CMS 3D CMS Logo

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