CMS 3D CMS Logo

HcalTBTriggerDataUnpacker.cc
Go to the documentation of this file.
4 #include <iostream>
5 
6 using namespace std;
7 
8 // Structure for "old" TriggerData - contains header and trailer
9 //
11  uint32_t cdfHeader[4];
12  uint32_t triggerWord;
13  uint32_t triggerNumber;
14  uint32_t triggerTime_usec;
15  uint32_t triggerTime_base;
16  uint32_t spillNumber;
17  uint32_t runNumber;
18  char runNumberSequenceId[16];
19  uint32_t orbitNumber;
20  uint32_t bunchNumber;
21  uint32_t eventStatus;
22  uint32_t filler1;
23  uint32_t cdfTrailer[2];
24 };
25 
26 // structures for "new" trigger data format - does NOT
27 // contain header or trailer (header size is variable -
28 // either 64 or 128 bits)
29 //
30 typedef struct StandardTrgMsgBlkStruct {
31  uint32_t orbitNumber;
32  uint32_t eventNumber;
33  uint32_t flags_daq_ttype;
34  uint32_t algo_bits_3;
35  uint32_t algo_bits_2;
36  uint32_t algo_bits_1;
37  uint32_t algo_bits_0;
38  uint32_t tech_bits;
39  uint32_t gps_1234;
40  uint32_t gps_5678;
42 
43 typedef struct newExtendedTrgMsgBlkStruct {
44  StandardTrgMsgBlk stdBlock;
45  uint32_t triggerWord;
46  uint32_t triggerTime_usec;
47  uint32_t triggerTime_base;
48  uint32_t spillNumber;
49  uint32_t runNumber;
50  char runNumberSequenceId[16];
51  uint32_t eventStatus;
53 
54 namespace hcaltb {
55 
57  // Use the size to determine which format we have received:
58  //
59  if (raw.size() == 80) { // "old" test beam trigger format
60 
61  const oldTriggerDataFormat *oldtrgblk = (const oldTriggerDataFormat *)(raw.data());
62  htbtd.setStandardData(oldtrgblk->orbitNumber,
63  oldtrgblk->triggerNumber,
64  oldtrgblk->bunchNumber,
65  0, // flags_daq_ttype
66  0,
67  0,
68  0,
69  0, // algo_bits_3->0
70  0, // tech_bits
71  0,
72  0 // gps_1234, gps_5678
73  );
74 
75  htbtd.setExtendedData(oldtrgblk->triggerWord,
76  oldtrgblk->triggerTime_usec,
77  oldtrgblk->triggerTime_base,
78  oldtrgblk->spillNumber,
79  oldtrgblk->runNumber,
80  oldtrgblk->runNumberSequenceId);
81  } else {
82  const newExtendedTrgMsgBlk *newtrgblk;
83 
84  if (raw.size() == 96) // "new" test beam trigger format,
85  // 64-bit header
86  newtrgblk = (const newExtendedTrgMsgBlk *)(raw.data() + 8);
87 
88  else if (raw.size() == 104) // "new" test beam trigger format,
89  // 128-bit header
90  newtrgblk = (const newExtendedTrgMsgBlk *)(raw.data() + 16);
91  else {
92  cerr << "HcalTBtdUnpacker.unpack: data of unknown size ";
93  cerr << raw.size() << endl;
94  return;
95  }
96 
97  // get bunch number from the header
98  //
99  const uint32_t *cdflow = (const uint32_t *)raw.data();
100  int bunch_id = (*cdflow) >> 20;
101 
102  htbtd.setStandardData(newtrgblk->stdBlock.orbitNumber,
103  newtrgblk->stdBlock.eventNumber,
104  bunch_id,
105  newtrgblk->stdBlock.flags_daq_ttype,
106  newtrgblk->stdBlock.algo_bits_3,
107  newtrgblk->stdBlock.algo_bits_2,
108  newtrgblk->stdBlock.algo_bits_1,
109  newtrgblk->stdBlock.algo_bits_0,
110  newtrgblk->stdBlock.tech_bits,
111  newtrgblk->stdBlock.gps_1234,
112  newtrgblk->stdBlock.gps_5678);
113 
114  htbtd.setExtendedData(newtrgblk->triggerWord,
115  newtrgblk->triggerTime_usec,
116  newtrgblk->triggerTime_base,
117  newtrgblk->spillNumber,
118  newtrgblk->runNumber,
119  newtrgblk->runNumberSequenceId);
120  }
121  }
122 } // namespace hcaltb
oldTriggerDataFormat::triggerTime_base
uint32_t triggerTime_base
Definition: HcalTBTriggerDataUnpacker.cc:15
StandardTrgMsgBlkStruct
Definition: HcalTBWriter.cc:111
oldTriggerDataFormat::runNumberSequenceId
char runNumberSequenceId[16]
Definition: HcalTBTriggerDataUnpacker.cc:18
StandardTrgMsgBlk
struct StandardTrgMsgBlkStruct StandardTrgMsgBlk
oldTriggerDataFormat::runNumber
uint32_t runNumber
Definition: HcalTBTriggerDataUnpacker.cc:17
HcalTBTriggerData::setExtendedData
void setExtendedData(uint32_t triggerWord, uint32_t triggerTime_usec, uint32_t triggerTime_base, uint32_t spillNumber, uint32_t runNumber, const char *runNumberSequenceId)
Definition: HcalTBTriggerData.cc:61
HcalTBTriggerData.h
StandardTrgMsgBlkStruct::orbitNumber
uint32_t orbitNumber
Definition: HcalTBWriter.cc:112
StandardTrgMsgBlkStruct::algo_bits_1
uint32_t algo_bits_1
Definition: HcalTBWriter.cc:117
newExtendedTrgMsgBlkStruct::triggerTime_base
uint32_t triggerTime_base
Definition: HcalTBWriter.cc:128
FEDRawData.h
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
newExtendedTrgMsgBlkStruct::runNumberSequenceId
char runNumberSequenceId[16]
Definition: HcalTBWriter.cc:131
FEDRawData
Definition: FEDRawData.h:19
convertSQLiteXML.runNumber
runNumber
Definition: convertSQLiteXML.py:91
oldTriggerDataFormat::triggerNumber
uint32_t triggerNumber
Definition: HcalTBTriggerDataUnpacker.cc:13
newExtendedTrgMsgBlkStruct::triggerWord
uint32_t triggerWord
Definition: HcalTBWriter.cc:126
newExtendedTrgMsgBlkStruct::runNumber
uint32_t runNumber
Definition: HcalTBWriter.cc:130
newExtendedTrgMsgBlkStruct::spillNumber
uint32_t spillNumber
Definition: HcalTBWriter.cc:129
newExtendedTrgMsgBlkStruct::stdBlock
StandardTrgMsgBlk stdBlock
Definition: HcalTBWriter.cc:125
oldTriggerDataFormat::bunchNumber
uint32_t bunchNumber
Definition: HcalTBTriggerDataUnpacker.cc:20
StandardTrgMsgBlkStruct::gps_5678
uint32_t gps_5678
Definition: HcalTBWriter.cc:121
hcaltb
Definition: HcalTBQADCUnpacker.h:6
HcalTBTriggerData::setStandardData
void setStandardData(uint32_t orbitNumber, uint32_t eventNumber, uint16_t bunchNumber, uint32_t flags_daq_ttype, uint32_t algo_bits_3, uint32_t algo_bits_2, uint32_t algo_bits_1, uint32_t algo_bits_0, uint32_t tech_bits, uint32_t gps_1234, uint32_t gps_5678)
Definition: HcalTBTriggerData.cc:37
HcalTBTriggerData
Definition: HcalTBTriggerData.h:17
StandardTrgMsgBlkStruct::algo_bits_3
uint32_t algo_bits_3
Definition: HcalTBWriter.cc:115
StandardTrgMsgBlkStruct::gps_1234
uint32_t gps_1234
Definition: HcalTBWriter.cc:120
oldTriggerDataFormat::spillNumber
uint32_t spillNumber
Definition: HcalTBTriggerDataUnpacker.cc:16
HcalTBTriggerDataUnpacker.h
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
oldTriggerDataFormat::orbitNumber
uint32_t orbitNumber
Definition: HcalTBTriggerDataUnpacker.cc:19
oldTriggerDataFormat::triggerWord
uint32_t triggerWord
Definition: HcalTBTriggerDataUnpacker.cc:12
StandardTrgMsgBlkStruct::flags_daq_ttype
uint32_t flags_daq_ttype
Definition: HcalTBWriter.cc:114
oldTriggerDataFormat::triggerTime_usec
uint32_t triggerTime_usec
Definition: HcalTBTriggerDataUnpacker.cc:14
std
Definition: JetResolutionObject.h:76
StandardTrgMsgBlkStruct::eventNumber
uint32_t eventNumber
Definition: HcalTBWriter.cc:113
newExtendedTrgMsgBlkStruct
Definition: HcalTBWriter.cc:124
StandardTrgMsgBlkStruct::algo_bits_0
uint32_t algo_bits_0
Definition: HcalTBWriter.cc:118
StandardTrgMsgBlkStruct::tech_bits
uint32_t tech_bits
Definition: HcalTBWriter.cc:119
BeamSpotPI::unpack
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
Definition: BeamSpotPayloadInspectorHelper.h:22
newExtendedTrgMsgBlk
struct newExtendedTrgMsgBlkStruct newExtendedTrgMsgBlk
StandardTrgMsgBlkStruct::algo_bits_2
uint32_t algo_bits_2
Definition: HcalTBWriter.cc:116
oldTriggerDataFormat::eventStatus
uint32_t eventStatus
Definition: HcalTBTriggerDataUnpacker.cc:21
oldTriggerDataFormat::filler1
uint32_t filler1
Definition: HcalTBTriggerDataUnpacker.cc:22
EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.cerr
cerr
Definition: EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0.py:8
newExtendedTrgMsgBlkStruct::triggerTime_usec
uint32_t triggerTime_usec
Definition: HcalTBWriter.cc:127
oldTriggerDataFormat
Definition: HcalTBTriggerDataUnpacker.cc:10