CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/TBDataFormats/EcalTBObjects/src/EcalTBEventHeader.cc

Go to the documentation of this file.
00001 #include "TBDataFormats/EcalTBObjects/interface/EcalTBEventHeader.h"
00002 #include <cstdio>
00003 
00007 std::string EcalTBEventHeader::eventType() const
00008 {
00009   // this piece of code was in TPilot (ievtype)
00010   int m = triggerMask_ & 0x00FFFF01; // bits 0, 8..23
00011 
00012   // this piece of code was in TPilot (numbit)
00013   int w = m ;
00014   int num = 0;
00015   if ( w < 0 ) {        //
00016     w &= 0x7FFFFFFF;    // CINT Error
00017     num++;              //
00018   }
00019   do { num += ( w & 0x1 ); } while ( (w >>= 1) != 0 );
00020   // end of numbit
00021 
00022   if (num != 1)  return std::string("error") ;
00023 
00024   char chEvtype[80] ;
00025   if ( m == 1 ) return std::string("beam") ; // Physics triggers
00026   for(int i=0;i<24;i++) {
00027     if ( ( m & 0x1 ) == 1 ) {
00028       sprintf(chEvtype, "%d", i) ;
00029       if (i==11) return std::string("pedestal") ;
00030       if (i==13) return std::string("laser") ;
00031       return std::string(chEvtype) ;
00032     }
00033     m >>= 1;
00034   }
00035   return std::string("error");
00036 
00037   //   // FIXME: to be uncommented with new rawroot
00038   //   int evtype = rawHeader->GetEventType() ;
00039   //   if (evtype == 0) return std::string("error") ;
00040   //   if (evtype == 1) return std::string("beam") ; 
00041   //   if (evtype == 11) return std::string("pedestal") ;
00042   //   if (evtype == 13) return std::string("laser") ;
00043   //   char chEvtype[80] ;
00044   //   sprintf(chEvtype, "%d", evtype) ;
00045   //   return std::string(chEvtype) ;
00046 }
00047 
00048 
00049 int EcalTBEventHeader::dbEventType() const{
00050   std::string evtType = eventType();
00051   int ievtType = 0;
00052   if (evtType=="beam") ievtType = 1 ;
00053   if (evtType=="laser") ievtType = 2 ;
00054   if (evtType=="pedestal") ievtType = 1 ; // same as beam
00055   if (ievtType == 2) {
00056     LaserType laser_type = laserTypeName();
00057     //if (laser_type == EcalTBEventHeader::LBlue) ievtType += 0 ;
00058     if (laser_type == EcalTBEventHeader::LGreen) ievtType += 1 ;
00059     if (laser_type == EcalTBEventHeader::LInfrared) ievtType += 2 ;
00060     if (laser_type == EcalTBEventHeader::LRed) ievtType += 3 ;
00061   }
00062   return ievtType;
00063 }
00064 
00065 std::ostream& operator<<(std::ostream& s, const EcalTBEventHeader& eventHeader) {
00066   s << "Run Number " << eventHeader.runNumber() << " Event Number " << eventHeader.eventNumber() << " Burst Number " << eventHeader.burstNumber() ;
00067   return s;
00068 }