CMS 3D CMS Logo

L1TRate_Offline.cc
Go to the documentation of this file.
1 // L1TMonitor includes
3 
11 
12 #include "TList.h"
13 
14 using namespace edm;
15 using namespace std;
16 
17 //_____________________________________________________________________
19  : m_menuToken(esConsumes<edm::Transition::BeginRun>()),
20  m_l1GtPfAlgoToken(esConsumes<edm::Transition::BeginRun>()),
21  m_helperTokens(L1TMenuHelper::consumes<edm::Transition::BeginRun>(consumesCollector())),
22  m_l1GtUtils(ps, consumesCollector(), false, *this) {
23  m_maxNbins = 2500; // Maximum LS for each run (for binning purposes)
24  m_parameters = ps;
25 
26  // Mapping parameter input variables
28  consumes<LumiScalersCollection>(m_parameters.getParameter<InputTag>("inputTagScalersResults"));
30  consumes<Level1TriggerScalersCollection>(m_parameters.getParameter<InputTag>("inputTagScalersResults"));
32  consumes<L1GlobalTriggerReadoutRecord>(m_parameters.getParameter<InputTag>("inputTagL1GtDataDaq"));
33  m_verbose = m_parameters.getUntrackedParameter<bool>("verbose", false);
34  m_refPrescaleSet = m_parameters.getParameter<int>("refPrescaleSet");
35  m_lsShiftGTRates = m_parameters.getUntrackedParameter<int>("lsShiftGTRates", 0);
36 
37  // Getting which categories to monitor
39  m_inputCategories["Mu"] = Categories.getUntrackedParameter<bool>("Mu");
40  m_inputCategories["EG"] = Categories.getUntrackedParameter<bool>("EG");
41  m_inputCategories["IsoEG"] = Categories.getUntrackedParameter<bool>("IsoEG");
42  m_inputCategories["Jet"] = Categories.getUntrackedParameter<bool>("Jet");
43  m_inputCategories["CenJet"] = Categories.getUntrackedParameter<bool>("CenJet");
44  m_inputCategories["ForJet"] = Categories.getUntrackedParameter<bool>("ForJet");
45  m_inputCategories["TauJet"] = Categories.getUntrackedParameter<bool>("TauJet");
46  m_inputCategories["ETM"] = Categories.getUntrackedParameter<bool>("ETM");
47  m_inputCategories["ETT"] = Categories.getUntrackedParameter<bool>("ETT");
48  m_inputCategories["HTT"] = Categories.getUntrackedParameter<bool>("HTT");
49  m_inputCategories["HTM"] = Categories.getUntrackedParameter<bool>("HTM");
50 
51  // Initializing Variables
52  if (m_verbose) {
53  cout << "[L1TRate_Offline:] ____________ Storage initialization ____________ " << endl;
54  cout << "[L1TRate_Offline:] Setting up dbe folder: L1T/L1TRate" << endl;
55  }
56 }
57 
58 //_____________________________________________________________________
60 
61 //_____________________________________________________________________
62 // BeginRun: as input you get filtered events...
63 //_____________________________________________________________________
65  if (m_verbose) {
66  cout << "[L1TRate_Offline:] Called beginRun." << endl;
67  }
68 
69  const L1GtTriggerMenu& menu = iSetup.getData(m_menuToken);
70  const L1GtPrescaleFactors& l1GtPfAlgo = iSetup.getData(m_l1GtPfAlgoToken);
71 
72  // Initializing DQM Monitor Elements
73  ibooker.setCurrentFolder("L1T/L1TRate");
74  m_ErrorMonitor = ibooker.book1D("ErrorMonitor", "ErrorMonitor", 2, 0, 2);
75  m_ErrorMonitor->setBinLabel(UNKNOWN, "UNKNOWN");
76  m_ErrorMonitor->setBinLabel(WARNING_PY_MISSING_FIT, "WARNING_PY_MISSING_FIT");
77 
78  if (m_verbose) {
79  cout << "[L1TRate_Offline:] m_ErrorMonitor: " << m_ErrorMonitor << endl;
80  }
81 
82  // Retriving the list of prescale sets
83  m_listsPrescaleFactors = &(l1GtPfAlgo.gtPrescaleFactors());
84 
85  // Getting Lowest Prescale Single Object Triggers from the menu
86  L1TMenuHelper myMenuHelper = L1TMenuHelper(iSetup, m_helperTokens);
89 
90  //-> Getting template fits for the algLo cross sections
92 
93  for (const auto& algo : menu.gtAlgorithmMap()) {
94  m_algoBit[(algo.second).algoAlias()] = (algo.second).algoBitNumber();
95  }
96 
97  double minInstantLuminosity = m_parameters.getParameter<double>("minInstantLuminosity");
98  double maxInstantLuminosity = m_parameters.getParameter<double>("maxInstantLuminosity");
99 
100  // Initializing DQM Monitor Elements
101  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
102  TString tCategory = (*i).first;
103  TString tTrigger = (*i).second;
104 
105  TString tErrorMessage = "";
106  TF1* tTestFunction;
107 
108  if (tTrigger != "Undefined" && m_templateFunctions.find(tTrigger) != m_templateFunctions.end()) {
109  tTestFunction = m_templateFunctions[tTrigger];
110  } else if (tTrigger == "Undefined") {
111  TString tFunc = "-1";
112  tTestFunction = new TF1("FitParametrization_" + tTrigger, tFunc, 0, double(m_maxNbins) - 0.5);
113  } else if (m_templateFunctions.find(tTrigger) == m_templateFunctions.end()) {
114  TString tFunc = "-1";
115  tTestFunction = new TF1("FitParametrization_" + tTrigger, tFunc, 0, double(m_maxNbins) - 0.5);
116  tErrorMessage = " (Undefined Test Function)";
117  } else {
118  TString tFunc = "-1";
119  tTestFunction = new TF1("FitParametrization_" + tTrigger, tFunc, 0, double(m_maxNbins) - 0.5);
120  }
121 
122  if (tTrigger != "Undefined") {
123  if (myMenuHelper.getPrescaleByAlias(tCategory, tTrigger) != 1) {
124  tErrorMessage += " WARNING: Default Prescale = ";
125  tErrorMessage += myMenuHelper.getPrescaleByAlias(tCategory, tTrigger);
126  }
127 
128  if (tCategory == "Mu" &&
129  myMenuHelper.getEtaRangeByAlias(tCategory, tTrigger) != 4294967295) { //hexadecimal of the whole range
130  tErrorMessage += " WARNING: Eta Range = ";
131  tErrorMessage += myMenuHelper.getEtaRangeByAlias(tCategory, tTrigger);
132  } else if (tCategory == "EG" && myMenuHelper.getEtaRangeByAlias(tCategory, tTrigger) != 32639) {
133  tErrorMessage += " WARNING: Eta Range = ";
134  tErrorMessage += myMenuHelper.getEtaRangeByAlias(tCategory, tTrigger);
135  } else if (tCategory == "IsoEG" && myMenuHelper.getEtaRangeByAlias(tCategory, tTrigger) != 32639) {
136  tErrorMessage += " WARNING: Eta Range = ";
137  tErrorMessage += myMenuHelper.getEtaRangeByAlias(tCategory, tTrigger);
138  }
139 
140  if (tCategory == "Mu" && myMenuHelper.getQualityAlias(tCategory, tTrigger) != 240) {
141  tErrorMessage += " WARNING: Quality = ";
142  tErrorMessage += myMenuHelper.getQualityAlias(tCategory, tTrigger);
143  }
144  }
145 
146  ibooker.setCurrentFolder("L1T/L1TRate/xSecDelivLumi"); // trigger counts...
147  m_xSecObservedVsDelivLumi[tTrigger] = ibooker.bookProfile(tCategory,
148  "Cross Sec. vs Deliv. Lumi: " + tTrigger + tErrorMessage,
149  m_maxNbins,
152  0,
153  500);
154  m_xSecObservedVsDelivLumi[tTrigger]->setAxisTitle("Delivered Luminosity [10^{30}cm^{-2}s^{-1}]", 1);
155  m_xSecObservedVsDelivLumi[tTrigger]->setAxisTitle("Algorithm #sigma [#mu b]", 2);
156 
157  ibooker.setCurrentFolder("L1T/L1TRate/xSecRecorLumi"); // trigger counts...
158  m_xSecObservedVsRecorLumi[tTrigger] = ibooker.bookProfile(tCategory,
159  "Cross Sec. vs Recor. Lumi: " + tTrigger + tErrorMessage,
160  m_maxNbins,
163  0,
164  500);
165  m_xSecObservedVsRecorLumi[tTrigger]->setAxisTitle("Recorded Luminosity [10^{30}cm^{-2}s^{-1}]", 1);
166  m_xSecObservedVsRecorLumi[tTrigger]->setAxisTitle("Algorithm #sigma [#mu b]", 2);
167 
168  ibooker.setCurrentFolder("L1T/L1TRate/TriggerCounts"); // trigger counts...
169  m_CountsVsLS[tTrigger] = ibooker.bookProfile(tCategory,
170  "Cross Sec. vs Inst. Lumi Algo: " + tTrigger + tErrorMessage,
171  m_maxNbins,
174  0,
175  500);
176  m_CountsVsLS[tTrigger]->setAxisTitle("Instantaneous Luminosity [10^{30}cm^{-2}s^{-1}]", 1);
177  m_CountsVsLS[tTrigger]->setAxisTitle("Algorithm #sigma [#mu b]", 2);
178  m_CountsVsLS[tTrigger]->getTProfile()->GetListOfFunctions()->Add(tTestFunction);
179  m_CountsVsLS[tTrigger]->getTProfile()->SetMarkerStyle(23);
180 
181  m_algoFit[tTrigger] = (TF1*)tTestFunction->Clone("Fit_" + tTrigger); // NOTE: Workaround
182 
183  ibooker.setCurrentFolder("L1T/L1TRate/xSecObs");
184  m_xSecObservedVsLS[tTrigger] =
185  ibooker.book1D(tCategory, "Algo: " + tTrigger + tErrorMessage, m_maxNbins, -0.5, double(m_maxNbins) - 0.5);
186  m_xSecObservedVsLS[tTrigger]->setAxisTitle("Lumi Section", 1);
187  m_xSecObservedVsLS[tTrigger]->setAxisTitle("#sigma_{obs}", 2);
188 
189  ibooker.setCurrentFolder("L1T/L1TRate/Delivered");
190  m_DelivLumiVsLS[tTrigger] =
191  ibooker.book1D(tCategory, "Algo: " + tTrigger + tErrorMessage, m_maxNbins, -0.5, double(m_maxNbins) - 0.5);
192  m_DelivLumiVsLS[tTrigger]->setAxisTitle("Lumi Section", 1);
193  m_DelivLumiVsLS[tTrigger]->setAxisTitle("Deliv. Lumi", 2);
194 
195  ibooker.setCurrentFolder("L1T/L1TRate/Recorded");
196  m_RecorLumiVsLS[tTrigger] =
197  ibooker.book1D(tCategory, "Algo: " + tTrigger + tErrorMessage, m_maxNbins, -0.5, double(m_maxNbins) - 0.5);
198  m_RecorLumiVsLS[tTrigger]->setAxisTitle("Lumi Section", 1);
199  m_RecorLumiVsLS[tTrigger]->setAxisTitle("Recor. Lumi", 2);
200 
201  ibooker.setCurrentFolder("L1T/L1TRate/Ratio");
202  m_xSecObservedToExpected[tTrigger] =
203  ibooker.book1D(tCategory, "Algo: " + tTrigger + tErrorMessage, m_maxNbins, -0.5, double(m_maxNbins) - 0.5);
204  m_xSecObservedToExpected[tTrigger]->setAxisTitle("Lumi Section", 1);
205  m_xSecObservedToExpected[tTrigger]->setAxisTitle("#sigma_{obs} / #sigma_{exp}", 2);
206  }
207 }
208 
209 //_____________________________________________________________________
211  if (m_verbose) {
212  cout << "[L1TRate_Offline:] Called beginLuminosityBlock at LS=" << lumiBlock.id().luminosityBlock() << endl;
213  }
214 }
215 
216 //_____________________________________________________________________
218  int eventLS = lumiBlock.id().luminosityBlock();
219  if (m_verbose) {
220  cout << "[L1TRate_Offline:] Called endLuminosityBlock at LS=" << eventLS << endl;
221  }
222 
223  // We can certify LS -1 since we should have available:
224  // gt rates: (current LS)-1
225  // prescale: current LS
226  // lumi : current LS
227  //eventLS--;
228 
229  // Checking if all necessary quantities are defined for our calculations
230  //bool isDefRate,isDefLumi,isDefPrescaleIndex;
231  bool isDefLumi, isDefPrescaleIndex;
232  //map<TString,double>* rates=0;
233  double lumi = 0;
234  double deadtime = 0;
235  unsigned int prescalesIndex = 0;
236 
237  bool isDefCount;
238  map<TString, double>* counts = nullptr;
239 
240  // Resetting MonitorElements so we can refill them
241  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
242  string tTrigger = (*i).second;
243  // m_DeadTimeVsLS [tTrigger]->getTH1()->Reset("ICE");
244  m_CountsVsLS[tTrigger]->getTH1()->Reset("ICE");
245  m_xSecObservedToExpected[tTrigger]->getTH1()->Reset("ICE");
246 
247  m_xSecObservedVsLS[tTrigger]->getTH1()->Reset("ICE");
248  m_DelivLumiVsLS[tTrigger]->getTH1()->Reset("ICE");
249  m_RecorLumiVsLS[tTrigger]->getTH1()->Reset("ICE");
250 
251  m_xSecObservedVsDelivLumi[tTrigger]->getTH1()->Reset("ICE");
252  m_xSecObservedVsRecorLumi[tTrigger]->getTH1()->Reset("ICE");
253  }
254 
255  //Trying to do the same with Counts....
256  for (map<int, map<TString, double> >::iterator j = m_lsRates.begin(); j != m_lsRates.end(); j++) {
257  unsigned int lsOffline = (*j).first;
258  counts = &(*j).second;
259  isDefCount = true;
260 
261  unsigned int lsPreInd;
262 
263  if (m_lsLuminosity.find(lsOffline) == m_lsLuminosity.end()) {
264  isDefLumi = false;
265  } else {
266  isDefLumi = true;
267  lumi = m_lsLuminosity[lsOffline];
268  deadtime = m_lsDeadTime[lsOffline];
269  }
270 
271  lsPreInd = lsOffline + 1; // NOTE: Workaround
272 
273  if (m_lsPrescaleIndex.find(lsPreInd) == m_lsPrescaleIndex.end()) {
274  isDefPrescaleIndex = false;
275  } else {
276  isDefPrescaleIndex = true;
277  prescalesIndex = m_lsPrescaleIndex[lsPreInd];
278  }
279 
280  if (isDefCount && isDefLumi && isDefPrescaleIndex && (prescalesIndex < m_listsPrescaleFactors->size())) {
281  const vector<int>& currentPrescaleFactors = (*m_listsPrescaleFactors).at(prescalesIndex);
282 
283  for (map<string, string>::const_iterator j = m_selectedTriggers.begin(); j != m_selectedTriggers.end(); j++) {
284  string tTrigger = (*j).second;
285  double trigCount = (*counts)[tTrigger];
286 
287  // TF1* tTestFunction = (TF1*) m_CountsVsLS[tTrigger]->getTProfile()->GetListOfFunctions()->First();
288  TF1* tTestFunction = m_algoFit[tTrigger]; // NOTE: Workaround....
289 
290  // If trigger name is defined we get the rate fit parameters
291  if (tTrigger != "Undefined") {
292  unsigned int trigBit = m_algoBit[tTrigger];
293  double trigPrescale = currentPrescaleFactors[trigBit];
294 
295  if (lumi != 0 && trigCount != 0 && trigPrescale != 0) {
296  double RecLumi = lumi * (1. - deadtime / 100.);
297 
298  double AlgoXSec = (trigPrescale * trigCount) / RecLumi;
299  double TemplateFunctionValue = tTestFunction->Eval(lumi);
300 
301  // Checking against Template function
302  // m_DeadTimeVsLS [tTrigger]->Fill(lumi,deadtime);
303 
304  m_xSecObservedVsRecorLumi[tTrigger]->Fill(RecLumi, AlgoXSec);
305 
306  m_CountsVsLS[tTrigger]->Fill(lumi, AlgoXSec);
307 
308  int ibin = m_xSecObservedToExpected[tTrigger]->getTH1()->FindBin(lsOffline);
309  m_xSecObservedToExpected[tTrigger]->setBinContent(ibin, AlgoXSec / TemplateFunctionValue);
310 
311  m_DelivLumiVsLS[tTrigger]->setBinContent(ibin, lumi);
312  m_RecorLumiVsLS[tTrigger]->setBinContent(ibin, RecLumi);
313 
314  m_xSecObservedVsLS[tTrigger]->setBinContent(ibin, AlgoXSec);
315 
316  } else {
317  // m_DeadTimeVsLS [tTrigger]->Fill(0.000001,0.000001);
318 
319  m_xSecObservedVsRecorLumi[tTrigger]->Fill(0.000001, 0.000001);
320 
321  m_CountsVsLS[tTrigger]->Fill(0.000001, 0.000001);
322 
323  int ibin = m_xSecObservedToExpected[tTrigger]->getTH1()->FindBin(lsOffline);
324  m_xSecObservedToExpected[tTrigger]->setBinContent(ibin, 0.000001);
325 
326  m_DelivLumiVsLS[tTrigger]->setBinContent(ibin, 0.000001);
327  m_RecorLumiVsLS[tTrigger]->setBinContent(ibin, 0.000001);
328 
329  m_xSecObservedVsLS[tTrigger]->setBinContent(ibin, 0.000001);
330  }
331  }
332  }
333  }
334  }
335 }
336 
337 //_____________________________________________________________________
339  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
342 
343  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
344  iEvent.getByToken(m_scalersSource_LSCollection, colLScal);
345  iEvent.getByToken(m_scalersSource_L1TSCollection, triggerScalers);
346 
347  // Integers
348  int EventRun = iEvent.id().run();
349  unsigned int eventLS = iEvent.id().luminosityBlock();
350 
351  // Getting the trigger trigger rates from GT and buffering it
352  if (triggerScalers.isValid() && !triggerScalers->empty()) {
353  Level1TriggerScalersCollection::const_iterator itL1TScalers = triggerScalers->begin();
354  Level1TriggerRates trigRates(*itL1TScalers, EventRun);
355 
356  //Trying to retrieve GT DeadTime
357  //unsigned long long deadtime = itL1TScalers->deadtime();
358  //double deadtime = itL1TScalers->deadtime();
359  double deadtime = trigRates.deadtimePercent(); //correct DeadTime % to retrieve
360 
361  // Trying to get the trigger counts
362  const std::vector<unsigned int> gtAlgoCounts = itL1TScalers->gtAlgoCounts();
363 
364  // int lumisegment = (*itL1TScalers).lumiSegmentNr();
365 
366  // cout << "deadtime =" << deadtime << " --
367  // cout << "lumisegment = " << lumisegment << endl;
368 
369  int gtLS = (*itL1TScalers).lumiSegmentNr() + m_lsShiftGTRates;
370 
371  // If we haven't got the data from this LS yet get it
372  if (m_lsRates.find(gtLS) == m_lsRates.end()) {
373  map<TString, double> bufferCount;
374 
375  // Buffer the rate informations for all selected bits
376  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
377  string tTrigger = (*i).second;
378 
379  // If trigger name is defined we store the rate
380  if (tTrigger != "Undefined") {
381  unsigned int trigBit = m_algoBit[tTrigger];
382  double trigCount = gtAlgoCounts[trigBit];
383 
384  bufferCount[tTrigger] = trigCount;
385  }
386  }
387  m_lsRates[gtLS] = bufferCount;
388  m_lsDeadTime[gtLS] = deadtime;
389  }
390  }
391 
392  // Getting from the SCAL the luminosity information and buffering it
393  if (colLScal.isValid() && !colLScal->empty()) {
394  LumiScalersCollection::const_iterator itLScal = colLScal->begin();
395  unsigned int scalLS = itLScal->sectionNumber();
396 
397  // If we haven't got the data from this SCAL LS yet get it
398  if (m_lsLuminosity.find(scalLS) == m_lsLuminosity.end()) {
399  if (m_verbose) {
400  cout << "[L1TRate_Offline:] Buffering SCAL-HF Lumi for LS=" << scalLS << endl;
401  }
402  double instLumi =
403  itLScal->instantLumi(); // Getting Instant Lumi from HF (via SCAL) // <###### WE NEED TO STORE THIS
404  double deadTimeNormHF = itLScal->deadTimeNormalization(); // Getting Dead Time Normalization from HF (via SCAL)
405 
406  // double mylumiFill = itLScal->lumiFill(); // Integrated lumi since beginning of fill, delivered
407  // double mylumiRun = itLScal->lumiRun(); // Integrated lumi since beginning of run, delivered
408  // double myliveLumiFill = itLScal->liveLumiFill(); // Integrated lumi since beginning of fill, live
409  // double myliveLumiRun = itLScal->liveLumiRun(); // Integrated lumi since beginning of run, live
410  // double mysectionNumber = itLScal->sectionNumber(); // Lumi section number for this info
411  // double mynumOrbits = itLScal->numOrbits(); // Number of orbits that have passed this run
412 
413  // cout << "instantLumi = " << instLumi << endl;
414  // cout << "lumiFill = " << mylumiFill << endl;
415  // cout << "lumiRun = " << mylumiRun << endl;
416  // cout << "livelumiFill = " << myliveLumiFill << endl;
417  // cout << "livelumiRun = " << myliveLumiRun << endl;
418  // cout << "sectionNumber = " << mysectionNumber << endl;
419  // cout << "numOrbits = " << mynumOrbits << endl;
420 
421  // If HF Dead Time Corrections is requested we apply it
422  // NOTE: By default this is assumed false since for now WbM fits do NOT assume this correction
423  if (m_parameters.getUntrackedParameter<bool>("useHFDeadTimeNormalization", false)) {
424  // Protecting for deadtime = 0
425  if (deadTimeNormHF == 0) {
426  instLumi = 0;
427  } else {
428  instLumi = instLumi / deadTimeNormHF;
429  }
430  }
431  // Buffering the luminosity information
432  m_lsLuminosity[scalLS] = instLumi;
433  }
434  }
435 
436  // Getting the prescale index used when this event was triggered
437  if (gtReadoutRecordData.isValid()) {
438  // If we haven't got the data from this LS yet get it
439  if (m_lsPrescaleIndex.find(eventLS) == m_lsPrescaleIndex.end()) {
440  if (m_verbose) {
441  cout << "[L1TRate_Offline:] Buffering Prescale Index for LS=" << eventLS << endl;
442  }
443 
444  // Getting Final Decision Logic (FDL) Data from GT
445  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
446 
447  // Getting the index for the fdl data for this event
448  int indexFDL = 0;
449  for (unsigned int i = 0; i < gtFdlVectorData.size(); i++) {
450  if (gtFdlVectorData[i].bxInEvent() == 0) {
451  indexFDL = i;
452  break;
453  }
454  }
455 
456  if (!gtFdlVectorData.empty()) {
457  int CurrentPrescalesIndex =
458  gtFdlVectorData[indexFDL].gtPrescaleFactorIndexAlgo(); // <###### WE NEED TO STORE THIS
459  m_lsPrescaleIndex[eventLS] = CurrentPrescalesIndex;
460  }
461  }
462  }
463 }
464 
465 //_____________________________________________________________________
466 // function: getXSexFitsPython
467 // Imputs:
468 // * const edm::ParameterSet& ps = ParameterSet contaning the fit
469 // functions and parameters for the selected triggers
470 // Outputs:
471 // * int error = Number of algos where you did not find a
472 // corresponding fit
473 //_____________________________________________________________________
475  // error meaning
476  bool noError = true;
477 
478  // Getting fit parameters
479  std::vector<edm::ParameterSet> m_fitParameters = ps.getParameter<vector<ParameterSet> >("fitParameters");
480 
481  double minInstantLuminosity = m_parameters.getParameter<double>("minInstantLuminosity");
482  double maxInstantLuminosity = m_parameters.getParameter<double>("maxInstantLuminosity");
483 
484  // Getting rate fit parameters for all input triggers
485  for (map<string, string>::const_iterator a = m_selectedTriggers.begin(); a != m_selectedTriggers.end(); a++) {
486  string tTrigger = (*a).second;
487 
488  // If trigger name is defined we get the rate fit parameters
489  if (tTrigger != "Undefined") {
490  bool foundFit = false;
491 
492  for (unsigned int b = 0; b < m_fitParameters.size(); b++) {
493  if (tTrigger == m_fitParameters[b].getParameter<string>("AlgoName")) {
494  TString tAlgoName = m_fitParameters[b].getParameter<string>("AlgoName");
495  TString tTemplateFunction = m_fitParameters[b].getParameter<string>("TemplateFunction");
496  vector<double> tParameters = m_fitParameters[b].getParameter<vector<double> >("Parameters");
497 
498  // Retriving and populating the m_templateFunctions array
499  m_templateFunctions[tTrigger] =
500  new TF1("FitParametrization_" + tAlgoName, tTemplateFunction, minInstantLuminosity, maxInstantLuminosity);
501  m_templateFunctions[tTrigger]->SetParameters(&tParameters[0]);
502  m_templateFunctions[tTrigger]->SetLineWidth(1);
503  m_templateFunctions[tTrigger]->SetLineColor(kRed);
504 
505  foundFit = true;
506  break;
507  }
508  }
509 
510  if (!foundFit) {
511  noError = false;
512 
513  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_PY_MISSING_FIT);
514  eCount++;
515  m_ErrorMonitor->getTH1()->SetBinContent(WARNING_PY_MISSING_FIT, eCount);
516  }
517  }
518  }
519 
520  return noError;
521 }
522 
523 //define this as a plug-in
size
Write out results.
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
LuminosityBlockNumber_t luminosityBlock() const
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void retrieveL1EventSetup(const edm::EventSetup &, bool isRun=true)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
Definition: L1GtUtils.cc:128
edm::EDGetTokenT< Level1TriggerScalersCollection > m_scalersSource_L1TSCollection
MonitorElement * m_ErrorMonitor
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::map< int, double > m_lsDeadTime
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::map< TString, MonitorElement * > m_xSecObservedToExpected
std::map< int, int > m_lsPrescaleIndex
std::map< std::string, bool > m_inputCategories
double deadtimePercent() const
std::map< std::string, std::string > m_selectedTriggers
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
std::map< int, std::map< TString, double > > m_lsRates
bool getXSexFitsPython(const edm::ParameterSet &ps)
const edm::ESGetToken< L1GtPrescaleFactors, L1GtPrescaleFactorsAlgoTrigRcd > m_l1GtPfAlgoToken
std::map< TString, MonitorElement * > m_xSecObservedVsLS
void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
T getUntrackedParameter(std::string const &, T const &) const
void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
std::map< TString, MonitorElement * > m_xSecObservedVsDelivLumi
std::map< int, double > m_lsLuminosity
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
edm::ParameterSet m_parameters
int iEvent
Definition: GenABIO.cc:224
L1TMenuHelper::Tokens m_helperTokens
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:408
std::map< TString, MonitorElement * > m_RecorLumiVsLS
std::map< TString, TF1 * > m_templateFunctions
L1TRate_Offline(const edm::ParameterSet &ps)
~L1TRate_Offline() override
std::map< TString, MonitorElement * > m_DelivLumiVsLS
Transition
Definition: Transition.h:12
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
unsigned int getQualityAlias(const TString &iCategory, const TString &iAlias)
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)
std::map< TString, int > m_algoBit
std::map< TString, TF1 * > m_algoFit
const std::vector< std::vector< int > > * m_listsPrescaleFactors
void analyze(const edm::Event &e, const edm::EventSetup &c) override
LuminosityBlockID id() const
L1GtUtils m_l1GtUtils
double b
Definition: hdecay.h:120
bool isValid() const
Definition: HandleBase.h:70
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
HLT enums.
std::map< TString, MonitorElement * > m_CountsVsLS
edm::EDGetTokenT< LumiScalersCollection > m_scalersSource_LSCollection
double a
Definition: hdecay.h:121
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
unsigned int getEtaRangeByAlias(const TString &iCategory, const TString &iAlias)
std::map< TString, MonitorElement * > m_xSecObservedVsRecorLumi
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > m_menuToken
int getPrescaleByAlias(const TString &iCategory, const TString &iAlias)
Definition: Run.h:45
std::map< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors, L1GtUtils const &myUtils)