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
52 //#include "DQMOffline/L1Trigger/interface/L1TMenuHelper.h"
53 
54 #include "TList.h"
55 
56 using namespace edm;
57 using namespace std;
58 
59 //-------------------------------------------------------------------------------------
60 //-------------------------------------------------------------------------------------
61 L1TSync_Offline::L1TSync_Offline(const ParameterSet& pset) : m_l1GtUtils(pset, consumesCollector(), false, *this) {
63 
64  // Mapping parameter input variables
65  m_l1GtDataDaqInputTag = consumes<L1GlobalTriggerReadoutRecord>(pset.getParameter<InputTag>("inputTagL1GtDataDaq"));
66  m_l1GtEvmSource = consumes<L1GlobalTriggerEvmReadoutRecord>(pset.getParameter<InputTag>("inputTagtEvmSource"));
67  m_verbose = pset.getUntrackedParameter<bool>("verbose", false);
68  m_refPrescaleSet = pset.getParameter<int>("refPrescaleSet");
69 
70  // Getting which categories to monitor
71  ParameterSet Categories = pset.getParameter<ParameterSet>("Categories");
72 
73  bool forceGlobalParameters = Categories.getParameter<bool>("forceGlobalParameters");
74  bool doGlobalAutoSelection = Categories.getParameter<bool>("doGlobalAutoSelection");
75 
76  ParameterSet CatBPTX = Categories.getParameter<ParameterSet>("BPTX");
77  ParameterSet CatMu = Categories.getParameter<ParameterSet>("Mu");
78  ParameterSet CatEG = Categories.getParameter<ParameterSet>("EG");
79  ParameterSet CatIsoEG = Categories.getParameter<ParameterSet>("IsoEG");
80  ParameterSet CatJet = Categories.getParameter<ParameterSet>("Jet");
81  ParameterSet CatCenJet = Categories.getParameter<ParameterSet>("CenJet");
82  ParameterSet CatForJet = Categories.getParameter<ParameterSet>("ForJet");
83  ParameterSet CatTauJet = Categories.getParameter<ParameterSet>("TauJet");
84  ParameterSet CatETM = Categories.getParameter<ParameterSet>("ETT");
85  ParameterSet CatETT = Categories.getParameter<ParameterSet>("ETM");
86  ParameterSet CatHTT = Categories.getParameter<ParameterSet>("HTT");
87  ParameterSet CatHTM = Categories.getParameter<ParameterSet>("HTM");
88 
89  // --> Setting parameters related to which algos to monitor
90  // If global parameters are forced they take precedence over algo-by-algo parameters
92  // If global automatic selection if enable all categories set to be monitored will have
93  // their algos auto selected (the lowest prescale algo will be selected)
95  if (CatMu.getParameter<bool>("monitor")) {
96  m_algoAutoSelect["Mu"] = true;
97  } else {
98  m_algoAutoSelect["Mu"] = false;
99  }
100  if (CatEG.getParameter<bool>("monitor")) {
101  m_algoAutoSelect["EG"] = true;
102  } else {
103  m_algoAutoSelect["EG"] = false;
104  }
105  if (CatIsoEG.getParameter<bool>("monitor")) {
106  m_algoAutoSelect["IsoEG"] = true;
107  } else {
108  m_algoAutoSelect["IsoEG"] = false;
109  }
110  if (CatJet.getParameter<bool>("monitor")) {
111  m_algoAutoSelect["Jet"] = true;
112  } else {
113  m_algoAutoSelect["Jet"] = false;
114  }
115  if (CatCenJet.getParameter<bool>("monitor")) {
116  m_algoAutoSelect["CenJet"] = true;
117  } else {
118  m_algoAutoSelect["CenJet"] = false;
119  }
120  if (CatForJet.getParameter<bool>("monitor")) {
121  m_algoAutoSelect["ForJet"] = true;
122  } else {
123  m_algoAutoSelect["ForJet"] = false;
124  }
125  if (CatTauJet.getParameter<bool>("monitor")) {
126  m_algoAutoSelect["TauJet"] = true;
127  } else {
128  m_algoAutoSelect["TauJet"] = false;
129  }
130  if (CatETM.getParameter<bool>("monitor")) {
131  m_algoAutoSelect["ETM"] = true;
132  } else {
133  m_algoAutoSelect["ETM"] = false;
134  }
135  if (CatETT.getParameter<bool>("monitor")) {
136  m_algoAutoSelect["ETT"] = true;
137  } else {
138  m_algoAutoSelect["ETT"] = false;
139  }
140  if (CatHTM.getParameter<bool>("monitor")) {
141  m_algoAutoSelect["HTM"] = true;
142  } else {
143  m_algoAutoSelect["HTM"] = false;
144  }
145  if (CatHTT.getParameter<bool>("monitor")) {
146  m_algoAutoSelect["HTT"] = true;
147  } else {
148  m_algoAutoSelect["HTT"] = false;
149  }
150 
151  // If global non-automatic selection is enable all categories set to be monitored will use
152  // user defined algos
153  } else {
154  m_algoAutoSelect["Mu"] = false;
155  m_algoAutoSelect["EG"] = false;
156  m_algoAutoSelect["IsoEG"] = false;
157  m_algoAutoSelect["Jet"] = false;
158  m_algoAutoSelect["CenJet"] = false;
159  m_algoAutoSelect["ForJet"] = false;
160  m_algoAutoSelect["TauJet"] = false;
161  m_algoAutoSelect["ETM"] = false;
162  m_algoAutoSelect["ETT"] = false;
163  m_algoAutoSelect["HTM"] = false;
164  m_algoAutoSelect["HTT"] = false;
165 
166  if (CatMu.getParameter<bool>("monitor")) {
167  m_selectedTriggers["Mu"] = CatMu.getParameter<string>("algo");
168  }
169  if (CatEG.getParameter<bool>("monitor")) {
170  m_selectedTriggers["EG"] = CatEG.getParameter<string>("algo");
171  }
172  if (CatIsoEG.getParameter<bool>("monitor")) {
173  m_selectedTriggers["IsoEG"] = CatIsoEG.getParameter<string>("algo");
174  }
175  if (CatJet.getParameter<bool>("monitor")) {
176  m_selectedTriggers["Jet"] = CatJet.getParameter<string>("algo");
177  }
178  if (CatCenJet.getParameter<bool>("monitor")) {
179  m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");
180  }
181  if (CatForJet.getParameter<bool>("monitor")) {
182  m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");
183  }
184  if (CatTauJet.getParameter<bool>("monitor")) {
185  m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");
186  }
187  if (CatETM.getParameter<bool>("monitor")) {
188  m_selectedTriggers["ETM"] = CatETM.getParameter<string>("algo");
189  }
190  if (CatETT.getParameter<bool>("monitor")) {
191  m_selectedTriggers["ETT"] = CatETT.getParameter<string>("algo");
192  }
193  if (CatHTM.getParameter<bool>("monitor")) {
194  m_selectedTriggers["HTM"] = CatHTM.getParameter<string>("algo");
195  }
196  if (CatHTT.getParameter<bool>("monitor")) {
197  m_selectedTriggers["HTT"] = CatHTT.getParameter<string>("algo");
198  }
199  }
200 
201  // If we are using algo-by-algo parametes we get them and set what is needed
202  } else {
203  if (CatBPTX.getParameter<bool>("monitor")) {
204  m_selectedTriggers["BPTX"] = CatBPTX.getParameter<string>("algo");
205  }
206 
207  if (CatMu.getParameter<bool>("monitor")) {
208  m_algoAutoSelect["Mu"] = CatMu.getParameter<bool>("doAutoSelection");
209  if (!m_algoAutoSelect["Mu"]) {
210  m_selectedTriggers["Mu"] = CatMu.getParameter<string>("algo");
211  }
212  } else {
213  m_algoAutoSelect["Mu"] = false;
214  }
215 
216  if (CatEG.getParameter<bool>("monitor")) {
217  m_algoAutoSelect["EG"] = CatEG.getParameter<bool>("doAutoSelection");
218  if (!m_algoAutoSelect["EG"]) {
219  m_selectedTriggers["EG"] = CatEG.getParameter<string>("algo");
220  }
221  } else {
222  m_algoAutoSelect["EG"] = false;
223  }
224 
225  if (CatIsoEG.getParameter<bool>("monitor")) {
226  m_algoAutoSelect["IsoEG"] = CatIsoEG.getParameter<bool>("doAutoSelection");
227  if (!m_algoAutoSelect["IsoEG"]) {
228  m_selectedTriggers["IsoEG"] = CatIsoEG.getParameter<string>("algo");
229  }
230  } else {
231  m_algoAutoSelect["IsoEG"] = false;
232  }
233 
234  if (CatJet.getParameter<bool>("monitor")) {
235  m_algoAutoSelect["Jet"] = CatJet.getParameter<bool>("doAutoSelection");
236  if (!m_algoAutoSelect["Jet"]) {
237  m_selectedTriggers["Jet"] = CatJet.getParameter<string>("algo");
238  }
239  } else {
240  m_algoAutoSelect["Jet"] = false;
241  }
242 
243  if (CatCenJet.getParameter<bool>("monitor")) {
244  m_algoAutoSelect["CenJet"] = CatCenJet.getParameter<bool>("doAutoSelection");
245  if (!m_algoAutoSelect["CenJet"]) {
246  m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");
247  }
248  } else {
249  m_algoAutoSelect["CenJet"] = false;
250  }
251 
252  if (CatForJet.getParameter<bool>("monitor")) {
253  m_algoAutoSelect["CatForJet"] = CatForJet.getParameter<bool>("doAutoSelection");
254  if (!m_algoAutoSelect["CatForJet"]) {
255  m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");
256  }
257  } else {
258  m_algoAutoSelect["CatForJet"] = false;
259  }
260 
261  if (CatTauJet.getParameter<bool>("monitor")) {
262  m_algoAutoSelect["TauJet"] = CatTauJet.getParameter<bool>("doAutoSelection");
263  if (!m_algoAutoSelect["TauJet"]) {
264  m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");
265  }
266  } else {
267  m_algoAutoSelect["TauJet"] = false;
268  }
269 
270  if (CatETM.getParameter<bool>("monitor")) {
271  m_algoAutoSelect["ETM"] = CatETM.getParameter<bool>("doAutoSelection");
272  if (!m_algoAutoSelect["ETM"]) {
273  m_selectedTriggers["ETM"] = CatETM.getParameter<string>("algo");
274  }
275  } else {
276  m_algoAutoSelect["ETM"] = false;
277  }
278 
279  if (CatETT.getParameter<bool>("monitor")) {
280  m_algoAutoSelect["ETT"] = CatETT.getParameter<bool>("doAutoSelection");
281  if (!m_algoAutoSelect["ETT"]) {
282  m_selectedTriggers["ETT"] = CatETT.getParameter<string>("algo");
283  }
284  } else {
285  m_algoAutoSelect["ETT"] = false;
286  }
287 
288  if (CatHTM.getParameter<bool>("monitor")) {
289  m_algoAutoSelect["HTM"] = CatHTM.getParameter<bool>("doAutoSelection");
290  if (!m_algoAutoSelect["HTM"]) {
291  m_selectedTriggers["HTM"] = CatHTM.getParameter<string>("algo");
292  }
293  } else {
294  m_algoAutoSelect["HTM"] = false;
295  }
296 
297  if (CatHTT.getParameter<bool>("monitor")) {
298  m_algoAutoSelect["HTT"] = CatHTT.getParameter<bool>("doAutoSelection");
299  if (!m_algoAutoSelect["HTT"]) {
300  m_selectedTriggers["HTT"] = CatHTT.getParameter<string>("algo");
301  }
302  } else {
303  m_algoAutoSelect["HTT"] = false;
304  }
305  }
306 }
307 
308 //-------------------------------------------------------------------------------------
309 //-------------------------------------------------------------------------------------
311 
312 //-------------------------------------------------------------------------------------
313 
315 //-------------------------------------------------------------------------------------
317 //-------------------------------------------------------------------------------------
318 void L1TSync_Offline::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& iRun, const edm::EventSetup& iSetup) {
319  if (m_verbose) {
320  cout << "[L1TSync_Offline] Called beginRun." << endl;
321  }
322 
323  // Initializing variables
324  int maxNbins = 2501;
325 
326  // Reseting run dependent variables
327  m_lhcFill = 0;
328  m_certFirstLS.clear();
329  m_certLastLS.clear();
330 
331  // Getting Trigger menu from GT
333  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd);
334  const L1GtTriggerMenu* menu = menuRcd.product();
335 
336  // Filling Alias-Bit Map
337  for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo != menu->gtAlgorithmAliasMap().end(); ++algo) {
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);
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 //_____________________________________________________________________
405 void L1TSync_Offline::analyze(const Event& iEvent, const EventSetup& eventSetup) {
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
L1TSync_Offline.h
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
L1GtTriggerMenu.h
LumiScalers.h
L1TSync_Offline::m_algoAutoSelect
std::map< std::string, bool > m_algoAutoSelect
Definition: L1TSync_Offline.h:149
L1TBeamConfiguration::bxConfig
bool bxConfig(unsigned iBx)
Definition: L1TBeamConfiguration.cc:64
L1TSync_Offline::m_algoBit
std::map< TString, int > m_algoBit
Definition: L1TSync_Offline.h:144
mps_fire.i
i
Definition: mps_fire.py:355
L1TSync_cfi.Categories
Categories
Definition: L1TSync_cfi.py:26
L1TSync_Offline::~L1TSync_Offline
~L1TSync_Offline() override
Definition: L1TSync_Offline.cc:310
funct::false
false
Definition: Factorize.h:34
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
L1GtTriggerMenuRcd.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1GlobalTriggerEvmReadoutRecord::gtfeWord
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
Definition: L1GlobalTriggerEvmReadoutRecord.cc:249
DQMStore.h
L1TSync_Offline::m_algoVsBunchStructure
std::map< TString, MonitorElement * > m_algoVsBunchStructure
Definition: L1TSync_Offline.h:148
L1TSync_Offline::m_refPrescaleSet
int m_refPrescaleSet
Definition: L1TSync_Offline.h:133
L1TSync_Offline::m_l1GtDataDaqInputTag
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TSync_Offline.h:157
edm::Handle
Definition: AssociativeIterator.h:50
L1TBeamConfiguration::beam2
std::vector< bool > beam2
Definition: L1TBeamConfiguration.h:69
L1TSync_Offline::m_certFirstLS
std::map< TString, unsigned int > m_certFirstLS
Definition: L1TSync_Offline.h:145
L1TSync_Offline::m_selectedTriggers
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TSync_Offline.h:150
L1TSync_Offline::WARNING_DB_INCORRECT_NBUNCHES
Definition: L1TSync_Offline.h:98
L1TSync_Offline::m_l1GtEvmSource
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
Definition: L1TSync_Offline.h:156
cmsdt::algo
algo
Definition: constants.h:164
L1TSync_Offline::WARNING_DB_CONN_FAILED
Definition: L1TSync_Offline.h:96
Level1TriggerScalers.h
L1TSync_Offline::m_beamConfig
L1TBeamConfiguration m_beamConfig
Definition: L1TSync_Offline.h:138
L1TSync_Offline::globalBeginLuminosityBlock
std::shared_ptr< ltso::LSValid > globalBeginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) const final
Definition: L1TSync_Offline.cc:395
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
L1TBeamConfiguration::beam1
std::vector< bool > beam1
Definition: L1TBeamConfiguration.h:68
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CItAlgo
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
Definition: L1GtTriggerMenuFwd.h:38
L1TSync_Offline::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TSync_Offline.cc:405
L1GtTriggerMenuRcd
Definition: L1GtTriggerMenuRcd.h:32
L1TSync_Offline::m_certLastLS
std::map< TString, unsigned int > m_certLastLS
Definition: L1TSync_Offline.h:146
edm::ESHandle< L1GtTriggerMenu >
L1TSync_cfi.forceGlobalParameters
forceGlobalParameters
Definition: L1TSync_cfi.py:29
L1TSync_Offline::getBeamConfOffline
void getBeamConfOffline(const edm::Event &)
Definition: L1TSync_Offline.cc:537
dqm::impl::MonitorElement::getTH1
virtual TH1 * getTH1()
Definition: MonitorElement.cc:969
L1TSync_Offline::UNKNOWN
Definition: L1TSync_Offline.h:95
L1TMenuHelper
Definition: L1TMenuHelper.h:79
optionsL1T.menu
menu
Definition: optionsL1T.py:29
edm::ParameterSet
Definition: ParameterSet.h:36
a
double a
Definition: hdecay.h:119
L1TSync_Offline::L1TSync_Offline
L1TSync_Offline(const edm::ParameterSet &ps)
Definition: L1TSync_Offline.cc:61
L1GtTriggerMenu
Definition: L1GtTriggerMenu.h:48
L1TSync_Offline::m_ErrorMonitor
MonitorElement * m_ErrorMonitor
Definition: L1TSync_Offline.h:153
L1GtfeExtWord::lhcFillNumber
const cms_uint32_t lhcFillNumber() const
Definition: L1GtfeExtWord.cc:195
L1TBeamConfiguration::isValid
bool isValid()
Definition: L1TBeamConfiguration.h:65
L1GtMuonTemplate.h
iEvent
int iEvent
Definition: GenABIO.cc:224
L1TSync_Offline::m_verbose
bool m_verbose
Definition: L1TSync_Offline.h:130
dqm::impl::MonitorElement::setBinLabel
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)
Definition: MonitorElement.cc:771
L1GtPrescaleFactorsAlgoTrigRcd.h
L1GtUtils::retrieveL1EventSetup
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:127
L1TSync_Offline::ERROR_LSBLOCK_NOTVALID
Definition: L1TSync_Offline.h:101
L1TSync_Offline::dqmBeginRun
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
Definition: L1TSync_Offline.cc:314
L1TSync_Offline
Definition: L1TSync_Offline.h:68
edm::EventSetup
Definition: EventSetup.h:57
L1TMenuHelper::testAlgos
std::map< std::string, std::string > testAlgos(const std::map< std::string, std::string > &)
Definition: L1TMenuHelper.cc:399
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
L1TSync_Offline::ERROR_TRIGGERALIAS_NOTVALID
Definition: L1TSync_Offline.h:100
get
#define get
L1GtfeExtWord
Definition: L1GtfeExtWord.h:31
L1TSync_Offline::bookHistograms
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
BeginRun.
Definition: L1TSync_Offline.cc:318
L1TMenuHelper.h
L1TSync_Offline::WARNING_DB_QUERY_FAILED
Definition: L1TSync_Offline.h:97
L1TSync_Offline::m_algoCertification
std::map< TString, MonitorElement * > m_algoCertification
Definition: L1TSync_Offline.h:147
std
Definition: JetResolutionObject.h:76
L1TMenuHelper::getLUSOTrigger
std::map< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors, L1GtUtils const &myUtils)
Definition: L1TMenuHelper.cc:57
L1TSync_Offline::m_l1GtUtils
L1GtUtils m_l1GtUtils
Definition: L1TSync_Offline.h:159
L1TSync_Offline::STABLE
Definition: L1TSync_Offline.h:81
ConditionsInEdm.h
L1TSync_cfi.doGlobalAutoSelection
doGlobalAutoSelection
Definition: L1TSync_cfi.py:30
Level1TriggerRates.h
L1TBeamConfiguration::m_valid
bool m_valid
Definition: L1TBeamConfiguration.h:67
L1TSync_Offline::m_parameters
edm::ParameterSet m_parameters
Definition: L1TSync_Offline.h:127
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1GtTriggerMenuFwd.h
L1TSync_Offline::ERROR_UNABLE_RETRIVE_PRODUCT
Definition: L1TSync_Offline.h:99
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
L1TSync_Offline::m_lhcFill
unsigned int m_lhcFill
Definition: L1TSync_Offline.h:135
edm::Event
Definition: Event.h:73
L1GtfeExtWord::beamMode
const cms_uint16_t beamMode() const
Definition: L1GtfeExtWord.cc:215
edm::InputTag
Definition: InputTag.h:15
L1GtPrescaleFactors.h
L1GlobalTriggerReadoutRecord::gtFdlVector
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
Definition: L1GlobalTriggerReadoutRecord.h:119
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27