00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "FileReadoutFormat/FileTraits_v0_7.h"
00011
00012 #include "DaqReadoutFormat/BitsDefinition.h"
00013
00014 using DybDaq::DaqTraits;
00015 using DybDaq::FileTraits;
00016 using DybDaq::FileTraits_v0_7;
00017 using std::string;
00018
00019 static const unsigned int m_markers[] = {
00020 0x1234aaaaU,
00021 0x1234aabbU,
00022 0x1234aabcU,
00023 0x1234bbbbU,
00024 0x1234bbddU,
00025 0x1234ccccU,
00026 0x1234ddddU,
00027 0x1234eeeeU
00028 };
00029
00030 static const unsigned int m_recordSizes[] = {
00031 8U,
00032 2U,
00033 3U,
00034 6U,
00035 21U,
00036 4U,
00037 10U,
00038 0U
00039 };
00040
00041 static const unsigned int m_indices[] = {
00042 0U,
00043 1U,
00044 2U,
00045 2U,
00046 3U,
00047 4U,
00048 5U,
00049 6U,
00050 7U,
00051 2U,
00052 2U,
00053 3U,
00054 2U,
00055 3U,
00056 4U,
00057 5U,
00058 2U,
00059 4U,
00060 5U,
00061 6U,
00062 7U,
00063 12U,
00064 14U,
00065 2U,
00066 3U,
00067 2U,
00068 3U,
00069 4U,
00070 5U,
00071 6U,
00072 7U,
00073 8U,
00074 9U,
00075 3U,
00076 8U,
00077 9U,
00078 10U,
00079 11U,
00080 13U
00081 };
00082
00083 static const unsigned int m_shifts[] = {
00084 0U,
00085 0U,
00086 0U,
00087 0U,
00088 0U,
00089 0U,
00090 0U,
00091 0U,
00092 0U,
00093 0U,
00094 0U,
00095 0U,
00096 0U,
00097 0U,
00098 0U,
00099 0U,
00100 0U,
00101 0U,
00102 0U,
00103 0U,
00104 0U,
00105 0U,
00106 0U,
00107 0U,
00108 0U,
00109 0U,
00110 0U,
00111 0U,
00112 0U,
00113 0U,
00114 0U,
00115 0U,
00116 0U,
00117 0U,
00118 0U,
00119 0U,
00120 0U,
00121 0U,
00122 0U
00123 };
00124
00125 static const unsigned int m_masks[] = {
00126 0xffffffffU,
00127 0xffffffffU,
00128 0x00000000U,
00129 0xffffffffU,
00130 0xffffffffU,
00131 0xffffffffU,
00132 0xffffffffU,
00133 0xffffffffU,
00134 0xffffffffU,
00135 0xffffffffU,
00136 0xffffffffU,
00137 0xffffffffU,
00138 0xffffffffU,
00139 0x00000001U,
00140 0xffffffffU,
00141 0xffffffffU,
00142 0xffffffffU,
00143 0xffffffffU,
00144 0xffffffffU,
00145 0xffffffffU,
00146 0xffffffffU,
00147 0xffffffffU,
00148 0xffffffffU,
00149 0xffffffffU,
00150 0xffffffffU,
00151 0xffffffffU,
00152 0xffffffffU,
00153 0xffffffffU,
00154 0xffffffffU,
00155 0xffffffffU,
00156 0xffffffffU,
00157 0xffffffffU,
00158 0xffffffffU,
00159 0xffffffffU,
00160 0xffffffffU,
00161 0xffffffffU,
00162 0xffffffffU,
00163 0xffffffffU,
00164 0xffffffffU
00165 };
00166
00167 static const std::string m_description[] = {
00168 "File Record Type",
00169 "File Record Size",
00170 "Major File Format Version",
00171 "Minor File Format Version",
00172 "File Sequence Number",
00173 "File Open Date",
00174 "File Open Time",
00175 "File Data Block Limit",
00176 "File Payload MB Limit",
00177 "Length of first File Name",
00178 "Number of Metadata entries",
00179 "Length of first Metadata",
00180 "Run Number",
00181 "Run Enabled",
00182 "Run Tigger Type",
00183 "Run Detector Mask",
00184 "Calibration Detector Id",
00185 "Calibration Axis",
00186 "Calibration Source Id",
00187 "Calibration Z Position",
00188 "Calibration Duration",
00189 "Calibration LED Frequency",
00190 "Calibration LTB Mode",
00191 "Data Block Number",
00192 "Data Block Length",
00193 "File Close Date",
00194 "File Close Time",
00195 "File Data Block Count",
00196 "File Payload size in MB",
00197 "Run Data Block Count",
00198 "Run Payload size in MB ",
00199 "End of File Status",
00200 "End of File Marker",
00201 "Calibration AD Number",
00202 "Calibration LED 1",
00203 "Calibration LED 2",
00204 "Calibration LED 1 Voltage",
00205 "Calibration LED 2 Voltage",
00206 "Calibration LED Pulse Sep."
00207 };
00208
00209 static const unsigned int kFileStartElements[] = {
00210 0U,
00211 1U,
00212 3U,
00213 4U,
00214 5U,
00215 6U,
00216 7U,
00217 8U
00218 };
00219
00220 static const unsigned int kFileNameElements[] = {
00221 0U,
00222 1U,
00223 9U
00224 };
00225
00226 static const unsigned int kMetadataElements[] = {
00227 0U,
00228 1U,
00229 10U,
00230 11U
00231 };
00232
00233 static const unsigned int kRunParameterElements[] = {
00234 0U,
00235 1U,
00236 12U,
00237 13U,
00238 14U,
00239 15U
00240 };
00241
00242 static const unsigned int kCalibrationElements[] = {
00243 0U,
00244 1U,
00245 16U,
00246 17U,
00247 18U,
00248 19U,
00249 20U,
00250 21U,
00251 22U,
00252 33U,
00253 34U,
00254 35U,
00255 36U,
00256 37U,
00257 38U
00258 };
00259
00260 static const unsigned int kDataSeparatorElements[] = {
00261 0U,
00262 1U,
00263 23U,
00264 24U
00265 };
00266
00267 static const unsigned int kFileEndElements[] = {
00268 0U,
00269 1U,
00270 25U,
00271 26U,
00272 27U,
00273 28U,
00274 29U,
00275 30U,
00276 31U,
00277 32U
00278 };
00279
00280 static const unsigned int* m_componentFields[] = {
00281 kFileStartElements,
00282 kFileNameElements,
00283 kMetadataElements,
00284 kRunParameterElements,
00285 kCalibrationElements,
00286 kDataSeparatorElements,
00287 kFileEndElements
00288 };
00289
00290 static const unsigned int m_componentFieldsEnd[] = {
00291 8U,
00292 3U,
00293 4U,
00294 6U,
00295 15U,
00296 4U,
00297 10U
00298 };
00299
00300 static DaqTraits::Definitions* m_definitions[] = {
00301 0,
00302 0,
00303 0,
00304 0,
00305 0,
00306 0,
00307 0
00308 };
00309
00310 static const char* m_detectors[] = {
00311 "TST-TST",
00312 "DBN-AD1",
00313 "DBN-AD2",
00314 "UNK",
00315 "UNK",
00316 "DBN-WPI",
00317 "DBN-WPO",
00318 "DBN-RPC",
00319 "UNK",
00320 "LAN-AD1",
00321 "LAN-AD2",
00322 "UNK",
00323 "UNK",
00324 "LAN-WPI",
00325 "LAN-WPO",
00326 "LAN-RPC",
00327 "UNK",
00328 "FAR-AD1",
00329 "FAR-AD2",
00330 "FAR-AD3",
00331 "FAR-AD4",
00332 "FAR-WPI",
00333 "FAR-WPO",
00334 "FAR-RPC"
00335 };
00336
00337 const char* FileTraits_v0_7::key() {
00338 return "File Format 0.7";
00339 }
00340
00341 FileTraits_v0_7::FileTraits_v0_7() {
00342 }
00343
00344 FileTraits_v0_7::~FileTraits_v0_7() {
00345 }
00346
00347 unsigned int FileTraits_v0_7::majorVersion() const {
00348 return 0U;
00349 }
00350
00351 unsigned int FileTraits_v0_7::minorVersion() const {
00352 return 7U;
00353 }
00354
00355 const string FileTraits_v0_7::versionString() const {
00356 return key();
00357 }
00358
00359 unsigned int FileTraits_v0_7::markersEnd() const {
00360 return kEndFileMarker + 1;
00361 }
00362
00363 const unsigned int* FileTraits_v0_7::recordSizes() const {
00364 return m_recordSizes;
00365 }
00366
00367 unsigned int FileTraits_v0_7::detectorListEnd() const {
00368 return 24U;
00369 }
00370
00371 const char** FileTraits_v0_7::detectorStrings() const {
00372 return m_detectors;
00373 }
00374
00375
00376 const unsigned int* FileTraits_v0_7::markers() const {
00377 return m_markers;
00378 }
00379
00380 unsigned int FileTraits_v0_7::fieldsEnd() const {
00381 return kCalibrationLedPulseSeparation + 1;
00382 }
00383
00384 const unsigned int* FileTraits_v0_7::indices() const {
00385 return m_indices;
00386 }
00387
00388 const unsigned int* FileTraits_v0_7::shifts() const {
00389 return m_shifts;
00390 }
00391
00392 const unsigned int* FileTraits_v0_7::masks() const {
00393 return m_masks;
00394 }
00395
00396 const std::string* FileTraits_v0_7::descriptions() const {
00397 return m_description;
00398 }
00399
00400 DaqTraits::Definitions* FileTraits_v0_7::definitions(unsigned int component) const {
00401 return m_definitions[component];
00402 }
00403
00404 void FileTraits_v0_7::setDefinitions(DaqTraits::Definitions* definitions,
00405 unsigned int component) {
00406 m_definitions[component] = definitions;
00407 }
00408
00409 const unsigned int* FileTraits_v0_7::componentFields(unsigned int component) const {
00410 return m_componentFields[component];
00411 }
00412
00413 const unsigned int FileTraits_v0_7::componentFieldsEnd(unsigned int component) const {
00414 return m_componentFieldsEnd[component];
00415 }