CMS 3D CMS Logo

EcalTBEventHeader.cc

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

Generated on Tue Jun 9 17:48:05 2009 for CMSSW by  doxygen 1.5.4