HLT

L1

LumiSummary

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
#ifndef DataFormats_Luminosity_LumiSummary_h
#define DataFormats_Luminosity_LumiSummary_h

/** \class LumiSummary
 *
 *
 * LumiSummary holds Summary information averaged over all bunch crossings
 * for the given luminosity section LS   
 *
 * \author Valerie Halyo
 *         David Dagenhart
 *         Zhen Xie
 * \version   1st Version June 7 2007
 *
 ************************************************************/

#include <vector>
#include <iosfwd>
#include <string>
class LumiSummary {
public:
  class L1 {
  public:
    L1() : triggernameidx(-1), prescale(0) {}
    int triggernameidx;
    unsigned int prescale;
  };
  class HLT {
  public:
    HLT() : pathnameidx(-1), prescale(0) {}
    int pathnameidx;
    unsigned int prescale;
  };

public:
  /// default constructor
  LumiSummary()
      : lumiversion_("-1"),
        avginsdellumi_(0.0),
        avginsdellumierr_(0.0),
        lumisecqual_(0),
        deadcount_(0),
        bitzerocount_(),
        lsnumber_(0),
        startorbit_(0),
        numorbit_(0) {
    hltdata_.reserve(100);
    l1data_.reserve(192);
  }

  /// set default constructor
  LumiSummary(float avginsdellumi,
              float avginsdellumierr,
              short lumisecqual,
              unsigned long long deadcount,
              unsigned long long bitzerocount,
              unsigned int lsnumber,
              const std::vector<L1>& l1in,
              const std::vector<HLT>& hltin,
              unsigned int startorbit,
              unsigned int numorbit,
              const std::string& lumiversion)
      : lumiversion_(lumiversion),
        avginsdellumi_(avginsdellumi),
        avginsdellumierr_(avginsdellumierr),
        lumisecqual_(lumisecqual),
        deadcount_(deadcount),
        bitzerocount_(bitzerocount),
        lsnumber_(lsnumber),
        hltdata_(hltin),
        l1data_(l1in),
        startorbit_(startorbit),
        numorbit_(numorbit) {}

  /// destructor
  ~LumiSummary() {}
  /** 
	average inst lumi,delivered, 
	unit Hz/ub, 
	uncalibrated for lumiversion v2 
    **/
  float avgInsDelLumi() const;
  /**
       average inst lumi error, empty for lumiversion v2 
    **/
  float avgInsDelLumiErr() const;
  /**
       delivered luminosity integrated over LS , 
       unit /ub,  
       uncalibrated for lumiversion v2 
    **/
  float intgDelLumi() const;
  short lumiSecQual() const;
  /** 
	trigger DeadtimeBeamActive count 
    **/
  unsigned long long deadcount() const;
  /**
       trigger normalization bit count*prescale
    **/
  unsigned long long bitzerocount() const;
  /** the fraction trigger is not active=
	trigger DeadtimeBeamActive/BitZero
	special values:
	if trigger data absent for this LS, return deadfraction 1.0
	if bitzero=0 return -1.0 meaning no beam
    **/
  float deadFrac() const;
  /** the fraction trigger is active=
    	1-deadfraction
    	special values:
    	if deadfraction<0(no beam) livefraction=0
	
     **/
  float liveFrac() const;
  /**lumi section length in seconds
       numorbits*3564*25e-09
    **/
  float lumiSectionLength() const;
  unsigned int lsNumber() const;
  unsigned int startOrbit() const;
  unsigned int numOrbit() const;
  /**data are valid only if run exists from all sources lumi,trg ,hlt
     **/
  bool isValid() const;
  //retrieve trigger bit by bit number 0-191(algo,tech)
  L1 l1info(unsigned int idx) const;
  HLT hltinfo(unsigned int idx) const;
  size_t nTriggerLine() const;
  size_t nHLTPath() const;
  /**avg inst lumi corrected by deadtime**/
  float avgInsRecLumi() const;
  /**avg inst lumi error corrected by deadtime**/
  float avgInsRecLumiErr() const;
  /**recorded luminosity integrated over LS **/
  float intgRecLumi() const;
  bool isProductEqual(LumiSummary const& next) const;
  /** lumi data version.
	special values:
	"-1" means not all lumi,trigger,hlt data exist, therefore invalid
     **/
  std::string lumiVersion() const;
  //
  //setters
  //
  void setLumiVersion(const std::string& lumiversion);
  void setLumiData(float instlumi, float instlumierr, short lumiquality);
  void setDeadCount(unsigned long long deadcount);
  void setBitZeroCount(unsigned long long bitzerocount);
  void setlsnumber(unsigned int lsnumber);
  void setOrbitData(unsigned int startorbit, unsigned int numorbit);
  void swapL1Data(std::vector<L1>& l1data);
  void swapHLTData(std::vector<HLT>& hltdata);
  void copyL1Data(const std::vector<L1>& l1data);
  void copyHLTData(const std::vector<HLT>& hltdata);

private:
  std::string lumiversion_;
  //instant lumi , selected from best algorithm
  float avginsdellumi_;
  //instant lumierror
  float avginsdellumierr_;
  //detector quality flag use HF,HLX
  short lumisecqual_;
  unsigned long long deadcount_;
  unsigned long long bitzerocount_;
  unsigned int lsnumber_;
  //contains about 100 - 200 hlt paths
  std::vector<HLT> hltdata_;
  //contains 128 + 64 triggers
  std::vector<L1> l1data_;
  //first orbit number of this LS
  unsigned int startorbit_;
  //number of orbits in this LS
  unsigned int numorbit_;
};

std::ostream& operator<<(std::ostream& s, const LumiSummary& lumiSummary);

#endif  // DataFormats_Luminosity_LumiSummary_h