ATLAS Offline Software
LumiCalculator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 // GoodRunsLists
11 
12 // ROOT
13 #include "TTree.h"
14 #include "TFile.h"
15 #include "TString.h"
16 #include "TObjString.h"
17 #include "TROOT.h"
18 
19 // stl includes
20 #include <iomanip>
21 #include <iostream>
22 #include <set>
23 #include <regex.h>
24 
26  : m_LumiTree (nullptr)
27  , m_recordTTree (false)
28  , m_State (true)
29 
30  , m_trigger ("COOLONL_TRIGGER/")
31  , m_lumioff ("COOLOFL_TRIGGER/")
32  , m_lumionl ("COOLONL_TRIGGER/")
33  , m_lumitag ("OflLumi-8TeV-002")// for offline: OflLumi_CosmicFake, OflLumi_TopMix
34  , m_lumimethod ("")// offline channels: ATLAS_PREFERRED, OflLumi_Fake0, OflLumi_Fake:, TopMixLumi
35  , m_laroff ("COOLOFL_LAR/")
36  , m_bsonl ("COOLONL_INDET/")
37  , m_bstag ("IndetBeamposOnl-HLT-UPD1-001-00")
38 
39  , m_parlvl1menufolder ("/TRIGGER/LVL1/Menu")
40  , m_parhltmenufolder ("/TRIGGER/HLT/Menu")// ChainCounter is here for COOLONL_TRIGGER/COMP20
41  , m_parhltprescalesfolder ("/TRIGGER/HLT/Prescales")// ChainCounter is here for COOLONL_TRIGGER/COMP20
42  , m_parlumilvl1folder ("/TRIGGER/LUMI/LVL1COUNTERS")
43  , m_parlumihltfolder ("/TRIGGER/LUMI/HLTCOUNTERS")
44  , m_parlvl1prescalesfolder ("/TRIGGER/LVL1/Prescales")
45  , m_parlvl1lblbfolder ("/TRIGGER/LUMI/LBLB")// for time information
46  , m_parlareventvetofolder ("/LAR/BadChannelsOfl/EventVeto") // For LAr event veto
47  , m_paronlbeamspotfolder ("/Indet/Onl/Beampos") // For invalid online beamspot
48 
49  , m_logger( "LumiCalculator" )
50  , m_lbcollname ("LumiBlocks")
51  , m_uselivetrigger (false)
52  , m_verbose (false)
53  , m_lbstarttime(0.)
54  , m_lbendtime(0.)
55 
56  , m_totalDelL(0.)
57  , m_totalL(0.)
58  , m_totalLRun(0.)
59  , m_totaltime(0.)
60  , m_instLumi(0.)
61  , m_AvEvtsPerBX(0.)
62  , m_delLumi(0.)
63  , m_intLumi(0.)
64  , m_deltaT(0.)
65  , m_TotaldeltaT(0.)
66  , m_livefrac(0.)
67  , m_livetime(0.)
68  , m_l1acc(0)
69  , m_livetime_l1acc(0)
70  , m_l1accof(false)
71  , m_l2acc(0)
72  , m_l3acc(0)
73  , m_totall1acc(0)
74  , m_livtrig_totall1acc(0)
75  , m_totall1befpresc(0)
76  , m_totall2acc(0)
77  , m_totall3acc(0)
78  , m_l1prescale(0.)
79  , m_l2prescale(0.)
80  , m_l3prescale(0.)
81  , m_afterprescale(0)
82  , m_livetime_beforeprescale(0)
83  , m_livetime_afterprescale(0)
84  , m_afterprescaleof(false)
85  , m_beforeprescale(0)
86  , m_beforeprescaleof(false)
87  , m_runnbr(0)
88  , m_lbstart(0)
89  , m_lbstop(0)
90  , m_lbstart_prev(0)
91  , m_lbstop_prev(0)
92  , m_runnbr_prev(0)
93  , m_totalgoodblock(0)
94  , m_totalbadblock(0)
95  , m_clumiblocknbr(0)
96  , m_clumiblocknbrend(0)
97  , m_triglevel(0)
98  , m_totalPrescaleWLiveTime(0.)
99  , m_t_totalPrescaleWLiveTime(0.)
100  , m_totalPrescale(0.)
101  , m_t_totalPrescale(0.)
102  , m_lumiWOPrescale(0.)
103  , m_t_lumiWOPrescale(0.)
104  , m_lumiLAr(0.)
105  , m_t_lumiLAr(0.)
106  , m_t_totalDelL(0.)
107  , m_t_totalL(0.)
108  , m_t_totalLRun(0.)
109  , m_t_totaltime(0.)
110  , m_t_deltaT(0.)
111  , m_t_l1acc(0)
112  , m_t_l2acc(0)
113  , m_t_l3acc(0)
114  , m_t_totalgoodblock(0)
115  , m_t_totalbadblock(0)
116  , m_t_totall1befpresc(0)
117  , m_lartime(0.)
118  , m_larfrac(0.)
119  , m_bsvalid(0.)
120  , m_effxsec(1.)
121  , m_l1rate(0.)
122  , m_l2rate(0.)
123  , m_l3rate(0.)
124  , m_l1ratediveffxsec(0.)
125  , m_total_l1ratediveffxsec(0.)
126  , m_total_l1ratediveffxsecRun(0.)
127  , m_l1ratediveffxsec_recorded(0.)
128  , m_total_l1ratediveffxsec_recorded(0.)
129  , m_total_l1ratediveffxsecRun_recorded(0.)
130  , m_mintrigrate(5./120.)
131  , m_collsgrl(0)
132  , m_ntrigplb(0)
133  , m_trigrateplb(0)
134  , m_lumiplb(0)
135  , m_lumitrigrateplb(0)
136  , m_intlumi(0)
137  , m_intlumitrigrate(0)
138  , m_lumitrigrateplb_recorded(0)
139  , m_intlumitrigrate_recorded(0)
140  , m_intlumiruns(0)
141  , m_intlumitrigrateruns(0)
142  , m_intlumitrigrateruns_recorded(0)
143  , m_avgintperbx(0)
144  , m_makePlots(false)
145  , m_makecollList(false)
146  , m_Lumiid(0)
147  , m_L3id(0)
148  , m_L2id(0)
149  , m_L1id(0)
150  , m_LiveL1id(0)
151  , m_L1Valid(false)
152  , m_L2Valid(false)
153  , m_L3Valid(false)
154  , m_LiveValid(false)
155  , m_onlinelumi(false)
156  , m_uselar(false)
157  , m_usebs(false)
158  , m_minrun(0)
159  , m_maxrun(0)
160 {
161 
162  // by default we use the "offline data" database name
167 
168  m_lumichannel = 0;
169 
170 }
171 
172 
174 
175  // delete collisions grl
176  if (m_collsgrl!=0) { delete m_collsgrl; m_collsgrl=0; }
177 
179  for (itr=m_ntrigplbVec.begin(); itr!=m_ntrigplbVec.end(); ++itr) { delete *itr; }
180  for (itr=m_trigrateplbVec.begin(); itr!=m_trigrateplbVec.end(); ++itr) { delete *itr; }
181  for (itr=m_lumiplbVec.begin(); itr!=m_lumiplbVec.end(); ++itr) { delete *itr; }
182  for (itr=m_lumitrigrateplbVec.begin(); itr!=m_lumitrigrateplbVec.end(); ++itr) { delete *itr; }
183  for (itr=m_intlumiVec.begin(); itr!=m_intlumiVec.end(); ++itr) { delete *itr; }
184  for (itr=m_intlumitrigrateVec.begin(); itr!=m_intlumitrigrateVec.end(); ++itr) { delete *itr; }
185  for (itr=m_lumitrigrateplb_recordedVec.begin(); itr!=m_lumitrigrateplb_recordedVec.end(); ++itr) { delete *itr; }
186  for (itr=m_intlumitrigrate_recordedVec.begin(); itr!=m_intlumitrigrate_recordedVec.end(); ++itr) { delete *itr; }
187 
188  m_ntrigplbVec.clear();
189  m_trigrateplbVec.clear();
190  m_lumiplbVec.clear();
191  m_lumitrigrateplbVec.clear();
192  m_intlumiVec.clear();
193  m_intlumitrigrateVec.clear();
196 
197  if (m_intlumiruns!=0) { delete m_intlumiruns; m_intlumiruns=0; }
200  if (m_avgintperbx != 0) { delete m_avgintperbx; m_avgintperbx = 0; }
201 
202 }
203 
205  // Register branches
206  m_LumiTree = tree;
207  if(m_LumiTree != 0){
208 
209  m_LumiTree->Branch("LBStartTime/D", &m_lbstarttime);
210  m_LumiTree->Branch("LBEndTime/D", &m_lbendtime);
211  m_LumiTree->Branch("Trigger", &m_triggerchain);
212  m_LumiTree->Branch("LBCollection", &m_lbcollname);
213  m_LumiTree->Branch("RunNbr", &m_runnbr);
214  m_LumiTree->Branch("IOVRStart", &m_lbstart);
215  m_LumiTree->Branch("IOVREnd", &m_lbstop);
216  m_LumiTree->Branch("LBStart", &m_clumiblocknbr);
217  m_LumiTree->Branch("Inst_m_Lumi", &m_instLumi);
218  m_LumiTree->Branch("LiveTime", &m_livetime);
219  m_LumiTree->Branch("L1Presc", &m_l1prescale);
220  m_LumiTree->Branch("L2Presc", &m_l2prescale);
221  m_LumiTree->Branch("L3Presc", &m_l3prescale);
222  m_LumiTree->Branch("L1Count", &m_l1acc);
223  m_LumiTree->Branch("L1CountOverFlow", &m_l1accof);
224  m_LumiTree->Branch("L2Count", &m_l2acc);
225  m_LumiTree->Branch("L3Count", &m_l3acc);
226  m_LumiTree->Branch("L1AfterPrescale", &m_afterprescale);
227  m_LumiTree->Branch("L1AfterPrescaleOverFlow", &m_afterprescaleof);
228  m_LumiTree->Branch("L1BeforePrescale", &m_beforeprescale);
229  m_LumiTree->Branch("L1BeforePrescaleOverFlow", &m_beforeprescaleof);
230  m_LumiTree->Branch("Livefrac", &m_livefrac);
231  m_LumiTree->Branch("LArfrac", &m_larfrac);
232  m_LumiTree->Branch("DeltaT", &m_deltaT);
233  m_LumiTree->Branch("L1Rate", &m_l1rate);
234  m_LumiTree->Branch("IntLumi",&m_intLumi);
235  m_LumiTree->Branch("L1Ratediveffxsec",&m_l1ratediveffxsec);
236  m_LumiTree->Branch("TotalLumi",&m_totalL);
237  m_LumiTree->Branch("Total_L1Ratediveffxsec",&m_total_l1ratediveffxsec);
238  m_LumiTree->Branch("TotalLumiRun",&m_totalLRun);
239  m_LumiTree->Branch("Total_L1RatediveffxsecRun",&m_total_l1ratediveffxsecRun);
240  m_LumiTree->Branch("L1RatediveffxsecRecorded",&m_l1ratediveffxsec_recorded);
241  m_LumiTree->Branch("Total_L1RatediveffxsecRecorded",&m_total_l1ratediveffxsec_recorded);
242  m_LumiTree->Branch("Total_L1RatediveffxsecRunRecorded",&m_total_l1ratediveffxsecRun_recorded);
243  m_LumiTree->Branch("AvergeInteractionPerXing",&m_AvEvtsPerBX);
244  m_LumiTree->Branch("BSValid", &m_bsvalid);
245  }
246 
247 }
248 
249 
250 void LumiCalculator::SetCollName(const std::string& lbcollname){
251  m_lbcollname = lbcollname;
252 }
253 
254 
256  m_verbose = verbose;
257 }
258 
260 
261  // Print warning
262  if (mc)
263  m_logger << Root::kWARNING << "Monte Carlo mode no longer supported!" << Root::GEndl;
264 
265 }
266 
268 
270 
271 }
272 
273 void LumiCalculator::UseLumiTag(const std::string& tag){
274  m_lumitag = tag;
275 }
276 
277 void LumiCalculator::UseLumiMethod(const std::string& method){
279 }
280 
283  m_lumimethod = "";
284 }
285 
286 
287 void LumiCalculator::UseLiveTrigger(bool live, std::string& livetrigger){
288  m_uselivetrigger = live;
289  m_livetrigger = livetrigger;
290 }
291 
292 void LumiCalculator::UseLArNoiseDB(bool lar, const std::string& lartag) {
293  m_uselar = lar;
294  m_lartag = lartag;
295 }
296 
297 void LumiCalculator::UseBeamspot(bool bs, const std::string& bstag) {
298  m_usebs = bs;
299  m_bstag = bstag;
300 }
301 
303  if(m_LumiTree != 0)return m_LumiTree;
304  return 0;
305 }
306 
307 //______________________________________________________________________________
308 void LumiCalculator::IntegrateLumi ATLAS_NOT_THREAD_SAFE (const xAOD::LumiBlockRangeContainer * iovc, const std::string& triggerchain){
309 
310 
311  CoolQuery * cq_lumi = NULL;
312  CoolQuery * cq_trigger = NULL;
313  CoolQuery* cq_lar = NULL;
314  CoolQuery* cq_bs = NULL;
315 
316  // Peek at first run in iovc to check if we want Run1 or Run2 data
318  // const IOVRange * iovr = (*it);
319  const IOVRange* iovr = new IOVRange(IOVTime((*it)->startRunNumber(),(*it)->startLumiBlockNumber()),
320  IOVTime((*it)->stopRunNumber(),(*it)->stopLumiBlockNumber()));
321 
322  bool isrun2 = false;
323  std::string onlfolder;
324  std::string oflfolder;
325  if (iovr->start().run() > 222222) {
326  isrun2 = true;
327  m_data_db="CONDBR2";
328  onlfolder = "/TRIGGER/LUMI/OnlPrefLumi";
329  oflfolder = "/TRIGGER/OFLLUMI/OflPrefLumi";
330  } else {
331  isrun2 = false;
332  m_data_db="COMP200";
333  onlfolder = "/TRIGGER/LUMI/LBLESTONL";
334  oflfolder = "/TRIGGER/OFLLUMI/LBLESTOFL";
335  }
336 
337  // define all connection strings
338 
339  // check for online DB
340  if(m_onlinelumi){
341  m_lumi_database = m_lumionl + m_data_db;
342  m_parlumiestfolder = onlfolder;
343  } else {
344  m_lumi_database = m_lumioff + m_data_db;
345  m_parlumiestfolder = oflfolder;
346  }
347 
348  m_trig_database = m_trigger + m_data_db;
349  m_lar_database = m_laroff + m_data_db;
350  m_bs_database = m_bsonl + m_data_db;
351 
352 
353  m_logger << Root::kINFO << "Luminosity database: " << m_lumi_database << Root::GEndl;
354  m_logger << Root::kINFO << "Trigger database: " << m_trig_database << Root::GEndl;
355 
356  cq_lumi = new CoolQuery(m_lumi_database, triggerchain);
357  if (!cq_lumi->openDbConn()) {
358  delete cq_lumi;
359  return;
360  }
361 
362  cq_trigger = new CoolQuery(m_trig_database, triggerchain);
363  if (!cq_trigger->openDbConn()) {
364  delete cq_trigger;
365  return;
366  }
367 
368  if (m_uselar) {
369  m_logger << Root::kINFO << "LAr database: " << m_lar_database << Root::GEndl;
370 
371  cq_lar = new CoolQuery(m_lar_database, triggerchain);
372  if (!cq_lar->openDbConn()) {
373  delete cq_lar;
374  return;
375  }
376  }
377 
378  if (m_usebs) {
379  m_logger << Root::kINFO << "Onl beamspot database: " << m_bs_database << Root::GEndl;
380 
381  cq_bs = new CoolQuery(m_bs_database, triggerchain);
382  if (!cq_bs->openDbConn()) {
383  delete cq_bs;
384  return;
385  }
386  }
387 
388  // initialize
389  m_lbstarttime = 0.;
390  m_lbendtime = 0.;
391  m_totalDelL = 0.;
392  m_totalL = 0.;
393  m_totalLRun = 0.;
394  m_totaltime = 0.;
395  m_instLumi = 0.;
396  m_delLumi = 0.;
397  m_intLumi = 0.;
398  m_deltaT = 0.;
399 
400  m_totalPrescaleWLiveTime = 0.;
401  m_totalPrescale = 0.;
402  m_lumiWOPrescale = 0.;
403  m_lumiLAr = 0.;
404  m_TotaldeltaT = 0.;
405  m_livefrac = 0.;
406  m_livetime = 0.;
407  m_lartime = 0.;
408  m_larfrac = 0.;
409  m_bsvalid = 0.;
410  m_livetime_l1acc = 0;
411  m_l1acc = 0;
412  m_l2acc = 0;
413  m_l3acc = 0;
414  m_totall1acc = 0;
415  m_livtrig_totall1acc = 0;
416  m_totall2acc = 0;
417  m_totall3acc = 0;
418  m_l1prescale = 1.;
419  m_l2prescale = 1.;
420  m_l3prescale = 1.;
421  m_livetime_beforeprescale = 0;
422  m_livetime_afterprescale = 0;
423  m_afterprescale = 0;
424  m_beforeprescale = 0;
425  m_totall1befpresc = 0;
426  m_runnbr = 0;
427  m_lbstart = 0;
428  m_lbstop = 0;
429  m_lbstart_prev = 0;
430  m_lbstop_prev = 0;
431  m_totalgoodblock = 0;
432  m_totalbadblock = 0;
433  m_clumiblocknbr = 0;
434  m_clumiblocknbrend =0;
435  m_triglevel = 0;
436  m_lbcollectionname = "LumiBlocks";
437  m_triggerchain = triggerchain;
438  m_l1rate = 0.;
439  m_l2rate = 0.;
440  m_l3rate = 0.;
441  m_l1ratediveffxsec = 0.;
442  m_total_l1ratediveffxsec = 0.;
443  m_total_l1ratediveffxsecRun = 0.;
444  m_l1ratediveffxsec_recorded = 0.;
445  m_total_l1ratediveffxsec_recorded = 0.;
446  m_total_l1ratediveffxsecRun_recorded = 0.;
447  m_runnbr_prev = 0;
448 
449  // Set to extreme values, to be updated below
450  m_minrun = 99999999;
451  m_maxrun = 0;
452 
453  bool firstL1Missing = true;
454  bool firstHLTMissing = true;
455 
456  std::set<cool::ValidityKey> lbrunset;
457  lbrunset.clear();
458 
459  // collisions xml file settings
460  if (m_collsgrl!=0) { delete m_collsgrl; m_collsgrl=0; }
461  if (m_makecollList) {
462  m_collsgrl = new Root::TGoodRunsList();
463  m_collsgrl->SetVersion("30"); // lumicalc signature
464  m_collsgrl->AddMetaData("Query","Generated by LumiCalculator");
465  }
466 
467  // Figure out trigger level
468  m_triglevel = cq_lumi->getTriggerLevel(triggerchain);
469  if (m_triglevel == 0){
470  // Check if on purpose, otherwise, give a warning
471  if (triggerchain == "None") {
472  m_logger << Root::kINFO << "No trigger specified!" << Root::GEndl;
473  } else {
474  m_logger << Root::kWARNING << "Invalid trigger: [" << triggerchain << "] - will proceed with no trigger defined!" << Root::GEndl;
475  }
476  }
477 
478  // Look for b-jet triggers
479  regex_t regex;
480  int reti = regcomp(&regex, "_[[:digit:]]?b[[:digit:]]+_", REG_EXTENDED);
481  if (reti) m_logger << Root::kWARNING << "Could not compile regex!" << Root::GEndl;
482 
483  reti = regexec(&regex, triggerchain.c_str(), 0, NULL, 0);
484  if ( !reti && !m_usebs) {
485  m_logger << Root::kWARNING << "Trigger: [" << triggerchain << "] appears to be a b-jet trigger, but online beamspot validity not included in livefraction!" << Root::GEndl;
486  m_logger << Root::kWARNING << "Probably need to specify --beamspot to get accurate luminosity!" << Root::GEndl;
487  }
488  regfree(&regex);
489 
490  // get lumi channel id (this never changes)
491  if (m_lumimethod != "") {
492  m_Lumiid = cq_lumi->getLumiChannelId(m_lumimethod, m_parlumiestfolder);
493  } else {
494  m_Lumiid = m_lumichannel;
495  }
496 
497 
498  // do main LumiBlock loop
499  //==============================
500 
501  IOVData<cool::Int32> L1preObj;
502  IOVData<cool::Int32> L1preOther;
503  IOVData<cool::Float> L2preObj;
504  IOVData<cool::Float> L3preObj;
505  IOVData<cool::UInt32> LArObj;
506  IOVData<cool::Int32> BSObj;
507 
508  std::map<cool::ValidityKey, CoolQuery::LumiFolderData> LumiDataMap;
509 
510  // UTC nanoseconds since 1970
511  std::map<cool::ValidityKey, cool::UInt63> L1starttime_map;
512  std::map<cool::ValidityKey, cool::UInt63> L1endtime_map;
513 
514  // Livetime maps
515  std::map<cool::ValidityKey, CoolQuery::L1CountFolderData> Livetime_map;
516  std::map<cool::ValidityKey, CoolQuery::L1CountFolderData> L1accept_map;
517 
518  for(xAOD::LumiBlockRangeContainer::const_iterator it = iovc->begin(); it != iovc->end(); ++it){
519  const IOVRange* iovr = new IOVRange(IOVTime((*it)->startRunNumber(),(*it)->startLumiBlockNumber()),
520  IOVTime((*it)->stopRunNumber(),(*it)->stopLumiBlockNumber()));
521 
522  // Bookkeeping temporary results
523  m_t_totalDelL = 0.;
524  m_t_totalL = 0.;
525  m_t_totalLRun = 0.;
526  m_t_totaltime = 0.;
527  m_t_deltaT = 0.;
528  m_t_l1acc = 0;
529  m_t_l2acc = 0;
530  m_t_l3acc = 0;
531  m_t_totalgoodblock = 0;
532  m_t_totalbadblock = 0;
533  m_t_totall1befpresc = 0;
534  m_t_totalPrescaleWLiveTime = 0.;
535  m_t_totalPrescale = 0.;
536  m_t_lumiWOPrescale = 0. ;
537  m_t_lumiLAr = 0.;
538 
539  m_runnbr = iovr->start().run();
540  m_lbstart = iovr->start().event();
541  m_lbstop = iovr->stop().event();
542 
543  // Look for duplicate run/LB
544  if(m_lbstart_prev == m_lbstart && m_lbstop_prev == m_lbstop && m_runnbr_prev == m_runnbr){
545  m_logger << Root::kWARNING << "Skipping multiply stored IOVRange: [" << m_lbstart << "-" << m_lbstop << "]" << Root::GEndl;
546  continue;
547  }
548 
549  // new run, reset its lumi and reload the trigger channels
550  if ( m_runnbr!=m_runnbr_prev ) {
551 
552  if (m_runnbr < m_minrun) m_minrun = m_runnbr;
553  if (m_runnbr > m_maxrun) m_maxrun = m_runnbr;
554 
555  m_totalLRun=0.;
556  m_total_l1ratediveffxsecRun=0.;
557  m_total_l1ratediveffxsecRun_recorded=0.;
558 
559  // Set IOV range for full run
560  cq_trigger->setIOVForRun (m_runnbr);
561  cq_lumi->setIOVForRun(m_runnbr);
562 
563  // get trigger channel ids
564  m_L1Valid = false;
565  m_L2Valid = false;
566  m_L3Valid = false;
567  m_LiveValid = false;
568  m_triggerlowerchains.clear();
569  // These are used to resolve L1 ORs like [L1_MU20,L1_MU21]
570  m_L1triggerchains.clear();
571  m_L1idList.clear();
572 
573  std::string lowerch = "";
574 
575  // This is really inefficient...
576  if(m_triglevel == 3){
577  m_L3id = cq_trigger->getHLTChannelId(triggerchain, m_parhltmenufolder);
578  m_L3Valid = cq_trigger->channelIdValid();
579 
580  lowerch = cq_trigger->getHLTLowerChainName(triggerchain, m_parhltmenufolder);
581  m_triggerlowerchains.push_back(lowerch);
582  //
583  m_L2id = cq_trigger->getHLTChannelId(lowerch, m_parhltmenufolder);
584  m_L2Valid = cq_trigger->channelIdValid();
585 
586  lowerch = cq_trigger->getHLTLowerChainName(lowerch, m_parhltmenufolder);
587  m_triggerlowerchains.push_back(lowerch);
588  //
589  m_L1id = cq_trigger->getL1ChannelId(lowerch, m_parlvl1menufolder );
590  m_L1Valid = cq_trigger->channelIdValid();
591 
592  }else if(m_triglevel == 2){ // Run2 or starting at L2 in Run1
593  lowerch = cq_trigger->getHLTLowerChainName(triggerchain, m_parhltmenufolder);
594  m_triggerlowerchains.push_back(lowerch);
595  m_L2id = cq_trigger->getHLTChannelId(triggerchain, m_parhltmenufolder);
596  m_L2Valid = cq_trigger->channelIdValid();
597 
598  ParseL1Trigger(lowerch, cq_trigger);
599 
600  }else if(m_triglevel == 1){
601 
602  ParseL1Trigger(triggerchain, cq_trigger);
603  }
604 
605  if (firstL1Missing && (!m_L1Valid && m_triglevel > 0)) {
606  firstL1Missing = false;
607  cq_trigger->printL1Triggers(m_parlvl1menufolder);
608  }
609 
610  if (firstHLTMissing && ((!m_L2Valid && m_triglevel > 1) || (!m_L3Valid && m_triglevel > 2)) ) {
611  firstHLTMissing = false;
612  cq_trigger->printHLTTriggers(m_parhltmenufolder);
613  }
614 
615  // Should we check here for btag trigger and onl beamspot?
616 
617  // Do we use dedicated livetime trigger?
618  if(m_uselivetrigger){
619  m_LiveL1id = cq_trigger->getL1ChannelId(m_livetrigger, m_parlvl1menufolder);
620  m_LiveValid = cq_trigger->channelIdValid();
621  }else{
622  // then fall back to the original trigger
623  m_LiveL1id = m_L1id;
624  m_LiveValid = m_L1Valid;
625  }
626 
627  if (!m_LiveValid) {
628  if (m_uselivetrigger)
629  m_logger << Root::kWARNING << "Runnumber: [" << m_runnbr << "] can't find livefraction trigger [" << m_livetrigger << "]! Livefraction won't be calculated!" << Root::GEndl;
630  else
631  m_logger << Root::kWARNING << "Runnumber: [" << m_runnbr << "] can't find trigger [" << triggerchain << "]! Livefraction won't be calculated!" << Root::GEndl;
632  }
633 
634  // Also load all deadtime counters here
635 
636  // Need to fix this for non-MC. HLT counters now available, but not used here...
637 
638  //-------------------------
639  // Load livetime information
640  Livetime_map.clear();
641  L1accept_map.clear();
642 
643  if (m_LiveValid)
644  Livetime_map = cq_trigger->getL1CountFolderData(m_parlumilvl1folder, m_LiveL1id);
645 
646 
647  if (m_L1Valid && m_triglevel >= 1)
648  L1accept_map = cq_trigger->getL1CountFolderData(m_parlumilvl1folder, m_L1id);
649 
650  // UTC nanoseconds since 1970
651  L1starttime_map.clear();
652  L1endtime_map.clear();
653  L1starttime_map = cq_trigger->getObjMapFromFolderAtChan<cool::UInt63>("StartTime", m_parlvl1lblbfolder, 0);
654  L1endtime_map = cq_trigger->getObjMapFromFolderAtChan<cool::UInt63>("EndTime", m_parlvl1lblbfolder, 0);
655 
656  //---------------------------
657  // Load LAr defects
658  LArObj.clear();
659 
660  if (m_uselar) {
661  cool::ValidityKey runstarttime = L1starttime_map.begin()->second;
662  cool::ValidityKey runendtime = L1endtime_map.rbegin()->second;
663 
664  cq_lar->setIOV(runstarttime, runendtime);
665  LArObj = cq_lar->getIOVData<cool::UInt32>("EventVeto", m_parlareventvetofolder, 0, m_lartag);
666  }
667 
668  //---------------------------
669  // Load Onl beamspot
670  BSObj.clear();
671 
672  if (m_usebs) {
673  cq_bs->setIOVForRun(m_runnbr);
674  BSObj = cq_bs->getIOVData<cool::Int32>("status", m_paronlbeamspotfolder, 0, m_bstag);
675  }
676 
677 
678  //-----------------------------
679  // Load luminosity for this run
680  LumiDataMap.clear();
681  LumiDataMap = cq_lumi->getLumiFolderData(m_parlumiestfolder, m_lumitag, m_Lumiid);
682 
683 
684  } // End of new run stuff
685 
686  m_lbstart_prev = m_lbstart;
687  m_lbstop_prev = m_lbstop;
688  m_runnbr_prev = m_runnbr;
689 
690  // Update DB for this specific IOV range
691  cq_trigger->setIOV(iovr->start().re_time(), iovr->stop().re_time());
692 
693  // Print this here (will be output for each contiguous LB range in XML file)
694  m_logger << Root::kINFO << std::left << "-----------------------------------" << Root::GEndl;
695  m_logger << Root::kINFO << "Beginning calculation for ";
696  if (m_triglevel > 0) {
697  m_logger << Root::kINFO << "Trigger " << m_triggerchain;
698  if(m_triggerlowerchains.size() > 0){
699  m_logger << Root::kINFO << "[";
700  for(std::vector<std::string>::iterator sit = m_triggerlowerchains.begin(); sit != m_triggerlowerchains.end(); ++sit){
701  m_logger << Root::kINFO << "==>" << *sit;
702  }
703  m_logger << Root::kINFO << "], ";
704  }
705  }
706  m_logger << Root::kINFO << "Run " << m_runnbr << " LB [" << m_lbstart << "-" << m_lbstop << "]" << Root::GEndl;
707  m_logger << Root::kINFO << std::left << "-----------------------------------" << Root::GEndl;
708 
709  //----------------------------
710  // Load prescales for this IOV
711  L1preObj.clear();
712  L2preObj.clear();
713  L3preObj.clear();
714  L1preOther.clear(); // Used for mutliple L1 triggers
715 
716  if(m_L1Valid) {
717  // Normal case
718  if (m_L1idList.size() <= 1) {
719  L1preObj = cq_trigger->getIOVData<cool::Int32>("Lvl1Prescale", m_parlvl1prescalesfolder, m_L1id);
720 
721  // Multiple L1 items defined
722  } else {
723 
724  m_logger << Root::kINFO << "Resolving multiple L1 prescales:" << Root::GEndl;
725 
726  // Load first one
727  L1preObj = cq_trigger->getIOVData<cool::Int32>("Lvl1Prescale", m_parlvl1prescalesfolder, m_L1idList[0]);
728 
729  // Dump prescales
730  std::list< std::pair<IOVRange, cool::Int32> >::iterator it;
731 
732  m_logger << Root::kINFO << std::setw(10) << std::left << m_L1triggerchains[0];
733  for(it = L1preObj.data.begin(); it != L1preObj.data.end(); ++it) {
734  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" ;
735 
736  if (it->second < 0)
737  m_logger << it->second << ", ";
738  else
739  m_logger << (0xFFFFFF / float(0x1000000 - it->second)) << ", ";
740  }
741  m_logger << Root::kINFO << Root::GEndl;
742 
743  // Now loop over the remaining and replace
744  for (unsigned int iid=1; iid < m_L1idList.size(); iid++) {
745  L1preOther = cq_trigger->getIOVData<cool::Int32>("Lvl1Prescale", m_parlvl1prescalesfolder, m_L1idList[iid]);
746 
747  // Dump prescales
748  m_logger << Root::kINFO << std::setw(10) << std::left << m_L1triggerchains[iid];
749  for(it = L1preOther.data.begin(); it != L1preOther.data.end(); ++it) {
750  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" ;
751 
752  if (it->second < 0)
753  m_logger << it->second << ", ";
754  else
755  m_logger << (0xFFFFFF / float(0x1000000 - it->second)) << ", ";
756  }
757  m_logger << Root::kINFO << Root::GEndl;
758 
759  // Iterate through both lists and keep lowest non-negative prescale
760  std::list< std::pair<IOVRange, cool::Int32> >::iterator it1;
761  std::list< std::pair<IOVRange, cool::Int32> >::iterator it2;
762  for(it1 = L1preObj.data.begin(), it2 = L1preOther.data.begin(); it1 != L1preObj.data.end(); ++it1, ++it2) {
763 
764  // -1 is disabled, otherwise this is the event count to prescale
765  if ((it2->second > 0) && (it1->second > it2->second)) {
766  // Check if they are both prescaled (this is bad)
767  if ((it1->second > 1) && (it2->second > 1)) {
768  m_logger << Root::kWARNING << "L1 Prescales combined with both triggers prescaled for Run " << m_runnbr << "!" << Root::GEndl;
769  }
770  it1->second = it2->second;// See if this works...
771  }
772  }
773  }
774 
775  // OK done, lets check the result
776  // Dump prescales
777  m_logger << Root::kINFO << std::setw(10) << std::left << "L1 Pre:";
778  for(it = L1preObj.data.begin(); it != L1preObj.data.end(); ++it) {
779  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" ;
780 
781  if (it->second < 0)
782  m_logger << it->second << ", ";
783  else
784  m_logger << (0xFFFFFF / float(0x1000000 - it->second)) << ", ";
785  }
786  m_logger << Root::kINFO << Root::GEndl;
787 
788  }
789 
790  }
791 
792  if(m_L2Valid) {
793  if (isrun2) {
794  L2preObj = cq_trigger->getIOVData<cool::Float>("Prescale", m_parhltprescalesfolder, 20000 + m_L2id);
795  }
796  else {
797  L2preObj = cq_trigger->getIOVData<cool::Float>("Prescale", m_parhltprescalesfolder, 2*m_L2id);
798  }
799  }
800 
801  if(m_L3Valid) {
802  L3preObj = cq_trigger->getIOVData<cool::Float>("Prescale", m_parhltprescalesfolder, 2*m_L3id+1);
803  }
804 
805  // Reload the time map to get the ATLAS range
806  L1starttime_map.clear();
807  L1endtime_map.clear();
808  L1starttime_map = cq_trigger->getObjMapFromFolderAtChan<cool::UInt63>("StartTime", m_parlvl1lblbfolder, 0);
809  L1endtime_map = cq_trigger->getObjMapFromFolderAtChan<cool::UInt63>("EndTime", m_parlvl1lblbfolder, 0);
810 
811  // Restrict lb range if necessary based on actual ATLAS run/lb values
812  if (L1starttime_map.begin()->first > iovr->start().re_time() || L1starttime_map.rbegin()->first < iovr->stop().re_time()) {
813  m_lbstart = (L1starttime_map.begin()->first & 0xFFFFFFFF);
814  m_lbstop = (L1starttime_map.rbegin()->first & 0xFFFFFFFF);
815  m_logger << Root::kINFO << "Restricting to valid ATLAS lumi block range [" << m_lbstart << "-" << m_lbstop << "]" << Root::GEndl;
816  }
817 
818 
819  //
820  // Dont assume that all lumi blocks in this range are present in the lumi DB.
821  // Loop over all lumi blocks specifically and flag any missing lumi entries as bad lumi blocks.
822  //
823 
824  // Counters to check for missing LB ranges
825  int firstMissing = -1;
826  int lastMissing = -1;
827 
828  for (cool::ValidityKey currentVK = L1starttime_map.begin()->first; currentVK <= L1starttime_map.rbegin()->first; currentVK++) {
829 
830  // Current IOVTime
831  IOVTime curIOV;
832  curIOV.setRETime(currentVK);
833 
834  m_clumiblocknbr = curIOV.event();
835  m_clumiblocknbrend = curIOV.event()+1;
836 
837  // Check here for duplicate lumi blocks by explicitly keeping track of every run/lb seen
838  if (lbrunset.count(curIOV.re_time()) != 0) {
839  m_logger << Root::kWARNING << "Skipping duplicate [run,lumiblock]: " << curIOV << " !" << Root::GEndl;
840  continue;
841  } else {
842  lbrunset.insert(curIOV.re_time());
843  }
844 
845  // Not really good, just all seen
846  m_totalgoodblock += 1;
847  m_t_totalgoodblock += 1;
848 
849  // Find luminosity record
850  std::map<cool::ValidityKey, CoolQuery::LumiFolderData>::iterator itOL = LumiDataMap.find(currentVK);
851 
852  // Check if we didn't find anything
853  if (itOL == LumiDataMap.end()) {
854 
855  m_t_totalbadblock++;
856  m_totalbadblock++;
857 
858  if (firstMissing < 0) {
859  // Is this the first missing one? If so, make a note of it and go on
860  firstMissing = curIOV.event();
861  lastMissing = firstMissing;
862  } else if (int(curIOV.event()) == (lastMissing+1)) {
863  // Is this a contiguous missing lumi block?
864  lastMissing = curIOV.event();
865  } else {
866  // Not contiguous, print previous
867  if (firstMissing == lastMissing) {
868  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB " << firstMissing << " !" << Root::GEndl;
869  } else {
870  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB [" << firstMissing << "-" << lastMissing << "] !" << Root::GEndl;
871  }
872  firstMissing = curIOV.event();
873  lastMissing = firstMissing;
874  }
875 
876  // If last time through loop, print this also
877  if (currentVK == L1starttime_map.rbegin()->first) {
878  if (firstMissing == lastMissing) {
879  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB " << firstMissing << " !" << Root::GEndl;
880  } else {
881  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB [" << firstMissing << "-" << lastMissing << "] !" << Root::GEndl;
882  }
883  firstMissing = -1;
884  lastMissing = -1;
885  }
886 
887  // Skip rest of this LB
888  continue;
889 
890  } else {
891 
892  // Check if we had previous missing block
893  if (firstMissing >= 0) {
894  if (firstMissing == lastMissing) {
895  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB " << firstMissing << " !" << Root::GEndl;
896  } else {
897  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB [" << firstMissing << "-" << lastMissing << "] !" << Root::GEndl;
898  }
899 
900  firstMissing = -1;
901  lastMissing = -1;
902  }
903 
904  }
905 
906 
907  // given in units of ub^{-1} = 10^{30} cm^{-2}
908  m_instLumi = (itOL->second).LBAvInstLumi;
909  m_AvEvtsPerBX = (itOL->second).LBAvEvtsPerBX;
910  m_Valid = (itOL->second).Valid;
911 
912 
913  // Clear values in case trigger isn't defined
914  m_l1acc = 0.;
915  m_beforeprescale = 0.;
916  m_afterprescale = 0.;
917  m_l2acc = 0.;
918  m_l3acc = 0.;
919 
920  // Store dummy prescale values at start
921  m_l1prescale = -1.;
922  m_l2prescale = -1.;
923  m_l3prescale = -1.;
924 
925  // Some trigger is defined. Get prescales and values here
926  if(m_L1Valid && m_triglevel > 0) {
927 
928  // Get L1 prescale
929  if (isrun2) {
930  if (L1preObj.getValue(curIOV) < 0)
931  m_l1prescale = L1preObj.getValue(curIOV);
932  else
933  m_l1prescale = 0xFFFFFF / float(0x1000000 - L1preObj.getValue(curIOV));
934  }
935  else {
936  m_l1prescale = L1preObj.getValue(curIOV);
937  }
938 
939  if (m_triglevel >=2) {
940  if(m_L2Valid) {
941 
942  // Get L2 prescale
943  m_l2prescale = L2preObj.getValue(curIOV);
944 
945  }
946  // Else, prescale stays at -1.
947 
948  } else {
949  // Force L2 'passthrough'
950  m_l2prescale = 1.;
951  }
952 
953  if(m_triglevel == 3){
954  if (m_L3Valid) {
955 
956  // Get L3 prescale
957  m_l3prescale = L3preObj.getValue(curIOV);
958 
959  }
960  // Else, L3 prescale stays at -1.
961  } else {
962  // Force L3 'passthrough'
963  m_l3prescale = 1.;
964  }
965  }
966 
967  //-------------------------------
968  // Calculate livetime from a dedicated not rare trigger if user requested
969  CoolQuery::L1CountFolderData l1count = Livetime_map.find(currentVK)->second;
970 
971  m_livetime_beforeprescale = l1count.BeforePrescale;
972  m_livetime_afterprescale = l1count.AfterPrescale;
973  m_livetime_l1acc = l1count.L1Accept;
974  if(m_livetime_afterprescale > 0.){
975  m_livefrac = m_livetime_l1acc/(float)m_livetime_afterprescale;
976  }else{
977  m_livefrac = 0.0;
978  }
979 
980  // Hack for bad SFO in particular run
981  if (m_runnbr == 286367) {
982  m_livefrac *= 5./6.;
983  }
984 
985  if (m_runnbr == 281385) {
986  if (m_clumiblocknbr <= 196) {
987  m_livefrac *= 4./6.;
988  } else if (m_clumiblocknbr <= 374) {
989  m_livefrac *= 5./6.;
990  }
991  }
992 
993  // Check for low statistics in afterprescale counts
994  if(m_livetime_beforeprescale > 0 && m_livetime_afterprescale <= 0 ){
995  std::string ttrig = "";
996  ttrig = triggerchain;
997  if(m_uselivetrigger)ttrig = m_livetrigger;
998  m_logger << Root::kWARNING << "L1 counts after prescale (before veto) are 0.0 for trigger " << ttrig << "! Livefraction set to zero!" << Root::GEndl;
999  m_logger << Root::kWARNING << "Try using a high rate L1 trigger for livetime calculation: --livetrigger=<high rate L1 trigger> " << Root::GEndl;
1000  m_logger << Root::kINFO << m_runnbr << "[" << m_clumiblocknbr << "]: L1Acc: " << m_l1acc << ", AfterPrescale: " << m_afterprescale << ", L1Presc: " << m_l1prescale << Root::GEndl;
1001  }
1002 
1003  //------------------------
1004  // Calculate LAr veto time
1005 
1006  cool::ValidityKey lbstarttime = L1starttime_map.find(currentVK)->second;
1007  cool::ValidityKey lbendtime = L1endtime_map.find(currentVK)->second;
1008 
1009  m_lartime = 0.; // Time to exclude in seconds
1010  if (m_uselar) {
1011 
1012  IOVTime lbstart, lbend;
1013  lbstart.setRETime(lbstarttime);
1014  lbend.setRETime(lbendtime);
1015  IOVRange range(lbstart, lbend);
1016 
1017  std::list<std::pair<IOVRange, cool::UInt32> > larlist;
1018  larlist = LArObj.getOverlap(range);
1019 
1020  for (std::list<std::pair<IOVRange, cool::UInt32> >::iterator it = larlist.begin(); it != larlist.end(); ++it) {
1021  if (it->second == 0) continue;
1022  float dtime = (it->first.stop().re_time() - it->first.start().re_time())/1.E9;
1023  m_lartime += dtime;
1024  if (m_verbose == true) {
1025  m_logger << Root::kINFO << "Found LAr veto from " << it->first.start().re_time() << " to " << it->first.stop().re_time() << " = " << dtime << " seconds" << Root::GEndl;
1026  }
1027  }
1028  }
1029 
1030  //------------------------
1031  // Check for online BS
1032  m_bsvalid = 1.;
1033  if (m_usebs) {
1034 
1035  // Read beamspot validity
1036  bool valid = true;
1037  int status = BSObj.getValue(curIOV);
1038  //m_logger << Root::kINFO << "Found online beamspot status = " << status << Root::GEndl;
1039 
1040  if (status != 7) valid = false;
1041 
1042  if (!valid) {
1043  m_bsvalid = 0.0;
1044  m_livefrac = 0.0;
1045  if(m_verbose == true){
1046  m_logger << Root::kINFO << m_runnbr << "[" << m_clumiblocknbr << "]: Online beamspot invalid with Lumi=" << m_instLumi << " 10^30 cm-2 s-1" << Root::GEndl;
1047  }
1048  }
1049  }
1050 
1051  //-------------------------------
1052 
1053  l1count = L1accept_map.find(currentVK)->second;
1054  m_beforeprescale = l1count.BeforePrescale;
1055  m_beforeprescaleof = false;
1056  m_afterprescale = l1count.AfterPrescale;
1057  m_afterprescaleof = false;
1058  m_l1acc = l1count.L1Accept;
1059  m_l1accof = false;
1060 
1061  m_deltaT = (lbendtime-lbstarttime)/1.E9;
1062  m_lbstarttime = lbstarttime/1.E9;
1063  m_lbendtime = lbendtime/1.E9;
1064 
1065  if (m_deltaT > 0.) m_larfrac = 1.-m_lartime/m_deltaT;
1066 
1067  // For online lumi database case one needs to make some changes:
1068  if(m_onlinelumi == true){
1069  // In Valid UInt32 type value some information is encoded:
1070  // see: https://twiki.cern.ch/twiki/bin/view/Atlas/CoolOnlineData#Folder_TRIGGER_LUMI_LBLESTONL
1071  cool::UInt32 tempValid = (m_Valid & 1023);
1072 
1073  if(tempValid == 10){
1074  // in this bits, Value 301 and 302 means MBTS and LUCID lumi for which some care is needed
1075  if((m_Valid >> 22) == 301
1076  || (m_Valid >> 22) == 302
1077  || (m_Valid >> 22) == 101
1078  || (m_Valid >> 22) == 102
1079  || (m_Valid >> 22) == 103
1080  || (m_Valid >> 22) == 104
1081  ){
1082  m_Valid = 0;
1083  }else{
1084  m_Valid = tempValid;
1085  }
1086  }else{
1087  m_Valid = tempValid;
1088  }
1089 
1090  } else {
1091 
1092  // For offline, we also need to strip out the preferred channel value from the validity word
1093  m_Valid &= 0xFFFF;
1094  }
1095 
1096  // Dump out debugging information
1097  if(m_verbose == true){
1098  m_logger << Root::kINFO << m_runnbr << "[" << m_clumiblocknbr << "]: L1Acc: " << m_l1acc;
1099  if(m_uselivetrigger) m_logger << ", Livetime trigger L1Acc: " << m_livetime_l1acc;
1100  m_logger << ", InstLumi: " << m_instLumi << ", deltaT: " << m_deltaT << ", AvEvtsPerBX: " << m_AvEvtsPerBX << ", BeforePrescale: " << m_beforeprescale << ", AfterPrescale: " << m_afterprescale;
1101  if (m_uselivetrigger) m_logger << ", Livetime trigger BeforePrescale: " << m_livetime_beforeprescale << " Livetime trigger AfterPrescale: " << m_livetime_afterprescale;
1102  if (isrun2) {
1103  m_logger << ", Livefrac: " << m_livefrac << ", L1Presc: " << m_l1prescale << ", HLTPresc: " << m_l2prescale << ", Valid: " << m_Valid;
1104  } else {
1105  m_logger << ", Livefrac: " << m_livefrac << ", L1Presc: " << m_l1prescale << ", L2Presc: " << m_l2prescale << ", L3Presc: " << m_l3prescale << ", Valid: " << m_Valid;
1106  }
1107  if (m_uselar) m_logger << ", LAr ready fraction: " << m_larfrac;
1108  m_logger << Root::GEndl;
1109  }
1110 
1111  // Check if we have valid luminosity
1112  // Just need to check lowest digit. 10 -> BCID blind, 100 -> mu not valid
1113  if(m_Valid%10 != 0){
1114 
1115  // Invalid luminosity entry, call it bad
1116  m_instLumi = 0.0;
1117  m_totalbadblock += 1;
1118  m_t_totalbadblock += 1;
1119  m_logger << Root::kWARNING << "Skipping lumiblock " << m_runnbr << "[" << m_clumiblocknbr << "] with invalid inst. lumi. (valid=" << m_Valid << ")!" << Root::GEndl;
1120 
1121  } else if ((m_triglevel > 0) && (m_l1prescale < 0. || m_l2prescale < 0. || m_l3prescale < 0.)) {
1122 
1123  // Disabled trigger, call bad but still record delivered luminosity
1124  m_totalbadblock += 1;
1125  m_t_totalbadblock += 1;
1126  m_logger << Root::kWARNING << "Lumiblock " << m_runnbr << "[" << m_clumiblocknbr << "] has a disabled or incorrectly specified trigger.! " << Root::GEndl;
1127 
1128  }
1129 
1130  //========================================================//
1131  // L U M I N O S I T Y C A L C U L A T I O N H E R E //
1132  //========================================================//
1133  // The actual calculation of integrated luminosity and
1134  // accumulation of some variables
1135  m_totalDelL += (m_deltaT*m_instLumi); // delivered lumi
1136  m_t_totalDelL += (m_deltaT*m_instLumi); // delivered lumi
1137  m_t_deltaT += m_deltaT;
1138 
1139  // Count up everything
1140  m_totall1acc += m_l1acc;
1141  m_livtrig_totall1acc += m_livetime_l1acc;
1142  m_t_l1acc += m_l1acc;
1143  m_totall1befpresc += m_beforeprescale;
1144  m_t_totall1befpresc += m_beforeprescale;
1145  m_totall2acc += m_l2acc;
1146  m_t_l2acc += m_l2acc;
1147  m_totall3acc += m_l3acc;
1148  m_t_l3acc += m_l3acc;
1149  m_livetime = m_livefrac*m_deltaT;
1150  m_totaltime += m_livetime;
1151  m_t_totaltime += m_livetime;
1152 
1153  double totalPrescale = m_l1prescale * m_l2prescale * m_l3prescale;
1154 
1155  // Check for disabled triggers
1156  if (m_l1prescale < 0. ) totalPrescale = 0.;
1157  if (m_l2prescale < 0. ) totalPrescale = 0.;
1158  if (m_l3prescale < 0. ) totalPrescale = 0.;
1159 
1160  // Check also for no trigger
1161  if (m_triglevel == 0) totalPrescale = 1.;
1162 
1163  m_intLumi = 0.;
1164 
1165  m_lumiWOPrescale += m_livetime*m_instLumi ;
1166  m_t_lumiWOPrescale += m_livetime*m_instLumi ;
1167 
1168  m_lumiLAr += m_livetime*m_larfrac*m_instLumi;
1169  m_t_lumiLAr += m_livetime*m_larfrac*m_instLumi;
1170 
1171  if (totalPrescale > 0.) {
1172  m_totalPrescaleWLiveTime += m_livetime/totalPrescale;
1173  m_t_totalPrescaleWLiveTime += m_livetime/totalPrescale;
1174  m_totalPrescale += 1./totalPrescale;
1175  m_t_totalPrescale += 1./totalPrescale;
1176  m_intLumi = m_larfrac * m_livetime * m_instLumi/totalPrescale; // <<<--- T H E F O R M U L A
1177  }
1178 
1179 
1180  m_totalL += m_intLumi;
1181  m_t_totalL += m_intLumi;
1182  m_totalLRun += m_intLumi;
1183 
1184 
1185  // MB: trigger rates, note that livefrac drops out of ratio
1186  m_l1rate = ( m_livetime>0 ? m_l1acc / m_livetime : 0. );
1187  m_l2rate = ( m_livetime>0 ? m_l2acc / m_livetime : 0. );
1188  m_l3rate = ( m_livetime>0 ? m_l3acc / m_livetime : 0. );
1189 
1190  // MB: delivered lumi
1191  m_l1ratediveffxsec = (float)m_afterprescale/( m_deltaT*m_effxsec );
1192  m_total_l1ratediveffxsec += (float)m_afterprescale / m_effxsec ;
1193  m_total_l1ratediveffxsecRun += (float)m_afterprescale / m_effxsec ;
1194 
1195  // MB: recorded lumi
1196  m_l1ratediveffxsec_recorded = (float)m_l1acc /( m_deltaT*m_effxsec );
1197  m_total_l1ratediveffxsec_recorded += (float)m_l1acc / m_effxsec ;
1198  m_total_l1ratediveffxsecRun_recorded += (float)m_l1acc / m_effxsec ;
1199 
1200  if (m_collsgrl!=0) {
1201  if ( m_l1rate>=m_mintrigrate )
1202  m_collsgrl->AddRunLumiBlock(m_runnbr,m_clumiblocknbr);
1203  }
1204 
1205  if (m_verbose) {
1206  if (m_effxsec!=1.0)
1207  m_logger << Root::kINFO << "L1rate a/ prescale: " << m_afterprescale << ", Delivered LumiFromL1rate (/ub): " << m_l1ratediveffxsec << ", Delivered TotalLumiFromL1rate (/ub): " << m_total_l1ratediveffxsec
1208  << Root::GEndl;
1209  }
1210 
1211  if(m_LumiTree != 0)m_LumiTree->Fill();
1212  } // End of loop over lumi blocks
1213 
1214  // Print IOV summary
1215  m_logger << Root::kINFO<< std::setw(10) << std::left << ">== Trigger : " << triggerchain << Root::GEndl;
1216  m_logger << Root::kINFO<< std::setw(10) << std::right << "Run" << std::setw(10) << std::right << "L1-Acc" << std::setw(10) << std::right << "L2-Acc" << std::setw(10) << std::right << "L3-Acc" << std::setw(10) << std::right << "LiveTime" << std::setw(18) << std::right << "IntL rec.(ub^-1)" << std::setw(18) << std::right << "IntL del.(ub^-1)" << Root::GEndl;
1217  m_logger << Root::kINFO<< std::setw(10) << std::right << m_runnbr << std::setw(10) << std::right << m_t_l1acc << std::setw(10) << std::right << m_t_l2acc << std::setw(10) << std::right << m_t_l3acc << std::setw(10) << std::right << m_t_totaltime << std::setw(18) << std::right << m_t_totalL << std::setw(18) << std::right << m_t_totalDelL << Root::GEndl;
1218  // m_logger << Root::kINFO << std::setw(10) << std::right << "BeforePrescale" << std::setw(10) << std::right << m_totall1befpresc << std::setw(10) << std::right << "" << std::setw(10) << std::right << "" << std::setw(10) << std::right << "" << std::setw(10) << std::right << "" << std::setw(10) << std::right << "" << std::setw(10) << m_TotaldeltaT << std::setw(14) << std::right << m_totalL << Root::GEndl;
1219 
1220  m_logger << Root::kINFO<< std::setw(10) << std::left << "L1/2/3 accept: " << std::setw(10) << std::left << m_t_l1acc << std::setw(10) << std::left << m_t_l2acc << std::setw(10) << std::left << m_t_l3acc << Root::GEndl;
1221  m_logger << Root::kINFO << std::setw(10) << std::left << "L1BeforePresc: " << std::setw(10) << std::left << m_t_totall1befpresc << Root::GEndl;
1222  m_logger << Root::kINFO << std::setw(10) << std::left << "Livetime : " << m_t_totaltime << Root::GEndl;
1223  m_logger << Root::kINFO << std::setw(10) << std::left << "Prescale Weighted Livetime: " << m_t_totalPrescaleWLiveTime << Root::GEndl;
1224  m_logger << Root::kINFO<< std::setw(10) << std::left << "Good LBs : " << m_t_totalgoodblock - m_t_totalbadblock << Root::GEndl;
1225  m_logger << Root::kINFO<< std::setw(10) << std::left << "Bad LBs : " << m_t_totalbadblock << Root::GEndl;
1226 
1227  if ( m_effxsec==1.0 ) {
1228  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL delivered (ub^-1) : " << m_t_totalDelL << Root::GEndl;
1229  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL after livefraction (ub^-1): " << m_t_lumiWOPrescale << Root::GEndl;
1230  if (m_uselar)
1231  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL after LAr fraction (ub^-1): " << m_t_lumiLAr << Root::GEndl;
1232  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL recorded after prescale (ub^-1) : " << m_t_totalL << Root::GEndl;
1233  } else {
1234  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL delived (ub^-1) : " << m_total_l1ratediveffxsec << Root::GEndl;
1235  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL recorded (ub^-1) : " << m_total_l1ratediveffxsec_recorded << Root::GEndl;
1236  }
1237 
1238  // Print prescales as range of actual lumi blocks these apply to
1239  if(m_triglevel >= 1){
1240  // Print L1 Prescale values:
1241  m_logger << Root::kINFO << std::setw(10) << std::left << "L1 Prescales: ";
1242 
1243  std::list< std::pair<IOVRange, cool::Int32> >::iterator it;
1244  for(it = L1preObj.data.begin(); it != L1preObj.data.end(); ++it) {
1245  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" ;
1246  if (isrun2) {
1247  if (it->second < 0)
1248  m_logger << it->second << ", ";
1249  else
1250  m_logger << (0xFFFFFF / float(0x1000000 - it->second)) << ", ";
1251  } else {
1252  m_logger << it->second << ", ";
1253  }
1254  }
1255  m_logger << Root::kINFO << Root::GEndl;
1256  }
1257 
1258  if(m_triglevel >= 2){
1259  // Print L2 Prescale values:
1260  if (isrun2) {
1261  m_logger << Root::kINFO << std::setw(10) << std::left << "HLT Prescales: ";
1262  }
1263  else {
1264  m_logger << Root::kINFO << std::setw(10) << std::left << "L2 Prescales: ";
1265  }
1266 
1267  std::list< std::pair<IOVRange, cool::Float> >::iterator it;
1268  for(it = L2preObj.data.begin(); it != L2preObj.data.end(); ++it) {
1269  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" << it->second << ", ";
1270  }
1271  m_logger << Root::kINFO << Root::GEndl;
1272  }
1273 
1274  if(m_triglevel == 3){
1275  // Print L3 Prescale values:
1276  m_logger << Root::kINFO << std::setw(10) << std::left << "L3 Prescales: ";
1277 
1278  std::list< std::pair<IOVRange, cool::Float> >::iterator it;
1279  for(it = L3preObj.data.begin(); it != L3preObj.data.end(); ++it) {
1280  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" << it->second << ", ";
1281  }
1282  m_logger << Root::kINFO << Root::GEndl;
1283  }
1284 
1285  } // end lb collection loop
1286 
1287 
1288  // ------------------------------------------------------------------------------------------------
1289  // MB : Print total only at end of LB loop:
1290  m_logger << Root::kINFO << std::left << "-----------------------------------" << Root::GEndl;
1291  m_logger << Root::kINFO << std::left << " LumiCalculator summary" << Root::GEndl;
1292  m_logger << Root::kINFO << std::left << "-----------------------------------" << Root::GEndl;
1293  m_logger << Root::kINFO<< std::setw(10) << std::right << "Total" << std::setw(10) << std::right << "L1-Acc" << std::setw(10) << std::right << "L2-Acc" << std::setw(10) << std::right << "L3-Acc" <<
1294  std::setw(10) << std::right << "LiveTime" << std::setw(18) << std::right << "IntL rec.(ub^-1)" << std::setw(18) << std::right << "IntL del.(ub^-1)" << Root::GEndl;
1295  m_logger << Root::kINFO<< std::setw(10) << std::right << "" << std::setw(10) << std::right << m_totall1acc << std::setw(10) << std::right << m_totall2acc << std::setw(10) << std::right
1296  << m_totall3acc << std::setw(10) << std::right << m_totaltime << std::setw(18) << std::right << m_totalL << std::setw(18) << std::right << m_totalDelL << Root::GEndl;
1297  m_logger << Root::kINFO<< std::setw(10) << std::left << "Total L1/2/3 accept: " << std::setw(10) << std::left << m_totall1acc << std::setw(10) << std::left << m_totall2acc << std::setw(10)
1298  << std::left << m_totall3acc << Root::GEndl;
1299  if(m_uselivetrigger)m_logger << Root::kINFO<< std::setw(10) << std::left << "Total L1 livetime trigger accept: " << std::setw(10) << std::left << m_livtrig_totall1acc << Root::GEndl;
1300 
1301  m_logger << Root::kINFO << std::setw(10) << std::left << "First Run: " << std::setw(10) << std::left << m_minrun << Root::GEndl;
1302  m_logger << Root::kINFO << std::setw(10) << std::left << "Last Run: " << std::setw(10) << std::left << m_maxrun << Root::GEndl;
1303  m_logger << Root::kINFO << std::setw(10) << std::left << "Total L1BeforePresc: " << std::setw(10) << std::left << m_totall1befpresc << Root::GEndl;
1304  m_logger << Root::kINFO<< std::setw(10) << std::left << "Total Livetime : " << m_totaltime << Root::GEndl;
1305  m_logger << Root::kINFO << std::setw(10) << std::left << "Total prescale weighted Livetime: " << m_totalPrescaleWLiveTime << Root::GEndl;
1306  m_logger << Root::kINFO<< std::setw(10) << std::left << "Total Good LBs : " << m_totalgoodblock - m_totalbadblock << Root::GEndl;
1307  m_logger << Root::kINFO<< std::setw(10) << std::left << "Total Bad LBs : " << m_totalbadblock << Root::GEndl;
1308  m_logger << Root::kINFO << std::setw(10) << std::left << "Total IntL delivered (ub^-1) : " << m_totalDelL << Root::GEndl;
1309  m_logger << Root::kINFO << std::setw(10) << std::left << "Total IntL after livefraction (ub^-1): " << m_lumiWOPrescale << Root::GEndl;
1310  if (m_uselar)
1311  m_logger << Root::kINFO << std::setw(10) << std::left << "Total IntL after LAr fraction (ub^-1): " << m_lumiLAr << Root::GEndl;
1312  m_logger << Root::kINFO << std::setw(10) << std::left << "Total IntL recorded (ub^-1) : " << m_totalL << Root::GEndl;
1313 
1314  // ------------------------------------------------------------------------------------------------
1315 
1316  if(m_makecollList == true){
1317  // store collisions xml file on demand
1318  if (m_collsgrl!=0) {
1319  TString collisionsxml = "collisions_" + m_collsgrl->GetSuggestedName() + ".xml";
1321  writer.SetGoodRunsList( *m_collsgrl );
1322  writer.SetFilename( collisionsxml.Data() );
1323  writer.WriteXMLFile();
1324  // can now delete grl
1325  delete m_collsgrl; m_collsgrl=0;
1326  }
1327  }
1328 
1329 
1330  // Creating monitoring plots on demand
1331  if(m_makePlots == true) { this->MakePlots(triggerchain); }
1332 
1333  delete cq_trigger;
1334  delete cq_lumi;
1335  delete cq_lar;
1336  delete cq_bs;
1337 }
1338 
1339 // Deal with composite L1 trigger
1340 void
1341 LumiCalculator::ParseL1Trigger(const std::string& lowerch, CoolQuery * cq_trigger) {
1342 
1343  //
1344  // Check if we have multiple entries
1345  size_t last = 0;
1346  size_t next = 0;
1347  cool::ChannelId id;
1348  bool valid;
1349 
1350  m_L1id = 0;
1351  m_L1Valid = false;
1352 
1353  if (lowerch.find(',', last) == std::string::npos) {
1354  // Normal case
1355  m_L1id = cq_trigger->getL1ChannelId(lowerch, m_parlvl1menufolder);
1356  m_L1Valid = cq_trigger->channelIdValid();
1357 
1358  } else {
1359  m_logger << Root::kINFO << "L1 item is composite: " << lowerch << Root::GEndl;
1360  do {
1361  next = lowerch.find(',', last);
1362  // Check if these are valid before using them
1363  id = cq_trigger->getL1ChannelId(lowerch.substr(last, next-last), m_parlvl1menufolder);
1364  valid = cq_trigger->channelIdValid();
1365  if (valid) {
1366  m_L1triggerchains.push_back(lowerch.substr(last, next-last));
1367  m_L1idList.push_back(m_L1id);
1368  m_L1id = id;
1369  m_L1Valid = true;
1370  } else {
1371  m_logger << Root::kINFO << lowerch.substr(last, next-last) << " Invalid" << Root::GEndl;
1372  }
1373 
1374  last = next + 1;
1375  } while (next != std::string::npos);
1376 
1377 
1378  }
1379 }
1380 
1381 // ---------------------------------------------------------------------------------
1382 // Utility to print lumicalc summary results
1383 void
1385 
1386  os << std::left << "-----------------------------------" << std::endl;
1387  os << std::left << " LumiCalculator summary" << std::endl;
1388  os << std::left << "-----------------------------------" << std::endl;
1389  os << std::setw(10) << std::left << "Trigger: " << std::setw(10) << std::left << m_triggerchain << std::endl;
1390  os << std::setw(10) << std::left << "First Run: " << std::setw(10) << std::left << m_minrun << std::endl;
1391  os << std::setw(10) << std::left << "Last Run: " << std::setw(10) << std::left << m_maxrun << std::endl;
1392  os << std::setw(10) << std::left << "Total L1BeforePresc: " << std::setw(10) << std::left << m_totall1befpresc << std::endl;
1393  os << std::setw(10) << std::left << "Total Livetime : " << m_totaltime << std::endl;
1394  os << std::setw(10) << std::left << "Total prescale weighted Livetime: " << m_totalPrescaleWLiveTime << std::endl;
1395  os << std::setw(10) << std::left << "Total Good LBs : " << m_totalgoodblock - m_totalbadblock << std::endl;
1396  os << std::setw(10) << std::left << "Total Bad LBs : " << m_totalbadblock << std::endl;
1397  os << std::setw(10) << std::left << "Total IntL delivered (ub^-1) : " << m_totalDelL << std::endl;
1398  os << std::setw(10) << std::left << "Total IntL after livefraction (ub^-1): " << m_lumiWOPrescale << std::endl;
1399  if (m_uselar)
1400  os << std::setw(10) << std::left << "Total IntL after LAr fraction (ub^-1): " << m_lumiLAr << std::endl;
1401  os << std::setw(10) << std::left << "Total IntL recorded (ub^-1) : " << m_totalL << std::endl;
1402 
1403 }
1404 
1405 void
1406 LumiCalculator::DoHistogramAdmin(const uint32_t& runnbr, const TString& trigName, const float& effxsec)
1407 {
1408  // rebin the histograms once number of LBs is known
1409  int maxlb = 5000;
1410 
1411  m_ntrigplbVec.push_back( new TH1F(Form("run%d_ntrigplb",runnbr), Form("Run %d",runnbr) , maxlb, 0., float(maxlb)) );
1412  m_trigrateplbVec.push_back( new TH1F(Form("run%d_trigrateplb",runnbr), Form("Run %d",runnbr) , maxlb, 0., float(maxlb)) );
1413  m_lumiplbVec.push_back( new TH1F(Form("run%d_peaklumiplb",runnbr), Form("Run %d",runnbr) , maxlb, 0., float(maxlb)) );
1414  m_lumitrigrateplbVec.push_back( new TH1F(Form("run%d_peaklumitrigrateplb",runnbr), Form("Run %d",runnbr) , maxlb, 0., float(maxlb)) );
1415  m_intlumiVec.push_back( new TH1F(Form("run%d_intlumi",runnbr), Form("Run %d",runnbr) , maxlb, 0., float(maxlb)) );
1416  m_intlumitrigrateVec.push_back( new TH1F(Form("run%d_intlumitrigrate",runnbr), Form("Run %d",runnbr) , maxlb, 0., float(maxlb)) );
1417  m_lumitrigrateplb_recordedVec.push_back( new TH1F(Form("run%d_peakrecordedlumitrigrateplb",runnbr), Form("Run %d",runnbr) , maxlb, 0., float(maxlb)) );
1418  m_intlumitrigrate_recordedVec.push_back( new TH1F(Form("run%d_intrecordedlumitrigrate",runnbr), Form("Run %d",runnbr) , maxlb, 0., float(maxlb)) );
1419 
1420  m_ntrigplb = *(m_ntrigplbVec.rbegin());
1421  m_trigrateplb = *(m_trigrateplbVec.rbegin());
1422  m_lumiplb = *(m_lumiplbVec.rbegin());
1424  m_intlumi = *(m_intlumiVec.rbegin());
1428 
1429  this->SetHistogramStyle(m_ntrigplb, Form("Run = %d",runnbr), "Luminosity block number", Form("# %s triggers / LB",trigName.Data()));
1430  this->SetHistogramStyle(m_trigrateplb, Form("Run = %d",runnbr), "Luminosity block number", Form("%s trigger rate / LB",trigName.Data()));
1431  this->SetHistogramStyle(m_lumiplb, Form("Run = %d",runnbr), "Luminosity block number", "Delivered luminosity (#mub^{-1}/s)");
1432  this->SetHistogramStyle(m_lumitrigrateplb, Form("Efficiency * x-sec = %.1f #mub, Run = %d",effxsec,runnbr), "Luminosity block number", Form("%s luminosity (#mub^{-1}/s)",trigName.Data()));
1433  this->SetHistogramStyle(m_intlumi, Form("Run = %d",runnbr), "Luminosity block number", "Integrated delivered luminosity (#mub^{-1})");
1434  this->SetHistogramStyle(m_intlumitrigrate, Form("Efficiency * x-sec = %.1f #mub, Run = %d",effxsec,runnbr), "Luminosity block number", Form("%s Integrated luminosity (#mub^{-1})",trigName.Data()));
1435  this->SetHistogramStyle(m_lumitrigrateplb_recorded, Form("Efficiency * x-sec = %.1f #mub, Run = %d",effxsec,runnbr), "Luminosity block number", Form("%s Recorded luminosity (#mub^{-1}/s)",trigName.Data()));
1436  this->SetHistogramStyle(m_intlumitrigrate_recorded, Form("Efficiency * x-sec = %.1f #mub, Run = %d",effxsec,runnbr), "Luminosity block number", Form("%s Integrated recorded luminosity (#mub^{-1})",trigName.Data()));
1437 }
1438 
1439 
1440 void
1441 LumiCalculator::RebinHistograms(const int& nbins, const double& start, const double& end)
1442 {
1443  m_ntrigplb->SetBins(nbins,start,end);
1444  m_trigrateplb->SetBins(nbins,start,end);
1445  m_lumiplb->SetBins(nbins,start,end);
1446  m_lumitrigrateplb->SetBins(nbins,start,end);
1447  m_intlumi->SetBins(nbins,start,end);
1448  m_intlumitrigrate->SetBins(nbins,start,end);
1451 }
1452 
1453 
1454 void
1455 LumiCalculator::SetHistogramStyle(TH1F* hist, const char* title, const char* xaxis, const char* yaxis)
1456 {
1457  hist->SetFillColor(33); // light grey, blueish
1458  if (title!=0) hist->SetTitle(title);
1459  if (xaxis!=0) hist->GetXaxis()->SetTitle(xaxis);
1460  if (yaxis!=0) hist->GetYaxis()->SetTitle(yaxis);
1461 
1462  hist->GetXaxis()->SetLabelFont(52);
1463  hist->GetXaxis()->SetLabelSize(0.04);
1464  hist->GetXaxis()->SetTitleSize(0.05);
1465  hist->GetXaxis()->SetTitleOffset(1.28);
1466  hist->GetXaxis()->SetTitleFont(42);
1467 
1468  hist->GetYaxis()->SetLabelFont(52);
1469  hist->GetYaxis()->SetLabelSize(0.04);
1470  hist->GetYaxis()->SetTitleSize(0.05);
1471  hist->GetYaxis()->SetTitleOffset(1.25);
1472  hist->GetYaxis()->SetTitleFont(42);
1473 
1474  hist->SetStats(false);
1475 
1476  hist->SetLineWidth(2);
1477 }
1478 
1479 void
1480 LumiCalculator::MakePlots(const std::string& triggerchain)
1481 {
1482  if(m_LumiTree != 0){
1483  // rebin and fill histograms:
1484  m_LumiTree->SetBranchAddress("LBStart", &m_clumiblocknbr);
1485  m_LumiTree->SetBranchAddress("L1AfterPrescale", &m_afterprescale);
1486  m_LumiTree->SetBranchAddress("L1Rate", &m_l1rate);
1487  m_LumiTree->SetBranchAddress("IntLumi",&m_intLumi);
1488  m_LumiTree->SetBranchAddress("L1Ratediveffxsec",&m_l1ratediveffxsec);
1489  m_LumiTree->SetBranchAddress("TotalLumi",&m_totalL);
1490  m_LumiTree->SetBranchAddress("Total_L1Ratediveffxsec",&m_total_l1ratediveffxsec);
1491  m_LumiTree->SetBranchAddress("TotalLumiRun",&m_totalLRun);
1492  m_LumiTree->SetBranchAddress("Total_L1RatediveffxsecRun",&m_total_l1ratediveffxsecRun);
1493  m_LumiTree->SetBranchAddress("RunNbr", &m_runnbr);
1494  m_LumiTree->SetBranchAddress("L1RatediveffxsecRecorded",&m_l1ratediveffxsec_recorded);
1495  m_LumiTree->SetBranchAddress("Total_L1RatediveffxsecRecorded",&m_total_l1ratediveffxsec_recorded);
1496  m_LumiTree->SetBranchAddress("Total_L1RatediveffxsecRunRecorded",&m_total_l1ratediveffxsecRun_recorded);
1497  m_LumiTree->SetBranchAddress("AvergeInteractionPerXing",&m_AvEvtsPerBX);
1498 
1499  // get first and last run number
1500  m_LumiTree->GetEntry(0);
1501  int runnbrstart = m_runnbr;
1502  m_LumiTree->GetEntry(m_LumiTree->GetEntries()-1);
1503  int runnbrend = m_runnbr;
1504 
1505  // makeup of integrated lumi histograms
1506  m_intlumiruns = new TH1F("intlumiruns","Luminosity",1,0.,1.);
1507  m_intlumitrigrateruns = new TH1F("intlumitrigrateruns","Delivered luminosity",1,0.,1.);
1508  m_intlumitrigrateruns_recorded = new TH1F("intlumitrigrateruns_recorded","Recorded luminosity",1,0.,1.);
1509  m_intlumiruns->SetBins(runnbrend-runnbrstart+10,float(runnbrstart),float(runnbrend+10));
1510  m_intlumitrigrateruns->SetBins(runnbrend-runnbrstart+10,float(runnbrstart),float(runnbrend+10));
1511  m_intlumitrigrateruns_recorded->SetBins(runnbrend-runnbrstart+10,float(runnbrstart),float(runnbrend+10));
1512 
1513  // Lumi-weighted average interactions per crossing
1514  m_avgintperbx = new TH1F("avgintperbx", "Avg Int/BX", 1000, 0., 100.);
1515  m_avgintperbx->SetTitle("Lumi-weighted Interactions per BX");
1516  this->SetHistogramStyle(m_avgintperbx, "Lumi-weighted Average Interactions per BX", "Average Interactions per BX", "Recorded Luminosity (mb-1)");
1517 
1518  // loop over the lumi tree
1519  m_runnbr_prev = 0;
1520  int nlbs(0);
1521  float totalL(0.), total_l1ratediveffxsec(0.), total_l1ratediveffxsec_recorded(0.), totalLRun(0.), total_l1ratediveffxsecRun(0.), total_l1ratediveffxsecRun_recorded(0.);
1522  for(int i=0; i < m_LumiTree->GetEntries(); i++){
1523  m_LumiTree->GetEntry(i);
1524 
1525  // do histogram admin first
1526  if ( m_runnbr!=m_runnbr_prev ) {
1527  // first rebin prev histograms
1528  if (m_runnbr_prev>0) {
1529  m_intlumi->SetTitle(Form("Delivered luminosity = %.1f /#mu b, Run = %d",totalLRun,m_runnbr_prev));
1530  m_intlumitrigrate->SetTitle(Form("Delivered luminosity = %.1f /#mu b, Efficiency * x-sec = %.1f #mu b, Run = %d",total_l1ratediveffxsecRun,m_effxsec,m_runnbr_prev));
1531  m_intlumitrigrate_recorded->SetTitle(Form("Recorded luminosity = %.1f /#mu b, Efficiency * x-sec = %.1f #mu b, Run = %d",total_l1ratediveffxsecRun_recorded,m_effxsec,m_runnbr_prev));
1532  this->RebinHistograms(nlbs+10,0,double(nlbs+10));
1533  }
1534  // create new histograms
1535  this->DoHistogramAdmin(m_runnbr,triggerchain,m_effxsec);
1536  // fill cullumative luminosity
1537  if (m_runnbr_prev>0) {
1538  for (uint32_t j=m_runnbr_prev; j<m_runnbr; ++j) {
1539  m_intlumiruns->Fill(j,totalL);
1540  m_intlumitrigrateruns->Fill(j,total_l1ratediveffxsec);
1541  m_intlumitrigrateruns_recorded->Fill(j,total_l1ratediveffxsec_recorded);
1542  }
1543  }
1545  }
1546  totalL = m_totalL;
1547  totalLRun = m_totalLRun;
1548  total_l1ratediveffxsec = m_total_l1ratediveffxsec;
1549  total_l1ratediveffxsecRun = m_total_l1ratediveffxsecRun;
1550  total_l1ratediveffxsec_recorded = m_total_l1ratediveffxsec_recorded;
1551  total_l1ratediveffxsecRun_recorded = m_total_l1ratediveffxsecRun_recorded;
1552  nlbs = m_clumiblocknbr;
1553 
1562  m_avgintperbx->Fill(m_AvEvtsPerBX, m_intLumi); // Lumi-weighted mu
1563 
1564  } // end tree loop
1565  m_intlumiruns->Fill(runnbrend,totalL);
1566  m_intlumitrigrateruns->Fill(runnbrend,total_l1ratediveffxsec);
1567  m_intlumitrigrateruns_recorded->Fill(runnbrend,total_l1ratediveffxsec_recorded);
1568 
1569  // finish histograms make-up
1570  m_intlumiruns->SetMinimum(0.);
1571  m_intlumitrigrateruns->SetMinimum(0.);
1572  this->RebinHistograms(nlbs+10,0,double(nlbs+10));
1573  this->SetHistogramStyle(m_intlumiruns, Form("Delivered luminosity = %.1f /ub",totalL), "Run number", "Luminosity (#mu b^{-1})");
1574  this->SetHistogramStyle(m_intlumitrigrateruns, Form("Delivered luminosity = %.1f /#mu b, Recorded luminosity = %.1f /#mu b", //, Efficiency * x-sec = %.1f mb",
1575  total_l1ratediveffxsec,total_l1ratediveffxsec_recorded/*,m_effxsec*/), "Run number", Form("%s Luminosity (#mu b^{-1})",triggerchain.c_str()));
1576  this->SetHistogramStyle(m_intlumitrigrateruns_recorded, Form("Delivered luminosity = %.1f /#mub, Recorded luminosity = %.1f /#mub", //, Efficiency * x-sec = %.1f #mub",
1577  total_l1ratediveffxsec,total_l1ratediveffxsec_recorded/*,m_effxsec*/), "Run number", Form("%s Luminosity (#mu b^{-1})",triggerchain.c_str()));
1578 
1580 
1581  // and store the histograms
1582  TString histFileName = TString("ilumicalc_histograms_") + TString(triggerchain) + ( runnbrstart==runnbrend ? Form("_%d_",runnbrstart) : Form("_%d-%d_",runnbrstart,runnbrend)) + TString(m_lumitag) + TString(".root");
1583  TFile *ff = new TFile(histFileName.Data(),"recreate");
1584  m_avgintperbx->Write();
1585  if (m_effxsec==1.0) {
1586  m_intlumiruns->Write();
1587  for (itr=m_lumiplbVec.begin(); itr!=m_lumiplbVec.end(); ++itr) { (*itr)->Write(); }
1588  for (itr=m_intlumiVec.begin(); itr!=m_intlumiVec.end(); ++itr) { (*itr)->Write(); }
1589  }
1590  for (itr=m_ntrigplbVec.begin(); itr!=m_ntrigplbVec.end(); ++itr) { (*itr)->Write(); }
1591  for (itr=m_trigrateplbVec.begin(); itr!=m_trigrateplbVec.end(); ++itr) { (*itr)->Write(); }
1592  if (m_effxsec!=1.0) { // results only make sense when proper xsec is provided externally
1593  m_intlumitrigrateruns->Write();
1595  for (itr=m_lumitrigrateplbVec.begin(); itr!=m_lumitrigrateplbVec.end(); ++itr) { (*itr)->Write(); }
1596  for (itr=m_intlumitrigrateVec.begin(); itr!=m_intlumitrigrateVec.end(); ++itr) { (*itr)->Write(); }
1597  for (itr=m_lumitrigrateplb_recordedVec.begin(); itr!=m_lumitrigrateplb_recordedVec.end(); ++itr) { (*itr)->Write(); }
1598  for (itr=m_intlumitrigrate_recordedVec.begin(); itr!=m_intlumitrigrate_recordedVec.end(); ++itr) { (*itr)->Write(); }
1599  }
1600  m_LumiTree->Write();
1601 
1602  // And write out the lumi tag information
1603  TObjString lumiTag(m_lumitag.c_str());
1604  lumiTag.Write("lumiTag");
1605 
1606  TObjString larTag(m_lartag.c_str());
1607  larTag.Write("larTag");
1608 
1609 
1610  ff->Close();
1611  delete ff;
1612  m_logger << Root::kINFO << "Histograms stored as : " << histFileName << Root::GEndl;
1613 
1614  }else{
1615  m_logger << Root::kWARNING << "LumiTree pointer does not exist! : " << Root::GEndl;
1616  }
1617 
1618 
1619 }
1620 
1621 
RunTileTBRec.method
method
Definition: RunTileTBRec.py:73
LumiCalculator::m_deltaT
float m_deltaT
Definition: LumiCalculator.h:121
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
LumiCalculator::m_afterprescaleof
bool m_afterprescaleof
Definition: LumiCalculator.h:141
LumiCalculator::m_l2acc
unsigned int m_l2acc
Definition: LumiCalculator.h:128
TGoodRunsList.h
LumiCalculator::m_lumiLAr
float m_lumiLAr
Definition: LumiCalculator.h:161
LumiCalculator::m_ntrigplbVec
std::vector< TH1F * > m_ntrigplbVec
Definition: LumiCalculator.h:213
LumiCalculator::m_livetrigger
std::string m_livetrigger
Definition: LumiCalculator.h:75
Root::kWARNING
@ kWARNING
Definition: TMsgLogger.h:51
LumiCalculator::m_totalbadblock
unsigned int m_totalbadblock
Definition: LumiCalculator.h:151
LumiCalculator::m_lumimethod
std::string m_lumimethod
Definition: LumiCalculator.h:80
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
LumiCalculator::UseLumiChannel
void UseLumiChannel(int chan)
Definition: LumiCalculator.cxx:281
LumiCalculator::m_totalgoodblock
unsigned int m_totalgoodblock
Definition: LumiCalculator.h:150
LumiCalculator::m_intlumi
TH1F * m_intlumi
Definition: LumiCalculator.h:202
LumiCalculator::m_lbstarttime
double m_lbstarttime
Definition: LumiCalculator.h:109
LumiCalculator::printSummary
void printSummary(std::ostream &os)
Definition: LumiCalculator.cxx:1384
IOVRange
Validity Range object. Holds two IOVTimes (start and stop)
Definition: IOVRange.h:30
python.output.AtlRunQueryRoot.MakePlots
def MakePlots(tree, datapath)
Definition: AtlRunQueryRoot.py:111
LumiCalculator::SetHistogramStyle
void SetHistogramStyle(TH1F *hist, const char *title=0, const char *xaxis=0, const char *yaxis=0)
Definition: LumiCalculator.cxx:1455
IOVTime::event
uint32_t event() const noexcept
Definition: IOVTime.h:106
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
IOVData
Definition: CoolQuery.h:54
LumiCalculator::m_usebs
bool m_usebs
Definition: LumiCalculator.h:238
LumiCalculator::m_intlumitrigrate
TH1F * m_intlumitrigrate
Definition: LumiCalculator.h:203
CoolQuery::getLumiFolderData
std::map< cool::ValidityKey, LumiFolderData > getLumiFolderData(const std::string &folder_name, const std::string &tag, const cool::ChannelId &id)
Definition: CoolQuery.cxx:290
LumiCalculator::RebinHistograms
void RebinHistograms(const int &nbins, const double &start, const double &end)
Definition: LumiCalculator.cxx:1441
LumiCalculator::m_lumichannel
int m_lumichannel
Definition: LumiCalculator.h:85
plotmaker.hist
hist
Definition: plotmaker.py:148
LumiCalculator::m_bsonl
std::string m_bsonl
Definition: LumiCalculator.h:83
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
tree
TChain * tree
Definition: tile_monitor.h:30
IOVRange::start
const IOVTime & start() const
Definition: IOVRange.h:38
CoolQuery::getHLTLowerChainName
std::string getHLTLowerChainName(const std::string &trigger, const std::string &folder_name)
Definition: CoolQuery.cxx:256
CoolQuery::setIOVForRun
void setIOVForRun(unsigned int runnum)
Definition: CoolQuery.cxx:101
skel.it
it
Definition: skel.GENtoEVGEN.py:396
IOVTime::re_time
uint64_t re_time() const noexcept
Definition: IOVTime.h:107
CoolQuery::L1CountFolderData::AfterPrescale
cool::UInt63 AfterPrescale
Definition: CoolQuery.h:312
LumiCalculator::m_afterprescale
ULong64_t m_afterprescale
Definition: LumiCalculator.h:138
LumiCalculator::m_lumitrigrateplbVec
std::vector< TH1F * > m_lumitrigrateplbVec
Definition: LumiCalculator.h:216
LumiCalculator::m_trigger
std::string m_trigger
Definition: LumiCalculator.h:74
CoolQuery::L1CountFolderData::BeforePrescale
cool::UInt63 BeforePrescale
Definition: CoolQuery.h:311
ATLAS_NOT_THREAD_SAFE
void LumiCalculator::IntegrateLumi ATLAS_NOT_THREAD_SAFE(const xAOD::LumiBlockRangeContainer *iovc, const std::string &triggerchain)
Definition: LumiCalculator.cxx:308
LumiCalculator::m_lumitrigrateplb
TH1F * m_lumitrigrateplb
Definition: LumiCalculator.h:201
LumiCalculator::m_lumiplbVec
std::vector< TH1F * > m_lumiplbVec
Definition: LumiCalculator.h:215
LumiCalculator::m_L1id
cool::ChannelId m_L1id
Definition: LumiCalculator.h:228
LumiCalculator::m_parlvl1menufolder
std::string m_parlvl1menufolder
Definition: LumiCalculator.h:90
LumiCalculator::m_avgintperbx
TH1F * m_avgintperbx
Definition: LumiCalculator.h:211
LumiCalculator.h
LumiCalculator::m_l3prescale
float m_l3prescale
Definition: LumiCalculator.h:137
LumiCalculator::SetCollName
void SetCollName(const std::string &lbcollname)
Definition: LumiCalculator.cxx:250
LumiCalculator::m_totalLRun
float m_totalLRun
Definition: LumiCalculator.h:114
LumiCalculator::UseLumiMethod
void UseLumiMethod(const std::string &method)
Definition: LumiCalculator.cxx:277
GEndl
#define GEndl
Definition: TMsgLogger.h:151
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
LumiCalculator::m_intlumiVec
std::vector< TH1F * > m_intlumiVec
Definition: LumiCalculator.h:217
LumiCalculator::m_trigrateplb
TH1F * m_trigrateplb
Definition: LumiCalculator.h:199
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
LumiCalculator::m_AvEvtsPerBX
float m_AvEvtsPerBX
Definition: LumiCalculator.h:117
CoolQuery::getL1CountFolderData
std::map< cool::ValidityKey, L1CountFolderData > getL1CountFolderData(const std::string &folder_name, const cool::ChannelId &id)
Definition: CoolQuery.cxx:324
IOVRange::stop
const IOVTime & stop() const
Definition: IOVRange.h:39
LumiCalculator::m_livefrac
float m_livefrac
Definition: LumiCalculator.h:123
LumiCalculator::m_bstag
std::string m_bstag
Definition: LumiCalculator.h:84
LumiCalculator::m_lumi_database
std::string m_lumi_database
Definition: LumiCalculator.h:69
LumiCalculator::m_lartag
std::string m_lartag
Definition: LumiCalculator.h:82
LumiCalculator::m_laroff
std::string m_laroff
Definition: LumiCalculator.h:81
IOVTime
Basic time unit for IOVSvc. Hold time as a combination of run and event numbers.
Definition: IOVTime.h:33
calibdata.valid
list valid
Definition: calibdata.py:45
LumiCalculator::ParseL1Trigger
void ParseL1Trigger(const std::string &lowerch, CoolQuery *cq_trigger)
Definition: LumiCalculator.cxx:1341
TileSynchronizeBch.online
online
Definition: TileSynchronizeBch.py:88
mc
Definition: mc.PG_single_nu_valid.py:1
LumiCalculator::m_lbstop
uint32_t m_lbstop
Definition: LumiCalculator.h:146
CoolQuery::getLumiChannelId
cool::ChannelId getLumiChannelId(const std::string &lumimethod, const std::string &folder_name)
Definition: CoolQuery.cxx:170
LumiCalculator::m_data_db
std::string m_data_db
Definition: LumiCalculator.h:78
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
CoolQuery::L1CountFolderData::L1Accept
cool::UInt63 L1Accept
Definition: CoolQuery.h:313
CoolQuery
Definition: CoolQuery.h:217
lumiFormat.i
int i
Definition: lumiFormat.py:85
D3PDSizeSummary.ff
ff
Definition: D3PDSizeSummary.py:305
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
LumiCalculator::m_clumiblocknbr
uint32_t m_clumiblocknbr
Definition: LumiCalculator.h:152
LumiCalculator::m_l1ratediveffxsec_recorded
float m_l1ratediveffxsec_recorded
Definition: LumiCalculator.h:191
DetDescrDictionaryDict::it1
std::vector< HWIdentifier >::iterator it1
Definition: DetDescrDictionaryDict.h:17
Root::kINFO
@ kINFO
Definition: TMsgLogger.h:50
LumiCalculator::m_lbstart
uint32_t m_lbstart
Definition: LumiCalculator.h:145
LumiCalculator::m_onlinelumi
bool m_onlinelumi
Definition: LumiCalculator.h:236
LumiCalculator::m_verbose
bool m_verbose
Definition: LumiCalculator.h:103
LumiCalculator::m_intlumitrigrateruns
TH1F * m_intlumitrigrateruns
Definition: LumiCalculator.h:208
IOVData::clear
void clear()
Definition: CoolQuery.h:65
LumiCalculator::m_totalL
float m_totalL
Definition: LumiCalculator.h:113
covarianceTool.title
title
Definition: covarianceTool.py:542
Root::TGoodRunsListWriter
Definition: TGoodRunsListWriter.h:38
LumiCalculator::m_maxrun
unsigned int m_maxrun
Definition: LumiCalculator.h:241
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
LumiCalculator::m_collsgrl
Root::TGoodRunsList * m_collsgrl
Definition: LumiCalculator.h:196
LumiCalculator::m_l1ratediveffxsec
float m_l1ratediveffxsec
Definition: LumiCalculator.h:188
LumiCalculator::m_effxsec
float m_effxsec
Definition: LumiCalculator.h:184
beamspotman.bstag
string bstag
Definition: beamspotman.py:858
LumiCalculator::m_bs_database
std::string m_bs_database
Definition: LumiCalculator.h:72
CoolQuery::getObjMapFromFolderAtChan
std::map< cool::ValidityKey, T > getObjMapFromFolderAtChan(const std::string &obj_name, const std::string &folder_name, const cool::ChannelId &id)
Definition: CoolQuery.h:375
LumiCalculator::m_beforeprescaleof
bool m_beforeprescaleof
Definition: LumiCalculator.h:143
LumiCalculator::m_intlumitrigrate_recordedVec
std::vector< TH1F * > m_intlumitrigrate_recordedVec
Definition: LumiCalculator.h:220
IOVTime::setRETime
void setRETime(uint64_t time) noexcept
Definition: IOVTime.cxx:84
LumiCalculator::m_runnbr_prev
uint32_t m_runnbr_prev
Definition: LumiCalculator.h:149
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
LumiCalculator::m_lumiplb
TH1F * m_lumiplb
Definition: LumiCalculator.h:200
LumiCalculator::m_total_l1ratediveffxsecRun
float m_total_l1ratediveffxsecRun
Definition: LumiCalculator.h:190
CoolQuery::printHLTTriggers
void printHLTTriggers(const std::string &folder_name)
Definition: CoolQuery.cxx:235
CoolQuery::getIOVData
IOVData< T > getIOVData(const std::string &name, const std::string &folder_name, const cool::ChannelId &id, const std::string &tag="")
Definition: CoolQuery.h:421
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
LumiCalculator::m_lumioff
std::string m_lumioff
Definition: LumiCalculator.h:76
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
LumiCalculator::m_logger
Root::TMsgLogger m_logger
Definition: LumiCalculator.h:100
CoolQuery::getHLTChannelId
cool::ChannelId getHLTChannelId(const std::string &trigger, const std::string &folder_name)
Definition: CoolQuery.cxx:191
LumiCalculator::m_totalDelL
float m_totalDelL
Definition: LumiCalculator.h:112
LumiCalculator::m_L1idList
std::vector< cool::ChannelId > m_L1idList
Definition: LumiCalculator.h:181
CoolQuery::channelIdValid
bool channelIdValid()
Definition: CoolQuery.cxx:250
LumiCalculator::UseLArNoiseDB
void UseLArNoiseDB(bool lar, const std::string &lardb)
Definition: LumiCalculator.cxx:292
LumiCalculator::m_livetime
float m_livetime
Definition: LumiCalculator.h:124
LumiCalculator::m_intlumitrigrateruns_recorded
TH1F * m_intlumitrigrateruns_recorded
Definition: LumiCalculator.h:209
LumiCalculator::m_ntrigplb
TH1F * m_ntrigplb
Definition: LumiCalculator.h:198
LumiCalculator::m_totall1befpresc
unsigned int m_totall1befpresc
Definition: LumiCalculator.h:132
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
CoolQuery::setIOV
void setIOV(const cool::ValidityKey start, const cool::ValidityKey stop)
Definition: CoolQuery.cxx:96
LumiCalculator::m_l1acc
unsigned int m_l1acc
Definition: LumiCalculator.h:125
LumiCalculator::m_lumitrigrateplb_recordedVec
std::vector< TH1F * > m_lumitrigrateplb_recordedVec
Definition: LumiCalculator.h:219
LumiCalculator::m_L1Valid
bool m_L1Valid
Definition: LumiCalculator.h:231
LumiCalculator::m_uselivetrigger
bool m_uselivetrigger
Definition: LumiCalculator.h:102
IOVTime::run
uint32_t run() const noexcept
Definition: IOVTime.h:105
Root::TGoodRunsList
Definition: TGoodRunsList.h:31
LumiCalculator::Verbose
void Verbose(bool verbose=true)
Definition: LumiCalculator.cxx:255
LumiCalculator::m_intLumi
float m_intLumi
Definition: LumiCalculator.h:120
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
LumiCalculator::m_L1triggerchains
std::vector< std::string > m_L1triggerchains
Definition: LumiCalculator.h:180
CoolQuery::printL1Triggers
void printL1Triggers(const std::string &folder_name)
Definition: CoolQuery.cxx:221
LumiCalculator::m_l1rate
float m_l1rate
Definition: LumiCalculator.h:185
LumiCalculator::m_total_l1ratediveffxsecRun_recorded
float m_total_l1ratediveffxsecRun_recorded
Definition: LumiCalculator.h:193
LumiCalculator::m_l3acc
unsigned int m_l3acc
Definition: LumiCalculator.h:129
LumiCalculator::UseOnlineLumi
void UseOnlineLumi(bool online)
Definition: LumiCalculator.cxx:267
LumiCalculator::m_lbcollname
std::string m_lbcollname
Definition: LumiCalculator.h:101
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
LumiCalculator::UseMC
void UseMC(bool mc=true)
Definition: LumiCalculator.cxx:259
python.DataFormatRates.lumiTag
lumiTag
Definition: DataFormatRates.py:56
IOVData::data
std::list< std::pair< IOVRange, T > > data
Definition: CoolQuery.h:81
LumiCalculator::m_intlumiruns
TH1F * m_intlumiruns
Definition: LumiCalculator.h:207
LumiCalculator::m_trigrateplbVec
std::vector< TH1F * > m_trigrateplbVec
Definition: LumiCalculator.h:214
CoolQuery::openDbConn
bool openDbConn()
Definition: CoolQuery.cxx:30
LumiCalculator::m_triggerchain
std::string m_triggerchain
Definition: LumiCalculator.h:178
LumiCalculator::m_intlumitrigrateVec
std::vector< TH1F * > m_intlumitrigrateVec
Definition: LumiCalculator.h:218
LumiCalculator::m_runnbr
uint32_t m_runnbr
Definition: LumiCalculator.h:144
LumiCalculator::m_l1prescale
float m_l1prescale
Definition: LumiCalculator.h:135
LumiCalculator::m_lumitag
std::string m_lumitag
Definition: LumiCalculator.h:79
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
LumiCalculator::m_totaltime
float m_totaltime
Definition: LumiCalculator.h:115
LumiCalculator::m_larfrac
float m_larfrac
Definition: LumiCalculator.h:175
LumiCalculator::m_LumiTree
TTree * m_LumiTree
Definition: LumiCalculator.h:62
TMsgLogger.h
LumiCalculator::m_l2prescale
float m_l2prescale
Definition: LumiCalculator.h:136
LumiCalculator::DoHistogramAdmin
void DoHistogramAdmin(const uint32_t &runnbr, const TString &trigName, const float &effxsec)
Definition: LumiCalculator.cxx:1406
IOVData::getValue
T getValue(IOVTime time)
Definition: CoolQuery.h:99
IOVData::getOverlap
std::list< std::pair< IOVRange, T > > getOverlap(const IOVRange &range)
Definition: CoolQuery.h:173
LumiCalculator::m_lumitrigrateplb_recorded
TH1F * m_lumitrigrateplb_recorded
Definition: LumiCalculator.h:204
LumiCalculator::m_total_l1ratediveffxsec
float m_total_l1ratediveffxsec
Definition: LumiCalculator.h:189
merge.status
status
Definition: merge.py:17
LumiCalculator::m_instLumi
float m_instLumi
Definition: LumiCalculator.h:116
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
CoolQuery::L1CountFolderData
Definition: CoolQuery.h:310
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
LumiCalculator::m_lar_database
std::string m_lar_database
Definition: LumiCalculator.h:71
LumiCalculator::UseLiveTrigger
void UseLiveTrigger(bool live, std::string &livetrigger)
Definition: LumiCalculator.cxx:287
LumiCalculator::m_bsvalid
float m_bsvalid
Definition: LumiCalculator.h:176
LumiCalculator::m_beforeprescale
ULong64_t m_beforeprescale
Definition: LumiCalculator.h:142
LumiCalculator::MakePlots
void MakePlots(bool plots)
Definition: LumiCalculator.h:40
LumiCalculator::m_total_l1ratediveffxsec_recorded
float m_total_l1ratediveffxsec_recorded
Definition: LumiCalculator.h:192
LumiCalculator::UseBeamspot
void UseBeamspot(bool bs, const std::string &bstag)
Definition: LumiCalculator.cxx:297
example.writer
writer
show summary of content
Definition: example.py:36
LumiCalculator::m_lumiWOPrescale
float m_lumiWOPrescale
Definition: LumiCalculator.h:159
LumiCalculator::m_lbendtime
double m_lbendtime
Definition: LumiCalculator.h:110
LumiCalculator::m_intlumitrigrate_recorded
TH1F * m_intlumitrigrate_recorded
Definition: LumiCalculator.h:205
LumiCalculator::m_uselar
bool m_uselar
Definition: LumiCalculator.h:237
LumiCalculator::m_totalPrescaleWLiveTime
float m_totalPrescaleWLiveTime
Definition: LumiCalculator.h:155
readCCLHist.float
float
Definition: readCCLHist.py:83
TGoodRunsListWriter.h
LumiCalculator::m_trig_database
std::string m_trig_database
Definition: LumiCalculator.h:70
LumiCalculator::m_l1accof
bool m_l1accof
Definition: LumiCalculator.h:127
LumiCalculator::LumiCalculator
LumiCalculator()
Definition: LumiCalculator.cxx:25
LumiCalculator::~LumiCalculator
~LumiCalculator()
Definition: LumiCalculator.cxx:173
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
CoolQuery::getTriggerLevel
unsigned int getTriggerLevel(const std::string &triggername)
Definition: CoolQuery.cxx:79
LumiCalculator::m_minrun
unsigned int m_minrun
Definition: LumiCalculator.h:240
LumiCalculator::getTree
TTree * getTree()
Definition: LumiCalculator.cxx:302
LumiCalculator::UseLumiTag
void UseLumiTag(const std::string &tag)
Definition: LumiCalculator.cxx:273
LumiCalculator::setTree
void setTree(TTree *tree=0)
Definition: LumiCalculator.cxx:204
CoolQuery::getL1ChannelId
cool::ChannelId getL1ChannelId(const std::string &trigger, const std::string &folder_name)
Definition: CoolQuery.cxx:139