CMS 3D CMS Logo

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

#include <L1TSync_Offline.h>

Inheritance diagram for L1TSync_Offline:
one::DQMEDAnalyzer< edm::LuminosityBlockCache< ltso::LSValid > > one::dqmimplementation::DQMBaseClass< T... >

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 Member Functions

 L1TSync_Offline (const edm::ParameterSet &ps)
 
 ~L1TSync_Offline () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< edm::LuminosityBlockCache< ltso::LSValid > >
 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 bookHistograms (DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
 BeginRun. More...
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
std::shared_ptr< ltso::LSValidglobalBeginLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) const final
 
void globalEndLuminosityBlock (edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) final
 

Private Member Functions

void getBeamConfOffline (const edm::Event &)
 

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
 
L1TBeamConfiguration m_beamConfig
 
std::map< TString, unsigned int > m_certFirstLS
 
std::map< TString, unsigned int > m_certLastLS
 
MonitorElementm_ErrorMonitor
 
edm::EDGetTokenT< L1GlobalTriggerReadoutRecordm_l1GtDataDaqInputTag
 
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecordm_l1GtEvmSource
 
L1GtUtils m_l1GtUtils
 
unsigned int m_lhcFill
 
edm::ParameterSet m_parameters
 
int m_refPrescaleSet
 
std::map< std::string, std::string > m_selectedTriggers
 
bool m_verbose
 

Detailed Description

Description: offline DQM module for L1Trigger/bunchStructure synchronization

Implementation: <TODO: enter implementation details>

Author
: Pietro Vischia - LIP Lisbon pietr.nosp@m.o.vi.nosp@m.schia.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Changelog: 2012/08/10 11:01:01: First creation. Dummy module with actual code commented.

Todo:

Definition at line 68 of file L1TSync_Offline.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 72 of file L1TSync_Offline.h.

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

Constructor & Destructor Documentation

L1TSync_Offline::L1TSync_Offline ( const edm::ParameterSet ps)

Definition at line 61 of file L1TSync_Offline.cc.

References TagProbeFitTreeAnalyzer_cfi::Categories, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_algoAutoSelect, m_l1GtDataDaqInputTag, m_l1GtEvmSource, m_parameters, m_refPrescaleSet, m_selectedTriggers, m_verbose, and muonDTDigis_cfi::pset.

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

Definition at line 209 of file L1TSync_Offline.cc.

209 {}

Member Function Documentation

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

Definition at line 301 of file L1TSync_Offline.cc.

References a, funct::abs(), L1TBeamConfiguration::beam1, L1TBeamConfiguration::beam2, L1GtfeExtWord::beamMode(), L1TBeamConfiguration::bxConfig(), gather_cfg::cout, ERROR_UNABLE_RETRIVE_PRODUCT, getBeamConfOffline(), edm::Event::getByToken(), edm::Event::getLuminosityBlock(), MonitorElement::getTH1(), L1GlobalTriggerReadoutRecord::gtFdlVector(), L1GlobalTriggerEvmReadoutRecord::gtfeWord(), mps_fire::i, edm::LuminosityBlock::index(), L1TBeamConfiguration::isValid(), edm::HandleBase::isValid(), L1GtfeExtWord::lhcFillNumber(), m_algoBit, m_algoVsBunchStructure, m_beamConfig, m_ErrorMonitor, m_l1GtDataDaqInputTag, m_l1GtEvmSource, m_lhcFill, m_selectedTriggers, m_verbose, and STABLE.

301  {
302 
303 
304  if(m_verbose){cout << "[L1TSync_Offline] Called analyze." << endl;}
305 
306  // We only start analyzing if current LS is still valid
307  auto& currentLSValid = luminosityBlockCache(iEvent.getLuminosityBlock().index())->lsIsValid;
308  if(currentLSValid){
309 
310  if(m_verbose){cout << "[L1TSync_Offline] -> currentLSValid=" << currentLSValid << endl;}
311 
312  // Retriving information from GT
314  iEvent.getByToken(m_l1GtEvmSource, gtEvmReadoutRecord);
315 
316  // Determining beam mode and fill number
317  if(gtEvmReadoutRecord.isValid()){
318 
319  const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
320  unsigned int lhcBeamMode = gtfeEvmWord.beamMode(); // Updating beam mode
321 
322  if(m_lhcFill == 0){
323  m_lhcFill = gtfeEvmWord.lhcFillNumber(); // Getting LHC Fill Number from GT
324 
325  //I AM HERE
326  getBeamConfOffline(iEvent); // Getting Beam Configuration from OMDS
327  // no OMDS //
328  /* (Savannah ticket https://savannah.cern.ch/task/?31857 )
329  Purged the OMDS helper from the module, since apparently we don't have access to that information from Offline.
330  The comparison with the closest BPTX trigger will be performed via conditions objects which are being implemented by Joao Pela.
331  In the meantime, for being able to test the module, he suggested to pass the correct bunch structure by hand for the specific run which is run during the test.
332  The idea of the temporary fix is setting the vector variable that stores the bunch structure either by hand or filling it with the BPTX fires (that is check for the event the BX's where tech0 fired and set those as true in the vector.
333  */
334  // no OMDS // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve); Yuhuuu!!!OB asked Joao Pela how to fetch that
335 
336 
337 
338 
339  }
340 
341  if(lhcBeamMode != STABLE){currentLSValid = false;
342  if(m_verbose){cout << "[L1TSync_Offline] -> currentLSValid=" << currentLSValid << "because beams mode not stable, being " << lhcBeamMode << endl;}
343  } // If Beams are not stable we invalidate this LS
344  }else{
345  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
346  eCount++;
347  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
348  }
349  }else{
350  if(m_verbose){cout << "[L1TSync_Offline] -> currentLSValid=" << currentLSValid << endl;}
351  }
352 
353  // Commenting out un-necessary print outs (S.Dutta)
354  /* for(size_t l=0; l<m_beamConfig.beam1.size(); l++){
355  cout << "Beam 1: element " << l << " is in state " << m_beamConfig.beam1[l] << " --- Beam 2: element " << l << " is in state " << m_beamConfig.beam2[l] << endl;
356  }*/
357  //------------------------------------------------------------------------------
358  // If current LS is valid and Beam Configuration is Valid we analyse this event
359  //------------------------------------------------------------------------------
360  if(currentLSValid && m_beamConfig.isValid()){
361 
362  // Getting Final Decision Logic (FDL) Data from GT
363  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
364  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
365 
366  if(gtReadoutRecordData.isValid()){
367 
368  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
369 
370  // Running over selected triggers
371  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
372 
373  string tTrigger = (*i).second;
374 
375  // Analyse only defined triggers
376  if(tTrigger != "Undefined" && tTrigger != "Undefined (Wrong Name)"){
377 
378  bool beamSingleConfig = false; // Single beam configured for this event
379  bool firedAlgo = false; // Algo fired in this event
380  unsigned int eventBx = ~0;
381 
382  // Running over FDL results to get which bits fired
383  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
384 
385  // Selecting the FDL that triggered
386  if(gtFdlVectorData[a].bxInEvent() == 0){
387  eventBx = gtFdlVectorData[a].localBxNr();
388  if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[tTrigger] ]){firedAlgo = true;}
389  }
390  }
391 
392  // Checking beam configuration
393  if ( m_beamConfig.beam1.size() > eventBx && m_beamConfig.beam2.size() > eventBx) {
394  if( m_beamConfig.beam1[eventBx] && !m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
395  if(!m_beamConfig.beam1[eventBx] && m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
396  }
397  // Analyse only if this trigger fired in this event
398  // NOTE: Veto cases where a single beam is configured since
399  // for this cases this could be a real-satelite bunch collision
400  // -> Calculate the minimum bx diference between this event and a configured bx
401  if(firedAlgo && !beamSingleConfig){
402 
403  int DifAlgoVsBunchStructure = 9999; // Majorated
404 
405  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
406 
407  int bxFDL = gtFdlVectorData[a].localBxNr();
408  int bxInEvent = gtFdlVectorData[a].bxInEvent();
409 
410  if(m_beamConfig.bxConfig(bxFDL) && abs(bxInEvent)<abs(DifAlgoVsBunchStructure)){
411  DifAlgoVsBunchStructure = -1*bxInEvent;
412  }
413  }
414 
415  m_algoVsBunchStructure[tTrigger]->Fill(0 /*m_currentLS*/,DifAlgoVsBunchStructure);
416 
417  }
418  }
419  }
420  }
421  else{
422  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
423  eCount++;
424  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
425  }
426 
427  }
428 }
void getBeamConfOffline(const edm::Event &)
MonitorElement * m_ErrorMonitor
std::map< std::string, std::string > m_selectedTriggers
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
std::map< TString, int > m_algoBit
int iEvent
Definition: GenABIO.cc:224
unsigned int m_lhcFill
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:74
bool bxConfig(unsigned iBx)
std::vector< bool > beam2
const cms_uint32_t lhcFillNumber() const
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
double a
Definition: hdecay.h:121
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
std::vector< bool > beam1
const cms_uint16_t beamMode() const
L1TBeamConfiguration m_beamConfig
std::map< TString, MonitorElement * > m_algoVsBunchStructure
void L1TSync_Offline::bookHistograms ( DQMStore::IBooker ibooker,
const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprotected

BeginRun.

Definition at line 219 of file L1TSync_Offline.cc.

References patPFMETCorrections_cff::algo, DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), gather_cfg::cout, ERROR_LSBLOCK_NOTVALID, ERROR_TRIGGERALIAS_NOTVALID, ERROR_UNABLE_RETRIVE_PRODUCT, edm::EventSetup::get(), L1TMenuHelper::getLUSOTrigger(), L1GtTriggerMenu::gtAlgorithmAliasMap(), mps_fire::i, m_algoAutoSelect, m_algoBit, m_algoCertification, m_algoVsBunchStructure, m_certFirstLS, m_certLastLS, m_ErrorMonitor, m_l1GtUtils, m_lhcFill, m_refPrescaleSet, m_selectedTriggers, m_verbose, edm::ESHandle< T >::product(), L1GtUtils::retrieveL1EventSetup(), MonitorElement::setBinLabel(), DQMStore::IBooker::setCurrentFolder(), L1TMenuHelper::testAlgos(), UNKNOWN, WARNING_DB_CONN_FAILED, WARNING_DB_INCORRECT_NBUNCHES, and WARNING_DB_QUERY_FAILED.

219  {
220 
221  if (m_verbose){cout << "[L1TSync_Offline] Called beginRun." << endl;}
222 
223  // Initializing variables
224  int maxNbins = 2501;
225 
226  // Reseting run dependent variables
227  m_lhcFill = 0;
228  m_certFirstLS.clear();
229  m_certLastLS .clear();
230 
231  // Getting Trigger menu from GT
233  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd);
234  const L1GtTriggerMenu* menu = menuRcd.product();
235 
236  // Filling Alias-Bit Map
237  for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo!=menu->gtAlgorithmAliasMap().end(); ++algo){
238  m_algoBit[(algo->second).algoAlias()] = (algo->second).algoBitNumber();
239  }
240 
241  // Getting fill number for this run
242  //Handle<ConditionsInRunBlock> runConditions;
243  //iRun.getByType(runConditions);
244  //int lhcFillNumber = runConditions->lhcFillNumber;
245  //
246  //ESHandle<L1GtPrescaleFactors> l1GtPfAlgo;
247  //iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
248  //const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
249 
250  L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup);
251 
253 
255  map<string,string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect, m_refPrescaleSet, m_l1GtUtils);
256  m_selectedTriggers.insert(tAutoSelTrig.begin(),tAutoSelTrig.end());
257 
258  // Initializing DQM Monitor Elements
259  ibooker.setCurrentFolder("L1T/L1TSync");
260  m_ErrorMonitor = ibooker.book1D("ErrorMonitor","ErrorMonitor",7,0,7);
261  m_ErrorMonitor->setBinLabel(UNKNOWN ,"UNKNOWN");
262  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED ,"WARNING_DB_CONN_FAILED"); // Errors from L1TOMDSHelper
263  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED ,"WARNING_DB_QUERY_FAILED"); // Errors from L1TOMDSHelper
264  m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,"WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
265  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT ,"ERROR_UNABLE_RETRIVE_PRODUCT");
266  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID ,"ERROR_TRIGGERALIAS_NOTVALID");
267  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID ,"ERROR_LSBLOCK_NOTVALID");
268 
269  // Looping over selected triggers
270  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
271 
272  string tCategory = (*i).first;
273  string tTrigger = (*i).second;
274 
275  // Initializing LS blocks for certification
276  m_certFirstLS[(*i).second] = 0;
277  m_certLastLS [(*i).second] = 0;
278 
279  // Initializing DQM Monitors
280  ibooker.setCurrentFolder("L1T/L1TSync/AlgoVsBunchStructure/");
281  m_algoVsBunchStructure[tTrigger] = ibooker.book2D(tCategory,"min #Delta("+tTrigger+",Bunch)",maxNbins,-0.5,double(maxNbins)-0.5,5,-2.5,2.5);
282  m_algoVsBunchStructure[tTrigger] ->setAxisTitle("Lumi Section" ,1);
283 
284  ibooker.setCurrentFolder("L1T/L1TSync/Certification/");
285  m_algoCertification[tTrigger] = ibooker.book1D(tCategory, "fraction of in sync: "+tTrigger,maxNbins,-0.5,double(maxNbins)-0.5);
286  m_algoCertification[tTrigger] ->setAxisTitle("Lumi Section" ,1);
287 
288  }
289 }
std::map< TString, unsigned int > m_certLastLS
MonitorElement * m_ErrorMonitor
std::map< std::string, std::string > m_selectedTriggers
std::map< TString, unsigned int > m_certFirstLS
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)
L1GtUtils m_l1GtUtils
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
std::map< TString, int > m_algoBit
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
unsigned int m_lhcFill
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
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 > &)
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
std::map< TString, MonitorElement * > m_algoCertification
T get() const
Definition: EventSetup.h:71
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
std::map< std::string, bool > m_algoAutoSelect
T const * product() const
Definition: ESHandle.h:86
std::map< TString, MonitorElement * > m_algoVsBunchStructure
std::map< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors, L1GtUtils const &myUtils)
void L1TSync_Offline::dqmBeginRun ( const edm::Run ,
const edm::EventSetup  
)
overrideprotected

Definition at line 213 of file L1TSync_Offline.cc.

213  {
214 
215 }
void L1TSync_Offline::getBeamConfOffline ( const edm::Event iEvent)
private

Definition at line 435 of file L1TSync_Offline.cc.

References a, L1TBeamConfiguration::beam1, L1TBeamConfiguration::beam2, DEFINE_FWK_MODULE, edm::Event::getByToken(), L1GlobalTriggerReadoutRecord::gtFdlVector(), edm::HandleBase::isValid(), m_algoBit, m_beamConfig, m_l1GtDataDaqInputTag, m_selectedTriggers, and L1TBeamConfiguration::m_valid.

Referenced by analyze().

435  {
436 
437  //Getting connection parameters
438  // [11:21:35] Pietro Vischia: pathCondDB and oracleDB are available in offline?
439  // [11:21:51] Joao Pela: no
440  // [11:21:56] Pietro Vischia: cool
441  // [11:21:58] Pietro Vischia: tks
442  // [11:22:00] Joao Pela: well
443  // [11:22:02] Joao Pela: maybe
444  // [11:22:05] Joao Pela: but assume no
445  // [11:22:22] Joao Pela: definitely assume no
446  // *** UPDATE: now we have a DB for Rate parameters, it would be useful to have s.th also for L1TSync
447 
448  // string oracleDB = m_parameters.getParameter<string>("oracleDB");
449  // string pathCondDB = m_parameters.getParameter<string>("pathCondDB");
450 
451  // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve);
452  // m_lhcFill -> lhcFillNumber
453  // errorRetrieve -> error
454  // m_beamConfig -> bConfig
455 
456 
457  // No error codes at the moment. Taking info from BPTX fires
458  // int errorRetrieve = 0; // NO_ERROR;
459  m_beamConfig.m_valid = true;
460 
461 
462 
463  // bool beamSingleConfig = false; // Single beam configured for this event
464  bool firedAlgo = false; // Algo fired in this event
465  // int eventBx = -1;
466 
467  // Running over FDL results to get which bits fired for BPTX (temporary fix Savannah ticket https://savannah.cern.ch/task/?31857 )
468  // Getting Final Decision Logic (FDL) Data from GT
469  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
470  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
471 
472  if(gtReadoutRecordData.isValid()){
473 
474  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
475 
476  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
477  // Selecting the FDL that triggered
478  if(gtFdlVectorData[a].bxInEvent() == 0){
479  //eventBx = gtFdlVectorData[a].localBxNr();
480  if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[ m_selectedTriggers["BPTX"] ] ]){firedAlgo = true;}
481  }
482 
483  // Fill beam status with BPTX fires
484  if(firedAlgo){
485  m_beamConfig.beam1.push_back(true);
486  m_beamConfig.beam2.push_back(true);
487  }
488  else {
489  m_beamConfig.beam1.push_back(false);
490  m_beamConfig.beam2.push_back(false);
491  }
492  // End fill beam status with BPTX fires
493  } // End loop on FDL
494  } // End if readout is valid
495 
496 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::map< std::string, std::string > m_selectedTriggers
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
std::map< TString, int > m_algoBit
bool isValid() const
Definition: HandleBase.h:74
std::vector< bool > beam2
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
double a
Definition: hdecay.h:121
std::vector< bool > beam1
L1TBeamConfiguration m_beamConfig
std::shared_ptr< ltso::LSValid > L1TSync_Offline::globalBeginLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
) const
finalprotected

Definition at line 294 of file L1TSync_Offline.cc.

References gather_cfg::cout, and m_verbose.

294  {
295  if (m_verbose){cout << "[L1TSync_Offline] Called beginLuminosityBlock." << endl;}
296 
297  return std::make_shared<ltso::LSValid>();
298  }
void L1TSync_Offline::globalEndLuminosityBlock ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  c 
)
inlinefinalprotected

Definition at line 117 of file L1TSync_Offline.h.

References bookHistograms().

117 {}

Member Data Documentation

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

Definition at line 147 of file L1TSync_Offline.h.

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

Definition at line 155 of file L1TSync_Offline.h.

Referenced by bookHistograms(), and L1TSync_Offline().

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

Definition at line 150 of file L1TSync_Offline.h.

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

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

Definition at line 153 of file L1TSync_Offline.h.

Referenced by bookHistograms().

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

Definition at line 154 of file L1TSync_Offline.h.

Referenced by analyze(), and bookHistograms().

L1TBeamConfiguration L1TSync_Offline::m_beamConfig
private

Definition at line 144 of file L1TSync_Offline.h.

Referenced by analyze(), and getBeamConfOffline().

std::map<TString,unsigned int> L1TSync_Offline::m_certFirstLS
private

Definition at line 151 of file L1TSync_Offline.h.

Referenced by bookHistograms().

std::map<TString,unsigned int> L1TSync_Offline::m_certLastLS
private

Definition at line 152 of file L1TSync_Offline.h.

Referenced by bookHistograms().

MonitorElement* L1TSync_Offline::m_ErrorMonitor
private

Definition at line 159 of file L1TSync_Offline.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 163 of file L1TSync_Offline.h.

Referenced by analyze(), getBeamConfOffline(), and L1TSync_Offline().

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

Definition at line 162 of file L1TSync_Offline.h.

Referenced by analyze(), and L1TSync_Offline().

L1GtUtils L1TSync_Offline::m_l1GtUtils
private

Definition at line 165 of file L1TSync_Offline.h.

Referenced by bookHistograms().

unsigned int L1TSync_Offline::m_lhcFill
private

Definition at line 141 of file L1TSync_Offline.h.

Referenced by analyze(), and bookHistograms().

edm::ParameterSet L1TSync_Offline::m_parameters
private

Definition at line 133 of file L1TSync_Offline.h.

Referenced by L1TSync_Offline().

int L1TSync_Offline::m_refPrescaleSet
private

Definition at line 139 of file L1TSync_Offline.h.

Referenced by bookHistograms(), and L1TSync_Offline().

std::map<std::string,std::string> L1TSync_Offline::m_selectedTriggers
private

Definition at line 156 of file L1TSync_Offline.h.

Referenced by analyze(), bookHistograms(), getBeamConfOffline(), and L1TSync_Offline().

bool L1TSync_Offline::m_verbose
private