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 287 of file LumiCalculator.cxx.

287  {
288 
289 
290  CoolQuery * cq_lumi = NULL;
291  CoolQuery * cq_trigger = NULL;
292  CoolQuery* cq_lar = NULL;
293  CoolQuery* cq_bs = NULL;
294 
295  // Peek at first run in iovc to check if we want Run1 or Run2 data
297  // const IOVRange * iovr = (*it);
298  const IOVRange* iovr = new IOVRange(IOVTime((*it)->startRunNumber(),(*it)->startLumiBlockNumber()),
299  IOVTime((*it)->stopRunNumber(),(*it)->stopLumiBlockNumber()));
300 
301  bool isrun2 = false;
302  std::string onlfolder;
303  std::string oflfolder;
304  if (iovr->start().run() > 222222) {
305  isrun2 = true;
306  m_data_db="CONDBR2";
307  onlfolder = "/TRIGGER/LUMI/OnlPrefLumi";
308  oflfolder = "/TRIGGER/OFLLUMI/OflPrefLumi";
309  } else {
310  isrun2 = false;
311  m_data_db="COMP200";
312  onlfolder = "/TRIGGER/LUMI/LBLESTONL";
313  oflfolder = "/TRIGGER/OFLLUMI/LBLESTOFL";
314  }
315 
316  // define all connection strings
317 
318  // check for online DB
319  if(m_onlinelumi){
320  m_lumi_database = m_lumionl + m_data_db;
321  m_parlumiestfolder = onlfolder;
322  } else {
323  m_lumi_database = m_lumioff + m_data_db;
324  m_parlumiestfolder = oflfolder;
325  }
326 
327  m_trig_database = m_trigger + m_data_db;
328  m_lar_database = m_laroff + m_data_db;
329  m_bs_database = m_bsonl + m_data_db;
330 
331 
332  m_logger << Root::kINFO << "Luminosity database: " << m_lumi_database << Root::GEndl;
333  m_logger << Root::kINFO << "Trigger database: " << m_trig_database << Root::GEndl;
334 
335  cq_lumi = new CoolQuery(m_lumi_database, triggerchain);
336  if (!cq_lumi->openDbConn()) {
337  delete cq_lumi;
338  return;
339  }
340 
341  cq_trigger = new CoolQuery(m_trig_database, triggerchain);
342  if (!cq_trigger->openDbConn()) {
343  delete cq_trigger;
344  return;
345  }
346 
347  if (m_uselar) {
348  m_logger << Root::kINFO << "LAr database: " << m_lar_database << Root::GEndl;
349 
350  cq_lar = new CoolQuery(m_lar_database, triggerchain);
351  if (!cq_lar->openDbConn()) {
352  delete cq_lar;
353  return;
354  }
355  }
356 
357  if (m_usebs) {
358  m_logger << Root::kINFO << "Onl beamspot database: " << m_bs_database << Root::GEndl;
359 
360  cq_bs = new CoolQuery(m_bs_database, triggerchain);
361  if (!cq_bs->openDbConn()) {
362  delete cq_bs;
363  return;
364  }
365  }
366 
367  // initialize
368  m_lbstarttime = 0.;
369  m_lbendtime = 0.;
370  m_totalDelL = 0.;
371  m_totalL = 0.;
372  m_totalLRun = 0.;
373  m_totaltime = 0.;
374  m_instLumi = 0.;
375  m_delLumi = 0.;
376  m_intLumi = 0.;
377  m_deltaT = 0.;
378  m_totalPrescaleWLiveTime = 0.;
379  m_totalPrescale = 0.;
380  m_lumiWOPrescale = 0.;
381  m_lumiLAr = 0.;
382  m_TotaldeltaT = 0.;
383  m_livefrac = 0.;
384  m_livetime = 0.;
385  m_lartime = 0.;
386  m_larfrac = 0.;
387  m_bsvalid = 0.;
388  m_livetime_l1acc = 0;
389  m_l1acc = 0;
390  m_l2acc = 0;
391  m_l3acc = 0;
392  m_totall1acc = 0;
393  m_livtrig_totall1acc = 0;
394  m_totall2acc = 0;
395  m_totall3acc = 0;
396  m_l1prescale = 1.;
397  m_l2prescale = 1.;
398  m_l3prescale = 1.;
399  m_livetime_beforeprescale = 0;
400  m_livetime_afterprescale = 0;
401  m_afterprescale = 0;
402  m_beforeprescale = 0;
403  m_totall1befpresc = 0;
404  m_runnbr = 0;
405  m_lbstart = 0;
406  m_lbstop = 0;
407  m_lbstart_prev = 0;
408  m_lbstop_prev = 0;
409  m_totalgoodblock = 0;
410  m_totalbadblock = 0;
411  m_clumiblocknbr = 0;
412  m_clumiblocknbrend =0;
413  m_triglevel = 0;
414  m_lbcollectionname = "LumiBlocks";
415  m_triggerchain = triggerchain;
416  m_l1rate = 0.;
417  m_l2rate = 0.;
418  m_l3rate = 0.;
419  m_l1ratediveffxsec = 0.;
420  m_total_l1ratediveffxsec = 0.;
421  m_total_l1ratediveffxsecRun = 0.;
422  m_l1ratediveffxsec_recorded = 0.;
423  m_total_l1ratediveffxsec_recorded = 0.;
424  m_total_l1ratediveffxsecRun_recorded = 0.;
425  m_runnbr_prev = 0;
426 
427  // Set to extreme values, to be updated below
428  m_minrun = 99999999;
429  m_maxrun = 0;
430 
431  bool firstL1Missing = true;
432  bool firstHLTMissing = true;
433 
434  std::set<cool::ValidityKey> lbrunset;
435  lbrunset.clear();
436 
437  // collisions xml file settings
438  if (m_collsgrl!=0) { delete m_collsgrl; m_collsgrl=0; }
439  if (m_makecollList) {
440  m_collsgrl = new Root::TGoodRunsList();
441  m_collsgrl->SetVersion("30"); // lumicalc signature
442  m_collsgrl->AddMetaData("Query","Generated by LumiCalculator");
443  }
444 
445  // Figure out trigger level
446  m_triglevel = cq_lumi->getTriggerLevel(triggerchain);
447  if (m_triglevel == 0){
448  // Check if on purpose, otherwise, give a warning
449  if (triggerchain == "None") {
450  m_logger << Root::kINFO << "No trigger specified!" << Root::GEndl;
451  } else {
452  m_logger << Root::kWARNING << "Invalid trigger: [" << triggerchain << "] - will proceed with no trigger defined!" << Root::GEndl;
453  }
454  }
455 
456  // Look for b-jet triggers
457  regex_t regex;
458  int reti = regcomp(&regex, "_[[:digit:]]?b[[:digit:]]+_", REG_EXTENDED);
459  if (reti) m_logger << Root::kWARNING << "Could not compile regex!" << Root::GEndl;
460 
461  reti = regexec(&regex, triggerchain.c_str(), 0, NULL, 0);
462  if ( !reti && !m_usebs) {
463  m_logger << Root::kWARNING << "Trigger: [" << triggerchain << "] appears to be a b-jet trigger, but online beamspot validity not included in livefraction!" << Root::GEndl;
464  m_logger << Root::kWARNING << "Probably need to specify --beamspot to get accurate luminosity!" << Root::GEndl;
465  }
466  regfree(&regex);
467 
468  // get lumi channel id (this never changes)
469  if (m_lumimethod != "") {
470  m_Lumiid = cq_lumi->getLumiChannelId(m_lumimethod, m_parlumiestfolder);
471  } else {
472  m_Lumiid = m_lumichannel;
473  }
474 
475 
476  // do main LumiBlock loop
477  //==============================
478 
479  IOVData<cool::Int32> L1preObj;
480  IOVData<cool::Int32> L1preOther;
481  IOVData<cool::Float> L2preObj;
482  IOVData<cool::Float> L3preObj;
483  IOVData<cool::UInt32> LArObj;
484  IOVData<cool::Int32> BSObj;
485 
486  std::map<cool::ValidityKey, CoolQuery::LumiFolderData> LumiDataMap;
487 
488  // UTC nanoseconds since 1970
489  std::map<cool::ValidityKey, cool::UInt63> L1starttime_map;
490  std::map<cool::ValidityKey, cool::UInt63> L1endtime_map;
491 
492  // Livetime maps
493  std::map<cool::ValidityKey, CoolQuery::L1CountFolderData> Livetime_map;
494  std::map<cool::ValidityKey, CoolQuery::L1CountFolderData> L1accept_map;
495 
496  for(xAOD::LumiBlockRangeContainer::const_iterator it = iovc->begin(); it != iovc->end(); ++it){
497  const IOVRange* iovr = new IOVRange(IOVTime((*it)->startRunNumber(),(*it)->startLumiBlockNumber()),
498  IOVTime((*it)->stopRunNumber(),(*it)->stopLumiBlockNumber()));
499 
500  // Bookkeeping temporary results
501  m_t_totalDelL = 0.;
502  m_t_totalL = 0.;
503  m_t_totalLRun = 0.;
504  m_t_totaltime = 0.;
505  m_t_deltaT = 0.;
506  m_t_l1acc = 0;
507  m_t_l2acc = 0;
508  m_t_l3acc = 0;
509  m_t_totalgoodblock = 0;
510  m_t_totalbadblock = 0;
511  m_t_totall1befpresc = 0;
512  m_t_totalPrescaleWLiveTime = 0.;
513  m_t_totalPrescale = 0.;
514  m_t_lumiWOPrescale = 0. ;
515  m_t_lumiLAr = 0.;
516 
517  m_runnbr = iovr->start().run();
518  m_lbstart = iovr->start().event();
519  m_lbstop = iovr->stop().event();
520 
521  // Look for duplicate run/LB
522  if(m_lbstart_prev == m_lbstart && m_lbstop_prev == m_lbstop && m_runnbr_prev == m_runnbr){
523  m_logger << Root::kWARNING << "Skipping multiply stored IOVRange: [" << m_lbstart << "-" << m_lbstop << "]" << Root::GEndl;
524  continue;
525  }
526 
527  // new run, reset its lumi and reload the trigger channels
528  if ( m_runnbr!=m_runnbr_prev ) {
529 
530  if (m_runnbr < m_minrun) m_minrun = m_runnbr;
531  if (m_runnbr > m_maxrun) m_maxrun = m_runnbr;
532 
533  m_totalLRun=0.;
534  m_total_l1ratediveffxsecRun=0.;
535  m_total_l1ratediveffxsecRun_recorded=0.;
536 
537  // Set IOV range for full run
538  cq_trigger->setIOVForRun (m_runnbr);
539  cq_lumi->setIOVForRun(m_runnbr);
540 
541  // get trigger channel ids
542  m_L1Valid = false;
543  m_L2Valid = false;
544  m_L3Valid = false;
545  m_LiveValid = false;
546  m_triggerlowerchains.clear();
547  // These are used to resolve L1 ORs like [L1_MU20,L1_MU21]
548  m_L1triggerchains.clear();
549  m_L1idList.clear();
550 
551  std::string lowerch = "";
552 
553  // This is really inefficient...
554  if(m_triglevel == 3){
555  m_L3id = cq_trigger->getHLTChannelId(triggerchain, m_parhltmenufolder);
556  m_L3Valid = cq_trigger->channelIdValid();
557 
558  lowerch = cq_trigger->getHLTLowerChainName(triggerchain, m_parhltmenufolder);
559  m_triggerlowerchains.push_back(lowerch);
560  //
561  m_L2id = cq_trigger->getHLTChannelId(lowerch, m_parhltmenufolder);
562  m_L2Valid = cq_trigger->channelIdValid();
563 
564  lowerch = cq_trigger->getHLTLowerChainName(lowerch, m_parhltmenufolder);
565  m_triggerlowerchains.push_back(lowerch);
566  //
567  m_L1id = cq_trigger->getL1ChannelId(lowerch, m_parlvl1menufolder );
568  m_L1Valid = cq_trigger->channelIdValid();
569 
570  }else if(m_triglevel == 2){ // Run2 or starting at L2 in Run1
571  lowerch = cq_trigger->getHLTLowerChainName(triggerchain, m_parhltmenufolder);
572  m_triggerlowerchains.push_back(lowerch);
573  m_L2id = cq_trigger->getHLTChannelId(triggerchain, m_parhltmenufolder);
574  m_L2Valid = cq_trigger->channelIdValid();
575 
576  ParseL1Trigger(lowerch, cq_trigger);
577 
578  }else if(m_triglevel == 1){
579 
580  ParseL1Trigger(triggerchain, cq_trigger);
581  }
582 
583  if (firstL1Missing && (!m_L1Valid && m_triglevel > 0)) {
584  firstL1Missing = false;
585  cq_trigger->printL1Triggers(m_parlvl1menufolder);
586  }
587 
588  if (firstHLTMissing && ((!m_L2Valid && m_triglevel > 1) || (!m_L3Valid && m_triglevel > 2)) ) {
589  firstHLTMissing = false;
590  cq_trigger->printHLTTriggers(m_parhltmenufolder);
591  }
592 
593  // Should we check here for btag trigger and onl beamspot?
594 
595  // Do we use dedicated livetime trigger?
596  if(m_uselivetrigger){
597  m_LiveL1id = cq_trigger->getL1ChannelId(m_livetrigger, m_parlvl1menufolder);
598  m_LiveValid = cq_trigger->channelIdValid();
599  }else{
600  // then fall back to the original trigger
601  m_LiveL1id = m_L1id;
602  m_LiveValid = m_L1Valid;
603  }
604 
605  if (!m_LiveValid) {
606  if (m_uselivetrigger)
607  m_logger << Root::kWARNING << "Runnumber: [" << m_runnbr << "] can't find livefraction trigger [" << m_livetrigger << "]! Livefraction won't be calculated!" << Root::GEndl;
608  else
609  m_logger << Root::kWARNING << "Runnumber: [" << m_runnbr << "] can't find trigger [" << triggerchain << "]! Livefraction won't be calculated!" << Root::GEndl;
610  }
611 
612  // Also load all deadtime counters here
613 
614  // Need to fix this for non-MC. HLT counters now available, but not used here...
615 
616  //-------------------------
617  // Load livetime information
618  Livetime_map.clear();
619  L1accept_map.clear();
620 
621  if (m_LiveValid)
622  Livetime_map = cq_trigger->getL1CountFolderData(m_parlumilvl1folder, m_LiveL1id);
623 
624 
625  if (m_L1Valid && m_triglevel >= 1)
626  L1accept_map = cq_trigger->getL1CountFolderData(m_parlumilvl1folder, m_L1id);
627 
628  // UTC nanoseconds since 1970
629  L1starttime_map.clear();
630  L1endtime_map.clear();
631  L1starttime_map = cq_trigger->getObjMapFromFolderAtChan<cool::UInt63>("StartTime", m_parlvl1lblbfolder, 0);
632  L1endtime_map = cq_trigger->getObjMapFromFolderAtChan<cool::UInt63>("EndTime", m_parlvl1lblbfolder, 0);
633 
634  //---------------------------
635  // Load LAr defects
636  LArObj.clear();
637 
638  if (m_uselar) {
639  cool::ValidityKey runstarttime = L1starttime_map.begin()->second;
640  cool::ValidityKey runendtime = L1endtime_map.rbegin()->second;
641 
642  cq_lar->setIOV(runstarttime, runendtime);
643  LArObj = cq_lar->getIOVData<cool::UInt32>("EventVeto", m_parlareventvetofolder, 0, m_lartag);
644  }
645 
646  //---------------------------
647  // Load Onl beamspot
648  BSObj.clear();
649 
650  if (m_usebs) {
651  cq_bs->setIOVForRun(m_runnbr);
652  BSObj = cq_bs->getIOVData<cool::Int32>("status", m_paronlbeamspotfolder, 0, m_bstag);
653  }
654 
655 
656  //-----------------------------
657  // Load luminosity for this run
658  LumiDataMap.clear();
659  LumiDataMap = cq_lumi->getLumiFolderData(m_parlumiestfolder, m_lumitag, m_Lumiid);
660 
661 
662  } // End of new run stuff
663 
664  m_lbstart_prev = m_lbstart;
665  m_lbstop_prev = m_lbstop;
666  m_runnbr_prev = m_runnbr;
667 
668  // Update DB for this specific IOV range
669  cq_trigger->setIOV(iovr->start().re_time(), iovr->stop().re_time());
670 
671  // Print this here (will be output for each contiguous LB range in XML file)
672  m_logger << Root::kINFO << std::left << "-----------------------------------" << Root::GEndl;
673  m_logger << Root::kINFO << "Beginning calculation for ";
674  if (m_triglevel > 0) {
675  m_logger << Root::kINFO << "Trigger " << m_triggerchain;
676  if(m_triggerlowerchains.size() > 0){
677  m_logger << Root::kINFO << "[";
678  for(std::vector<std::string>::iterator sit = m_triggerlowerchains.begin(); sit != m_triggerlowerchains.end(); ++sit){
679  m_logger << Root::kINFO << "==>" << *sit;
680  }
681  m_logger << Root::kINFO << "], ";
682  }
683  }
684  m_logger << Root::kINFO << "Run " << m_runnbr << " LB [" << m_lbstart << "-" << m_lbstop << "]" << Root::GEndl;
685  m_logger << Root::kINFO << std::left << "-----------------------------------" << Root::GEndl;
686 
687  //----------------------------
688  // Load prescales for this IOV
689  L1preObj.clear();
690  L2preObj.clear();
691  L3preObj.clear();
692  L1preOther.clear(); // Used for mutliple L1 triggers
693 
694  if(m_L1Valid) {
695  // Normal case
696  if (m_L1idList.size() <= 1) {
697  L1preObj = cq_trigger->getIOVData<cool::Int32>("Lvl1Prescale", m_parlvl1prescalesfolder, m_L1id);
698 
699  // Multiple L1 items defined
700  } else {
701 
702  m_logger << Root::kINFO << "Resolving multiple L1 prescales:" << Root::GEndl;
703 
704  // Load first one
705  L1preObj = cq_trigger->getIOVData<cool::Int32>("Lvl1Prescale", m_parlvl1prescalesfolder, m_L1idList[0]);
706 
707  // Dump prescales
708  std::list< std::pair<IOVRange, cool::Int32> >::iterator it;
709 
710  m_logger << Root::kINFO << std::setw(10) << std::left << m_L1triggerchains[0];
711  for(it = L1preObj.data.begin(); it != L1preObj.data.end(); ++it) {
712  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" ;
713 
714  if (it->second < 0)
715  m_logger << it->second << ", ";
716  else
717  m_logger << (0xFFFFFF / float(0x1000000 - it->second)) << ", ";
718  }
719  m_logger << Root::kINFO << Root::GEndl;
720 
721  // Now loop over the remaining and replace
722  for (unsigned int iid=1; iid < m_L1idList.size(); iid++) {
723  L1preOther = cq_trigger->getIOVData<cool::Int32>("Lvl1Prescale", m_parlvl1prescalesfolder, m_L1idList[iid]);
724 
725  // Dump prescales
726  m_logger << Root::kINFO << std::setw(10) << std::left << m_L1triggerchains[iid];
727  for(it = L1preOther.data.begin(); it != L1preOther.data.end(); ++it) {
728  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" ;
729 
730  if (it->second < 0)
731  m_logger << it->second << ", ";
732  else
733  m_logger << (0xFFFFFF / float(0x1000000 - it->second)) << ", ";
734  }
735  m_logger << Root::kINFO << Root::GEndl;
736 
737  // Iterate through both lists and keep lowest non-negative prescale
738  std::list< std::pair<IOVRange, cool::Int32> >::iterator it1;
739  std::list< std::pair<IOVRange, cool::Int32> >::iterator it2;
740  for(it1 = L1preObj.data.begin(), it2 = L1preOther.data.begin(); it1 != L1preObj.data.end(); ++it1, ++it2) {
741 
742  // -1 is disabled, otherwise this is the event count to prescale
743  if ((it2->second > 0) && (it1->second > it2->second)) {
744  // Check if they are both prescaled (this is bad)
745  if ((it1->second > 1) && (it2->second > 1)) {
746  m_logger << Root::kWARNING << "L1 Prescales combined with both triggers prescaled for Run " << m_runnbr << "!" << Root::GEndl;
747  }
748  it1->second = it2->second;// See if this works...
749  }
750  }
751  }
752 
753  // OK done, lets check the result
754  // Dump prescales
755  m_logger << Root::kINFO << std::setw(10) << std::left << "L1 Pre:";
756  for(it = L1preObj.data.begin(); it != L1preObj.data.end(); ++it) {
757  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" ;
758 
759  if (it->second < 0)
760  m_logger << it->second << ", ";
761  else
762  m_logger << (0xFFFFFF / float(0x1000000 - it->second)) << ", ";
763  }
764  m_logger << Root::kINFO << Root::GEndl;
765 
766  }
767 
768  }
769 
770  if(m_L2Valid) {
771  if (isrun2) {
772  L2preObj = cq_trigger->getIOVData<cool::Float>("Prescale", m_parhltprescalesfolder, 20000 + m_L2id);
773  }
774  else {
775  L2preObj = cq_trigger->getIOVData<cool::Float>("Prescale", m_parhltprescalesfolder, 2*m_L2id);
776  }
777  }
778 
779  if(m_L3Valid) {
780  L3preObj = cq_trigger->getIOVData<cool::Float>("Prescale", m_parhltprescalesfolder, 2*m_L3id+1);
781  }
782 
783  // Reload the time map to get the ATLAS range
784  L1starttime_map.clear();
785  L1endtime_map.clear();
786  L1starttime_map = cq_trigger->getObjMapFromFolderAtChan<cool::UInt63>("StartTime", m_parlvl1lblbfolder, 0);
787  L1endtime_map = cq_trigger->getObjMapFromFolderAtChan<cool::UInt63>("EndTime", m_parlvl1lblbfolder, 0);
788 
789  // Restrict lb range if necessary based on actual ATLAS run/lb values
790  if (L1starttime_map.begin()->first > iovr->start().re_time() || L1starttime_map.rbegin()->first < iovr->stop().re_time()) {
791  m_lbstart = (L1starttime_map.begin()->first & 0xFFFFFFFF);
792  m_lbstop = (L1starttime_map.rbegin()->first & 0xFFFFFFFF);
793  m_logger << Root::kINFO << "Restricting to valid ATLAS lumi block range [" << m_lbstart << "-" << m_lbstop << "]" << Root::GEndl;
794  }
795 
796 
797  //
798  // Dont assume that all lumi blocks in this range are present in the lumi DB.
799  // Loop over all lumi blocks specifically and flag any missing lumi entries as bad lumi blocks.
800  //
801 
802  // Counters to check for missing LB ranges
803  int firstMissing = -1;
804  int lastMissing = -1;
805 
806  for (cool::ValidityKey currentVK = L1starttime_map.begin()->first; currentVK <= L1starttime_map.rbegin()->first; currentVK++) {
807 
808  // Current IOVTime
809  IOVTime curIOV;
810  curIOV.setRETime(currentVK);
811 
812  m_clumiblocknbr = curIOV.event();
813  m_clumiblocknbrend = curIOV.event()+1;
814 
815  // Check here for duplicate lumi blocks by explicitly keeping track of every run/lb seen
816  if (lbrunset.count(curIOV.re_time()) != 0) {
817  m_logger << Root::kWARNING << "Skipping duplicate [run,lumiblock]: " << curIOV << " !" << Root::GEndl;
818  continue;
819  } else {
820  lbrunset.insert(curIOV.re_time());
821  }
822 
823  // Not really good, just all seen
824  m_totalgoodblock += 1;
825  m_t_totalgoodblock += 1;
826 
827  // Find luminosity record
828  std::map<cool::ValidityKey, CoolQuery::LumiFolderData>::iterator itOL = LumiDataMap.find(currentVK);
829 
830  // Check if we didn't find anything
831  if (itOL == LumiDataMap.end()) {
832 
833  m_t_totalbadblock++;
834  m_totalbadblock++;
835 
836  if (firstMissing < 0) {
837  // Is this the first missing one? If so, make a note of it and go on
838  firstMissing = curIOV.event();
839  lastMissing = firstMissing;
840  } else if (int(curIOV.event()) == (lastMissing+1)) {
841  // Is this a contiguous missing lumi block?
842  lastMissing = curIOV.event();
843  } else {
844  // Not contiguous, print previous
845  if (firstMissing == lastMissing) {
846  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB " << firstMissing << " !" << Root::GEndl;
847  } else {
848  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB [" << firstMissing << "-" << lastMissing << "] !" << Root::GEndl;
849  }
850  firstMissing = curIOV.event();
851  lastMissing = firstMissing;
852  }
853 
854  // If last time through loop, print this also
855  if (currentVK == L1starttime_map.rbegin()->first) {
856  if (firstMissing == lastMissing) {
857  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB " << firstMissing << " !" << Root::GEndl;
858  } else {
859  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB [" << firstMissing << "-" << lastMissing << "] !" << Root::GEndl;
860  }
861  firstMissing = -1;
862  lastMissing = -1;
863  }
864 
865  // Skip rest of this LB
866  continue;
867 
868  } else {
869 
870  // Check if we had previous missing block
871  if (firstMissing >= 0) {
872  if (firstMissing == lastMissing) {
873  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB " << firstMissing << " !" << Root::GEndl;
874  } else {
875  m_logger << Root::kWARNING << "Luminosity info not found for Run " << m_runnbr << " LB [" << firstMissing << "-" << lastMissing << "] !" << Root::GEndl;
876  }
877 
878  firstMissing = -1;
879  lastMissing = -1;
880  }
881 
882  }
883 
884 
885  // given in units of ub^{-1} = 10^{30} cm^{-2}
886  m_instLumi = (itOL->second).LBAvInstLumi;
887  m_AvEvtsPerBX = (itOL->second).LBAvEvtsPerBX;
888  m_Valid = (itOL->second).Valid;
889 
890 
891  // Clear values in case trigger isn't defined
892  m_l1acc = 0.;
893  m_beforeprescale = 0.;
894  m_afterprescale = 0.;
895  m_l2acc = 0.;
896  m_l3acc = 0.;
897 
898  // Store dummy prescale values at start
899  m_l1prescale = -1.;
900  m_l2prescale = -1.;
901  m_l3prescale = -1.;
902 
903  // Some trigger is defined. Get prescales and values here
904  if(m_L1Valid && m_triglevel > 0) {
905 
906  // Get L1 prescale
907  if (isrun2) {
908  if (L1preObj.getValue(curIOV) < 0)
909  m_l1prescale = L1preObj.getValue(curIOV);
910  else
911  m_l1prescale = 0xFFFFFF / float(0x1000000 - L1preObj.getValue(curIOV));
912  }
913  else {
914  m_l1prescale = L1preObj.getValue(curIOV);
915  }
916 
917  if (m_triglevel >=2) {
918  if(m_L2Valid) {
919 
920  // Get L2 prescale
921  m_l2prescale = L2preObj.getValue(curIOV);
922 
923  }
924  // Else, prescale stays at -1.
925 
926  } else {
927  // Force L2 'passthrough'
928  m_l2prescale = 1.;
929  }
930 
931  if(m_triglevel == 3){
932  if (m_L3Valid) {
933 
934  // Get L3 prescale
935  m_l3prescale = L3preObj.getValue(curIOV);
936 
937  }
938  // Else, L3 prescale stays at -1.
939  } else {
940  // Force L3 'passthrough'
941  m_l3prescale = 1.;
942  }
943  }
944 
945  //-------------------------------
946  // Calculate livetime from a dedicated not rare trigger if user requested
947  CoolQuery::L1CountFolderData l1count = Livetime_map.find(currentVK)->second;
948 
949  m_livetime_beforeprescale = l1count.BeforePrescale;
950  m_livetime_afterprescale = l1count.AfterPrescale;
951  m_livetime_l1acc = l1count.L1Accept;
952  if(m_livetime_afterprescale > 0.){
953  m_livefrac = m_livetime_l1acc/(float)m_livetime_afterprescale;
954  }else{
955  m_livefrac = 0.0;
956  }
957 
958  // Hack for bad SFO in particular run
959  if (m_runnbr == 286367) {
960  m_livefrac *= 5./6.;
961  }
962 
963  if (m_runnbr == 281385) {
964  if (m_clumiblocknbr <= 196) {
965  m_livefrac *= 4./6.;
966  } else if (m_clumiblocknbr <= 374) {
967  m_livefrac *= 5./6.;
968  }
969  }
970 
971  // Check for low statistics in afterprescale counts
972  if(m_livetime_beforeprescale > 0 && m_livetime_afterprescale <= 0 ){
973  std::string ttrig = "";
974  ttrig = triggerchain;
975  if(m_uselivetrigger)ttrig = m_livetrigger;
976  m_logger << Root::kWARNING << "L1 counts after prescale (before veto) are 0.0 for trigger " << ttrig << "! Livefraction set to zero!" << Root::GEndl;
977  m_logger << Root::kWARNING << "Try using a high rate L1 trigger for livetime calculation: --livetrigger=<high rate L1 trigger> " << Root::GEndl;
978  m_logger << Root::kINFO << m_runnbr << "[" << m_clumiblocknbr << "]: L1Acc: " << m_l1acc << ", AfterPrescale: " << m_afterprescale << ", L1Presc: " << m_l1prescale << Root::GEndl;
979  }
980 
981  //------------------------
982  // Calculate LAr veto time
983 
984  cool::ValidityKey lbstarttime = L1starttime_map.find(currentVK)->second;
985  cool::ValidityKey lbendtime = L1endtime_map.find(currentVK)->second;
986 
987  m_lartime = 0.; // Time to exclude in seconds
988  if (m_uselar) {
989 
990  IOVTime lbstart, lbend;
991  lbstart.setRETime(lbstarttime);
992  lbend.setRETime(lbendtime);
993  IOVRange range(lbstart, lbend);
994 
995  std::list<std::pair<IOVRange, cool::UInt32> > larlist;
996  larlist = LArObj.getOverlap(range);
997 
998  for (std::list<std::pair<IOVRange, cool::UInt32> >::iterator it = larlist.begin(); it != larlist.end(); ++it) {
999  if (it->second == 0) continue;
1000  float dtime = (it->first.stop().re_time() - it->first.start().re_time())/1.E9;
1001  m_lartime += dtime;
1002  if (m_verbose == true) {
1003  m_logger << Root::kINFO << "Found LAr veto from " << it->first.start().re_time() << " to " << it->first.stop().re_time() << " = " << dtime << " seconds" << Root::GEndl;
1004  }
1005  }
1006  }
1007 
1008  //------------------------
1009  // Check for online BS
1010  m_bsvalid = 1.;
1011  if (m_usebs) {
1012 
1013  // Read beamspot validity
1014  bool valid = true;
1015  int status = BSObj.getValue(curIOV);
1016  //m_logger << Root::kINFO << "Found online beamspot status = " << status << Root::GEndl;
1017 
1018  if (status != 7) valid = false;
1019 
1020  if (!valid) {
1021  m_bsvalid = 0.0;
1022  m_livefrac = 0.0;
1023  if(m_verbose == true){
1024  m_logger << Root::kINFO << m_runnbr << "[" << m_clumiblocknbr << "]: Online beamspot invalid with Lumi=" << m_instLumi << " 10^30 cm-2 s-1" << Root::GEndl;
1025  }
1026  }
1027  }
1028 
1029  //-------------------------------
1030 
1031  l1count = L1accept_map.find(currentVK)->second;
1032  m_beforeprescale = l1count.BeforePrescale;
1033  m_beforeprescaleof = false;
1034  m_afterprescale = l1count.AfterPrescale;
1035  m_afterprescaleof = false;
1036  m_l1acc = l1count.L1Accept;
1037  m_l1accof = false;
1038 
1039  m_deltaT = (lbendtime-lbstarttime)/1.E9;
1040  m_lbstarttime = lbstarttime/1.E9;
1041  m_lbendtime = lbendtime/1.E9;
1042 
1043  if (m_deltaT > 0.) m_larfrac = 1.-m_lartime/m_deltaT;
1044 
1045  // For online lumi database case one needs to make some changes:
1046  if(m_onlinelumi == true){
1047  // In Valid UInt32 type value some information is encoded:
1048  // see: https://twiki.cern.ch/twiki/bin/view/Atlas/CoolOnlineData#Folder_TRIGGER_LUMI_LBLESTONL
1049  cool::UInt32 tempValid = (m_Valid & 1023);
1050 
1051  if(tempValid == 10){
1052  // in this bits, Value 301 and 302 means MBTS and LUCID lumi for which some care is needed
1053  if((m_Valid >> 22) == 301
1054  || (m_Valid >> 22) == 302
1055  || (m_Valid >> 22) == 101
1056  || (m_Valid >> 22) == 102
1057  || (m_Valid >> 22) == 103
1058  || (m_Valid >> 22) == 104
1059  ){
1060  m_Valid = 0;
1061  }else{
1062  m_Valid = tempValid;
1063  }
1064  }else{
1065  m_Valid = tempValid;
1066  }
1067 
1068  } else {
1069 
1070  // For offline, we also need to strip out the preferred channel value from the validity word
1071  m_Valid &= 0xFFFF;
1072  }
1073 
1074  // Dump out debugging information
1075  if(m_verbose == true){
1076  m_logger << Root::kINFO << m_runnbr << "[" << m_clumiblocknbr << "]: L1Acc: " << m_l1acc;
1077  if(m_uselivetrigger) m_logger << ", Livetime trigger L1Acc: " << m_livetime_l1acc;
1078  m_logger << ", InstLumi: " << m_instLumi << ", deltaT: " << m_deltaT << ", AvEvtsPerBX: " << m_AvEvtsPerBX << ", BeforePrescale: " << m_beforeprescale << ", AfterPrescale: " << m_afterprescale;
1079  if (m_uselivetrigger) m_logger << ", Livetime trigger BeforePrescale: " << m_livetime_beforeprescale << " Livetime trigger AfterPrescale: " << m_livetime_afterprescale;
1080  if (isrun2) {
1081  m_logger << ", Livefrac: " << m_livefrac << ", L1Presc: " << m_l1prescale << ", HLTPresc: " << m_l2prescale << ", Valid: " << m_Valid;
1082  } else {
1083  m_logger << ", Livefrac: " << m_livefrac << ", L1Presc: " << m_l1prescale << ", L2Presc: " << m_l2prescale << ", L3Presc: " << m_l3prescale << ", Valid: " << m_Valid;
1084  }
1085  if (m_uselar) m_logger << ", LAr ready fraction: " << m_larfrac;
1086  m_logger << Root::GEndl;
1087  }
1088 
1089  // Check if we have valid luminosity
1090  // Just need to check lowest digit. 10 -> BCID blind, 100 -> mu not valid
1091  if(m_Valid%10 != 0){
1092 
1093  // Invalid luminosity entry, call it bad
1094  m_instLumi = 0.0;
1095  m_totalbadblock += 1;
1096  m_t_totalbadblock += 1;
1097  m_logger << Root::kWARNING << "Skipping lumiblock " << m_runnbr << "[" << m_clumiblocknbr << "] with invalid inst. lumi. (valid=" << m_Valid << ")!" << Root::GEndl;
1098 
1099  } else if ((m_triglevel > 0) && (m_l1prescale < 0. || m_l2prescale < 0. || m_l3prescale < 0.)) {
1100 
1101  // Disabled trigger, call bad but still record delivered luminosity
1102  m_totalbadblock += 1;
1103  m_t_totalbadblock += 1;
1104  m_logger << Root::kWARNING << "Lumiblock " << m_runnbr << "[" << m_clumiblocknbr << "] has a disabled or incorrectly specified trigger.! " << Root::GEndl;
1105 
1106  }
1107 
1108  //========================================================//
1109  // 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 //
1110  //========================================================//
1111  // The actual calculation of integrated luminosity and
1112  // accumulation of some variables
1113  m_totalDelL += (m_deltaT*m_instLumi); // delivered lumi
1114  m_t_totalDelL += (m_deltaT*m_instLumi); // delivered lumi
1115  m_t_deltaT += m_deltaT;
1116 
1117  // Count up everything
1118  m_totall1acc += m_l1acc;
1119  m_livtrig_totall1acc += m_livetime_l1acc;
1120  m_t_l1acc += m_l1acc;
1121  m_totall1befpresc += m_beforeprescale;
1122  m_t_totall1befpresc += m_beforeprescale;
1123  m_totall2acc += m_l2acc;
1124  m_t_l2acc += m_l2acc;
1125  m_totall3acc += m_l3acc;
1126  m_t_l3acc += m_l3acc;
1127  m_livetime = m_livefrac*m_deltaT;
1128  m_totaltime += m_livetime;
1129  m_t_totaltime += m_livetime;
1130 
1131  double totalPrescale = m_l1prescale * m_l2prescale * m_l3prescale;
1132 
1133  // Check for disabled triggers
1134  if (m_l1prescale < 0. ) totalPrescale = 0.;
1135  if (m_l2prescale < 0. ) totalPrescale = 0.;
1136  if (m_l3prescale < 0. ) totalPrescale = 0.;
1137 
1138  // Check also for no trigger
1139  if (m_triglevel == 0) totalPrescale = 1.;
1140 
1141  m_intLumi = 0.;
1142 
1143  m_lumiWOPrescale += m_livetime*m_instLumi ;
1144  m_t_lumiWOPrescale += m_livetime*m_instLumi ;
1145 
1146  m_lumiLAr += m_livetime*m_larfrac*m_instLumi;
1147  m_t_lumiLAr += m_livetime*m_larfrac*m_instLumi;
1148 
1149  if (totalPrescale > 0.) {
1150  m_totalPrescaleWLiveTime += m_livetime/totalPrescale;
1151  m_t_totalPrescaleWLiveTime += m_livetime/totalPrescale;
1152  m_totalPrescale += 1./totalPrescale;
1153  m_t_totalPrescale += 1./totalPrescale;
1154  m_intLumi = m_larfrac * m_livetime * m_instLumi/totalPrescale; // <<<--- T H E F O R M U L A
1155  }
1156 
1157 
1158  m_totalL += m_intLumi;
1159  m_t_totalL += m_intLumi;
1160  m_totalLRun += m_intLumi;
1161 
1162 
1163  // MB: trigger rates, note that livefrac drops out of ratio
1164  m_l1rate = ( m_livetime>0 ? m_l1acc / m_livetime : 0. );
1165  m_l2rate = ( m_livetime>0 ? m_l2acc / m_livetime : 0. );
1166  m_l3rate = ( m_livetime>0 ? m_l3acc / m_livetime : 0. );
1167 
1168  // MB: delivered lumi
1169  m_l1ratediveffxsec = (float)m_afterprescale/( m_deltaT*m_effxsec );
1170  m_total_l1ratediveffxsec += (float)m_afterprescale / m_effxsec ;
1171  m_total_l1ratediveffxsecRun += (float)m_afterprescale / m_effxsec ;
1172 
1173  // MB: recorded lumi
1174  m_l1ratediveffxsec_recorded = (float)m_l1acc /( m_deltaT*m_effxsec );
1175  m_total_l1ratediveffxsec_recorded += (float)m_l1acc / m_effxsec ;
1176  m_total_l1ratediveffxsecRun_recorded += (float)m_l1acc / m_effxsec ;
1177 
1178  if (m_collsgrl!=0) {
1179  if ( m_l1rate>=m_mintrigrate )
1180  m_collsgrl->AddRunLumiBlock(m_runnbr,m_clumiblocknbr);
1181  }
1182 
1183  if (m_verbose) {
1184  if (m_effxsec!=1.0)
1185  m_logger << Root::kINFO << "L1rate a/ prescale: " << m_afterprescale << ", Delivered LumiFromL1rate (/ub): " << m_l1ratediveffxsec << ", Delivered TotalLumiFromL1rate (/ub): " << m_total_l1ratediveffxsec
1186  << Root::GEndl;
1187  }
1188 
1189  if(m_LumiTree != 0)m_LumiTree->Fill();
1190  } // End of loop over lumi blocks
1191 
1192  // Print IOV summary
1193  m_logger << Root::kINFO<< std::setw(10) << std::left << ">== Trigger : " << triggerchain << Root::GEndl;
1194  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;
1195  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;
1196  // 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;
1197 
1198  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;
1199  m_logger << Root::kINFO << std::setw(10) << std::left << "L1BeforePresc: " << std::setw(10) << std::left << m_t_totall1befpresc << Root::GEndl;
1200  m_logger << Root::kINFO << std::setw(10) << std::left << "Livetime : " << m_t_totaltime << Root::GEndl;
1201  m_logger << Root::kINFO << std::setw(10) << std::left << "Prescale Weighted Livetime: " << m_t_totalPrescaleWLiveTime << Root::GEndl;
1202  m_logger << Root::kINFO<< std::setw(10) << std::left << "Good LBs : " << m_t_totalgoodblock - m_t_totalbadblock << Root::GEndl;
1203  m_logger << Root::kINFO<< std::setw(10) << std::left << "Bad LBs : " << m_t_totalbadblock << Root::GEndl;
1204 
1205  if ( m_effxsec==1.0 ) {
1206  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL delivered (ub^-1) : " << m_t_totalDelL << Root::GEndl;
1207  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL after livefraction (ub^-1): " << m_t_lumiWOPrescale << Root::GEndl;
1208  if (m_uselar)
1209  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL after LAr fraction (ub^-1): " << m_t_lumiLAr << Root::GEndl;
1210  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL recorded after prescale (ub^-1) : " << m_t_totalL << Root::GEndl;
1211  } else {
1212  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL delived (ub^-1) : " << m_total_l1ratediveffxsec << Root::GEndl;
1213  m_logger << Root::kINFO << std::setw(10) << std::left << "IntL recorded (ub^-1) : " << m_total_l1ratediveffxsec_recorded << Root::GEndl;
1214  }
1215 
1216  // Print prescales as range of actual lumi blocks these apply to
1217  if(m_triglevel >= 1){
1218  // Print L1 Prescale values:
1219  m_logger << Root::kINFO << std::setw(10) << std::left << "L1 Prescales: ";
1220 
1221  std::list< std::pair<IOVRange, cool::Int32> >::iterator it;
1222  for(it = L1preObj.data.begin(); it != L1preObj.data.end(); ++it) {
1223  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" ;
1224  if (isrun2) {
1225  if (it->second < 0)
1226  m_logger << it->second << ", ";
1227  else
1228  m_logger << (0xFFFFFF / float(0x1000000 - it->second)) << ", ";
1229  } else {
1230  m_logger << it->second << ", ";
1231  }
1232  }
1233  m_logger << Root::kINFO << Root::GEndl;
1234  }
1235 
1236  if(m_triglevel >= 2){
1237  // Print L2 Prescale values:
1238  if (isrun2) {
1239  m_logger << Root::kINFO << std::setw(10) << std::left << "HLT Prescales: ";
1240  }
1241  else {
1242  m_logger << Root::kINFO << std::setw(10) << std::left << "L2 Prescales: ";
1243  }
1244 
1245  std::list< std::pair<IOVRange, cool::Float> >::iterator it;
1246  for(it = L2preObj.data.begin(); it != L2preObj.data.end(); ++it) {
1247  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" << it->second << ", ";
1248  }
1249  m_logger << Root::kINFO << Root::GEndl;
1250  }
1251 
1252  if(m_triglevel == 3){
1253  // Print L3 Prescale values:
1254  m_logger << Root::kINFO << std::setw(10) << std::left << "L3 Prescales: ";
1255 
1256  std::list< std::pair<IOVRange, cool::Float> >::iterator it;
1257  for(it = L3preObj.data.begin(); it != L3preObj.data.end(); ++it) {
1258  m_logger << Root::kINFO << std::setw(1) << std::left << "[" << it->first.start().event() << "," << it->first.stop().event()-1 << "]:" << it->second << ", ";
1259  }
1260  m_logger << Root::kINFO << Root::GEndl;
1261  }
1262 
1263  } // end lb collection loop
1264 
1265 
1266  // ------------------------------------------------------------------------------------------------
1267  // MB : Print total only at end of LB loop:
1268  m_logger << Root::kINFO << std::left << "-----------------------------------" << Root::GEndl;
1269  m_logger << Root::kINFO << std::left << " LumiCalculator summary" << Root::GEndl;
1270  m_logger << Root::kINFO << std::left << "-----------------------------------" << Root::GEndl;
1271  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" <<
1272  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;
1273  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
1274  << 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;
1275  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)
1276  << std::left << m_totall3acc << Root::GEndl;
1277  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;
1278 
1279  m_logger << Root::kINFO << std::setw(10) << std::left << "First Run: " << std::setw(10) << std::left << m_minrun << Root::GEndl;
1280  m_logger << Root::kINFO << std::setw(10) << std::left << "Last Run: " << std::setw(10) << std::left << m_maxrun << Root::GEndl;
1281  m_logger << Root::kINFO << std::setw(10) << std::left << "Total L1BeforePresc: " << std::setw(10) << std::left << m_totall1befpresc << Root::GEndl;
1282  m_logger << Root::kINFO<< std::setw(10) << std::left << "Total Livetime : " << m_totaltime << Root::GEndl;
1283  m_logger << Root::kINFO << std::setw(10) << std::left << "Total prescale weighted Livetime: " << m_totalPrescaleWLiveTime << Root::GEndl;
1284  m_logger << Root::kINFO<< std::setw(10) << std::left << "Total Good LBs : " << m_totalgoodblock - m_totalbadblock << Root::GEndl;
1285  m_logger << Root::kINFO<< std::setw(10) << std::left << "Total Bad LBs : " << m_totalbadblock << Root::GEndl;
1286  m_logger << Root::kINFO << std::setw(10) << std::left << "Total IntL delivered (ub^-1) : " << m_totalDelL << Root::GEndl;
1287  m_logger << Root::kINFO << std::setw(10) << std::left << "Total IntL after livefraction (ub^-1): " << m_lumiWOPrescale << Root::GEndl;
1288  if (m_uselar)
1289  m_logger << Root::kINFO << std::setw(10) << std::left << "Total IntL after LAr fraction (ub^-1): " << m_lumiLAr << Root::GEndl;
1290  m_logger << Root::kINFO << std::setw(10) << std::left << "Total IntL recorded (ub^-1) : " << m_totalL << Root::GEndl;
1291 
1292  // ------------------------------------------------------------------------------------------------
1293 
1294  if(m_makecollList == true){
1295  // store collisions xml file on demand
1296  if (m_collsgrl!=0) {
1297  TString collisionsxml = "collisions_" + m_collsgrl->GetSuggestedName() + ".xml";
1299  writer.SetGoodRunsList( *m_collsgrl );
1300  writer.SetFilename( collisionsxml.Data() );
1301  writer.WriteXMLFile();
1302  // can now delete grl
1303  delete m_collsgrl; m_collsgrl=0;
1304  }
1305  }
1306 
1307 
1308  // Creating monitoring plots on demand
1309  if(m_makePlots == true) { this->MakePlots(triggerchain); }
1310 
1311  delete cq_trigger;
1312  delete cq_lumi;
1313  delete cq_lar;
1314  delete cq_bs;
1315 }
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:423
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