CMS 3D CMS Logo

LumiInfo.h
Go to the documentation of this file.
1 #ifndef DataFormats_Luminosity_LumiInfo_h
2 #define DataFormats_Luminosity_LumiInfo_h
3 
21 #include <vector>
22 #include <iosfwd>
23 #include <string>
25 
26 class LumiInfo {
27 public:
31  {
33  }
34 
36  LumiInfo(float deadtimeFraction,
37  const std::vector<float>& instLumiByBX):
38  deadtimeFraction_(deadtimeFraction)
39  {
40  instLumiByBX_.assign(instLumiByBX.begin(), instLumiByBX.end());
41  }
42 
45 
46  // Instantaneous luminosity (in Hz/ub)
47  float instLuminosity() const;
48 
49  // Integrated (delivered) luminosity (in ub^-1)
50  float integLuminosity() const;
51 
52  // Recorded (integrated) luminosity (in ub^-1)
53  // (==integLuminosity * (1-deadtimeFraction))
54  float recordedLuminosity() const;
55 
56  // Deadtime/livetime fraction
57  float deadFraction() const { return deadtimeFraction_; }
58  float liveFraction() const { return 1-deadtimeFraction_; }
59 
60  // lumi section length in seconds = numorbits*3564*25e-09
61  float lumiSectionLength() const;
62 
63  // Inst lumi by bunch
64  float getInstLumiBX(int bx) const { return instLumiByBX_.at(bx); }
65  const std::vector<float>& getInstLumiAllBX() const { return instLumiByBX_; }
66 
67  bool isProductEqual(LumiInfo const& next) const;
68 
69  //
70  //setters
71  //
72 
73  void setDeadFraction(float deadtimeFraction) { deadtimeFraction_ = deadtimeFraction; }
74  // fill inst lumi
75  void fill(const std::vector<float>& instLumiByBX);
76  // synonym for above
77  void fillInstLumi(const std::vector<float>& instLumiByBX);
78 
79 private:
81  std::vector<float> instLumiByBX_;
82 };
83 
84 std::ostream& operator<<(std::ostream& s, const LumiInfo& lumiInfo);
85 
86 #endif // DataFormats_Luminosity_LumiInfo_h
void fillInstLumi(const std::vector< float > &instLumiByBX)
Definition: LumiInfo.cc:34
bool isProductEqual(LumiInfo const &next) const
Definition: LumiInfo.cc:29
float recordedLuminosity() const
Definition: LumiInfo.cc:20
float lumiSectionLength() const
Definition: LumiInfo.cc:24
float deadFraction() const
Definition: LumiInfo.h:57
static const unsigned int numBX
Definition: LumiConstants.h:9
~LumiInfo()
destructor
Definition: LumiInfo.h:44
float integLuminosity() const
Definition: LumiInfo.cc:16
float liveFraction() const
Definition: LumiInfo.h:58
float instLuminosity() const
Definition: LumiInfo.cc:7
void fill(const std::vector< float > &instLumiByBX)
Definition: LumiInfo.cc:38
LumiInfo()
default constructor
Definition: LumiInfo.h:29
const std::vector< float > & getInstLumiAllBX() const
Definition: LumiInfo.h:65
float deadtimeFraction_
Definition: LumiInfo.h:80
float getInstLumiBX(int bx) const
Definition: LumiInfo.h:64
void setDeadFraction(float deadtimeFraction)
Definition: LumiInfo.h:73
LumiInfo(float deadtimeFraction, const std::vector< float > &instLumiByBX)
constructor with fill
Definition: LumiInfo.h:36
std::ostream & operator<<(std::ostream &s, const LumiInfo &lumiInfo)
Definition: LumiInfo.cc:42
std::vector< float > instLumiByBX_
Definition: LumiInfo.h:81