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 //-------------------------------------------------------------------------------------
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 }
206 
207 //-------------------------------------------------------------------------------------
208 //-------------------------------------------------------------------------------------
210 
211 //-------------------------------------------------------------------------------------
212 
214 
215 }
216 //-------------------------------------------------------------------------------------
218 //-------------------------------------------------------------------------------------
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 }
290 
291  //_____________________________________________________________________
292  // Function: globalBeginLuminosityBlock
293  //_____________________________________________________________________
294 std::shared_ptr<ltso::LSValid> L1TSync_Offline::globalBeginLuminosityBlock(LuminosityBlock const& lumiBlock, EventSetup const& c) const {
295  if (m_verbose){cout << "[L1TSync_Offline] Called beginLuminosityBlock." << endl;}
296 
297  return std::make_shared<ltso::LSValid>();
298  }
299 
300 //_____________________________________________________________________
301 void L1TSync_Offline::analyze(const Event & iEvent, const EventSetup & eventSetup){
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 }
429 
430 //_____________________________________________________________________
431 // Method: getBunchStructureOffline
432 // Description: Attempt to retrive Beam Configuration from Offline and if
433 // we find error handle it
434 //_____________________________________________________________________
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 }
497 
498 
499 
500 //_____________________________________________________________________
501 // Method: doFractionInSync
502 // Description: Produce plot with the fraction of in sync trigger for
503 // LS blocks with enough statistics.
504 // Variable: iForce - Forces closing of all blocks and calculation of
505 // the respective fractions
506 // Variable: iBad - (Only works with iForce=true) Forces the current
507 // all current blocks to be marked as bad
508 //_____________________________________________________________________
509 //void L1TSync_Offline::doFractionInSync(bool iForce,bool iBad){
510 //
609 //}
610 
611 
612 //_____________________________________________________________________
613 // Method: certifyLSBlock
614 // Description: Fill the trigger certification plot by blocks
615 // Variable: iTrigger - Which trigger to certify
616 // Variable: iInitLs - Blocks initial LS
617 // Variable: iEndLs - Blocks end LS
618 // Variable: iValue - Value to be used to fill
619 //_____________________________________________________________________
620 //void L1TSync_Offline::certifyLSBlock(string iTrigger, int iInitLs, int iEndLs ,float iValue){
621 //
629 //
630 //}
631 
632 //define this as a plug-in
T getParameter(std::string const &) const
void getBeamConfOffline(const edm::Event &)
T getUntrackedParameter(std::string const &, T const &) const
std::map< TString, unsigned int > m_certLastLS
MonitorElement * m_ErrorMonitor
LuminosityBlockIndex index() const
L1TSync_Offline(const edm::ParameterSet &ps)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::map< std::string, std::string > m_selectedTriggers
std::map< TString, unsigned int > m_certFirstLS
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
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
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)
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
BeginRun.
L1GtUtils m_l1GtUtils
edm::ParameterSet m_parameters
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
std::map< TString, int > m_algoBit
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
unsigned int m_lhcFill
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:97
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
bool isValid() const
Definition: HandleBase.h:74
~L1TSync_Offline() override
std::map< std::string, std::string > testAlgos(const std::map< std::string, std::string > &)
bool bxConfig(unsigned iBx)
std::vector< bool > beam2
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
const cms_uint32_t lhcFillNumber() const
HLT enums.
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
double a
Definition: hdecay.h:121
std::map< TString, MonitorElement * > m_algoCertification
T get() const
Definition: EventSetup.h:71
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
void analyze(const edm::Event &e, const edm::EventSetup &c) override
std::map< std::string, bool > m_algoAutoSelect
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEvmSource
std::vector< bool > beam1
const cms_uint16_t beamMode() const
T const * product() const
Definition: ESHandle.h:86
std::shared_ptr< ltso::LSValid > globalBeginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) const final
L1TBeamConfiguration m_beamConfig
std::map< TString, MonitorElement * > m_algoVsBunchStructure
Definition: Run.h:45
std::map< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors, L1GtUtils const &myUtils)