CMS 3D CMS Logo

HcalTBTriggerData.cc
Go to the documentation of this file.
2 #include <cstdio>
3 #include <cstdint>
4 
5 using namespace std;
6 
7 const uint32_t HcalTBTriggerData::bit_BeamTrigger = 1;
10 const uint32_t HcalTBTriggerData::bit_LaserTrigger = 4;
12 const uint32_t HcalTBTriggerData::bit_LEDTrigger = 6;
13 
14 const uint32_t HcalTBTriggerData::bit_FakeTrigger = 15;
15 
16 const uint32_t HcalTBTriggerData::bit_InSpill = 0x10;
17 
19  : runNumberSequenceId_(""),
20  runNumber_(0),
21  triggerWord_(0),
22  triggerTimeUsec_(0),
23  triggerTimeBase_(0),
24  spillNumber_(0),
25  orbitNumber_(0),
26  bunchNumber_(0),
27  eventNumber_(0),
28  flagsDaqTtype_(0),
29  algoBits3_(0),
30  algoBits2_(0),
31  algoBits1_(0),
32  algoBits0_(0),
33  techBits_(0),
34  gps1234_(0),
35  gps5678_(0) {}
36 
37 void HcalTBTriggerData::setStandardData(uint32_t orbitNumber,
38  uint32_t eventNumber,
39  uint16_t bunchNumber,
40  uint32_t flags_daq_ttype,
41  uint32_t algo_bits_3,
42  uint32_t algo_bits_2,
43  uint32_t algo_bits_1,
44  uint32_t algo_bits_0,
45  uint32_t tech_bits,
46  uint32_t gps_1234,
47  uint32_t gps_5678) {
49  eventNumber_ = eventNumber & 0x00ffffff; // only lower 24 bits active
51  flagsDaqTtype_ = flags_daq_ttype;
52  algoBits3_ = algo_bits_3;
53  algoBits2_ = algo_bits_2;
54  algoBits1_ = algo_bits_1;
55  algoBits0_ = algo_bits_0;
56  techBits_ = tech_bits;
57  gps1234_ = gps_1234;
58  gps5678_ = gps_5678;
59 }
60 
61 void HcalTBTriggerData::setExtendedData(uint32_t triggerWord,
62  uint32_t triggerTime_usec,
63  uint32_t triggerTime_base,
64  uint32_t spillNumber,
65  uint32_t runNumber,
66  const char* runNumberSequenceId) {
68  triggerTimeUsec_ = triggerTime_usec;
69  triggerTimeBase_ = triggerTime_base;
73 }
74 
75 ostream& operator<<(ostream& s, const HcalTBTriggerData& htbtd) {
76  char str[50];
77  s << htbtd.runNumberSequenceId() << ":";
78  s << htbtd.runNumber() << ":";
79  s << htbtd.eventNumber() << endl;
80 
81  s << " Spill# =" << htbtd.spillNumber() << endl;
82  s << " Bunch# =" << htbtd.bunchNumber() << endl;
83  s << " Orbit# =" << htbtd.orbitNumber() << endl;
84 
85  sprintf(str, " Trigger word = %08x\n", htbtd.triggerWord());
86  s << str;
87 
88  int32_t trigtimebase = (int32_t)htbtd.triggerTimeBase();
89  uint32_t trigtimeusec = htbtd.triggerTimeUsec();
90 
91  // trim seconds off of usec and add to base
92  trigtimebase += trigtimeusec / 1000000;
93  trigtimeusec %= 1000000;
94 
95  sprintf(str, " Trigger time: %s", ctime((time_t*)&trigtimebase));
96  s << str;
97  sprintf(str, " %d us\n", trigtimeusec);
98  s << str;
99 
100  return s;
101 }
static const char runNumber_[]
static const uint32_t bit_LaserTrigger
ostream & operator<<(ostream &s, const HcalTBTriggerData &htbtd)
uint16_t eventNumber() const
Returns the event number of this trigger.
uint32_t runNumber() const
Returns the current run number.
uint32_t spillNumber() const
Returns the spill number of this trigger.
std::string runNumberSequenceId_
void setExtendedData(uint32_t triggerWord, uint32_t triggerTime_usec, uint32_t triggerTime_base, uint32_t spillNumber, uint32_t runNumber, const char *runNumberSequenceId)
uint32_t triggerTimeUsec() const
Returns the relative time of this trigger in microseconds.
uint16_t bunchNumber() const
Returns the bunch number of this trigger.
static const uint32_t bit_LEDTrigger
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)
static const uint32_t bit_InSpill
static const uint32_t bit_InSpillPedestalTrigger
uint32_t algoBits3_
<extended type="31:28,extended" size="27:24,zeros=23:7,daq#=6:4,type=3:0">
static const uint32_t bit_FakeTrigger
uint32_t triggerTimeBase() const
Returns the base time of the run (in seconds, from a time() call)
static const uint32_t bit_spillIgnorantPedestalTrigger
const std::string & runNumberSequenceId() const
uint32_t orbitNumber() const
Returns the orbit number of this trigger.
static const uint32_t bit_BeamTrigger
static const uint32_t bit_OutSpillPedestalTrigger
#define str(s)
uint32_t triggerWord() const
Returns the entire packed trigger word.