Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:48

0001 #include "DQM/L1TMonitor/interface/L1TBPTX.h"
0002 
0003 #include "DQMServices/Core/interface/DQMStore.h"
0004 
0005 #include "DataFormats/Scalers/interface/LumiScalers.h"
0006 #include "DataFormats/Scalers/interface/Level1TriggerRates.h"
0007 
0008 #include "DataFormats/Common/interface/ConditionsInEdm.h"  // Parameters associated to Run, LS and Event
0009 
0010 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h"
0011 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
0012 #include "CondFormats/L1TObjects/interface/L1GtPrescaleFactors.h"
0013 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
0014 #include "CondFormats/DataRecord/interface/L1GtPrescaleFactorsAlgoTrigRcd.h"
0015 #include "CondFormats/DataRecord/interface/L1GtPrescaleFactorsTechTrigRcd.h"
0016 #include "CondFormats/L1TObjects/interface/L1GtMuonTemplate.h"
0017 
0018 // Luminosity Information
0019 //#include "DataFormats/Luminosity/interface/LumiDetails.h"
0020 //#include "DataFormats/Luminosity/interface/LumiSummary.h"
0021 
0022 // L1TMonitor includes
0023 #include "DQM/L1TMonitor/interface/L1TMenuHelper.h"
0024 
0025 #include "TList.h"
0026 #include <string>
0027 
0028 using namespace edm;
0029 using namespace std;
0030 
0031 //-------------------------------------------------------------------------------------
0032 //-------------------------------------------------------------------------------------
0033 L1TBPTX::L1TBPTX(const ParameterSet& pset) {
0034   m_parameters = pset;
0035 
0036   // Mapping parameter input variables
0037   m_scalersSource = consumes<Level1TriggerScalersCollection>(pset.getParameter<InputTag>("inputTagScalersResults"));
0038   m_l1GtDataDaqInputTag = consumes<L1GlobalTriggerReadoutRecord>(pset.getParameter<InputTag>("inputTagL1GtDataDaq"));
0039   m_l1GtEvmSource = consumes<L1GlobalTriggerEvmReadoutRecord>(pset.getParameter<InputTag>("inputTagtEvmSource"));
0040   l1gtMenuToken_ = esConsumes<edm::Transition::BeginRun>();
0041   l1GtPfAlgoToken_ = esConsumes<edm::Transition::BeginRun>();
0042   l1GtPfTechToken_ = esConsumes<edm::Transition::BeginRun>();
0043   m_verbose = pset.getUntrackedParameter<bool>("verbose", false);
0044   //  m_refPrescaleSet      = pset.getParameter         <int>     ("refPrescaleSet");
0045 
0046   m_monitorBits = pset.getParameter<vector<ParameterSet> >("MonitorBits");
0047 
0048   for (unsigned i = 0; i < m_monitorBits.size(); i++) {
0049     // Algorithms
0050     if (m_monitorBits[i].getParameter<bool>("bitType")) {
0051       int bit = m_monitorBits[i].getParameter<int>("bitNumber");
0052       int offset = m_monitorBits[i].getParameter<int>("bitOffset");
0053       m_selAlgoBit.push_back(pair<int, int>(bit, offset));
0054     }
0055     // Tech
0056     else {
0057       int bit = m_monitorBits[i].getParameter<int>("bitNumber");
0058       int offset = m_monitorBits[i].getParameter<int>("bitOffset");
0059       m_selTechBit.push_back(pair<int, int>(bit, offset));
0060     }
0061   }
0062 
0063   m_monitorRates = pset.getParameter<vector<ParameterSet> >("MonitorRates");
0064 }
0065 
0066 //-------------------------------------------------------------------------------------
0067 //-------------------------------------------------------------------------------------
0068 L1TBPTX::~L1TBPTX() {}
0069 
0070 //-------------------------------------------------------------------------------------
0071 /// BeginRun
0072 //-------------------------------------------------------------------------------------
0073 void L1TBPTX::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& iRun, const edm::EventSetup& iSetup) {
0074   if (m_verbose) {
0075     cout << "[L1TBPTX] Called beginRun." << endl;
0076   }
0077 
0078   ibooker.setCurrentFolder("L1T/L1TBPTX");
0079 
0080   // Initializing variables
0081   int maxNbins = 2501;
0082 
0083   // Reseting run dependent variables
0084   m_lhcFill = 0;
0085   m_currentLS = 0;
0086 
0087   // Getting Trigger menu from GT
0088   const L1GtTriggerMenu* menu = &iSetup.getData(l1gtMenuToken_);
0089 
0090   // Filling Alias-Bit Map
0091   for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo != menu->gtAlgorithmAliasMap().end(); ++algo) {
0092     m_algoBit_Alias[(algo->second).algoBitNumber()] = (algo->second).algoAlias();
0093   }
0094 
0095   for (CItAlgo algo = menu->gtTechnicalTriggerMap().begin(); algo != menu->gtTechnicalTriggerMap().end(); ++algo) {
0096     m_techBit_Alias[(algo->second).algoBitNumber()] = (algo->second).algoName();
0097   }
0098 
0099   // Initializing DQM Monitor Elements
0100   ibooker.setCurrentFolder("L1T/L1TBPTX");
0101   m_ErrorMonitor = ibooker.book1D("ErrorMonitor", "ErrorMonitor", 7, 0, 7);
0102   m_ErrorMonitor->setBinLabel(UNKNOWN, "UNKNOWN");
0103   m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED, "WARNING_DB_CONN_FAILED");    // Errors from L1TOMDSHelper
0104   m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED, "WARNING_DB_QUERY_FAILED");  // Errors from L1TOMDSHelper
0105   m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,
0106                               "WARNING_DB_INCORRECT_NBUNCHES");  // Errors from L1TOMDSHelper
0107   m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT, "ERROR_UNABLE_RETRIVE_PRODUCT");
0108   m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID, "ERROR_TRIGGERALIAS_NOTVALID");
0109   m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID, "ERROR_LSBLOCK_NOTVALID");
0110 
0111   for (unsigned i = 0; i < m_monitorBits.size(); i++) {
0112     bool isAlgo = m_monitorBits[i].getParameter<bool>("bitType");
0113     TString testName = m_monitorBits[i].getParameter<string>("testName");
0114     int bit = m_monitorBits[i].getParameter<int>("bitNumber");
0115 
0116     TString meTitle = "";
0117     ibooker.setCurrentFolder("L1T/L1TBPTX/Efficiency/");
0118     if (isAlgo) {
0119       meTitle = "Algo ";
0120       meTitle += bit;
0121       meTitle += " - ";
0122       meTitle += m_algoBit_Alias[bit];
0123       meTitle += " Efficiency";
0124       m_meAlgoEfficiency[bit] = ibooker.book1D(testName, meTitle, maxNbins, -0.5, double(maxNbins) - 0.5);
0125       m_meAlgoEfficiency[bit]->setAxisTitle("Lumi Section", 1);
0126     } else {
0127       meTitle = "Tech ";
0128       meTitle += bit;
0129       meTitle += " - ";
0130       meTitle += m_techBit_Alias[bit];
0131       meTitle += " Efficiency";
0132       m_meTechEfficiency[bit] = ibooker.book1D(testName, meTitle, maxNbins, -0.5, double(maxNbins) - 0.5);
0133       m_meTechEfficiency[bit]->setAxisTitle("Lumi Section", 1);
0134     }
0135 
0136     meTitle = "";
0137     ibooker.setCurrentFolder("L1T/L1TBPTX/MissFire/");
0138     if (isAlgo) {
0139       meTitle = "Algo ";
0140       meTitle += bit;
0141       meTitle += " - ";
0142       meTitle += m_algoBit_Alias[bit];
0143       meTitle += "(1 - Miss Fire Rate)";
0144       m_meAlgoMissFire[bit] = ibooker.book1D(testName, meTitle, maxNbins, -0.5, double(maxNbins) - 0.5);
0145       m_meAlgoMissFire[bit]->setAxisTitle("Lumi Section", 1);
0146       m_meAlgoMissFire[bit]->setAxisTitle("1 - Miss Fire Rate", 2);
0147     } else {
0148       meTitle = "Tech ";
0149       meTitle += bit;
0150       meTitle += " - ";
0151       meTitle += m_techBit_Alias[bit];
0152       meTitle += "(1 - Miss Fire Rate)";
0153       m_meTechMissFire[bit] = ibooker.book1D(testName, meTitle, maxNbins, -0.5, double(maxNbins) - 0.5);
0154       m_meTechMissFire[bit]->setAxisTitle("Lumi Section", 1);
0155       m_meTechMissFire[bit]->setAxisTitle("1 - Miss Fire Rate", 2);
0156     }
0157   }
0158 
0159   for (unsigned i = 0; i < m_monitorRates.size(); i++) {
0160     TString testName = m_monitorRates[i].getParameter<string>("testName");
0161     bool isAlgo = m_monitorRates[i].getParameter<bool>("bitType");
0162     int bit = m_monitorRates[i].getParameter<int>("bitNumber");
0163 
0164     pair<bool, int> refME = pair<bool, int>(isAlgo, bit);
0165 
0166     TString meTitle = "";
0167     ibooker.setCurrentFolder("L1T/L1TBPTX/Rate/");
0168     if (isAlgo) {
0169       meTitle = "Algo " + std::to_string(bit);
0170       meTitle += " - ";
0171       meTitle += m_algoBit_Alias[bit];
0172       meTitle += " Rate";
0173       m_meRate[refME] = ibooker.book1D(testName, meTitle, maxNbins, -0.5, double(maxNbins) - 0.5);
0174       m_meRate[refME]->setAxisTitle("Lumi Section", 1);
0175       m_meRate[refME]->setAxisTitle("Rate (unprescaled) [Hz]", 2);
0176     } else {
0177       meTitle = "Tech " + std::to_string(bit);
0178       meTitle += " - ";
0179       meTitle += m_techBit_Alias[bit];
0180       meTitle += " Rate";
0181       m_meRate[refME] = ibooker.book1D(testName, meTitle, maxNbins, -0.5, double(maxNbins) - 0.5);
0182       m_meRate[refME]->setAxisTitle("Lumi Section", 1);
0183       m_meRate[refME]->setAxisTitle("Rate (unprescaled) [Hz]", 2);
0184     }
0185   }
0186 
0187   //_____________________________________________________________________
0188   // Getting the prescale columns definition for this run
0189   const auto& l1GtPfAlgo = iSetup.getHandle(l1GtPfAlgoToken_);
0190   const auto& l1GtPfTech = iSetup.getHandle(l1GtPfTechToken_);
0191 
0192   if (l1GtPfAlgo.isValid()) {
0193     const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
0194     m_prescaleFactorsAlgoTrig = &(m_l1GtPfAlgo->gtPrescaleFactors());
0195   } else {
0196     //TODO: Some error handling
0197   }
0198 
0199   if (l1GtPfAlgo.isValid()) {
0200     const L1GtPrescaleFactors* m_l1GtPfTech = l1GtPfTech.product();
0201     m_prescaleFactorsTechTrig = &(m_l1GtPfTech->gtPrescaleFactors());
0202   } else {
0203     //TODO: Some error handling
0204   }
0205 }
0206 
0207 void L1TBPTX::dqmBeginRun(const edm::Run&, const edm::EventSetup&) {
0208   //empty
0209 }
0210 
0211 //_____________________________________________________________________
0212 // Function: beginLuminosityBlock
0213 //_____________________________________________________________________
0214 void L1TBPTX::beginLuminosityBlock(LuminosityBlock const& lumiBlock, EventSetup const& c) {
0215   if (m_verbose) {
0216     cout << "[L1TBPTX] Called beginLuminosityBlock." << endl;
0217   }
0218 
0219   // Updating current LS number
0220   m_currentLS = lumiBlock.id().luminosityBlock();
0221 
0222   // A LS will be valid if BeamMode==STABLE for all events monitored
0223   m_currentLSValid = true;
0224 
0225   for (unsigned i = 0; i < m_monitorBits.size(); i++) {
0226     TString triggerName = "";
0227     if (m_monitorBits[i].getParameter<bool>("bitType")) {
0228       triggerName = "algo_" + std::to_string(m_monitorBits[i].getParameter<int>("bitNumber"));
0229     } else {
0230       triggerName = "tech_" + std::to_string(m_monitorBits[i].getParameter<int>("bitNumber"));
0231     }
0232 
0233     m_effNumerator[triggerName] = 0;
0234     m_effDenominator[triggerName] = 0;
0235     m_missFireNumerator[triggerName] = 0;
0236     m_missFireDenominator[triggerName] = 0;
0237   }
0238 }
0239 
0240 //_____________________________________________________________________
0241 // Function: endLuminosityBlock
0242 // * Fills LS by LS ration of trigger out of sync
0243 //_____________________________________________________________________
0244 void L1TBPTX::endLuminosityBlock(LuminosityBlock const& lumiBlock, EventSetup const& c) {
0245   //______________________________________________________________________________
0246   // Monitoring efficiencies
0247   //______________________________________________________________________________
0248   if (m_verbose) {
0249     cout << "[L1TBPTX] Called endLuminosityBlock." << endl;
0250   }
0251 
0252   // If this LS is valid (i.e. all events recorded with stable beams)
0253   if (m_currentLSValid && m_beamConfig.isValid()) {
0254     for (unsigned i = 0; i < m_monitorBits.size(); i++) {
0255       bool isAlgo = m_monitorBits[i].getParameter<bool>("bitType");
0256       TString testName = m_monitorBits[i].getParameter<string>("testName");
0257       int bit = m_monitorBits[i].getParameter<int>("bitNumber");
0258 
0259       TString triggerName;
0260       if (isAlgo) {
0261         triggerName = "algo_" + std::to_string(bit);
0262       } else {
0263         triggerName = "tech_" + std::to_string(bit);
0264       }
0265 
0266       double valEff;
0267       double valMiss;
0268       if (m_effDenominator[triggerName] != 0) {
0269         valEff = (double)m_effNumerator[triggerName] / m_effDenominator[triggerName];
0270       } else {
0271         valEff = 0;
0272       }
0273       if (m_missFireDenominator[triggerName] != 0) {
0274         valMiss = (double)m_missFireNumerator[triggerName] / m_missFireDenominator[triggerName];
0275       } else {
0276         valMiss = 0;
0277       }
0278 
0279       if (isAlgo) {
0280         int bin = m_meAlgoEfficiency[bit]->getTH1()->FindBin(m_currentLS);
0281         m_meAlgoEfficiency[bit]->setBinContent(bin, valEff);
0282         m_meAlgoMissFire[bit]->setBinContent(bin, 1 - valMiss);
0283       } else {
0284         int bin = m_meTechEfficiency[bit]->getTH1()->FindBin(m_currentLS);
0285         m_meTechEfficiency[bit]->setBinContent(bin, valEff);
0286         m_meTechMissFire[bit]->setBinContent(bin, 1 - valMiss);
0287       }
0288     }
0289   }
0290 
0291   //______________________________________________________________________________
0292   // Monitoring rates
0293   //______________________________________________________________________________
0294   // We are only interested in monitoring lumisections where the the LHC state is
0295   // RAMP, FLATTOP, SQUEEZE, ADJUST or STABLE since the bunch configuration and
0296   // therefore the BPTX rate will not change.
0297 
0298   if (m_currentLSValid) {
0299     const vector<int>& currentPFAlgo = (*m_prescaleFactorsAlgoTrig).at(m_currentPrescalesIndex);
0300     const vector<int>& currentPFTech = (*m_prescaleFactorsTechTrig).at(m_currentPrescalesIndex);
0301 
0302     for (unsigned i = 0; i < m_monitorRates.size(); i++) {
0303       bool isAlgo = m_monitorRates[i].getParameter<bool>("bitType");
0304       int bit = m_monitorRates[i].getParameter<int>("bitNumber");
0305 
0306       pair<bool, int> refME = pair<bool, int>(isAlgo, bit);
0307 
0308       if (isAlgo) {
0309         int bin = m_meRate[refME]->getTH1()->FindBin(m_currentGTLS);
0310         int trigPS = currentPFAlgo[bit];
0311         double trigRate = (double)trigPS * m_l1Rate[refME];
0312         m_meRate[refME]->setBinContent(bin, trigRate);
0313 
0314       } else {
0315         int bin = m_meRate[refME]->getTH1()->FindBin(m_currentGTLS);
0316         int trigPS = currentPFTech[bit];
0317         double trigRate = (double)trigPS * m_l1Rate[refME];
0318         m_meRate[refME]->setBinContent(bin, trigRate);
0319       }
0320     }
0321   }
0322 }
0323 
0324 //_____________________________________________________________________
0325 void L1TBPTX::analyze(const Event& iEvent, const EventSetup& eventSetup) {
0326   if (m_verbose) {
0327     cout << "[L1TBPTX] Called analyze." << endl;
0328   }
0329 
0330   // We only start analyzing if current LS is still valid
0331   if (m_currentLSValid) {
0332     if (m_verbose) {
0333       cout << "[L1TBPTX] -> m_currentLSValid=" << m_currentLSValid << endl;
0334     }
0335 
0336     // Retriving information from GT
0337     edm::Handle<L1GlobalTriggerEvmReadoutRecord> gtEvmReadoutRecord;
0338     iEvent.getByToken(m_l1GtEvmSource, gtEvmReadoutRecord);
0339 
0340     // Determining beam mode and fill number
0341     if (gtEvmReadoutRecord.isValid()) {
0342       const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
0343       unsigned int lhcBeamMode = gtfeEvmWord.beamMode();  // Updating beam mode
0344 
0345       if (m_verbose) {
0346         cout << "[L1TBPTX] Beam mode: " << lhcBeamMode << endl;
0347       }
0348 
0349       if (lhcBeamMode == RAMP || lhcBeamMode == FLATTOP || lhcBeamMode == SQUEEZE || lhcBeamMode == ADJUST ||
0350           lhcBeamMode == STABLE) {
0351         if (m_lhcFill == 0) {
0352           if (m_verbose) {
0353             cout << "[L1TBPTX] No valid bunch structure yet retrived. Attemptting to retrive..." << endl;
0354           }
0355 
0356           m_lhcFill = gtfeEvmWord.lhcFillNumber();  // Getting LHC Fill Number from GT
0357 
0358           getBeamConfOMDS();  // Getting Beam Configuration from OMDS
0359 
0360           // We are between RAMP and STABLE so there should be some colliding bunches
0361           // in the machine. If 0 colliding bunched are found might be due to a delay
0362           // of the update of the database. So we declare this LS as invalid and try
0363           // again on the next one.
0364           if (m_beamConfig.nCollidingBunches <= 0) {
0365             m_lhcFill = 0;
0366             m_currentLSValid = false;
0367           }
0368         }
0369       } else {
0370         m_currentLSValid = false;
0371       }
0372 
0373     } else {
0374       int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
0375       eCount++;
0376       m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT, eCount);
0377     }
0378   }
0379 
0380   //______________________________________________________________________________
0381   // If current LS is valid and Beam Configuration is Valid we analyse this event
0382   //______________________________________________________________________________
0383   if (m_currentLSValid && m_beamConfig.isValid()) {
0384     if (m_verbose) {
0385       cout << "Current event in valid LS and beam config" << endl;
0386     }
0387 
0388     // Getting Final Decision Logic (FDL) Data from GT
0389     edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
0390     iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
0391 
0392     if (gtReadoutRecordData.isValid()) {
0393       const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
0394 
0395       // Getting the index for the fdl data for this event
0396       int eventFDL = 0;
0397       for (unsigned int i = 0; i < gtFdlVectorData.size(); i++) {
0398         if (gtFdlVectorData[i].bxInEvent() == 0) {
0399           eventFDL = i;
0400           break;
0401         }
0402       }
0403 
0404       m_currentPrescalesIndex = gtFdlVectorData[eventFDL].gtPrescaleFactorIndexAlgo();
0405 
0406       for (unsigned i = 0; i < m_monitorBits.size(); i++) {
0407         TString triggerName = "";
0408         bool isAlgo = m_monitorBits[i].getParameter<bool>("bitType");
0409         int bit = m_monitorBits[i].getParameter<int>("bitNumber");
0410         int offset = m_monitorBits[i].getParameter<int>("bitOffset");
0411 
0412         if (isAlgo) {
0413           triggerName = "algo_" + std::to_string(bit);
0414         } else {
0415           triggerName = "tech_" + std::to_string(bit);
0416         }
0417 
0418         for (unsigned a = 0; a < gtFdlVectorData.size(); a++) {
0419           int testBx = gtFdlVectorData[a].localBxNr() - offset;
0420           bool lhcBxFilled = m_beamConfig.beam1[testBx] && m_beamConfig.beam2[testBx];
0421           bool algoFired = false;
0422 
0423           if (isAlgo) {
0424             if (gtFdlVectorData[a].gtDecisionWord()[bit])
0425               algoFired = true;
0426 
0427           } else {
0428             if (gtFdlVectorData[a].gtTechnicalTriggerWord()[bit])
0429               algoFired = true;
0430           }
0431 
0432           if (lhcBxFilled) {
0433             m_effDenominator[triggerName]++;
0434             if (algoFired)
0435               m_effNumerator[triggerName]++;
0436           }
0437           if (algoFired) {
0438             m_missFireDenominator[triggerName]++;
0439             if (!lhcBxFilled)
0440               m_missFireNumerator[triggerName]++;
0441           }
0442         }
0443       }
0444     }
0445   }
0446 
0447   //______________________________________________________________________________
0448   // Rate calculation
0449   //______________________________________________________________________________
0450   edm::Handle<Level1TriggerScalersCollection> triggerScalers;
0451   iEvent.getByToken(m_scalersSource, triggerScalers);
0452 
0453   if (triggerScalers.isValid()) {
0454     Level1TriggerScalersCollection::const_iterator itL1TScalers = triggerScalers->begin();
0455     Level1TriggerRates trigRates(*itL1TScalers, iEvent.id().run());
0456 
0457     m_currentGTLS = (*itL1TScalers).lumiSegmentNr();
0458 
0459     for (unsigned i = 0; i < m_monitorRates.size(); i++) {
0460       bool isAlgo = m_monitorRates[i].getParameter<bool>("bitType");
0461       int bit = m_monitorRates[i].getParameter<int>("bitNumber");
0462 
0463       pair<bool, int> refTrig = pair<bool, int>(isAlgo, bit);
0464 
0465       if (isAlgo) {
0466         m_l1Rate[refTrig] = trigRates.gtAlgoCountsRate()[bit];
0467       } else {
0468         m_l1Rate[refTrig] = trigRates.gtTechCountsRate()[bit];
0469       }
0470     }
0471   }
0472 }
0473 
0474 //_____________________________________________________________________
0475 // Method: getBunchStructureOMDS
0476 // Description: Attempt to retrive Beam Configuration from OMDS and if
0477 //              we find error handle it
0478 //_____________________________________________________________________
0479 void L1TBPTX::getBeamConfOMDS() {
0480   if (m_verbose) {
0481     cout << "[L1TBPTX] Called getBeamConfOMDS()" << endl;
0482   }
0483 
0484   //Getting connection paremeters
0485   string oracleDB = m_parameters.getParameter<string>("oracleDB");
0486   string pathCondDB = m_parameters.getParameter<string>("pathCondDB");
0487 
0488   // Connecting to OMDS
0489   L1TOMDSHelper myOMDSHelper = L1TOMDSHelper();
0490   int conError;
0491   myOMDSHelper.connect(oracleDB, pathCondDB, conError);
0492 
0493   if (conError == L1TOMDSHelper::NO_ERROR) {
0494     if (m_verbose) {
0495       cout << "[L1TBPTX] Connected to DB with no error." << endl;
0496     }
0497 
0498     int errorRetrive;
0499     m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill, errorRetrive);
0500 
0501     if (errorRetrive == L1TOMDSHelper::NO_ERROR) {
0502       if (m_verbose) {
0503         cout << "[L1TBPTX] Retriving LHC Bunch Structure: NO_ERROR" << endl;
0504         cout << "[L1TSync] -> LHC Bunch Structure valid=" << m_beamConfig.m_valid
0505              << " nBunches=" << m_beamConfig.nCollidingBunches << endl;
0506       }
0507     } else if (errorRetrive == L1TOMDSHelper::WARNING_DB_QUERY_FAILED) {
0508       if (m_verbose) {
0509         cout << "[L1TBPTX] Retriving LHC Bunch Structure: WARNING_DB_QUERY_FAILED" << endl;
0510       }
0511 
0512       int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_QUERY_FAILED);
0513       eCount++;
0514       m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_QUERY_FAILED, eCount);
0515     } else if (errorRetrive == L1TOMDSHelper::WARNING_DB_INCORRECT_NBUNCHES) {
0516       if (m_verbose) {
0517         cout << "[L1TBPTX] Retriving LHC Bunch Structure: WARNING_DB_INCORRECT_NBUNCHES" << endl;
0518       }
0519 
0520       int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_INCORRECT_NBUNCHES);
0521       eCount++;
0522       m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_INCORRECT_NBUNCHES, eCount);
0523     } else {
0524       if (m_verbose) {
0525         cout << "[L1TBPTX] Retriving LHC Bunch Structure: UNKNOWN" << endl;
0526       }
0527       int eCount = m_ErrorMonitor->getTH1()->GetBinContent(UNKNOWN);
0528       eCount++;
0529       m_ErrorMonitor->getTH1()->SetBinContent(UNKNOWN, eCount);
0530     }
0531 
0532   } else if (conError == L1TOMDSHelper::WARNING_DB_CONN_FAILED) {
0533     if (m_verbose) {
0534       cout << "[L1TBPTX] Connection to DB: WARNING_DB_CONN_FAILED" << endl;
0535     }
0536     int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_CONN_FAILED);
0537     eCount++;
0538     m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_CONN_FAILED, eCount);
0539   } else {
0540     if (m_verbose) {
0541       cout << "[L1TBPTX] Connection to DB: UNKNOWN" << endl;
0542     }
0543     int eCount = m_ErrorMonitor->getTH1()->GetBinContent(UNKNOWN);
0544     eCount++;
0545     m_ErrorMonitor->getTH1()->SetBinContent(UNKNOWN, eCount);
0546   }
0547 }
0548 
0549 //_____________________________________________________________________
0550 // Method: doFractionInSync
0551 // Description: Produce plot with the fraction of in sync trigger for
0552 //              LS blocks with enough statistics.
0553 // Variable: iForce - Forces closing of all blocks and calculation of
0554 //                    the respective fractions
0555 // Variable: iBad   - (Only works with iForce=true) Forces the current
0556 //                    all current blocks to be marked as bad
0557 //_____________________________________________________________________
0558 void L1TBPTX::doFractionInSync(bool iForce, bool iBad) {}
0559 
0560 //_____________________________________________________________________
0561 // Method: certifyLSBlock
0562 // Description: Fill the trigger certification plot by blocks
0563 // Variable: iTrigger - Which trigger to certify
0564 // Variable: iInitLs  - Blocks initial LS
0565 // Variable: iEndLs   - Blocks end LS
0566 // Variable: iValue   - Value to be used to fill
0567 //_____________________________________________________________________
0568 void L1TBPTX::certifyLSBlock(string iTrigger, int iInitLs, int iEndLs, float iValue) {}