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
00010 int m = triggerMask_ & 0x00FFFF01;
00011
00012
00013 int w = m ;
00014 int num = 0;
00015 if ( w < 0 ) {
00016 w &= 0x7FFFFFFF;
00017 num++;
00018 }
00019 do { num += ( w & 0x1 ); } while ( (w >>= 1) != 0 );
00020
00021
00022 if (num != 1) return std::string("error") ;
00023
00024 char chEvtype[80] ;
00025 if ( m == 1 ) return std::string("beam") ;
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
00038
00039
00040
00041
00042
00043
00044
00045
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 ;
00055 if (ievtType == 2) {
00056 LaserType laser_type = laserTypeName();
00057
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 }