CMS 3D CMS Logo

L1TSync_Offline.cc
Go to the documentation of this file.
1 
22 //
23 
24 // This class header
26 
27 // System include files
28 // --
29 
30 // User include files
32 
36 
37 #include "DataFormats/Common/interface/ConditionsInEdm.h" // Parameters associated to Run, LS and Event
38 
46 // Luminosity Information
47 //#include "DataFormats/Luminosity/interface/LumiDetails.h"
48 //#include "DataFormats/Luminosity/interface/LumiSummary.h"
49 
50 // L1TMonitor includes
51 //#include "DQMOffline/L1Trigger/interface/L1TMenuHelper.h"
52 
53 #include "TList.h"
54 
55 using namespace edm;
56 using namespace std;
57 
58 //-------------------------------------------------------------------------------------
59 //-------------------------------------------------------------------------------------
61  : m_menuToken(esConsumes<edm::Transition::BeginRun>()),
62  m_helperTokens(L1TMenuHelper::consumes<edm::Transition::BeginRun>(consumesCollector())),
63  m_l1GtUtils(pset, consumesCollector(), false, *this) {
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
94  // If global automatic selection if enable all categories set to be monitored will have
95  // their algos auto selected (the lowest prescale algo will be selected)
97  if (CatMu.getParameter<bool>("monitor")) {
98  m_algoAutoSelect["Mu"] = true;
99  } else {
100  m_algoAutoSelect["Mu"] = false;
101  }
102  if (CatEG.getParameter<bool>("monitor")) {
103  m_algoAutoSelect["EG"] = true;
104  } else {
105  m_algoAutoSelect["EG"] = false;
106  }
107  if (CatIsoEG.getParameter<bool>("monitor")) {
108  m_algoAutoSelect["IsoEG"] = true;
109  } else {
110  m_algoAutoSelect["IsoEG"] = false;
111  }
112  if (CatJet.getParameter<bool>("monitor")) {
113  m_algoAutoSelect["Jet"] = true;
114  } else {
115  m_algoAutoSelect["Jet"] = false;
116  }
117  if (CatCenJet.getParameter<bool>("monitor")) {
118  m_algoAutoSelect["CenJet"] = true;
119  } else {
120  m_algoAutoSelect["CenJet"] = false;
121  }
122  if (CatForJet.getParameter<bool>("monitor")) {
123  m_algoAutoSelect["ForJet"] = true;
124  } else {
125  m_algoAutoSelect["ForJet"] = false;
126  }
127  if (CatTauJet.getParameter<bool>("monitor")) {
128  m_algoAutoSelect["TauJet"] = true;
129  } else {
130  m_algoAutoSelect["TauJet"] = false;
131  }
132  if (CatETM.getParameter<bool>("monitor")) {
133  m_algoAutoSelect["ETM"] = true;
134  } else {
135  m_algoAutoSelect["ETM"] = false;
136  }
137  if (CatETT.getParameter<bool>("monitor")) {
138  m_algoAutoSelect["ETT"] = true;
139  } else {
140  m_algoAutoSelect["ETT"] = false;
141  }
142  if (CatHTM.getParameter<bool>("monitor")) {
143  m_algoAutoSelect["HTM"] = true;
144  } else {
145  m_algoAutoSelect["HTM"] = false;
146  }
147  if (CatHTT.getParameter<bool>("monitor")) {
148  m_algoAutoSelect["HTT"] = true;
149  } else {
150  m_algoAutoSelect["HTT"] = false;
151  }
152 
153  // If global non-automatic selection is enable all categories set to be monitored will use
154  // user defined algos
155  } else {
156  m_algoAutoSelect["Mu"] = false;
157  m_algoAutoSelect["EG"] = false;
158  m_algoAutoSelect["IsoEG"] = false;
159  m_algoAutoSelect["Jet"] = false;
160  m_algoAutoSelect["CenJet"] = false;
161  m_algoAutoSelect["ForJet"] = false;
162  m_algoAutoSelect["TauJet"] = false;
163  m_algoAutoSelect["ETM"] = false;
164  m_algoAutoSelect["ETT"] = false;
165  m_algoAutoSelect["HTM"] = false;
166  m_algoAutoSelect["HTT"] = false;
167 
168  if (CatMu.getParameter<bool>("monitor")) {
169  m_selectedTriggers["Mu"] = CatMu.getParameter<string>("algo");
170  }
171  if (CatEG.getParameter<bool>("monitor")) {
172  m_selectedTriggers["EG"] = CatEG.getParameter<string>("algo");
173  }
174  if (CatIsoEG.getParameter<bool>("monitor")) {
175  m_selectedTriggers["IsoEG"] = CatIsoEG.getParameter<string>("algo");
176  }
177  if (CatJet.getParameter<bool>("monitor")) {
178  m_selectedTriggers["Jet"] = CatJet.getParameter<string>("algo");
179  }
180  if (CatCenJet.getParameter<bool>("monitor")) {
181  m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");
182  }
183  if (CatForJet.getParameter<bool>("monitor")) {
184  m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");
185  }
186  if (CatTauJet.getParameter<bool>("monitor")) {
187  m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");
188  }
189  if (CatETM.getParameter<bool>("monitor")) {
190  m_selectedTriggers["ETM"] = CatETM.getParameter<string>("algo");
191  }
192  if (CatETT.getParameter<bool>("monitor")) {
193  m_selectedTriggers["ETT"] = CatETT.getParameter<string>("algo");
194  }
195  if (CatHTM.getParameter<bool>("monitor")) {
196  m_selectedTriggers["HTM"] = CatHTM.getParameter<string>("algo");
197  }
198  if (CatHTT.getParameter<bool>("monitor")) {
199  m_selectedTriggers["HTT"] = CatHTT.getParameter<string>("algo");
200  }
201  }
202 
203  // If we are using algo-by-algo parametes we get them and set what is needed
204  } else {
205  if (CatBPTX.getParameter<bool>("monitor")) {
206  m_selectedTriggers["BPTX"] = CatBPTX.getParameter<string>("algo");
207  }
208 
209  if (CatMu.getParameter<bool>("monitor")) {
210  m_algoAutoSelect["Mu"] = CatMu.getParameter<bool>("doAutoSelection");
211  if (!m_algoAutoSelect["Mu"]) {
212  m_selectedTriggers["Mu"] = CatMu.getParameter<string>("algo");
213  }
214  } else {
215  m_algoAutoSelect["Mu"] = false;
216  }
217 
218  if (CatEG.getParameter<bool>("monitor")) {
219  m_algoAutoSelect["EG"] = CatEG.getParameter<bool>("doAutoSelection");
220  if (!m_algoAutoSelect["EG"]) {
221  m_selectedTriggers["EG"] = CatEG.getParameter<string>("algo");
222  }
223  } else {
224  m_algoAutoSelect["EG"] = false;
225  }
226 
227  if (CatIsoEG.getParameter<bool>("monitor")) {
228  m_algoAutoSelect["IsoEG"] = CatIsoEG.getParameter<bool>("doAutoSelection");
229  if (!m_algoAutoSelect["IsoEG"]) {
230  m_selectedTriggers["IsoEG"] = CatIsoEG.getParameter<string>("algo");
231  }
232  } else {
233  m_algoAutoSelect["IsoEG"] = false;
234  }
235 
236  if (CatJet.getParameter<bool>("monitor")) {
237  m_algoAutoSelect["Jet"] = CatJet.getParameter<bool>("doAutoSelection");
238  if (!m_algoAutoSelect["Jet"]) {
239  m_selectedTriggers["Jet"] = CatJet.getParameter<string>("algo");
240  }
241  } else {
242  m_algoAutoSelect["Jet"] = false;
243  }
244 
245  if (CatCenJet.getParameter<bool>("monitor")) {
246  m_algoAutoSelect["CenJet"] = CatCenJet.getParameter<bool>("doAutoSelection");
247  if (!m_algoAutoSelect["CenJet"]) {
248  m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");
249  }
250  } else {
251  m_algoAutoSelect["CenJet"] = false;
252  }
253 
254  if (CatForJet.getParameter<bool>("monitor")) {
255  m_algoAutoSelect["CatForJet"] = CatForJet.getParameter<bool>("doAutoSelection");
256  if (!m_algoAutoSelect["CatForJet"]) {
257  m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");
258  }
259  } else {
260  m_algoAutoSelect["CatForJet"] = false;
261  }
262 
263  if (CatTauJet.getParameter<bool>("monitor")) {
264  m_algoAutoSelect["TauJet"] = CatTauJet.getParameter<bool>("doAutoSelection");
265  if (!m_algoAutoSelect["TauJet"]) {
266  m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");
267  }
268  } else {
269  m_algoAutoSelect["TauJet"] = false;
270  }
271 
272  if (CatETM.getParameter<bool>("monitor")) {
273  m_algoAutoSelect["ETM"] = CatETM.getParameter<bool>("doAutoSelection");
274  if (!m_algoAutoSelect["ETM"]) {
275  m_selectedTriggers["ETM"] = CatETM.getParameter<string>("algo");
276  }
277  } else {
278  m_algoAutoSelect["ETM"] = false;
279  }
280 
281  if (CatETT.getParameter<bool>("monitor")) {
282  m_algoAutoSelect["ETT"] = CatETT.getParameter<bool>("doAutoSelection");
283  if (!m_algoAutoSelect["ETT"]) {
284  m_selectedTriggers["ETT"] = CatETT.getParameter<string>("algo");
285  }
286  } else {
287  m_algoAutoSelect["ETT"] = false;
288  }
289 
290  if (CatHTM.getParameter<bool>("monitor")) {
291  m_algoAutoSelect["HTM"] = CatHTM.getParameter<bool>("doAutoSelection");
292  if (!m_algoAutoSelect["HTM"]) {
293  m_selectedTriggers["HTM"] = CatHTM.getParameter<string>("algo");
294  }
295  } else {
296  m_algoAutoSelect["HTM"] = false;
297  }
298 
299  if (CatHTT.getParameter<bool>("monitor")) {
300  m_algoAutoSelect["HTT"] = CatHTT.getParameter<bool>("doAutoSelection");
301  if (!m_algoAutoSelect["HTT"]) {
302  m_selectedTriggers["HTT"] = CatHTT.getParameter<string>("algo");
303  }
304  } else {
305  m_algoAutoSelect["HTT"] = false;
306  }
307  }
308 }
309 
310 //-------------------------------------------------------------------------------------
311 //-------------------------------------------------------------------------------------
313 
314 //-------------------------------------------------------------------------------------
315 
317 //-------------------------------------------------------------------------------------
319 //-------------------------------------------------------------------------------------
320 void L1TSync_Offline::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& iRun, const edm::EventSetup& iSetup) {
321  if (m_verbose) {
322  cout << "[L1TSync_Offline] Called beginRun." << endl;
323  }
324 
325  // Initializing variables
326  int maxNbins = 2501;
327 
328  // Reseting run dependent variables
329  m_lhcFill = 0;
330  m_certFirstLS.clear();
331  m_certLastLS.clear();
332 
333  // Getting Trigger menu from GT
334  const L1GtTriggerMenu& menu = iSetup.getData(m_menuToken);
335 
336  // Filling Alias-Bit Map
337  for (const auto& algo : menu.gtAlgorithmAliasMap()) {
338  m_algoBit[algo.second.algoAlias()] = algo.second.algoBitNumber();
339  }
340 
341  // Getting fill number for this run
342  //Handle<ConditionsInRunBlock> runConditions;
343  //iRun.getByType(runConditions);
344  //int lhcFillNumber = runConditions->lhcFillNumber;
345  //
346  //ESHandle<L1GtPrescaleFactors> l1GtPfAlgo;
347  //iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
348  //const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
349 
350  L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup, m_helperTokens);
351 
353 
355  map<string, string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect, m_refPrescaleSet, m_l1GtUtils);
356  m_selectedTriggers.insert(tAutoSelTrig.begin(), tAutoSelTrig.end());
357 
358  // Initializing DQM Monitor Elements
359  ibooker.setCurrentFolder("L1T/L1TSync");
360  m_ErrorMonitor = ibooker.book1D("ErrorMonitor", "ErrorMonitor", 7, 0, 7);
361  m_ErrorMonitor->setBinLabel(UNKNOWN, "UNKNOWN");
362  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED, "WARNING_DB_CONN_FAILED"); // Errors from L1TOMDSHelper
363  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED, "WARNING_DB_QUERY_FAILED"); // Errors from L1TOMDSHelper
365  "WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
366  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT, "ERROR_UNABLE_RETRIVE_PRODUCT");
367  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID, "ERROR_TRIGGERALIAS_NOTVALID");
368  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID, "ERROR_LSBLOCK_NOTVALID");
369 
370  // Looping over selected triggers
371  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
372  string tCategory = (*i).first;
373  string tTrigger = (*i).second;
374 
375  // Initializing LS blocks for certification
376  m_certFirstLS[(*i).second] = 0;
377  m_certLastLS[(*i).second] = 0;
378 
379  // Initializing DQM Monitors
380  ibooker.setCurrentFolder("L1T/L1TSync/AlgoVsBunchStructure/");
381  m_algoVsBunchStructure[tTrigger] = ibooker.book2D(
382  tCategory, "min #Delta(" + tTrigger + ",Bunch)", maxNbins, -0.5, double(maxNbins) - 0.5, 5, -2.5, 2.5);
383  m_algoVsBunchStructure[tTrigger]->setAxisTitle("Lumi Section", 1);
384 
385  ibooker.setCurrentFolder("L1T/L1TSync/Certification/");
386  m_algoCertification[tTrigger] =
387  ibooker.book1D(tCategory, "fraction of in sync: " + tTrigger, maxNbins, -0.5, double(maxNbins) - 0.5);
388  m_algoCertification[tTrigger]->setAxisTitle("Lumi Section", 1);
389  }
390 }
391 
392 //_____________________________________________________________________
393 // Function: globalBeginLuminosityBlock
394 //_____________________________________________________________________
395 std::shared_ptr<ltso::LSValid> L1TSync_Offline::globalBeginLuminosityBlock(LuminosityBlock const& lumiBlock,
396  EventSetup const& c) const {
397  if (m_verbose) {
398  cout << "[L1TSync_Offline] Called beginLuminosityBlock." << endl;
399  }
400 
401  return std::make_shared<ltso::LSValid>();
402 }
403 
404 //_____________________________________________________________________
406  if (m_verbose) {
407  cout << "[L1TSync_Offline] Called analyze." << endl;
408  }
409 
410  // We only start analyzing if current LS is still valid
411  auto& currentLSValid = luminosityBlockCache(iEvent.getLuminosityBlock().index())->lsIsValid;
412  if (currentLSValid) {
413  if (m_verbose) {
414  cout << "[L1TSync_Offline] -> currentLSValid=" << currentLSValid << endl;
415  }
416 
417  // Retriving information from GT
419  iEvent.getByToken(m_l1GtEvmSource, gtEvmReadoutRecord);
420 
421  // Determining beam mode and fill number
422  if (gtEvmReadoutRecord.isValid()) {
423  const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
424  unsigned int lhcBeamMode = gtfeEvmWord.beamMode(); // Updating beam mode
425 
426  if (m_lhcFill == 0) {
427  m_lhcFill = gtfeEvmWord.lhcFillNumber(); // Getting LHC Fill Number from GT
428 
429  //I AM HERE
430  getBeamConfOffline(iEvent); // Getting Beam Configuration from OMDS
431  // no OMDS //
432  /* (Savannah ticket https://savannah.cern.ch/task/?31857 )
433  Purged the OMDS helper from the module, since apparently we don't have access to that information from Offline.
434  The comparison with the closest BPTX trigger will be performed via conditions objects which are being implemented by Joao Pela.
435  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.
436  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.
437  */
438  // no OMDS // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve); Yuhuuu!!!OB asked Joao Pela how to fetch that
439  }
440 
441  if (lhcBeamMode != STABLE) {
442  currentLSValid = false;
443  if (m_verbose) {
444  cout << "[L1TSync_Offline] -> currentLSValid=" << currentLSValid << "because beams mode not stable, being "
445  << lhcBeamMode << endl;
446  }
447  } // If Beams are not stable we invalidate this LS
448  } else {
449  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
450  eCount++;
451  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT, eCount);
452  }
453  } else {
454  if (m_verbose) {
455  cout << "[L1TSync_Offline] -> currentLSValid=" << currentLSValid << endl;
456  }
457  }
458 
459  // Commenting out un-necessary print outs (S.Dutta)
460  /* for(size_t l=0; l<m_beamConfig.beam1.size(); l++){
461  cout << "Beam 1: element " << l << " is in state " << m_beamConfig.beam1[l] << " --- Beam 2: element " << l << " is in state " << m_beamConfig.beam2[l] << endl;
462  }*/
463  //------------------------------------------------------------------------------
464  // If current LS is valid and Beam Configuration is Valid we analyse this event
465  //------------------------------------------------------------------------------
466  if (currentLSValid && m_beamConfig.isValid()) {
467  // Getting Final Decision Logic (FDL) Data from GT
468  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
469  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
470 
471  if (gtReadoutRecordData.isValid()) {
472  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
473 
474  // Running over selected triggers
475  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
476  string tTrigger = (*i).second;
477 
478  // Analyse only defined triggers
479  if (tTrigger != "Undefined" && tTrigger != "Undefined (Wrong Name)") {
480  bool beamSingleConfig = false; // Single beam configured for this event
481  bool firedAlgo = false; // Algo fired in this event
482  unsigned int eventBx = ~0;
483 
484  // Running over FDL results to get which bits fired
485  for (unsigned int a = 0; a < gtFdlVectorData.size(); a++) {
486  // Selecting the FDL that triggered
487  if (gtFdlVectorData[a].bxInEvent() == 0) {
488  eventBx = gtFdlVectorData[a].localBxNr();
489  if (gtFdlVectorData[a].gtDecisionWord()[m_algoBit[tTrigger]]) {
490  firedAlgo = true;
491  }
492  }
493  }
494 
495  // Checking beam configuration
496  if (m_beamConfig.beam1.size() > eventBx && m_beamConfig.beam2.size() > eventBx) {
497  if (m_beamConfig.beam1[eventBx] && !m_beamConfig.beam2[eventBx]) {
498  beamSingleConfig = true;
499  }
500  if (!m_beamConfig.beam1[eventBx] && m_beamConfig.beam2[eventBx]) {
501  beamSingleConfig = true;
502  }
503  }
504  // Analyse only if this trigger fired in this event
505  // NOTE: Veto cases where a single beam is configured since
506  // for this cases this could be a real-satelite bunch collision
507  // -> Calculate the minimum bx diference between this event and a configured bx
508  if (firedAlgo && !beamSingleConfig) {
509  int DifAlgoVsBunchStructure = 9999; // Majorated
510 
511  for (unsigned int a = 0; a < gtFdlVectorData.size(); a++) {
512  int bxFDL = gtFdlVectorData[a].localBxNr();
513  int bxInEvent = gtFdlVectorData[a].bxInEvent();
514 
515  if (m_beamConfig.bxConfig(bxFDL) && abs(bxInEvent) < abs(DifAlgoVsBunchStructure)) {
516  DifAlgoVsBunchStructure = -1 * bxInEvent;
517  }
518  }
519 
520  m_algoVsBunchStructure[tTrigger]->Fill(0 /*m_currentLS*/, DifAlgoVsBunchStructure);
521  }
522  }
523  }
524  } else {
525  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
526  eCount++;
527  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT, eCount);
528  }
529  }
530 }
531 
532 //_____________________________________________________________________
533 // Method: getBunchStructureOffline
534 // Description: Attempt to retrive Beam Configuration from Offline and if
535 // we find error handle it
536 //_____________________________________________________________________
538  //Getting connection parameters
539  // [11:21:35] Pietro Vischia: pathCondDB and oracleDB are available in offline?
540  // [11:21:51] Joao Pela: no
541  // [11:21:56] Pietro Vischia: cool
542  // [11:21:58] Pietro Vischia: tks
543  // [11:22:00] Joao Pela: well
544  // [11:22:02] Joao Pela: maybe
545  // [11:22:05] Joao Pela: but assume no
546  // [11:22:22] Joao Pela: definitely assume no
547  // *** UPDATE: now we have a DB for Rate parameters, it would be useful to have s.th also for L1TSync
548 
549  // string oracleDB = m_parameters.getParameter<string>("oracleDB");
550  // string pathCondDB = m_parameters.getParameter<string>("pathCondDB");
551 
552  // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve);
553  // m_lhcFill -> lhcFillNumber
554  // errorRetrieve -> error
555  // m_beamConfig -> bConfig
556 
557  // No error codes at the moment. Taking info from BPTX fires
558  // int errorRetrieve = 0; // NO_ERROR;
559  m_beamConfig.m_valid = true;
560 
561  // bool beamSingleConfig = false; // Single beam configured for this event
562  bool firedAlgo = false; // Algo fired in this event
563  // int eventBx = -1;
564 
565  // Running over FDL results to get which bits fired for BPTX (temporary fix Savannah ticket https://savannah.cern.ch/task/?31857 )
566  // Getting Final Decision Logic (FDL) Data from GT
567  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
568  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
569 
570  if (gtReadoutRecordData.isValid()) {
571  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
572 
573  for (unsigned int a = 0; a < gtFdlVectorData.size(); a++) {
574  // Selecting the FDL that triggered
575  if (gtFdlVectorData[a].bxInEvent() == 0) {
576  //eventBx = gtFdlVectorData[a].localBxNr();
577  if (gtFdlVectorData[a].gtDecisionWord()[m_algoBit[m_selectedTriggers["BPTX"]]]) {
578  firedAlgo = true;
579  }
580  }
581 
582  // Fill beam status with BPTX fires
583  if (firedAlgo) {
584  m_beamConfig.beam1.push_back(true);
585  m_beamConfig.beam2.push_back(true);
586  } else {
587  m_beamConfig.beam1.push_back(false);
588  m_beamConfig.beam2.push_back(false);
589  }
590  // End fill beam status with BPTX fires
591  } // End loop on FDL
592  } // End if readout is valid
593 }
594 
595 //_____________________________________________________________________
596 // Method: doFractionInSync
597 // Description: Produce plot with the fraction of in sync trigger for
598 // LS blocks with enough statistics.
599 // Variable: iForce - Forces closing of all blocks and calculation of
600 // the respective fractions
601 // Variable: iBad - (Only works with iForce=true) Forces the current
602 // all current blocks to be marked as bad
603 //_____________________________________________________________________
604 //void L1TSync_Offline::doFractionInSync(bool iForce,bool iBad){
605 //
704 //}
705 
706 //_____________________________________________________________________
707 // Method: certifyLSBlock
708 // Description: Fill the trigger certification plot by blocks
709 // Variable: iTrigger - Which trigger to certify
710 // Variable: iInitLs - Blocks initial LS
711 // Variable: iEndLs - Blocks end LS
712 // Variable: iValue - Value to be used to fill
713 //_____________________________________________________________________
714 //void L1TSync_Offline::certifyLSBlock(string iTrigger, int iInitLs, int iEndLs ,float iValue){
715 //
723 //
724 //}
725 
726 //define this as a plug-in
void getBeamConfOffline(const edm::Event &)
L1TMenuHelper::Tokens m_helperTokens
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
void retrieveL1EventSetup(const edm::EventSetup &, bool isRun=true)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
Definition: L1GtUtils.cc:128
const cms_uint16_t beamMode() const
MonitorElement * m_ErrorMonitor
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
L1TSync_Offline(const edm::ParameterSet &ps)
std::map< TString, MonitorElement * > m_algoCertification
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
BeginRun.
L1GtUtils m_l1GtUtils
edm::ParameterSet m_parameters
int iEvent
Definition: GenABIO.cc:224
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
unsigned int m_lhcFill
const cms_uint32_t lhcFillNumber() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Transition
Definition: Transition.h:12
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
virtual 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)
~L1TSync_Offline() override
std::map< TString, int > m_algoBit
std::map< std::string, std::string > testAlgos(const std::map< std::string, std::string > &)
std::map< std::string, bool > m_algoAutoSelect
bool bxConfig(unsigned iBx)
std::map< TString, MonitorElement * > m_algoVsBunchStructure
std::vector< bool > beam2
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
bool isValid() const
Definition: HandleBase.h:70
std::shared_ptr< ltso::LSValid > globalBeginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) const final
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > m_menuToken
HLT enums.
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
double a
Definition: hdecay.h:121
std::map< std::string, std::string > m_selectedTriggers
std::map< TString, unsigned int > m_certFirstLS
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
void analyze(const edm::Event &e, const edm::EventSetup &c) override
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
std::vector< bool > beam1
L1TBeamConfiguration m_beamConfig
std::map< TString, unsigned int > m_certLastLS
Definition: Run.h:45
std::map< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors, L1GtUtils const &myUtils)