CMS 3D CMS Logo

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