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  m_outputFile = pset.getUntrackedParameter < std::string > ("outputFile","");
206 
207  if (m_outputFile.size() != 0) {
208  std::cout << "L1T Monitoring histograms will be saved to " << m_outputFile.c_str() << std::endl;
209  }
210 
211  bool disable = pset.getUntrackedParameter < bool > ("disableROOToutput", false);
212  if (disable) {m_outputFile = "";}
213 }
214 
215 //-------------------------------------------------------------------------------------
216 //-------------------------------------------------------------------------------------
218 
219 //-------------------------------------------------------------------------------------
220 
222 
223 }
224 //-------------------------------------------------------------------------------------
226 //-------------------------------------------------------------------------------------
228 
229  if (m_verbose){cout << "[L1TSync_Offline] Called beginRun." << endl;}
230 
231  // Initializing variables
232  int maxNbins = 2501;
233 
234  // Reseting run dependent variables
235  m_lhcFill = 0;
236  m_currentLS = 0;
237  m_certFirstLS.clear();
238  m_certLastLS .clear();
239 
240  // Getting Trigger menu from GT
242  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd);
243  const L1GtTriggerMenu* menu = menuRcd.product();
244 
245  // Filling Alias-Bit Map
246  for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo!=menu->gtAlgorithmAliasMap().end(); ++algo){
247  m_algoBit[(algo->second).algoAlias()] = (algo->second).algoBitNumber();
248  }
249 
250  // Getting fill number for this run
251  //Handle<ConditionsInRunBlock> runConditions;
252  //iRun.getByType(runConditions);
253  //int lhcFillNumber = runConditions->lhcFillNumber;
254  //
255  //ESHandle<L1GtPrescaleFactors> l1GtPfAlgo;
256  //iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
257  //const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
258 
259  L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup);
260 
262 
264  map<string,string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect, m_refPrescaleSet, m_l1GtUtils);
265  m_selectedTriggers.insert(tAutoSelTrig.begin(),tAutoSelTrig.end());
266 
267  // Initializing DQM Monitor Elements
268  ibooker.setCurrentFolder("L1T/L1TSync");
269  m_ErrorMonitor = ibooker.book1D("ErrorMonitor","ErrorMonitor",7,0,7);
270  m_ErrorMonitor->setBinLabel(UNKNOWN ,"UNKNOWN");
271  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED ,"WARNING_DB_CONN_FAILED"); // Errors from L1TOMDSHelper
272  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED ,"WARNING_DB_QUERY_FAILED"); // Errors from L1TOMDSHelper
273  m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,"WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
274  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT ,"ERROR_UNABLE_RETRIVE_PRODUCT");
275  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID ,"ERROR_TRIGGERALIAS_NOTVALID");
276  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID ,"ERROR_LSBLOCK_NOTVALID");
277 
278  // Looping over selected triggers
279  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
280 
281  string tCategory = (*i).first;
282  string tTrigger = (*i).second;
283 
284  // Initializing LS blocks for certification
285  m_certFirstLS[(*i).second] = 0;
286  m_certLastLS [(*i).second] = 0;
287 
288  // Initializing DQM Monitors
289  ibooker.setCurrentFolder("L1T/L1TSync/AlgoVsBunchStructure/");
290  m_algoVsBunchStructure[tTrigger] = ibooker.book2D(tCategory,"min #Delta("+tTrigger+",Bunch)",maxNbins,-0.5,double(maxNbins)-0.5,5,-2.5,2.5);
291  m_algoVsBunchStructure[tTrigger] ->setAxisTitle("Lumi Section" ,1);
292 
293  ibooker.setCurrentFolder("L1T/L1TSync/Certification/");
294  m_algoCertification[tTrigger] = ibooker.book1D(tCategory, "fraction of in sync: "+tTrigger,maxNbins,-0.5,double(maxNbins)-0.5);
295  m_algoCertification[tTrigger] ->setAxisTitle("Lumi Section" ,1);
296 
297  }
298 }
299 
300  //_____________________________________________________________________
301  // Function: beginLuminosityBlock
302  //_____________________________________________________________________
304 
305  if (m_verbose){cout << "[L1TSync_Offline] Called beginLuminosityBlock." << endl;}
306 
307  m_currentLSValid = true;
308 
309  }
310 
311 //_____________________________________________________________________
312 void L1TSync_Offline::analyze(const Event & iEvent, const EventSetup & eventSetup){
313 
314 
315  if(m_verbose){cout << "[L1TSync_Offline] Called analyze." << endl;}
316 
317  // We only start analyzing if current LS is still valid
318  if(m_currentLSValid){
319 
320  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
321 
322  // Retriving information from GT
324  iEvent.getByToken(m_l1GtEvmSource, gtEvmReadoutRecord);
325 
326  // Determining beam mode and fill number
327  if(gtEvmReadoutRecord.isValid()){
328 
329  const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
330  unsigned int lhcBeamMode = gtfeEvmWord.beamMode(); // Updating beam mode
331 
332  if(m_lhcFill == 0){
333  m_lhcFill = gtfeEvmWord.lhcFillNumber(); // Getting LHC Fill Number from GT
334 
335  //I AM HERE
336  getBeamConfOffline(iEvent); // Getting Beam Configuration from OMDS
337  // no OMDS //
338  /* (Savannah ticket https://savannah.cern.ch/task/?31857 )
339  Purged the OMDS helper from the module, since apparently we don't have access to that information from Offline.
340  The comparison with the closest BPTX trigger will be performed via conditions objects which are being implemented by Joao Pela.
341  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.
342  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.
343  */
344  // no OMDS // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve); Yuhuuu!!!OB asked Joao Pela how to fetch that
345 
346 
347 
348 
349  }
350 
351  if(lhcBeamMode != STABLE){m_currentLSValid = false;
352  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << "because beams mode not stable, being " << lhcBeamMode << endl;}
353  } // If Beams are not stable we invalidate this LS
354  }else{
355  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
356  eCount++;
357  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
358  }
359  }else{
360  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
361  }
362 
363  // Commenting out un-necessary print outs (S.Dutta)
364  /* for(size_t l=0; l<m_beamConfig.beam1.size(); l++){
365  cout << "Beam 1: element " << l << " is in state " << m_beamConfig.beam1[l] << " --- Beam 2: element " << l << " is in state " << m_beamConfig.beam2[l] << endl;
366  }*/
367  //------------------------------------------------------------------------------
368  // If current LS is valid and Beam Configuration is Valid we analyse this event
369  //------------------------------------------------------------------------------
371 
372  // Getting Final Decision Logic (FDL) Data from GT
373  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
374  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
375 
376  if(gtReadoutRecordData.isValid()){
377 
378  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
379 
380  // Running over selected triggers
381  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
382 
383  string tTrigger = (*i).second;
384 
385  // Analyse only defined triggers
386  if(tTrigger != "Undefined" && tTrigger != "Undefined (Wrong Name)"){
387 
388  bool beamSingleConfig = false; // Single beam configured for this event
389  bool firedAlgo = false; // Algo fired in this event
390  unsigned int eventBx = ~0;
391 
392  // Running over FDL results to get which bits fired
393  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
394 
395  // Selecting the FDL that triggered
396  if(gtFdlVectorData[a].bxInEvent() == 0){
397  eventBx = gtFdlVectorData[a].localBxNr();
398  if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[tTrigger] ]){firedAlgo = true;}
399  }
400  }
401 
402  // Checking beam configuration
403  if ( m_beamConfig.beam1.size() > eventBx && m_beamConfig.beam2.size() > eventBx) {
404  if( m_beamConfig.beam1[eventBx] && !m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
405  if(!m_beamConfig.beam1[eventBx] && m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
406  }
407  // Analyse only if this trigger fired in this event
408  // NOTE: Veto cases where a single beam is configured since
409  // for this cases this could be a real-satelite bunch collision
410  // -> Calculate the minimum bx diference between this event and a configured bx
411  if(firedAlgo && !beamSingleConfig){
412 
413  int DifAlgoVsBunchStructure = 9999; // Majorated
414 
415  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
416 
417  int bxFDL = gtFdlVectorData[a].localBxNr();
418  int bxInEvent = gtFdlVectorData[a].bxInEvent();
419 
420  if(m_beamConfig.bxConfig(bxFDL) && abs(bxInEvent)<abs(DifAlgoVsBunchStructure)){
421  DifAlgoVsBunchStructure = -1*bxInEvent;
422  }
423  }
424 
425  m_algoVsBunchStructure[tTrigger]->Fill(m_currentLS,DifAlgoVsBunchStructure);
426 
427  }
428  }
429  }
430  }
431  else{
432  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
433  eCount++;
434  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
435  }
436 
437  }
438 }
439 
440 //_____________________________________________________________________
441 // Method: getBunchStructureOffline
442 // Description: Attempt to retrive Beam Configuration from Offline and if
443 // we find error handle it
444 //_____________________________________________________________________
446 
447  //Getting connection parameters
448  // [11:21:35] Pietro Vischia: pathCondDB and oracleDB are available in offline?
449  // [11:21:51] Joao Pela: no
450  // [11:21:56] Pietro Vischia: cool
451  // [11:21:58] Pietro Vischia: tks
452  // [11:22:00] Joao Pela: well
453  // [11:22:02] Joao Pela: maybe
454  // [11:22:05] Joao Pela: but assume no
455  // [11:22:22] Joao Pela: definitely assume no
456  // *** UPDATE: now we have a DB for Rate parameters, it would be useful to have s.th also for L1TSync
457 
458  // string oracleDB = m_parameters.getParameter<string>("oracleDB");
459  // string pathCondDB = m_parameters.getParameter<string>("pathCondDB");
460 
461  // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve);
462  // m_lhcFill -> lhcFillNumber
463  // errorRetrieve -> error
464  // m_beamConfig -> bConfig
465 
466 
467  // No error codes at the moment. Taking info from BPTX fires
468  // int errorRetrieve = 0; // NO_ERROR;
469  m_beamConfig.m_valid = true;
470 
471 
472 
473  // bool beamSingleConfig = false; // Single beam configured for this event
474  bool firedAlgo = false; // Algo fired in this event
475  // int eventBx = -1;
476 
477  // Running over FDL results to get which bits fired for BPTX (temporary fix Savannah ticket https://savannah.cern.ch/task/?31857 )
478  // Getting Final Decision Logic (FDL) Data from GT
479  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
480  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
481 
482  if(gtReadoutRecordData.isValid()){
483 
484  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
485 
486  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
487  // Selecting the FDL that triggered
488  if(gtFdlVectorData[a].bxInEvent() == 0){
489  //eventBx = gtFdlVectorData[a].localBxNr();
490  if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[ m_selectedTriggers["BPTX"] ] ]){firedAlgo = true;}
491  }
492 
493  // Fill beam status with BPTX fires
494  if(firedAlgo){
495  m_beamConfig.beam1.push_back(true);
496  m_beamConfig.beam2.push_back(true);
497  }
498  else {
499  m_beamConfig.beam1.push_back(false);
500  m_beamConfig.beam2.push_back(false);
501  }
502  // End fill beam status with BPTX fires
503  } // End loop on FDL
504  } // End if readout is valid
505 
506 }
507 
508 
509 
510 //_____________________________________________________________________
511 // Method: doFractionInSync
512 // Description: Produce plot with the fraction of in sync trigger for
513 // LS blocks with enough statistics.
514 // Variable: iForce - Forces closing of all blocks and calculation of
515 // the respective fractions
516 // Variable: iBad - (Only works with iForce=true) Forces the current
517 // all current blocks to be marked as bad
518 //_____________________________________________________________________
519 //void L1TSync_Offline::doFractionInSync(bool iForce,bool iBad){
520 //
619 //}
620 
621 
622 //_____________________________________________________________________
623 // Method: certifyLSBlock
624 // Description: Fill the trigger certification plot by blocks
625 // Variable: iTrigger - Which trigger to certify
626 // Variable: iInitLs - Blocks initial LS
627 // Variable: iEndLs - Blocks end LS
628 // Variable: iValue - Value to be used to fill
629 //_____________________________________________________________________
630 //void L1TSync_Offline::certifyLSBlock(string iTrigger, int iInitLs, int iEndLs ,float iValue){
631 //
639 //
640 //}
641 
642 //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
L1TSync_Offline(const edm::ParameterSet &ps)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::map< std::string, std::string > m_selectedTriggers
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
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
virtual void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
virtual 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)
virtual 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:230
std::string m_outputFile
unsigned int m_lhcFill
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TH1 * getTH1(void) const
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
std::map< std::string, std::string > testAlgos(const std::map< std::string, std::string > &)
bool bxConfig(unsigned iBx)
std::vector< bool > beam2
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
const cms_uint32_t lhcFillNumber() const
const T & get() const
Definition: EventSetup.h:55
virtual ~L1TSync_Offline()
HLT enums.
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
double a
Definition: hdecay.h:121
std::map< TString, MonitorElement * > m_algoCertification
unsigned int m_currentLS
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
L1TBeamConfiguration m_beamConfig
std::map< TString, MonitorElement * > m_algoVsBunchStructure
Definition: Run.h:42
std::map< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors, L1GtUtils const &myUtils)