CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:
edm::EDAnalyzer edm::EDConsumerBase

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 Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 

Public Member Functions

 L1TBPTX (const edm::ParameterSet &ps)
 
virtual ~L1TBPTX ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginJob ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
void beginRun (const edm::Run &run, const edm::EventSetup &iSetup)
 BeginRun. More...
 
void endJob (void)
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
void endRun (const edm::Run &run, const edm::EventSetup &iSetup)
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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

DQMStoredbe
 
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::InputTag m_l1GtDataDaqInputTag
 
edm::InputTag m_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::InputTag m_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
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 67 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 71 of file L1TBPTX.h.

71  {
72  NOMODE=1,
73  SETUP=2,
74  INJPILOT=3,
75  INJINTR=4,
76  INJNOMN=5,
77  PRERAMP=6,
78  RAMP=7,
79  FLATTOP=8,
80  SQUEEZE=9,
81  ADJUST=10,
82  STABLE=11,
83  UNSTABLE=12,
84  BEAMDUMP=13,
85  RAMPDOWN=14,
86  RECOVERY=15,
87  INJDUMP=16,
88  CIRCDUMP=17,
89  ABORT=18,
90  CYCLING=19,
91  WBDUMP=20,
92  NOBEAM=21
93  };
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 95 of file L1TBPTX.h.

Constructor & Destructor Documentation

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

Definition at line 36 of file L1TBPTX.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, evf::evtn::offset(), and cppFunctionSkipper::operator.

36  {
37 
38  m_parameters = pset;
39 
40  // Mapping parameter input variables
41  m_scalersSource = pset.getParameter <InputTag>("inputTagScalersResults");
42  m_l1GtDataDaqInputTag = pset.getParameter <InputTag>("inputTagL1GtDataDaq");
43  m_l1GtEvmSource = pset.getParameter <InputTag>("inputTagtEvmSource");
44  m_verbose = pset.getUntrackedParameter<bool> ("verbose",false);
45 // m_refPrescaleSet = pset.getParameter <int> ("refPrescaleSet");
46 
47  m_monitorBits = pset.getParameter< vector<ParameterSet> >("MonitorBits");
48 
49  for(unsigned i=0; i<m_monitorBits.size(); i++){
50 
51  // Algorithms
52  if(m_monitorBits[i].getParameter<bool>("bitType")){
53 
54  int bit = m_monitorBits[i].getParameter<int>("bitNumber");
55  int offset = m_monitorBits[i].getParameter<int>("bitOffset");
56  m_selAlgoBit.push_back( pair<int,int>(bit,offset) );
57  }
58  // Tech
59  else{
60  int bit = m_monitorBits[i].getParameter<int>("bitNumber");
61  int offset = m_monitorBits[i].getParameter<int>("bitOffset");
62  m_selTechBit.push_back( pair<int,int>(bit,offset) );
63  }
64  }
65 
66  m_monitorRates = pset.getParameter< vector<ParameterSet> >("MonitorRates");
67 
68  if (pset.getUntrackedParameter < bool > ("dqmStore", false)) {
70  dbe->setVerbose(0);
71  }
72 
73 }
int i
Definition: DBlmapReader.cc:9
edm::InputTag m_scalersSource
Definition: L1TBPTX.h:184
std::vector< std::pair< int, int > > m_selAlgoBit
Definition: L1TBPTX.h:159
edm::InputTag m_l1GtDataDaqInputTag
Definition: L1TBPTX.h:186
std::vector< std::pair< int, int > > m_selTechBit
Definition: L1TBPTX.h:160
DQMStore * dbe
Definition: L1TBPTX.h:132
bool m_verbose
Definition: L1TBPTX.h:140
edm::ParameterSet m_parameters
Definition: L1TBPTX.h:134
void setVerbose(unsigned level)
Definition: DQMStore.cc:398
unsigned int offset(bool)
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:136
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:135
edm::InputTag m_l1GtEvmSource
Definition: L1TBPTX.h:185
L1TBPTX::~L1TBPTX ( )
virtual

Definition at line 77 of file L1TBPTX.cc.

77 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 352 of file L1TBPTX.cc.

References a, L1GtfeExtWord::beamMode(), gather_cfg::cout, edm::Event::getByLabel(), Level1TriggerRates::gtAlgoCountsRate(), i, edm::EventBase::id(), edm::HandleBase::isValid(), L1GtfeExtWord::lhcFillNumber(), evf::evtn::offset(), and edm::EventID::run().

352  {
353 
354  if(m_verbose){cout << "[L1TBPTX] Called analyze." << endl;}
355 
356  // We only start analyzing if current LS is still valid
357  if(m_currentLSValid){
358 
359  if(m_verbose){cout << "[L1TBPTX] -> m_currentLSValid=" << m_currentLSValid << endl;}
360 
361  // Retriving information from GT
363  iEvent.getByLabel(m_l1GtEvmSource, gtEvmReadoutRecord);
364 
365  // Determining beam mode and fill number
366  if(gtEvmReadoutRecord.isValid()){
367 
368  const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
369  unsigned int lhcBeamMode = gtfeEvmWord.beamMode(); // Updating beam mode
370 
371  if(m_verbose){cout << "[L1TBPTX] Beam mode: "<< lhcBeamMode << endl;}
372 
373  if(lhcBeamMode==RAMP || lhcBeamMode==FLATTOP || lhcBeamMode==SQUEEZE || lhcBeamMode==ADJUST || lhcBeamMode==STABLE){
374 
375  if(m_lhcFill==0){
376 
377  if(m_verbose){cout << "[L1TBPTX] No valid bunch structure yet retrived. Attemptting to retrive..." << endl;}
378 
379  m_lhcFill = gtfeEvmWord.lhcFillNumber(); // Getting LHC Fill Number from GT
380 
381  getBeamConfOMDS(); // Getting Beam Configuration from OMDS
382 
383  // We are between RAMP and STABLE so there should be some colliding bunches
384  // in the machine. If 0 colliding bunched are found might be due to a delay
385  // of the update of the database. So we declare this LS as invalid and try
386  // again on the next one.
388  m_lhcFill=0;
389  m_currentLSValid=false;
390  }
391  }
392  }
393  else{m_currentLSValid=false;}
394 
395  }else{
396  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
397  eCount++;
398  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
399  }
400  }
401 
402  //______________________________________________________________________________
403  // If current LS is valid and Beam Configuration is Valid we analyse this event
404  //______________________________________________________________________________
406 
407  if(m_verbose){cout << "Current event in valid LS and beam config" << endl;}
408 
409  // Getting Final Decision Logic (FDL) Data from GT
410  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
411  iEvent.getByLabel(m_l1GtDataDaqInputTag, gtReadoutRecordData);
412 
413  if(gtReadoutRecordData.isValid()){
414 
415  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
416 
417  // Getting the index for the fdl data for this event
418  int eventFDL=0;
419  for(unsigned int i=0; i<gtFdlVectorData.size(); i++){
420  if(gtFdlVectorData[i].bxInEvent()==0){eventFDL=i; break;}
421  }
422 
423  m_currentPrescalesIndex = gtFdlVectorData[eventFDL].gtPrescaleFactorIndexAlgo();
424 
425  for(unsigned i=0; i<m_monitorBits.size(); i++){
426 
427  TString triggerName = "";
428  bool isAlgo = m_monitorBits[i].getParameter<bool>("bitType");
429  int bit = m_monitorBits[i].getParameter<int> ("bitNumber");
430  int offset = m_monitorBits[i].getParameter<int> ("bitOffset");
431 
432  if(isAlgo){triggerName = "algo_"+bit;}
433  else {triggerName = "tech_"+bit;}
434 
435  int evBxStart = -2;
436  int evBxEnd = 2;
437 
438  if(offset<0){evBxStart+=-1*offset;}
439  if(offset>0){evBxEnd +=-1*offset;}
440 
441  for(unsigned a=0; a<gtFdlVectorData.size(); a++){
442 
443  int testBx = gtFdlVectorData[a].localBxNr()-offset;
444  bool lhcBxFilled = m_beamConfig.beam1[testBx] && m_beamConfig.beam2[testBx];
445  bool algoFired = false;
446 
447  if(isAlgo){
448  if(gtFdlVectorData[a].gtDecisionWord()[bit]){algoFired=true;}
449 
450  }
451  else{
452  if(gtFdlVectorData[a].gtTechnicalTriggerWord()[bit]){algoFired=true;}
453  }
454 
455  if(lhcBxFilled) {m_effDenominator[triggerName]++;}
456  if(lhcBxFilled && algoFired){m_effNumerator [triggerName]++;}
457 
458  if(algoFired) {m_missFireNumerator[triggerName]++;}
459  if(algoFired && !lhcBxFilled){m_missFireNumerator[triggerName]++;}
460 
461  }
462  }
463  }
464  }
465 
466  //______________________________________________________________________________
467  // Rate calculation
468  //______________________________________________________________________________
470  iEvent.getByLabel(m_scalersSource,triggerScalers);
471 
472  if(triggerScalers.isValid()){
473 
474  Level1TriggerScalersCollection::const_iterator itL1TScalers = triggerScalers->begin();
475  Level1TriggerRates trigRates(*itL1TScalers,iEvent.id().run());
476 
477  m_currentGTLS= (*itL1TScalers).lumiSegmentNr();
478 
479  for(unsigned i=0; i<m_monitorRates.size(); i++){
480 
481  bool isAlgo = m_monitorRates[i].getParameter<bool>("bitType");
482  int bit = m_monitorRates[i].getParameter<int> ("bitNumber");
483 
484  pair<bool,int> refTrig = pair<bool,int>(isAlgo,bit);
485 
486  if(isAlgo){m_l1Rate[refTrig] = trigRates.gtAlgoCountsRate()[bit];}
487  else {m_l1Rate[refTrig] = trigRates.gtTechCountsRate()[bit];}
488  }
489  }
490 
491 }
int i
Definition: DBlmapReader.cc:9
unsigned int m_lhcFill
Definition: L1TBPTX.h:155
edm::InputTag m_scalersSource
Definition: L1TBPTX.h:184
edm::InputTag m_l1GtDataDaqInputTag
Definition: L1TBPTX.h:186
BeamConfiguration m_beamConfig
Definition: L1TBPTX.h:158
int iEvent
Definition: GenABIO.cc:243
bool m_verbose
Definition: L1TBPTX.h:140
std::map< TString, int > m_effDenominator
Definition: L1TBPTX.h:146
TH1 * getTH1(void) const
int m_currentPrescalesIndex
Definition: L1TBPTX.h:151
unsigned int offset(bool)
bool isValid() const
Definition: HandleBase.h:76
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:136
bool m_currentLSValid
Definition: L1TBPTX.h:141
const cms_uint32_t lhcFillNumber() const
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:135
edm::InputTag m_l1GtEvmSource
Definition: L1TBPTX.h:185
unsigned int m_currentGTLS
Definition: L1TBPTX.h:153
std::map< TString, int > m_effNumerator
Definition: L1TBPTX.h:145
double a
Definition: hdecay.h:121
std::map< std::pair< bool, int >, double > m_l1Rate
Definition: L1TBPTX.h:178
std::vector< bool > beam2
Definition: L1TOMDSHelper.h:38
void getBeamConfOMDS()
Definition: L1TBPTX.cc:498
tuple cout
Definition: gather_cfg.py:121
std::vector< bool > beam1
Definition: L1TOMDSHelper.h:37
const cms_uint16_t beamMode() const
MonitorElement * m_ErrorMonitor
Definition: L1TBPTX.h:181
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:147
void L1TBPTX::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 81 of file L1TBPTX.cc.

References gather_cfg::cout, cppFunctionSkipper::operator, DQMStore::rmdir(), and DQMStore::setCurrentFolder().

81  {
82 
83  if (m_verbose){cout << "[L1TBPTX] Called beginJob." << endl;}
84 
85  // get hold of back-end interface
86  DQMStore *dbe = 0;
87  dbe = Service < DQMStore > ().operator->();
88 
89  if (dbe) {
90  dbe->setCurrentFolder("L1T/L1TBPTX");
91  dbe->rmdir("L1T/L1TBPTX");
92  }
93 
94 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2535
DQMStore * dbe
Definition: L1TBPTX.h:132
bool m_verbose
Definition: L1TBPTX.h:140
tuple cout
Definition: gather_cfg.py:121
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void L1TBPTX::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 236 of file L1TBPTX.cc.

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

236  {
237 
238  if (m_verbose){cout << "[L1TBPTX] Called beginLuminosityBlock." << endl;}
239 
240  // Updating current LS number
241  m_currentLS = lumiBlock.id().luminosityBlock();
242 
243  // A LS will be valid if BeamMode==STABLE for all events monitored
244  m_currentLSValid = true;
245 
246  for(unsigned i=0; i<m_monitorBits.size(); i++){
247 
248  TString triggerName = "";
249  if(m_monitorBits[i].getParameter<bool>("bitType")){
250  triggerName = "algo_"+m_monitorBits[i].getParameter<int>("bitNumber");
251  }else{
252  triggerName = "tech_"+m_monitorBits[i].getParameter<int>("bitNumber");
253  }
254 
255  m_effNumerator [triggerName] = 0;
256  m_effDenominator [triggerName] = 0;
257  m_missFireNumerator [triggerName] = 0;
258  m_missFireDenominator[triggerName] = 0;
259 
260  }
261 
262 }
int i
Definition: DBlmapReader.cc:9
unsigned int m_currentLS
Definition: L1TBPTX.h:152
bool m_verbose
Definition: L1TBPTX.h:140
std::map< TString, int > m_effDenominator
Definition: L1TBPTX.h:146
bool m_currentLSValid
Definition: L1TBPTX.h:141
std::map< TString, int > m_missFireDenominator
Definition: L1TBPTX.h:148
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:135
std::map< TString, int > m_effNumerator
Definition: L1TBPTX.h:145
tuple cout
Definition: gather_cfg.py:121
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:147
void L1TBPTX::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 112 of file L1TBPTX.cc.

References gather_cfg::cout, edm::EventSetup::get(), L1GtTriggerMenu::gtAlgorithmAliasMap(), L1GtPrescaleFactors::gtPrescaleFactors(), L1GtTriggerMenu::gtTechnicalTriggerMap(), i, edm::ESHandleBase::isValid(), relval_steps::menu, edm::ESHandle< class >::product(), and pat::UNKNOWN.

112  {
113 
114  if (m_verbose){cout << "[L1TBPTX] Called beginRun." << endl;}
115 
116  // Initializing variables
117  int maxNbins = 2501;
118 
119  // Reseting run dependent variables
120  m_lhcFill = 0;
121  m_currentLS = 0;
122 
123  // Getting Trigger menu from GT
125  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd);
126  const L1GtTriggerMenu* menu = menuRcd.product();
127 
128  // Filling Alias-Bit Map
129  for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo!=menu->gtAlgorithmAliasMap().end(); ++algo){
130  m_algoBit_Alias[(algo->second).algoBitNumber()] = (algo->second).algoAlias();
131  }
132 
133  for (CItAlgo algo = menu->gtTechnicalTriggerMap().begin(); algo!=menu->gtTechnicalTriggerMap().end(); ++algo){
134  m_techBit_Alias[(algo->second).algoBitNumber()] = (algo->second).algoName();
135  }
136 
137  // Initializing DQM Monitor Elements
138  dbe->setCurrentFolder("L1T/L1TBPTX");
139  m_ErrorMonitor = dbe->book1D("ErrorMonitor","ErrorMonitor",7,0,7);
140  m_ErrorMonitor->setBinLabel(UNKNOWN ,"UNKNOWN");
141  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED ,"WARNING_DB_CONN_FAILED"); // Errors from L1TOMDSHelper
142  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED ,"WARNING_DB_QUERY_FAILED"); // Errors from L1TOMDSHelper
143  m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,"WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
144  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT ,"ERROR_UNABLE_RETRIVE_PRODUCT");
145  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID ,"ERROR_TRIGGERALIAS_NOTVALID");
146  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID ,"ERROR_LSBLOCK_NOTVALID");
147 
148  for(unsigned i=0; i<m_monitorBits.size(); i++){
149 
150  bool isAlgo = m_monitorBits[i].getParameter<bool> ("bitType");
151  TString testName = m_monitorBits[i].getParameter<string>("testName");
152  int bit = m_monitorBits[i].getParameter<int> ("bitNumber");
153 
154  TString meTitle = "";
155  dbe->setCurrentFolder("L1T/L1TBPTX/Efficiency/");
156  if(isAlgo){
157  meTitle="Algo ";meTitle+=bit; meTitle+=" - "; meTitle+=m_algoBit_Alias[bit]; meTitle+=" Efficiency";
158  m_meAlgoEfficiency[bit] = dbe->book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
159  m_meAlgoEfficiency[bit]->setAxisTitle("Lumi Section" ,1);
160  }
161  else{
162  meTitle="Tech "; meTitle+=bit; meTitle+=" - "; meTitle+=m_techBit_Alias[bit]; meTitle+=" Efficiency";
163  m_meTechEfficiency[bit] = dbe->book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
164  m_meTechEfficiency[bit]->setAxisTitle("Lumi Section" ,1);
165  }
166 
167  meTitle = "";
168  dbe->setCurrentFolder("L1T/L1TBPTX/MissFire/");
169  if(isAlgo){
170  meTitle="Algo "; meTitle+=bit; meTitle+=" - "; meTitle+=m_algoBit_Alias[bit]; meTitle+="(1 - Miss Fire Rate)";
171  m_meAlgoMissFire[bit] = dbe->book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
172  m_meAlgoMissFire[bit]->setAxisTitle("Lumi Section" ,1);
173  m_meAlgoMissFire[bit]->setAxisTitle("1 - Miss Fire Rate",2);
174  }
175  else{
176  meTitle="Tech "; meTitle+=bit; meTitle+=" - "; meTitle+=m_techBit_Alias[bit]; meTitle+="(1 - Miss Fire Rate)";
177  m_meTechMissFire[bit] = dbe->book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
178  m_meTechMissFire[bit]->setAxisTitle("Lumi Section" ,1);
179  m_meTechMissFire[bit]->setAxisTitle("1 - Miss Fire Rate",2);
180  }
181  }
182 
183  for(unsigned i=0; i<m_monitorRates.size(); i++){
184 
185  TString testName = m_monitorRates[i].getParameter<string>("testName");
186  bool isAlgo = m_monitorRates[i].getParameter<bool> ("bitType");
187  int bit = m_monitorRates[i].getParameter<int> ("bitNumber");
188 
189  pair<bool,int> refME = pair<bool,int>(isAlgo,bit);
190 
191  TString meTitle = "";
192  dbe->setCurrentFolder("L1T/L1TBPTX/Rate/");
193  if(isAlgo){
194  meTitle="Algo "+bit; meTitle+=" - "; meTitle+=m_algoBit_Alias[bit]; meTitle+=" Rate";
195  m_meRate[refME] = dbe->book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
196  m_meRate[refME]->setAxisTitle("Lumi Section" ,1);
197  m_meRate[refME]->setAxisTitle("Rate (unprescaled) [Hz]",2);
198  }
199  else{
200  meTitle="Tech "+bit; meTitle+=" - "; meTitle+=m_techBit_Alias[bit]; meTitle+=" Rate";
201  m_meRate[refME] = dbe->book1D(testName,meTitle,maxNbins,-0.5,double(maxNbins)-0.5);
202  m_meRate[refME]->setAxisTitle("Lumi Section" ,1);
203  m_meRate[refME]->setAxisTitle("Rate (unprescaled) [Hz]",2);
204  }
205  }
206 
207 
208 
209  //_____________________________________________________________________
210  // Getting the prescale columns definition for this run
213 
214  iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
215  iSetup.get<L1GtPrescaleFactorsTechTrigRcd>().get(l1GtPfTech);
216 
217  if(l1GtPfAlgo.isValid()){
218  const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
219  m_prescaleFactorsAlgoTrig = &(m_l1GtPfAlgo->gtPrescaleFactors());
220  }else{
221  //TODO: Some error handling
222  }
223 
224  if(l1GtPfAlgo.isValid()){
225  const L1GtPrescaleFactors* m_l1GtPfTech = l1GtPfTech.product();
226  m_prescaleFactorsTechTrig = &(m_l1GtPfTech->gtPrescaleFactors());
227  }else{
228  //TODO: Some error handling
229  }
230 
231 }
std::map< TString, MonitorElement * > m_meTechEfficiency
Definition: L1TBPTX.h:173
int i
Definition: DBlmapReader.cc:9
unsigned int m_lhcFill
Definition: L1TBPTX.h:155
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
std::map< TString, MonitorElement * > m_meAlgoEfficiency
Definition: L1TBPTX.h:171
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:152
std::map< std::pair< bool, int >, MonitorElement * > m_meRate
Definition: L1TBPTX.h:177
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
DQMStore * dbe
Definition: L1TBPTX.h:132
std::map< TString, MonitorElement * > m_meAlgoMissFire
Definition: L1TBPTX.h:172
bool m_verbose
Definition: L1TBPTX.h:140
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
Definition: L1TBPTX.h:164
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:136
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
std::map< int, TString > m_techBit_Alias
Definition: L1TBPTX.h:168
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:135
std::map< TString, MonitorElement * > m_meTechMissFire
Definition: L1TBPTX.h:174
tuple cout
Definition: gather_cfg.py:121
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:167
bool isValid() const
Definition: ESHandle.h:37
MonitorElement * m_ErrorMonitor
Definition: L1TBPTX.h:181
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
Definition: L1TBPTX.h:163
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void L1TBPTX::certifyLSBlock ( std::string  iTrigger,
int  iInitLs,
int  iEndLs,
float  iValue 
)
private

Definition at line 582 of file L1TBPTX.cc.

582  {
583 
584 }
void L1TBPTX::doFractionInSync ( bool  iForce = false,
bool  iBad = false 
)
private

Definition at line 569 of file L1TBPTX.cc.

569  {
570 
571 }
void L1TBPTX::endJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 98 of file L1TBPTX.cc.

References gather_cfg::cout.

98  {
99 
100  if (m_verbose){cout << "[L1TBPTX] Called endJob." << endl;}
101 
102  if (m_outputFile.size() != 0 && dbe)
104 
105  return;
106 
107 }
std::string m_outputFile
Definition: L1TBPTX.h:137
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2118
DQMStore * dbe
Definition: L1TBPTX.h:132
bool m_verbose
Definition: L1TBPTX.h:140
tuple cout
Definition: gather_cfg.py:121
void L1TBPTX::endLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 268 of file L1TBPTX.cc.

References newFWLiteAna::bin, gather_cfg::cout, and i.

268  {
269 
270  //______________________________________________________________________________
271  // Monitoring efficiencies
272  //______________________________________________________________________________
273  if(m_verbose){cout << "[L1TBPTX] Called endLuminosityBlock." << endl;}
274 
275  // If this LS is valid (i.e. all events recorded with stable beams)
277 
278  for(unsigned i=0; i<m_monitorBits.size(); i++){
279 
280  bool isAlgo = m_monitorBits[i].getParameter<bool> ("bitType");
281  TString testName = m_monitorBits[i].getParameter<string>("testName");
282  int bit = m_monitorBits[i].getParameter<int> ("bitNumber");
283 
284  TString triggerName;
285  if(isAlgo){triggerName = "algo_"+bit;}
286  else {triggerName = "tech_"+bit;}
287 
288  double valEff;
289  double valMiss;
290  if(m_effDenominator[triggerName]!=0) {valEff = (double)m_effNumerator[triggerName]/m_effDenominator[triggerName];}
291  else {valEff = 0;}
292  if(m_missFireDenominator[triggerName]!=0){valMiss = (double)m_missFireNumerator[triggerName]/m_missFireDenominator[triggerName];}
293  else {valMiss = 0;}
294 
295  if(isAlgo){
296  int bin = m_meAlgoEfficiency[bit]->getTH1()->FindBin(m_currentLS);
297  m_meAlgoEfficiency[bit]->setBinContent(bin,valEff);
298  m_meAlgoMissFire[bit] ->setBinContent(bin,1-valMiss);
299  }
300  else{
301  int bin = m_meTechEfficiency[bit]->getTH1()->FindBin(m_currentLS);
302  m_meTechEfficiency[bit]->setBinContent(bin,valEff);
303  m_meTechMissFire[bit] ->setBinContent(bin,1-valMiss);
304  }
305  }
306  }
307 
308  //______________________________________________________________________________
309  // Monitoring rates
310  //______________________________________________________________________________
311  // We are only interested in monitoring lumisections where the the LHC state is
312  // RAMP, FLATTOP, SQUEEZE, ADJUST or STABLE since the bunch configuration and
313  // therefore the BPTX rate will not change.
314 
315  if(m_currentLSValid){
316 
317  const vector<int>& currentPFAlgo = (*m_prescaleFactorsAlgoTrig).at(m_currentPrescalesIndex);
318  const vector<int>& currentPFTech = (*m_prescaleFactorsTechTrig).at(m_currentPrescalesIndex);
319 
320  for(unsigned i=0; i<m_monitorRates.size(); i++){
321 
322  bool isAlgo = m_monitorRates[i].getParameter<bool> ("bitType");
323  int bit = m_monitorRates[i].getParameter<int> ("bitNumber");
324 
325  pair<bool,int> refME = pair<bool,int>(isAlgo,bit);
326 
327  if(isAlgo){
328  int bin = m_meRate[refME]->getTH1()->FindBin(m_currentGTLS);
329  int trigPS = currentPFAlgo[bit];
330  double trigRate = (double) trigPS*m_l1Rate[refME];
331  m_meRate[refME]->setBinContent(bin,trigRate);
332 
333  }else{
334  int bin = m_meRate[refME]->getTH1()->FindBin(m_currentGTLS);
335  int trigPS = currentPFTech[bit];
336  double trigRate = (double) trigPS*m_l1Rate[refME];
337  m_meRate[refME]->setBinContent(bin,trigRate);
338  }
339  }
340  }
341 }
std::map< TString, MonitorElement * > m_meTechEfficiency
Definition: L1TBPTX.h:173
int i
Definition: DBlmapReader.cc:9
std::map< TString, MonitorElement * > m_meAlgoEfficiency
Definition: L1TBPTX.h:171
unsigned int m_currentLS
Definition: L1TBPTX.h:152
BeamConfiguration m_beamConfig
Definition: L1TBPTX.h:158
std::map< std::pair< bool, int >, MonitorElement * > m_meRate
Definition: L1TBPTX.h:177
std::map< TString, MonitorElement * > m_meAlgoMissFire
Definition: L1TBPTX.h:172
bool m_verbose
Definition: L1TBPTX.h:140
std::map< TString, int > m_effDenominator
Definition: L1TBPTX.h:146
int m_currentPrescalesIndex
Definition: L1TBPTX.h:151
std::vector< edm::ParameterSet > m_monitorRates
Definition: L1TBPTX.h:136
bool m_currentLSValid
Definition: L1TBPTX.h:141
std::map< TString, int > m_missFireDenominator
Definition: L1TBPTX.h:148
std::vector< edm::ParameterSet > m_monitorBits
Definition: L1TBPTX.h:135
unsigned int m_currentGTLS
Definition: L1TBPTX.h:153
std::map< TString, int > m_effNumerator
Definition: L1TBPTX.h:145
std::map< TString, MonitorElement * > m_meTechMissFire
Definition: L1TBPTX.h:174
std::map< std::pair< bool, int >, double > m_l1Rate
Definition: L1TBPTX.h:178
tuple cout
Definition: gather_cfg.py:121
std::map< TString, int > m_missFireNumerator
Definition: L1TBPTX.h:147
void L1TBPTX::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 344 of file L1TBPTX.cc.

References gather_cfg::cout.

344  {
345 
346  if(m_verbose){cout << "[L1TBPTX] Called endRun." << endl;}
347 
348 
349 }
bool m_verbose
Definition: L1TBPTX.h:140
tuple cout
Definition: gather_cfg.py:121
void L1TBPTX::getBeamConfOMDS ( )
private

Definition at line 498 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.

498  {
499 
500  if(m_verbose){cout << "[L1TBPTX] Called getBeamConfOMDS()" << endl;}
501 
502  //Getting connection paremeters
503  string oracleDB = m_parameters.getParameter<string>("oracleDB");
504  string pathCondDB = m_parameters.getParameter<string>("pathCondDB");
505 
506  // Connecting to OMDS
507  L1TOMDSHelper myOMDSHelper = L1TOMDSHelper();
508  int conError;
509  myOMDSHelper.connect(oracleDB,pathCondDB,conError);
510 
511  if(conError == L1TOMDSHelper::NO_ERROR){
512 
513  if(m_verbose){cout << "[L1TBPTX] Connected to DB with no error." << endl;}
514 
515  int errorRetrive;
516  m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrive);
517 
518  if(errorRetrive == L1TOMDSHelper::NO_ERROR){
519  if(m_verbose){
520  cout << "[L1TBPTX] Retriving LHC Bunch Structure: NO_ERROR" << endl;
521  cout << "[L1TSync] -> LHC Bunch Structure valid=" << m_beamConfig.m_valid << " nBunches=" << m_beamConfig.nCollidingBunches << endl;
522  }
523  }
524  else if(errorRetrive == L1TOMDSHelper::WARNING_DB_QUERY_FAILED){
525  if(m_verbose){cout << "[L1TBPTX] Retriving LHC Bunch Structure: WARNING_DB_QUERY_FAILED" << endl;}
526 
527  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_QUERY_FAILED);
528  eCount++;
529  m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_QUERY_FAILED,eCount);
530  }
531  else if(errorRetrive == L1TOMDSHelper::WARNING_DB_INCORRECT_NBUNCHES){
532  if(m_verbose){cout << "[L1TBPTX] Retriving LHC Bunch Structure: WARNING_DB_INCORRECT_NBUNCHES" << endl;}
533 
534  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_INCORRECT_NBUNCHES);
535  eCount++;
536  m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_INCORRECT_NBUNCHES,eCount);
537  }
538  else{
539  if(m_verbose){cout << "[L1TBPTX] Retriving LHC Bunch Structure: UNKNOWN" << endl;}
540  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(UNKNOWN);
541  eCount++;
542  m_ErrorMonitor->getTH1()->SetBinContent(UNKNOWN,eCount);
543  }
544 
545  }
546  else if(conError == L1TOMDSHelper::WARNING_DB_CONN_FAILED){
547  if(m_verbose){cout << "[L1TBPTX] Connection to DB: WARNING_DB_CONN_FAILED" << endl;}
548  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_DB_CONN_FAILED);
549  eCount++;
550  m_ErrorMonitor->getTH1()->SetBinContent(WARNING_DB_CONN_FAILED,eCount);
551  }
552  else{
553  if(m_verbose){cout << "[L1TBPTX] Connection to DB: UNKNOWN" << endl;}
554  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(UNKNOWN);
555  eCount++;
556  m_ErrorMonitor->getTH1()->SetBinContent(UNKNOWN,eCount);
557  }
558 }
T getParameter(std::string const &) const
unsigned int m_lhcFill
Definition: L1TBPTX.h:155
BeamConfiguration m_beamConfig
Definition: L1TBPTX.h:158
bool m_verbose
Definition: L1TBPTX.h:140
edm::ParameterSet m_parameters
Definition: L1TBPTX.h:134
TH1 * getTH1(void) const
tuple cout
Definition: gather_cfg.py:121
MonitorElement * m_ErrorMonitor
Definition: L1TBPTX.h:181

Member Data Documentation

DQMStore* L1TBPTX::dbe
private

Definition at line 132 of file L1TBPTX.h.

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

Definition at line 167 of file L1TBPTX.h.

BeamConfiguration L1TBPTX::m_beamConfig
private

Definition at line 158 of file L1TBPTX.h.

unsigned int L1TBPTX::m_currentGTLS
private

Definition at line 153 of file L1TBPTX.h.

unsigned int L1TBPTX::m_currentLS
private

Definition at line 152 of file L1TBPTX.h.

bool L1TBPTX::m_currentLSValid
private

Definition at line 141 of file L1TBPTX.h.

int L1TBPTX::m_currentPrescalesIndex
private

Definition at line 151 of file L1TBPTX.h.

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

Definition at line 146 of file L1TBPTX.h.

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

Definition at line 145 of file L1TBPTX.h.

MonitorElement* L1TBPTX::m_ErrorMonitor
private

Definition at line 181 of file L1TBPTX.h.

edm::InputTag L1TBPTX::m_l1GtDataDaqInputTag
private

Definition at line 186 of file L1TBPTX.h.

edm::InputTag L1TBPTX::m_l1GtEvmSource
private

Definition at line 185 of file L1TBPTX.h.

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

Definition at line 178 of file L1TBPTX.h.

unsigned int L1TBPTX::m_lhcFill
private

Definition at line 155 of file L1TBPTX.h.

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

Definition at line 171 of file L1TBPTX.h.

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

Definition at line 172 of file L1TBPTX.h.

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

Definition at line 177 of file L1TBPTX.h.

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

Definition at line 173 of file L1TBPTX.h.

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

Definition at line 174 of file L1TBPTX.h.

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

Definition at line 148 of file L1TBPTX.h.

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

Definition at line 147 of file L1TBPTX.h.

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

Definition at line 135 of file L1TBPTX.h.

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

Definition at line 136 of file L1TBPTX.h.

std::string L1TBPTX::m_outputFile
private

Definition at line 137 of file L1TBPTX.h.

edm::ParameterSet L1TBPTX::m_parameters
private

Definition at line 134 of file L1TBPTX.h.

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

Definition at line 163 of file L1TBPTX.h.

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

Definition at line 164 of file L1TBPTX.h.

bool* L1TBPTX::m_processedLS
private

Definition at line 142 of file L1TBPTX.h.

int L1TBPTX::m_refPrescaleSet
private

Definition at line 150 of file L1TBPTX.h.

edm::InputTag L1TBPTX::m_scalersSource
private

Definition at line 184 of file L1TBPTX.h.

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

Definition at line 159 of file L1TBPTX.h.

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

Definition at line 160 of file L1TBPTX.h.

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

Definition at line 168 of file L1TBPTX.h.

bool L1TBPTX::m_verbose
private

Definition at line 140 of file L1TBPTX.h.