ATLAS Offline Software
Loading...
Searching...
No Matches
LumiCalculator.cxx File Reference
#include "LumiCalc/LumiCalculator.h"
#include "GoodRunsLists/TGoodRunsList.h"
#include "GoodRunsLists/TGoodRunsListWriter.h"
#include "LumiCalc/CoolQuery.h"
#include "LumiCalc/LumiBlockRangeContainerConverter.h"
#include "TH1F.h"
#include "TTree.h"
#include "TFile.h"
#include "TString.h"
#include "TObjString.h"
#include "TROOT.h"
#include <memory>
#include <iomanip>
#include <iostream>
#include <set>
#include <regex.h>
#include <stdexcept>

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

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