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 //_____________________________________________________________________
61 void L1TRate_Offline::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) {
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,
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,
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,
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 //_____________________________________________________________________
214  if (m_verbose) {
215  cout << "[L1TRate_Offline:] Called beginLuminosityBlock at LS=" << lumiBlock.id().luminosityBlock() << endl;
216  }
217 }
218 
219 //_____________________________________________________________________
221  int eventLS = lumiBlock.id().luminosityBlock();
222  if (m_verbose) {
223  cout << "[L1TRate_Offline:] Called endLuminosityBlock at LS=" << eventLS << endl;
224  }
225 
226  // We can certify LS -1 since we should have available:
227  // gt rates: (current LS)-1
228  // prescale: current LS
229  // lumi : current LS
230  //eventLS--;
231 
232  // Checking if all necessary quantities are defined for our calculations
233  //bool isDefRate,isDefLumi,isDefPrescaleIndex;
234  bool isDefLumi, isDefPrescaleIndex;
235  //map<TString,double>* rates=0;
236  double lumi = 0;
237  double deadtime = 0;
238  unsigned int prescalesIndex = 0;
239 
240  bool isDefCount;
241  map<TString, double>* counts = nullptr;
242 
243  // Resetting MonitorElements so we can refill them
244  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
245  string tTrigger = (*i).second;
246  // m_DeadTimeVsLS [tTrigger]->getTH1()->Reset("ICE");
247  m_CountsVsLS[tTrigger]->getTH1()->Reset("ICE");
248  m_xSecObservedToExpected[tTrigger]->getTH1()->Reset("ICE");
249 
250  m_xSecObservedVsLS[tTrigger]->getTH1()->Reset("ICE");
251  m_DelivLumiVsLS[tTrigger]->getTH1()->Reset("ICE");
252  m_RecorLumiVsLS[tTrigger]->getTH1()->Reset("ICE");
253 
254  m_xSecObservedVsDelivLumi[tTrigger]->getTH1()->Reset("ICE");
255  m_xSecObservedVsRecorLumi[tTrigger]->getTH1()->Reset("ICE");
256  }
257 
258  //Trying to do the same with Counts....
259  for (map<int, map<TString, double> >::iterator j = m_lsRates.begin(); j != m_lsRates.end(); j++) {
260  unsigned int lsOffline = (*j).first;
261  counts = &(*j).second;
262  isDefCount = true;
263 
264  unsigned int lsPreInd;
265 
266  if (m_lsLuminosity.find(lsOffline) == m_lsLuminosity.end()) {
267  isDefLumi = false;
268  } else {
269  isDefLumi = true;
270  lumi = m_lsLuminosity[lsOffline];
271  deadtime = m_lsDeadTime[lsOffline];
272  }
273 
274  lsPreInd = lsOffline + 1; // NOTE: Workaround
275 
276  if (m_lsPrescaleIndex.find(lsPreInd) == m_lsPrescaleIndex.end()) {
277  isDefPrescaleIndex = false;
278  } else {
279  isDefPrescaleIndex = true;
280  prescalesIndex = m_lsPrescaleIndex[lsPreInd];
281  }
282 
283  if (isDefCount && isDefLumi && isDefPrescaleIndex && (prescalesIndex < m_listsPrescaleFactors->size())) {
284  const vector<int>& currentPrescaleFactors = (*m_listsPrescaleFactors).at(prescalesIndex);
285 
286  for (map<string, string>::const_iterator j = m_selectedTriggers.begin(); j != m_selectedTriggers.end(); j++) {
287  string tTrigger = (*j).second;
288  double trigCount = (*counts)[tTrigger];
289 
290  // TF1* tTestFunction = (TF1*) m_CountsVsLS[tTrigger]->getTProfile()->GetListOfFunctions()->First();
291  TF1* tTestFunction = m_algoFit[tTrigger]; // NOTE: Workaround....
292 
293  // If trigger name is defined we get the rate fit parameters
294  if (tTrigger != "Undefined") {
295  unsigned int trigBit = m_algoBit[tTrigger];
296  double trigPrescale = currentPrescaleFactors[trigBit];
297 
298  if (lumi != 0 && trigCount != 0 && trigPrescale != 0) {
299  double RecLumi = lumi * (1. - deadtime / 100.);
300 
301  double AlgoXSec = (trigPrescale * trigCount) / RecLumi;
302  double TemplateFunctionValue = tTestFunction->Eval(lumi);
303 
304  // Checking against Template function
305  // m_DeadTimeVsLS [tTrigger]->Fill(lumi,deadtime);
306 
307  m_xSecObservedVsRecorLumi[tTrigger]->Fill(RecLumi, AlgoXSec);
308 
309  m_CountsVsLS[tTrigger]->Fill(lumi, AlgoXSec);
310 
311  int ibin = m_xSecObservedToExpected[tTrigger]->getTH1()->FindBin(lsOffline);
312  m_xSecObservedToExpected[tTrigger]->setBinContent(ibin, AlgoXSec / TemplateFunctionValue);
313 
314  m_DelivLumiVsLS[tTrigger]->setBinContent(ibin, lumi);
315  m_RecorLumiVsLS[tTrigger]->setBinContent(ibin, RecLumi);
316 
317  m_xSecObservedVsLS[tTrigger]->setBinContent(ibin, AlgoXSec);
318 
319  } else {
320  // m_DeadTimeVsLS [tTrigger]->Fill(0.000001,0.000001);
321 
322  m_xSecObservedVsRecorLumi[tTrigger]->Fill(0.000001, 0.000001);
323 
324  m_CountsVsLS[tTrigger]->Fill(0.000001, 0.000001);
325 
326  int ibin = m_xSecObservedToExpected[tTrigger]->getTH1()->FindBin(lsOffline);
327  m_xSecObservedToExpected[tTrigger]->setBinContent(ibin, 0.000001);
328 
329  m_DelivLumiVsLS[tTrigger]->setBinContent(ibin, 0.000001);
330  m_RecorLumiVsLS[tTrigger]->setBinContent(ibin, 0.000001);
331 
332  m_xSecObservedVsLS[tTrigger]->setBinContent(ibin, 0.000001);
333  }
334  }
335  }
336  }
337  }
338 }
339 
340 //_____________________________________________________________________
341 void L1TRate_Offline::analyze(const Event& iEvent, const EventSetup& eventSetup) {
342  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
345 
346  iEvent.getByToken(m_l1GtDataDaqInputTag, gtReadoutRecordData);
347  iEvent.getByToken(m_scalersSource_LSCollection, colLScal);
348  iEvent.getByToken(m_scalersSource_L1TSCollection, triggerScalers);
349 
350  // Integers
351  int EventRun = iEvent.id().run();
352  unsigned int eventLS = iEvent.id().luminosityBlock();
353 
354  // Getting the trigger trigger rates from GT and buffering it
355  if (triggerScalers.isValid() && !triggerScalers->empty()) {
356  Level1TriggerScalersCollection::const_iterator itL1TScalers = triggerScalers->begin();
357  Level1TriggerRates trigRates(*itL1TScalers, EventRun);
358 
359  //Trying to retrieve GT DeadTime
360  //unsigned long long deadtime = itL1TScalers->deadtime();
361  //double deadtime = itL1TScalers->deadtime();
362  double deadtime = trigRates.deadtimePercent(); //correct DeadTime % to retrieve
363 
364  // Trying to get the trigger counts
365  const std::vector<unsigned int> gtAlgoCounts = itL1TScalers->gtAlgoCounts();
366 
367  // int lumisegment = (*itL1TScalers).lumiSegmentNr();
368 
369  // cout << "deadtime =" << deadtime << " --
370  // cout << "lumisegment = " << lumisegment << endl;
371 
372  int gtLS = (*itL1TScalers).lumiSegmentNr() + m_lsShiftGTRates;
373 
374  // If we haven't got the data from this LS yet get it
375  if (m_lsRates.find(gtLS) == m_lsRates.end()) {
376  map<TString, double> bufferCount;
377 
378  // Buffer the rate informations for all selected bits
379  for (map<string, string>::const_iterator i = m_selectedTriggers.begin(); i != m_selectedTriggers.end(); i++) {
380  string tTrigger = (*i).second;
381 
382  // If trigger name is defined we store the rate
383  if (tTrigger != "Undefined") {
384  unsigned int trigBit = m_algoBit[tTrigger];
385  double trigCount = gtAlgoCounts[trigBit];
386 
387  bufferCount[tTrigger] = trigCount;
388  }
389  }
390  m_lsRates[gtLS] = bufferCount;
391  m_lsDeadTime[gtLS] = deadtime;
392  }
393  }
394 
395  // Getting from the SCAL the luminosity information and buffering it
396  if (colLScal.isValid() && !colLScal->empty()) {
397  LumiScalersCollection::const_iterator itLScal = colLScal->begin();
398  unsigned int scalLS = itLScal->sectionNumber();
399 
400  // If we haven't got the data from this SCAL LS yet get it
401  if (m_lsLuminosity.find(scalLS) == m_lsLuminosity.end()) {
402  if (m_verbose) {
403  cout << "[L1TRate_Offline:] Buffering SCAL-HF Lumi for LS=" << scalLS << endl;
404  }
405  double instLumi =
406  itLScal->instantLumi(); // Getting Instant Lumi from HF (via SCAL) // <###### WE NEED TO STORE THIS
407  double deadTimeNormHF = itLScal->deadTimeNormalization(); // Getting Dead Time Normalization from HF (via SCAL)
408 
409  // double mylumiFill = itLScal->lumiFill(); // Integrated lumi since beginning of fill, delivered
410  // double mylumiRun = itLScal->lumiRun(); // Integrated lumi since beginning of run, delivered
411  // double myliveLumiFill = itLScal->liveLumiFill(); // Integrated lumi since beginning of fill, live
412  // double myliveLumiRun = itLScal->liveLumiRun(); // Integrated lumi since beginning of run, live
413  // double mysectionNumber = itLScal->sectionNumber(); // Lumi section number for this info
414  // double mynumOrbits = itLScal->numOrbits(); // Number of orbits that have passed this run
415 
416  // cout << "instantLumi = " << instLumi << endl;
417  // cout << "lumiFill = " << mylumiFill << endl;
418  // cout << "lumiRun = " << mylumiRun << endl;
419  // cout << "livelumiFill = " << myliveLumiFill << endl;
420  // cout << "livelumiRun = " << myliveLumiRun << endl;
421  // cout << "sectionNumber = " << mysectionNumber << endl;
422  // cout << "numOrbits = " << mynumOrbits << endl;
423 
424  // If HF Dead Time Corrections is requested we apply it
425  // NOTE: By default this is assumed false since for now WbM fits do NOT assume this correction
426  if (m_parameters.getUntrackedParameter<bool>("useHFDeadTimeNormalization", false)) {
427  // Protecting for deadtime = 0
428  if (deadTimeNormHF == 0) {
429  instLumi = 0;
430  } else {
431  instLumi = instLumi / deadTimeNormHF;
432  }
433  }
434  // Buffering the luminosity information
435  m_lsLuminosity[scalLS] = instLumi;
436  }
437  }
438 
439  // Getting the prescale index used when this event was triggered
440  if (gtReadoutRecordData.isValid()) {
441  // If we haven't got the data from this LS yet get it
442  if (m_lsPrescaleIndex.find(eventLS) == m_lsPrescaleIndex.end()) {
443  if (m_verbose) {
444  cout << "[L1TRate_Offline:] Buffering Prescale Index for LS=" << eventLS << endl;
445  }
446 
447  // Getting Final Decision Logic (FDL) Data from GT
448  const vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
449 
450  // Getting the index for the fdl data for this event
451  int indexFDL = 0;
452  for (unsigned int i = 0; i < gtFdlVectorData.size(); i++) {
453  if (gtFdlVectorData[i].bxInEvent() == 0) {
454  indexFDL = i;
455  break;
456  }
457  }
458 
459  if (!gtFdlVectorData.empty()) {
460  int CurrentPrescalesIndex =
461  gtFdlVectorData[indexFDL].gtPrescaleFactorIndexAlgo(); // <###### WE NEED TO STORE THIS
462  m_lsPrescaleIndex[eventLS] = CurrentPrescalesIndex;
463  }
464  }
465  }
466 }
467 
468 //_____________________________________________________________________
469 // function: getXSexFitsPython
470 // Imputs:
471 // * const edm::ParameterSet& ps = ParameterSet contaning the fit
472 // functions and parameters for the selected triggers
473 // Outputs:
474 // * int error = Number of algos where you did not find a
475 // corresponding fit
476 //_____________________________________________________________________
478  // error meaning
479  bool noError = true;
480 
481  // Getting fit parameters
482  std::vector<edm::ParameterSet> m_fitParameters = ps.getParameter<vector<ParameterSet> >("fitParameters");
483 
484  double minInstantLuminosity = m_parameters.getParameter<double>("minInstantLuminosity");
485  double maxInstantLuminosity = m_parameters.getParameter<double>("maxInstantLuminosity");
486 
487  // Getting rate fit parameters for all input triggers
488  for (map<string, string>::const_iterator a = m_selectedTriggers.begin(); a != m_selectedTriggers.end(); a++) {
489  string tTrigger = (*a).second;
490 
491  // If trigger name is defined we get the rate fit parameters
492  if (tTrigger != "Undefined") {
493  bool foundFit = false;
494 
495  for (unsigned int b = 0; b < m_fitParameters.size(); b++) {
496  if (tTrigger == m_fitParameters[b].getParameter<string>("AlgoName")) {
497  TString tAlgoName = m_fitParameters[b].getParameter<string>("AlgoName");
498  TString tTemplateFunction = m_fitParameters[b].getParameter<string>("TemplateFunction");
499  vector<double> tParameters = m_fitParameters[b].getParameter<vector<double> >("Parameters");
500 
501  // Retriving and populating the m_templateFunctions array
502  m_templateFunctions[tTrigger] =
503  new TF1("FitParametrization_" + tAlgoName, tTemplateFunction, minInstantLuminosity, maxInstantLuminosity);
504  m_templateFunctions[tTrigger]->SetParameters(&tParameters[0]);
505  m_templateFunctions[tTrigger]->SetLineWidth(1);
506  m_templateFunctions[tTrigger]->SetLineColor(kRed);
507 
508  foundFit = true;
509  break;
510  }
511 
512  if (!foundFit) {
513  noError = false;
514 
515  int eCount = m_ErrorMonitor->getTH1()->GetBinContent(WARNING_PY_MISSING_FIT);
516  eCount++;
517  m_ErrorMonitor->getTH1()->SetBinContent(WARNING_PY_MISSING_FIT, eCount);
518  }
519  }
520  }
521  }
522 
523  return noError;
524 }
525 
526 //define this as a plug-in
L1TRate_Offline::m_RecorLumiVsLS
std::map< TString, MonitorElement * > m_RecorLumiVsLS
Definition: L1TRate_Offline.h:103
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
L1GtTriggerMenu.h
mps_fire.i
i
Definition: mps_fire.py:355
L1GtPrescaleFactors
Definition: L1GtPrescaleFactors.h:32
L1TSync_cfi.Categories
Categories
Definition: L1TSync_cfi.py:26
L1TRate_Offline::~L1TRate_Offline
~L1TRate_Offline() override
Definition: L1TRate_Offline.cc:56
L1TRate_Offline::m_algoFit
std::map< TString, TF1 * > m_algoFit
Definition: L1TRate_Offline.h:87
L1GtTriggerMaskAlgoTrigRcd.h
funct::false
false
Definition: Factorize.h:34
L1GtTriggerMask.h
L1TRate_Offline::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: L1TRate_Offline.cc:341
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
L1TRate_Offline::m_verbose
bool m_verbose
Definition: L1TRate_Offline.h:68
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
L1GtTriggerMenuRcd.h
gather_cfg.cout
cout
Definition: gather_cfg.py:144
L1TRate_Offline::m_l1GtUtils
L1GtUtils m_l1GtUtils
Definition: L1TRate_Offline.h:120
L1TRate_Offline::m_listsPrescaleFactors
const std::vector< std::vector< int > > * m_listsPrescaleFactors
Definition: L1TRate_Offline.h:79
L1TRate_cfi.minInstantLuminosity
minInstantLuminosity
Definition: L1TRate_cfi.py:28
L1GtPrescaleFactors::gtPrescaleFactors
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
Definition: L1GtPrescaleFactors.h:45
L1TRate_Offline::m_algoBit
std::map< TString, int > m_algoBit
Definition: L1TRate_Offline.h:86
L1TRate_Offline::bookHistograms
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &iSetup) override
Definition: L1TRate_Offline.cc:61
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
L1TMenuHelper::getQualityAlias
unsigned int getQualityAlias(const TString &iCategory, const TString &iAlias)
Definition: L1TMenuHelper.cc:754
tools.TF1
TF1
Definition: tools.py:23
L1TRate_Offline::m_CountsVsLS
std::map< TString, MonitorElement * > m_CountsVsLS
Definition: L1TRate_Offline.h:96
edm::Handle
Definition: AssociativeIterator.h:50
L1TMenuHelper::getPrescaleByAlias
int getPrescaleByAlias(const TString &iCategory, const TString &iAlias)
Definition: L1TMenuHelper.cc:604
L1TRate_Offline::m_maxNbins
int m_maxNbins
Definition: L1TRate_Offline.h:72
cmsdt::algo
algo
Definition: constants.h:164
L1TRate_Offline::m_scalersSource_LSCollection
edm::EDGetTokenT< LumiScalersCollection > m_scalersSource_LSCollection
Definition: L1TRate_Offline.h:110
Level1TriggerRates
Definition: Level1TriggerRates.h:30
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
CItAlgo
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
Definition: L1GtTriggerMenuFwd.h:38
L1TRate_Offline::m_xSecObservedVsRecorLumi
std::map< TString, MonitorElement * > m_xSecObservedVsRecorLumi
Definition: L1TRate_Offline.h:94
L1TRate_Offline::m_lsShiftGTRates
int m_lsShiftGTRates
Definition: L1TRate_Offline.h:73
L1GtTriggerMenuRcd
Definition: L1GtTriggerMenuRcd.h:32
edm::ESHandle< L1GtTriggerMenu >
b
double b
Definition: hdecay.h:118
dqm::impl::MonitorElement::getTH1
virtual TH1 * getTH1()
Definition: MonitorElement.cc:969
L1TMenuHelper
Definition: L1TMenuHelper.h:79
optionsL1T.menu
menu
Definition: optionsL1T.py:29
edm::ParameterSet
Definition: ParameterSet.h:36
a
double a
Definition: hdecay.h:119
L1GtTriggerMenu
Definition: L1GtTriggerMenu.h:48
L1TRate_Offline::m_lsDeadTime
std::map< int, double > m_lsDeadTime
Definition: L1TRate_Offline.h:82
L1TRate_Offline::m_scalersSource_L1TSCollection
edm::EDGetTokenT< Level1TriggerScalersCollection > m_scalersSource_L1TSCollection
Definition: L1TRate_Offline.h:111
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LuminosityBlockID::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockID.h:42
edm::LuminosityBlockBase::id
LuminosityBlockID id() const
Definition: LuminosityBlockBase.h:44
dqm::impl::MonitorElement::setBinLabel
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)
Definition: MonitorElement.cc:771
L1GtPrescaleFactorsAlgoTrigRcd.h
L1GtUtils::retrieveL1EventSetup
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:127
L1TRate_Offline::m_ErrorMonitor
MonitorElement * m_ErrorMonitor
Definition: L1TRate_Offline.h:118
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
get
#define get
muonGEMDigis_cfi.instLumi
instLumi
Definition: muonGEMDigis_cfi.py:10
L1TRate_Offline::m_xSecObservedToExpected
std::map< TString, MonitorElement * > m_xSecObservedToExpected
Definition: L1TRate_Offline.h:90
L1TRate_cfi.maxInstantLuminosity
maxInstantLuminosity
Definition: L1TRate_cfi.py:29
L1TRate_Offline::m_inputCategories
std::map< std::string, bool > m_inputCategories
Definition: L1TRate_Offline.h:88
L1TRate_Offline::m_selectedTriggers
std::map< std::string, std::string > m_selectedTriggers
Definition: L1TRate_Offline.h:89
L1TMenuHelper.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
std
Definition: JetResolutionObject.h:76
L1TRate_Offline::WARNING_PY_MISSING_FIT
Definition: L1TRate_Offline.h:46
writedatasetfile.run
run
Definition: writedatasetfile.py:27
L1TRate_Offline::m_lsRates
std::map< int, std::map< TString, double > > m_lsRates
Definition: L1TRate_Offline.h:85
L1TMenuHelper::getLUSOTrigger
std::map< std::string, std::string > getLUSOTrigger(const std::map< std::string, bool > &iCategories, int IndexRefPrescaleFactors, L1GtUtils const &myUtils)
Definition: L1TMenuHelper.cc:57
L1TRate_Offline::m_lsPrescaleIndex
std::map< int, int > m_lsPrescaleIndex
Definition: L1TRate_Offline.h:83
L1TRate_Offline::m_xSecObservedVsLS
std::map< TString, MonitorElement * > m_xSecObservedVsLS
Definition: L1TRate_Offline.h:101
L1TRate_Offline.h
dqmiodumpmetadata.counts
counts
Definition: dqmiodumpmetadata.py:25
L1TRate_Offline::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
Definition: L1TRate_Offline.cc:220
L1TMenuHelper::getEtaRangeByAlias
unsigned int getEtaRangeByAlias(const TString &iCategory, const TString &iAlias)
Definition: L1TMenuHelper.cc:679
Level1TriggerRates::deadtimePercent
double deadtimePercent() const
Definition: Level1TriggerRates.h:83
L1TRate_Offline::m_l1GtDataDaqInputTag
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputTag
Definition: L1TRate_Offline.h:112
L1TRate_Offline::m_parameters
edm::ParameterSet m_parameters
Definition: L1TRate_Offline.h:115
L1TRate_Offline::getXSexFitsPython
bool getXSexFitsPython(const edm::ParameterSet &ps)
Definition: L1TRate_Offline.cc:477
L1TRate_Offline::m_refPrescaleSet
int m_refPrescaleSet
Definition: L1TRate_Offline.h:71
genParticles_cff.map
map
Definition: genParticles_cff.py:11
L1GtTriggerMenuFwd.h
L1TRate_Offline
Definition: L1TRate_Offline.h:44
L1GtPrescaleFactorsAlgoTrigRcd
Definition: L1GtPrescaleFactorsAlgoTrigRcd.h:38
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
L1TRate_Offline::m_xSecObservedVsDelivLumi
std::map< TString, MonitorElement * > m_xSecObservedVsDelivLumi
Definition: L1TRate_Offline.h:93
L1TRate_Offline::beginLuminosityBlock
void beginLuminosityBlock(edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c) override
Definition: L1TRate_Offline.cc:213
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
L1TRate_Offline::UNKNOWN
Definition: L1TRate_Offline.h:46
lumi
Definition: LumiSectionData.h:20
L1TRate_Offline::m_templateFunctions
std::map< TString, TF1 * > m_templateFunctions
Definition: L1TRate_Offline.h:105
L1TRate_Offline::m_lsLuminosity
std::map< int, double > m_lsLuminosity
Definition: L1TRate_Offline.h:84
edm::InputTag
Definition: InputTag.h:15
L1TRate_Offline::m_DelivLumiVsLS
std::map< TString, MonitorElement * > m_DelivLumiVsLS
Definition: L1TRate_Offline.h:102
L1GtPrescaleFactors.h
L1TRate_Offline::L1TRate_Offline
L1TRate_Offline(const edm::ParameterSet &ps)
Definition: L1TRate_Offline.cc:19
L1GlobalTriggerReadoutRecord::gtFdlVector
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
Definition: L1GlobalTriggerReadoutRecord.h:119
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443