00001
00002
00003
00004
00005
00006
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,
00025 0U,
00026 0U,
00027 0U,
00028 0U,
00029 0U,
00030 0U,
00031 0U,
00032 0U,
00033 0U,
00034 1U,
00035 1U,
00036 1U,
00037 2U,
00038 4U,
00039 4U,
00040 4U,
00041 4U,
00042 4U,
00043 5U,
00044 0U
00045 };
00046
00047 static const unsigned int m_shifts[] = {
00048 22U,
00049 16U,
00050 8U,
00051 0U,
00052 18U,
00053 16U,
00054 0U,
00055 16U,
00056 8U,
00057 0U,
00058 16U,
00059 8U,
00060 0U,
00061 0U,
00062 16U,
00063 14U,
00064 13U,
00065 12U,
00066 0U,
00067 0U,
00068 0U
00069 };
00070
00071 static const unsigned int m_masks[] = {
00072 0x0000003fU,
00073 0x0000003fU,
00074 0x000000ffU,
00075 0x000000ffU,
00076 0x0000003fU,
00077 0x00000003U,
00078 0x0000ffffU,
00079 0x000000ffU,
00080 0x000000ffU,
00081 0x000000ffU,
00082 0x000000ffU,
00083 0x000000ffU,
00084 0x000000ffU,
00085 0x07ffffffU,
00086 0x000001ffU,
00087 0x00000001U,
00088 0x00000001U,
00089 0x00000001U,
00090 0x000007ffU,
00091 0x0000003fU,
00092 0x000000ffU
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,
00121 1U,
00122 2U,
00123 3U
00124 };
00125
00126 static const unsigned int kLtbFrameFrontElements[] = {
00127 4U,
00128 5U,
00129 6U,
00130 };
00131
00132 static const unsigned int kLtbTimeElements[] = {
00133 7U,
00134 8U,
00135 9U,
00136 10U,
00137 11U,
00138 12U,
00139 13U
00140 };
00141
00142 static const unsigned int kLtbFrameBackElements[] = {
00143 14U,
00144 15U,
00145 16U,
00146 17U,
00147 18U,
00148 19U
00149 };
00150
00151 static const unsigned int kLtbFootElements[] = {
00152 20U
00153 };
00154
00155 static const unsigned int* m_componentFields[] = {
00156 kLtbHeadElements,
00157 kLtbFrameFrontElements,
00158 kLtbTimeElements,
00159 kLtbFrameBackElements,
00160 kLtbFootElements
00161 };
00162
00163 static const unsigned int m_componentFieldsEnd[] = {
00164 4U,
00165 3U,
00166 7U,
00167 6U,
00168 1U,
00169 };
00170
00171 static DaqTraits::Definitions* m_definitions[] = {
00172 0,
00173 0,
00174 0,
00175 0,
00176 0
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,
00197 0x0002U,
00198 0x0004U,
00199 0x0008U,
00200 0x0010U,
00201 0x0020U,
00202 0x0040U,
00203 0x0080U,
00204 0x0100U,
00205 0x0200U,
00206 0x0400U,
00207 0x0800U,
00208 0x1000U
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;
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;
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;
00266 }
00267 }
00268
00269 void LtbTraits_v3_8::initializeFoot(char* buffer) const {
00270 *((unsigned int*)buffer) = 0xa0000000U;
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