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

In This Package:

LtbTraits_v3_8.cc
Go to the documentation of this file.
00001 /*
00002  *  LtbTraits_v3_8.cc
00003  *  LtbReadoutFormat
00004  *
00005  *  Created by Simon Patton on 7/21/10.
00006  *  Copyright 2010 DayaBay Collaboration. All rights reserved.
00007  *
00008  */
00009 #include "LtbReadoutFormat/LtbTraits_v3_8.h"
00010 
00011 #include <ctime>
00012 
00013 #include "DaqReadoutFormat/BitsDefinition.h"
00014 #include "DaqReadoutFormat/DaqBuffer.h"
00015 #include "LtbReadoutFormat/LtbTime.h"
00016 
00017 using DybDaq::DaqTraits;
00018 using DybDaq::LtbTime;
00019 using DybDaq::LtbTraits;
00020 using DybDaq::LtbTraits_v3_8;
00021 using std::string;
00022 
00023 static const unsigned int m_indices[] = {
00024     0U, // kRawTriggerTotal
00025     0U, // kRawTriggersSaved
00026     0U, // kLtbStatus
00027     0U, // kLocalTriggerNumber
00028     0U, // kFrameNumber
00029     0U, // kReadoutType
00030     0U, // kTriggerMask
00031     0U, // kYear
00032     0U, // kMonth
00033     0U, // kDay
00034     1U, // kHour
00035     1U, // kMinutes
00036     1U, // kSeconds
00037     2U, // kTicks
00038     4U, // kHitSum
00039     4U, // kTotalEsum
00040     4U, // kHighEsum
00041     4U, // kLowEsum
00042     4U, // kEnergySum
00043     5U, // kCrossTriggerSource
00044     0U  // kFootDataLength
00045 };
00046 
00047 static const unsigned int m_shifts[] = {
00048     22U, // kRawTriggerTotal
00049     16U, // kRawTriggersSaved
00050     8U,  // kLtbStatus
00051     0U,  // kLocalTriggerNumber
00052     18U, // kFrameNumber
00053     16U, // kReadoutType
00054     0U,  // kTriggerMask
00055     16U, // kYear
00056     8U,  // kMonth
00057     0U,  // kDay
00058     16U, // kHour
00059     8U,  // kMinutes
00060     0U,  // kSeconds
00061     0U,  // kTicks
00062     16U, // kHitSum
00063     14U, // kTotalEsum
00064     13U, // kHighEsum
00065     12U, // kLowEsum
00066     0U,  // kEnergySum
00067     0U,  // kCrossTriggerSource
00068     0U   // kFootDataLength
00069 };
00070 
00071 static const unsigned int m_masks[] = {
00072     0x0000003fU, // kRawTriggerTotal
00073     0x0000003fU, // kRawTriggersSaved
00074     0x000000ffU, // kLtbStatus
00075     0x000000ffU, // kLocalTriggerNumber
00076     0x0000003fU, // kFrameNumber
00077     0x00000003U, // kReadoutType
00078     0x0000ffffU, // kTriggerMask
00079     0x000000ffU, // kYear
00080     0x000000ffU, // kMonth
00081     0x000000ffU, // kDay
00082     0x000000ffU, // kHour
00083     0x000000ffU, // kMinutes
00084     0x000000ffU, // kSeconds
00085     0x07ffffffU, // kTicks
00086     0x000001ffU, // kHitSum
00087     0x00000001U, // kTotalEsum
00088     0x00000001U, // kHighEsum
00089     0x00000001U, // kLowEsum
00090     0x000007ffU, // kEnergySum
00091     0x0000003fU, // kCrossTriggerSource
00092     0x000000ffU  // kFootDataLength
00093 };
00094 
00095 static const std::string m_description[] = {
00096     "LTB Raw Trigger Total",
00097     "Number Raw Triggers Saved",
00098     "LTB status",
00099     "Local Trigger Seq. Number",
00100     "Frame Number in LTB Package",
00101     "LTB Readout Type",
00102     "LTB Trigger Mask",
00103     "Trigger Time's Year",
00104     "Trigger Time's Month",
00105     "Trigger Time's Day",
00106     "Trigger Time's Hour",
00107     "Trigger Time's Minutes",
00108     "Trigger Time's Seconds",
00109     "Trigger Time's Ticks",
00110     "Sum of Hits in FEE",
00111     "Total Energy Sum Comparison",
00112     "High Energy Sum Comparison",
00113     "Low Energy Sum Comparison",
00114     "ESUM ADC",
00115     "Cross Trigger Source",
00116     "LTB Package Data Length"
00117 };
00118 
00119 static const unsigned int kLtbHeadElements[] = {
00120     0U, // kRawTriggerTotal
00121     1U, // kRawTriggersSaved
00122     2U, // kLtbStatus
00123     3U  // kLocalTriggerNumber
00124 };
00125 
00126 static const unsigned int kLtbFrameFrontElements[] = {
00127     4U,  // kFrameNumber
00128     5U,  // kReadoutType
00129     6U,  // kTriggerMask
00130 };
00131 
00132 static const unsigned int kLtbTimeElements[] = {
00133     7U,  // kYear
00134     8U,  // kMonth
00135     9U,  // kDay
00136     10U, // kHour
00137     11U, // kMinutes
00138     12U, // kSeconds
00139     13U  // kTicks
00140 };
00141 
00142 static const unsigned int kLtbFrameBackElements[] = {
00143     14U, // kHitSum
00144     15U, // kTotalEsum
00145     16U, // kHighEsum
00146     17U, // kLowEsum
00147     18U, // kEnergySum
00148     19U  // kCrossTriggerSource
00149 };
00150 
00151 static const unsigned int kLtbFootElements[] = {
00152     20U // kFootDataLength
00153 };
00154 
00155 static const unsigned int* m_componentFields[] = {
00156     kLtbHeadElements,       // LTB Head
00157     kLtbFrameFrontElements, // LTB Frame Part 1
00158     kLtbTimeElements,       // LTB Time
00159     kLtbFrameBackElements,  // LTB Frame Part 2
00160     kLtbFootElements        // LTB Foot
00161 };
00162 
00163 static const unsigned int m_componentFieldsEnd[] = {
00164     4U, // LTB Head
00165     3U, // LTB Frame Part 1
00166     7U, // LTB Time
00167     6U, // LTB Frame Part 2
00168     1U, // LTB Foot
00169 };
00170 
00171 static DaqTraits::Definitions* m_definitions[] = {
00172     0, // LTB Header
00173     0, // LTB Frame Part 1
00174     0, // LTB Time
00175     0, // LTB Frame Part 2
00176     0  // LTB Foot
00177 };
00178 
00179 static const char* m_triggerLines[] = {
00180     "MANUAL_TRIGGER",
00181     "CROSS_TRIGGER_IN",
00182     "PERIODIC_TRIGGER",
00183     0,
00184     0,
00185     0,
00186     0,
00187     0,
00188     "MULTIPLICITY_TRIGGER",
00189     "ESUM_ADC_TRG",
00190     "HIGH_ESUM_COMP_TRG",
00191     "LOW_ESUM_COMP_TRG",
00192     "ALL_ESUM_COMP_TRG"
00193 };
00194 
00195 static const unsigned int m_triggerBits[] = {
00196     0x0001U, // kManualTrigger
00197     0x0002U, // kCrossTrigger
00198     0x0004U, // kPeriodicTrigger
00199     0x0008U,
00200     0x0010U,
00201     0x0020U,
00202     0x0040U,
00203     0x0080U,
00204     0x0100U, // kMultiplicityTrigger
00205     0x0200U, // kEsumAdcTrg
00206     0x0400U, // kHighEsumCompTrg
00207     0x0800U, // kLowEsumCompTrg
00208     0x1000U  // kAllEsumCompTrg
00209 };
00210 
00211 const char* LtbTraits_v3_8::key() {
00212         return "LTB Format 3.8";
00213 }
00214 
00215 LtbTraits_v3_8::LtbTraits_v3_8() {
00216 }
00217 
00218 LtbTraits_v3_8::~LtbTraits_v3_8() {
00219 }
00220 
00221 unsigned int LtbTraits_v3_8::majorVersion() const {
00222         return 3U;
00223 }
00224 
00225 unsigned int LtbTraits_v3_8::minorVersion() const {
00226         return 8U;
00227 }
00228 
00229 const string LtbTraits_v3_8::versionString() const {
00230         return key();
00231 }
00232 
00233 unsigned int LtbTraits_v3_8::headSize() const {
00234     return 1U;
00235 }
00236 
00237 unsigned int LtbTraits_v3_8::frameSize() const {
00238     return 6U;
00239 }
00240 
00241 unsigned int LtbTraits_v3_8::timeSize() const {
00242     return 3U;
00243 }
00244 
00245 unsigned int LtbTraits_v3_8::footSize() const {
00246     return 1U;
00247 }
00248 
00249 void LtbTraits_v3_8::initializeHead(char* buffer) const {
00250     *((unsigned int*)buffer)       = 0x40000000U; // Head four bytes
00251 }
00252 
00253 void LtbTraits_v3_8::initializeFrame(char* buffer) const {
00254     for (unsigned int count = 0;
00255          count != frameSize();
00256          ++count) {
00257         *((unsigned int*)(buffer + (count * DaqBuffer::kBytesInInt))) = 0x00000000U; // Frame four bytes
00258     }
00259 }
00260 
00261 void LtbTraits_v3_8::initializeTime(char* buffer) const {
00262     for (unsigned int count = 0;
00263          count != timeSize();
00264          ++count) {
00265         *((unsigned int*)(buffer + (count * DaqBuffer::kBytesInInt))) = 0x00000000U; // Time four bytes
00266     }
00267 }
00268 
00269 void LtbTraits_v3_8::initializeFoot(char* buffer) const {
00270     *((unsigned int*)buffer)       = 0xa0000000U; // Foot four bytes
00271 }
00272 
00273 unsigned int LtbTraits_v3_8::timeOffset() const {
00274     return 1U;
00275 }
00276 
00277 unsigned int LtbTraits_v3_8::markersEnd() const {
00278     return 0U;
00279 }
00280 
00281 const unsigned int* LtbTraits_v3_8::markers() const {
00282     return 0;
00283 }
00284 
00285 unsigned int LtbTraits_v3_8::fieldsEnd() const {
00286         return kFootDataLength + 1;
00287 }
00288 
00289 const unsigned int* LtbTraits_v3_8::indices() const {
00290         return m_indices;
00291 }
00292 
00293 const unsigned int* LtbTraits_v3_8::shifts() const {
00294         return m_shifts;
00295 }
00296 
00297 const unsigned int* LtbTraits_v3_8::masks() const {
00298         return m_masks;
00299 }
00300 
00301 const std::string* LtbTraits_v3_8::descriptions() const {
00302     return m_description;
00303 }
00304 
00305 DaqTraits::Definitions* LtbTraits_v3_8::definitions(unsigned int component) const {
00306     return m_definitions[component];
00307 }
00308 
00309 void LtbTraits_v3_8::setDefinitions(DaqTraits::Definitions* definitions,
00310                                     unsigned int component) {
00311     m_definitions[component] = definitions;
00312 }
00313 
00314 const unsigned int* LtbTraits_v3_8::componentFields(unsigned int component) const {
00315     return m_componentFields[component];
00316 }
00317 
00318 const unsigned int LtbTraits_v3_8::componentFieldsEnd(unsigned int component) const {
00319     return m_componentFieldsEnd[component];
00320 }
00321 
00322 unsigned int LtbTraits_v3_8::triggerLineEnd() const {
00323     return 13U;
00324 }
00325 
00326 const char** LtbTraits_v3_8::triggerLineStrings() const {
00327     return m_triggerLines;
00328 }
00329 
00330 const unsigned int* LtbTraits_v3_8::triggerLineBits() const {
00331     return m_triggerBits;
00332 }
00333 
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 09:53:06 for LtbReadoutFormat by doxygen 1.7.4