/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

FadcTraits_v1_2.cc
Go to the documentation of this file.
00001 /*
00002  *  FadcTraits_v1_2.cc
00003  *  CbltReadoutFormat
00004  *
00005  *  Created by Simon Patton on 9/2/10.
00006  *  Copyright 2010 DayaBay Collaboration. All rights reserved.
00007  *
00008  */
00009 
00010 #include "FadcReadoutFormat/FadcTraits_v1_2.h"
00011 
00012 #include "DaqReadoutFormat/BitsDefinition.h"
00013 
00014 using DybDaq::DaqTraits;
00015 using DybDaq::FadcTraits_v1_2;
00016 using std::string;
00017 
00018 static const unsigned int m_indices[] = {
00019     0U, // kHeadTriggerNumber
00020     0U, // kMajorVersion
00021     0U, // kMinorVersion
00022     0U, // kTriggerType
00023     0U, // kNoData
00024     0U, // kChannelId
00025     0U, // kHighDataByte
00026     0U, // kMiddleDataByte
00027     0U, // kLowDataByte
00028     0U, // kFootTriggerNumber
00029     0U, // kFootDataLength
00030     0U, // kHeadMarker
00031     0U, // kAdcDataMarker
00032     0U  // kFootMarker
00033 };
00034 
00035 static const unsigned int m_shifts[] = {
00036     0U,  // kHeadTriggerNumber
00037     0U,  // kMajorVersion
00038     0U,  // kMinorVersion
00039     16U, // kTriggerType
00040     15U, // kNoData
00041     24U, // kChannelId
00042     16U, // kHighDataByte
00043     8U,  // kMiddleDataByte
00044     0U,  // kLowDataByte
00045     16U, // kFootTriggerNumber
00046     0U,  // kFootDataLength
00047     28U, // kHeadMarker
00048     29U, // kAdcDataMarker
00049     28U  // kFootMarker
00050 };
00051 
00052 static const unsigned int m_masks[] = {
00053     0x000000ffU, // kHeadTriggerNumber
00054     0x00000000U, // kMajorVersion
00055     0x00000000U, // kMinorVersion
00056     0x0000000fU, // kTriggerType
00057     0x00000001U, // kNoData
00058     0x0000000fU, // kChannelId
00059     0x000000ffU, // kHighDataByte
00060     0x000000ffU, // kMiddleDataByte
00061     0x000000ffU, // kLowDataByte
00062     0x000000ffU, // kFootTriggerNumber
00063     0x0000ffffU, // kFootDataLength
00064     0x0000000fU, // kHeadMarker
00065     0x00000007U, // kAdcDataMarker
00066     0x0000000fU  // kFootMarker
00067 };
00068 
00069 static const std::string m_description[] = {
00070     "FADC Trigger Number",
00071     "FADC Major Format Version",
00072     "FADC Minor Format Version",
00073     "FADC Trigger Type",
00074     "FADC Has No Data",
00075     "FADC Channel Id",
00076     "FADC High Data Byte",
00077     "FADC Middle Data Byte",
00078     "FADC Low Data Byte",
00079     "FADC Trigger Number",
00080     "FADC Data Length",
00081     "FADC Head Marker (0x4)",
00082     "FADC ADC Data Marker (0x3)",
00083     "FADC Foot Marker (0xa)"
00084 };
00085 
00086 static const unsigned int kFdcHeadElements[] = {
00087     11U, // kHeadMarker
00088     3U,  // kTriggerType
00089     4U,  // kNoData
00090     0U   // kHeadTriggerNumber
00091 };
00092 
00093 static const unsigned int kFdcDataElements[] = {
00094     12U, // kAdcDataMarker
00095     5U,  // kChannelId
00096     6U,  // kHighDataByte
00097     7U,  // kMiddleDataByte
00098     8U   // kLowDataByte
00099 };
00100 
00101 static const unsigned int kFdcFootElements[] = {
00102     13U, // kFootMarker
00103     9U,  // kFootTriggerNumber
00104     10U  // kFootDataLength
00105 };
00106 
00107 static const unsigned int* m_componentFields[] = {
00108     kFdcHeadElements, // FADC Head
00109     kFdcDataElements, // FADC Data
00110     kFdcFootElements  // FADC Foot
00111 };
00112 
00113 static const unsigned int m_componentFieldsEnd[] = {
00114     4U, // FADC Head
00115     5U, // FADC Data
00116     3U  // FADC Foot
00117 };
00118 
00119 static DaqTraits::Definitions* m_definitions[] = {
00120     0, // FADC Head
00121     0, // FADC Data
00122     0  // FADC Foot
00123 };
00124 
00125 static const char* m_triggerTypes[] = {
00126     "self",
00127     "external",
00128 };
00129 
00130 const char* FadcTraits_v1_2::key() {
00131         return "FADC Format 1.2";
00132 }
00133 
00134 FadcTraits_v1_2::FadcTraits_v1_2() {
00135 }
00136 
00137 FadcTraits_v1_2::~FadcTraits_v1_2() {
00138 }
00139 
00140 unsigned int FadcTraits_v1_2::majorVersion() const {
00141         return 1U;
00142 }
00143 
00144 unsigned int FadcTraits_v1_2::minorVersion() const {
00145         return 2U;
00146 }
00147 
00148 const string FadcTraits_v1_2::versionString() const {
00149         return key();
00150 }
00151 
00152 unsigned int FadcTraits_v1_2::headSize() const {
00153     return 1U;
00154 }
00155 
00156 unsigned int FadcTraits_v1_2::dataSize() const {
00157     return 1U;
00158 }
00159 
00160 unsigned int FadcTraits_v1_2::footSize() const {
00161     return 1U;
00162 }
00163 
00164 void FadcTraits_v1_2::initializeHead(char* buffer) const {
00165     *((unsigned int*)buffer)       = 0x40000000U; // Head four bytes
00166 }
00167 
00168 void FadcTraits_v1_2::initializeData(char* buffer) const {
00169     *((unsigned int*)buffer)       = 0x60000000U; // Data four bytes
00170 }
00171 
00172 void FadcTraits_v1_2::initializeFoot(char* buffer) const {
00173     *((unsigned int*)buffer)       = 0xa0000000U; // Foot four bytes
00174 }
00175 
00176 unsigned int FadcTraits_v1_2::markersEnd() const {
00177     return 0U;
00178 }
00179 
00180 const unsigned int* FadcTraits_v1_2::markers() const {
00181     return 0;
00182 }
00183 
00184 unsigned int FadcTraits_v1_2::fieldsEnd() const {
00185         return kFootMarker + 1;
00186 }
00187 
00188 const unsigned int* FadcTraits_v1_2::indices() const {
00189         return m_indices;
00190 }
00191 
00192 const unsigned int* FadcTraits_v1_2::shifts() const {
00193         return m_shifts;
00194 }
00195 
00196 const unsigned int* FadcTraits_v1_2::masks() const {
00197         return m_masks;
00198 }
00199 
00200 const std::string* FadcTraits_v1_2::descriptions() const {
00201     return m_description;
00202 }
00203 
00204 DaqTraits::Definitions* FadcTraits_v1_2::definitions(unsigned int component) const {
00205     return m_definitions[component];
00206 }
00207 
00208 void FadcTraits_v1_2::setDefinitions(DaqTraits::Definitions* definitions,
00209                                      unsigned int component) {
00210     m_definitions[component] = definitions;
00211 }
00212 
00213 const unsigned int* FadcTraits_v1_2::componentFields(unsigned int component) const {
00214     return m_componentFields[component];
00215 }
00216 
00217 const unsigned int FadcTraits_v1_2::componentFieldsEnd(unsigned int component) const {
00218     return m_componentFieldsEnd[component];
00219 }
00220 
00221 unsigned int FadcTraits_v1_2::triggerTypeEnd() const {
00222     return 2U;
00223 }
00224 
00225 const char** FadcTraits_v1_2::triggerTypeStrings() const {
00226     return m_triggerTypes;
00227 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:52:58 for FadcReadoutFormat by doxygen 1.7.4