CMS 3D CMS Logo

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