ATLAS Offline Software
Functions
LumiCalculator.cxx File Reference
#include "LumiCalc/LumiCalculator.h"
#include "GoodRunsLists/TMsgLogger.h"
#include "GoodRunsLists/TGoodRunsList.h"
#include "GoodRunsLists/TGoodRunsListWriter.h"
#include "TTree.h"
#include "TFile.h"
#include "TString.h"
#include "TObjString.h"
#include "TROOT.h"
#include <iomanip>
#include <iostream>
#include <set>
#include <regex.h>

Go to the source code of this file.

Functions

void LumiCalculator::IntegrateLumi ATLAS_NOT_THREAD_SAFE (const xAOD::LumiBlockRangeContainer *iovc, const std::string &triggerchain)
 

Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

void LumiCalculator::IntegrateLumi ATLAS_NOT_THREAD_SAFE ( const xAOD::LumiBlockRangeContainer iovc,
const std::string &  triggerchain 
)

Definition at line 308 of file LumiCalculator.cxx.

308  {
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 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
Root::kWARNING
@ kWARNING
Definition: TMsgLogger.h:51
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
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
IOVTime::event
uint32_t event() const noexcept
Definition: IOVTime.h:106
IOVData
Definition: CoolQuery.h:54
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
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
CoolQuery::L1CountFolderData::BeforePrescale
cool::UInt63 BeforePrescale
Definition: CoolQuery.h:311
GEndl
#define GEndl
Definition: TMsgLogger.h:151
PrepareReferenceFile.regex
regex
Definition: PrepareReferenceFile.py:43
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
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
CoolQuery::getLumiChannelId
cool::ChannelId getLumiChannelId(const std::string &lumimethod, const std::string &folder_name)
Definition: CoolQuery.cxx:170
CoolQuery::L1CountFolderData::L1Accept
cool::UInt63 L1Accept
Definition: CoolQuery.h:313
CoolQuery
Definition: CoolQuery.h:217
DetDescrDictionaryDict::it1
std::vector< HWIdentifier >::iterator it1
Definition: DetDescrDictionaryDict.h:17
Root::kINFO
@ kINFO
Definition: TMsgLogger.h:50
IOVData::clear
void clear()
Definition: CoolQuery.h:65
Root::TGoodRunsListWriter
Definition: TGoodRunsListWriter.h:38
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
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
IOVTime::setRETime
void setRETime(uint64_t time) noexcept
Definition: IOVTime.cxx:84
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
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
CoolQuery::getHLTChannelId
cool::ChannelId getHLTChannelId(const std::string &trigger, const std::string &folder_name)
Definition: CoolQuery.cxx:191
CoolQuery::channelIdValid
bool channelIdValid()
Definition: CoolQuery.cxx:250
CoolQuery::setIOV
void setIOV(const cool::ValidityKey start, const cool::ValidityKey stop)
Definition: CoolQuery.cxx:96
IOVTime::run
uint32_t run() const noexcept
Definition: IOVTime.h:105
Root::TGoodRunsList
Definition: TGoodRunsList.h:31
CoolQuery::printL1Triggers
void printL1Triggers(const std::string &folder_name)
Definition: CoolQuery.cxx:221
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
IOVData::data
std::list< std::pair< IOVRange, T > > data
Definition: CoolQuery.h:81
CoolQuery::openDbConn
bool openDbConn()
Definition: CoolQuery.cxx:30
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
merge.status
status
Definition: merge.py:17
CoolQuery::L1CountFolderData
Definition: CoolQuery.h:310
example.writer
writer
show summary of content
Definition: example.py:36
readCCLHist.float
float
Definition: readCCLHist.py:83
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
CoolQuery::getL1ChannelId
cool::ChannelId getL1ChannelId(const std::string &trigger, const std::string &folder_name)
Definition: CoolQuery.cxx:139