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
L1TSync Class Reference

#include <L1TSync.h>

Inheritance diagram for L1TSync:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Types

enum  BeamMode {
  NOMODE =1, SETUP =2, INJPILOT =3, INJINTR =4,
  INJNOMN =5, PRERAMP =6, RAMP =7, FLATTOP =8,
  QUEEZE =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::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 L1TSync (const edm::ParameterSet &ps)
 
virtual ~L1TSync ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
virtual void bookHistograms (DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 BeginRun. More...
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
 
- 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

const std::vector< std::vector
< int > > * 
ListsPrescaleFactors
 
std::map< std::string, bool > m_algoAutoSelect
 
std::map< TString, int > m_algoBit
 
std::map< TString,
MonitorElement * > 
m_algoCertification
 
std::map< TString,
MonitorElement * > 
m_algoVsBunchStructure
 
BeamConfiguration m_beamConfig
 
std::map< TString, unsigned int > m_certFirstLS
 
std::map< TString, unsigned int > m_certLastLS
 
unsigned int m_currentLS
 
bool m_currentLSValid
 
MonitorElementm_ErrorMonitor
 
edm::EDGetTokenT
< L1GlobalTriggerReadoutRecord
m_l1GtDataDaqInputTag
 
edm::EDGetTokenT
< L1GlobalTriggerEvmReadoutRecord
m_l1GtEvmSource
 
L1GtUtils m_l1GtUtils
 
unsigned int m_lhcFill
 
std::string m_outputFile
 
edm::ParameterSet m_parameters
 
bool * m_processedLS
 
int m_refPrescaleSet
 
std::map< std::string,
std::string > 
m_selectedTriggers
 
bool m_verbose
 

Additional Inherited Members

- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Definition at line 47 of file L1TSync.h.

Member Enumeration Documentation

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

Definition at line 51 of file L1TSync.h.

51  {
52  NOMODE=1,
53  SETUP=2,
54  INJPILOT=3,
55  INJINTR=4,
56  INJNOMN=5,
57  PRERAMP=6,
58  RAMP=7,
59  FLATTOP=8,
60  QUEEZE=9,
61  ADJUST=10,
62  STABLE=11,
63  UNSTABLE=12,
64  BEAMDUMP=13,
65  RAMPDOWN=14,
66  RECOVERY=15,
67  INJDUMP=16,
68  CIRCDUMP=17,
69  ABORT=18,
70  CYCLING=19,
71  WBDUMP=20,
72  NOBEAM=21
73  };
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 75 of file L1TSync.h.

Constructor & Destructor Documentation

L1TSync::L1TSync ( const edm::ParameterSet ps)

Definition at line 40 of file L1TSync.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_algoAutoSelect, m_l1GtDataDaqInputTag, m_l1GtEvmSource, m_outputFile, m_parameters, m_refPrescaleSet, m_selectedTriggers, m_verbose, and AlCaHLTBitMon_QueryRunRegistry::string.

40  :
41  m_l1GtUtils(pset, consumesCollector(), false, *this){
42 
43  m_parameters = pset;
44 
45  // Mapping parameter input variables
46  m_l1GtDataDaqInputTag = consumes<L1GlobalTriggerReadoutRecord>(pset.getParameter <InputTag>("inputTagL1GtDataDaq"));
47  m_l1GtEvmSource = consumes<L1GlobalTriggerEvmReadoutRecord>(pset.getParameter <InputTag>("inputTagtEvmSource"));
48  m_verbose = pset.getUntrackedParameter<bool> ("verbose",false);
49  m_refPrescaleSet = pset.getParameter <int> ("refPrescaleSet");
50 
51  // Getting which categories to monitor
52  ParameterSet Categories = pset.getParameter< ParameterSet >("Categories");
53 
54  bool forceGlobalParameters = Categories.getParameter<bool>("forceGlobalParameters");
55  bool doGlobalAutoSelection = Categories.getParameter<bool>("doGlobalAutoSelection");
56 
57  ParameterSet CatBPTX = Categories.getParameter<ParameterSet>("BPTX");
58  ParameterSet CatMu = Categories.getParameter<ParameterSet>("Mu");
59  ParameterSet CatEG = Categories.getParameter<ParameterSet>("EG");
60  ParameterSet CatIsoEG = Categories.getParameter<ParameterSet>("IsoEG");
61  ParameterSet CatJet = Categories.getParameter<ParameterSet>("Jet");
62  ParameterSet CatCenJet = Categories.getParameter<ParameterSet>("CenJet");
63  ParameterSet CatForJet = Categories.getParameter<ParameterSet>("ForJet");
64  ParameterSet CatTauJet = Categories.getParameter<ParameterSet>("TauJet");
65  ParameterSet CatETM = Categories.getParameter<ParameterSet>("ETT");
66  ParameterSet CatETT = Categories.getParameter<ParameterSet>("ETM");
67  ParameterSet CatHTT = Categories.getParameter<ParameterSet>("HTT");
68  ParameterSet CatHTM = Categories.getParameter<ParameterSet>("HTM");
69 
70  // --> Setting parameters related to which algos to monitor
71  // If global parameters are forced they take precedence over algo-by-algo parameters
72  if(forceGlobalParameters){
73 
74  // If global automatic selection if enable all categories set to be monitored will have
75  // their algos auto selected (the lowest prescale algo will be selected)
76  if(doGlobalAutoSelection){
77 
78  if(CatMu .getParameter<bool>("monitor")){m_algoAutoSelect["Mu"] = true;}else{m_algoAutoSelect["Mu"] = false;}
79  if(CatEG .getParameter<bool>("monitor")){m_algoAutoSelect["EG"] = true;}else{m_algoAutoSelect["EG"] = false;}
80  if(CatIsoEG .getParameter<bool>("monitor")){m_algoAutoSelect["IsoEG"] = true;}else{m_algoAutoSelect["IsoEG"] = false;}
81  if(CatJet .getParameter<bool>("monitor")){m_algoAutoSelect["Jet"] = true;}else{m_algoAutoSelect["Jet"] = false;}
82  if(CatCenJet.getParameter<bool>("monitor")){m_algoAutoSelect["CenJet"] = true;}else{m_algoAutoSelect["CenJet"] = false;}
83  if(CatForJet.getParameter<bool>("monitor")){m_algoAutoSelect["ForJet"] = true;}else{m_algoAutoSelect["ForJet"] = false;}
84  if(CatTauJet.getParameter<bool>("monitor")){m_algoAutoSelect["TauJet"] = true;}else{m_algoAutoSelect["TauJet"] = false;}
85  if(CatETM .getParameter<bool>("monitor")){m_algoAutoSelect["ETM"] = true;}else{m_algoAutoSelect["ETM"] = false;}
86  if(CatETT .getParameter<bool>("monitor")){m_algoAutoSelect["ETT"] = true;}else{m_algoAutoSelect["ETT"] = false;}
87  if(CatHTM .getParameter<bool>("monitor")){m_algoAutoSelect["HTM"] = true;}else{m_algoAutoSelect["HTM"] = false;}
88  if(CatHTT .getParameter<bool>("monitor")){m_algoAutoSelect["HTT"] = true;}else{m_algoAutoSelect["HTT"] = false;}
89 
90  // If global non-automatic selection is enable all categories set to be monitored will use
91  // user defined algos
92  }else{
93 
94  m_algoAutoSelect["Mu"] = false;
95  m_algoAutoSelect["EG"] = false;
96  m_algoAutoSelect["IsoEG"] = false;
97  m_algoAutoSelect["Jet"] = false;
98  m_algoAutoSelect["CenJet"] = false;
99  m_algoAutoSelect["ForJet"] = false;
100  m_algoAutoSelect["TauJet"] = false;
101  m_algoAutoSelect["ETM"] = false;
102  m_algoAutoSelect["ETT"] = false;
103  m_algoAutoSelect["HTM"] = false;
104  m_algoAutoSelect["HTT"] = false;
105 
106  if(CatMu .getParameter<bool>("monitor")){m_selectedTriggers["Mu"] = CatMu .getParameter<string>("algo");}
107  if(CatEG .getParameter<bool>("monitor")){m_selectedTriggers["EG"] = CatEG .getParameter<string>("algo");}
108  if(CatIsoEG .getParameter<bool>("monitor")){m_selectedTriggers["IsoEG"] = CatIsoEG .getParameter<string>("algo");}
109  if(CatJet .getParameter<bool>("monitor")){m_selectedTriggers["Jet"] = CatJet .getParameter<string>("algo");}
110  if(CatCenJet.getParameter<bool>("monitor")){m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");}
111  if(CatForJet.getParameter<bool>("monitor")){m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");}
112  if(CatTauJet.getParameter<bool>("monitor")){m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");}
113  if(CatETM .getParameter<bool>("monitor")){m_selectedTriggers["ETM"] = CatETM .getParameter<string>("algo");}
114  if(CatETT .getParameter<bool>("monitor")){m_selectedTriggers["ETT"] = CatETT .getParameter<string>("algo");}
115  if(CatHTM .getParameter<bool>("monitor")){m_selectedTriggers["HTM"] = CatHTM .getParameter<string>("algo");}
116  if(CatHTT .getParameter<bool>("monitor")){m_selectedTriggers["HTT"] = CatHTT .getParameter<string>("algo");}
117 
118  }
119 
120  // If we are using algo-by-algo parametes we get them and set what is needed
121  }else{
122 
123  if(CatBPTX.getParameter<bool>("monitor")){
124  m_selectedTriggers["BPTX"] = CatBPTX.getParameter<string>("algo");
125  }
126 
127  if(CatMu.getParameter<bool>("monitor")){
128  m_algoAutoSelect["Mu"] = CatMu.getParameter<bool>("doAutoSelection");
129  if(!m_algoAutoSelect["Mu"]){m_selectedTriggers["Mu"] = CatMu.getParameter<string>("algo");}
130  }else{m_algoAutoSelect["Mu"] = false;}
131 
132  if(CatEG.getParameter<bool>("monitor")){
133  m_algoAutoSelect["EG"] = CatEG.getParameter<bool>("doAutoSelection");
134  if(!m_algoAutoSelect["EG"]){m_selectedTriggers["EG"] = CatEG.getParameter<string>("algo");}
135  }else{m_algoAutoSelect["EG"] = false;}
136 
137  if(CatIsoEG.getParameter<bool>("monitor")){
138  m_algoAutoSelect["IsoEG"] = CatIsoEG.getParameter<bool>("doAutoSelection");
139  if(!m_algoAutoSelect["IsoEG"]){m_selectedTriggers["IsoEG"] = CatIsoEG.getParameter<string>("algo");}
140  }else{m_algoAutoSelect["IsoEG"] = false;}
141 
142  if(CatJet.getParameter<bool>("monitor")){
143  m_algoAutoSelect["Jet"] = CatJet.getParameter<bool>("doAutoSelection");
144  if(!m_algoAutoSelect["Jet"]){m_selectedTriggers["Jet"] = CatJet.getParameter<string>("algo");}
145  }else{m_algoAutoSelect["Jet"] = false;}
146 
147  if(CatCenJet.getParameter<bool>("monitor")){
148  m_algoAutoSelect["CenJet"] = CatCenJet.getParameter<bool>("doAutoSelection");
149  if(!m_algoAutoSelect["CenJet"]){m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");}
150  }else{m_algoAutoSelect["CenJet"] = false;}
151 
152  if(CatForJet.getParameter<bool>("monitor")){
153  m_algoAutoSelect["CatForJet"] = CatForJet.getParameter<bool>("doAutoSelection");
154  if(!m_algoAutoSelect["CatForJet"]){m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");}
155  }else{m_algoAutoSelect["CatForJet"] = false;}
156 
157  if(CatTauJet.getParameter<bool>("monitor")){
158  m_algoAutoSelect["TauJet"] = CatTauJet.getParameter<bool>("doAutoSelection");
159  if(!m_algoAutoSelect["TauJet"]){m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");}
160  }else{m_algoAutoSelect["TauJet"] = false;}
161 
162  if(CatETM.getParameter<bool>("monitor")){
163  m_algoAutoSelect["ETM"] = CatETM.getParameter<bool>("doAutoSelection");
164  if(!m_algoAutoSelect["ETM"]){m_selectedTriggers["ETM"] = CatETM.getParameter<string>("algo");}
165  }else{m_algoAutoSelect["ETM"] = false;}
166 
167  if(CatETT.getParameter<bool>("monitor")){
168  m_algoAutoSelect["ETT"] = CatETT.getParameter<bool>("doAutoSelection");
169  if(!m_algoAutoSelect["ETT"]){m_selectedTriggers["ETT"] = CatETT.getParameter<string>("algo");}
170  }else{m_algoAutoSelect["ETT"] = false;}
171 
172  if(CatHTM.getParameter<bool>("monitor")){
173  m_algoAutoSelect["HTM"] = CatHTM.getParameter<bool>("doAutoSelection");
174  if(!m_algoAutoSelect["HTM"]){m_selectedTriggers["HTM"] = CatHTM.getParameter<string>("algo");}
175  }else{m_algoAutoSelect["HTM"] = false;}
176 
177  if(CatHTT.getParameter<bool>("monitor")){
178  m_algoAutoSelect["HTT"] = CatHTT.getParameter<bool>("doAutoSelection");
179  if(!m_algoAutoSelect["HTT"]){m_selectedTriggers["HTT"] = CatHTT.getParameter<string>("algo");}
180  }else{m_algoAutoSelect["HTT"] = false;}
181 
182  }
183 
184 
185  m_outputFile = pset.getUntrackedParameter < std::string > ("outputFile","");
186 
187  if (m_outputFile.size() != 0) {
188  std::cout << "L1T Monitoring histograms will be saved to " << m_outputFile.c_str() << std::endl;
189  }
190 
191  bool disable = pset.getUntrackedParameter < bool > ("disableROOToutput", false);
192  if (disable) {m_outputFile = "";}
193 
194 }
T getParameter(std::string const &) const
int m_refPrescaleSet
Definition: L1TSync.h:121
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:139
bool m_verbose
Definition: L1TSync.h:116
std::string m_outputFile
Definition: L1TSync.h:113
std::map< std::string, bool > m_algoAutoSelect
Definition: L1TSync.h:138
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TSync.h:146
edm::ParameterSet m_parameters
Definition: L1TSync.h:111
L1GtUtils m_l1GtUtils
Definition: L1TSync.h:148
tuple cout
Definition: gather_cfg.py:121
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TSync.h:145
L1TSync::~L1TSync ( )
virtual

Definition at line 198 of file L1TSync.cc.

198 {}

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 384 of file L1TSync.cc.

References a, funct::abs(), BeamConfiguration::beam1, BeamConfiguration::beam2, L1GtfeExtWord::beamMode(), BeamConfiguration::bxConfig(), gather_cfg::cout, ERROR_UNABLE_RETRIVE_PRODUCT, getBeamConfOMDS(), edm::Event::getByToken(), MonitorElement::getTH1(), i, BeamConfiguration::isValid(), edm::HandleBase::isValid(), L1GtfeExtWord::lhcFillNumber(), m_algoBit, m_algoVsBunchStructure, m_beamConfig, m_currentLS, m_currentLSValid, m_ErrorMonitor, m_l1GtDataDaqInputTag, m_l1GtEvmSource, m_lhcFill, m_selectedTriggers, m_verbose, and STABLE.

384  {
385 
386  if(m_verbose){cout << "[L1TSync] Called analyze." << endl;}
387 
388  // We only start analyzing if current LS is still valid
389  if(m_currentLSValid){
390 
391  if(m_verbose){cout << "[L1TSync] -> m_currentLSValid=" << m_currentLSValid << endl;}
392 
393  // Retriving information from GT
395  iEvent.getByToken(m_l1GtEvmSource, gtEvmReadoutRecord);
396 
397  // Determining beam mode and fill number
398  if(gtEvmReadoutRecord.isValid()){
399 
400  const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
401  unsigned int lhcBeamMode = gtfeEvmWord.beamMode(); // Updating beam mode
402 
403  if(m_lhcFill == 0){
404  m_lhcFill = gtfeEvmWord.lhcFillNumber(); // Getting LHC Fill Number from GT
405  getBeamConfOMDS(); // Getting Beam Configuration from OMDS
406  }
407 
408  if(lhcBeamMode != STABLE){m_currentLSValid = false;} // If Beams are not stable we invalidate this LS
409 
410  }else{
411  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
412  eCount++;
413  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
414  }
415  }else{
416  if(m_verbose){cout << "[L1TSync] -> m_currentLSValid=" << m_currentLSValid << endl;}
417  }
418 
419  //------------------------------------------------------------------------------
420  // If current LS is valid and Beam Configuration is Valid we analyse this event
421  //------------------------------------------------------------------------------
423 
424  // Getting Final Decision Logic (FDL) Data from GT
425  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
426  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
427 
428  if(gtReadoutRecordData.isValid()){
429 
430  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
431 
432  // Running over selected triggers
433  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
434 
435  string tTrigger = (*i).second;
436 
437  // Analyse only defined triggers
438  if(tTrigger != "Undefined" && tTrigger != "Undefined (Wrong Name)"){
439 
440  bool beamSingleConfig = false; // Single beam configured for this event
441  bool firedAlgo = false; // Algo fired in this event
442  int eventBx = -1;
443 
444  // Running over FDL results to get which bits fired
445  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
446 
447  // Selecting the FDL that triggered
448  if(gtFdlVectorData[a].bxInEvent() == 0){
449  eventBx = gtFdlVectorData[a].localBxNr();
450  if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[tTrigger] ]){firedAlgo = true;}
451  }
452  }
453 
454  // Checking beam configuration
455  if( m_beamConfig.beam1[eventBx] && !m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
456  if(!m_beamConfig.beam1[eventBx] && m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
457 
458  // Analyse only if this trigger fired in this event
459  // NOTE: Veto cases where a single beam is configured since
460  // for this cases this could be a real-satelite bunch collision
461  // -> Calculate the minimum bx diference between this event and a configured bx
462  if(firedAlgo && !beamSingleConfig){
463 
464  int DifAlgoVsBunchStructure = 9999; // Majorated
465 
466  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
467 
468  int bxFDL = gtFdlVectorData[a].localBxNr();
469  int bxInEvent = gtFdlVectorData[a].bxInEvent();
470 
471  if(m_beamConfig.bxConfig(bxFDL) && abs(bxInEvent)<abs(DifAlgoVsBunchStructure)){
472  DifAlgoVsBunchStructure = -1*bxInEvent;
473  }
474  }
475 
476  m_algoVsBunchStructure[tTrigger]->Fill(m_currentLS,DifAlgoVsBunchStructure);
477 
478  }
479  }
480  }
481  }
482  else{
483  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
484  eCount++;
485  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
486  }
487 
488  }
489 }
int i
Definition: DBlmapReader.cc:9
unsigned int m_lhcFill
Definition: L1TSync.h:124
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:139
BeamConfiguration m_beamConfig
Definition: L1TSync.h:127
bool m_verbose
Definition: L1TSync.h:116
int iEvent
Definition: GenABIO.cc:230
std::map< TString, MonitorElement * > m_algoVsBunchStructure
Definition: L1TSync.h:137
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TH1 * getTH1(void) const
bool bxConfig(int iBx)
Definition: L1TOMDSHelper.h:28
bool isValid() const
Definition: HandleBase.h:75
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TSync.h:146
const cms_uint32_t lhcFillNumber() const
void getBeamConfOMDS()
Definition: L1TSync.cc:496
bool m_currentLSValid
Definition: L1TSync.h:117
double a
Definition: hdecay.h:121
std::vector< bool > beam2
Definition: L1TOMDSHelper.h:38
tuple cout
Definition: gather_cfg.py:121
MonitorElement * m_ErrorMonitor
Definition: L1TSync.h:142
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TSync.h:145
std::map< TString, int > m_algoBit
Definition: L1TSync.h:133
std::vector< bool > beam1
Definition: L1TOMDSHelper.h:37
const cms_uint16_t beamMode() const
unsigned int m_currentLS
Definition: L1TSync.h:122
void L1TSync::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 283 of file L1TSync.cc.

References gather_cfg::cout, doFractionInSync(), i, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), m_certFirstLS, m_currentLS, m_currentLSValid, m_selectedTriggers, and m_verbose.

283  {
284 
285  if (m_verbose){cout << "[L1TSync] Called beginLuminosityBlock." << endl;}
286 
287  // If this LS is not the next to last one force closing of current LS blocks
288  // for certification
289  if(m_currentLS !=0 && m_currentLS+1 != lumiBlock.id().luminosityBlock()){
290 
291  if (m_verbose){
292  cout << "[L1TSync] None consecutive: doFractionInSync() - LAST="
293  << m_currentLS << " CURRENT=" << lumiBlock.id().luminosityBlock() << endl;
294  }
295  doFractionInSync(true,false);
296  }
297 
298  // Updating current LS number
299  m_currentLS = lumiBlock.id().luminosityBlock();
300 
301  // If this is the fist valid LS update first LS for certification
302  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
303 
304  string theTriggerAlias = (*i).second;
305  if(m_certFirstLS[theTriggerAlias]==0){m_certFirstLS[theTriggerAlias] = m_currentLS;}
306 
307  }
308 
309  // A LS will be valid if:
310  // * BeamMode == STABLE for all events monitored
311  m_currentLSValid = true;
312 
313 }
int i
Definition: DBlmapReader.cc:9
void doFractionInSync(bool iForce=false, bool iBad=false)
Definition: L1TSync.cc:576
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:139
std::map< TString, unsigned int > m_certFirstLS
Definition: L1TSync.h:134
bool m_verbose
Definition: L1TSync.h:116
bool m_currentLSValid
Definition: L1TSync.h:117
tuple cout
Definition: gather_cfg.py:121
unsigned int m_currentLS
Definition: L1TSync.h:122
void L1TSync::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 208 of file L1TSync.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), ERROR_LSBLOCK_NOTVALID, ERROR_TRIGGERALIAS_NOTVALID, ERROR_UNABLE_RETRIVE_PRODUCT, edm::EventSetup::get(), L1TMenuHelper::getLUSOTrigger(), L1GtTriggerMenu::gtAlgorithmAliasMap(), i, m_algoAutoSelect, m_algoBit, m_algoCertification, m_algoVsBunchStructure, m_certFirstLS, m_certLastLS, m_currentLS, m_ErrorMonitor, m_l1GtUtils, m_lhcFill, m_refPrescaleSet, m_selectedTriggers, relval_steps::menu, edm::ESHandle< class >::product(), L1GtUtils::retrieveL1EventSetup(), MonitorElement::setBinLabel(), DQMStore::IBooker::setCurrentFolder(), L1TMenuHelper::testAlgos(), UNKNOWN, WARNING_DB_CONN_FAILED, WARNING_DB_INCORRECT_NBUNCHES, and WARNING_DB_QUERY_FAILED.

208  {
209 
210  // Initializing variables
211  int maxNbins = 2501;
212 
213  // Reseting run dependent variables
214  m_lhcFill = 0;
215  m_currentLS = 0;
216  m_certFirstLS.clear();
217  m_certLastLS .clear();
218 
219  // Getting Trigger menu from GT
221  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd);
222  const L1GtTriggerMenu* menu = menuRcd.product();
223 
224  // Filling Alias-Bit Map
225  for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo!=menu->gtAlgorithmAliasMap().end(); ++algo){
226  m_algoBit[(algo->second).algoAlias()] = (algo->second).algoBitNumber();
227  }
228 
229  // Getting fill number for this run
230  //Handle<ConditionsInRunBlock> runConditions;
231  //iRun.getByType(runConditions);
232  //int lhcFillNumber = runConditions->lhcFillNumber;
233 
234  //ESHandle<L1GtPrescaleFactors> l1GtPfAlgo;
235  //iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
236  //const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
237 
238  L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup);
239 
241 
243  map<string,string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect, m_refPrescaleSet, m_l1GtUtils);
244  m_selectedTriggers.insert(tAutoSelTrig.begin(),tAutoSelTrig.end());
245 
246  // Initializing DQM Monitor Elements
247  ibooker.setCurrentFolder("L1T/L1TSync");
248  m_ErrorMonitor = ibooker.book1D("ErrorMonitor","ErrorMonitor",7,0,7);
249  m_ErrorMonitor->setBinLabel(UNKNOWN ,"UNKNOWN");
250  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED ,"WARNING_DB_CONN_FAILED"); // Errors from L1TOMDSHelper
251  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED ,"WARNING_DB_QUERY_FAILED"); // Errors from L1TOMDSHelper
252  m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,"WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
253  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT ,"ERROR_UNABLE_RETRIVE_PRODUCT");
254  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID ,"ERROR_TRIGGERALIAS_NOTVALID");
255  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID ,"ERROR_LSBLOCK_NOTVALID");
256 
257  // Looping over selected triggers
258  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
259 
260  string tCategory = (*i).first;
261  string tTrigger = (*i).second;
262 
263  // Initializing LS blocks for certification
264  m_certFirstLS[(*i).second] = 0;
265  m_certLastLS [(*i).second] = 0;
266 
267  // Initializing DQM Monitors
268  ibooker.setCurrentFolder("L1T/L1TSync/AlgoVsBunchStructure/");
269  m_algoVsBunchStructure[tTrigger] = ibooker.book2D(tCategory,"min #Delta("+tTrigger+",Bunch)",maxNbins,-0.5,double(maxNbins)-0.5,5,-2.5,2.5);
270  m_algoVsBunchStructure[tTrigger] ->setAxisTitle("Lumi Section" ,1);
271 
272  ibooker.setCurrentFolder("L1T/L1TSync/Certification/");
273  m_algoCertification[tTrigger] = ibooker.book1D(tCategory, "fraction of in sync: "+tTrigger,maxNbins,-0.5,double(maxNbins)-0.5);
274  m_algoCertification[tTrigger] ->setAxisTitle("Lumi Section" ,1);
275 
276  }
277 
278 }
int m_refPrescaleSet
Definition: L1TSync.h:121
int i
Definition: DBlmapReader.cc:9
std::map< TString, unsigned int > m_certLastLS
Definition: L1TSync.h:135
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_lhcFill
Definition: L1TSync.h:124
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:139
std::map< TString, unsigned int > m_certFirstLS
Definition: L1TSync.h:134
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
std::map< std::string, bool > m_algoAutoSelect
Definition: L1TSync.h:138
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
std::map< TString, MonitorElement * > m_algoVsBunchStructure
Definition: L1TSync.h:137
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
Definition: L1GtUtils.cc:121
std::map< std::string, std::string > testAlgos(const std::map< std::string, std::string > &)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
L1GtUtils m_l1GtUtils
Definition: L1TSync.h:148
MonitorElement * m_ErrorMonitor
Definition: L1TSync.h:142
std::map< TString, MonitorElement * > m_algoCertification
Definition: L1TSync.h:136
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
std::map< TString, int > m_algoBit
Definition: L1TSync.h:133
std::map< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors, L1GtUtils const &myUtils)
unsigned int m_currentLS
Definition: L1TSync.h:122
void L1TSync::certifyLSBlock ( std::string  iTrigger,
int  iInitLs,
int  iEndLs,
float  iValue 
)
private

Definition at line 687 of file L1TSync.cc.

References python.rootplot.utilities::ls(), and m_algoCertification.

Referenced by doFractionInSync().

687  {
688 
689  // Finding correct bins in the histogram for this block
690  int binInit = m_algoCertification[iTrigger]->getTH1()->FindBin(iInitLs);
691  int binEnd = m_algoCertification[iTrigger]->getTH1()->FindBin(iEndLs);
692 
693  for(int ls=binInit ; ls<=binEnd ; ls++){
694  m_algoCertification[iTrigger]->setBinContent(ls,iValue);
695  }
696 
697 }
std::map< TString, MonitorElement * > m_algoCertification
Definition: L1TSync.h:136
void L1TSync::doFractionInSync ( bool  iForce = false,
bool  iBad = false 
)
private

Definition at line 576 of file L1TSync.cc.

References a, certifyLSBlock(), gather_cfg::cout, ERROR_LSBLOCK_NOTVALID, ERROR_TRIGGERALIAS_NOTVALID, HLT_25ns14e33_v1_cff::fraction, edm::ParameterSet::getParameter(), MonitorElement::getTH1(), i, python.rootplot.utilities::ls(), m_algoVsBunchStructure, m_certFirstLS, m_certLastLS, m_ErrorMonitor, m_parameters, m_selectedTriggers, and m_verbose.

Referenced by beginLuminosityBlock(), and endLuminosityBlock().

576  {
577 
578  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
579 
580  string theCategory = (*i).first;
581  string theTriggerAlias = (*i).second;
582 
583  // Caching frequently used values from maps
584  unsigned int fLS = m_certFirstLS[theTriggerAlias];
585  unsigned int lLS = m_certLastLS [theTriggerAlias];
586 
587  // Checking validity of the trigger alias and of the LS block
588  bool triggerAlias_isValid = theTriggerAlias != "Undefined" && theTriggerAlias != "Undefined (Wrong Name)";
589  bool lsBlock_exists = !(fLS == 0 && lLS == 0);
590  bool lsBlock_isValid = fLS <= lLS && fLS > 0 && lLS > 0;
591 
592  if(triggerAlias_isValid && lsBlock_exists && lsBlock_isValid){
593 
594  // If we are forced to close blocks and mark them bad
595  if(iForce && iBad){
596  certifyLSBlock(theTriggerAlias,fLS,lLS,-1);
597  m_certFirstLS[theTriggerAlias] = 0;
598  m_certLastLS [theTriggerAlias] = 0;
599  }
600 
601  // If we are not forced to mark bad, we check if we have enough statistics
602  else{
603 
604  // Getting events with 0 bx difference between BPTX and Algo for current LS
605  double CountSync = 0;
606  double CountAll = 0;
607 
608  // Adding all entries for current LS block
609  for(unsigned int ls=fLS ; ls<=lLS ; ls++){
610 
611  CountSync += m_algoVsBunchStructure[theTriggerAlias]->getBinContent(ls+1,3);
612  for(int a=1 ; a<6 ; a++){
613  CountAll += m_algoVsBunchStructure[theTriggerAlias]->getBinContent(ls+1,a);
614  }
615  }
616 
617  if(m_verbose){
618  cout << "Alias = " << theTriggerAlias
619  << " InitLS=" << fLS
620  << " EndLS=" << lLS
621  << " Events=" << CountAll ;
622  }
623 
624  if(iForce ||
625  CountAll >= m_parameters.getParameter<ParameterSet>("Categories")
626  .getParameter<ParameterSet>(theCategory)
627  .getParameter<int>("CertMinEvents")){
628 
629  if(m_verbose){cout << " <--------------- Enough Statistics: ";}
630 
631 
632  // Calculating fraction of in time
633  double fraction = 0;
634  if(CountAll >0){fraction = CountSync/CountAll;}
635 
636  // This is to avoid having an entry equal to zero and thus
637  // disregarded by the automatic tests
638  if(fraction==0){fraction=0.000001;}
639 
640  certifyLSBlock(theTriggerAlias,fLS,lLS,fraction);
641  m_certFirstLS[theTriggerAlias] = 0;
642  m_certLastLS [theTriggerAlias] = 0;
643  }
644 
645  if(m_verbose){cout << endl;}
646 
647  }
648  }
649 
650  // A problem was found. We report it and set a not physical vale (-1) to the certification plot
651  else{
652 
653  // If trigger alias is not valid report it to m_ErrorMonitor
654  if(!triggerAlias_isValid){
655  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_TRIGGERALIAS_NOTVALID);
656  eCount++;
657  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_TRIGGERALIAS_NOTVALID,eCount);
658  certifyLSBlock(theTriggerAlias,fLS,lLS,-1);
659  m_certFirstLS[theTriggerAlias] = 0;
660  m_certLastLS [theTriggerAlias] = 0;
661  }
662 
663  // If LS Block is not valid report it to m_ErrorMonitor
664  if(lsBlock_exists && !lsBlock_isValid){
665  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_LSBLOCK_NOTVALID);
666  eCount++;
667  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_LSBLOCK_NOTVALID,eCount);
668  certifyLSBlock(theTriggerAlias,fLS,lLS,-1);
669  m_certFirstLS[theTriggerAlias] = 0;
670  m_certLastLS [theTriggerAlias] = 0;
671  }
672 
673  }
674  }
675 
676 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::map< TString, unsigned int > m_certLastLS
Definition: L1TSync.h:135
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:139
std::map< TString, unsigned int > m_certFirstLS
Definition: L1TSync.h:134
bool m_verbose
Definition: L1TSync.h:116
void certifyLSBlock(std::string iTrigger, int iInitLs, int iEndLs, float iValue)
Definition: L1TSync.cc:687
std::map< TString, MonitorElement * > m_algoVsBunchStructure
Definition: L1TSync.h:137
TH1 * getTH1(void) const
edm::ParameterSet m_parameters
Definition: L1TSync.h:111
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
MonitorElement * m_ErrorMonitor
Definition: L1TSync.h:142
void L1TSync::dqmBeginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
protectedvirtual

BeginRun.

Reimplemented from DQMEDAnalyzer.

Definition at line 203 of file L1TSync.cc.

References gather_cfg::cout, and m_verbose.

203  {
204  //
205  if (m_verbose){cout << "[L1TSync] Called beginRun." << endl;}
206 }
bool m_verbose
Definition: L1TSync.h:116
tuple cout
Definition: gather_cfg.py:121
void L1TSync::endLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
protectedvirtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 319 of file L1TSync.cc.

References gather_cfg::cout, doFractionInSync(), i, BeamConfiguration::isValid(), m_beamConfig, m_certFirstLS, m_certLastLS, m_currentLS, m_currentLSValid, m_selectedTriggers, and m_verbose.

319  {
320 
321  if(m_verbose){cout << "[L1TSync] Called endLuminosityBlock." << endl;}
322 
323  if(m_verbose){
324  cout << "[L1TSync] m_currentLSValid : " << m_currentLSValid << endl;
325  cout << "[L1TSync] m_beamConfig.isValid(): " << m_beamConfig.isValid() << endl;
326  }
327 
328  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
329 
330  // Update last LS for certification
331  string theTriggerAlias = (*i).second;
332  m_certLastLS[theTriggerAlias] = m_currentLS;
333 
334  }
335 
336  // If this LS is valid (i.e. all events recorded with stable beams)
338 
339  if(m_verbose){cout << "[L1TSync] Regular call: doFractionInSync()" << endl;}
340  doFractionInSync(false,false);
341 
342  }
343  // If this LS is not valid it can be in the following context:
344  // * We still hadn't stable beam (no need to certify nothing
345  // * Beam just got unstable or dumped (we may have a complete block of data do certify)
346  else{
347 
348  //-> First we close all blocks from certFirstLS[] to m_currentLS-1
349  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
350 
351  string theTriggerAlias = (*i).second;
352 
353  int fLs = m_certFirstLS[theTriggerAlias];
354  int lLS = m_certLastLS [theTriggerAlias];
355 
356  // If this is a single LS block we do nothing (in this step)
357  if(fLs == lLS){
358  m_certFirstLS[theTriggerAlias] = 0;
359  m_certLastLS [theTriggerAlias] = 0;
360  }
361  // If block is multi LS then we remove the current LS
362  else{
363  m_certLastLS [theTriggerAlias] = m_currentLS-1;
364  }
365 
366  }
367  doFractionInSync(true,false);
368 
369  //-> Second we mark this single LS bad for all triggers
370  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
371  string theTriggerAlias = (*i).second;
372  m_certFirstLS[theTriggerAlias] = m_currentLS;
373  m_certLastLS [theTriggerAlias] = m_currentLS;
374  }
375  doFractionInSync(true,true);
376 
377  if(m_verbose){cout << "[L1TSync] Error call: doFractionInSync()" << endl;}
378 
379  }
380 
381 }
int i
Definition: DBlmapReader.cc:9
std::map< TString, unsigned int > m_certLastLS
Definition: L1TSync.h:135
void doFractionInSync(bool iForce=false, bool iBad=false)
Definition: L1TSync.cc:576
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync.h:139
BeamConfiguration m_beamConfig
Definition: L1TSync.h:127
std::map< TString, unsigned int > m_certFirstLS
Definition: L1TSync.h:134
bool m_verbose
Definition: L1TSync.h:116
bool m_currentLSValid
Definition: L1TSync.h:117
tuple cout
Definition: gather_cfg.py:121
unsigned int m_currentLS
Definition: L1TSync.h:122
void L1TSync::getBeamConfOMDS ( )
private

Definition at line 496 of file L1TSync.cc.

References gather_cfg::cout, edm::ParameterSet::getParameter(), MonitorElement::getTH1(), m_beamConfig, m_ErrorMonitor, m_lhcFill, m_parameters, BeamConfiguration::m_valid, m_verbose, BeamConfiguration::nCollidingBunches, L1TOMDSHelper::NO_ERROR, UNKNOWN, L1TOMDSHelper::WARNING_DB_CONN_FAILED, WARNING_DB_CONN_FAILED, WARNING_DB_INCORRECT_NBUNCHES, L1TOMDSHelper::WARNING_DB_QUERY_FAILED, and WARNING_DB_QUERY_FAILED.

Referenced by analyze().

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

Member Data Documentation

const std::vector< std::vector<int> >* L1TSync::ListsPrescaleFactors
private

Definition at line 130 of file L1TSync.h.

std::map<std::string,bool> L1TSync::m_algoAutoSelect
private

Definition at line 138 of file L1TSync.h.

Referenced by bookHistograms(), and L1TSync().

std::map<TString,int> L1TSync::m_algoBit
private

Definition at line 133 of file L1TSync.h.

Referenced by analyze(), and bookHistograms().

std::map<TString,MonitorElement*> L1TSync::m_algoCertification
private

Definition at line 136 of file L1TSync.h.

Referenced by bookHistograms(), and certifyLSBlock().

std::map<TString,MonitorElement*> L1TSync::m_algoVsBunchStructure
private

Definition at line 137 of file L1TSync.h.

Referenced by analyze(), bookHistograms(), and doFractionInSync().

BeamConfiguration L1TSync::m_beamConfig
private

Definition at line 127 of file L1TSync.h.

Referenced by analyze(), endLuminosityBlock(), and getBeamConfOMDS().

std::map<TString,unsigned int> L1TSync::m_certFirstLS
private
std::map<TString,unsigned int> L1TSync::m_certLastLS
private

Definition at line 135 of file L1TSync.h.

Referenced by bookHistograms(), doFractionInSync(), and endLuminosityBlock().

unsigned int L1TSync::m_currentLS
private

Definition at line 122 of file L1TSync.h.

Referenced by analyze(), beginLuminosityBlock(), bookHistograms(), and endLuminosityBlock().

bool L1TSync::m_currentLSValid
private

Definition at line 117 of file L1TSync.h.

Referenced by analyze(), beginLuminosityBlock(), and endLuminosityBlock().

MonitorElement* L1TSync::m_ErrorMonitor
private

Definition at line 142 of file L1TSync.h.

Referenced by analyze(), bookHistograms(), doFractionInSync(), and getBeamConfOMDS().

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

Definition at line 146 of file L1TSync.h.

Referenced by analyze(), and L1TSync().

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

Definition at line 145 of file L1TSync.h.

Referenced by analyze(), and L1TSync().

L1GtUtils L1TSync::m_l1GtUtils
private

Definition at line 148 of file L1TSync.h.

Referenced by bookHistograms().

unsigned int L1TSync::m_lhcFill
private

Definition at line 124 of file L1TSync.h.

Referenced by analyze(), bookHistograms(), and getBeamConfOMDS().

std::string L1TSync::m_outputFile
private

Definition at line 113 of file L1TSync.h.

Referenced by L1TSync().

edm::ParameterSet L1TSync::m_parameters
private

Definition at line 111 of file L1TSync.h.

Referenced by doFractionInSync(), getBeamConfOMDS(), and L1TSync().

bool* L1TSync::m_processedLS
private

Definition at line 118 of file L1TSync.h.

int L1TSync::m_refPrescaleSet
private

Definition at line 121 of file L1TSync.h.

Referenced by bookHistograms(), and L1TSync().

std::map<std::string,std::string> L1TSync::m_selectedTriggers
private
bool L1TSync::m_verbose
private