CMS 3D CMS Logo

EcalTBEventHeader.cc
Go to the documentation of this file.
2 #include <cstdio>
3 
8  // this piece of code was in TPilot (ievtype)
9  int m = triggerMask_ & 0x00FFFF01; // bits 0, 8..23
10 
11  // this piece of code was in TPilot (numbit)
12  int w = m;
13  int num = 0;
14  if (w < 0) { //
15  w &= 0x7FFFFFFF; // CINT Error
16  num++; //
17  }
18  do {
19  num += (w & 0x1);
20  } while ((w >>= 1) != 0);
21  // end of numbit
22 
23  if (num != 1)
24  return std::string("error");
25 
26  char chEvtype[80];
27  if (m == 1)
28  return std::string("beam"); // Physics triggers
29  for (int i = 0; i < 24; i++) {
30  if ((m & 0x1) == 1) {
31  sprintf(chEvtype, "%d", i);
32  if (i == 11)
33  return std::string("pedestal");
34  if (i == 13)
35  return std::string("laser");
36  return std::string(chEvtype);
37  }
38  m >>= 1;
39  }
40  return std::string("error");
41 
42  // // FIXME: to be uncommented with new rawroot
43  // int evtype = rawHeader->GetEventType() ;
44  // if (evtype == 0) return std::string("error") ;
45  // if (evtype == 1) return std::string("beam") ;
46  // if (evtype == 11) return std::string("pedestal") ;
47  // if (evtype == 13) return std::string("laser") ;
48  // char chEvtype[80] ;
49  // sprintf(chEvtype, "%d", evtype) ;
50  // return std::string(chEvtype) ;
51 }
52 
54  std::string evtType = eventType();
55  int ievtType = 0;
56  if (evtType == "beam")
57  ievtType = 1;
58  if (evtType == "laser")
59  ievtType = 2;
60  if (evtType == "pedestal")
61  ievtType = 1; // same as beam
62  if (ievtType == 2) {
63  LaserType laser_type = laserTypeName();
64  //if (laser_type == EcalTBEventHeader::LBlue) ievtType += 0 ;
65  if (laser_type == EcalTBEventHeader::LGreen)
66  ievtType += 1;
67  if (laser_type == EcalTBEventHeader::LInfrared)
68  ievtType += 2;
69  if (laser_type == EcalTBEventHeader::LRed)
70  ievtType += 3;
71  }
72  return ievtType;
73 }
74 
75 std::ostream& operator<<(std::ostream& s, const EcalTBEventHeader& eventHeader) {
76  s << "Run Number " << eventHeader.runNumber() << " Event Number " << eventHeader.eventNumber() << " Burst Number "
77  << eventHeader.burstNumber();
78  return s;
79 }
std::string eventType() const
LaserType laserTypeName() const
T w() const
int eventNumber() const
Returns the event number.
std::ostream & operator<<(std::ostream &s, const EcalTBEventHeader &eventHeader)
int triggerMask_
The trigger mask.
short burstNumber() const
Returns the burst number.
int dbEventType() const
Returns the event type as in the H4ROOTDB.