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