CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
53 
54 #include "TList.h"
55 
56 using namespace edm;
57 using namespace std;
58 
59 //-------------------------------------------------------------------------------------
60 //-------------------------------------------------------------------------------------
62 
63  m_parameters = pset;
64 
65  // Mapping parameter input variables
66  m_l1GtDataDaqInputTag = consumes<L1GlobalTriggerReadoutRecord>(pset.getParameter <InputTag>("inputTagL1GtDataDaq"));
67  m_l1GtEvmSource = consumes<L1GlobalTriggerEvmReadoutRecord>(pset.getParameter <InputTag>("inputTagtEvmSource"));
68  m_verbose = pset.getUntrackedParameter<bool> ("verbose",false);
69  m_refPrescaleSet = pset.getParameter <int> ("refPrescaleSet");
70 
71  // Getting which categories to monitor
72  ParameterSet Categories = pset.getParameter< ParameterSet >("Categories");
73 
74  bool forceGlobalParameters = Categories.getParameter<bool>("forceGlobalParameters");
75  bool doGlobalAutoSelection = Categories.getParameter<bool>("doGlobalAutoSelection");
76 
77  ParameterSet CatBPTX = Categories.getParameter<ParameterSet>("BPTX");
78  ParameterSet CatMu = Categories.getParameter<ParameterSet>("Mu");
79  ParameterSet CatEG = Categories.getParameter<ParameterSet>("EG");
80  ParameterSet CatIsoEG = Categories.getParameter<ParameterSet>("IsoEG");
81  ParameterSet CatJet = Categories.getParameter<ParameterSet>("Jet");
82  ParameterSet CatCenJet = Categories.getParameter<ParameterSet>("CenJet");
83  ParameterSet CatForJet = Categories.getParameter<ParameterSet>("ForJet");
84  ParameterSet CatTauJet = Categories.getParameter<ParameterSet>("TauJet");
85  ParameterSet CatETM = Categories.getParameter<ParameterSet>("ETT");
86  ParameterSet CatETT = Categories.getParameter<ParameterSet>("ETM");
87  ParameterSet CatHTT = Categories.getParameter<ParameterSet>("HTT");
88  ParameterSet CatHTM = Categories.getParameter<ParameterSet>("HTM");
89 
90  // --> Setting parameters related to which algos to monitor
91  // If global parameters are forced they take precedence over algo-by-algo parameters
92  if(forceGlobalParameters){
93 
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)
96  if(doGlobalAutoSelection){
97 
98  if(CatMu .getParameter<bool>("monitor")){m_algoAutoSelect["Mu"] = true;}else{m_algoAutoSelect["Mu"] = false;}
99  if(CatEG .getParameter<bool>("monitor")){m_algoAutoSelect["EG"] = true;}else{m_algoAutoSelect["EG"] = false;}
100  if(CatIsoEG .getParameter<bool>("monitor")){m_algoAutoSelect["IsoEG"] = true;}else{m_algoAutoSelect["IsoEG"] = false;}
101  if(CatJet .getParameter<bool>("monitor")){m_algoAutoSelect["Jet"] = true;}else{m_algoAutoSelect["Jet"] = false;}
102  if(CatCenJet.getParameter<bool>("monitor")){m_algoAutoSelect["CenJet"] = true;}else{m_algoAutoSelect["CenJet"] = false;}
103  if(CatForJet.getParameter<bool>("monitor")){m_algoAutoSelect["ForJet"] = true;}else{m_algoAutoSelect["ForJet"] = false;}
104  if(CatTauJet.getParameter<bool>("monitor")){m_algoAutoSelect["TauJet"] = true;}else{m_algoAutoSelect["TauJet"] = false;}
105  if(CatETM .getParameter<bool>("monitor")){m_algoAutoSelect["ETM"] = true;}else{m_algoAutoSelect["ETM"] = false;}
106  if(CatETT .getParameter<bool>("monitor")){m_algoAutoSelect["ETT"] = true;}else{m_algoAutoSelect["ETT"] = false;}
107  if(CatHTM .getParameter<bool>("monitor")){m_algoAutoSelect["HTM"] = true;}else{m_algoAutoSelect["HTM"] = false;}
108  if(CatHTT .getParameter<bool>("monitor")){m_algoAutoSelect["HTT"] = true;}else{m_algoAutoSelect["HTT"] = false;}
109 
110  // If global non-automatic selection is enable all categories set to be monitored will use
111  // user defined algos
112  }else{
113 
114  m_algoAutoSelect["Mu"] = false;
115  m_algoAutoSelect["EG"] = false;
116  m_algoAutoSelect["IsoEG"] = false;
117  m_algoAutoSelect["Jet"] = false;
118  m_algoAutoSelect["CenJet"] = false;
119  m_algoAutoSelect["ForJet"] = false;
120  m_algoAutoSelect["TauJet"] = false;
121  m_algoAutoSelect["ETM"] = false;
122  m_algoAutoSelect["ETT"] = false;
123  m_algoAutoSelect["HTM"] = false;
124  m_algoAutoSelect["HTT"] = false;
125 
126  if(CatMu .getParameter<bool>("monitor")){m_selectedTriggers["Mu"] = CatMu .getParameter<string>("algo");}
127  if(CatEG .getParameter<bool>("monitor")){m_selectedTriggers["EG"] = CatEG .getParameter<string>("algo");}
128  if(CatIsoEG .getParameter<bool>("monitor")){m_selectedTriggers["IsoEG"] = CatIsoEG .getParameter<string>("algo");}
129  if(CatJet .getParameter<bool>("monitor")){m_selectedTriggers["Jet"] = CatJet .getParameter<string>("algo");}
130  if(CatCenJet.getParameter<bool>("monitor")){m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");}
131  if(CatForJet.getParameter<bool>("monitor")){m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");}
132  if(CatTauJet.getParameter<bool>("monitor")){m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");}
133  if(CatETM .getParameter<bool>("monitor")){m_selectedTriggers["ETM"] = CatETM .getParameter<string>("algo");}
134  if(CatETT .getParameter<bool>("monitor")){m_selectedTriggers["ETT"] = CatETT .getParameter<string>("algo");}
135  if(CatHTM .getParameter<bool>("monitor")){m_selectedTriggers["HTM"] = CatHTM .getParameter<string>("algo");}
136  if(CatHTT .getParameter<bool>("monitor")){m_selectedTriggers["HTT"] = CatHTT .getParameter<string>("algo");}
137 
138  }
139 
140  // If we are using algo-by-algo parametes we get them and set what is needed
141  }else{
142 
143  if(CatBPTX.getParameter<bool>("monitor")){
144  m_selectedTriggers["BPTX"] = CatBPTX.getParameter<string>("algo");
145  }
146 
147  if(CatMu.getParameter<bool>("monitor")){
148  m_algoAutoSelect["Mu"] = CatMu.getParameter<bool>("doAutoSelection");
149  if(!m_algoAutoSelect["Mu"]){m_selectedTriggers["Mu"] = CatMu.getParameter<string>("algo");}
150  }else{m_algoAutoSelect["Mu"] = false;}
151 
152  if(CatEG.getParameter<bool>("monitor")){
153  m_algoAutoSelect["EG"] = CatEG.getParameter<bool>("doAutoSelection");
154  if(!m_algoAutoSelect["EG"]){m_selectedTriggers["EG"] = CatEG.getParameter<string>("algo");}
155  }else{m_algoAutoSelect["EG"] = false;}
156 
157  if(CatIsoEG.getParameter<bool>("monitor")){
158  m_algoAutoSelect["IsoEG"] = CatIsoEG.getParameter<bool>("doAutoSelection");
159  if(!m_algoAutoSelect["IsoEG"]){m_selectedTriggers["IsoEG"] = CatIsoEG.getParameter<string>("algo");}
160  }else{m_algoAutoSelect["IsoEG"] = false;}
161 
162  if(CatJet.getParameter<bool>("monitor")){
163  m_algoAutoSelect["Jet"] = CatJet.getParameter<bool>("doAutoSelection");
164  if(!m_algoAutoSelect["Jet"]){m_selectedTriggers["Jet"] = CatJet.getParameter<string>("algo");}
165  }else{m_algoAutoSelect["Jet"] = false;}
166 
167  if(CatCenJet.getParameter<bool>("monitor")){
168  m_algoAutoSelect["CenJet"] = CatCenJet.getParameter<bool>("doAutoSelection");
169  if(!m_algoAutoSelect["CenJet"]){m_selectedTriggers["CenJet"] = CatCenJet.getParameter<string>("algo");}
170  }else{m_algoAutoSelect["CenJet"] = false;}
171 
172  if(CatForJet.getParameter<bool>("monitor")){
173  m_algoAutoSelect["CatForJet"] = CatForJet.getParameter<bool>("doAutoSelection");
174  if(!m_algoAutoSelect["CatForJet"]){m_selectedTriggers["CatForJet"] = CatForJet.getParameter<string>("algo");}
175  }else{m_algoAutoSelect["CatForJet"] = false;}
176 
177  if(CatTauJet.getParameter<bool>("monitor")){
178  m_algoAutoSelect["TauJet"] = CatTauJet.getParameter<bool>("doAutoSelection");
179  if(!m_algoAutoSelect["TauJet"]){m_selectedTriggers["TauJet"] = CatTauJet.getParameter<string>("algo");}
180  }else{m_algoAutoSelect["TauJet"] = false;}
181 
182  if(CatETM.getParameter<bool>("monitor")){
183  m_algoAutoSelect["ETM"] = CatETM.getParameter<bool>("doAutoSelection");
184  if(!m_algoAutoSelect["ETM"]){m_selectedTriggers["ETM"] = CatETM.getParameter<string>("algo");}
185  }else{m_algoAutoSelect["ETM"] = false;}
186 
187  if(CatETT.getParameter<bool>("monitor")){
188  m_algoAutoSelect["ETT"] = CatETT.getParameter<bool>("doAutoSelection");
189  if(!m_algoAutoSelect["ETT"]){m_selectedTriggers["ETT"] = CatETT.getParameter<string>("algo");}
190  }else{m_algoAutoSelect["ETT"] = false;}
191 
192  if(CatHTM.getParameter<bool>("monitor")){
193  m_algoAutoSelect["HTM"] = CatHTM.getParameter<bool>("doAutoSelection");
194  if(!m_algoAutoSelect["HTM"]){m_selectedTriggers["HTM"] = CatHTM.getParameter<string>("algo");}
195  }else{m_algoAutoSelect["HTM"] = false;}
196 
197  if(CatHTT.getParameter<bool>("monitor")){
198  m_algoAutoSelect["HTT"] = CatHTT.getParameter<bool>("doAutoSelection");
199  if(!m_algoAutoSelect["HTT"]){m_selectedTriggers["HTT"] = CatHTT.getParameter<string>("algo");}
200  }else{m_algoAutoSelect["HTT"] = false;}
201 
202  }
203 
204 
205  if (pset.getUntrackedParameter < bool > ("dqmStore", false)) {
206  dbe = Service < DQMStore > ().operator->();
207  dbe->setVerbose(0);
208  }
209 
210  m_outputFile = pset.getUntrackedParameter < std::string > ("outputFile","");
211 
212  if (m_outputFile.size() != 0) {
213  std::cout << "L1T Monitoring histograms will be saved to " << m_outputFile.c_str() << std::endl;
214  }
215 
216  bool disable = pset.getUntrackedParameter < bool > ("disableROOToutput", false);
217  if (disable) {m_outputFile = "";}
218 
219  if (dbe != NULL) {dbe->setCurrentFolder("L1T/L1TSync");}
220 
221 }
222 
223 //-------------------------------------------------------------------------------------
224 //-------------------------------------------------------------------------------------
226 
227 //-------------------------------------------------------------------------------------
228 //-------------------------------------------------------------------------------------
230 
231  if (m_verbose){cout << "[L1TSync_Offline] Called beginJob." << endl;}
232 
233  // get hold of back-end interface
234  DQMStore *dbe = 0;
235  dbe = Service < DQMStore > ().operator->();
236 
237  if (dbe) {
238  dbe->setCurrentFolder("L1T/L1TSync");
239  dbe->rmdir("L1T/L1TSync");
240  }
241 
242 }
243 
244 //-------------------------------------------------------------------------------------
245 //-------------------------------------------------------------------------------------
247 
248  if (m_verbose){cout << "[L1TSync_Offline] Called endJob." << endl;}
249 
250  if (m_outputFile.size() != 0 && dbe)
251  dbe->save(m_outputFile);
252 
253  return;
254 
255 }
256 
257 //-------------------------------------------------------------------------------------
259 //-------------------------------------------------------------------------------------
260 void L1TSync_Offline::beginRun(const edm::Run& iRun, const edm::EventSetup& iSetup){
261 
262  if (m_verbose){cout << "[L1TSync_Offline] Called beginRun." << endl;}
263 
264  // Initializing variables
265  int maxNbins = 2501;
266 
267  // Reseting run dependent variables
268  m_lhcFill = 0;
269  m_currentLS = 0;
270  m_certFirstLS.clear();
271  m_certLastLS .clear();
272 
273  // Getting Trigger menu from GT
275  iSetup.get<L1GtTriggerMenuRcd>().get(menuRcd);
276  const L1GtTriggerMenu* menu = menuRcd.product();
277 
278  // Filling Alias-Bit Map
279  for (CItAlgo algo = menu->gtAlgorithmAliasMap().begin(); algo!=menu->gtAlgorithmAliasMap().end(); ++algo){
280  m_algoBit[(algo->second).algoAlias()] = (algo->second).algoBitNumber();
281  }
282 
283  // Getting fill number for this run
284  //Handle<ConditionsInRunBlock> runConditions;
285  //iRun.getByType(runConditions);
286  //int lhcFillNumber = runConditions->lhcFillNumber;
287  //
288  //ESHandle<L1GtPrescaleFactors> l1GtPfAlgo;
289  //iSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
290  //const L1GtPrescaleFactors* m_l1GtPfAlgo = l1GtPfAlgo.product();
291 
292  L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup);
293 
294  m_selectedTriggers = myMenuHelper.testAlgos(m_selectedTriggers);
295 
296  map<string,string> tAutoSelTrig = myMenuHelper.getLUSOTrigger(m_algoAutoSelect,m_refPrescaleSet);
297  m_selectedTriggers.insert(tAutoSelTrig.begin(),tAutoSelTrig.end());
298 
299  // Initializing DQM Monitor Elements
300  dbe->setCurrentFolder("L1T/L1TSync");
301  m_ErrorMonitor = dbe->book1D("ErrorMonitor","ErrorMonitor",7,0,7);
302  m_ErrorMonitor->setBinLabel(UNKNOWN ,"UNKNOWN");
303  m_ErrorMonitor->setBinLabel(WARNING_DB_CONN_FAILED ,"WARNING_DB_CONN_FAILED"); // Errors from L1TOMDSHelper
304  m_ErrorMonitor->setBinLabel(WARNING_DB_QUERY_FAILED ,"WARNING_DB_QUERY_FAILED"); // Errors from L1TOMDSHelper
305  m_ErrorMonitor->setBinLabel(WARNING_DB_INCORRECT_NBUNCHES,"WARNING_DB_INCORRECT_NBUNCHES"); // Errors from L1TOMDSHelper
306  m_ErrorMonitor->setBinLabel(ERROR_UNABLE_RETRIVE_PRODUCT ,"ERROR_UNABLE_RETRIVE_PRODUCT");
307  m_ErrorMonitor->setBinLabel(ERROR_TRIGGERALIAS_NOTVALID ,"ERROR_TRIGGERALIAS_NOTVALID");
308  m_ErrorMonitor->setBinLabel(ERROR_LSBLOCK_NOTVALID ,"ERROR_LSBLOCK_NOTVALID");
309 
310  // Looping over selected triggers
311  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
312 
313  string tCategory = (*i).first;
314  string tTrigger = (*i).second;
315 
316  // Initializing LS blocks for certification
317  m_certFirstLS[(*i).second] = 0;
318  m_certLastLS [(*i).second] = 0;
319 
320  // Initializing DQM Monitors
321  dbe->setCurrentFolder("L1T/L1TSync/AlgoVsBunchStructure/");
322  m_algoVsBunchStructure[tTrigger] = dbe->book2D(tCategory,"min #Delta("+tTrigger+",Bunch)",maxNbins,-0.5,double(maxNbins)-0.5,5,-2.5,2.5);
323  m_algoVsBunchStructure[tTrigger] ->setAxisTitle("Lumi Section" ,1);
324 
325  dbe->setCurrentFolder("L1T/L1TSync/Certification/");
326  m_algoCertification[tTrigger] = dbe->book1D(tCategory, "fraction of in sync: "+tTrigger,maxNbins,-0.5,double(maxNbins)-0.5);
327  m_algoCertification[tTrigger] ->setAxisTitle("Lumi Section" ,1);
328 
329  }
330 
331 }
332 
333  //_____________________________________________________________________
334  // Function: beginLuminosityBlock
335  //_____________________________________________________________________
337 
338  if (m_verbose){cout << "[L1TSync_Offline] Called beginLuminosityBlock." << endl;}
339 
340  m_currentLSValid = true;
341 
342  }
343 
344 
345 //_____________________________________________________________________
347 
348  if(m_verbose){cout << "[L1TSync_Offline] Called endRun." << endl;}
349 
350  // When the run end for closing of the LS certification blocks and evaluation
351  // of synchronization for that block
352 
353  // This will be for Harvesting
354  // doFractionInSync(true,false);
355 
356 }
357 
358 //_____________________________________________________________________
359 void L1TSync_Offline::analyze(const Event & iEvent, const EventSetup & eventSetup){
360 
361 
362  if(m_verbose){cout << "[L1TSync_Offline] Called analyze." << endl;}
363 
364  // We only start analyzing if current LS is still valid
365  if(m_currentLSValid){
366 
367  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
368 
369  // Retriving information from GT
371  iEvent.getByToken(m_l1GtEvmSource, gtEvmReadoutRecord);
372 
373  // Determining beam mode and fill number
374  if(gtEvmReadoutRecord.isValid()){
375 
376  const L1GtfeExtWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
377  unsigned int lhcBeamMode = gtfeEvmWord.beamMode(); // Updating beam mode
378 
379  if(m_lhcFill == 0){
380  m_lhcFill = gtfeEvmWord.lhcFillNumber(); // Getting LHC Fill Number from GT
381 
382  //I AM HERE
383  getBeamConfOffline(iEvent); // Getting Beam Configuration from OMDS
384  // no OMDS //
385  /* (Savannah ticket https://savannah.cern.ch/task/?31857 )
386  Purged the OMDS helper from the module, since apparently we don't have access to that information from Offline.
387  The comparison with the closest BPTX trigger will be performed via conditions objects which are being implemented by Joao Pela.
388  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.
389  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.
390  */
391  // no OMDS // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve); Yuhuuu!!!OB asked Joao Pela how to fetch that
392 
393 
394 
395 
396  }
397 
398  if(lhcBeamMode != STABLE){m_currentLSValid = false;
399  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << "because beams mode not stable, being " << lhcBeamMode << endl;}
400  } // If Beams are not stable we invalidate this LS
401  }else{
402  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
403  eCount++;
404  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
405  }
406  }else{
407  if(m_verbose){cout << "[L1TSync_Offline] -> m_currentLSValid=" << m_currentLSValid << endl;}
408  }
409 
410  // Commenting out un-necessary print outs (S.Dutta)
411  /* for(size_t l=0; l<m_beamConfig.beam1.size(); l++){
412  cout << "Beam 1: element " << l << " is in state " << m_beamConfig.beam1[l] << " --- Beam 2: element " << l << " is in state " << m_beamConfig.beam2[l] << endl;
413  }*/
414  //------------------------------------------------------------------------------
415  // If current LS is valid and Beam Configuration is Valid we analyse this event
416  //------------------------------------------------------------------------------
417  if(m_currentLSValid && m_beamConfig.isValid()){
418 
419  // Getting Final Decision Logic (FDL) Data from GT
420  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
421  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
422 
423  if(gtReadoutRecordData.isValid()){
424 
425  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
426 
427  // Running over selected triggers
428  for(map<string,string>::const_iterator i=m_selectedTriggers.begin() ; i!=m_selectedTriggers.end() ; i++){
429 
430  string tTrigger = (*i).second;
431 
432  // Analyse only defined triggers
433  if(tTrigger != "Undefined" && tTrigger != "Undefined (Wrong Name)"){
434 
435  bool beamSingleConfig = false; // Single beam configured for this event
436  bool firedAlgo = false; // Algo fired in this event
437  unsigned int eventBx = ~0;
438 
439  // Running over FDL results to get which bits fired
440  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
441 
442  // Selecting the FDL that triggered
443  if(gtFdlVectorData[a].bxInEvent() == 0){
444  eventBx = gtFdlVectorData[a].localBxNr();
445  if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[tTrigger] ]){firedAlgo = true;}
446  }
447  }
448 
449  // Checking beam configuration
450  if ( m_beamConfig.beam1.size() > eventBx && m_beamConfig.beam2.size() > eventBx) {
451  if( m_beamConfig.beam1[eventBx] && !m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
452  if(!m_beamConfig.beam1[eventBx] && m_beamConfig.beam2[eventBx]){beamSingleConfig = true;}
453  }
454  // Analyse only if this trigger fired in this event
455  // NOTE: Veto cases where a single beam is configured since
456  // for this cases this could be a real-satelite bunch collision
457  // -> Calculate the minimum bx diference between this event and a configured bx
458  if(firedAlgo && !beamSingleConfig){
459 
460  int DifAlgoVsBunchStructure = 9999; // Majorated
461 
462  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
463 
464  int bxFDL = gtFdlVectorData[a].localBxNr();
465  int bxInEvent = gtFdlVectorData[a].bxInEvent();
466 
467  if(m_beamConfig.bxConfig(bxFDL) && abs(bxInEvent)<abs(DifAlgoVsBunchStructure)){
468  DifAlgoVsBunchStructure = -1*bxInEvent;
469  }
470  }
471 
472  m_algoVsBunchStructure[tTrigger]->Fill(m_currentLS,DifAlgoVsBunchStructure);
473 
474  }
475  }
476  }
477  }
478  else{
479  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT);
480  eCount++;
481  m_ErrorMonitor->getTH1()->SetBinContent(ERROR_UNABLE_RETRIVE_PRODUCT,eCount);
482  }
483 
484  }
485 }
486 
487 //_____________________________________________________________________
488 // Method: getBunchStructureOffline
489 // Description: Attempt to retrive Beam Configuration from Offline and if
490 // we find error handle it
491 //_____________________________________________________________________
493 
494  //Getting connection parameters
495  // [11:21:35] Pietro Vischia: pathCondDB and oracleDB are available in offline?
496  // [11:21:51] Joao Pela: no
497  // [11:21:56] Pietro Vischia: cool
498  // [11:21:58] Pietro Vischia: tks
499  // [11:22:00] Joao Pela: well
500  // [11:22:02] Joao Pela: maybe
501  // [11:22:05] Joao Pela: but assume no
502  // [11:22:22] Joao Pela: definitely assume no
503  // *** UPDATE: now we have a DB for Rate parameters, it would be useful to have s.th also for L1TSync
504 
505  // string oracleDB = m_parameters.getParameter<string>("oracleDB");
506  // string pathCondDB = m_parameters.getParameter<string>("pathCondDB");
507 
508  // m_beamConfig = myOMDSHelper.getBeamConfiguration(m_lhcFill,errorRetrieve);
509  // m_lhcFill -> lhcFillNumber
510  // errorRetrieve -> error
511  // m_beamConfig -> bConfig
512 
513 
514  // No error codes at the moment. Taking info from BPTX fires
515  // int errorRetrieve = 0; // NO_ERROR;
516  m_beamConfig.m_valid = true;
517 
518 
519 
520  // bool beamSingleConfig = false; // Single beam configured for this event
521  bool firedAlgo = false; // Algo fired in this event
522  // int eventBx = -1;
523 
524  // Running over FDL results to get which bits fired for BPTX (temporary fix Savannah ticket https://savannah.cern.ch/task/?31857 )
525  // Getting Final Decision Logic (FDL) Data from GT
526  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
527  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
528 
529  if(gtReadoutRecordData.isValid()){
530 
531  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
532 
533  for(unsigned int a=0 ; a<gtFdlVectorData.size() ; a++){
534  // Selecting the FDL that triggered
535  if(gtFdlVectorData[a].bxInEvent() == 0){
536  //eventBx = gtFdlVectorData[a].localBxNr();
537  if(gtFdlVectorData[a].gtDecisionWord()[ m_algoBit[ m_selectedTriggers["BPTX"] ] ]){firedAlgo = true;}
538  }
539 
540  // Fill beam status with BPTX fires
541  if(firedAlgo){
542  m_beamConfig.beam1.push_back(true);
543  m_beamConfig.beam2.push_back(true);
544  }
545  else {
546  m_beamConfig.beam1.push_back(false);
547  m_beamConfig.beam2.push_back(false);
548  }
549  // End fill beam status with BPTX fires
550  } // End loop on FDL
551  } // End if readout is valid
552 
553 }
554 
555 
556 
557 //_____________________________________________________________________
558 // Method: doFractionInSync
559 // Description: Produce plot with the fraction of in sync trigger for
560 // LS blocks with enough statistics.
561 // Variable: iForce - Forces closing of all blocks and calculation of
562 // the respective fractions
563 // Variable: iBad - (Only works with iForce=true) Forces the current
564 // all current blocks to be marked as bad
565 //_____________________________________________________________________
566 //void L1TSync_Offline::doFractionInSync(bool iForce,bool iBad){
567 //
666 //}
667 
668 
669 //_____________________________________________________________________
670 // Method: certifyLSBlock
671 // Description: Fill the trigger certification plot by blocks
672 // Variable: iTrigger - Which trigger to certify
673 // Variable: iInitLs - Blocks initial LS
674 // Variable: iEndLs - Blocks end LS
675 // Variable: iValue - Value to be used to fill
676 //_____________________________________________________________________
677 //void L1TSync_Offline::certifyLSBlock(string iTrigger, int iInitLs, int iEndLs ,float iValue){
678 //
686 //
687 //}
688 
689 //define this as a plug-in
T getParameter(std::string const &) const
void getBeamConfOffline(const edm::Event &)
void beginRun(const edm::Run &run, const edm::EventSetup &iSetup)
BeginRun.
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2731
L1TSync_Offline(const edm::ParameterSet &ps)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
0: Unidentified isolated particle
Definition: ParticleCode.h:19
#define NULL
Definition: scimark2.h:8
DEFINE_FWK_MODULE(HiMixingModule)
virtual void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
std::map< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors)
int iEvent
Definition: GenABIO.cc:243
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:76
std::map< std::string, std::string > testAlgos(const std::map< std::string, std::string > &)
const cms_uint32_t lhcFillNumber() const
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
virtual ~L1TSync_Offline()
void analyze(const edm::Event &e, const edm::EventSetup &c)
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:121
const AlgorithmMap & gtAlgorithmAliasMap() const
get / set the algorithm map (by alias)
const cms_uint16_t beamMode() const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:585
Definition: Run.h:41
void endRun(const edm::Run &run, const edm::EventSetup &iSetup)