CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LumiSummary.cc
Go to the documentation of this file.
1 
2 // $Id: LumiSummary.cc,v 1.27 2012/09/20 14:08:11 xiezhen Exp $
3 
5 
6 #include <iomanip>
7 #include <ostream>
8 #include <iostream>
9 float
11  size_t iIndex=lumiversion_.rfind("v");
12  if(iIndex != std::string::npos){//i.e. not "-1" and not "DIP", "-1" and "DIP" lumi are already corrected and unit conversion included in the raw data.
13  return avginsdellumi_*1000.0;
14  }
15  return avginsdellumi_;
16 }
17 float
19  return this->avgInsDelLumi()*float(this->lumiSectionLength());
20 }
21 float
23  return avginsdellumierr_;
24 }
25 float
27  return this->avgInsRecLumi()*float(this->lumiSectionLength());
28 }
29 short
31  return lumisecqual_;
32 }
33 unsigned long long
35  return deadcount_;
36 }
37 unsigned long long
39  return bitzerocount_;
40 }
41 float
43  //definition: deadcount/bitzerocount
44  //if no trigger data, return deadfraction 1.0,mask out this LS
45  //if bitzerocount=0, return -1.0 meaning no beam
46  if(lumiversion_=="DIP"){
47  return float(deadcount_)/float(bitzerocount_);
48  }
49  if (l1data_.size()==0) return 1.0;
50  if (bitzerocount_==0) return -1.0;
51  return float(deadcount_)/float(bitzerocount_);
52 }
53 float
55  //1-deadfraction
56  //else if deadfraction<0 meaning no beam, live fraction=0
57  //
58  if (deadFrac()<0) return 0;
59  return 1-deadFrac();
60 }
61 float
63  //numorbits*3564*24.95e-09
64  return numorbit_*3564.0*24.95e-9;
65 }
66 unsigned int
68  return lsnumber_;
69 }
70 unsigned int
72  return startorbit_;
73 }
74 unsigned int
76  return numorbit_;
77 }
78 bool
80  return avginsdellumi_>0;
81 }
83 LumiSummary::l1info(unsigned int idx)const{
84  return l1data_.at(idx);
85 }
87 LumiSummary::hltinfo(unsigned int idx) const {
88  return hltdata_.at(idx);
89 }
90 size_t
92  return l1data_.size();
93 }
94 size_t
96  return hltdata_.size();
97 }
98 float
100  return this->avgInsDelLumi() * liveFrac();
101 }
102 float
104  return avginsdellumierr_ * liveFrac();
105 }
106 bool
108  return (avginsdellumi_ == next.avginsdellumi_ &&
110  lumisecqual_ == next.lumisecqual_ &&
111  deadcount_ == next.deadcount_ &&
112  lsnumber_ == next.lsnumber_ &&
113  startorbit_== next.startorbit_ &&
114  numorbit_==next.numorbit_&&
115  l1data_.size() == next.l1data_.size() &&
116  hltdata_.size() == next.hltdata_.size() &&
117  lumiversion_ == next.lumiversion_ );
118 }
121  return lumiversion_;
122 }
123 void
125  lumiversion_=lumiversion;
126 }
127 void
128 LumiSummary::setLumiData(float instlumi,float instlumierr,short lumiquality){
129  avginsdellumi_=instlumi;
130  avginsdellumierr_=instlumierr;
131  lumisecqual_=lumiquality;
132 }
133 void
134 LumiSummary::setDeadCount(unsigned long long deadcount){
136 }
137 void
138 LumiSummary::setBitZeroCount(unsigned long long bitzerocount){
140 }
141 void
142 LumiSummary::setlsnumber(unsigned int lsnumber){
143  lsnumber_=lsnumber;
144 }
145 void
146 LumiSummary::setOrbitData(unsigned int startorbit,unsigned int numorbit){
147  startorbit_=startorbit;
148  numorbit_=numorbit;
149 }
150 void
151 LumiSummary::swapL1Data(std::vector<L1>& l1data){
152  l1data_.swap(l1data);
153 }
154 void
156  hltdata_.swap(hltdata);
157 }
158 void
159 LumiSummary::copyL1Data(const std::vector<L1>& l1data){
160  l1data_.assign(l1data.begin(),l1data.end());
161 }
162 void
163 LumiSummary::copyHLTData(const std::vector<HLT>& hltdata){
164  hltdata_.assign(hltdata.begin(),hltdata.end());
165 }
166 std::ostream& operator<<(std::ostream& s, const LumiSummary& lumiSummary) {
167  s << "\nDumping LumiSummary\n\n";
168  if(!lumiSummary.isValid()){
169  s << " === Invalid Lumi values === \n";
170  }
171  s << " lumiVersion = " << lumiSummary.lumiVersion() << "\n";
172  s << " avgInsDelLumi = " << lumiSummary.avgInsDelLumi() << "\n";
173  s << " avgIntgDelLumi = " << lumiSummary.intgDelLumi() <<"\n";
174  s << " avgInsDelLumiErr = " << lumiSummary.avgInsDelLumiErr() << "\n";
175  s << " lumiSecQual = " << lumiSummary.lumiSecQual() << "\n";
176  s << " deadCount = " << lumiSummary.deadcount() << "\n";
177  s << " bitZeroCount = " << lumiSummary.bitzerocount() << "\n";
178  s << " deadFrac = " << (float)lumiSummary.deadFrac() << "\n";
179  s << " liveFrac = " << (float)lumiSummary.liveFrac() << "\n";
180  s << " lsNumber = " << lumiSummary.lsNumber() << "\n";
181  s << " startOrbit = " << lumiSummary.startOrbit() <<"\n";
182  s << " numOrbit = " << lumiSummary.numOrbit() <<"\n";
183  s << " avgInsRecLumi = " << lumiSummary.avgInsRecLumi() << "\n";
184  s << " avgInsRecLumiErr = " << lumiSummary.avgInsRecLumiErr() << "\n\n";
185  s << std::setw(15) << "l1nameidx";
186  s << std::setw(15) << "l1prescale";
187  s << "\n";
188  size_t nTriggers=lumiSummary.nTriggerLine();
189  size_t nHLTPath=lumiSummary.nHLTPath();
190  for(unsigned int i = 0; i < nTriggers; ++i) {
191  s << std::setw(15);
192  s << lumiSummary.l1info(i).triggernameidx;
193  s << std::setw(15);
194  s << lumiSummary.l1info(i).prescale;
195  s<<"\n";
196  }
197  s << std::setw(15) << "hltpathidx";
198  s << std::setw(15) << "hltprescale";
199  s << "\n";
200  for(unsigned int i = 0; i < nHLTPath; ++i) {
201  s << std::setw(15);
202  s << lumiSummary.hltinfo(i).pathnameidx;
203  s << std::setw(15);
204  s << lumiSummary.hltinfo(i).prescale;
205  s << "\n";
206  }
207  return s << "\n";
208 }
int i
Definition: DBlmapReader.cc:9
unsigned long long bitzerocount_
Definition: LumiSummary.h:165
unsigned int startOrbit() const
Definition: LumiSummary.cc:71
L1 l1info(unsigned int idx) const
Definition: LumiSummary.cc:83
void swapHLTData(std::vector< HLT > &hltdata)
Definition: LumiSummary.cc:155
float lumiSectionLength() const
Definition: LumiSummary.cc:62
unsigned int startorbit_
Definition: LumiSummary.h:172
tuple lumiSummary
Definition: runregparse.py:290
unsigned long long deadcount() const
Definition: LumiSummary.cc:34
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
float avgInsRecLumi() const
Definition: LumiSummary.cc:99
float intgRecLumi() const
Definition: LumiSummary.cc:26
void setlsnumber(unsigned int lsnumber)
Definition: LumiSummary.cc:142
unsigned int lsnumber_
Definition: LumiSummary.h:166
std::vector< L1 > l1data_
Definition: LumiSummary.h:170
tuple hltdata
Definition: dataDML.py:2362
unsigned int prescale
Definition: LumiSummary.h:27
bool isProductEqual(LumiSummary const &next) const
Definition: LumiSummary.cc:107
void setOrbitData(unsigned int startorbit, unsigned int numorbit)
Definition: LumiSummary.cc:146
float intgDelLumi() const
Definition: LumiSummary.cc:18
unsigned int lsNumber() const
Definition: LumiSummary.cc:67
void copyL1Data(const std::vector< L1 > &l1data)
Definition: LumiSummary.cc:159
float avginsdellumierr_
Definition: LumiSummary.h:161
unsigned int numOrbit() const
Definition: LumiSummary.cc:75
float avgInsRecLumiErr() const
Definition: LumiSummary.cc:103
float avgInsDelLumi() const
Definition: LumiSummary.cc:10
float avgInsDelLumiErr() const
Definition: LumiSummary.cc:22
float liveFrac() const
Definition: LumiSummary.cc:54
void setLumiVersion(const std::string &lumiversion)
Definition: LumiSummary.cc:124
std::string lumiversion_
Definition: LumiSummary.h:157
void setLumiData(float instlumi, float instlumierr, short lumiquality)
Definition: LumiSummary.cc:128
void setBitZeroCount(unsigned long long bitzerocount)
Definition: LumiSummary.cc:138
void copyHLTData(const std::vector< HLT > &hltdata)
Definition: LumiSummary.cc:163
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
void setDeadCount(unsigned long long deadcount)
Definition: LumiSummary.cc:134
size_t nTriggerLine() const
Definition: LumiSummary.cc:91
short lumisecqual_
Definition: LumiSummary.h:163
void swapL1Data(std::vector< L1 > &l1data)
Definition: LumiSummary.cc:151
HLT hltinfo(unsigned int idx) const
Definition: LumiSummary.cc:87
unsigned int numorbit_
Definition: LumiSummary.h:174
std::string lumiVersion() const
Definition: LumiSummary.cc:120
unsigned long long deadcount_
Definition: LumiSummary.h:164
float avginsdellumi_
Definition: LumiSummary.h:159
size_t nHLTPath() const
Definition: LumiSummary.cc:95
float deadFrac() const
Definition: LumiSummary.cc:42
bool isValid() const
Definition: LumiSummary.cc:79
std::vector< HLT > hltdata_
Definition: LumiSummary.h:168
unsigned long long bitzerocount() const
Definition: LumiSummary.cc:38
short lumiSecQual() const
Definition: LumiSummary.cc:30
unsigned int prescale
Definition: LumiSummary.h:33