CMS 3D CMS Logo

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