Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:40

0001 #ifndef DataFormats_Luminosity_LumiSummary_h
0002 #define DataFormats_Luminosity_LumiSummary_h
0003 
0004 /** \class LumiSummary
0005  *
0006  *
0007  * LumiSummary holds Summary information averaged over all bunch crossings
0008  * for the given luminosity section LS   
0009  *
0010  * \author Valerie Halyo
0011  *         David Dagenhart
0012  *         Zhen Xie
0013  * \version   1st Version June 7 2007
0014  *
0015  ************************************************************/
0016 
0017 #include <vector>
0018 #include <iosfwd>
0019 #include <string>
0020 class LumiSummary {
0021 public:
0022   class L1 {
0023   public:
0024     L1() : triggernameidx(-1), prescale(0) {}
0025     int triggernameidx;
0026     unsigned int prescale;
0027   };
0028   class HLT {
0029   public:
0030     HLT() : pathnameidx(-1), prescale(0) {}
0031     int pathnameidx;
0032     unsigned int prescale;
0033   };
0034 
0035 public:
0036   /// default constructor
0037   LumiSummary()
0038       : lumiversion_("-1"),
0039         avginsdellumi_(0.0),
0040         avginsdellumierr_(0.0),
0041         lumisecqual_(0),
0042         deadcount_(0),
0043         bitzerocount_(),
0044         lsnumber_(0),
0045         startorbit_(0),
0046         numorbit_(0) {
0047     hltdata_.reserve(100);
0048     l1data_.reserve(192);
0049   }
0050 
0051   /// set default constructor
0052   LumiSummary(float avginsdellumi,
0053               float avginsdellumierr,
0054               short lumisecqual,
0055               unsigned long long deadcount,
0056               unsigned long long bitzerocount,
0057               unsigned int lsnumber,
0058               const std::vector<L1>& l1in,
0059               const std::vector<HLT>& hltin,
0060               unsigned int startorbit,
0061               unsigned int numorbit,
0062               const std::string& lumiversion)
0063       : lumiversion_(lumiversion),
0064         avginsdellumi_(avginsdellumi),
0065         avginsdellumierr_(avginsdellumierr),
0066         lumisecqual_(lumisecqual),
0067         deadcount_(deadcount),
0068         bitzerocount_(bitzerocount),
0069         lsnumber_(lsnumber),
0070         hltdata_(hltin),
0071         l1data_(l1in),
0072         startorbit_(startorbit),
0073         numorbit_(numorbit) {}
0074 
0075   /// destructor
0076   ~LumiSummary() {}
0077   /** 
0078     average inst lumi,delivered, 
0079     unit Hz/ub, 
0080     uncalibrated for lumiversion v2 
0081     **/
0082   float avgInsDelLumi() const;
0083   /**
0084        average inst lumi error, empty for lumiversion v2 
0085     **/
0086   float avgInsDelLumiErr() const;
0087   /**
0088        delivered luminosity integrated over LS , 
0089        unit /ub,  
0090        uncalibrated for lumiversion v2 
0091     **/
0092   float intgDelLumi() const;
0093   short lumiSecQual() const;
0094   /** 
0095     trigger DeadtimeBeamActive count 
0096     **/
0097   unsigned long long deadcount() const;
0098   /**
0099        trigger normalization bit count*prescale
0100     **/
0101   unsigned long long bitzerocount() const;
0102   /** the fraction trigger is not active=
0103     trigger DeadtimeBeamActive/BitZero
0104     special values:
0105     if trigger data absent for this LS, return deadfraction 1.0
0106     if bitzero=0 return -1.0 meaning no beam
0107     **/
0108   float deadFrac() const;
0109   /** the fraction trigger is active=
0110         1-deadfraction
0111         special values:
0112         if deadfraction<0(no beam) livefraction=0
0113     
0114      **/
0115   float liveFrac() const;
0116   /**lumi section length in seconds
0117        numorbits*3564*25e-09
0118     **/
0119   float lumiSectionLength() const;
0120   unsigned int lsNumber() const;
0121   unsigned int startOrbit() const;
0122   unsigned int numOrbit() const;
0123   /**data are valid only if run exists from all sources lumi,trg ,hlt
0124      **/
0125   bool isValid() const;
0126   //retrieve trigger bit by bit number 0-191(algo,tech)
0127   L1 l1info(unsigned int idx) const;
0128   HLT hltinfo(unsigned int idx) const;
0129   size_t nTriggerLine() const;
0130   size_t nHLTPath() const;
0131   /**avg inst lumi corrected by deadtime**/
0132   float avgInsRecLumi() const;
0133   /**avg inst lumi error corrected by deadtime**/
0134   float avgInsRecLumiErr() const;
0135   /**recorded luminosity integrated over LS **/
0136   float intgRecLumi() const;
0137   bool isProductEqual(LumiSummary const& next) const;
0138   /** lumi data version.
0139     special values:
0140     "-1" means not all lumi,trigger,hlt data exist, therefore invalid
0141      **/
0142   std::string lumiVersion() const;
0143   //
0144   //setters
0145   //
0146   void setLumiVersion(const std::string& lumiversion);
0147   void setLumiData(float instlumi, float instlumierr, short lumiquality);
0148   void setDeadCount(unsigned long long deadcount);
0149   void setBitZeroCount(unsigned long long bitzerocount);
0150   void setlsnumber(unsigned int lsnumber);
0151   void setOrbitData(unsigned int startorbit, unsigned int numorbit);
0152   void swapL1Data(std::vector<L1>& l1data);
0153   void swapHLTData(std::vector<HLT>& hltdata);
0154   void copyL1Data(const std::vector<L1>& l1data);
0155   void copyHLTData(const std::vector<HLT>& hltdata);
0156 
0157 private:
0158   std::string lumiversion_;
0159   //instant lumi , selected from best algorithm
0160   float avginsdellumi_;
0161   //instant lumierror
0162   float avginsdellumierr_;
0163   //detector quality flag use HF,HLX
0164   short lumisecqual_;
0165   unsigned long long deadcount_;
0166   unsigned long long bitzerocount_;
0167   unsigned int lsnumber_;
0168   //contains about 100 - 200 hlt paths
0169   std::vector<HLT> hltdata_;
0170   //contains 128 + 64 triggers
0171   std::vector<L1> l1data_;
0172   //first orbit number of this LS
0173   unsigned int startorbit_;
0174   //number of orbits in this LS
0175   unsigned int numorbit_;
0176 };
0177 
0178 std::ostream& operator<<(std::ostream& s, const LumiSummary& lumiSummary);
0179 
0180 #endif  // DataFormats_Luminosity_LumiSummary_h