CMS 3D CMS Logo

LumiSummary.cc
Go to the documentation of this file.
1 
2 
4 
5 #include <iomanip>
6 #include <ostream>
7 #include <iostream>
9  size_t iIndex = lumiversion_.rfind("v");
10  //i.e. not "-1" and not "DIP", "-1" and "DIP" lumi are already corrected and unit conversion included in the raw data.
11  if (iIndex != std::string::npos) {
12  return avginsdellumi_ * 1000.0;
13  }
14  return avginsdellumi_;
15 }
16 float LumiSummary::intgDelLumi() const { return this->avgInsDelLumi() * float(this->lumiSectionLength()); }
18 float LumiSummary::intgRecLumi() const { return this->avgInsRecLumi() * float(this->lumiSectionLength()); }
19 short LumiSummary::lumiSecQual() const { return lumisecqual_; }
20 unsigned long long LumiSummary::deadcount() const { return deadcount_; }
21 unsigned long long LumiSummary::bitzerocount() const { return bitzerocount_; }
22 float LumiSummary::deadFrac() const {
23  //definition: deadcount/bitzerocount
24  //if no trigger data, return deadfraction 1.0,mask out this LS
25  //if bitzerocount=0, return -1.0 meaning no beam
26  if (lumiversion_ == "DIP") {
28  }
29  if (l1data_.empty())
30  return 1.0;
31  if (bitzerocount_ == 0)
32  return -1.0;
34 }
35 float LumiSummary::liveFrac() const {
36  //1-deadfraction
37  //else if deadfraction<0 meaning no beam, live fraction=0
38  //
39  if (deadFrac() < 0)
40  return 0;
41  return 1 - deadFrac();
42 }
44  //numorbits*3564*24.95e-09
45  return numorbit_ * 3564.0 * 24.95e-9;
46 }
47 unsigned int LumiSummary::lsNumber() const { return lsnumber_; }
48 unsigned int LumiSummary::startOrbit() const { return startorbit_; }
49 unsigned int LumiSummary::numOrbit() const { return numorbit_; }
50 bool LumiSummary::isValid() const { return avginsdellumi_ > 0; }
51 LumiSummary::L1 LumiSummary::l1info(unsigned int idx) const { return l1data_.at(idx); }
52 LumiSummary::HLT LumiSummary::hltinfo(unsigned int idx) const { return hltdata_.at(idx); }
53 size_t LumiSummary::nTriggerLine() const { return l1data_.size(); }
54 size_t LumiSummary::nHLTPath() const { return hltdata_.size(); }
55 float LumiSummary::avgInsRecLumi() const { return this->avgInsDelLumi() * liveFrac(); }
59  lumisecqual_ == next.lumisecqual_ && deadcount_ == next.deadcount_ && lsnumber_ == next.lsnumber_ &&
60  startorbit_ == next.startorbit_ && numorbit_ == next.numorbit_ && l1data_.size() == next.l1data_.size() &&
61  hltdata_.size() == next.hltdata_.size() && lumiversion_ == next.lumiversion_);
62 }
65 void LumiSummary::setLumiData(float instlumi, float instlumierr, short lumiquality) {
66  avginsdellumi_ = instlumi;
67  avginsdellumierr_ = instlumierr;
68  lumisecqual_ = lumiquality;
69 }
72 void LumiSummary::setlsnumber(unsigned int lsnumber) { lsnumber_ = lsnumber; }
73 void LumiSummary::setOrbitData(unsigned int startorbit, unsigned int numorbit) {
74  startorbit_ = startorbit;
75  numorbit_ = numorbit;
76 }
77 void LumiSummary::swapL1Data(std::vector<L1>& l1data) { l1data_.swap(l1data); }
78 void LumiSummary::swapHLTData(std::vector<HLT>& hltdata) { hltdata_.swap(hltdata); }
79 void LumiSummary::copyL1Data(const std::vector<L1>& l1data) { l1data_.assign(l1data.begin(), l1data.end()); }
80 void LumiSummary::copyHLTData(const std::vector<HLT>& hltdata) { hltdata_.assign(hltdata.begin(), hltdata.end()); }
81 std::ostream& operator<<(std::ostream& s, const LumiSummary& lumiSummary) {
82  s << "\nDumping LumiSummary\n\n";
83  if (!lumiSummary.isValid()) {
84  s << " === Invalid Lumi values === \n";
85  }
86  s << " lumiVersion = " << lumiSummary.lumiVersion() << "\n";
87  s << " avgInsDelLumi = " << lumiSummary.avgInsDelLumi() << "\n";
88  s << " avgIntgDelLumi = " << lumiSummary.intgDelLumi() << "\n";
89  s << " avgInsDelLumiErr = " << lumiSummary.avgInsDelLumiErr() << "\n";
90  s << " lumiSecQual = " << lumiSummary.lumiSecQual() << "\n";
91  s << " deadCount = " << lumiSummary.deadcount() << "\n";
92  s << " bitZeroCount = " << lumiSummary.bitzerocount() << "\n";
93  s << " deadFrac = " << (float)lumiSummary.deadFrac() << "\n";
94  s << " liveFrac = " << (float)lumiSummary.liveFrac() << "\n";
95  s << " lsNumber = " << lumiSummary.lsNumber() << "\n";
96  s << " startOrbit = " << lumiSummary.startOrbit() << "\n";
97  s << " numOrbit = " << lumiSummary.numOrbit() << "\n";
98  s << " avgInsRecLumi = " << lumiSummary.avgInsRecLumi() << "\n";
99  s << " avgInsRecLumiErr = " << lumiSummary.avgInsRecLumiErr() << "\n\n";
100  s << std::setw(15) << "l1nameidx";
101  s << std::setw(15) << "l1prescale";
102  s << "\n";
103  size_t nTriggers = lumiSummary.nTriggerLine();
104  size_t nHLTPath = lumiSummary.nHLTPath();
105  for (unsigned int i = 0; i < nTriggers; ++i) {
106  s << std::setw(15);
107  s << lumiSummary.l1info(i).triggernameidx;
108  s << std::setw(15);
109  s << lumiSummary.l1info(i).prescale;
110  s << "\n";
111  }
112  s << std::setw(15) << "hltpathidx";
113  s << std::setw(15) << "hltprescale";
114  s << "\n";
115  for (unsigned int i = 0; i < nHLTPath; ++i) {
116  s << std::setw(15);
117  s << lumiSummary.hltinfo(i).pathnameidx;
118  s << std::setw(15);
119  s << lumiSummary.hltinfo(i).prescale;
120  s << "\n";
121  }
122  return s << "\n";
123 }
unsigned long long bitzerocount_
Definition: LumiSummary.h:166
unsigned int startOrbit() const
Definition: LumiSummary.cc:48
std::ostream & operator<<(std::ostream &s, const LumiSummary &lumiSummary)
Definition: LumiSummary.cc:81
L1 l1info(unsigned int idx) const
Definition: LumiSummary.cc:51
void swapHLTData(std::vector< HLT > &hltdata)
Definition: LumiSummary.cc:78
float lumiSectionLength() const
Definition: LumiSummary.cc:43
unsigned int startorbit_
Definition: LumiSummary.h:173
unsigned long long deadcount() const
Definition: LumiSummary.cc:20
float avgInsRecLumi() const
Definition: LumiSummary.cc:55
float intgRecLumi() const
Definition: LumiSummary.cc:18
void setlsnumber(unsigned int lsnumber)
Definition: LumiSummary.cc:72
unsigned int lsnumber_
Definition: LumiSummary.h:167
std::vector< L1 > l1data_
Definition: LumiSummary.h:171
unsigned int prescale
Definition: LumiSummary.h:26
bool isProductEqual(LumiSummary const &next) const
Definition: LumiSummary.cc:57
void setOrbitData(unsigned int startorbit, unsigned int numorbit)
Definition: LumiSummary.cc:73
float intgDelLumi() const
Definition: LumiSummary.cc:16
unsigned int lsNumber() const
Definition: LumiSummary.cc:47
void copyL1Data(const std::vector< L1 > &l1data)
Definition: LumiSummary.cc:79
float avginsdellumierr_
Definition: LumiSummary.h:162
unsigned int numOrbit() const
Definition: LumiSummary.cc:49
float avgInsRecLumiErr() const
Definition: LumiSummary.cc:56
float avgInsDelLumi() const
Definition: LumiSummary.cc:8
float avgInsDelLumiErr() const
Definition: LumiSummary.cc:17
float liveFrac() const
Definition: LumiSummary.cc:35
void setLumiVersion(const std::string &lumiversion)
Definition: LumiSummary.cc:64
std::string lumiversion_
Definition: LumiSummary.h:158
void setLumiData(float instlumi, float instlumierr, short lumiquality)
Definition: LumiSummary.cc:65
void setBitZeroCount(unsigned long long bitzerocount)
Definition: LumiSummary.cc:71
void copyHLTData(const std::vector< HLT > &hltdata)
Definition: LumiSummary.cc:80
void setDeadCount(unsigned long long deadcount)
Definition: LumiSummary.cc:70
size_t nTriggerLine() const
Definition: LumiSummary.cc:53
short lumisecqual_
Definition: LumiSummary.h:164
void swapL1Data(std::vector< L1 > &l1data)
Definition: LumiSummary.cc:77
HLT hltinfo(unsigned int idx) const
Definition: LumiSummary.cc:52
unsigned int numorbit_
Definition: LumiSummary.h:175
std::string lumiVersion() const
Definition: LumiSummary.cc:63
unsigned long long deadcount_
Definition: LumiSummary.h:165
float avginsdellumi_
Definition: LumiSummary.h:160
size_t nHLTPath() const
Definition: LumiSummary.cc:54
float deadFrac() const
Definition: LumiSummary.cc:22
bool isValid() const
Definition: LumiSummary.cc:50
std::vector< HLT > hltdata_
Definition: LumiSummary.h:169
unsigned long long bitzerocount() const
Definition: LumiSummary.cc:21
short lumiSecQual() const
Definition: LumiSummary.cc:19
unsigned int prescale
Definition: LumiSummary.h:32