CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/CondFormats/Luminosity/interface/LumiSectionData.h

Go to the documentation of this file.
00001 #ifndef CondFormats_Luminosity_LumiSectionData_h
00002 #define CondFormats_Luminosity_LumiSectionData_h
00003 
00015 #include <vector>
00016 #include <string>
00017 
00018 namespace lumi{
00019   static const int BXMIN=1;
00020   static const int BXMAX=3564;
00021   static const int LUMIALGOMAX=3;
00022   
00023   typedef enum { ET=0,OCCD1=1,OCCD2=2 } LumiAlgoType;
00024   typedef enum { ALGO=0,TECH=1 } TriggerType;
00025 
00026   struct HLTInfo{
00027     HLTInfo():pathname(""),inputcount(-99),acceptcount(-99),prescale(-99){}
00028     HLTInfo(const std::string& pathnameIN, int i,int a,int p):
00029       pathname(pathnameIN),inputcount(i),acceptcount(a),prescale(p){}
00030     std::string pathname;
00031     int inputcount;
00032     int acceptcount;
00033     int prescale;
00034   };
00035 
00036   struct TriggerInfo{
00037     TriggerInfo():name(""),triggercount(-99),deadtimecount(-99),prescale(-99){}
00038     TriggerInfo(const std::string& trgname,int trgcount,int deadcount,int p):name(trgname),triggercount(trgcount),deadtimecount(deadcount),prescale(p){}
00039     std::string name;
00040     int triggercount;
00041     int deadtimecount;//max 2**20*3564=3737124864, so wrong type
00042     int prescale; 
00043   };
00044 
00045   struct BunchCrossingInfo {
00046     BunchCrossingInfo(){}
00047     BunchCrossingInfo(int idx,float value,float err,int quality):
00048       BXIdx(idx),lumivalue(value),lumierr(err),lumiquality(quality){}
00049     int BXIdx;//starting from 1
00050     float lumivalue; 
00051     float lumierr;
00052     int lumiquality;
00053   };
00054 
00055   static const BunchCrossingInfo BXNULL=BunchCrossingInfo(-99,-99.0,-99.0,-99);
00056   typedef std::vector<BunchCrossingInfo>::const_iterator BunchCrossingIterator;
00057   typedef std::vector< HLTInfo >::const_iterator HLTIterator;  
00058   typedef std::vector< TriggerInfo >::const_iterator TriggerIterator;
00059 
00060   class LumiSectionData{
00061   public:
00062     LumiSectionData();
00063     ~LumiSectionData(){}
00064   public:
00068     std::string lumiVersion()const;
00069     int lumisectionID()const;
00070     size_t nBunchCrossing()const;
00071     //radom access to instant LumiAverage 
00072     float lumiAverage()const;
00073     float lumiError()const;
00074     float deadFraction()const;
00075     int lumiquality()const;
00076     unsigned long long startorbit()const;
00077     //get bunchCrossingInfo by algorithm
00078     void bunchCrossingInfo(  const LumiAlgoType lumialgotype, 
00079                              std::vector<BunchCrossingInfo>& result )const ;
00080     //random access to bunchCrossingInfo by bunchcrossing index
00081     const BunchCrossingInfo bunchCrossingInfo( const int BXIndex,
00082                                          const LumiAlgoType lumialgotype )const;
00083     //sequential access to bunchCrossingInfo
00084     BunchCrossingIterator bunchCrossingBegin( const LumiAlgoType lumialgotype )const;
00085     BunchCrossingIterator bunchCrossingEnd( const LumiAlgoType lumialgotype )const;
00086     //total number of HLT paths
00087     size_t nHLTPath()const;
00088     bool HLThasData()const;
00089     HLTIterator hltBegin()const;
00090     HLTIterator hltEnd()const;
00091 
00092     bool TriggerhasData()const;
00093     TriggerIterator trgBegin()const;
00094     TriggerIterator trgEnd()const;
00095 
00096     short qualityFlag()const;
00100     void setLumiNull(); //set versionid number to -99, signal no lumi data written.
00101     void setLumiVersion(const std::string& versionid);
00102     void setLumiSectionId(int sectionid);
00103     void setLumiAverage(float lumiavg);
00104     void setLumiQuality(int lumiquality);
00105     void setDeadFraction(float deadfrac);
00106     void setLumiError(float lumierr);
00107     void setStartOrbit(unsigned long long orbtnumber);
00108     void setBunchCrossingData(const std::vector<BunchCrossingInfo>& BXs,
00109                               const LumiAlgoType algotype);
00110     void setHLTData(const std::vector<HLTInfo>& hltdetail);
00111     void setTriggerData(const std::vector<TriggerInfo>& triggerinfo);
00112     void setQualityFlag(short qualityflag);
00113     void print( std::ostream& s )const;
00114   private:
00115     std::vector<BunchCrossingInfo> m_bx;//Lumi detail info sorted by algoright+BX number stored as blob
00116     int m_sectionid; //LS id counting from 1 as required by evt. Instead from 0
00117     std::string m_versionid; //Lumi version
00118     float m_lumiavg; //instant lumi , selected from best algo
00119     float m_lumierror; //instant lumi err, 
00120     short m_quality; //use 7 bits PIXEL,STRIP,MUON,HCAL,ECAL,HF,HLX
00121     float m_deadfrac; //deadtime fraction
00122     unsigned long long m_startorbit; //first orbit number of this LS    
00123     std::vector< HLTInfo > m_hlt; //hlt scaler information sorted by hltpath independent of lumiversion
00124     std::vector< TriggerInfo > m_trigger; //trigger scaler sorted by bit number 128algo+64tech independent of lumiversion
00125   }; 
00126 }//ns lumi
00127 #endif