CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
L1TBPTX Class Reference

#include <L1TBPTX.h>

Inheritance diagram for L1TBPTX:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Types

enum  BeamMode {
  NOMODE =1, SETUP =2, INJPILOT =3, INJINTR =4,
  INJNOMN =5, PRERAMP =6, RAMP =7, FLATTOP =8,
  SQUEEZE =9, ADJUST =10, STABLE =11, UNSTABLE =12,
  BEAMDUMP =13, RAMPDOWN =14, RECOVERY =15, INJDUMP =16,
  CIRCDUMP =17, ABORT =18, CYCLING =19, WBDUMP =20,
  NOBEAM =21
}
 
enum  Errors {
  UNKNOWN = 1, WARNING_DB_CONN_FAILED = 2, WARNING_DB_QUERY_FAILED = 3, WARNING_DB_INCORRECT_NBUNCHES = 4,
  ERROR_UNABLE_RETRIVE_PRODUCT = 5, ERROR_TRIGGERALIAS_NOTVALID = 6, ERROR_LSBLOCK_NOTVALID = 7
}
 

Public Member Functions

 L1TBPTX (const edm::ParameterSet &ps)
 
 ~L1TBPTX () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
 
void bookHistograms (DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
 BeginRun. More...
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
void endLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
 

Private Member Functions

void certifyLSBlock (std::string iTrigger, int iInitLs, int iEndLs, float iValue)
 
void doFractionInSync (bool iForce=false, bool iBad=false)
 
void getBeamConfOMDS ()
 

Private Attributes

std::map< int, TString > m_algoBit_Alias
 
BeamConfiguration m_beamConfig
 
unsigned int m_currentGTLS
 
unsigned int m_currentLS
 
bool m_currentLSValid
 
int m_currentPrescalesIndex
 
std::map< TString, int > m_effDenominator
 
std::map< TString, int > m_effNumerator
 
MonitorElementm_ErrorMonitor
 
edm::EDGetTokenT< L1GlobalTriggerReadoutRecordm_l1GtDataDaqInputTag
 
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecordm_l1GtEvmSource
 
std::map< std::pair< bool, int >, double > m_l1Rate
 
unsigned int m_lhcFill
 
std::map< TString, MonitorElement * > m_meAlgoEfficiency
 
std::map< TString, MonitorElement * > m_meAlgoMissFire
 
std::map< std::pair< bool, int >, MonitorElement * > m_meRate
 
std::map< TString, MonitorElement * > m_meTechEfficiency
 
std::map< TString, MonitorElement * > m_meTechMissFire
 
std::map< TString, int > m_missFireDenominator
 
std::map< TString, int > m_missFireNumerator
 
std::vector< edm::ParameterSetm_monitorBits
 
std::vector< edm::ParameterSetm_monitorRates
 
std::string m_outputFile
 
edm::ParameterSet m_parameters
 
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
 
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
 
bool * m_processedLS
 
int m_refPrescaleSet
 
edm::EDGetTokenT< Level1TriggerScalersCollectionm_scalersSource
 
std::vector< std::pair< int, int > > m_selAlgoBit
 
std::vector< std::pair< int, int > > m_selTechBit
 
std::map< int, TString > m_techBit_Alias
 
bool m_verbose
 

Detailed Description

Definition at line 72 of file L1TBPTX.h.

Member Enumeration Documentation

Enumerator
NOMODE 
SETUP 
INJPILOT 
INJINTR 
INJNOMN 
PRERAMP 
RAMP 
FLATTOP 
SQUEEZE 
ADJUST 
STABLE 
UNSTABLE 
BEAMDUMP 
RAMPDOWN 
RECOVERY 
INJDUMP 
CIRCDUMP 
ABORT 
CYCLING 
WBDUMP 
NOBEAM 

Definition at line 76 of file L1TBPTX.h.

76  {
77  NOMODE=1,
78  SETUP=2,
79  INJPILOT=3,
80  INJINTR=4,
81  INJNOMN=5,
82  PRERAMP=6,
83  RAMP=7,
84  FLATTOP=8,
85  SQUEEZE=9,
86  ADJUST=10,
87  STABLE=11,
88  UNSTABLE=12,
89  BEAMDUMP=13,
90  RAMPDOWN=14,
91  RECOVERY=15,
92  INJDUMP=16,
93  CIRCDUMP=17,
94  ABORT=18,
95  CYCLING=19,
96  WBDUMP=20,
97  NOBEAM=21
98  };
Enumerator
UNKNOWN 
WARNING_DB_CONN_FAILED 
WARNING_DB_QUERY_FAILED 
WARNING_DB_INCORRECT_NBUNCHES 
ERROR_UNABLE_RETRIVE_PRODUCT 
ERROR_TRIGGERALIAS_NOTVALID 
ERROR_LSBLOCK_NOTVALID 

Definition at line 100 of file L1TBPTX.h.

Constructor & Destructor Documentation

L1TBPTX::L1TBPTX ( const edm::ParameterSet ps)

Definition at line 33 of file L1TBPTX.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), mps_fire::i, PFRecoTauDiscriminationByIsolation_cfi::offset, and muonDTDigis_cfi::pset.

33  {
34 
36 
37  // Mapping parameter input variables
38  m_scalersSource = consumes<Level1TriggerScalersCollection>(pset.getParameter <InputTag>("inputTagScalersResults"));
39  m_l1GtDataDaqInputTag = consumes<L1GlobalTriggerReadoutRecord>(pset.getParameter <InputTag>("inputTagL1GtDataDaq"));
40  m_l1GtEvmSource = consumes<L1GlobalTriggerEvmReadoutRecord>(pset.getParameter <InputTag>("inputTagtEvmSource"));
41  m_verbose = pset.getUntrackedParameter<bool> ("verbose",false);
42 // m_refPrescaleSet = pset.getParameter <int> ("refPrescaleSet");
43 
44  m_monitorBits = pset.getParameter< vector<ParameterSet> >("MonitorBits");
45 
46  for(unsigned i=0; i<m_monitorBits.size(); i++){
47 
48  // Algorithms
49  if(m_monitorBits[i].getParameter<bool>("bitType")){
50 
51  int bit = m_monitorBits[i].getParameter<int>("bitNumber");
52  int offset = m_monitorBits[i].getParameter<int>("bitOffset");
53  m_selAlgoBit.push_back( pair<int,int>(bit,offset) );
54  }
55  // Tech
56  else{
57  int bit = m_monitorBits[i].getParameter<int>("bitNumber");
58  int offset = m_monitorBits[i].getParameter<int>("bitOffset");
59  m_selTechBit.push_back( pair<int,int>(bit,offset) );
60  }
61  }
62 
63  m_monitorRates = pset.getParameter< vector<ParameterSet> >("MonitorRates");
64 
65 }
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TBPTX.h:187
std::vector< std::pair< int, int > > m_selAlgoBit
Definition: L1TBPTX.h:160
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TBPTX.h:186
std::vector< std::pair< int, int > > m_selTechBit
Definition: L1TBPTX.h:161
bool m_verbose
Definition: L1TBPTX.h:141
edm::ParameterSet m_parameters
Definition: L1TBPTX.h:135
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:137
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:136
edm::EDGetTokenT< Level1TriggerScalersCollection > m_scalersSource
Definition: L1TBPTX.h:185
L1TBPTX::~L1TBPTX ( )
override

Definition at line 69 of file L1TBPTX.cc.

69 {}

Member Function Documentation

void L1TBPTX::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotected

Definition at line 313 of file L1TBPTX.cc.

References a, L1GtfeExtWord::beamMode(), gather_cfg::cout, edm::Event::getByToken(), Level1TriggerRates::gtAlgoCountsRate(), L1GlobalTriggerReadoutRecord::gtFdlVector(), L1GlobalTriggerEvmReadoutRecord::gtfeWord(), mps_fire::i, edm::EventBase::id(), edm::HandleBase::isValid(), L1GtfeExtWord::lhcFillNumber(), PFRecoTauDiscriminationByIsolation_cfi::offset, and edm::EventID::run().

313  {
314 
315  if(m_verbose){cout << "[L1TBPTX] Called analyze." << endl;}
316 
317  // We only start analyzing if current LS is still valid
318  if(m_currentLSValid){
319 
320  if(m_verbose){cout << "[L1TBPTX] -> m_currentLSValid=" << m_currentLSValid << endl;}
321 
322  // Retriving information from GT
324  iEvent.getByToken(m_l1GtEvmSource, gtEvmReadoutRecord);
325 
326  // Determining beam mode and fill number
327  if(gtEvmReadoutRecord.isValid()){
328 
329  const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
330  unsigned int lhcBeamMode = gtfeEvmWord.beamMode(); // Updating beam mode
331 
332  if(m_verbose){cout << "[L1TBPTX] Beam mode: "<< lhcBeamMode << endl;}
333 
334  if(lhcBeamMode==RAMP || lhcBeamMode==FLATTOP || lhcBeamMode==SQUEEZE || lhcBeamMode==ADJUST || lhcBeamMode==STABLE){
335 
336  if(m_lhcFill==0){
337 
338  if(m_verbose){cout << "[L1TBPTX] No valid bunch structure yet retrived. Attemptting to retrive..." << endl;}
339 
340  m_lhcFill = gtfeEvmWord.lhcFillNumber(); // Getting LHC Fill Number from GT
341 
342  getBeamConfOMDS(); // Getting Beam Configuration from OMDS
343 
344  // We are between RAMP and STABLE so there should be some colliding bunches
345  // in the machine. If 0 colliding bunched are found might be due to a delay
346  // of the update of the database. So we declare this LS as invalid and try
347  // again on the next one.
349  m_lhcFill=0;
350  m_currentLSValid=false;
351  }
352  }
353  }
354  else{m_currentLSValid=false;}
355 
356  }else{
357  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
358  eCount++;
359  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
360  }
361  }
362 
363  //______________________________________________________________________________
364  // If current LS is valid and Beam Configuration is Valid we analyse this event
365  //______________________________________________________________________________
367 
368  if(m_verbose){cout << "Current event in valid LS and beam config" << endl;}
369 
370  // Getting Final Decision Logic (FDL) Data from GT
371  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
372  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
373 
374  if(gtReadoutRecordData.isValid()){
375 
376  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
377 
378  // Getting the index for the fdl data for this event
379  int eventFDL=0;
380  for(unsigned int i=0; i<gtFdlVectorData.size(); i++){
381  if(gtFdlVectorData[i].bxInEvent()==0){eventFDL=i; break;}
382  }
383 
384  m_currentPrescalesIndex = gtFdlVectorData[eventFDL].gtPrescaleFactorIndexAlgo();
385 
386  for(unsigned i=0; i<m_monitorBits.size(); i++){
387 
388  TString triggerName = "";
389  bool isAlgo = m_monitorBits[i].getParameter<bool>("bitType");
390  int bit = m_monitorBits[i].getParameter<int> ("bitNumber");
391  int offset = m_monitorBits[i].getParameter<int> ("bitOffset");
392 
393  if(isAlgo){triggerName = "algo_"+std::to_string(bit);}
394  else {triggerName = "tech_"+std::to_string(bit);}
395 
396  int evBxStart = -2;
397  int evBxEnd = 2;
398 
399  if(offset<0){evBxStart+=-1*offset;}
400  if(offset>0){evBxEnd +=-1*offset;}
401 
402  for(unsigned a=0; a<gtFdlVectorData.size(); a++){
403 
404  int testBx = gtFdlVectorData[a].localBxNr()-offset;
405  bool lhcBxFilled = m_beamConfig.beam1[testBx] && m_beamConfig.beam2[testBx];
406  bool algoFired = false;
407 
408  if(isAlgo){
409  if(gtFdlVectorData[a].gtDecisionWord()[bit]){algoFired=true;}
410 
411  }
412  else{
413  if(gtFdlVectorData[a].gtTechnicalTriggerWord()[bit]){algoFired=true;}
414  }
415 
416  if(lhcBxFilled) {m_effDenominator[triggerName]++;}
417  if(lhcBxFilled && algoFired){m_effNumerator [triggerName]++;}
418 
419  if(algoFired) {m_missFireNumerator[triggerName]++;}
420  if(algoFired && !lhcBxFilled){m_missFireNumerator[triggerName]++;}
421 
422  }
423  }
424  }
425  }
426 
427  //______________________________________________________________________________
428  // Rate calculation
429  //______________________________________________________________________________
431  iEvent.getByToken(m_scalersSource,triggerScalers);
432 
433  if(triggerScalers.isValid()){
434 
435  Level1TriggerScalersCollection::const_iterator itL1TScalers = triggerScalers->begin();
436  Level1TriggerRates trigRates(*itL1TScalers,iEvent.id().run());
437 
438  m_currentGTLS= (*itL1TScalers).lumiSegmentNr();
439 
440  for(unsigned i=0; i<m_monitorRates.size(); i++){
441 
442  bool isAlgo = m_monitorRates[i].getParameter<bool>("bitType");
443  int bit = m_monitorRates[i].getParameter<int> ("bitNumber");
444 
445  pair<bool,int> refTrig = pair<bool,int>(isAlgo,bit);
446 
447  if(isAlgo){m_l1Rate[refTrig] = trigRates.gtAlgoCountsRate()[bit];}
448  else {m_l1Rate[refTrig] = trigRates.gtTechCountsRate()[bit];}
449  }
450  }
451 }
unsigned int m_lhcFill
Definition: L1TBPTX.h:156
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
TH1 * getTH1() const
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TBPTX.h:187
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TBPTX.h:186
BeamConfiguration m_beamConfig
Definition: L1TBPTX.h:159
int iEvent
Definition: GenABIO.cc:230
bool m_verbose
Definition: L1TBPTX.h:141
std::map< TString, int > m_effDenominator
Definition: L1TBPTX.h:147
int m_currentPrescalesIndex
Definition: L1TBPTX.h:152
bool isValid() const
Definition: HandleBase.h:74
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:137
bool m_currentLSValid
Definition: L1TBPTX.h:142
const cms_uint32_t lhcFillNumber() const
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:136
unsigned int m_currentGTLS
Definition: L1TBPTX.h:154
std::map< TString, int > m_effNumerator
Definition: L1TBPTX.h:146
double a
Definition: hdecay.h:121
std::map< std::pair< bool, int >, double > m_l1Rate
Definition: L1TBPTX.h:179
std::vector< bool > beam2
Definition: L1TOMDSHelper.h:38
void getBeamConfOMDS()
Definition: L1TBPTX.cc:458
std::vector< bool > beam1
Definition: L1TOMDSHelper.h:37
const cms_uint16_t beamMode() const
MonitorElement * m_ErrorMonitor
Definition: L1TBPTX.h:182
edm::EDGetTokenT< Level1TriggerScalersCollection > m_scalersSource
Definition: L1TBPTX.h:185
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:148
void L1TBPTX::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
overrideprotected

Definition at line 204 of file L1TBPTX.cc.

References gather_cfg::cout, mps_fire::i, edm::LuminosityBlockBase::id(), and edm::LuminosityBlockID::luminosityBlock().

204  {
205 
206  if (m_verbose){cout << "[L1TBPTX] Called beginLuminosityBlock." << endl;}
207 
208  // Updating current LS number
209  m_currentLS = lumiBlock.id().luminosityBlock();
210 
211  // A LS will be valid if BeamMode==STABLE for all events monitored
212  m_currentLSValid = true;
213 
214  for(unsigned i=0; i<m_monitorBits.size(); i++){
215 
216  TString triggerName = "";
217  if(m_monitorBits[i].getParameter<bool>("bitType")){
218  triggerName = "algo_"+std::to_string(m_monitorBits[i].getParameter<int>("bitNumber"));
219  }else{
220  triggerName = "tech_"+std::to_string(m_monitorBits[i].getParameter<int>("bitNumber"));
221  }
222 
223  m_effNumerator [triggerName] = 0;
224  m_effDenominator [triggerName] = 0;
225  m_missFireNumerator [triggerName] = 0;
226  m_missFireDenominator[triggerName] = 0;
227 
228  }
229 
230 }
unsigned int m_currentLS
Definition: L1TBPTX.h:153
bool m_verbose
Definition: L1TBPTX.h:141
std::map< TString, int > m_effDenominator
Definition: L1TBPTX.h:147
bool m_currentLSValid
Definition: L1TBPTX.h:142
std::map< TString, int > m_missFireDenominator
Definition: L1TBPTX.h:149
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:136
std::map< TString, int > m_effNumerator
Definition: L1TBPTX.h:146
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:148
void L1TBPTX::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprotected

BeginRun.

Definition at line 74 of file L1TBPTX.cc.

References patPFMETCorrections_cff::algo, HIPAlignmentAlgorithm_cfi::algoName, DQMStore::IBooker::book1D(), gather_cfg::cout, edm::EventSetup::get(), L1GtTriggerMenu::gtAlgorithmAliasMap(), L1GtPrescaleFactors::gtPrescaleFactors(), L1GtTriggerMenu::gtTechnicalTriggerMap(), mps_fire::i, edm::ESHandleBase::isValid(), edm::ESHandle< T >::product(), MonitorElement::setAxisTitle(), MonitorElement::setBinLabel(), DQMStore::IBooker::setCurrentFolder(), and pat::UNKNOWN.

74  {
75 
76  if (m_verbose){cout << "[L1TBPTX] Called beginRun." << endl;}
77 
78  ibooker.setCurrentFolder("L1T/L1TBPTX");
79 
80  // Initializing variables
81  int maxNbins = 2501;
82 
83  // Reseting run dependent variables
84  m_lhcFill = 0;
85  m_currentLS = 0;
86 
87  // Getting Trigger menu from GT
89  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd);
90  const L1GtTriggerMenu* menu = menuRcd.product();
91 
92  // Filling Alias-Bit Map
93  for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo!=menu->gtAlgorithmAliasMap().end(); ++algo){
94  m_algoBit_Alias[(algo->second).algoBitNumber()] = (algo->second).algoAlias();
95  }
96 
97  for (CItAlgo algo = menu->gtTechnicalTriggerMap().begin(); algo!=menu->gtTechnicalTriggerMap().end(); ++algo){
98  m_techBit_Alias[(algo->second).algoBitNumber()] = (algo->second).algoName();
99  }
100 
101  // Initializing DQM Monitor Elements
102  ibooker.setCurrentFolder("L1T/L1TBPTX");
103  m_ErrorMonitor = ibooker.book1D("ErrorMonitor","ErrorMonitor",7,0,7);
104  m_ErrorMonitor->setBinLabel(UNKNOWN ,"UNKNOWN");
105  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED ,"WARNING_DB_CONN_FAILED"); // Errors from L1TOMDSHelper
106  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED ,"WARNING_DB_QUERY_FAILED"); // Errors from L1TOMDSHelper
107  m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,"WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
108  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT ,"ERROR_UNABLE_RETRIVE_PRODUCT");
109  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID ,"ERROR_TRIGGERALIAS_NOTVALID");
110  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID ,"ERROR_LSBLOCK_NOTVALID");
111 
112  for(unsigned i=0; i<m_monitorBits.size(); i++){
113 
114  bool isAlgo = m_monitorBits[i].getParameter<bool> ("bitType");
115  TString testName = m_monitorBits[i].getParameter<string>("testName");
116  int bit = m_monitorBits[i].getParameter<int> ("bitNumber");
117 
118  TString meTitle = "";
119  ibooker.setCurrentFolder("L1T/L1TBPTX/Efficiency/");
120  if(isAlgo){
121  meTitle="Algo ";meTitle+=bit; meTitle+=" - "; meTitle+=m_algoBit_Alias[bit]; meTitle+=" Efficiency";
122  m_meAlgoEfficiency[bit] = ibooker.book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
123  m_meAlgoEfficiency[bit]->setAxisTitle("Lumi Section" ,1);
124  }
125  else{
126  meTitle="Tech "; meTitle+=bit; meTitle+=" - "; meTitle+=m_techBit_Alias[bit]; meTitle+=" Efficiency";
127  m_meTechEfficiency[bit] = ibooker.book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
128  m_meTechEfficiency[bit]->setAxisTitle("Lumi Section" ,1);
129  }
130 
131  meTitle = "";
132  ibooker.setCurrentFolder("L1T/L1TBPTX/MissFire/");
133  if(isAlgo){
134  meTitle="Algo "; meTitle+=bit; meTitle+=" - "; meTitle+=m_algoBit_Alias[bit]; meTitle+="(1 - Miss Fire Rate)";
135  m_meAlgoMissFire[bit] = ibooker.book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
136  m_meAlgoMissFire[bit]->setAxisTitle("Lumi Section" ,1);
137  m_meAlgoMissFire[bit]->setAxisTitle("1 - Miss Fire Rate",2);
138  }
139  else{
140  meTitle="Tech "; meTitle+=bit; meTitle+=" - "; meTitle+=m_techBit_Alias[bit]; meTitle+="(1 - Miss Fire Rate)";
141  m_meTechMissFire[bit] = ibooker.book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
142  m_meTechMissFire[bit]->setAxisTitle("Lumi Section" ,1);
143  m_meTechMissFire[bit]->setAxisTitle("1 - Miss Fire Rate",2);
144  }
145  }
146 
147  for(unsigned i=0; i<m_monitorRates.size(); i++){
148 
149  TString testName = m_monitorRates[i].getParameter<string>("testName");
150  bool isAlgo = m_monitorRates[i].getParameter<bool> ("bitType");
151  int bit = m_monitorRates[i].getParameter<int> ("bitNumber");
152 
153  pair<bool,int> refME = pair<bool,int>(isAlgo,bit);
154 
155  TString meTitle = "";
156  ibooker.setCurrentFolder("L1T/L1TBPTX/Rate/");
157  if(isAlgo){
158  meTitle="Algo "+std::to_string(bit); meTitle+=" - "; meTitle+=m_algoBit_Alias[bit]; meTitle+=" Rate";
159  m_meRate[refME] = ibooker.book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
160  m_meRate[refME]->setAxisTitle("Lumi Section" ,1);
161  m_meRate[refME]->setAxisTitle("Rate (unprescaled) [Hz]",2);
162  }
163  else{
164  meTitle="Tech "+std::to_string(bit); meTitle+=" - "; meTitle+=m_techBit_Alias[bit]; meTitle+=" Rate";
165  m_meRate[refME] = ibooker.book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
166  m_meRate[refME]->setAxisTitle("Lumi Section" ,1);
167  m_meRate[refME]->setAxisTitle("Rate (unprescaled) [Hz]",2);
168  }
169  }
170 
171 
172 
173  //_____________________________________________________________________
174  // Getting the prescale columns definition for this run
177 
178  iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
179  iSetup.get<L1GtPrescaleFactorsTechTrigRcd>().get(l1GtPfTech);
180 
181  if(l1GtPfAlgo.isValid()){
182  const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
183  m_prescaleFactorsAlgoTrig = &(m_l1GtPfAlgo->gtPrescaleFactors());
184  }else{
185  //TODO: Some error handling
186  }
187 
188  if(l1GtPfAlgo.isValid()){
189  const L1GtPrescaleFactors* m_l1GtPfTech = l1GtPfTech.product();
190  m_prescaleFactorsTechTrig = &(m_l1GtPfTech->gtPrescaleFactors());
191  }else{
192  //TODO: Some error handling
193  }
194 
195 }
std::map< TString, MonitorElement * > m_meTechEfficiency
Definition: L1TBPTX.h:174
unsigned int m_lhcFill
Definition: L1TBPTX.h:156
std::map< TString, MonitorElement * > m_meAlgoEfficiency
Definition: L1TBPTX.h:172
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
unsigned int m_currentLS
Definition: L1TBPTX.h:153
std::map< std::pair< bool, int >, MonitorElement * > m_meRate
Definition: L1TBPTX.h:178
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::map< TString, MonitorElement * > m_meAlgoMissFire
Definition: L1TBPTX.h:173
bool m_verbose
Definition: L1TBPTX.h:141
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Definition: L1TBPTX.h:165
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:137
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
std::map< int, TString > m_techBit_Alias
Definition: L1TBPTX.h:169
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:136
std::map< TString, MonitorElement * > m_meTechMissFire
Definition: L1TBPTX.h:175
T get() const
Definition: EventSetup.h:68
const AlgorithmMap & gtTechnicalTriggerMap() const
get / set the technical trigger map
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
std::map< int, TString > m_algoBit_Alias
Definition: L1TBPTX.h:168
bool isValid() const
Definition: ESHandle.h:45
T const * product() const
Definition: ESHandle.h:84
MonitorElement * m_ErrorMonitor
Definition: L1TBPTX.h:182
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
Definition: L1TBPTX.h:164
void L1TBPTX::certifyLSBlock ( std::string  iTrigger,
int  iInitLs,
int  iEndLs,
float  iValue 
)
private

Definition at line 542 of file L1TBPTX.cc.

542  {
543 
544 }
void L1TBPTX::doFractionInSync ( bool  iForce = false,
bool  iBad = false 
)
private

Definition at line 529 of file L1TBPTX.cc.

529  {
530 
531 }
void L1TBPTX::dqmBeginRun ( const edm::Run ,
const edm::EventSetup  
)
overrideprotected

Definition at line 197 of file L1TBPTX.cc.

197  {
198  //empty
199 }
void L1TBPTX::endLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
overrideprotected

Definition at line 236 of file L1TBPTX.cc.

References stringResolutionProvider_cfi::bin, gather_cfg::cout, and mps_fire::i.

236  {
237 
238  //______________________________________________________________________________
239  // Monitoring efficiencies
240  //______________________________________________________________________________
241  if(m_verbose){cout << "[L1TBPTX] Called endLuminosityBlock." << endl;}
242 
243  // If this LS is valid (i.e. all events recorded with stable beams)
245 
246  for(unsigned i=0; i<m_monitorBits.size(); i++){
247 
248  bool isAlgo = m_monitorBits[i].getParameter<bool> ("bitType");
249  TString testName = m_monitorBits[i].getParameter<string>("testName");
250  int bit = m_monitorBits[i].getParameter<int> ("bitNumber");
251 
252  TString triggerName;
253  if(isAlgo){triggerName = "algo_"+std::to_string(bit);}
254  else {triggerName = "tech_"+std::to_string(bit);}
255 
256  double valEff;
257  double valMiss;
258  if(m_effDenominator[triggerName]!=0) {valEff = (double)m_effNumerator[triggerName]/m_effDenominator[triggerName];}
259  else {valEff = 0;}
260  if(m_missFireDenominator[triggerName]!=0){valMiss = (double)m_missFireNumerator[triggerName]/m_missFireDenominator[triggerName];}
261  else {valMiss = 0;}
262 
263  if(isAlgo){
264  int bin = m_meAlgoEfficiency[bit]->getTH1()->FindBin(m_currentLS);
265  m_meAlgoEfficiency[bit]->setBinContent(bin,valEff);
266  m_meAlgoMissFire[bit] ->setBinContent(bin,1-valMiss);
267  }
268  else{
269  int bin = m_meTechEfficiency[bit]->getTH1()->FindBin(m_currentLS);
270  m_meTechEfficiency[bit]->setBinContent(bin,valEff);
271  m_meTechMissFire[bit] ->setBinContent(bin,1-valMiss);
272  }
273  }
274  }
275 
276  //______________________________________________________________________________
277  // Monitoring rates
278  //______________________________________________________________________________
279  // We are only interested in monitoring lumisections where the the LHC state is
280  // RAMP, FLATTOP, SQUEEZE, ADJUST or STABLE since the bunch configuration and
281  // therefore the BPTX rate will not change.
282 
283  if(m_currentLSValid){
284 
285  const vector<int>& currentPFAlgo = (*m_prescaleFactorsAlgoTrig).at(m_currentPrescalesIndex);
286  const vector<int>& currentPFTech = (*m_prescaleFactorsTechTrig).at(m_currentPrescalesIndex);
287 
288  for(unsigned i=0; i<m_monitorRates.size(); i++){
289 
290  bool isAlgo = m_monitorRates[i].getParameter<bool> ("bitType");
291  int bit = m_monitorRates[i].getParameter<int> ("bitNumber");
292 
293  pair<bool,int> refME = pair<bool,int>(isAlgo,bit);
294 
295  if(isAlgo){
296  int bin = m_meRate[refME]->getTH1()->FindBin(m_currentGTLS);
297  int trigPS = currentPFAlgo[bit];
298  double trigRate = (double) trigPS*m_l1Rate[refME];
299  m_meRate[refME]->setBinContent(bin,trigRate);
300 
301  }else{
302  int bin = m_meRate[refME]->getTH1()->FindBin(m_currentGTLS);
303  int trigPS = currentPFTech[bit];
304  double trigRate = (double) trigPS*m_l1Rate[refME];
305  m_meRate[refME]->setBinContent(bin,trigRate);
306  }
307  }
308  }
309 }
std::map< TString, MonitorElement * > m_meTechEfficiency
Definition: L1TBPTX.h:174
std::map< TString, MonitorElement * > m_meAlgoEfficiency
Definition: L1TBPTX.h:172
unsigned int m_currentLS
Definition: L1TBPTX.h:153
BeamConfiguration m_beamConfig
Definition: L1TBPTX.h:159
std::map< std::pair< bool, int >, MonitorElement * > m_meRate
Definition: L1TBPTX.h:178
std::map< TString, MonitorElement * > m_meAlgoMissFire
Definition: L1TBPTX.h:173
bool m_verbose
Definition: L1TBPTX.h:141
std::map< TString, int > m_effDenominator
Definition: L1TBPTX.h:147
int m_currentPrescalesIndex
Definition: L1TBPTX.h:152
bin
set the eta bin as selection string.
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:137
bool m_currentLSValid
Definition: L1TBPTX.h:142
std::map< TString, int > m_missFireDenominator
Definition: L1TBPTX.h:149
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:136
unsigned int m_currentGTLS
Definition: L1TBPTX.h:154
std::map< TString, int > m_effNumerator
Definition: L1TBPTX.h:146
std::map< TString, MonitorElement * > m_meTechMissFire
Definition: L1TBPTX.h:175
std::map< std::pair< bool, int >, double > m_l1Rate
Definition: L1TBPTX.h:179
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:148
void L1TBPTX::getBeamConfOMDS ( )
private

Definition at line 458 of file L1TBPTX.cc.

References gather_cfg::cout, L1TOMDSHelper::NO_ERROR, pat::UNKNOWN, L1TOMDSHelper::WARNING_DB_CONN_FAILED, L1TOMDSHelper::WARNING_DB_INCORRECT_NBUNCHES, and L1TOMDSHelper::WARNING_DB_QUERY_FAILED.

458  {
459 
460  if(m_verbose){cout << "[L1TBPTX] Called getBeamConfOMDS()" << endl;}
461 
462  //Getting connection paremeters
463  string oracleDB = m_parameters.getParameter<string>("oracleDB");
464  string pathCondDB = m_parameters.getParameter<string>("pathCondDB");
465 
466  // Connecting to OMDS
467  L1TOMDSHelper myOMDSHelper = L1TOMDSHelper();
468  int conError;
469  myOMDSHelper.connect(oracleDB,pathCondDB,conError);
470 
471  if(conError == L1TOMDSHelper::NO_ERROR){
472 
473  if(m_verbose){cout << "[L1TBPTX] Connected to DB with no error." << endl;}
474 
475  int errorRetrive;
476  m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrive);
477 
478  if(errorRetrive == L1TOMDSHelper::NO_ERROR){
479  if(m_verbose){
480  cout << "[L1TBPTX] Retriving LHC Bunch Structure: NO_ERROR" << endl;
481  cout << "[L1TSync] -> LHC Bunch Structure valid=" << m_beamConfig.m_valid << " nBunches=" << m_beamConfig.nCollidingBunches << endl;
482  }
483  }
484  else if(errorRetrive == L1TOMDSHelper::WARNING_DB_QUERY_FAILED){
485  if(m_verbose){cout << "[L1TBPTX] Retriving LHC Bunch Structure: WARNING_DB_QUERY_FAILED" << endl;}
486 
487  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_QUERY_FAILED);
488  eCount++;
489  m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_QUERY_FAILED,eCount);
490  }
491  else if(errorRetrive == L1TOMDSHelper::WARNING_DB_INCORRECT_NBUNCHES){
492  if(m_verbose){cout << "[L1TBPTX] Retriving LHC Bunch Structure: WARNING_DB_INCORRECT_NBUNCHES" << endl;}
493 
494  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_INCORRECT_NBUNCHES);
495  eCount++;
496  m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_INCORRECT_NBUNCHES,eCount);
497  }
498  else{
499  if(m_verbose){cout << "[L1TBPTX] Retriving LHC Bunch Structure: UNKNOWN" << endl;}
500  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(UNKNOWN);
501  eCount++;
502  m_ErrorMonitor->getTH1()->SetBinContent(UNKNOWN,eCount);
503  }
504 
505  }
506  else if(conError == L1TOMDSHelper::WARNING_DB_CONN_FAILED){
507  if(m_verbose){cout << "[L1TBPTX] Connection to DB: WARNING_DB_CONN_FAILED" << endl;}
508  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_CONN_FAILED);
509  eCount++;
510  m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_CONN_FAILED,eCount);
511  }
512  else{
513  if(m_verbose){cout << "[L1TBPTX] Connection to DB: UNKNOWN" << endl;}
514  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(UNKNOWN);
515  eCount++;
516  m_ErrorMonitor->getTH1()->SetBinContent(UNKNOWN,eCount);
517  }
518 }
T getParameter(std::string const &) const
unsigned int m_lhcFill
Definition: L1TBPTX.h:156
TH1 * getTH1() const
BeamConfiguration m_beamConfig
Definition: L1TBPTX.h:159
bool m_verbose
Definition: L1TBPTX.h:141
edm::ParameterSet m_parameters
Definition: L1TBPTX.h:135
MonitorElement * m_ErrorMonitor
Definition: L1TBPTX.h:182

Member Data Documentation

std::map<int,TString> L1TBPTX::m_algoBit_Alias
private

Definition at line 168 of file L1TBPTX.h.

BeamConfiguration L1TBPTX::m_beamConfig
private

Definition at line 159 of file L1TBPTX.h.

unsigned int L1TBPTX::m_currentGTLS
private

Definition at line 154 of file L1TBPTX.h.

unsigned int L1TBPTX::m_currentLS
private

Definition at line 153 of file L1TBPTX.h.

bool L1TBPTX::m_currentLSValid
private

Definition at line 142 of file L1TBPTX.h.

int L1TBPTX::m_currentPrescalesIndex
private

Definition at line 152 of file L1TBPTX.h.

std::map<TString,int> L1TBPTX::m_effDenominator
private

Definition at line 147 of file L1TBPTX.h.

std::map<TString,int> L1TBPTX::m_effNumerator
private

Definition at line 146 of file L1TBPTX.h.

MonitorElement* L1TBPTX::m_ErrorMonitor
private

Definition at line 182 of file L1TBPTX.h.

edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> L1TBPTX::m_l1GtDataDaqInputTag
private

Definition at line 187 of file L1TBPTX.h.

edm::EDGetTokenT<L1GlobalTriggerEvmReadoutRecord> L1TBPTX::m_l1GtEvmSource
private

Definition at line 186 of file L1TBPTX.h.

std::map<std::pair<bool,int>,double> L1TBPTX::m_l1Rate
private

Definition at line 179 of file L1TBPTX.h.

unsigned int L1TBPTX::m_lhcFill
private

Definition at line 156 of file L1TBPTX.h.

std::map<TString,MonitorElement*> L1TBPTX::m_meAlgoEfficiency
private

Definition at line 172 of file L1TBPTX.h.

std::map<TString,MonitorElement*> L1TBPTX::m_meAlgoMissFire
private

Definition at line 173 of file L1TBPTX.h.

std::map<std::pair<bool,int>,MonitorElement*> L1TBPTX::m_meRate
private

Definition at line 178 of file L1TBPTX.h.

std::map<TString,MonitorElement*> L1TBPTX::m_meTechEfficiency
private

Definition at line 174 of file L1TBPTX.h.

std::map<TString,MonitorElement*> L1TBPTX::m_meTechMissFire
private

Definition at line 175 of file L1TBPTX.h.

std::map<TString,int> L1TBPTX::m_missFireDenominator
private

Definition at line 149 of file L1TBPTX.h.

std::map<TString,int> L1TBPTX::m_missFireNumerator
private

Definition at line 148 of file L1TBPTX.h.

std::vector<edm::ParameterSet> L1TBPTX::m_monitorBits
private

Definition at line 136 of file L1TBPTX.h.

std::vector<edm::ParameterSet> L1TBPTX::m_monitorRates
private

Definition at line 137 of file L1TBPTX.h.

std::string L1TBPTX::m_outputFile
private

Definition at line 138 of file L1TBPTX.h.

edm::ParameterSet L1TBPTX::m_parameters
private

Definition at line 135 of file L1TBPTX.h.

const std::vector<std::vector<int> >* L1TBPTX::m_prescaleFactorsAlgoTrig
private

Definition at line 164 of file L1TBPTX.h.

const std::vector<std::vector<int> >* L1TBPTX::m_prescaleFactorsTechTrig
private

Definition at line 165 of file L1TBPTX.h.

bool* L1TBPTX::m_processedLS
private

Definition at line 143 of file L1TBPTX.h.

int L1TBPTX::m_refPrescaleSet
private

Definition at line 151 of file L1TBPTX.h.

edm::EDGetTokenT<Level1TriggerScalersCollection> L1TBPTX::m_scalersSource
private

Definition at line 185 of file L1TBPTX.h.

std::vector< std::pair<int,int> > L1TBPTX::m_selAlgoBit
private

Definition at line 160 of file L1TBPTX.h.

std::vector< std::pair<int,int> > L1TBPTX::m_selTechBit
private

Definition at line 161 of file L1TBPTX.h.

std::map<int,TString> L1TBPTX::m_techBit_Alias
private

Definition at line 169 of file L1TBPTX.h.

bool L1TBPTX::m_verbose
private

Definition at line 141 of file L1TBPTX.h.