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

In This Package:

EventTraits_v0_6.cc
Go to the documentation of this file.
00001 /*
00002  *  EventTraits_v0_6.cc
00003  *  RawFileReading
00004  *
00005  *  Created by Simon Patton on 7/19/10.
00006  *  Copyright 2010 DayaBay Collaboration. All rights reserved.
00007  *
00008  */
00009 
00010 #include "EventReadoutFormat/EventTraits_v0_6.h"
00011 
00012 #include "DaqReadoutFormat/BitsDefinition.h"
00013 #include "DaqReadoutFormat/DaqBuffer.h"
00014 
00015 using DybDaq::DaqTraits;
00016 using DybDaq::EventTraits_v0_6;
00017 using std::string;
00018 
00019 static const unsigned int m_markers[] = {
00020     0xaa1234aaU, // Event Header
00021     0xbb1234bbU  // ROM fragment Header
00022 };
00023 
00024 static const unsigned int m_headerLengths[] = {
00025     8U, // Event Header
00026     3U  // ROM fragment Header
00027 };
00028 
00029 static const unsigned int m_indices[] = {
00030         0U, // kMarker
00031         1U, // kMajorVersion
00032         1U, // kMinorVersion
00033         2U, // kEventHeaderSize
00034         2U, // kEventTotalSize
00035         3U, // kEventSite
00036         3U, // kEventDetector
00037         4U, // kEventRun
00038         5U, // kEventNumber
00039         6U, // kEventDataType
00040         7U, // kCbltWrapping
00041         7U, // kRawCblt
00042         7U, // kLtbMismatch
00043         7U, // kInvalidData
00044         1U, // kRomHeaderSize
00045         1U, // kRomTotalSize
00046         2U, // kRomSite
00047         2U, // kRomDetector
00048         2U, // kRomModuleType
00049         2U  // kRomSlot
00050 };
00051 
00052 static const unsigned int m_shifts[] = {
00053         0U,  // kMarker
00054         24U, // kMajorVersion
00055         16U, // kMinorVersion
00056         24U, // kEventHeaderSize
00057         0U,  // kEventTotalSize
00058         20U, // kEventSite
00059         16U, // kEventDetector
00060         0U,  // kEventRun
00061         0U,  // kEventNumber
00062         28U, // kEventDataType
00063         17U, // kCbltWrapping
00064         16U, // kRawCblt
00065         1U,  // kLtbMismatch
00066         0U,  // kInvalidData
00067         24U, // kRomHeaderSize
00068         0U,  // kRomTotalSize
00069         20U, // kRomSite
00070         16U, // kRomDetector
00071         8U,  // kRomModuleType
00072         0U   // kRomSlot
00073 };
00074 
00075 static const unsigned int m_masks[] = {
00076         0xffffffffU, // kMarker
00077         0x000000ffU, // kMajorVersion
00078         0x000000ffU, // kMinorVersion
00079         0x000000ffU, // kEventHeaderSize
00080         0x00ffffffU, // kEventTotalSize
00081         0x0000000fU, // kEventSite
00082         0x0000000fU, // kEventDetector
00083         0xffffffffU, // kEventRun
00084         0xffffffffU, // kEventNumber
00085         0x0000000fU, // kEventDataType
00086         0x00000001U, // kCbltWrapping
00087         0x00000001U, // kRawCblt
00088         0x00000001U, // kLtbMismatch
00089         0x00000001U, // kInvalidData
00090         0x000000ffU, // kRomHeaderSize
00091         0x00ffffffU, // kRomTotalSize
00092         0x0000000fU, // kRomSite
00093         0x0000000fU, // kRomDetector
00094         0x000000ffU, // kRomModuleType
00095         0x000000ffU  // kRomSlot
00096 };
00097 
00098 static const std::string m_description[] = {
00099     "Event Record Type",
00100     "Major File Format Version",
00101     "Minor File Format Version",
00102     "Event Header Size",
00103     "Total Event Size",
00104     "Event Site",
00105     "Event Detector",
00106     "Event Run",
00107     "Event Number",
00108     "Event Data Type",
00109     "CBLT Wrapping",
00110     "Raw CBLT Data",
00111     "LTB Mismatch",
00112     "Invalid Data",
00113     "ROM Header Size",
00114     "ROM Event Size",
00115     "ROM Site",
00116     "ROM Detector",
00117     "ROM Module Type",
00118     "ROM Slot"
00119 };
00120 
00121 static const unsigned int kEventHeaderElements[] = {
00122         0U,  // kMarker
00123         1U,  // kMajorVersion
00124         2U,  // kMinorVersion
00125         3U,  // kEventHeaderSize
00126         4U,  // kEventTotalSize
00127         5U,  // kEventSite
00128         6U,  // kEventDetector
00129         7U,  // kEventRun
00130         8U,  // kEventNumber
00131         9U,  // kEventDataType
00132         10U, // kCbltWrapping
00133         11U, // kRawCblt
00134         12U, // kLtbMismatch
00135         13U  // kInvalidData
00136 };
00137 
00138 static const unsigned int kRomHeaderElements[] = {
00139         0U,  // kMarker
00140         14U, // kRomHeaderSize
00141         15U, // kRomTotalSize
00142         16U, // kRomSite
00143         17U, // kRomDetector
00144         18U, // kRomModuleType
00145         19U  // kRomSlot
00146 };
00147 
00148 static const unsigned int* m_componentFields[] = {
00149     kEventHeaderElements, // Event Header
00150     kRomHeaderElements    // ROM fragment Header
00151 };
00152 
00153 static const unsigned int m_componentFieldsEnd[] = {
00154     14U, // Event Header
00155     7U   // ROM fragment Header
00156 };
00157 
00158 static DaqTraits::Definitions* m_definitions[] = {
00159     0, // Event Header
00160     0  // ROM fragment Header
00161 };
00162 
00163 static const char* m_sites[] = {
00164     "TST",
00165     "DYB",
00166     "LAN",
00167     "FAR",
00168     "MID",
00169     "FIL",
00170     "SAB",
00171     "UNK"
00172 };
00173 
00174 static const char* m_detectors[] = {
00175     "TST",
00176     "AD1",
00177     "AD2",
00178     "AD3",
00179     "AD4",
00180     "IWP",
00181     "OWP",
00182     "RPC"
00183 };
00184 
00185 static const char* m_dataTypes[] = {
00186     "NORMAL",
00187     "CALIBRATION",
00188     "ELECTRONICS_CALIBRATION",
00189     "PEDESTAL"
00190 };
00191 
00192 static const unsigned int m_moduleTypes[] = {
00193     1U, // kFeeModule
00194     2U, // kFadcModule
00195     3U, // kLtbModule
00196     4U, // kRpcRomModule
00197     5U, // kRpcRtmModule
00198     6U  // kMtbModule
00199 };
00200 
00201 static const char* m_moduleTypeStrings[] = {
00202     "UNK",
00203     "PMT_FEE",
00204     "Flash_ADC",
00205     "Local_Trigger",
00206     "RPC_ROM",
00207     "RPC_RTM",
00208     "Master_Trigger"
00209 };
00210 
00211 const char* EventTraits_v0_6::key() {
00212         return "Event Format 0.6";
00213 }
00214 
00215 EventTraits_v0_6::EventTraits_v0_6() {
00216 }
00217 
00218 EventTraits_v0_6::~EventTraits_v0_6() {
00219 }
00220 
00221 unsigned int EventTraits_v0_6::majorVersion() const {
00222         return 0U;
00223 }
00224 
00225 unsigned int EventTraits_v0_6::minorVersion() const {
00226         return 6U;
00227 }
00228 
00229 const string EventTraits_v0_6::versionString() const {
00230         return key();
00231 }
00232 
00233 unsigned int EventTraits_v0_6::headerSize(const unsigned int marker) const {
00234         if (marker >= markersEnd()) {
00235                 return illegalMarker();
00236         }
00237         return m_headerLengths[marker];
00238 }
00239 
00240 void EventTraits_v0_6::initializeHeader(const unsigned int markerToInit,
00241                                         char* buffer) const {
00242     for (unsigned int count = 0;
00243          count != headerSize(markerToInit);
00244          ++count) {
00245         *((unsigned int*)(buffer + (count * DaqBuffer::kBytesInInt))) = 0x00000000U; // Header four bytes
00246     }
00247     *((unsigned int*)buffer) = marker(markerToInit);
00248     if (markerToInit == kEventHeader) {
00249         *(((unsigned int*)buffer) + index(EventTraits::kEventDetector)) = 0xC0000000U;
00250     }
00251 }
00252 
00253 unsigned int EventTraits_v0_6::markersEnd() const {
00254     return kRomHeader + 1;
00255 }
00256 
00257 const unsigned int* EventTraits_v0_6::markers() const {
00258     return m_markers;
00259 }
00260 
00261 unsigned int EventTraits_v0_6::fieldsEnd() const {
00262         return kRomSlot + 1;
00263 }
00264 
00265 const unsigned int* EventTraits_v0_6::indices() const {
00266         return m_indices;
00267 }
00268 
00269 const unsigned int* EventTraits_v0_6::shifts() const {
00270         return m_shifts;
00271 }
00272 
00273 const unsigned int* EventTraits_v0_6::masks() const {
00274         return m_masks;
00275 }
00276 
00277 const std::string* EventTraits_v0_6::descriptions() const {
00278     return m_description;
00279 }
00280 
00281 DaqTraits::Definitions* EventTraits_v0_6::definitions(unsigned int component) const {
00282     return m_definitions[component];
00283 }
00284 
00285 void EventTraits_v0_6::setDefinitions(DaqTraits::Definitions* definitions,
00286                                       unsigned int component) {
00287     m_definitions[component] = definitions;
00288 }
00289 
00290 const unsigned int* EventTraits_v0_6::componentFields(unsigned int component) const {
00291     return m_componentFields[component];
00292 }
00293 
00294 const unsigned int EventTraits_v0_6::componentFieldsEnd(unsigned int component) const {
00295     return m_componentFieldsEnd[component];
00296 }
00297 
00298 unsigned int EventTraits_v0_6::maxSite() const {
00299         return 7U;
00300 }
00301 
00302 const char** EventTraits_v0_6::siteStrings() const {
00303     return m_sites;
00304 }
00305 
00306 unsigned int EventTraits_v0_6::maxDetector() const {
00307         return 7U;
00308 }
00309 
00310 const char** EventTraits_v0_6::detectorStrings() const {
00311     return m_detectors;
00312 }
00313 
00314 unsigned int EventTraits_v0_6::maxDataType() const {
00315         return 3U;
00316 }
00317 
00318 const char** EventTraits_v0_6::dataTypeStrings() const {
00319     return m_dataTypes;
00320 }
00321 
00322 unsigned int EventTraits_v0_6::maxModuleType() const {
00323     return kMtbModule;
00324 }
00325 
00326 const unsigned int* EventTraits_v0_6::moduleTypes() const {
00327         return m_moduleTypes;
00328 }
00329 
00330 const char** EventTraits_v0_6::moduleTypeStrings() const {
00331     return m_moduleTypeStrings;
00332 }
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:53:15 for EventReadoutFormat by doxygen 1.7.4