CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrigResRateMon.cc
Go to the documentation of this file.
1 // See header file for information.
2 #include "TMath.h"
3 #include "TString.h"
7 
8 #include <map>
9 #include <utility>
10 
11 
12 using namespace edm;
13 using namespace trigger;
14 using namespace std;
15 
16 TrigResRateMon::TrigResRateMon(const edm::ParameterSet& iConfig): currentRun_(-99)
17 {
18 
19  LogDebug("TrigResRateMon") << "constructor...." ;
20 
21  fIsSetup = false;
22 
24  if ( ! dbe_ ) {
25  LogInfo("TrigResRateMon") << "unabel to get DQMStore service?";
26  }
27  if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
28  dbe_->setVerbose(0);
29  }
30 
31  dirname_ = iConfig.getUntrackedParameter("dirname", std::string("HLT/TrigResults/"));
32  //dirname_ += iConfig.getParameter<std::string>("@module_label");
33 
34  if (dbe_ != 0 ) {
36  }
37 
38  doCombineRuns_ = iConfig.getUntrackedParameter<bool>("doCombineRuns", false);
39  doVBTFMuon_ = iConfig.getUntrackedParameter<bool>("doVBTFMuon", true);
40 
41  processname_ = iConfig.getParameter<std::string>("processname");
42  fCustomBXPath = iConfig.getUntrackedParameter<std::string>("customBXPath", std::string("HLT_MinBiasBSC"));
43 
44  referenceBX_ = iConfig.getUntrackedParameter<unsigned int>("referenceBX",51);
45  Nbx_ = iConfig.getUntrackedParameter<unsigned int>("Nbx",3564);
46 
47  // plotting paramters
48  ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
49  ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",1000.);
50  nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",20);
51  nBins2D_ = iConfig.getUntrackedParameter<unsigned int>("Nbins2D",40);
52  dRMax_ = iConfig.getUntrackedParameter<double>("dRMax",1.0);
53  dRMaxElectronMuon_ = iConfig.getUntrackedParameter<double>("dRMaxElectronMuon",0.3);
54  nBinsDR_ = iConfig.getUntrackedParameter<unsigned int>("NbinsDR",10);
55  nBinsOneOverEt_ = iConfig.getUntrackedParameter<unsigned int>("NbinsOneOverEt",10000);
56  nLS_ = iConfig.getUntrackedParameter<unsigned int>("NLuminositySegments",10);
57  LSsize_ = iConfig.getUntrackedParameter<double>("LuminositySegmentSize",23);
58  thresholdFactor_ = iConfig.getUntrackedParameter<double>("thresholdFactor",1.0);
59 
60 
61  plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
62  // this is the list of paths to look at.
63  std::vector<edm::ParameterSet> paths =
64  iConfig.getParameter<std::vector<edm::ParameterSet> >("paths");
65 
66  for(std::vector<edm::ParameterSet>::iterator pathconf = paths.begin() ; pathconf != paths.end(); pathconf++) {
67 
68  custompathnamepairs_.push_back(
69  make_pair(
70  pathconf->getParameter<std::string>("pathname"),
71  pathconf->getParameter<std::string>("denompathname")
72  )
73  );
74 
75  }
76 
77  if (hltPaths_.size() > 0)
78  {
79  // book a histogram of scalers
80  scalersSelect = dbe_->book1D("selectedScalers","Selected Scalers", hltPaths_.size(), 0.0, (double)hltPaths_.size());
81 
82  }
83 
84  triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
85  triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
86 
87 
88  /*
89  muonRecoCollectionName_ = iConfig.getUntrackedParameter("muonRecoCollectionName", std::string("muons"));
90 
91  electronEtaMax_ = iConfig.getUntrackedParameter<double>("electronEtaMax",2.5);
92  electronEtMin_ = iConfig.getUntrackedParameter<double>("electronEtMin",3.0);
93  electronDRMatch_ =iConfig.getUntrackedParameter<double>("electronDRMatch",0.3);
94  electronL1DRMatch_ =iConfig.getUntrackedParameter<double>("electronL1DRMatch",0.3);
95 
96  muonEtaMax_ = iConfig.getUntrackedParameter<double>("muonEtaMax",2.1);
97  muonEtMin_ = iConfig.getUntrackedParameter<double>("muonEtMin",0.0);
98  muonDRMatch_ =iConfig.getUntrackedParameter<double>("muonDRMatch",0.3);
99  muonL1DRMatch_ =iConfig.getUntrackedParameter<double>("muonL1DRMatch",0.3);
100 
101  tauEtaMax_ = iConfig.getUntrackedParameter<double>("tauEtaMax",2.5);
102  tauEtMin_ = iConfig.getUntrackedParameter<double>("tauEtMin",3.0);
103  tauDRMatch_ =iConfig.getUntrackedParameter<double>("tauDRMatch",0.3);
104  tauL1DRMatch_ =iConfig.getUntrackedParameter<double>("tauL1DRMatch",0.5);
105 
106  jetEtaMax_ = iConfig.getUntrackedParameter<double>("jetEtaMax",5.0);
107  jetEtMin_ = iConfig.getUntrackedParameter<double>("jetEtMin",10.0);
108  jetDRMatch_ =iConfig.getUntrackedParameter<double>("jetDRMatch",0.3);
109  jetL1DRMatch_ =iConfig.getUntrackedParameter<double>("jetL1DRMatch",0.5);
110 
111  bjetEtaMax_ = iConfig.getUntrackedParameter<double>("bjetEtaMax",2.5);
112  bjetEtMin_ = iConfig.getUntrackedParameter<double>("bjetEtMin",10.0);
113  bjetDRMatch_ =iConfig.getUntrackedParameter<double>("bjetDRMatch",0.3);
114  bjetL1DRMatch_ =iConfig.getUntrackedParameter<double>("bjetL1DRMatch",0.3);
115 
116  photonEtaMax_ = iConfig.getUntrackedParameter<double>("photonEtaMax",2.5);
117  photonEtMin_ = iConfig.getUntrackedParameter<double>("photonEtMin",3.0);
118  photonDRMatch_ =iConfig.getUntrackedParameter<double>("photonDRMatch",0.3);
119  photonL1DRMatch_ =iConfig.getUntrackedParameter<double>("photonL1DRMatch",0.3);
120 
121  trackEtaMax_ = iConfig.getUntrackedParameter<double>("trackEtaMax",2.5);
122  trackEtMin_ = iConfig.getUntrackedParameter<double>("trackEtMin",3.0);
123  trackDRMatch_ =iConfig.getUntrackedParameter<double>("trackDRMatch",0.3);
124  trackL1DRMatch_ =iConfig.getUntrackedParameter<double>("trackL1DRMatch",0.3);
125 
126  metEtaMax_ = iConfig.getUntrackedParameter<double>("metEtaMax",5);
127  metMin_ = iConfig.getUntrackedParameter<double>("metMin",10.0);
128  metDRMatch_ =iConfig.getUntrackedParameter<double>("metDRMatch",0.5);
129  metL1DRMatch_ =iConfig.getUntrackedParameter<double>("metL1DRMatch",0.5);
130 
131  htEtaMax_ = iConfig.getUntrackedParameter<double>("htEtaMax",5);
132  htMin_ = iConfig.getUntrackedParameter<double>("htMin",10.0);
133  htDRMatch_ =iConfig.getUntrackedParameter<double>("htDRMatch",0.5);
134  htL1DRMatch_ =iConfig.getUntrackedParameter<double>("htL1DRMatch",0.5);
135  */
136 
137  sumEtMin_ = iConfig.getUntrackedParameter<double>("sumEtMin",10.0);
138 
139  // Muon quality cuts
140  dxyCut_ = iConfig.getUntrackedParameter<double>("DxyCut", 0.2); // dxy < 0.2 cm
141  normalizedChi2Cut_ = iConfig.getUntrackedParameter<double>("NormalizedChi2Cut", 10.); // chi2/ndof (of global fit) <10.0
142  trackerHitsCut_ = iConfig.getUntrackedParameter<int>("TrackerHitsCut", 11); // Tracker Hits >10
143  pixelHitsCut_ = iConfig.getUntrackedParameter<int>("PixelHitsCut", 1); // Pixel Hits >0
144  muonHitsCut_ = iConfig.getUntrackedParameter<int>("MuonHitsCut", 1); // Valid Muon Hits >0
145  isAlsoTrackerMuon_ = iConfig.getUntrackedParameter<bool>("IsAlsoTrackerMuon", true);
146  nMatchesCut_ = iConfig.getUntrackedParameter<int>("NMatchesCut", 2); // At least 2 Chambers with matches
147 
148  specialPaths_ = iConfig.getParameter<std::vector<std::string > >("SpecialPaths");
149 
150  testPathsFolder_ = iConfig.getUntrackedParameter ("testPathsFolder",std::string("HLT/TrigResults/testPaths/"));
151  pathsSummaryFolder_ = iConfig.getUntrackedParameter ("pathsSummaryFolder",std::string("HLT/TrigResults/PathsSummary/HLT Counts/"));
152  pathsSummaryStreamsFolder_ = iConfig.getUntrackedParameter ("pathsSummaryFolder",std::string("HLT/TrigResults/PathsSummary/"));
153  //pathsSummaryStreamsFolder_ = iConfig.getUntrackedParameter ("pathsSummaryFolder",std::string("HLT/TrigResults/PathsSummary/Streams/"));
154  pathsSummaryHLTCorrelationsFolder_ = iConfig.getUntrackedParameter ("hltCorrelationsFolder",std::string("HLT/TrigResults/PathsSummary/HLT Correlations/"));
155  pathsSummaryFilterCountsFolder_ = iConfig.getUntrackedParameter ("filterCountsFolder",std::string("HLT/TrigResults/PathsSummary/Filters Counts/"));
156 
157  pathsSummaryHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("individualPathsPerLSFolder",std::string("HLT/TrigResults/PathsSummary/HLT LS/"));
158  pathsIndividualHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("individualPathsPerLSFolder",std::string("HLT/TrigResults/PathsSummary/HLT LS/Paths/"));
159  pathsSummaryHLTPathsPerBXFolder_ = iConfig.getUntrackedParameter ("individualPathsPerBXFolder",std::string("HLT/TrigResults/PathsSummary/HLT BX/"));
160 
161 
162  // mask off some of the paths so that they don't appear in the plots
163 
164  maskedPaths_ = iConfig.getParameter<std::vector<std::string > >("MaskedPaths");
165 
166  referenceTrigInput_ = iConfig.getParameter<std::string> ("ReferenceTrigger");
167  foundReferenceTrigger_ = false;
168 
169  //Robin
170  testPaths_ = iConfig.getParameter<std::vector<std::string > >("testPaths");
171 
172  fLumiFlag = true;
173  ME_HLTAll_LS = NULL;
174  ME_HLT_BX = NULL;
176 
177  //jetID = new reco::helper::JetIDHelper(iConfig.getParameter<ParameterSet>("JetIDParams"));
178 
179  recHitsEBTag_ = iConfig.getUntrackedParameter<edm::InputTag>("RecHitsEBTag",edm::InputTag("reducedEcalRecHitsEB"));
180  recHitsEETag_ = iConfig.getUntrackedParameter<edm::InputTag>("RecHitsEETag",edm::InputTag("reducedEcalRecHitsEE"));
181 
182 
183  jmsDebug = false;
184  jmsFakeZBCounts = false;
185  found_zbIndex = false;
186  if (jmsDebug ) std::cout << "Printing extra info " << std::endl;
187 
188  //set Token(-s)
189  triggerResultsToken_ = consumes<edm::TriggerResults>(iConfig.getParameter<edm::InputTag>("triggerResultsLabel"));
190  edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
191  triggerResultsTokenFU_ = consumes<edm::TriggerResults>(triggerResultsLabelFU);
192  lumiScalersToken_ = consumes<LumiScalersCollection>(InputTag("hltScalersRawToDigi","",""));
193 }
194 
195 
197 {
198 
199  // do anything here that needs to be done at desctruction time
200  // (e.g. close files, deallocate resources etc.)
201 
202 }
203 
204 
205 //
206 // member functions
207 //
208 
209 // ------------ method called to for each event ------------
210 void
212 {
213 
214  //if(! fLumiFlag ) return;
215 
216  using namespace edm;
217  using namespace trigger;
218  ++nev_;
219  LogDebug("TrigResRateMon")<< " analyze...." ;
220 
221 
224  if(!triggerResults.isValid()) {
225  edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
227  if(!triggerResults.isValid()) {
228  edm::LogInfo("TrigResRateMon") << "TriggerResults not found, "
229  "skipping event";
230  return;
231  }
232  }
234  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
235 
236  //Robin---
237  nStream_++;
238  passAny = false ;
239 
240  // Find which index is zero bias for this run
241 
242 // // if(!found_zbIndex){
243 // // // set default to something that is out-of-bounds
244 // // zbIndex = triggerNames.size() +2;
245 // // for (unsigned int i = 0; i < triggerNames.size(); i ++){
246 // // std::string thisName = triggerNames.triggerName(i);
247 // // TString checkName(thisName.c_str());
248 // // if (checkName.Contains("HLT_ZeroBias_v")){
249 // // zbIndex = i;
250 // // found_zbIndex = true;
251 // // if(jmsDebug) std::cout << "Found the ZeroBias index!!!!!!!! It is " << zbIndex <<std::endl;
252 // // }
253 // // }
254 // // }
255 
256  // int bx = iEvent.bunchCrossing();
257  /*
258  // Fill HLTPassed_Correlation Matrix bin (i,j) = (Any,Any)
259  // --------------------------------------------------------
260  int anyBinNumber = ME_HLTPassPass->getTH2F()->GetXaxis()->FindBin("HLT_Any");
261  // any triger accepted
262  if(triggerResults->accept()){
263 
264  ME_HLTPassPass->Fill(anyBinNumber-1,anyBinNumber-1);//binNumber1 = 0 = first filter
265 
266  }
267  */
268 
269 
270 
271  fillHltMatrix(triggerNames, iEvent, iSetup);
272 
273 
274 
275 
277  //
278  // Experimental Testing Area
279  // Try to get the lumi information for these events
280  //
282 
284 
285  bool lumiHandleOK = iEvent.getByToken(lumiScalersToken_, lumiScalers);
286 
287  if (jmsDebug) std::cout << "Tried to get lumi handle result = " << lumiHandleOK << std::endl;
288 
289  if (lumiHandleOK) {
290  if (jmsDebug) std::cout << "LumiScalers size is: " << lumiScalers->size() << std::endl;
291 
292  if (lumiScalers->size()) {
293  LumiScalersCollection::const_iterator it3 = lumiScalers->begin();
294  unsigned int lumisection = it3->sectionNumber();
295  if(lumisection){
296 
297  if (jmsDebug) std::cout << "Instanteous Lumi is " << it3->instantLumi() << std::endl;
298  if (jmsDebug) std::cout << "Instanteous Lumi Error is " <<it3->instantLumiErr() << std::endl;
299  if (jmsDebug) std::cout << "Lumi Fill is " <<it3->lumiFill() << std::endl;
300  if (jmsDebug) std::cout << "Lumi Fill is " <<it3->lumiRun() << std::endl;
301  if (jmsDebug) std::cout << "Live Lumi Fill is " <<it3->liveLumiFill() << std::endl;
302  if (jmsDebug) std::cout << "Live Lumi Run is " <<it3->liveLumiRun() << std::endl;
303 
304  addLumiToAverage(it3->instantLumi());
305 
306 
307  } // end
308  }// end if lumi scalers exist
309 
310  }// end if lumi handle ok
311 
312 
313  fillCountsPerPath(iEvent, iSetup);
314 
315  if (passAny) nPass_ ++ ;
316 
317  return;
318 
319 }
320 
321 
322 
323 // -- method called once each job just before starting event loop --------
324 void
326 {
327  nev_ = 0;
328  DQMStore *dbe = 0;
329  dbe = Service<DQMStore>().operator->();
330 
331  if (dbe) {
333  }
334 
335 
336  MonitorElement* reportSummaryME = dbe->book1D("reportSummaryMap","report Summary Map",2,0,2);
337  if(reportSummaryME) reportSummaryME->Fill(1);
338 
339 
340 }
341 
342 // - method called once each job just after ending the event loop ------------
343 void
345 {
346  LogInfo("TrigResRateMon") << "analyzed " << nev_ << " events";
347  return;
348 }
349 
350 
351 // BeginRun
353 {
354 
355  LogDebug("TrigResRateMon") << "beginRun, run " << run.id();
356 
357  if(fIsSetup) return;
358 
359  // HLT config does not change within runs!
360  bool changed=false;
361 
362  if (!hltConfig_.init(run, c, processname_, changed)) {
363 
364  processname_ = "FU";
365 
366 
367  if (!hltConfig_.init(run, c, processname_, changed)){
368 
369  if (jmsDebug) std::cout << "HLTConfigProvider failed to initialize.";
370 
371  } else {
372  if (jmsDebug) std::cout << "Initialized HLTConfigProvider with name FU " << std::endl;
373  }
374 
375  // check if trigger name in (new) config
376  // cout << "Available TriggerNames are: " << endl;
377  // hltConfig_.dump("Triggers");
378  } else {
379  if (jmsDebug) std::cout << "Initialized HLTConfigProvider with name HLT " << std::endl;
380  }
381 
382  if (1) {
383 
384  DQMStore *dbe = 0;
385  dbe = Service<DQMStore>().operator->();
386 
387  if (dbe) {
389  }
390 
391 
392  // const unsigned int n(hltConfig_.size());
393 
394  TotalDroppedCounts = 0;
395  //Robin-------Diagnostic plots--------
396  meDiagnostic = dbe->book1D("DroppedCounts Diagnose", "LSs vs Status;Status;LSs", 3, -0.5,2.5 );
397  meCountsDroppedPerLS = dbe->book1D("CountsDroppedVsLS", "Counts vs LumiSec;LS;Dropped Stream Counts", nLS_, 0.5, nLS_+0.5);
398  meCountsPassPerLS = dbe->book1D("CountsPassVsLS", "Counts vs LumiSec;LS;Passed Stream Counts", nLS_, 0.5, nLS_+0.5);
399  meCountsStreamPerLS = dbe->book1D("CountsStreamVsLS", "Counts vs LumiSec;LS;Stream Counts", nLS_, 0.5, nLS_+0.5);
400  meXsecStreamPerLS = dbe->book1D("XsecStreamVsLS", "Xsec vs LumiSec;LS;Stream Xsec", nLS_, 0.5, nLS_+0.5);
401 
402 // meXsecPerLS = dbe->book1D("XsecVsLS", "Xsec vs LumiSec;LS;Xsec", nLS_, 0.5, nLS_+0.5);
403 // meXsec = dbe->book1D("Xsec", "histo for Xsec ", 20, 0.01, 0.06);
404 // // meXsecPerIL = dbe->book2D("XsecVsIL", "Xsec vs Inst Lumi;#mub^{-1}*s^{-1}; Xsec", 200, 700, 900, 100, 0.01, 0.1);
405 // TProfile tempProfile("XsecVsIL", "Xsec vs Inst Lumi;#mub^{-1}*s^{-1}; Xsec", 40, 600, 3000);
406 // meXsecPerIL = dbe_->bookProfile("XsecVsIL", &tempProfile);
407 
408  bookTestHisto(); //Robin
409  dbe->setCurrentFolder(dirname_); //Robin
410 
411  // JMS fill the counts per path
414  averageInstLumi3LS = 0 ;
416  meAverageLumiPerLS = dbe->book1D("InstLumiVsLS", "Instantaneous Luminosity vs LumiSec;LS;#mub^{-1}*s^{-1}", nLS_, 0.5, nLS_+0.5);
417 // // if (plotAll_){
418 
419 // // for (unsigned int j=0; j!=n; ++j) {
420 
421 // // std::string pathname = hltConfig_.triggerName(j);
422 
423 // // string l1pathname = getL1ConditionModuleName(pathname);
424 
425 // // int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1pathname);
426 
427 // // int objectType = getTriggerTypeParsePathName(pathname);
428 
429 // // for (unsigned int i=0; i!=n; ++i) {
430 
431 // // std::string denompathname = hltConfig_.triggerName(i);
432 // // int denomobjectType = getTriggerTypeParsePathName(denompathname);
433 
434 
435 
436 // // std::string filtername("dummy");
437 // // float ptMin = 0.0;
438 // // float ptMax = 100.0;
439 // // if (plotAll_ && denomobjectType == objectType && objectType != 0) {
440 
441 // // int hltThreshold = getThresholdFromName(pathname);
442 // // int l1Threshold = getThresholdFromName(l1pathname);
443 // // hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
444 
445 // // }
446 
447 // // }
448 // // }
449 
450 // // } // end if plotAll
451 // // else {
452 
453  // plot all diagonal combinations plus any other specified pairs
454 // // for (unsigned int i=0; i!=n; ++i) {
455 
456 // // std::string denompathname = "";
457 // // std::string pathname = hltConfig_.triggerName(i);
458 // // //parse pathname to guess object type
459 // // int objectType = getTriggerTypeParsePathName(pathname);
460 
461 // // string l1pathname = getL1ConditionModuleName(pathname);
462 // // int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1pathname);
463 
464 // // std::string filtername("dummy");
465 // // float ptMin = 0.0;
466 // // float ptMax = 100.0;
467 
468 // // if (objectType == trigger::TriggerPhoton) ptMax = 100.0;
469 // // if (objectType == trigger::TriggerElectron) ptMax = 100.0;
470 // // if (objectType == trigger::TriggerMuon) ptMax = 150.0;
471 // // if (objectType == trigger::TriggerTau) ptMax = 100.0;
472 // // if (objectType == trigger::TriggerJet) ptMax = 300.0;
473 // // if (objectType == trigger::TriggerBJet) ptMax = 300.0;
474 // // if (objectType == trigger::TriggerMET) ptMax = 300.0;
475 // // if (objectType == trigger::TriggerTET) ptMax = 300.0;
476 // // if (objectType == trigger::TriggerTrack) ptMax = 100.0;
477 
478 // // // keep track of all paths, except for FinalPath
479 // // if (objectType != -1 && pathname.find("FinalPath") == std::string::npos){
480 
481 // // int hltThreshold = getThresholdFromName(pathname);
482 // // int l1Threshold = getThresholdFromName(l1pathname);
483 
484 // // hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
485 
486 // // hltPathsDiagonal_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
487 
488 // // }
489 
490 // // } // end for i
491 
492 
493  // now loop over denom/num path pairs specified in cfg,
494  // recording the off-diagonal ones
495 // // for (std::vector<std::pair<std::string, std::string> >::iterator custompathnamepair = custompathnamepairs_.begin(); custompathnamepair != custompathnamepairs_.end(); ++custompathnamepair) {
496 
497 // // std::string numpathname = custompathnamepair->first;
498 // // std::string denompathname = custompathnamepair->second;
499 
500 // // if (numpathname != denompathname) {
501 
502 // // // check that denominator exists
503 // // bool founddenominator = false;
504 // // for (unsigned int k=0; k!=n; ++k) {
505 
506 // // string n_pathname = hltConfig_.triggerName(k);
507 
508 // // if (n_pathname.find(denompathname) != std::string::npos) {
509 
510 // // LogDebug("TrigResRateMon") << "denompathname is selected to be = " << n_pathname << endl;;
511 // // founddenominator = true;
512 
513 // // break;
514 
515 // // }
516 // // }
517 
518 // // if (!founddenominator) {
519 
520 // // edm::LogInfo("TrigResRateMon") << "denompathname not found, go to the next pair numearator-denominator" << endl;
521 
522 // // // go to the next pair
523 // // continue;
524 
525 // // }
526 
527 // // // check that numerator exists
528 // // bool foundnumerator = false;
529 // // for (unsigned int j=0; j!=n; ++j) {
530 
531 // // string pathname = hltConfig_.triggerName(j);
532 
533 // // LogDebug("TrigResRateMon") << "check if path " << pathname << " is numpathname = " << numpathname << endl;
534 // // if (hltConfig_.triggerName(j).find(numpathname)!= std::string::npos) {
535 
536 // // LogDebug("TrigResRateMon") << "pathname is selected to be = " << denompathname << endl;;
537 // // foundnumerator = true;
538 
539 // // }
540 
541 
542 // // if (!foundnumerator) {
543 
544 // // edm::LogInfo("TrigResRateMon") << "pathname not found, ignoring " << pathname;
545 // // continue;
546 
547 // // }
548 
549 
550 // // string l1pathname = getL1ConditionModuleName(pathname);
551 // // int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1pathname);
552 // // int objectType = getTriggerTypeParsePathName(pathname);
553 
554 // // std::string filtername("dummy");
555 // // float ptMin = 0.0;
556 // // float ptMax = 100.0;
557 // // if (objectType == trigger::TriggerPhoton) ptMax = 100.0;
558 // // if (objectType == trigger::TriggerElectron) ptMax = 100.0;
559 // // if (objectType == trigger::TriggerMuon) ptMax = 150.0;
560 // // if (objectType == trigger::TriggerTau) ptMax = 100.0;
561 // // if (objectType == trigger::TriggerJet) ptMax = 300.0;
562 // // if (objectType == trigger::TriggerBJet) ptMax = 300.0;
563 // // if (objectType == trigger::TriggerMET) ptMax = 300.0;
564 // // if (objectType == trigger::TriggerTET) ptMax = 300.0;
565 // // if (objectType == trigger::TriggerTrack) ptMax = 100.0;
566 
567 // // // monitor regardless of the objectType of the path
568 // // if (objectType != 0) {
569 // // int hltThreshold = getThresholdFromName(pathname);
570 // // int l1Threshold = getThresholdFromName(l1pathname);
571 // // hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
572 
573 // // }
574 
575 // // } // end for j, loop over paths
576 
577 // // } // end if not same num and denominator
578 
579 // // }
580 // // end for pair
581 
582 // }
583  // end else
584 
585 
586  /*
587  vector<string> muonPaths;
588  vector<string> egammaPaths;
589  vector<string> tauPaths;
590  vector<string> jetmetPaths;
591  vector<string> restPaths;
592  */
593  vector<string> allPaths;
594 
595  // fill vectors of Muon, Egamma, JetMET, Rest, and Special paths
596  for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
597 
598  std::string pathName = v->getPath();
599  //int objectType = v->getObjectType();
600 
601  vector<int> tempCount(5,0);
602 
603  fPathTempCountPair.push_back(make_pair(pathName,0));
604  fPathBxTempCountPair.push_back(make_pair(pathName,tempCount));
605 
606  allPaths.push_back(pathName);
607 
608  /*
609  switch (objectType) {
610  case trigger::TriggerMuon :
611  muonPaths.push_back(pathName);
612  break;
613 
614  case trigger::TriggerElectron :
615  case trigger::TriggerPhoton :
616  egammaPaths.push_back(pathName);
617  break;
618 
619  case trigger::TriggerTau :
620  tauPaths.push_back(pathName);
621  break;
622 
623  case trigger::TriggerJet :
624  case trigger::TriggerMET :
625  jetmetPaths.push_back(pathName);
626  break;
627 
628  default:
629  restPaths.push_back(pathName);
630  }
631  */
632 
633  }
634 
635  fPathTempCountPair.push_back(make_pair("HLT_Any",0));
636 
637  fGroupName.push_back("AllSelectedPaths");
638  /*
639  fGroupName.push_back("Muon");
640  fGroupName.push_back("Egamma");
641  fGroupName.push_back("Tau");
642  fGroupName.push_back("JetMET");
643  fGroupName.push_back("Rest");
644  fGroupName.push_back("Special");
645  */
646 
647  for(unsigned int g=0; g<fGroupName.size(); g++) {
648 
649  //fGroupTempCountPair.push_back(make_pair(fGroupName[g],0));
650  //fGroupL1TempCountPair.push_back(make_pair(fGroupName[g],0));
651 
652  }
653 
655 
656 
657 
658 // fGroupNamePathsPair.push_back(make_pair("AllSelectedPaths",allPaths));
659 
660  /*
661  fGroupNamePathsPair.push_back(make_pair("Muon",muonPaths));
662 
663  fGroupNamePathsPair.push_back(make_pair("Egamma",egammaPaths));
664 
665  fGroupNamePathsPair.push_back(make_pair("Tau",tauPaths));
666 
667  fGroupNamePathsPair.push_back(make_pair("JetMET",jetmetPaths));
668 
669  fGroupNamePathsPair.push_back(make_pair("Rest",restPaths));
670 
671  fGroupNamePathsPair.push_back(make_pair("Special",specialPaths_));
672  */
673 
675  //vector<string> datasetNames = hltConfig_.datasetNames() ;
676  vector<string> datasetNames = hltConfig_.streamContent("A") ;
677  for (unsigned int i=0;i<datasetNames.size();i++) {
678 
679  vector<string> datasetPaths = hltConfig_.datasetContent(datasetNames[i]);
680  fGroupNamePathsPair.push_back(make_pair(datasetNames[i],datasetPaths));
681 
682  DatasetInfo tempDS;
683  tempDS.datasetName = datasetNames[i];
684  tempDS.setPaths(datasetPaths);
685  tempDS.countsPerPathME_Name = pathsSummaryFolder_ + "HLT_" + datasetNames[i] + "_Pass_Any";
686  tempDS.xsecPerPathME_Name = pathsSummaryFolder_ + "HLT_" + datasetNames[i] + "_Xsec";
687  tempDS.rawCountsPerPathME_Name = pathsSummaryFolder_ + "HLT_" + datasetNames[i] + "_RawCounts";
688  tempDS.scaledXsecPerPathME_Name = pathsSummaryFolder_ + "HLT_" + datasetNames[i] + "_XsecScaled";
689  tempDS.ratePerLSME_Name = pathsSummaryFolder_ + "HLT_" + datasetNames[i] + "_Rate"; //Robin
691  if (jmsDebug) tempDS.printMaskedPaths();
692  primaryDataSetInformation.push_back(tempDS);
693 
694  rawCountsPerPD.push_back(0); //Robin
695  }
696 
697  // push stream A and its PDs
698  fGroupNamePathsPair.push_back(make_pair("A",datasetNames));
699 
700 
701  for (unsigned int g=0;g<fGroupNamePathsPair.size();g++) {
702 
703  fGroupTempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
704  fGroupL1TempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
706 
707  }
708 
709 /*
710  // HLT matrices from Streams
711  const std::vector<std::string> streamNames = hltConfig_.streamNames();
712 
713  for (unsigned int s=0;s<streamNames.size();s++) {
714 
716  vector<string> hltConfig = streamDatasetNames_.streamContent(streamNames[s]) ;
717  if(streamNames[s] == "A") setupStreamMatrix(streamNames[s],streamDatasetNames);
718 
719  }
720 */
721 
722 // // setupHltLsPlots();
723 
724 // // setupHltBxPlots();
725 
726 
727 // for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
728 
729 // // -------------------------
730 // //
731 // // Filters for each path
732 // //
733 // // -------------------------
734 
735 // // get all modules in this HLT path
736 // vector<string> moduleNames = hltConfig_.moduleLabels( v->getPath() );
737 
738 // int numModule = 0;
739 // string moduleName, moduleType;
740 // unsigned int moduleIndex;
741 
742 // //print module name
743 // vector<string>::const_iterator iDumpModName;
744 // for (iDumpModName = moduleNames.begin();iDumpModName != moduleNames.end();iDumpModName++) {
745 
746 // moduleName = *iDumpModName;
747 // moduleType = hltConfig_.moduleType(moduleName);
748 // moduleIndex = hltConfig_.moduleIndex(v->getPath(), moduleName);
749 
750 // LogTrace ("TrigResRateMon") << "Module " << numModule
751 // << " is called " << moduleName
752 // << " , type = " << moduleType
753 // << " , index = " << moduleIndex
754 // << endl;
755 
756 // numModule++;
757 
758 // if((moduleType.find("Filter") != string::npos && moduleType.find("HLTTriggerTypeFilter") == string::npos ) ||
759 // (moduleType.find("Associator") != string::npos) ||
760 // (moduleType.find("HLTLevel1GTSeed") != string::npos) ||
761 // (moduleType.find("HLTGlobalSumsCaloMET") != string::npos) ||
762 // (moduleType.find("HLTPrescaler") != string::npos) ) {
763 
764 // //std::pair<std::string, int> filterIndexPair;
765 // //filterIndexPair.first = moduleName;
766 // //filterIndexPair.second = moduleIndex;
767 // //v->filtersAndIndices.push_back(filterIndexPair);
768 // v->filtersAndIndices.push_back(make_pair(moduleName,moduleIndex));
769 
770 // }
771 
772 
773 // }//end for modulesName
774 
775 // // dbe_->setCurrentFolder(pathsSummaryFilterCountsFolder_.c_str());
776 
777 // // //int nbin_sub = 5;
778 // // int nbin_sub = v->filtersAndIndices.size()+2;
779 
780 // // // count plots for subfilter
781 // // MonitorElement* filters = dbe_->book1D("Filters_" + v->getPath(),
782 // // "Filters_" + v->getPath(),
783 // // nbin_sub+1, -0.5, 0.5+(double)nbin_sub);
784 
785 // // for(unsigned int filt = 0; filt < v->filtersAndIndices.size(); filt++){
786 
787 // // filters->setBinLabel(filt+1, (v->filtersAndIndices[filt]).first);
788 
789 // // }
790 
791 // // book Count vs LS
792 // dbe_->setCurrentFolder(pathsIndividualHLTPathsPerLSFolder_.c_str());
793 // MonitorElement* tempME = dbe_->book1D(v->getPath() + "_count_per_LS",
794 // v->getPath() + " rate [Hz]",
795 // nLS_, 0,nLS_);
796 // tempME->setAxisTitle("Luminosity Section");
797 
798 // //v->setFilterHistos(filters);
799 
800 // }
801  // end for paths
802 
803  // now set up all of the histos for each path-denom
804 // for(PathInfoCollection::iterator v = hltPaths_.begin(); v!= hltPaths_.end(); ++v ) {
805 
806  /*
807  MonitorElement *NOn, *onEtOn, *onOneOverEtOn, *onEtavsonPhiOn=0;
808  MonitorElement *NOff, *offEtOff, *offEtavsoffPhiOff=0;
809  MonitorElement *NL1, *l1EtL1, *l1Etavsl1PhiL1=0;
810  MonitorElement *NL1On, *l1EtL1On, *l1Etavsl1PhiL1On=0;
811  MonitorElement *NL1Off, *offEtL1Off, *offEtavsoffPhiL1Off=0;
812  MonitorElement *NOnOff, *offEtOnOff, *offEtavsoffPhiOnOff=0;
813  MonitorElement *NL1OnUM, *l1EtL1OnUM, *l1Etavsl1PhiL1OnUM=0;
814  MonitorElement *NL1OffUM, *offEtL1OffUM, *offEtavsoffPhiL1OffUM=0;
815  MonitorElement *NOnOffUM, *offEtOnOffUM, *offEtavsoffPhiOnOffUM=0;
816  MonitorElement *offDRL1Off, *offDROnOff, *l1DRL1On=0;
817  */
818 
819 
820 // std::string labelname("dummy");
821 // labelname = v->getPath() + "_wrt_" + v->getDenomPath();
822 // std::string histoname(labelname+"_NOn");
823 // std::string title(labelname+" N online");
824 // double histEtaMax = 2.5;
825 
826 // if (v->getObjectType() == trigger::TriggerMuon || v->getObjectType() == trigger::TriggerL1Mu) {
827 
828 // histEtaMax = muonEtaMax_;
829 
830 // }
831 // else if (v->getObjectType() == trigger::TriggerElectron || v->getObjectType() == trigger::TriggerL1NoIsoEG || v->getObjectType() == trigger::TriggerL1IsoEG )
832 // {
833 // histEtaMax = electronEtaMax_;
834 // }
835 // else if (v->getObjectType() == trigger::TriggerTau || v->getObjectType() == trigger::TriggerL1TauJet )
836 // {
837 // histEtaMax = tauEtaMax_;
838 // }
839 // else if (v->getObjectType() == trigger::TriggerJet || v->getObjectType() == trigger::TriggerL1CenJet || v->getObjectType() == trigger::TriggerL1ForJet )
840 // {
841 // histEtaMax = jetEtaMax_;
842 // }
843 // else if (v->getObjectType() == trigger::TriggerBJet)
844 // {
845 // histEtaMax = bjetEtaMax_;
846 // }
847 // else if (v->getObjectType() == trigger::TriggerMET || v->getObjectType() == trigger::TriggerL1ETM )
848 // {
849 // histEtaMax = metEtaMax_;
850 // }
851 // else if (v->getObjectType() == trigger::TriggerPhoton)
852 // {
853 // histEtaMax = photonEtaMax_;
854 // }
855 // else if (v->getObjectType() == trigger::TriggerTrack)
856 // {
857 // histEtaMax = trackEtaMax_;
858 // }
859 
860 // TString pathfolder = dirname_ + TString("/FourVector/") + v->getPath();
861  /*
862  dbe_->setCurrentFolder(pathfolder.Data());
863 
864  NOn = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
865 
866 
867  histoname = labelname+"_NOff";
868  title = labelname+" N Off";
869  NOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
870 
871  histoname = labelname+"_NL1";
872  title = labelname+" N L1";
873  NL1 = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
874 
875  histoname = labelname+"_NL1On";
876  title = labelname+" N L1On";
877  NL1On = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
878 
879  histoname = labelname+"_NL1Off";
880  title = labelname+" N L1Off";
881  NL1Off = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
882 
883  histoname = labelname+"_NOnOff";
884  title = labelname+" N OnOff";
885  NOnOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
886 
887 
888  histoname = labelname+"_NL1OnUM";
889  title = labelname+" N L1OnUM";
890  NL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
891 
892  histoname = labelname+"_NL1OffUM";
893  title = labelname+" N L1OffUM";
894  NL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
895 
896  histoname = labelname+"_NOnOffUM";
897  title = labelname+" N OnOffUM";
898  NOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
899 
900 
901  histoname = labelname+"_onEtOn";
902  title = labelname+" onE_t online";
903  onEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
904 
905  histoname = labelname+"_onOneOverEtOn";
906  title = labelname+" 1 / onE_t online";
907  onOneOverEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBinsOneOverEt_, 0, 1);
908  onOneOverEtOn->setAxisTitle("HLT 1/Et [1/GeV]");
909 
910  histoname = labelname+"_offEtOff";
911  title = labelname+" offE_t offline";
912  offEtOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
913 
914  histoname = labelname+"_l1EtL1";
915  title = labelname+" l1E_t L1";
916  l1EtL1 = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
917 
918 
919  histoname = labelname+"_onEtaonPhiOn";
920  title = labelname+" on#eta vs on#phi online";
921  onEtavsonPhiOn = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
922 
923  histoname = labelname+"_offEtaoffPhiOff";
924  title = labelname+" off#eta vs off#phi offline";
925  offEtavsoffPhiOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
926 
927  histoname = labelname+"_l1Etal1PhiL1";
928  title = labelname+" l1#eta vs l1#phi L1";
929  l1Etavsl1PhiL1 = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
930 
931  histoname = labelname+"_l1EtL1On";
932  title = labelname+" l1E_t L1+online";
933  l1EtL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
934 
935  histoname = labelname+"_offEtL1Off";
936  title = labelname+" offE_t L1+offline";
937  offEtL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
938 
939  histoname = labelname+"_offEtOnOff";
940  title = labelname+" offE_t online+offline";
941  offEtOnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
942 
943  histoname = labelname+"_l1Etal1PhiL1On";
944  title = labelname+" l1#eta vs l1#phi L1+online";
945  l1Etavsl1PhiL1On = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
946 
947  histoname = labelname+"_offEtaoffPhiL1Off";
948  title = labelname+" off#eta vs off#phi L1+offline";
949  offEtavsoffPhiL1Off = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
950 
951  histoname = labelname+"_offEtaoffPhiOnOff";
952  title = labelname+" off#eta vs off#phi online+offline";
953  offEtavsoffPhiOnOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
954 
955  histoname = labelname+"_l1EtL1OnUM";
956  title = labelname+" l1E_t L1+onlineUM";
957  l1EtL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
958 
959  histoname = labelname+"_offEtL1OffUM";
960  title = labelname+" offE_t L1+offlineUM";
961  offEtL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
962 
963  histoname = labelname+"_offEtOnOffUM";
964  title = labelname+" offE_t online+offlineUM";
965  offEtOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
966 
967  histoname = labelname+"_l1Etal1PhiL1OnUM";
968  title = labelname+" l1#eta vs l1#phi L1+onlineUM";
969  l1Etavsl1PhiL1OnUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
970 
971  histoname = labelname+"_offEtaoffPhiL1OffUM";
972  title = labelname+" off#eta vs off#phi L1+offlineUM";
973  offEtavsoffPhiL1OffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
974 
975  histoname = labelname+"_offEtaoffPhiOnOffUM";
976  title = labelname+" off#eta vs off#phi online+offlineUM";
977  offEtavsoffPhiOnOffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
978 
979 
980 
981 
982  histoname = labelname+"_l1DRL1On";
983  title = labelname+" l1DR L1+online";
984  l1DRL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBinsDR_, 0, dRMax_);
985 
986  histoname = labelname+"_offDRL1Off";
987  title = labelname+" offDR L1+offline";
988  offDRL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBinsDR_, 0, dRMax_);
989 
990  histoname = labelname+"_offDROnOff";
991  title = labelname+" offDR online+offline";
992  offDROnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBinsDR_, 0, dRMax_);
993  */
994 
995 
996  //v->setHistos( NOn, onEtOn, onOneOverEtOn, onEtavsonPhiOn, NOff, offEtOff, offEtavsoffPhiOff, NL1, l1EtL1, l1Etavsl1PhiL1, NL1On, l1EtL1On, l1Etavsl1PhiL1On, NL1Off, offEtL1Off, offEtavsoffPhiL1Off, NOnOff, offEtOnOff, offEtavsoffPhiOnOff, NL1OnUM, l1EtL1OnUM, l1Etavsl1PhiL1OnUM, NL1OffUM, offEtL1OffUM, offEtavsoffPhiL1OffUM, NOnOffUM, offEtOnOffUM, offEtavsoffPhiOnOffUM, offDRL1Off, offDROnOff, l1DRL1On );
997 
998 
999 // } // end for hltPath
1000 
1001  // HLT_Any
1002  // book Count vs LS
1003 // // dbe_->setCurrentFolder(pathsIndividualHLTPathsPerLSFolder_.c_str());
1004 // // MonitorElement* tempME = dbe_->book1D("HLT_Any_count_per_LS",
1005 // // "HLT_Any rate [Hz]",
1006 // // nLS_, 0,nLS_);
1007 // // tempME->setAxisTitle("Luminosity Section");
1008 
1009  } // end if(1) dummy
1010 
1011 
1012 
1013 
1014 
1015  if(doCombineRuns_) fIsSetup = true;
1016 
1017  return;
1018 
1019 }
1020 
1023 {
1024 
1025  LogDebug("TrigResRateMon") << "endRun, run " << run.id();
1026 
1027 }
1028 
1029 
1030 void TrigResRateMon::setupHltMatrix(const std::string& label, vector<std::string>& paths) {
1031 
1032  //string groupLabelAny = "HLT_"+label+"_Any";
1033  //paths.push_back(groupLabelAny.c_str());
1034  //paths.push_back("HLT_"+label+"_L1_Any");
1035  paths.push_back("");
1036  paths.push_back("Total "+label);
1037  //paths.push_back("HLT_Any");
1038 
1039  string h_name;
1040  string h_title;
1041 
1043 
1044 // // h_name= "HLT_"+label+"_PassPass";
1045 // // h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass);;; ";
1046 // // MonitorElement* ME = dbe_->book2D(h_name.c_str(), h_title.c_str(),
1047 // // paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
1048 
1049  // This is counts per path per for a specific PD
1050  // it will be corrected for prescales
1051  h_name= "HLT_"+label+"_Pass_Any";
1052  h_title = "HLT_"+label+"_Pass -- Prescale*Counts Per Path;Path;PS*Counts";
1053  MonitorElement* ME_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
1054  paths.size(), -0.5, paths.size()-0.5);
1055 
1056  // This is RAW counts per path per for a specific PD
1057  // it will be corrected for
1058  h_name= "HLT_"+label+"_RawCounts";
1059  h_title = "HLT_"+label+"_Pass (x=Pass, An) normalized to HLT_Any Pass;;Counts";
1060  MonitorElement* ME_RawCounts = dbe_->book1D(h_name.c_str(), h_title.c_str(),
1061  paths.size(), -0.5, paths.size()-0.5);
1062 
1063 
1064  // Make a similar histogram that is xsec per path for a specific PD
1065  // this is actually a profile of the average xsec per path
1066  h_name= "HLT_"+label+"_Xsec";
1067  h_title = "HLT_"+label+"_Xsec -- Profile shows Average Xsec per path;;#sigma (#mu b)";
1068 
1069  TProfile tempProfile(h_name.c_str(), h_title.c_str(),
1070  paths.size(), -0.5, paths.size()-0.5);
1071  MonitorElement* ME_Xsec = dbe_->bookProfile(h_name.c_str(), &tempProfile);
1072 
1073 
1074  // Make a similar histogram that is xsec per path for a specific PD
1075  // this is actually a profile of the average xsec per path
1076  // this histogram is scaled to the cross section of a reference path
1077  h_name= "HLT_"+label+"_XsecScaled";
1078  h_title = "HLT_"+label+"_Xsec -- Profile shows Average Xsec per path Scaled to Reference;;Ratio (#sigma/#sigma_{ref}";
1079 
1080  TProfile tempProfileScaled(h_name.c_str(), h_title.c_str(),
1081  paths.size(), -0.5, paths.size()-0.5);
1082  MonitorElement* ME_XsecScaled = dbe_->bookProfile(h_name.c_str(), &tempProfileScaled);
1083 
1085  h_name= "HLT_"+label+"_Rate";
1086  h_title = "HLT_"+label+"_Rate -- histogram shows Average Rate per LS;LS;Rate [Hz]";
1087 
1088  // MonitorElement* ME_Rate = dbe_->book1D(h_name.c_str(), h_title.c_str(),nLS_, 0, nLS_);
1089 
1090 
1091 // dbe_->setCurrentFolder(pathsSummaryHLTCorrelationsFolder_.c_str());
1092 // h_name= "HLT_"+label+"_PassPass_Normalized";
1093 // h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass) normalized to xBin=Pass";
1094 // MonitorElement* ME_Normalized = dbe_->book2D(h_name.c_str(), h_title.c_str(),
1095 // paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
1096 // h_name= "HLT_"+label+"_Pass_Normalized_Any";
1097 // h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
1098 // MonitorElement* ME_Normalized_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
1099 // paths.size(), -0.5, paths.size()-0.5);
1100 
1101 // dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_.c_str());
1102 // h_name= "HLT_"+label+"_Total_LS";
1103 // h_title = label+" HLT paths total combined rate [Hz]";
1104 // MonitorElement* ME_Total_LS = dbe_->book1D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_);
1105 // ME_Total_LS->setAxisTitle("LS");
1106 
1107 // h_name= "HLT_"+label+"_LS";
1108 // h_title = label+" HLT paths rate [Hz]";
1109 // MonitorElement* ME_Group_LS = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, paths.size(), -0.5, paths.size()-0.5);
1110 // ME_Group_LS->setAxisTitle("LS");
1111 // /// add this path to the vector of 2D LS paths
1112 // v_ME_HLTAll_LS.push_back(ME_Group_LS);
1113 
1114  /*
1115  h_name= "HLT_"+label+"_L1_Total_LS";
1116  h_title = label+" HLT paths total combined rate [Hz]";
1117  MonitorElement* ME_Total_L1_LS = dbe_->book1D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_);
1118  ME_Total_L1_LS->setAxisTitle("LS");
1119 
1120  h_name= "HLT_"+label+"_L1_LS";
1121  h_title = label+" HLT L1s rate [Hz]";
1122  MonitorElement* ME_Group_L1_LS = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, paths.size(), -0.5, paths.size()-0.5);
1123  ME_Group_L1_LS->setAxisTitle("LS");
1124 
1125  dbe_->setCurrentFolder(pathsSummaryHLTPathsPerBXFolder_.c_str());
1126  h_name= "HLT_"+label+"_BX_LS";
1127  h_title = label+" HLT paths total count combined per BX ";
1128  MonitorElement* ME_Total_BX = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, 5, -2.5, 2.5);
1129  ME_Total_BX->setAxisTitle("LS",1);
1130  v_ME_Total_BX.push_back(ME_Total_BX);
1131 
1132  h_name= "HLT_"+label+"_BX_LS_Norm";
1133  h_title = label+" HLT paths total count combined per BX Normalized to LS";
1134  MonitorElement* ME_Total_BX_Norm = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, 5, -2.5, 2.5);
1135  ME_Total_BX_Norm->setAxisTitle("LS",1);
1136  v_ME_Total_BX_Norm.push_back(ME_Total_BX_Norm);
1137  */
1138 
1139  for(unsigned int i = 0; i < paths.size(); i++){
1140 
1141 // // ME->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1142 // // ME->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1143 // ME_Group_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1144 
1145 // ME_Normalized->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1146 // ME_Normalized->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1147 // ME_Normalized_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1148  ME_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1149  ME_Xsec->getTProfile()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1150  ME_XsecScaled->getTProfile()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1151  ME_RawCounts->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1152  }
1153 
1154 }
1155 
1156 
1157 void TrigResRateMon::setupStreamMatrix(const std::string& label, vector<std::string>& paths) {
1158 
1159 
1160  paths.push_back("");
1161  paths.push_back("HLT_"+label+"_Any");
1162 
1163  string h_name;
1164  string h_title;
1165 
1167 
1168  h_name= "HLT_"+label+"_PassPass";
1169  h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass)";
1170  MonitorElement* ME = dbe_->book2D(h_name.c_str(), h_title.c_str(),
1171  paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
1172 
1173  h_name= "HLT_"+label+"_Pass_Any";
1174  h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
1175  MonitorElement* ME_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
1176  paths.size(), -0.5, paths.size()-0.5);
1177 
1179  h_name= "HLT_"+label+"_PassPass_Normalized";
1180  h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass) normalized to xBin=Pass";
1181  MonitorElement* ME_Normalized = dbe_->book2D(h_name.c_str(), h_title.c_str(),
1182  paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
1183  h_name= "HLT_"+label+"_Pass_Normalized_Any";
1184  h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
1185  MonitorElement* ME_Normalized_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
1186  paths.size(), -0.5, paths.size()-0.5);
1187 
1188  for(unsigned int i = 0; i < paths.size(); i++){
1189 
1190  ME->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1191  ME->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1192 
1193  ME_Normalized->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1194  ME_Normalized->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1195 
1196  ME_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1197  ME_Normalized_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1198 
1199  }
1200 
1201 }
1202 
1203 void TrigResRateMon::fillHltMatrix(const edm::TriggerNames & triggerNames, const edm::Event& iEvent, const edm::EventSetup& iSetup) {
1204 
1205  string fullPathToME;
1206  std::vector <std::pair<std::string, bool> > groupAcceptPair;
1207 
1208  // This will store the prescale values
1209  std::pair<int,int> psValueCombo;
1210 
1211  // For each dataset
1212  for (unsigned int mi=0;mi<fGroupNamePathsPair.size()-1;mi++) {
1213 
1214 
1215 // // fullPathToME = pathsSummaryFolder_ + "HLT_"+fGroupNamePathsPair[mi].first+"_PassPass";
1216 // // MonitorElement* ME_2d = dbe_->get(fullPathToME);
1217  fullPathToME = pathsSummaryFolder_ + "HLT_"+fGroupNamePathsPair[mi].first+"_Pass_Any";
1218  MonitorElement* ME_1d = dbe_->get(fullPathToME);
1219 // // if(!ME_2d || !ME_1d) {
1220  if(!ME_1d) {
1221  LogTrace("TrigResRateMon") << " ME not valid although I gave full path" << endl;
1222  continue;
1223 
1224  }
1225 
1226 // // TH2F * hist_2d = ME_2d->getTH2F();
1227  TH1F * hist_1d = ME_1d->getTH1F();
1228 
1229  // Fill HLTPassed Matrix bin (i,j) = (Any,Any)
1230  // --------------------------------------------------------
1231 // // int anyBinNumber = hist_2d->GetXaxis()->FindBin("HLT_Any");
1232 
1233  //string groupBinLabel = "HLT_"+fGroupNamePathsPair[mi].first+"_Any";
1234 // // string groupBinLabel = "Total "+fGroupNamePathsPair[mi].first;
1235 // // int groupBinNumber = hist_2d->GetXaxis()->FindBin(groupBinLabel.c_str());
1236 
1237  // any triger accepted
1238  // if(triggerResults_->accept()){
1239 
1240  // hist_2d->Fill(anyBinNumber-1,anyBinNumber-1);//binNumber1 = 0 = first filter
1241 
1242 
1243 
1244  // hist_1d->Fill(anyBinNumber-1);//binNumber1 = 0 = first filter
1245 
1246  // }
1247 
1248 
1249 
1250 
1251  //if (jmsDebug) std::cout << "Setting histograms to HLT_ZeroBias index " << zbIndex << std::endl;
1252 
1253 // // if (zbIndex < triggerResults_->size() ) {
1254 // // if (triggerResults_->accept(zbIndex) || jmsFakeZBCounts) {
1255 // // if (jmsDebug) std::cout << "Filling bin " << (groupBinNumber-1)
1256 // // << " (out of " << hist_1d->GetNbinsX()
1257 // // << ") with ZB counts in histo "
1258 // // << hist_1d->GetName() << std::endl;
1259 
1260 // // hist_1d->Fill(groupBinNumber-1, 50000);
1261 // // hist_2d->Fill(groupBinNumber-1,groupBinNumber-1, 10000);//binNumber1 = 0 = first filter
1262 // // }
1263 // // }
1264 
1265 
1266  bool groupPassed = false;
1267  //bool groupL1Passed = false;
1268 
1269  // Main loop over paths
1270  // --------------------
1271 
1272  //for (int i=1; i< hist_2d->GetNbinsX();i++)
1273  for (unsigned int i=0; i< fGroupNamePathsPair[mi].second.size(); i++)
1274  {
1275 
1276  //string hltPathName = hist_2d->GetXaxis()->GetBinLabel(i);
1277  string hltPathName = fGroupNamePathsPair[mi].second[i];
1278 
1279  // check if this is hlt path name
1280  //unsigned int pathByIndex = triggerNames.triggerIndex(hltPathName);
1281  unsigned int pathByIndex = triggerNames.triggerIndex(fGroupNamePathsPair[mi].second[i]);
1282  if(pathByIndex >= triggerResults_->size() ) continue;
1283 
1284  // check if its L1 passed
1285  // comment out below but set groupL1Passed to true always
1286  //if(hasL1Passed(hltPathName,triggerNames)) groupL1Passed = true;
1287  //groupL1Passed = true;
1288 
1289  // Fill HLTPassed Matrix and HLTPassFail Matrix
1290  // --------------------------------------------------------
1291 
1292  if(triggerResults_->accept(pathByIndex)){
1293 
1294  groupPassed = true;
1295  //groupL1Passed = true;
1296 
1297 // // hist_2d->Fill(i,anyBinNumber-1);//binNumber1 = 0 = first filter
1298 // // hist_2d->Fill(anyBinNumber-1,i);//binNumber1 = 0 = first filter
1299 
1300 // // hist_2d->Fill(i,groupBinNumber-1);//binNumber1 = 0 = first filter
1301 // // hist_2d->Fill(groupBinNumber-1,i);//binNumber1 = 0 = first filter
1302 
1303  if (jmsDebug) std::cout << "Trying to get prescales... " << std::endl;
1304 
1305  psValueCombo = hltConfig_.prescaleValues(iEvent, iSetup, hltPathName);
1306 
1307  if (jmsDebug) std::cout << "Path " << hltPathName
1308  << " L1 PS " << psValueCombo.first
1309  << " and hlt ps " << psValueCombo.second << std::endl;
1310 
1311  if ( (psValueCombo.first > 0) && (psValueCombo.second > 0) ){
1312  hist_1d->Fill(i, psValueCombo.first * psValueCombo.second );//binNumber1 = 0 = first filter
1313  } else {
1314  hist_1d->Fill(i);
1315  }
1316 
1317  //for (int j=1; j< hist_2d->GetNbinsY();j++)
1318 //* for (unsigned int j=0; j< fGroupNamePathsPair[mi].second.size(); j++)
1319 //* {
1320 
1321 //* string crossHltPathName = fGroupNamePathsPair[mi].second[j];
1322 
1323 //* //unsigned int crosspathByIndex = triggerNames.triggerIndex(hist_2d->GetXaxis()->GetBinLabel(j));
1324 //* //unsigned int crosspathByIndex = triggerNames.triggerIndex(crossHltPathName);
1325 //* unsigned int crosspathByIndex = triggerNames.triggerIndex(fGroupNamePathsPair[mi].second[j]);
1326 
1327 //* if(crosspathByIndex >= triggerResults_->size() ) continue;
1328 
1329 //* if(triggerResults_->accept(crosspathByIndex)){
1330 
1331 //* hist_2d->Fill(i,j);//binNumber1 = 0 = first filter
1332 
1333 //* } // end if j path passed
1334 
1335 //* } // end for j
1336 
1337  } // end if i passed
1338 
1339 
1340  } // end for i
1341 
1342  if(groupPassed) {
1343 
1344  rawCountsPerPD[mi]++ ;
1345  //hist_1d->Fill(groupBinNumber-1);//binNumber1 = 0 = first filter
1346  //hist_2d->Fill(groupBinNumber-1,groupBinNumber-1);//binNumber1 = 0 = first filter
1347  //hist_2d->Fill(anyBinNumber-1,groupBinNumber-1);//binNumber1 = 0 = first filter
1348  //hist_2d->Fill(groupBinNumber-1,anyBinNumber-1);//binNumber1 = 0 = first filter
1349 
1350  }
1351 
1352  // if the group belongs to stream A
1353  // store groupName and Bool if it has passed
1354  bool isGroupFromStreamA = false;
1355 
1356  vector<string> streamDatasetNames = hltConfig_.streamContent("A") ;
1357  for (unsigned int g=0;g<streamDatasetNames.size();g++) {
1358 
1359  if(streamDatasetNames[g] == fGroupNamePathsPair[mi].first)
1360  {
1361 
1362  isGroupFromStreamA = true;
1363  break;
1364 
1365  }
1366  }
1367 
1368  if(isGroupFromStreamA) groupAcceptPair.push_back(make_pair(fGroupNamePathsPair[mi].first,groupPassed));
1369 
1370 
1371  // L1 groups - not used anymore
1372 // string groupL1BinLabel = "HLT_"+fGroupNamePathsPair[mi].first+"_L1_Any";
1373 // // int groupL1BinNumber = hist_2d->GetXaxis()->FindBin(groupL1BinLabel.c_str());
1374 
1375 // // if(groupL1Passed) hist_1d->Fill(groupL1BinNumber-1);//binNumber1 = 0 = first filter
1376 
1377  } // end for mi
1378 
1379 // // fullPathToME = pathsSummaryFolder_ + "HLT_A_PassPass";
1380 // // MonitorElement* ME_2d_Stream = dbe_->get(fullPathToME);
1381  fullPathToME = pathsSummaryFolder_ + "HLT_A_Pass_Any";
1382  MonitorElement* ME_1d_Stream = dbe_->get(fullPathToME);
1383 // // if(!ME_2d_Stream || !ME_1d_Stream) {
1384  if(!ME_1d_Stream) {
1385 
1386  LogTrace("TrigResRateMon") << " ME not valid although I gave full path" << endl;
1387  return;
1388 
1389  }
1390  else {
1391 
1392 // // TH2F * hist_2d_Stream = ME_2d_Stream->getTH2F();
1393  TH1F * hist_1d_Stream = ME_1d_Stream->getTH1F();
1394 
1395  int streamBinNumber = hist_1d_Stream->GetXaxis()->GetLast();
1396 
1397  bool acceptedStreamA = false;
1398 
1399  // loop over groups
1400  for (unsigned int i=0;i<groupAcceptPair.size();i++) {
1401 
1402  if(groupAcceptPair[i].second) {
1403 
1404  acceptedStreamA = true;
1405 
1406 // // int groupBinNumber_i = hist_2d_Stream->GetXaxis()->FindBin(groupAcceptPair[i].first.c_str());
1407  int groupBinNumber_i = hist_1d_Stream->GetXaxis()->FindBin(groupAcceptPair[i].first.c_str());
1408  //LogTrace("TrigResRateMon") << "Accepted group X " << groupAcceptPair[i].first.c_str() << " bin number " << groupBinNumber_i << endl;
1409  // Robin what about prescale for this one?
1410  hist_1d_Stream->Fill(groupBinNumber_i-1);//binNumber1 = 0 = first filter
1411 // // hist_2d_Stream->Fill(groupBinNumber_i-1,streamBinNumber-1);//binNumber1 = 0 = first filter
1412 // // hist_2d_Stream->Fill(streamBinNumber-1,groupBinNumber_i-1);//binNumber1 = 0 = first filter
1413 
1414 // // for (unsigned int j=0;j<groupAcceptPair.size();j++) {
1415 
1416 
1417 // // if(groupAcceptPair[j].second) {
1418 
1419 // // int groupBinNumber_j = hist_2d_Stream->GetXaxis()->FindBin(groupAcceptPair[j].first.c_str());
1420 // // //LogTrace("TrigResRateMon") << "Accepted group Y " << groupAcceptPair[j].first.c_str() << " bin number " << groupBinNumber_j << endl;
1421 
1422 // // // fill StreamMatrix(i,j)
1423 // // hist_2d_Stream->Fill(groupBinNumber_i-1,groupBinNumber_j-1);//binNumber1 = 0 = first filter
1424 
1425 // // } // end if j-th group accepted
1426 
1427 // // } // end for j
1428 
1429  } // end if i-th group accepted
1430 
1431  } // end for i
1432 
1433  if(acceptedStreamA) {
1434 
1435 // hist_2d_Stream->Fill(streamBinNumber-1,streamBinNumber-1);//binNumber1 = 0 = first filter
1436  hist_1d_Stream->Fill(streamBinNumber-1);//binNumber1 = 0 = first filter
1437 
1438  passAny = true ; //Robin
1439 
1440  }
1441 
1442  } // end else
1443 
1444 }
1445 
1446 
1447 
1449 
1450 
1451  if (jmsDebug) std::cout << "Filling counts per path" << std::endl;
1452 
1453  if (!triggerResults_.isValid()) {
1454  if (jmsDebug) std::cout << "Trigger Results not valid, sorry" << std::endl;
1455  return;
1456  }
1457 
1458  for (unsigned iName = 0; iName < hltConfig_.size(); iName++) {
1459  if ( triggerResults_ -> accept ( iName ) ){
1460  rawCountsPerPath[iName]++;
1461 
1462  //---Robin
1463  std::string thisName = hltConfig_.triggerName(iName);
1464 
1465  std::pair<int,int> psValueCombo = hltConfig_.prescaleValues(iEvent, iSetup, thisName);
1466  // if ps OK,
1467  if ( (psValueCombo.first > 0) && (psValueCombo.second > 0) ){
1468  finalCountsPerPath[iName] += psValueCombo.first * psValueCombo.second;
1469  } else {
1470  finalCountsPerPath[iName]++;
1471  }
1472  //-----------
1473 
1474  if ( (iName == referenceTrigIndex_) && (foundReferenceTrigger_) ) {
1475  // the get the prescales, and increment the PS*counts
1476  std::pair<int,int> psValueCombo = hltConfig_.prescaleValues(iEvent, iSetup, referenceTrigName_);
1477  // if ps OK,
1478  if ( (psValueCombo.first > 0) && (psValueCombo.second > 0) ){
1479  referenceTrigCountsPS_ += psValueCombo.first * psValueCombo.second;
1480  } else {
1482  }
1483 
1484  }// end if this is reference
1485 
1486  //Robin
1487  // std::string thisName = hltConfig_.triggerName(iName);
1488 // TString checkName(thisName.c_str());
1489 // if (checkName.Contains("HLT_IsoMu24_v")){
1490 
1491 // std::pair<int,int> psValueCombo = hltConfig_.prescaleValues(iEvent, iSetup, thisName);
1492 // // if ps OK,
1493 // if ( (psValueCombo.first > 0) && (psValueCombo.second > 0) ){
1494 // testTrigCountsPS_ += psValueCombo.first * psValueCombo.second;
1495 // } else {
1496 // testTrigCountsPS_++;
1497 // }
1498 
1499 // }
1500 
1501  } // end if trig fired
1502  }// end loop over paths
1503 
1504  // loop over all pds
1505  for (std::vector<DatasetInfo>::iterator iDS = primaryDataSetInformation.begin();
1506  iDS != primaryDataSetInformation.end();
1507  iDS++) {
1508 
1509  // now loop over all paths in the PD
1510 
1511  for (std::vector<std::string>::iterator iPath = iDS->pathNames.begin();
1512  iPath != iDS->pathNames.end();
1513  iPath++){
1514 
1515  unsigned trigIndex = hltConfig_.triggerIndex(*iPath);
1516  // did you pass the trigger?
1517  if ( triggerResults_ -> accept ( trigIndex ) ){
1518 
1519  // ok, you passed, increment the raw counts plot
1520  MonitorElement * thisRawCountsPlot = dbe_->get(iDS->rawCountsPerPathME_Name);
1521  if (thisRawCountsPlot){
1522  iDS->fillRawCountsForPath(thisRawCountsPlot, *iPath);
1523  } else {
1524  if (jmsDebug) std::cout << "sorry but couldn't find this raw counts plot"<< iDS->datasetName << std::endl;
1525  }
1526 
1527 
1528 
1529  // the get the prescales, and increment the PS*counts
1530  std::pair<int,int> psValueCombo = hltConfig_.prescaleValues(iEvent, iSetup, *iPath);
1531 
1532  // if ps OK,
1533  if ( (psValueCombo.first > 0) && (psValueCombo.second > 0) ){
1534  iDS->incrementCountsForPath(*iPath, psValueCombo.first*psValueCombo.second);
1535  } else {
1536  iDS->incrementCountsForPath(*iPath);
1537  }
1538 
1539  }
1540  }// end for each path
1541 
1542  }// end for each pd
1543 
1544 
1545 
1546 
1547 }
1548 
1550 
1551 
1552  for (unsigned iName = 0; iName < hltConfig_.size(); iName++) {
1553 
1554  rawCountsPerPath.push_back(0);
1555  finalCountsPerPath.push_back(0); //Robin
1556 
1557  }
1558 
1559 
1560 }
1561 
1562 
1564 
1565  if (jmsDebug) std::cout << "Looking for reference trigger " << referenceTrigInput_ << std::endl;
1566  for (unsigned iName = 0; iName < hltConfig_.size(); iName++) {
1567 
1568  std::string thisName = hltConfig_.triggerName(iName);
1569  TString tempThisName(thisName.c_str());
1570  if (tempThisName.Contains(referenceTrigInput_)){
1571  referenceTrigName_ = thisName;
1572  if (jmsDebug) std::cout << "Using Reference trigger " << referenceTrigName_ << std::endl;
1573  referenceTrigIndex_ = iName;
1574  foundReferenceTrigger_ = true;
1576  break;
1577  }// end if name contains substring
1578  }
1579 
1580  if (!foundReferenceTrigger_) {
1581  std::cout << "Sorry, we couldn't find a trigger like " << referenceTrigInput_ << std::endl;
1582  }
1583 
1584 }
1585 
1586 
1588 
1589  std::cout << "===> COUNTS THIS LUMI <===" << std::endl;
1590 
1591  for (unsigned iName = 0; iName < hltConfig_.size() ; iName++) {
1592  std::cout << hltConfig_.triggerName(iName)
1593  << " = " << rawCountsPerPath[iName]
1594  << "finalCounts = " << finalCountsPerPath[iName] //Robin
1595  << std::endl;
1596  }
1597 
1598  std::cout << "+++ Reference trigger " << referenceTrigName_ << " index " << referenceTrigIndex_ << " counts " << referenceTrigCountsPS_ << std::endl;
1599 
1600  // loop over all pds
1601  for (std::vector<DatasetInfo>::const_iterator iDS = primaryDataSetInformation.begin();
1602  iDS != primaryDataSetInformation.end();
1603  iDS++) {
1604 
1605  iDS->printCountsPerPath();
1606 
1607  }
1608 
1609 
1610 }
1611 
1613 
1614 
1615 // for (unsigned iName = 0; iName < hltConfig_.size() ; iName++) {
1616 
1617 // rawCountsPerPath[iName] = 0;
1618 // finalCountsPerPath[iName] = 0; //Robin
1619 
1620 // }
1621 
1623  // testTrigCountsPS_ = 0 ; //Robin
1624 
1625  for (std::vector<DatasetInfo>::iterator iDS = primaryDataSetInformation.begin();
1626  iDS != primaryDataSetInformation.end();
1627  iDS++) {
1628  iDS->clearCountsPerPath();
1629  }
1630 
1631 
1632 }
1633 
1635 
1636  averageInstLumi = 0;
1637 
1638 }
1639 
1641 
1642  if (averageInstLumi == 0) {
1644  } else {
1646  }
1647 
1648 }
1649 
1651 
1652  // calculate the reference cross section
1653 
1654  double refTrigXSec = referenceTrigCountsPS_ / ( averageInstLumi * LSsize_);
1655 
1656  // string fullpath = pathsSummaryFolder_ + "HLT_A_Pass_Any";
1657  // MonitorElement * meStreamA = dbe_->get(fullpath);
1658  // if (!meStreamA ) std::cout << "sorry but couldn't get the stream A ME" << std::endl;
1659 
1660  int iPD = 0;
1661 
1662  for (std::vector<DatasetInfo>::iterator iDS = primaryDataSetInformation.begin();
1663  iDS != primaryDataSetInformation.end();
1664  iDS++) {
1665  MonitorElement * thisXsecPlot = dbe_->get(iDS->xsecPerPathME_Name);
1666  MonitorElement * scaledXsecPlot = dbe_->get(iDS->scaledXsecPerPathME_Name);
1667  if (thisXsecPlot){
1668  iDS->fillXsecPlot(thisXsecPlot, averageInstLumi, LSsize_);
1669  } else {
1670  if (jmsDebug) std::cout << "sorry but couldn't find this xsec plot"<< iDS->datasetName << std::endl;
1671  }
1672 
1673  if (scaledXsecPlot){
1674  iDS->fillXsecPlot(scaledXsecPlot, averageInstLumi, LSsize_, refTrigXSec);
1675  } else {
1676  if (jmsDebug) std::cout << "sorry but couldn't find this scaled xsec plot"<< iDS->datasetName << std::endl;
1677  }
1678 
1680  MonitorElement * thisRatePlot = dbe_->get(iDS->ratePerLSME_Name);
1681  if (thisRatePlot) {
1682 
1683  double rate = rawCountsPerPD[iPD] / LSsize_ ;
1684 
1685  TH1F* rateHist = thisRatePlot->getTH1F();
1686  rateHist->SetBinContent(lumi, rate);
1687  }
1688  else {
1689  if (jmsDebug) std::cout << "sorry but couldn't find this rate plot"<< iDS->datasetName << std::endl;
1690  }
1691 
1692  rawCountsPerPD[iPD] = 0 ;
1693  iPD++;
1694  }
1695 
1696 }
1697 
1698 
1700 {
1701 
1702  //pathsSummaryFolder_ = TString("HLT/TrigResults/PathsSummary/");
1703  //dbe_->setCurrentFolder(pathsSummaryFolder_.c_str());
1705 
1706  // setup HLT bx plot
1707  unsigned int npaths = hltPathsDiagonal_.size();
1708 
1709  ME_HLT_BX = dbe_->book2D("HLT_bx",
1710  "HLT counts vs Event bx",
1711  Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
1712  ME_HLT_CUSTOM_BX = dbe_->book2D("HLT_Custom_bx",
1713  "HLT counts vs Event bx",
1714  Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
1715  ME_HLT_BX->setAxisTitle("Bunch Crossing");
1716  ME_HLT_CUSTOM_BX->setAxisTitle("Bunch Crossing");
1717 
1718 
1719  // Set up bin labels on Y axis continuing to cover all npaths
1720  for(unsigned int i = 0; i < npaths; i++){
1721 
1722  ME_HLT_BX->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
1723  ME_HLT_CUSTOM_BX->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
1724 
1725  }
1726 
1727 
1728 }
1729 
1731 {
1732 
1733  unsigned int npaths = hltPathsDiagonal_.size();
1734 
1735  //pathsSummaryHLTPathsPerLSFolder_ = TString("HLT/TrigResults/PathsSummary/HLT LS/");
1736  //dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_.c_str());
1738 
1739  ME_HLTAll_LS = dbe_->book2D("AllSelectedPaths_count_LS",
1740  "AllSelectedPaths paths rate [Hz]",
1741  nLS_, 0, nLS_, npaths+1, -0.5, npaths+1-0.5);
1742  ME_HLTAll_LS->setAxisTitle("Luminosity Section");
1743 
1744  // Set up bin labels on Y axis continuing to cover all npaths
1745  for(unsigned int i = 0; i < npaths; i++){
1746 
1747  ME_HLTAll_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
1748 
1749  }
1750 
1751  unsigned int i = npaths;
1752  ME_HLTAll_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, "HLT_Any");
1753 
1754  int nBinsPerLSHisto = 20;
1755  int nLSHistos = npaths/nBinsPerLSHisto;
1756  for (int nh=0;nh<nLSHistos+1;nh++) {
1757 
1758  char name[200];
1759  char title[200];
1760 
1761  sprintf(name, "Group_%d_paths_count_LS",nLSHistos-nh);
1762  sprintf(title, "Group %d, paths rate [Hz]",nLSHistos-nh);
1763 
1764  MonitorElement* tempME = dbe_->book2D(name,title,
1765  nLS_, 0, nLS_, nBinsPerLSHisto+3, -0.5, nBinsPerLSHisto+3-0.5);
1766 
1767  tempME->setAxisTitle("LS");
1768 
1769  // Set up bin labels on Y axis continuing to cover all npaths
1770  for(int i = nh*nBinsPerLSHisto; i < (nh+1)*nBinsPerLSHisto; i++){
1771 
1772  if (i == int(npaths)) break;
1773 
1774  int bin;
1775  if(nh == 0){
1776 
1777  bin = i;
1778 
1779  }
1780  else {
1781 
1782  bin = i % nBinsPerLSHisto;
1783 
1784  }
1785 
1786  tempME->setBinLabel(bin+1, hltPathsDiagonal_[i].getPath().c_str(), 2);
1787 
1788  }
1789 
1790  tempME->setBinLabel(nBinsPerLSHisto+3, "HLT_Any", 2);
1791  tempME->setBinLabel(nBinsPerLSHisto+2, "HLT_PhysicsDeclared", 2);
1792 
1793  v_ME_HLTAll_LS.push_back(tempME);
1794 
1795  }
1796 
1797 
1798 }
1799 
1800 //Robin
1802 {
1803 
1804  unsigned int npaths = testPaths_.size();
1805 
1806  //pathsSummaryHLTPathsPerLSFolder_ = TString("HLT/TrigResults/PathsSummary/HLT LS/");
1807  //dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_.c_str());
1808  //dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_);
1810 
1811  TProfile tempProfile("XsecVsTestPath", "Xsec vs Test Path;;Xsec #mub", npaths, 0.5, npaths+0.5);
1812  meXsecPerTestPath = dbe_->bookProfile("XsecVsTestPath", &tempProfile);
1813 
1814 
1815  for(unsigned int i = 0; i < npaths; i++){
1816  const char* pname = testPaths_[i].c_str() ;
1817  TString pathname = testPaths_[i].c_str() ;
1818  meXsecPerTestPath->getTProfile()->GetXaxis()->SetBinLabel(i+1, pathname );
1819 
1821  char name[200];
1822  char title[200];
1823 
1824  sprintf(name, "path_%s_XsecVsLS", pname);
1825  sprintf(title, "path_%s_XsecVsLS;LS;Xsec #mub", pname);
1826 
1827  MonitorElement* tempME = dbe_->book1D(name,title, nLS_, 0, nLS_ );
1828 
1829  tempME->setAxisTitle("LS");
1830 
1831  v_ME_XsecPerLS.push_back(tempME);
1832 
1833  char name2[200];
1834  char title2[200];
1835 
1836  sprintf(name2, "path_%s_countsVsLS", pname);
1837  sprintf(title2, "path_%s_countsVsLS;LS;Counts", pname);
1838 
1839  MonitorElement* tempME2 = dbe_->book1D(name2, title2, nLS_, 0, nLS_ );
1840 
1841  tempME2->setAxisTitle("LS");
1842 
1843  v_ME_CountsPerLS.push_back(tempME2);
1844 
1845  }
1846 
1847  MonitorElement* meXsec1 = dbe_->book1D("Xsec_HLT_IsoMu30_eta2p1", "HLT_IsoMu30_eta2p1 Xsec;Xsec #mub;number of LS", 10, 0.008, 0.012);
1848  MonitorElement* meXsec2 = dbe_->book1D("Xsec_HLT_Ele65_CaloIdVT_TrkIdT", "HLT_Ele65_CaloIdVT_TrkIdT Xsec;Xsec #mub;number of LS", 10, 0.002, 0.0025);
1849  MonitorElement* meXsec3 = dbe_->book1D("Xsec_HLT_MET200", "HLT_MET200 Xsec;Xsec #mub;number of LS", 10, 0.0004, 0.0008);
1850  MonitorElement* meXsec4 = dbe_->book1D("Xsec_HLT_Jet370", "HLT_Jet370 Xsec;Xsec #mub;number of LS", 10, 0.0006, 0.0008);
1851  MonitorElement* meXsec5 = dbe_->book1D("Xsec_HLT_HT600", "HLT_HT600 Xsec;Xsec #mub;number of LS", 10, 0.004, 0.005);
1852  MonitorElement* meXsec6 = dbe_->book1D("Xsec_HLT_Photon26_R9Id_Photon18_R9Id", "HLT_Photon26_R9Id_Photon18_R9Id Xsec;Xsec #mub;number of LS", 10, 0.002, 0.004);
1853  MonitorElement* meXsec7 = dbe_->book1D("Xsec_HLT_IsoMu15_eta2p1_LooseIsoPFTau20", "HLT_IsoMu15_eta2p1_LooseIsoPFTau20 Xsec;Xsec #mub;number of LS", 10, 0.0022, 0.003);
1854  MonitorElement* meXsec8 = dbe_->book1D("Xsec_HLT_PFMHT150", "HLT_PFMHT150 Xsec;Xsec #mub;number of LS", 10, 0.0005, 0.001);
1855  MonitorElement* meXsec9 = dbe_->book1D("Xsec_HLT_Photon90_CaloIdVL_IsoL", "HLT_Photon90_CaloIdVL_IsoL Xsec;Xsec #mub;number of LS", 10, 0.0015, 0.0025);
1856 
1857 
1858  v_ME_Xsec.push_back(meXsec1);
1859  v_ME_Xsec.push_back(meXsec2);
1860  v_ME_Xsec.push_back(meXsec3);
1861  v_ME_Xsec.push_back(meXsec4);
1862  v_ME_Xsec.push_back(meXsec5);
1863  v_ME_Xsec.push_back(meXsec6);
1864  v_ME_Xsec.push_back(meXsec7);
1865  v_ME_Xsec.push_back(meXsec8);
1866  v_ME_Xsec.push_back(meXsec9);
1867 
1868 
1869 }
1870 
1872 
1873  //int lumi = int(lumiSeg.id().luminosityBlock());
1874  //if(lumi < 74 || lumi > 77) fLumiFlag = false;
1875  //else fLumiFlag = true;
1876 
1877  if (jmsDebug) std::cout << "Inside begin lumi block" << std::endl;
1878 
1880  clearLumiAverage();
1881  nStream_ = 0 ;
1882  nPass_ = 0 ;
1883 
1884 }
1885 
1887 {
1888 
1889  int lumi = int(lumiSeg.id().luminosityBlock());
1890  LogTrace("TrigResRateMon") << " end lumiSection number " << lumi << endl;
1891 
1892 // countHLTPathHitsEndLumiBlock(lumi);
1893 // countHLTGroupHitsEndLumiBlock(lumi);
1894  //countHLTGroupL1HitsEndLumiBlock(lumi);
1895  //countHLTGroupBXHitsEndLumiBlock(lumi);
1896 
1897 // normalizeHLTMatrix();
1898 
1899  //if (jmsDebug) printCountsPerPathThisLumi();
1901  if (jmsDebug) std::cout << "Average lumi is " << averageInstLumi << std::endl;
1902 
1903  if (averageInstLumi > 500) {
1904 // MonitorElement* reportSumME = dbe_->get("Info/EventInfo/reportSummaryMap" );
1905 // TH2F * reportSum = reportSumME->getTH2F();
1906 // float physDecl = reportSum->GetBinContent(lumi,26);
1907 
1908  fillXsecPerDataset(lumi);
1909 
1910  filltestHisto(lumi); //Robin
1911  }
1912  //Robin-------Diagnostic plots--------
1913 // TH1F* tempXsecPerLS = meXsecPerLS->getTH1F();
1914 // double xsec = 1.0;
1915 
1916 // // std::cout << "counts for HLT_IsoMu15* is " << testTrigCountsPS_ << std::endl;
1917 
1918 // if (averageInstLumi > 0) {
1919 // xsec = testTrigCountsPS_ / (averageInstLumi*LSsize_);
1920 // }
1921 // // std::cout << "LS is " << lumi << " ; xsec is "<< xsec << std::endl;
1922 // tempXsecPerLS->SetBinContent(lumi, xsec);
1923 
1924 
1925 // TH1F* tempXsec = meXsec->getTH1F();
1926 // tempXsec->Fill(xsec);
1927 
1928 // TProfile* tempXsecPerIL = meXsecPerIL->getTProfile();
1929 // tempXsecPerIL->Fill(averageInstLumi,xsec);
1930 
1931  //--------- stream counts and xsec
1932  TH1F* tempCountsStreamPerLS = meCountsStreamPerLS->getTH1F();
1933  // std::cout << "number of stream counts is " << nStream_ << std::endl;
1934  tempCountsStreamPerLS->SetBinContent(lumi, nStream_);
1935 
1936  // dropped events
1937  MonitorElement* tempDroppedEvents = dbe_->get("SM_SMPS_Stats/droppedEventsCount_HLTTrigerResults DQM Consumer" );
1938  if (tempDroppedEvents) {
1939  TH1F* tempDiagnostic = meDiagnostic->getTH1F();
1940  if (tempDroppedEvents->kind() == MonitorElement::DQM_KIND_INT){
1941  tempDiagnostic->Fill(2);
1942  int64_t tempDroppedCounts = tempDroppedEvents->getIntValue();
1943  int64_t currentDroppedCounts = tempDroppedCounts - TotalDroppedCounts;
1944  TotalDroppedCounts = tempDroppedCounts ;
1945  TH1F* tempCountsDroppedPerLS = meCountsDroppedPerLS->getTH1F();
1946  tempCountsDroppedPerLS->SetBinContent(lumi, currentDroppedCounts);
1947  }
1948  else tempDiagnostic->Fill(1);
1949  }
1950  else {
1951  TH1F* tempDiagnostic = meDiagnostic->getTH1F();
1952  tempDiagnostic->Fill(0);
1953  }
1954 
1955  TH1F* tempXsecStreamPerLS = meXsecStreamPerLS->getTH1F();
1956  double xsecStream = 1.0 ;
1957  if (averageInstLumi > 0){
1958  xsecStream = nStream_ / (averageInstLumi*LSsize_);
1959  tempXsecStreamPerLS->SetBinContent(lumi, xsecStream);
1960  }
1961 
1962  TH1F* tempCountsPassPerLS = meCountsPassPerLS->getTH1F();
1963  // std::cout << "number of passed stream counts is " << nPass_ << std::endl;
1964  tempCountsPassPerLS->SetBinContent(lumi, nPass_);
1965 
1966  //-----------
1967 
1968  // keep track of what you thought the lumi was
1969  // assign an error of 6%
1970  TH1F* tempLumiPerLS = meAverageLumiPerLS->getTH1F();
1971  tempLumiPerLS->SetBinContent(lumi, averageInstLumi);
1972  tempLumiPerLS->SetBinError(lumi, averageInstLumi*0.06);
1973 
1974 
1975 }
1976 
1977 //Robin----
1979 
1981 
1982  if (lumi%3 == 0){
1983  unsigned int npaths = testPaths_.size();
1984  for(unsigned int i = 0; i < npaths; i++){
1985  TString pathname = testPaths_[i].c_str() ;
1986  pathname += "_v" ;
1987 
1988  int index = 0 ;
1989  int rawCount = 0 ;
1990  int finalCount = 0;
1991  double xsec = 0 ;
1992 
1993 
1994  //find the index for this test trigger path
1995  for (unsigned iName = 0; iName < hltConfig_.size(); iName++) {
1996 
1997  std::string thisName = hltConfig_.triggerName(iName);
1998  TString checkName(thisName.c_str());
1999  if (checkName.Contains(pathname)){
2000  index = iName ;
2001  // std::cout << "==>test path name is " << checkName << std::endl;
2002  break ;
2003  }
2004  }
2005 
2006  MonitorElement* testME_XsecPerLS = v_ME_XsecPerLS[i];
2007  MonitorElement* testME_rawCountsPerLS = v_ME_CountsPerLS[i];
2008  MonitorElement* testME_Xsec = v_ME_Xsec[i];
2009  // TProfile tempProfile("XsecVsTestPath", "Xsec vs Test Path", npaths, 0.5, npaths+0.5);
2010 
2011  rawCount = rawCountsPerPath[index];
2012  finalCount = finalCountsPerPath[index];
2013 
2014  testME_rawCountsPerLS->getTH1F()->SetBinContent(lumi, rawCount);
2015 
2016  if (averageInstLumi > 0 ) {
2017  xsec = finalCount/ (averageInstLumi3LS*LSsize_); //averageInstLumi ???
2018 
2019  testME_XsecPerLS->getTH1F()->SetBinContent(lumi, xsec);
2020  // testME_rawCountsPerLS->getTH1F()->SetBinContent(lumi, rawCount);
2021  testME_Xsec->getTH1F()->Fill(xsec);
2022 
2023  meXsecPerTestPath->getTProfile()->Fill(i+1,xsec);
2024  }
2025  }
2026 
2027  for (unsigned iName = 0; iName < hltConfig_.size() ; iName++) {
2028 
2029  rawCountsPerPath[iName] = 0;
2030  finalCountsPerPath[iName] = 0; //Robin
2031  }
2032  averageInstLumi3LS = 0 ;
2033 
2034  } // end if 3xLS
2035 
2036 }
2037 //----------
2038 
2040 {
2041 
2042  LogTrace("TrigResRateMon") << " countHLTGroupBXHitsEndLumiBlock() lumiSection number " << lumi << endl;
2043 
2044  if(! ME_HLT_BX) return;
2045 
2046  TH2F * hist_2d_bx = ME_HLT_BX->getTH2F();
2047 
2048  for (std::vector<std::pair<std::string, vector<int> > >::iterator ip = fPathBxTempCountPair.begin(); ip != fPathBxTempCountPair.end(); ++ip) {
2049 
2050  // get the path and its previous count
2051  std::string pathname = ip->first;
2052  vector<int> prevCount = ip->second;
2053 
2054  // vector of 5 zeros
2055  vector<int> currCount (5,0);
2056  vector<int> diffCount (5,0);
2057 
2058  // get the current count of path up to now
2059  int pathBin = hist_2d_bx->GetYaxis()->FindBin(pathname.c_str());
2060 
2061  if(pathBin > hist_2d_bx->GetNbinsY()) {
2062 
2063  LogTrace("TrigResRateMon") << " Cannot find the bin for path " << pathname << endl;
2064  continue;
2065 
2066  }
2067 
2068  for (unsigned int b =0;b<currCount.size();b++) {
2069 
2070  int bxOffset = b-2;
2071  int bunch = referenceBX_+bxOffset;
2072  if(bunch < 1) bunch += Nbx_ ;
2073  int bxBin = bunch +1; // add one to get the right bin
2074 
2075 
2076  currCount[b] = int(hist_2d_bx->GetBinContent(bxBin, pathBin)); // add one to get the right bin
2077 
2078  LogTrace("TrigResRateMon") << "currCount = " << currCount[b] << endl;
2079 
2080  // count due to prev lumi sec is a difference bw current and previous
2081  diffCount[b] = currCount[b] - prevCount[b];
2082 
2083  LogTrace("TrigResRateMon") << " lumi = " << lumi << " path " << pathname << "bxOffset = " << bxOffset << " count = " << diffCount[b] << endl;
2084 
2085  } // end for bx b
2086 
2087  // set the counter in the pair to current count
2088  ip->second = currCount;
2089 
2091  // fill the 2D Group paths' BX count per LS, using currCount
2093  LogTrace("TrigResRateMon") << "Find " << pathname << endl;
2094 
2095  //check if the path is in this group
2096  //for (unsigned int j=0;j<fGroupNamePathsPair.size();j++)
2097  for (unsigned int j=0;j<v_ME_Total_BX.size();j++)
2098  {
2099 
2100  bool isMember = false;
2101 
2102  LogTrace("TrigResRateMon") << " ---- Group " << fGroupNamePathsPair[j].first << endl;
2103 
2104  // decide if pathname is member of this group
2105  for (unsigned int k = 0; k<(fGroupNamePathsPair[j].second).size();k++) {
2106 
2107  LogTrace("TrigResRateMon") << " comparing to " << fGroupNamePathsPair[j].second[k] << endl;
2108 
2109  if(fGroupNamePathsPair[j].second[k] == pathname) {
2110 
2111  isMember = true;
2112  break;
2113 
2114  }
2115 
2116  } // end for k
2117 
2118  if(!isMember) {
2119 
2120  LogTrace("TrigResRateMon") << "Could not find a group to which the path belongs, path = " << pathname << " group = " << fGroupNamePathsPair[j].first << endl;
2121  continue;
2122 
2123  }
2124 
2125  MonitorElement* ME_2d = v_ME_Total_BX[j];
2126 
2127  if (! ME_2d) {
2128 
2129  LogDebug("TrigResRateMon") << " cannot find ME_2d for group " << fGroupNamePathsPair[j].first << endl;
2130  continue;
2131 
2132  }
2133 
2134  vector<int> updatedLumiCount(5,0);
2135 
2136  float entireBXWindowUpdatedLumiCount = 0;
2137 
2138  TH2F* hist_All = ME_2d->getTH2F();
2139 
2140  for (unsigned int b = 0; b<diffCount.size();b++) {
2141 
2142  // find the bin
2143  int binNumber = b+1; // add one to get right bin
2144 
2145  // update the bin content (must do that since events don't ncessarily come in the order
2146  int currentLumiCount = int(hist_All->GetBinContent(lumi+1,binNumber));
2147  updatedLumiCount[b] = currentLumiCount + diffCount[b];
2148  hist_All->SetBinContent(lumi+1,binNumber,updatedLumiCount[b]);
2149 
2150  entireBXWindowUpdatedLumiCount += updatedLumiCount[b];
2151 
2152  } // end for bx b
2153 
2154  MonitorElement* ME_2d_Norm = v_ME_Total_BX_Norm[j];
2155 
2156  if (! ME_2d_Norm) {
2157 
2158  LogDebug("TrigResRateMon") << " cannot find ME_2d_Norm for group " << fGroupNamePathsPair[j].first << endl;
2159  continue;
2160 
2161  }
2162 
2163  TH2F* hist_All_Norm = ME_2d_Norm->getTH2F();
2164 
2165  for (unsigned int b = 0; b<diffCount.size();b++) {
2166 
2167  // find the bin
2168  int binNumber = b+1; // add one to get right bin
2169 
2170  // update the bin content but normalized to the whole columb (BX windw +/- 2)
2171  hist_All_Norm->SetBinContent(lumi+1,binNumber,float(updatedLumiCount[b])/entireBXWindowUpdatedLumiCount);
2172 
2173  } // end for bx b
2174 
2175  } // end for group j
2176 
2177  } // end for ip
2178 
2179 }
2180 
2182 {
2183 
2184  LogTrace("TrigResRateMon") << " countHLTGroupL1HitsEndLumiBlock() lumiSection number " << lumi << endl;
2185 
2186  for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
2187 
2188  // get the count of path up to now
2189  string fullPathToME = pathsSummaryFolder_ + "HLT_" + fGroupNamePathsPair[i].first+ "_Pass_Any";
2190  MonitorElement* ME_1d = dbe_->get(fullPathToME);
2191 
2192  if(! ME_1d) {
2193 
2194  LogTrace("TrigResRateMon") << " could not find 1d matrix " << fullPathToME << endl;
2195 
2196  continue;
2197 
2198  }
2199 
2200  LogTrace("TrigResRateMon") << " Looking in histogram " << fullPathToME << endl;
2201 
2202  TH1F * hist_1d = ME_1d->getTH1F();
2203 
2204  for (std::vector<std::pair<std::string, float> >::iterator ip = fGroupL1TempCountPair.begin(); ip != fGroupL1TempCountPair.end(); ++ip) {
2205 
2206  // get the path and its previous count
2207  string pathname = ip->first;
2208  float prevCount = ip->second;
2209 
2210  string binLabel = "HLT_"+pathname+"_L1_Any";
2211 
2212  LogTrace("TrigResRateMon") << " Looking for binLabel = " << binLabel << endl;
2213  // get the current count of path up to now
2214  int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
2215 
2216  LogTrace("TrigResRateMon") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << endl;
2217  if(pathBin == -1) {
2218 
2219  LogTrace("TrigResRateMon") << " Cannot find the bin for path " << pathname << endl;
2220  continue;
2221 
2222  }
2223 
2224  float currCount = hist_1d->GetBinContent(pathBin)/LSsize_;
2225 
2226  // count due to prev lumi sec is a difference bw current and previous
2227  float diffCount = currCount - prevCount;
2228 
2229  LogTrace("TrigResRateMon") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << endl;
2230 
2231  // set the counter in the pair to current count
2232  ip->second = currCount;
2233 
2234 
2236  // fill the 1D individual path count per LS
2238  string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_L1_Total_LS";
2239  MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
2240  if ( ME_1d) {
2241 
2242  // update the bin content (must do that since events don't ncessarily come in the order
2243  float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
2244  float updatedLumiCount = currentLumiCount + diffCount;
2245  ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
2246 
2247  }
2248  else {
2249 
2250  LogDebug("TrigResRateMon") << " cannot find ME " << fullPathToME_count << endl;
2251 
2252  }
2253 
2254  } // end for ip
2255 
2256  } // end for i
2257 
2258 }
2259 
2260 
2262 {
2263 
2264  LogTrace("TrigResRateMon") << " countHLTGroupHitsEndLumiBlock() lumiSection number " << lumi << endl;
2265  for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
2266 
2267  // get the count of path up to now
2268  string fullPathToME = pathsSummaryFolder_ + "HLT_" + fGroupNamePathsPair[i].first + "_Pass_Any";
2269  MonitorElement* ME_1d = dbe_->get(fullPathToME);
2270 
2271  if(! ME_1d) {
2272 
2273  LogTrace("TrigResRateMon") << " could not find 1d matrix " << fullPathToME << endl;
2274 
2275  continue;
2276 
2277  }
2278 
2279  LogTrace("TrigResRateMon") << " Looking in histogram " << fullPathToME << endl;
2280 
2281  TH1F * hist_1d = ME_1d->getTH1F();
2282 
2283  for (std::vector<std::pair<std::string, float> >::iterator ip = fGroupTempCountPair.begin(); ip != fGroupTempCountPair.end(); ++ip) {
2284 
2285  // get the path and its previous count
2286  string pathname = ip->first;
2287  float prevCount = ip->second;
2288 
2289  string binLabel = "Total "+pathname;
2290 
2291  LogTrace("TrigResRateMon") << " Looking for binLabel = " << binLabel << endl;
2292 
2293  // get the current count of path up to now
2294  int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
2295 
2296  LogTrace("TrigResRateMon") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << endl;
2297  if(pathBin == -1) {
2298 
2299  binLabel = pathname;
2300  int alternativePathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
2301 
2302  if(alternativePathBin == -1) {
2303 
2304  LogTrace("TrigResRateMon") << " Cannot find the bin for path " << pathname << endl;
2305 
2306  continue;
2307 
2308  }
2309  else {
2310 
2311  pathBin = alternativePathBin;
2312 
2313  }
2314 
2315  }
2316 
2317  float currCount = hist_1d->GetBinContent(pathBin)/LSsize_;
2318 
2319  // count due to prev lumi sec is a difference bw current and previous
2320  float diffCount = currCount - prevCount;
2321 
2322  LogTrace("TrigResRateMon") << " lumi = " << lumi << " path " << pathname << " diffCount " << diffCount << endl;
2323 
2324  // set the counter in the pair to current count
2325  ip->second = currCount;
2326 
2328  // fill the 1D and 2D gruop and 2d_Stream_A count per LS
2330  string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_Total_LS";
2331  MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
2332 
2333  string fullPathToME_2D_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_LS";
2334  MonitorElement* ME_2d = dbe_->get(fullPathToME_2D_count);
2335 
2336  string fullPathToME_Stream_A_2D_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_A_LS";
2337  MonitorElement* ME_Stream_A_2d = dbe_->get(fullPathToME_Stream_A_2D_count);
2338 
2339  if ( ME_1d && ME_2d && ME_Stream_A_2d) {
2340 
2341  // update the bin content (must do that since events don't ncessarily come in the order
2342 
2343  float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
2344  float updatedLumiCount = currentLumiCount + diffCount;
2345  ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
2346 
2347  string groupBinLabel = "Total " + fGroupNamePathsPair[i].first;
2348  int groupBin = ME_2d->getTH2F()->GetYaxis()->FindBin(groupBinLabel.c_str());
2349  if(groupBin != -1) ME_2d->getTH2F()->SetBinContent(lumi+1,groupBin,updatedLumiCount);
2350 
2351  // this is to deal with Stream A and bins with names of PDs
2352  groupBinLabel = fGroupNamePathsPair[i].first;
2353  groupBin = ME_Stream_A_2d->getTH2F()->GetYaxis()->FindBin(groupBinLabel.c_str());
2354  if(groupBin != -1) ME_Stream_A_2d->getTH2F()->SetBinContent(lumi+1,groupBin,updatedLumiCount);
2355 
2356  }
2357  else {
2358 
2359  LogDebug("TrigResRateMon") << " cannot find ME " << fullPathToME_count << endl;
2360 
2361  }
2362 
2363  } // end for ip
2364 
2365  } // end for i
2366 
2367 }
2368 
2369 
2371 {
2372 
2373  LogTrace("TrigResRateMon") << " countHLTPathHitsEndLumiBlock() lumiSection number " << lumi << endl;
2374  // get the count of path up to now
2375  string fullPathToME = pathsSummaryFolder_ + "HLT_AllSelectedPaths_PassPass";
2376  MonitorElement* ME_2d = dbe_->get(fullPathToME);
2377 
2378  if(! ME_2d) {
2379 
2380  LogTrace("TrigResRateMon") << " could not fine 2d matrix " << fullPathToME << endl;
2381 
2382  return;
2383 
2384  }
2385 
2386  TH2F * hist_2d = ME_2d->getTH2F();
2387 
2388  for (std::vector<std::pair<std::string, float> >::iterator ip = fPathTempCountPair.begin(); ip != fPathTempCountPair.end(); ++ip) {
2389 
2390  // get the path and its previous count
2391  std::string pathname = ip->first;
2392  float prevCount = ip->second;
2393 
2394  // get the current count of path up to now
2395  float pathBin = hist_2d->GetXaxis()->FindBin(pathname.c_str());
2396 
2397  if(pathBin > hist_2d->GetNbinsX()) {
2398 
2399  LogTrace("TrigResRateMon") << " Cannot find the bin for path " << pathname << endl;
2400  continue;
2401 
2402  }
2403 
2404  float currCount = hist_2d->GetBinContent(pathBin, pathBin)/LSsize_;
2405 
2406  // count due to prev lumi sec is a difference bw current and previous
2407  float diffCount = currCount - prevCount;
2408 
2409  LogTrace("TrigResRateMon") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << endl;
2410 
2411  // set the counter in the pair to current count
2412  ip->second = currCount;
2413 
2415  // fill the 2D All paths' count per LS
2417  if ( ME_HLTAll_LS) {
2418 
2419  TH2F* hist_All = ME_HLTAll_LS->getTH2F();
2420 
2421  // find the bin
2422  int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
2423 
2424  // update the bin content (must do that since events don't ncessarily come in the order
2425  float currentLumiCount = hist_All->GetBinContent(lumi+1,pathBinNumber);
2426  float updatedLumiCount = currentLumiCount + diffCount;
2427  hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
2428 
2429  }
2430  else {
2431 
2432  LogDebug("TrigResRateMon") << " cannot find ME_HLTAll_LS" << endl;
2433 
2434  }
2435 
2436  for (unsigned int i=0 ; i< v_ME_HLTAll_LS.size(); i++) {
2437 
2438  MonitorElement* tempME = v_ME_HLTAll_LS[i];
2439 
2440  if ( tempME ) {
2441 
2442  TH2F* hist_All = tempME->getTH2F();
2443 
2444  // find the bin
2445  int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
2446  // update the bin content (must do that since events don't ncessarily come in the order
2447  float currentLumiCount = hist_All->GetBinContent(lumi+1,pathBinNumber);
2448  float updatedLumiCount = currentLumiCount + diffCount;
2449  hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
2450 
2451  }
2452  else {
2453 
2454  LogDebug("TrigResRateMon") << " cannot find tempME " << endl;
2455 
2456  }
2457 
2458  }
2459 
2460 
2462  // fill the 1D individual path count per LS
2464  string fullPathToME_count = pathsIndividualHLTPathsPerLSFolder_ + pathname + "_count_per_LS";
2465  MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
2466  if ( ME_1d) {
2467 
2468  // update the bin content (must do that since events don't ncessarily come in the order
2469  float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
2470  float updatedLumiCount = currentLumiCount + diffCount;
2471  ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
2472 
2473  }
2474  else {
2475 
2476  LogDebug("TrigResRateMon") << " cannot find ME " << fullPathToME_count << endl;
2477 
2478  }
2479 
2480  } // end for ip
2481 
2482 }
2483 
2485 {
2486 
2487  int objectType = 0;
2488 
2489  if (pathname.find("MET") != std::string::npos)
2490  objectType = trigger::TriggerMET;
2491  if (pathname.find("SumET") != std::string::npos)
2492  objectType = trigger::TriggerTET;
2493  if (pathname.find("HT") != std::string::npos)
2494  objectType = trigger::TriggerTET;
2495  if (pathname.find("Jet") != std::string::npos)
2496  objectType = trigger::TriggerJet;
2497  if (pathname.find("Mu") != std::string::npos)
2498  objectType = trigger::TriggerMuon;
2499  if (pathname.find("Ele") != std::string::npos)
2500  objectType = trigger::TriggerElectron;
2501  if (pathname.find("Photon") != std::string::npos)
2502  objectType = trigger::TriggerPhoton;
2503  if (pathname.find("EG") != std::string::npos)
2504  objectType = trigger::TriggerPhoton;
2505  if (pathname.find("Tau") != std::string::npos)
2506  objectType = trigger::TriggerTau;
2507  if (pathname.find("IsoTrack") != std::string::npos)
2508  objectType = trigger::TriggerTrack;
2509  if (pathname.find("BTag") != std::string::npos)
2510  objectType = trigger::TriggerBJet;
2511 
2512  return objectType;
2513 }
2514 
2516 {
2517 
2518  // find L1 condition for numpath with numpath objecttype
2519  // find PSet for L1 global seed for numpath,
2520  // list module labels for numpath
2521  string l1pathname = "dummy";
2522 
2523  vector<string> numpathmodules = hltConfig_.moduleLabels(pathname);
2524 
2525  for(vector<string>::iterator numpathmodule = numpathmodules.begin();
2526  numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
2527 
2528  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
2529 
2530  l1pathname = *numpathmodule;
2531  break;
2532 
2533  }
2534 
2535  } // end for
2536 
2537  return l1pathname;
2538 
2539 }
2540 
2541 
2542 bool TrigResRateMon::hasL1Passed(const string& pathname, const edm::TriggerNames & triggerNames)
2543 {
2544 
2545  bool rc = false;
2546  int l1ModuleIndex = 999;
2547  // --------------------
2548  for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
2549 
2550  if(v->getPath() == pathname ) l1ModuleIndex = v->getL1ModuleIndex();
2551 
2552  }
2553 
2554  unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
2555  if(pathByIndex >= triggerResults_->size() ) return rc; // path is not in the menu
2556 
2557  // get index of the last module that issued the decision
2558  int lastModule = triggerResults_->index(pathByIndex);
2559 
2560  // if L1 passed, then it must not be the module that
2561  // issued the last decision
2562  rc = (l1ModuleIndex < lastModule);
2563 
2564  return rc;
2565 
2566 }
2567 
2568 bool TrigResRateMon::hasHLTPassed(const string& pathname, const edm::TriggerNames & triggerNames)
2569 {
2570 
2571  bool rc = false;
2572 
2573  unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
2574  if(pathByIndex >= triggerResults_->size() ) return rc; // path is not in the menu
2575 
2576  rc = triggerResults_->accept(pathByIndex);
2577  return rc;
2578 
2579 }
2580 
2581 
2583 {
2584 
2586  //cout << "----------------------------------------------" << endl;
2587  //cout << pathname << endl;
2588 
2589  //remove "L1" substr
2590  if(pathname.find("L1") != std::string::npos) pathname.replace(pathname.find("L1"),2,"");
2591  //remove "L2" substr
2592  if(pathname.find("L2") != std::string::npos) pathname.replace(pathname.find("L2"),2,"");
2593  //remove "8E29" substr
2594  if(pathname.find("8E29") != std::string::npos) pathname.replace(pathname.find("8E29"),4,"");
2595 
2596  int digitLocation=0;
2597  for (unsigned int i=0; i < pathname.length(); i++)
2598  {
2599  if (isdigit(pathname.at(i))) {
2600 
2601  digitLocation = i;
2602  break;
2603 
2604  }
2605  }
2606 
2607  // get the string from the location of the first digit to the end
2608  string hltThresholdString = pathname.substr(digitLocation);
2609 
2610  int hltThreshold = 0;
2611 
2612  // get intiger at the begining of the string
2613  sscanf (hltThresholdString.c_str(),"%d%*s",&hltThreshold);
2614  //printf ("%s -> %s -> %d\n",pathname.c_str(), hltThresholdString.c_str(), hltThreshold);
2615 
2616  return hltThreshold;
2617 
2618 }
2619 
2621 
2622  string fullPathToME;
2623 
2624  // again, get hold of dataset names
2625  //vector<string> datasetNames = hltConfig_.datasetNames() ;
2626  vector<string> datasetNames = hltConfig_.streamContent("A") ;
2627 
2628  // fill vectors of MEs needed in normalization
2629  for (unsigned int i=0;i<datasetNames.size();i++) {
2630 
2631  fullPathToME = pathsSummaryFolder_ +"HLT_"+datasetNames[i]+"_PassPass";
2632  v_ME_HLTPassPass.push_back( dbe_->get(fullPathToME));
2633 
2634  fullPathToME = pathsSummaryHLTCorrelationsFolder_+"HLT_"+datasetNames[i]+"_PassPass_Normalized";
2635  v_ME_HLTPassPass_Normalized.push_back( dbe_->get(fullPathToME));
2636 
2637  fullPathToME = pathsSummaryHLTCorrelationsFolder_+"HLT_"+datasetNames[i]+"_Pass_Normalized_Any";
2638  v_ME_HLTPass_Normalized_Any.push_back( dbe_->get(fullPathToME));
2639 
2640  }
2641 
2642  // add stream MEs
2643  fullPathToME = pathsSummaryFolder_ +"HLT_A_PassPass";
2644  v_ME_HLTPassPass.push_back( dbe_->get(fullPathToME));
2645 
2646  fullPathToME = pathsSummaryHLTCorrelationsFolder_+"HLT_A_PassPass_Normalized";
2647  v_ME_HLTPassPass_Normalized.push_back( dbe_->get(fullPathToME));
2648 
2649  fullPathToME = pathsSummaryHLTCorrelationsFolder_+"HLT_A_Pass_Normalized_Any";
2650  v_ME_HLTPass_Normalized_Any.push_back( dbe_->get(fullPathToME));
2651 
2652  for (unsigned int i =0;i<v_ME_HLTPassPass.size();i++) {
2653 
2654  MonitorElement* ME_HLTPassPass = v_ME_HLTPassPass[i];
2655  MonitorElement* ME_HLTPassPass_Normalized = v_ME_HLTPassPass_Normalized[i];
2656  MonitorElement* ME_HLTPass_Normalized_Any = v_ME_HLTPass_Normalized_Any[i];
2657 
2658  if(!ME_HLTPassPass || !ME_HLTPassPass_Normalized || !ME_HLTPass_Normalized_Any) return;
2659 
2660  float passCount = 0;
2661  unsigned int nBinsX = ME_HLTPassPass->getTH2F()->GetNbinsX();
2662  unsigned int nBinsY = ME_HLTPassPass->getTH2F()->GetNbinsY();
2663 
2664  for(unsigned int binX = 0; binX < nBinsX+1; binX++) {
2665 
2666  passCount = ME_HLTPassPass->getTH2F()->GetBinContent(binX,binX);
2667 
2668 
2669  for(unsigned int binY = 0; binY < nBinsY+1; binY++) {
2670 
2671  if(passCount != 0) {
2672 
2673  // normalize each bin to number of passCount
2674  float normalizedBinContentPassPass = (ME_HLTPassPass->getTH2F()->GetBinContent(binX,binY))/passCount;
2675  //float normalizedBinContentPassFail = (ME_HLTPassFail_->getTH2F()->GetBinContent(binX,binY))/passCount;
2676 
2677  ME_HLTPassPass_Normalized->getTH2F()->SetBinContent(binX,binY,normalizedBinContentPassPass);
2678  //ME_HLTPassFail_Normalized_->getTH2F()->SetBinContent(binX,binY,normalizedBinContentPassFail);
2679 
2680  if(binX == nBinsX) {
2681 
2682  ME_HLTPass_Normalized_Any->getTH1F()->SetBinContent(binY,normalizedBinContentPassPass);
2683 
2684  }
2685 
2686  }
2687  else {
2688 
2689  ME_HLTPassPass_Normalized->getTH2F()->SetBinContent(binX,binY,0);
2690  //ME_HLTPassFail_Normalized_->getTH2F()->SetBinContent(binX,binY,0);
2691 
2692  } // end if else
2693 
2694  } // end for binY
2695 
2696  } // end for binX
2697 
2698  } // end for i
2699 
2700 }
#define LogDebug(id)
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
unsigned int size() const
number of trigger paths in trigger table
std::vector< unsigned > rawCountsPerPD
std::vector< std::pair< std::string, float > > fGroupL1TempCountPair
edm::InputTag triggerResultsLabel_
LuminosityBlockID id() const
double normalizedChi2Cut_
int getThresholdFromName(const std::string &pathname)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
unsigned int nBinsOneOverEt_
int i
Definition: DBlmapReader.cc:9
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:204
std::string pathsSummaryFilterCountsFolder_
TrigResRateMon(const edm::ParameterSet &)
RunID const & id() const
Definition: RunBase.h:41
const std::string moduleType(const std::string &module) const
C++ class name of module.
HLTConfigProvider hltConfig_
std::vector< std::string > fGroupName
void countHLTGroupBXHitsEndLumiBlock(const int &lumi)
void fillHltMatrix(const edm::TriggerNames &triggerNames, const edm::Event &iEvent, const edm::EventSetup &iSetup)
std::vector< std::string > testPaths_
std::vector< std::pair< std::string, float > > fPathTempCountPair
const std::string & triggerName(unsigned int triggerIndex) const
void setPaths(const std::vector< std::string > &inputPaths)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
std::vector< unsigned > finalCountsPerPath
std::vector< std::pair< std::string, std::vector< std::string > > > fGroupNamePathsPair
MonitorElement * ME_HLTAll_LS
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::string fCustomBXPath
MonitorElement * meAverageLumiPerLS
tuple lumi
Definition: fjr2json.py:35
edm::InputTag recHitsEBTag_
double averageInstLumi3LS
MonitorElement * scalersSelect
bool hasL1Passed(const std::string &pathname, const edm::TriggerNames &triggerNames)
void countHLTGroupHitsEndLumiBlock(const int &lumi)
PathInfoCollection hltPaths_
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::vector< MonitorElement * > v_ME_HLTAll_LS
#define NULL
Definition: scimark2.h:8
std::vector< MonitorElement * > v_ME_Xsec
std::string pathsSummaryHLTPathsPerLSFolder_
double thresholdFactor_
double dRMaxElectronMuon_
void setupHltMatrix(const std::string &label, std::vector< std::string > &paths)
edm::EDGetTokenT< LumiScalersCollection > lumiScalersToken_
std::vector< unsigned > rawCountsPerPath
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:26
void countHLTGroupL1HitsEndLumiBlock(const int &lumi)
std::string dirname_
std::vector< DatasetInfo > primaryDataSetInformation
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
PathInfoCollection hltPathsDiagonal_
double averageInstLumi
void Fill(long long x)
void addLumiToAverage(double lumi)
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
bool hasHLTPassed(const std::string &pathname, const edm::TriggerNames &triggerNames)
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
U second(std::pair< T, U > const &p)
std::vector< std::string > specialPaths_
Definition: ME.h:11
int iEvent
Definition: GenABIO.cc:243
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
bool foundReferenceTrigger_
std::string pathsSummaryStreamsFolder_
const std::vector< std::string > & streamContent(unsigned int stream) const
names of datasets in stream with index i
void setupStreamMatrix(const std::string &label, std::vector< std::string > &paths)
std::vector< std::pair< std::string, float > > fGroupTempCountPair
unsigned int nBinsDR_
std::vector< MonitorElement * > v_ME_HLTPassPass_Normalized
edm::InputTag recHitsEETag_
int j
Definition: DBlmapReader.cc:9
TH1 * getTH1(void) const
virtual void endJob()
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1186
void setVerbose(unsigned level)
Definition: DQMStore.cc:548
void countHLTPathHitsEndLumiBlock(const int &lumi)
Kind kind(void) const
Get the type of the monitor element.
std::vector< MonitorElement * > v_ME_HLTPassPass
static std::string const triggerResults
Definition: EdmProvDump.cc:41
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1623
std::vector< MonitorElement * > v_ME_Total_BX
void filltestHisto(const int &lumi)
std::vector< MonitorElement * > v_ME_CountsPerLS
bool first
Definition: L1TdeRCT.cc:79
bool isValid() const
Definition: HandleBase.h:76
edm::EDGetTokenT< edm::TriggerResults > triggerResultsTokenFU_
MonitorElement * ME_HLT_BX
#define LogTrace(id)
edm::InputTag triggerSummaryLabel_
unsigned int referenceBX_
std::string referenceTrigName_
MonitorElement * meXsecPerTestPath
int k[5][pyjets_maxn]
unsigned referenceTrigIndex_
std::vector< MonitorElement * > v_ME_Total_BX_Norm
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
unsigned int Nbx_
const std::vector< std::string > & datasetContent(unsigned int dataset) const
names of trigger paths in dataset with index i
std::string pathsSummaryFolder_
unsigned int nLS_
std::string testPathsFolder_
MonitorElement * meCountsDroppedPerLS
void fillXsecPerDataset(const int &lumi)
void findReferenceTriggerIndex()
std::string pathsIndividualHLTPathsPerLSFolder_
edm::Handle< edm::TriggerResults > triggerResults_
MonitorElement * meXsecStreamPerLS
int64_t getIntValue(void) const
void beginRun(const edm::Run &run, const edm::EventSetup &c)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::string referenceTrigInput_
MonitorElement * meDiagnostic
TH1F * getTH1F(void) const
double b
Definition: hdecay.h:120
LuminosityBlockNumber_t luminosityBlock() const
std::pair< int, int > prescaleValues(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger) const
Combined L1T (pair.first) and HLT (pair.second) prescales per HLT path.
std::vector< MonitorElement * > v_ME_XsecPerLS
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::string const & label() const
Definition: InputTag.h:42
double rate(double x)
Definition: Constants.cc:3
std::string pathsSummaryHLTCorrelationsFolder_
void endRun(const edm::Run &run, const edm::EventSetup &c)
EndRun.
void printCountsPerPathThisLumi()
std::vector< std::string > maskedPaths_
MonitorElement * meCountsStreamPerLS
TProfile * getTProfile(void) const
std::vector< MonitorElement * > v_ME_HLTPass_Normalized_Any
void setMaskedPaths(const std::vector< std::string > &inputPaths)
int64_t TotalDroppedCounts
tuple cout
Definition: gather_cfg.py:121
unsigned int nBins2D_
DQMStore * dbe_
virtual void beginJob()
volatile std::atomic< bool > shutdown_flag false
std::string pathsSummaryHLTPathsPerBXFolder_
TH2F * getTH2F(void) const
int getTriggerTypeParsePathName(const std::string &pathname)
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
std::string processname_
std::vector< std::pair< std::string, std::vector< int > > > fPathBxTempCountPair
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
unsigned int nBins_
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
std::string const & instance() const
Definition: InputTag.h:43
tuple size
Write out results.
MonitorElement * ME_HLT_CUSTOM_BX
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
MonitorElement * meCountsPassPerLS
const std::string getL1ConditionModuleName(const std::string &pathname)
Definition: Run.h:41
unsigned referenceTrigCountsPS_
void fillCountsPerPath(const edm::Event &iEvent, const edm::EventSetup &iSetup)