CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FourVectorHLTOnline.cc
Go to the documentation of this file.
1 // $Id: FourVectorHLTOnline.cc,v 1.42 2012/02/28 10:54:57 fwyzard Exp $
2 // See header file for information.
3 #include "TMath.h"
6 
7 #include <map>
8 #include <utility>
9 
10 
11 using namespace edm;
12 using namespace trigger;
13 using namespace std;
14 
16  resetMe_(true), currentRun_(-99)
17 {
18 
19  LogDebug("FourVectorHLTOnline") << "constructor...." ;
20 
22  if ( ! dbe_ ) {
23  LogInfo("FourVectorHLTOnline") << "unabel to get DQMStore service?";
24  }
25  if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
26  dbe_->setVerbose(0);
27  }
28 
29  dirname_ = iConfig.getUntrackedParameter("dirname", std::string("HLT/FourVector/"));
30  //dirname_ += iConfig.getParameter<std::string>("@module_label");
31 
32  if (dbe_ != 0 ) {
34  }
35 
36  processname_ = iConfig.getParameter<std::string>("processname");
37  fCustomBXPath = iConfig.getUntrackedParameter<std::string>("customBXPath", std::string("HLT_MinBiasBSC"));
38 
39  referenceBX_ = iConfig.getUntrackedParameter<unsigned int>("referenceBX",51);
40  Nbx_ = iConfig.getUntrackedParameter<unsigned int>("Nbx",3564);
41 
42  // plotting paramters
43  ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
44  ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",1000.);
45  nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",20);
46  nBinsOneOverEt_ = iConfig.getUntrackedParameter<unsigned int>("NbinsOneOverEt",10000);
47  nLS_ = iConfig.getUntrackedParameter<unsigned int>("NLuminositySegments",10);
48 
49 
50  plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
51  // this is the list of paths to look at.
52  std::vector<edm::ParameterSet> paths =
53  iConfig.getParameter<std::vector<edm::ParameterSet> >("paths");
54 
55  for(std::vector<edm::ParameterSet>::iterator pathconf = paths.begin() ; pathconf != paths.end(); pathconf++) {
56 
57  //std::pair<std::string, std::string> custompathnamepair;
58  //custompathnamepair.first =pathconf->getParameter<std::string>("pathname");
59  //custompathnamepair.second = pathconf->getParameter<std::string>("denompathname");
60  //custompathnamepairs_.push_back(custompathnamepair);
61  custompathnamepairs_.push_back(
62  make_pair(
63  pathconf->getParameter<std::string>("pathname"),
64  pathconf->getParameter<std::string>("denompathname")
65  )
66  );
67 
68  }
69 
70  if (hltPaths_.size() > 0)
71  {
72  // book a histogram of scalers
73  scalersSelect = dbe_->book1D("selectedScalers","Selected Scalers", hltPaths_.size(), 0.0, (double)hltPaths_.size());
74 
75  }
76 
77  triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
78  triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
79  muonRecoCollectionName_ = iConfig.getUntrackedParameter("muonRecoCollectionName", std::string("muons"));
80 
81  electronEtaMax_ = iConfig.getUntrackedParameter<double>("electronEtaMax",2.5);
82  electronEtMin_ = iConfig.getUntrackedParameter<double>("electronEtMin",3.0);
83  electronDRMatch_ =iConfig.getUntrackedParameter<double>("electronDRMatch",0.3);
84 
85  muonEtaMax_ = iConfig.getUntrackedParameter<double>("muonEtaMax",2.1);
86  muonEtMin_ = iConfig.getUntrackedParameter<double>("muonEtMin",3.0);
87  muonDRMatch_ =iConfig.getUntrackedParameter<double>("muonDRMatch",0.3);
88 
89  tauEtaMax_ = iConfig.getUntrackedParameter<double>("tauEtaMax",2.5);
90  tauEtMin_ = iConfig.getUntrackedParameter<double>("tauEtMin",3.0);
91  tauDRMatch_ =iConfig.getUntrackedParameter<double>("tauDRMatch",0.3);
92 
93  jetEtaMax_ = iConfig.getUntrackedParameter<double>("jetEtaMax",5.0);
94  jetEtMin_ = iConfig.getUntrackedParameter<double>("jetEtMin",10.0);
95  jetDRMatch_ =iConfig.getUntrackedParameter<double>("jetDRMatch",0.3);
96 
97  bjetEtaMax_ = iConfig.getUntrackedParameter<double>("bjetEtaMax",2.5);
98  bjetEtMin_ = iConfig.getUntrackedParameter<double>("bjetEtMin",10.0);
99  bjetDRMatch_ =iConfig.getUntrackedParameter<double>("bjetDRMatch",0.3);
100 
101  photonEtaMax_ = iConfig.getUntrackedParameter<double>("photonEtaMax",2.5);
102  photonEtMin_ = iConfig.getUntrackedParameter<double>("photonEtMin",3.0);
103  photonDRMatch_ =iConfig.getUntrackedParameter<double>("photonDRMatch",0.3);
104 
105  trackEtaMax_ = iConfig.getUntrackedParameter<double>("trackEtaMax",2.5);
106  trackEtMin_ = iConfig.getUntrackedParameter<double>("trackEtMin",3.0);
107  trackDRMatch_ =iConfig.getUntrackedParameter<double>("trackDRMatch",0.3);
108 
109  metEtaMax_ = iConfig.getUntrackedParameter<double>("metEtaMax",5);
110  metMin_ = iConfig.getUntrackedParameter<double>("metMin",10.0);
111  metDRMatch_ =iConfig.getUntrackedParameter<double>("metDRMatch",0.5);
112 
113  htEtaMax_ = iConfig.getUntrackedParameter<double>("htEtaMax",5);
114  htMin_ = iConfig.getUntrackedParameter<double>("htMin",10.0);
115  htDRMatch_ =iConfig.getUntrackedParameter<double>("htDRMatch",0.5);
116 
117  sumEtMin_ = iConfig.getUntrackedParameter<double>("sumEtMin",10.0);
118 
119  specialPaths_ = iConfig.getParameter<std::vector<std::string > >("SpecialPaths");
120 
121  pathsSummaryFolder_ = iConfig.getUntrackedParameter ("pathsSummaryFolder",std::string("HLT/FourVector/PathsSummary/"));
122  pathsSummaryHLTCorrelationsFolder_ = iConfig.getUntrackedParameter ("hltCorrelationsFolder",std::string("HLT/FourVector/PathsSummary/HLT Correlations/"));
123  pathsSummaryFilterCountsFolder_ = iConfig.getUntrackedParameter ("filterCountsFolder",std::string("HLT/FourVector/PathsSummary/Filters Counts/"));
124 
125  pathsSummaryHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("individualPathsPerLSFolder",std::string("HLT/FourVector/PathsSummary/HLT LS/"));
126  pathsIndividualHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("individualPathsPerLSFolder",std::string("HLT/FourVector/PathsSummary/HLT LS/Paths/"));
127  pathsSummaryHLTPathsPerBXFolder_ = iConfig.getUntrackedParameter ("individualPathsPerBXFolder",std::string("HLT/FourVector/PathsSummary/HLT BX/"));
128 
129  fLumiFlag = true;
131  ME_HLT_BX_ = NULL;
133 
134 }
135 
136 
138 {
139 
140  // do anything here that needs to be done at desctruction time
141  // (e.g. close files, deallocate resources etc.)
142 
143 }
144 
145 
146 //
147 // member functions
148 //
149 
150 // ------------ method called to for each event ------------
151 void
153 {
154 
155  //if(! fLumiFlag ) return;
156 
157  using namespace edm;
158  using namespace trigger;
159  ++nev_;
160  LogDebug("FourVectorHLTOnline")<< " analyze...." ;
161 
162 
163 
164  /*
165  Handle<GenParticleCollection> genParticles;
166  iEvent.getByLabel("genParticles", genParticles);
167  if(!genParticles.isValid()) {
168  edm::LogInfo("FourVectorHLTOnline") << "genParticles not found, "
169  "skipping event";
170  return;
171  }
172 
173  Handle<GenJetCollection> genJets;
174  iEvent.getByLabel("iterativeCone5GenJets",genJets);
175  if(!genJets.isValid()) {
176  edm::LogInfo("FourVectorHLTOnline") << "genJets not found, "
177  "skipping event";
178  return;
179  }
180 
181  Handle<GenMETCollection> genMets;
182  iEvent.getByLabel("genMetTrue",genMets);
183  if(!genMets.isValid()) {
184  edm::LogInfo("FourVectorHLTOnline") << "genMets not found, "
185  "skipping event";
186  return;
187  }
188  */
189 
190  // Get trigger results
191 
194  if(!triggerResults.isValid()) {
195  edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
196  iEvent.getByLabel(triggerResultsLabelFU,triggerResults);
197  if(!triggerResults.isValid()) {
198  edm::LogInfo("FourVectorHLTOnline") << "TriggerResults not found, "
199  "skipping event";
200  return;
201  }
202  }
204  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
205  int npath = triggerResults->size();
206 
208  if(!fTriggerObj.isValid()) {
209 
210  edm::InputTag triggerSummaryLabelFU(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(), "FU");
211  iEvent.getByLabel(triggerSummaryLabelFU,fTriggerObj);
212 
213  if(!fTriggerObj.isValid()) {
214 
215  edm::LogInfo("FourVectorHLTOnline") << "TriggerEvent not found, " "skipping event";
216  return;
217 
218  }
219 
220  }
221 
222  edm::Handle<TriggerResults> muonHandle;
223  iEvent.getByLabel(muonRecoCollectionName_,muonHandle);
224  if(!muonHandle.isValid()) {
225 
226  edm::LogInfo("FourVectorHLTOnline") << "muonHandle not found, ";
227  // "skipping event";
228  // return;
229 
230  }
231 
232 
234  iEvent.getByLabel("gsfElectrons",gsfElectrons);
235  if(!gsfElectrons.isValid())
236  edm::LogInfo("FourVectorHLTOnline") << "gsfElectrons not found, ";
237 
238  edm::Handle<TriggerResults> tauHandle;
239  iEvent.getByLabel("caloRecoTauProducer",tauHandle);
240  if(!tauHandle.isValid())
241  edm::LogInfo("FourVectorHLTOnline") << "tauHandle not found, ";
242 
243  edm::Handle<TriggerResults> jetHandle;
244  iEvent.getByLabel("iterativeCone5CaloJets",jetHandle);
245  if(!jetHandle.isValid())
246  edm::LogInfo("FourVectorHLTOnline") << "jetHandle not found, ";
247 
248  // Get b tag information
249  edm::Handle<TriggerResults> bTagIPHandle;
250  iEvent.getByLabel("jetProbabilityBJetTags", bTagIPHandle);
251  if (!bTagIPHandle.isValid())
252  edm::LogInfo("FourVectorHLTOnline") << "mTagIPHandle trackCountingHighEffJetTags not found, ";
253 
254  // Get b tag information
255  edm::Handle<TriggerResults> bTagMuHandle;
256  iEvent.getByLabel("softMuonBJetTags", bTagMuHandle);
257  if (!bTagMuHandle.isValid())
258  edm::LogInfo("FourVectorHLTOnline") << "bTagMuHandle not found, ";
259 
260  edm::Handle<TriggerResults> metHandle;
261  iEvent.getByLabel("met",metHandle);
262  if(!metHandle.isValid())
263  edm::LogInfo("FourVectorHLTOnline") << "metHandle not found, ";
264 
265  edm::Handle<TriggerResults> photonHandle;
266  iEvent.getByLabel("photons",photonHandle);
267  if(!photonHandle.isValid())
268  edm::LogInfo("FourVectorHLTOnline") << "photonHandle not found, ";
269 
270  edm::Handle<TriggerResults> trackHandle;
271  iEvent.getByLabel("pixelTracks",trackHandle);
272  if(!trackHandle.isValid())
273  edm::LogInfo("FourVectorHLTOnline") << "trackHandle not found, ";
274 
275  // ---------------------
276  // Monitors
277  // ---------------------
278 
279  // electron Monitor
281  eleMon.setReco(gsfElectrons);
282  eleMon.setLimits(electronEtaMax_, electronEtMin_, electronDRMatch_);
283 
284  eleMon.pushTriggerType(TriggerElectron);
285  eleMon.pushTriggerType(TriggerL1NoIsoEG);
286  eleMon.pushTriggerType(TriggerL1IsoEG);
287 
288  eleMon.pushL1TriggerType(TriggerL1NoIsoEG);
289  eleMon.pushL1TriggerType(TriggerL1IsoEG);
290 
291  // muon Monitor
293  muoMon.setReco(muonHandle);
294  muoMon.setLimits(muonEtaMax_, muonEtMin_, muonDRMatch_);
295 
296  muoMon.pushTriggerType(TriggerMuon);
297  muoMon.pushTriggerType(TriggerL1Mu);
298 
299  muoMon.pushL1TriggerType(TriggerL1Mu);
300 
301  // tau Monitor
303  tauMon.setReco(tauHandle);
304  tauMon.setLimits(tauEtaMax_, tauEtMin_, tauDRMatch_);
305 
306  tauMon.pushTriggerType(TriggerTau);
307  tauMon.pushTriggerType(TriggerL1TauJet);
308 
309  tauMon.pushL1TriggerType(TriggerL1TauJet);
310  tauMon.pushL1TriggerType(TriggerL1ForJet);
311 
312  // photon Monitor
314  phoMon.setReco(photonHandle);
315  phoMon.setLimits(photonEtaMax_, photonEtMin_, photonDRMatch_);
316 
317  phoMon.pushTriggerType(TriggerPhoton);
318 
319  phoMon.pushL1TriggerType(TriggerL1NoIsoEG);
320  phoMon.pushL1TriggerType(TriggerL1IsoEG);
321 
322  // jet Monitor - NOTICE: we use genJets for MC
324  jetMon.setReco(jetHandle);
325  jetMon.setLimits(jetEtaMax_, jetEtMin_, jetDRMatch_);
326 
327  jetMon.pushTriggerType(TriggerJet);
328  jetMon.pushTriggerType(TriggerL1CenJet);
329  jetMon.pushTriggerType(TriggerL1ForJet);
330 
331  jetMon.pushL1TriggerType(TriggerL1CenJet);
332  jetMon.pushL1TriggerType(TriggerL1ForJet);
333  jetMon.pushL1TriggerType(TriggerL1TauJet);
334 
335  // bjet Monitor - NOTICE: we use genJets for MC
336  objMonData<TriggerResults> btagIPMon; // CaloJet will not be used, this is only place holder
337  //btagIPMon.setReco(jetHandle);
338  btagIPMon.setBJetsFlag(true);
339  btagIPMon.setLimits(bjetEtaMax_, bjetEtMin_, bjetDRMatch_);
340 
341  btagIPMon.pushTriggerType(TriggerBJet);
342  btagIPMon.pushTriggerType(TriggerJet);
343 
344  btagIPMon.pushL1TriggerType(TriggerL1CenJet);
345  btagIPMon.pushL1TriggerType(TriggerL1ForJet);
346  btagIPMon.pushL1TriggerType(TriggerL1TauJet);
347 
348  objMonData<TriggerResults> btagMuMon; // CaloJet will not be used, this is only place holder
349  //btagMuMon.setReco(jetHandle);
350  btagMuMon.setBJetsFlag(true);
351  btagMuMon.setLimits(bjetEtaMax_, bjetEtMin_, bjetDRMatch_);
352 
353  btagMuMon.pushTriggerType(TriggerBJet);
354  btagMuMon.pushTriggerType(TriggerJet);
355 
356  btagMuMon.pushL1TriggerType(TriggerL1CenJet);
357  btagMuMon.pushL1TriggerType(TriggerL1ForJet);
358  btagMuMon.pushL1TriggerType(TriggerL1TauJet);
359 
360 
361  objMonData<TriggerResults> btagMon; // Generic btagMon
362 
363  // met Monitor
365  metMon.setReco(metHandle);
366  metMon.setLimits(metEtaMax_, metMin_, metDRMatch_);
367 
368  metMon.pushTriggerType(TriggerMET);
369 
370  metMon.pushL1TriggerType(TriggerL1ETM);
371 
372  // tet Monitor
374  tetMon.setReco(metHandle);
375  //tetMon.setLimits(tetEtaMax_=999., tetEtMin_=10, tetDRMatch_=999);
376  tetMon.setLimits(999., 10., 999.);
377 
378  tetMon.pushTriggerType(TriggerTET);
379 
380  tetMon.pushL1TriggerType(TriggerL1ETT);
381 
382  // default Monitor
383  //objMonData<trigger::TriggerEvent> defMon;
385  defMon.setLimits(999., 3., 999.);
386 
387  // vector to hold monitors
388  // interface is through virtual class BaseMonitor
389  std::vector<BaseMonitor*> monitors;
390 
391  //monitors.push_back(&jetMon);
392 
393  monitors.push_back(&muoMon);
394  monitors.push_back(&eleMon);
395  monitors.push_back(&tauMon);
396  monitors.push_back(&phoMon);
397  monitors.push_back(&jetMon);
398  monitors.push_back(&btagMon);
399  monitors.push_back(&metMon);
400  monitors.push_back(&tetMon);
401 
402  int bx = iEvent.bunchCrossing();
403  /*
404  // Fill HLTPassed_Correlation Matrix bin (i,j) = (Any,Any)
405  // --------------------------------------------------------
406  int anyBinNumber = ME_HLTPassPass_->getTH2F()->GetXaxis()->FindBin("HLT_Any");
407  // any triger accepted
408  if(triggerResults->accept()){
409 
410  ME_HLTPassPass_->Fill(anyBinNumber-1,anyBinNumber-1);//binNumber1 = 0 = first filter
411 
412  }
413  */
414 
415  //fillHltMatrix(triggerNames);
416 
417 
418  // Loop over paths
419  // --------------------
420  for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
421 
422  LogTrace("FourVectorHLTOnline") << " unique path " << v->getPath() << std::endl;
423 
424  unsigned int pathByIndex = triggerNames.triggerIndex(v->getPath());
425 
426  // path must be in the menu
427  if(pathByIndex >= triggerResults_->size() ) continue;
428 
429 
430  // Fill HLTPassed Matrix and HLTPassFail Matrix
431  // --------------------------------------------------------
432 
433  if(triggerResults->accept(pathByIndex)){
434 
435  int pathBinNumber = ME_HLT_BX_->getTH2F()->GetYaxis()->FindBin(v->getPath().c_str());
436  ME_HLT_BX_->Fill(bx,pathBinNumber-1);
437 
438  if(hasHLTPassed(fCustomBXPath,triggerNames)) {
439 
440  ME_HLT_CUSTOM_BX_->Fill(bx,pathBinNumber-1);
441 
442  }
443 
444  } // end if accept
445 
446  // Fill histogram of filter ocupancy for each HLT path
447  // ---------------------------------
448  unsigned int lastModule = triggerResults->index(pathByIndex);
449 
450  //check if hlt passed
451  bool hltPathPassed = triggerResults->accept(pathByIndex);
452 
453  //go through the list of filters
454  for(unsigned int filt = 0; filt < v->filtersAndIndices.size(); filt++){
455 
456  int binNumber = v->getFiltersHisto()->getTH1()->GetXaxis()->FindBin(v->filtersAndIndices[filt].first.c_str());
457 
458  // if hlt path passed, then all the modules passed
459  // otherwise the module that issued the decision is the first fail
460  // this means that all modules before it passed
461  if(hltPathPassed) {
462 
463  v->getFiltersHisto()->Fill(binNumber-1);//binNumber1 = 0 = first filter
464  }
465  else if(v->filtersAndIndices[filt].second < lastModule){
466  v->getFiltersHisto()->Fill(binNumber-1);//binNumber1 = 0 = first filter
467  }
468 
469  } // end for filt
470 
471  } // end for diag paths
472 
473 
474  // Main loop over paths
475  // --------------------
476  for(PathInfoCollection::iterator v = hltPaths_.begin(); v!= hltPaths_.end(); ++v ) {
477 
478  LogTrace("FourVectorHLTOnline") << " path " << v->getPath() << std::endl;
479 
480  if (v->getPath().find("BTagIP") != std::string::npos ) btagMon = btagIPMon;
481  else btagMon = btagMuMon;
482 
483  //if(*v != "HLT_L1Jet6U") continue;
484 
485  unsigned int pathByIndex = triggerNames.triggerIndex(v->getPath());
486 
487  if(pathByIndex >= triggerResults_->size() ) continue;
488 
489  // did we pass the denomPath?
490  bool denompassed = false;
491 
492  for(int i = 0; i < npath; ++i) {
493 
494  if (triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos && triggerResults->accept(i))
495  {
496  denompassed = true;
497  break;
498  }
499  }
500 
501  if (denompassed)
502  {
503 
504  //LogTrace("FourVectorHLTOnline") << " denominator path " << v->getPath() << std::endl;
505 
506 
507  // Get the righe monitor for this path
508  // -----------------------------------
509  BaseMonitor* mon = NULL;
510 
511  for(std::vector<BaseMonitor*>::iterator mit = monitors.begin(); mit!= monitors.end(); ++mit ) {
512 
513  if((*mit)->isTriggerType(v->getObjectType())) {
514 
515  mon = *mit;
516  break;
517 
518  }
519 
520  }
521 
522  // if cannot find moniotor for the path, go to next path
523  //if(!mon) continue;
524 
525  // if cannot find moniotor for the path, assign the default
526  if(!mon) mon = &defMon;
527 
528  // attach this path to mon
529  mon->setPath(v);
530 
531  // clear sets of matched objects
532  mon->clearSets();
533 
534  //int triggertype = 0;
535  //triggertype = v->getObjectType();
536 
537  // monitor L1 (only if L1 passed and can find GTSeed)
539  bool l1accept = false;
540  edm::InputTag l1testTag(v->getl1Path(),"",processname_);
541  const int l1Index = fTriggerObj->filterIndex(l1testTag);
542 
543  if ( l1Index >= fTriggerObj->sizeFilters() ) {
544 
545  LogTrace("FourVectorHLTOnline") << "Cannot find L1GTSeed of the path " << v->getPath() << std::endl;
546  LogTrace("FourVectorHLTOnline") << "\t L1GTSeed name = " << v->getl1Path() << std::endl;
547  LogTrace("FourVectorHLTOnline") << "\t tried with tag " << l1testTag << std::endl;
548  LogTrace("FourVectorHLTOnline") <<"\t module index = "<< l1Index << std::endl;
549 
550  }
551 
552  // monitor L1 object
553  mon->monitorL1(l1Index, this);
554 
555  // monitor Online (only if HLT passed)
557  bool numpassed = false;
558 
559  // did we pass the numerator path, i.e. HLT path?
560  for(int i = 0; i < npath; ++i) {
561 
562  if (triggerNames.triggerName(i) == v->getPath() && triggerResults->accept(i)) numpassed = true;
563 
564  }
565 
566  if (!numpassed) continue;
567 
568  if (!l1accept) {
569 
570  LogDebug("FourVectorHLTOnline")
571  << "This should not happen. HLT passed, but L1 Seed not passed for hlt path "<< std::endl
572  << "HLT path: " << v->getPath() << "\t HLTLevel1GTSeed: " << v->getl1Path();
573 
574  }
575 
576  // fill scaler histograms
577  edm::InputTag filterTag = v->getTag();
578 
579  // loop through indices and see if the filter is
580  // on the list of filters used by this path
581  //----------------------------------------------
582  if (v->getLabel() == "dummy"){
583  const std::vector<std::string> filterLabels = hltConfig_.moduleLabels(v->getPath());
584 
585  //loop over labels
586  for (std::vector<std::string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
587 
588  edm::InputTag testTag(*labelIter,"",processname_);
589 
590  int testindex = fTriggerObj->filterIndex(testTag);
591 
592  // last match wins...
593  if ( !(testindex >= fTriggerObj->sizeFilters()) ) {
594 
595  filterTag = testTag;
596  v->setLabel(*labelIter);}
597 
598  }
599 
600  } // end for
601 
602  const int hltIndex = fTriggerObj->filterIndex(filterTag);
603  if ( hltIndex >= fTriggerObj->sizeFilters() ) {
604 
605  LogTrace("FourVectorHLTOnline") << "WTF no index of that name " << filterTag << std::endl;
606  continue; // not in this event
607 
608  }
609 
610  mon->monitorOnline(hltIndex, l1Index, this);
611 
612  mon->fillOnlineMatch(l1Index, this);
613 
614  } //denompassed
615 
616 
617  } //pathinfo loop
618 
619 }
620 
621 
622 
623 // -- method called once each job just before starting event loop --------
624 void
626 {
627  nev_ = 0;
628  DQMStore *dbe = 0;
629  dbe = Service<DQMStore>().operator->();
630 
631  if (dbe) {
633  dbe->rmdir(dirname_);
634  }
635 
636 
637  if (dbe) {
639  }
640 }
641 
642 // - method called once each job just after ending the event loop ------------
643 void
645 {
646  LogInfo("FourVectorHLTOnline") << "analyzed " << nev_ << " events";
647  return;
648 }
649 
650 
651 // BeginRun
653 {
654  LogDebug("FourVectorHLTOnline") << "beginRun, run " << run.id();
655 
656  // HLT config does not change within runs!
657  bool changed=false;
658 
659  if (!hltConfig_.init(run, c, processname_, changed)) {
660  processname_ = "FU";
661 
662  if (!hltConfig_.init(run, c, processname_, changed)){
663 
664  LogDebug("FourVectorHLTOnline") << "HLTConfigProvider failed to initialize.";
665 
666  }
667 
668  // check if trigger name in (new) config
669  // std::cout << "Available TriggerNames are: " << std::endl;
670  // hltConfig_.dump("Triggers");
671  }
672 
673  if (1) {
674 
675  DQMStore *dbe = 0;
676  dbe = Service<DQMStore>().operator->();
677 
678  if (dbe) {
680  }
681 
682  const unsigned int n(hltConfig_.size());
683  if (plotAll_){
684 
685  for (unsigned int j=0; j!=n; ++j) {
686 
688 
689  std::string l1pathname = getL1ConditionModuleName(pathname);
690 
691  int objectType = getTriggerTypeParsePathName(pathname);
692 
693  for (unsigned int i=0; i!=n; ++i) {
694 
695  std::string denompathname = hltConfig_.triggerName(i);
696  int denomobjectType = getTriggerTypeParsePathName(denompathname);
697 
698 
699 
700  std::string filtername("dummy");
701  float ptMin = 0.0;
702  float ptMax = 100.0;
703  if (plotAll_ && denomobjectType == objectType && objectType != 0)
704 
705  hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, filtername, processname_, objectType, ptMin, ptMax));
706 
707  }
708  }
709 
710  } // end if plotAll
711  else {
712 
713  // plot all diagonal combinations plus any other specified pairs
714  for (unsigned int i=0; i!=n; ++i) {
715 
716  std::string denompathname = "";
718  //parse pathname to guess object type
719  int objectType = getTriggerTypeParsePathName(pathname);
720 
721  std::string l1pathname = getL1ConditionModuleName(pathname);
722 
723  std::string filtername("dummy");
724  float ptMin = 0.0;
725  float ptMax = 100.0;
726 
727  if (objectType == trigger::TriggerPhoton) ptMax = 100.0;
728  if (objectType == trigger::TriggerElectron) ptMax = 100.0;
729  if (objectType == trigger::TriggerMuon) ptMax = 150.0;
730  if (objectType == trigger::TriggerTau) ptMax = 100.0;
731  if (objectType == trigger::TriggerJet) ptMax = 300.0;
732  if (objectType == trigger::TriggerBJet) ptMax = 300.0;
733  if (objectType == trigger::TriggerMET) ptMax = 300.0;
734  if (objectType == trigger::TriggerTET) ptMax = 300.0;
735  if (objectType == trigger::TriggerTrack) ptMax = 100.0;
736 
737  // keep track of all paths, except for FinalPath
738  if (objectType != -1 && pathname.find("FinalPath") == std::string::npos){
739 
740  hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, filtername, processname_, objectType, ptMin, ptMax));
741 
742  hltPathsDiagonal_.push_back(PathInfo(denompathname, pathname, l1pathname, filtername, processname_, objectType, ptMin, ptMax));
743 
744  }
745 
746  } // end for i
747 
748 
749  // now loop over denom/num path pairs specified in cfg,
750  // recording the off-diagonal ones
751  for (std::vector<std::pair<std::string, std::string> >::iterator custompathnamepair = custompathnamepairs_.begin(); custompathnamepair != custompathnamepairs_.end(); ++custompathnamepair) {
752 
753  std::string numpathname = custompathnamepair->first;
754  std::string denompathname = custompathnamepair->second;
755 
756  if (numpathname != denompathname) {
757 
758  // check that denominator exists
759  bool founddenominator = false;
760  for (unsigned int k=0; k!=n; ++k) {
761 
762  std::string n_pathname = hltConfig_.triggerName(k);
763 
764  if (n_pathname.find(denompathname) != std::string::npos) {
765 
766  LogDebug("FourVectorHLTOnline") << "denompathname is selected to be = " << n_pathname << std::endl;;
767  founddenominator = true;
768 
769  break;
770 
771  }
772  }
773 
774  if (!founddenominator) {
775 
776  edm::LogInfo("FourVectorHLTOnline") << "denompathname not found, go to the next pair numearator-denominator" << std::endl;
777 
778  // go to the next pair
779  continue;
780 
781  }
782 
783  // check that numerator exists
784  bool foundnumerator = false;
785  for (unsigned int j=0; j!=n; ++j) {
786 
788 
789  LogDebug("FourVectorHLTOnline") << "check if path " << pathname << " is numpathname = " << numpathname << std::endl;
790  if (hltConfig_.triggerName(j).find(numpathname)!= std::string::npos) {
791 
792  LogDebug("FourVectorHLTOnline") << "pathname is selected to be = " << denompathname << std::endl;;
793  foundnumerator = true;
794 
795  }
796 
797 
798  if (!foundnumerator) {
799 
800  edm::LogInfo("FourVectorHLTOnline") << "pathname not found, ignoring " << pathname;
801  continue;
802 
803  }
804 
805 
806  std::string l1pathname = getL1ConditionModuleName(pathname);
807  int objectType = getTriggerTypeParsePathName(pathname);
808 
809  std::string filtername("dummy");
810  float ptMin = 0.0;
811  float ptMax = 100.0;
812  if (objectType == trigger::TriggerPhoton) ptMax = 100.0;
813  if (objectType == trigger::TriggerElectron) ptMax = 100.0;
814  if (objectType == trigger::TriggerMuon) ptMax = 150.0;
815  if (objectType == trigger::TriggerTau) ptMax = 100.0;
816  if (objectType == trigger::TriggerJet) ptMax = 300.0;
817  if (objectType == trigger::TriggerBJet) ptMax = 300.0;
818  if (objectType == trigger::TriggerMET) ptMax = 300.0;
819  if (objectType == trigger::TriggerTET) ptMax = 300.0;
820  if (objectType == trigger::TriggerTrack) ptMax = 100.0;
821 
822  // monitor regardless of the objectType of the path
823  if (objectType != 0)
824  hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, filtername, processname_, objectType, ptMin, ptMax));
825 
826  } // end for j, loop over paths
827 
828  } // end if not same num and denominator
829 
830  } // end for pair
831 
832  } // end else
833 
834 
835  std::vector<std::string> muonPaths;
836  std::vector<std::string> egammaPaths;
837  std::vector<std::string> tauPaths;
838  std::vector<std::string> jetmetPaths;
839  std::vector<std::string> restPaths;
840  std::vector<std::string> allPaths;
841  // fill vectors of Muon, Egamma, JetMet, Rest, and Special paths
842  for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
843 
844  std::string pathName = v->getPath();
845  int objectType = v->getObjectType();
846 
847  std::vector<int> tempCount(5,0);
848 
849  fPathTempCountPair.push_back(make_pair(pathName,0));
850  fPathBxTempCountPair.push_back(make_pair(pathName,tempCount));
851 
852  allPaths.push_back(pathName);
853 
854  switch (objectType) {
855  case trigger::TriggerMuon :
856  muonPaths.push_back(pathName);
857  break;
858 
861  egammaPaths.push_back(pathName);
862  break;
863 
864  case trigger::TriggerTau :
865  tauPaths.push_back(pathName);
866  break;
867 
868  case trigger::TriggerJet :
869  case trigger::TriggerMET :
870  jetmetPaths.push_back(pathName);
871  break;
872 
873  default:
874  restPaths.push_back(pathName);
875  }
876 
877  }
878 
879  fPathTempCountPair.push_back(make_pair("HLT_Any",0));
880 
881  fGroupName.push_back("All");
882  fGroupName.push_back("Muon");
883  fGroupName.push_back("Egamma");
884  fGroupName.push_back("Tau");
885  fGroupName.push_back("JetMet");
886  fGroupName.push_back("Rest");
887  fGroupName.push_back("Special");
888 
889  for(unsigned int g=0; g<fGroupName.size(); g++) {
890 
891  //fGroupTempCountPair.push_back(make_pair(fGroupName[g],0));
892  //fGroupL1TempCountPair.push_back(make_pair(fGroupName[g],0));
893 
894  }
895 
897 
898 
899 
900  fGroupNamePathsPair.push_back(make_pair("All",allPaths));
901 
902  fGroupNamePathsPair.push_back(make_pair("Muon",muonPaths));
903 
904  fGroupNamePathsPair.push_back(make_pair("Egamma",egammaPaths));
905 
906  fGroupNamePathsPair.push_back(make_pair("Tau",tauPaths));
907 
908  fGroupNamePathsPair.push_back(make_pair("JetMet",jetmetPaths));
909 
910  fGroupNamePathsPair.push_back(make_pair("Rest",restPaths));
911 
912  fGroupNamePathsPair.push_back(make_pair("Special",specialPaths_));
913 
915  std::vector<std::string> datasetNames = hltConfig_.datasetNames() ;
916  for (unsigned int i=0;i<datasetNames.size();i++) {
917 
918  std::vector<std::string> datasetPaths = hltConfig_.datasetContent(datasetNames[i]);
919 
920  fGroupNamePathsPair.push_back(make_pair(datasetNames[i],datasetPaths));
921  //setupHltMatrix(datasetNames[i],datasetPaths);
922 
923  }
924 
925  /*
926  setupHltMatrix("All", allPaths);
927  setupHltMatrix("Muon", muonPaths);
928  setupHltMatrix("Egamma", egammaPaths);
929  setupHltMatrix("Tau", tauPaths);
930  setupHltMatrix("JetMET", jetmetPaths);
931  setupHltMatrix("Rest", restPaths);
932  setupHltMatrix("Special", specialPaths_);
933  */
934 
935  for (unsigned int g=0;g<fGroupNamePathsPair.size();g++) {
936 
937  fGroupTempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
938  fGroupL1TempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
939  //setupHltMatrix(fGroupNamePathsPair[g].first,fGroupNamePathsPair[g].second);
940 
941  }
942  /*
943  */
944 
945  setupHltLsPlots();
946 
947  setupHltBxPlots();
948 
949 
950  for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
951 
952  // -------------------------
953  //
954  // Filters for each path
955  //
956  // -------------------------
957 
958  // get all modules in this HLT path
959  std::vector<std::string> moduleNames = hltConfig_.moduleLabels( v->getPath() );
960 
961  int numModule = 0;
962  std::string moduleName, moduleType;
963  unsigned int moduleIndex;
964 
965  //print module name
966  std::vector<std::string>::const_iterator iDumpModName;
967  for (iDumpModName = moduleNames.begin();iDumpModName != moduleNames.end();iDumpModName++) {
968 
969  moduleName = *iDumpModName;
970  moduleType = hltConfig_.moduleType(moduleName);
971  moduleIndex = hltConfig_.moduleIndex(v->getPath(), moduleName);
972 
973  LogTrace ("FourVectorHLTOnline") << "Module " << numModule
974  << " is called " << moduleName
975  << " , type = " << moduleType
976  << " , index = " << moduleIndex
977  << std::endl;
978 
979  numModule++;
980 
981  if((moduleType.find("Filter") != std::string::npos && moduleType.find("HLTTriggerTypeFilter") == std::string::npos ) ||
982  (moduleType.find("Associator") != std::string::npos) ||
983  (moduleType.find("HLTLevel1GTSeed") != std::string::npos) ||
984  (moduleType.find("HLTGlobalSumsCaloMET") != std::string::npos) ||
985  (moduleType.find("HLTPrescaler") != string::npos) ||
986  (hltConfig_.moduleEDMType(moduleName).find("EDFilter") != string::npos))
987  {
988 
989  //std::pair<std::string, int> filterIndexPair;
990  //filterIndexPair.first = moduleName;
991  //filterIndexPair.second = moduleIndex;
992  //v->filtersAndIndices.push_back(filterIndexPair);
993  v->filtersAndIndices.push_back(make_pair(moduleName,moduleIndex));
994 
995  }
996 
997 
998  }//end for modulesName
999 
1000 
1002 
1003  //int nbin_sub = 5;
1004  int nbin_sub = v->filtersAndIndices.size()+2;
1005 
1006  std::string pathName = v->getPath();
1007 
1008  vector<string> datasetNames = hltConfig_.datasetNames();
1009 
1010  //Creates subfolders in FourVector->PathsSummary->FiltersCounts for each dataset,
1011  //and moves each path's filter histogram to the proper dataset folder
1012  for (unsigned int k=0;k<datasetNames.size();k++) { //Loop to cycle through datasets
1013  // std::cout << "Dataset " << datasetNames[k] << " has trigger paths " << std::endl;
1014 
1015  std::string datasetFolder = pathsSummaryFilterCountsFolder_ + datasetNames[k];
1016  vector<string> datasetPaths = hltConfig_.datasetContent(datasetNames[k]);
1017 
1018  for (unsigned int m=0;m<datasetPaths.size();m++){ //Loop to cycle through trigger paths
1019  // std::cout << " " << datasetPaths[m] << std::endl;
1020 
1021  if(datasetPaths[m]==pathName){ //Moves path to proper dataset directory
1022  dbe_->setCurrentFolder(datasetFolder.c_str());
1023  }
1024  }
1025  }
1026 
1027 
1028  // count plots for subfilter
1029  MonitorElement* filters = dbe_->book1D("Filters_" + v->getPath(),
1030  "Filters_" + v->getPath(),
1031  nbin_sub+1, -0.5, 0.5+(double)nbin_sub);
1032 
1033  for(unsigned int filt = 0; filt < v->filtersAndIndices.size(); filt++){
1034 
1035  filters->setBinLabel(filt+1, (v->filtersAndIndices[filt]).first);
1036 
1037  }
1038 
1039  // book Count vs LS
1041  MonitorElement* tempME = dbe_->book1D(v->getPath() + "_count_per_LS",
1042  v->getPath() + " count per LS",
1043  nLS_, 0,nLS_);
1044  tempME->setAxisTitle("Luminosity Section");
1045 
1046  v->setFilterHistos(filters);
1047 
1048  } // end for paths
1049 
1050  // now set up all of the histos for each path-denom
1051  for(PathInfoCollection::iterator v = hltPaths_.begin(); v!= hltPaths_.end(); ++v ) {
1052 
1053  MonitorElement *NOn, *onEtOn, *onOneOverEtOn, *onEtavsonPhiOn=0;
1054  MonitorElement *NOff, *offEtOff, *offEtavsoffPhiOff=0;
1055  MonitorElement *NL1, *l1EtL1, *l1Etavsl1PhiL1=0;
1056  MonitorElement *NL1On, *l1EtL1On, *l1Etavsl1PhiL1On=0;
1057  MonitorElement *NL1Off, *offEtL1Off, *offEtavsoffPhiL1Off=0;
1058  MonitorElement *NOnOff, *offEtOnOff, *offEtavsoffPhiOnOff=0;
1059  MonitorElement *NL1OnUM, *l1EtL1OnUM, *l1Etavsl1PhiL1OnUM=0;
1060  MonitorElement *NL1OffUM, *offEtL1OffUM, *offEtavsoffPhiL1OffUM=0;
1061  MonitorElement *NOnOffUM, *offEtOnOffUM, *offEtavsoffPhiOnOffUM=0;
1062  MonitorElement *offDRL1Off, *offDROnOff, *l1DRL1On=0;
1063 
1064 
1065  std::string labelname("dummy");
1066  labelname = v->getPath() + "_wrt_" + v->getDenomPath();
1067  std::string histoname(labelname+"_NOn");
1068  std::string title(labelname+" N online");
1069  double histEtaMax = 2.5;
1070 
1071  if (v->getObjectType() == trigger::TriggerMuon || v->getObjectType() == trigger::TriggerL1Mu) {
1072 
1073  histEtaMax = muonEtaMax_;
1074 
1075  }
1076  else if (v->getObjectType() == trigger::TriggerElectron || v->getObjectType() == trigger::TriggerL1NoIsoEG || v->getObjectType() == trigger::TriggerL1IsoEG )
1077  {
1078  histEtaMax = electronEtaMax_;
1079  }
1080  else if (v->getObjectType() == trigger::TriggerTau || v->getObjectType() == trigger::TriggerL1TauJet )
1081  {
1082  histEtaMax = tauEtaMax_;
1083  }
1084  else if (v->getObjectType() == trigger::TriggerJet || v->getObjectType() == trigger::TriggerL1CenJet || v->getObjectType() == trigger::TriggerL1ForJet )
1085  {
1086  histEtaMax = jetEtaMax_;
1087  }
1088  else if (v->getObjectType() == trigger::TriggerBJet)
1089  {
1090  histEtaMax = bjetEtaMax_;
1091  }
1092  else if (v->getObjectType() == trigger::TriggerMET || v->getObjectType() == trigger::TriggerL1ETM )
1093  {
1094  histEtaMax = metEtaMax_;
1095  }
1096  else if (v->getObjectType() == trigger::TriggerPhoton)
1097  {
1098  histEtaMax = photonEtaMax_;
1099  }
1100  else if (v->getObjectType() == trigger::TriggerTrack)
1101  {
1102  histEtaMax = trackEtaMax_;
1103  }
1104 
1105  TString pathfolder = dirname_ + TString("/") + v->getPath();
1106  dbe_->setCurrentFolder(pathfolder.Data());
1107 
1108  NOn = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1109 
1110 
1111  histoname = labelname+"_NOff";
1112  title = labelname+" N Off";
1113  NOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1114 
1115  histoname = labelname+"_NL1";
1116  title = labelname+" N L1";
1117  NL1 = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1118 
1119  histoname = labelname+"_NL1On";
1120  title = labelname+" N L1On";
1121  NL1On = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1122 
1123  histoname = labelname+"_NL1Off";
1124  title = labelname+" N L1Off";
1125  NL1Off = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1126 
1127  histoname = labelname+"_NOnOff";
1128  title = labelname+" N OnOff";
1129  NOnOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1130 
1131 
1132  histoname = labelname+"_NL1OnUM";
1133  title = labelname+" N L1OnUM";
1134  NL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1135 
1136  histoname = labelname+"_NL1OffUM";
1137  title = labelname+" N L1OffUM";
1138  NL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1139 
1140  histoname = labelname+"_NOnOffUM";
1141  title = labelname+" N OnOffUM";
1142  NOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1143 
1144 
1145  histoname = labelname+"_onEtOn";
1146  title = labelname+" onE_t online";
1147  onEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1148 
1149  histoname = labelname+"_onOneOverEtOn";
1150  title = labelname+" 1 / onE_t online";
1151  onOneOverEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBinsOneOverEt_, 0, 1);
1152  onOneOverEtOn->setAxisTitle("HLT 1/Et [1/GeV]");
1153 
1154  histoname = labelname+"_offEtOff";
1155  title = labelname+" offE_t offline";
1156  offEtOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1157 
1158  histoname = labelname+"_l1EtL1";
1159  title = labelname+" l1E_t L1";
1160  l1EtL1 = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1161 
1162  int nBins2D = 10;
1163 
1164 
1165  histoname = labelname+"_onEtaonPhiOn";
1166  title = labelname+" on#eta vs on#phi online";
1167  onEtavsonPhiOn = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
1168 
1169  histoname = labelname+"_offEtaoffPhiOff";
1170  title = labelname+" off#eta vs off#phi offline";
1171  offEtavsoffPhiOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
1172 
1173  histoname = labelname+"_l1Etal1PhiL1";
1174  title = labelname+" l1#eta vs l1#phi L1";
1175  l1Etavsl1PhiL1 = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
1176 
1177  histoname = labelname+"_l1EtL1On";
1178  title = labelname+" l1E_t L1+online";
1179  l1EtL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1180 
1181  histoname = labelname+"_offEtL1Off";
1182  title = labelname+" offE_t L1+offline";
1183  offEtL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1184 
1185  histoname = labelname+"_offEtOnOff";
1186  title = labelname+" offE_t online+offline";
1187  offEtOnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1188 
1189  histoname = labelname+"_l1Etal1PhiL1On";
1190  title = labelname+" l1#eta vs l1#phi L1+online";
1191  l1Etavsl1PhiL1On = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
1192 
1193  histoname = labelname+"_offEtaoffPhiL1Off";
1194  title = labelname+" off#eta vs off#phi L1+offline";
1195  offEtavsoffPhiL1Off = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
1196 
1197  histoname = labelname+"_offEtaoffPhiOnOff";
1198  title = labelname+" off#eta vs off#phi online+offline";
1199  offEtavsoffPhiOnOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
1200 
1201  histoname = labelname+"_l1EtL1OnUM";
1202  title = labelname+" l1E_t L1+onlineUM";
1203  l1EtL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1204 
1205  histoname = labelname+"_offEtL1OffUM";
1206  title = labelname+" offE_t L1+offlineUM";
1207  offEtL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1208 
1209  histoname = labelname+"_offEtOnOffUM";
1210  title = labelname+" offE_t online+offlineUM";
1211  offEtOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1212 
1213  histoname = labelname+"_l1Etal1PhiL1OnUM";
1214  title = labelname+" l1#eta vs l1#phi L1+onlineUM";
1215  l1Etavsl1PhiL1OnUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
1216 
1217  histoname = labelname+"_offEtaoffPhiL1OffUM";
1218  title = labelname+" off#eta vs off#phi L1+offlineUM";
1219  offEtavsoffPhiL1OffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
1220 
1221  histoname = labelname+"_offEtaoffPhiOnOffUM";
1222  title = labelname+" off#eta vs off#phi online+offlineUM";
1223  offEtavsoffPhiOnOffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D,-histEtaMax,histEtaMax, nBins2D,-TMath::Pi(), TMath::Pi());
1224 
1225 
1226 
1227 
1228  histoname = labelname+"_l1DRL1On";
1229  title = labelname+" l1DR L1+online";
1230  l1DRL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, 1.);
1231 
1232  histoname = labelname+"_offDRL1Off";
1233  title = labelname+" offDR L1+offline";
1234  offDRL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, 1.);
1235 
1236  histoname = labelname+"_offDROnOff";
1237  title = labelname+" offDR online+offline";
1238  offDROnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, 1.);
1239 
1240 
1241  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
1242 );
1243 
1244 
1245  } // end for hltPath
1246 
1247  // HLT_Any
1248  // book Count vs LS
1250  MonitorElement* tempME = dbe_->book1D("HLT_Any_count_per_LS",
1251  "HLT_Any count per LS",
1252  nLS_, 0,nLS_);
1253  tempME->setAxisTitle("Luminosity Section");
1254 
1255  } // end if(1) dummy
1256 
1257  return;
1258 
1259 }
1260 
1263 {
1264 
1265  LogDebug("FourVectorHLTOnline") << "endRun, run " << run.id();
1266 
1267 }
1268 
1271 {
1272 
1273  LogDebug("FourVectorHLTOnline") << "cleanDRMatchSet(mmset& tempSet) " << "size of the set (before CLEANING) = " << tempSet.size() << " maps." << std::endl;
1274 
1275  if(tempSet.size() < 2) return;
1276 
1277  if(tempSet.size() > 10) {
1278 
1279  LogDebug("FourVectorHLTOnline") << "size of the set is too large. It will be truncated to 10." << std::endl;
1280  mmset::iterator it = tempSet.begin();
1281  for (int i=0;i<10;i++) { it++; }
1282  tempSet.erase( it, tempSet.end());
1283  LogDebug("FourVectorHLTOnline") << "size of the set is now = " << tempSet.size() << " maps." << std::endl;
1284 
1285  }
1286 
1287  bool cleanedOneMap = false;
1288 
1289  // cleaning needed if the set has at least two maps
1290 
1291  while(! cleanedOneMap && tempSet.size() > 1) {
1292 
1293  cleanedOneMap=false;
1294 
1295  //LogTrace("FourVectorHLTOnline") << "cleaning: size of the set = " << tempSet.size() << " maps." << std::endl;
1296 
1297  int imap = 0;
1298  for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ ) {
1299 
1300  fimmap tempMap_j = *setIter_i;
1301 
1302  //LogTrace("FourVectorHLTOnline") << " map " << imap << std::endl;
1303  //LogTrace("FourVectorHLTOnline") << " --------" << std::endl;
1304 
1305  for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it) {
1306 
1307  //LogTrace("FourVectorHLTOnline") << " " << (*it).first << " : " << (*it).second << std::endl;
1308 
1309  }
1310 
1311  imap++;
1312 
1313  }
1314 
1315  // loop i
1316  for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ ) {
1317 
1318  fimmap tempMap_i = *setIter_i;
1319  fimmap::iterator it = tempMap_i.begin();
1320  int topValue = (*it).second;
1321  //LogTrace("FourVectorHLTOnline") << " topValue = " << topValue << std::endl;
1322 
1323 
1324  mmset::iterator tempIter_i = setIter_i;
1325 
1326  // from all the other maps, clean entries that have mapped value "topValue"
1327  // loop j
1328  for ( mmset::iterator setIter_j = ++tempIter_i; setIter_j != tempSet.end( ); setIter_j++ ) {
1329 
1330  fimmap tempMap_j = *setIter_j;
1331  //LogTrace("FourVectorHLTOnline") << " size of the map = " << tempMap_j.size() << std::endl;
1332 
1333  for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it)
1334  {
1335 
1336  if(topValue == (*it).second) {
1337 
1338  //LogTrace("FourVectorHLTOnline") << " Ridding map of a doubly-matched object." << std::endl;
1339  tempMap_j.erase(it);
1340  cleanedOneMap = true;
1341 
1342  }
1343 
1344  } //end for
1345 
1346  if(cleanedOneMap) {
1347 
1348  //remove the old map from the set
1349  tempSet.erase(setIter_j);
1350 
1351  // insert in the set the new map if it is not an empty map
1352  if(! tempMap_j.empty()) tempSet.insert(tempMap_j);
1353 
1354  break; // break from loop j
1355 
1356  } // end if
1357 
1358  }// end loop j
1359 
1360  if(cleanedOneMap) break; // break from loop i
1361 
1362  } // end loop i
1363 
1364  if(cleanedOneMap) {
1365 
1366  // continue cleaning (in while loop)
1367  // but reset flag first
1368  cleanedOneMap=false;
1369  continue;
1370 
1371  }
1372  else {
1373 
1374  // finished cleaing (break from while loop)
1375  break;
1376 
1377  }
1378 
1379  } // end while
1380 
1381  //LogTrace("FourVectorHLTOnline") << "cleaned: size of the set = " << tempSet.size() << " maps." << std::endl;
1382  int jmap = 0;
1383 
1384  for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ )
1385  {
1386 
1387  fimmap tempMap_j = *setIter_i;
1388 
1389  //LogTrace("FourVectorHLTOnline") << " map " << jmap << std::endl;
1390  //LogTrace("FourVectorHLTOnline") << " --------" << std::endl;
1391 
1392  for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it) {
1393 
1394  //LogTrace("FourVectorHLTOnline") << " " << (*it).first << " : " << (*it).second << std::endl;
1395 
1396  }
1397 
1398  jmap++;
1399 
1400  } // end for
1401 
1402  return;
1403 
1404 }
1405 
1407 
1408  //string groupLabelAny = "HLT_"+label+"_Any";
1409  //paths.push_back(groupLabelAny.c_str());
1410  paths.push_back("HLT_"+label+"_L1_Any");
1411  paths.push_back("HLT_"+label+"_Any");
1412  paths.push_back("HLT_Any");
1413 
1414  std::string h_name;
1415  std::string h_title;
1416 
1418 
1419  h_name= "HLT_"+label+"_PassPass";
1420  h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass)";
1421  MonitorElement* ME = dbe_->book2D(h_name.c_str(), h_title.c_str(),
1422  paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
1423 
1424  h_name= "HLT_"+label+"_Pass_Any";
1425  h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
1426  MonitorElement* ME_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
1427  paths.size(), -0.5, paths.size()-0.5);
1428 
1430  h_name= "HLT_"+label+"_PassPass_Normalized";
1431  h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass) normalized to xBin=Pass";
1432  MonitorElement* ME_Normalized = dbe_->book2D(h_name.c_str(), h_title.c_str(),
1433  paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
1434  h_name= "HLT_"+label+"_Pass_Normalized_Any";
1435  h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
1436  MonitorElement* ME_Normalized_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
1437  paths.size(), -0.5, paths.size()-0.5);
1438 
1440  h_name= "HLT_"+label+"_Total_LS";
1441  h_title = label+" HLT paths total count combined per LS ";
1442  MonitorElement* ME_Total_LS = dbe_->book1D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_);
1443  ME_Total_LS->setAxisTitle("LS");
1444 
1445  h_name= "HLT_"+label+"_LS";
1446  h_title = label+" HLT paths count per LS ";
1447  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);
1448  ME_Group_LS->setAxisTitle("LS");
1450  v_ME_HLTAll_LS_.push_back(ME_Group_LS);
1451 
1452  h_name= "HLT_"+label+"_L1_Total_LS";
1453  h_title = label+" HLT paths total count combined per LS ";
1454  MonitorElement* ME_Total_L1_LS = dbe_->book1D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_);
1455  ME_Total_L1_LS->setAxisTitle("LS");
1456 
1457  h_name= "HLT_"+label+"_L1_LS";
1458  h_title = label+" HLT L1s count per LS ";
1459  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);
1460  ME_Group_L1_LS->setAxisTitle("LS");
1461 
1463  h_name= "HLT_"+label+"_BX_LS";
1464  h_title = label+" HLT paths total count combined per BX ";
1465  MonitorElement* ME_Total_BX = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, 5, -2.5, 2.5);
1466  ME_Total_BX->setAxisTitle("LS",1);
1467 
1468  for(unsigned int i = 0; i < paths.size(); i++){
1469 
1470  ME->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1471  ME->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1472  ME_Group_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1473 
1474  ME_Normalized->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1475  ME_Normalized->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1476  ME_Normalized_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1477  ME_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1478 
1479  }
1480 
1481 }
1482 
1484 
1485  std::string fullPathToME;
1486 
1487  //for (unsigned int mi=0;mi<fGroupName.size();mi++) {
1488  for (unsigned int mi=0;mi<fGroupNamePathsPair.size();mi++) {
1489 
1490 
1491  fullPathToME = "HLT/FourVector/PathsSummary/HLT_"+fGroupNamePathsPair[mi].first+"_PassPass";
1492  MonitorElement* ME_2d = dbe_->get(fullPathToME);
1493  fullPathToME = "HLT/FourVector/PathsSummary/HLT_"+fGroupNamePathsPair[mi].first+"_Pass_Any";
1494  MonitorElement* ME_1d = dbe_->get(fullPathToME);
1495  if(!ME_2d || !ME_1d) {
1496 
1497  LogTrace("FourVectorHLTOnline") << " ME not valid although I gave full path" << std::endl;
1498  continue;
1499 
1500  }
1501 
1502  TH2F * hist_2d = ME_2d->getTH2F();
1503  TH1F * hist_1d = ME_1d->getTH1F();
1504 
1505  // Fill HLTPassed Matrix bin (i,j) = (Any,Any)
1506  // --------------------------------------------------------
1507  int anyBinNumber = hist_2d->GetXaxis()->FindBin("HLT_Any");
1508  // any triger accepted
1509  if(triggerResults_->accept()){
1510 
1511  hist_2d->Fill(anyBinNumber-1,anyBinNumber-1);//binNumber1 = 0 = first filter
1512  hist_1d->Fill(anyBinNumber-1);//binNumber1 = 0 = first filter
1513 
1514  }
1515 
1516  bool groupPassed = false;
1517  bool groupL1Passed = false;
1518 
1519  // Main loop over paths
1520  // --------------------
1521 
1522  for (int i=1; i< hist_2d->GetNbinsX();i++) {
1523 
1524  std::string hltpathname = hist_2d->GetXaxis()->GetBinLabel(i);
1525 
1526 
1527  // check if this is hlt path name
1528  unsigned int pathByIndex = triggerNames.triggerIndex(hltpathname);
1529  if(pathByIndex >= triggerResults_->size() ) continue;
1530 
1531  // check if its L1 passed
1532  if(hasL1Passed(hltpathname,triggerNames)) groupL1Passed = true;
1533 
1534  // Fill HLTPassed Matrix and HLTPassFail Matrix
1535  // --------------------------------------------------------
1536 
1537  if(triggerResults_->accept(pathByIndex)){
1538 
1539  groupPassed = true;
1540  //groupL1Passed = true;
1541 
1542  if(groupPassed && !groupL1Passed)
1543 
1544  hist_2d->Fill(i-1,anyBinNumber-1);//binNumber1 = 0 = first filter
1545  hist_2d->Fill(anyBinNumber-1,i-1);//binNumber1 = 0 = first filter
1546 
1547  hist_1d->Fill(i-1);//binNumber1 = 0 = first filter
1548 
1549  for (int j=1; j< hist_2d->GetNbinsY();j++) {
1550 
1551  unsigned int crosspathByIndex = triggerNames.triggerIndex(hist_2d->GetXaxis()->GetBinLabel(j));
1552  if(crosspathByIndex >= triggerResults_->size() ) continue;
1553 
1554  if(triggerResults_->accept(crosspathByIndex)){
1555 
1556  hist_2d->Fill(i-1,j-1);//binNumber1 = 0 = first filter
1557 
1558  } // end if j path passed
1559 
1560  } // end for j
1561 
1562  } // end if i passed
1563 
1564 
1565  } // end for i
1566 
1567  std::string groupBinLabel = "HLT_"+fGroupNamePathsPair[mi].first+"_Any";
1568  int groupBinNumber = hist_2d->GetXaxis()->FindBin(groupBinLabel.c_str());
1569  if(groupPassed) hist_1d->Fill(groupBinNumber-1);//binNumber1 = 0 = first filter
1570 
1571  std::string groupL1BinLabel = "HLT_"+fGroupNamePathsPair[mi].first+"_L1_Any";
1572  int groupL1BinNumber = hist_2d->GetXaxis()->FindBin(groupL1BinLabel.c_str());
1573 
1574  if(groupL1Passed) hist_1d->Fill(groupL1BinNumber-1);//binNumber1 = 0 = first filter
1575  } // end for mi
1576 
1577 }
1578 
1580 {
1581 
1582  //pathsSummaryFolder_ = TString("HLT/FourVector/PathsSummary/");
1583  //dbe_->setCurrentFolder(pathsSummaryFolder_.c_str());
1585 
1586  // setup HLT bx plot
1587  unsigned int npaths = hltPathsDiagonal_.size();
1588 
1589  ME_HLT_BX_ = dbe_->book2D("HLT_bx",
1590  "HLT counts vs Event bx",
1591  Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
1592  ME_HLT_CUSTOM_BX_ = dbe_->book2D("HLT_Custom_bx",
1593  "HLT counts vs Event bx",
1594  Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
1595  ME_HLT_BX_->setAxisTitle("Bunch Crossing");
1596  ME_HLT_CUSTOM_BX_->setAxisTitle("Bunch Crossing");
1597 
1598 
1599  // Set up bin labels on Y axis continuing to cover all npaths
1600  for(unsigned int i = 0; i < npaths; i++){
1601 
1602  ME_HLT_BX_->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
1603  ME_HLT_CUSTOM_BX_->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
1604 
1605  }
1606 
1607 
1608 }
1609 
1611 {
1612 
1613  unsigned int npaths = hltPathsDiagonal_.size();
1614 
1615  //pathsSummaryHLTPathsPerLSFolder_ = TString("HLT/FourVector/PathsSummary/HLT LS/");
1616  //dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_.c_str());
1618 
1619  ME_HLTAll_LS_ = dbe_->book2D("All_count_LS",
1620  "All paths per LS ",
1621  nLS_, 0, nLS_, npaths+1, -0.5, npaths+1-0.5);
1622  ME_HLTAll_LS_->setAxisTitle("Luminosity Section");
1623 
1624  // Set up bin labels on Y axis continuing to cover all npaths
1625  for(unsigned int i = 0; i < npaths; i++){
1626 
1627  ME_HLTAll_LS_->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
1628 
1629  }
1630 
1631  unsigned int i = npaths;
1632  ME_HLTAll_LS_->getTH2F()->GetYaxis()->SetBinLabel(i+1, "HLT_Any");
1633 
1634  int nBinsPerLSHisto = 20;
1635  int nLSHistos = npaths/nBinsPerLSHisto;
1636  for (int nh=0;nh<nLSHistos+1;nh++) {
1637 
1638  char name[200];
1639  char title[200];
1640 
1641  sprintf(name, "Group_%d_paths_count_LS",nLSHistos-nh);
1642  sprintf(title, "Group %d, paths count per LS",nLSHistos-nh);
1643 
1644  MonitorElement* tempME = dbe_->book2D(name,title,
1645  nLS_, 0, nLS_, nBinsPerLSHisto+3, -0.5, nBinsPerLSHisto+3-0.5);
1646 
1647  tempME->setAxisTitle("LS");
1648 
1649  // Set up bin labels on Y axis continuing to cover all npaths
1650  for(int i = nh*nBinsPerLSHisto; i < (nh+1)*nBinsPerLSHisto; i++){
1651 
1652  if (i == int(npaths)) break;
1653 
1654  int bin;
1655  if(nh == 0){
1656 
1657  bin = i;
1658 
1659  }
1660  else {
1661 
1662  bin = i % nBinsPerLSHisto;
1663 
1664  }
1665 
1666  tempME->setBinLabel(bin+1, hltPathsDiagonal_[i].getPath().c_str(), 2);
1667 
1668  }
1669 
1670  tempME->setBinLabel(nBinsPerLSHisto+3, "HLT_Any", 2);
1671  tempME->setBinLabel(nBinsPerLSHisto+2, "HLT_PhysicsDeclared", 2);
1672 
1673  v_ME_HLTAll_LS_.push_back(tempME);
1674 
1675  }
1676 
1677 
1678 }
1679 
1680 
1682 
1683  //int lumi = int(lumiSeg.id().luminosityBlock());
1684  //if(lumi < 74 || lumi > 77) fLumiFlag = false;
1685  //else fLumiFlag = true;
1686 
1687 }
1688 
1690 {
1691 
1692  int lumi = int(lumiSeg.id().luminosityBlock());
1693  LogTrace("FourVectorHLTOnline") << " end lumiSection number " << lumi << std::endl;
1694 
1695  //countHLTPathHitsEndLumiBlock(lumi);
1696  //countHLTGroupHitsEndLumiBlock(lumi);
1697  //countHLTGroupL1HitsEndLumiBlock(lumi);
1698 
1699  //countHLTGroupBXHitsEndLumiBlock(lumi);
1700 
1701 }
1702 
1704 {
1705 
1706  LogTrace("FourVectorHLTOnline") << " countHLTGroupBXHitsEndLumiBlock() lumiSection number " << lumi << std::endl;
1707 
1708  TH2F * hist_2d_bx = ME_HLT_BX_->getTH2F();
1709 
1710  for (std::vector<std::pair<std::string, std::vector<int> > >::iterator ip = fPathBxTempCountPair.begin(); ip != fPathBxTempCountPair.end(); ++ip) {
1711 
1712  // get the path and its previous count
1713  std::string pathname = ip->first;
1714  std::vector<int> prevCount = ip->second;
1715 
1716  // vector of 5 zeros
1717  std::vector<int> currCount (5,0);
1718  std::vector<int> diffCount (5,0);
1719 
1720  // get the current count of path up to now
1721  int pathBin = hist_2d_bx->GetYaxis()->FindBin(pathname.c_str());
1722 
1723  if(pathBin > hist_2d_bx->GetNbinsY()) {
1724 
1725  LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
1726  continue;
1727 
1728  }
1729 
1730  for (unsigned int j =0;j<currCount.size();j++) {
1731 
1732  int bxOffset = j-2;
1733  int bunch = referenceBX_+bxOffset;
1734  if(bunch < 1) bunch += Nbx_ ;
1735  int bxBin = bunch +1; // add one to get the right bin
1736 
1737 
1738  currCount[j] = int(hist_2d_bx->GetBinContent(bxBin, pathBin)); // add one to get the right bin
1739 
1740  LogTrace("FourVectorHLTOnline") << "currCount = " << currCount[j] << std::endl;
1741 
1742  // count due to prev lumi sec is a difference bw current and previous
1743  diffCount[j] = currCount[j] - prevCount[j];
1744 
1745  LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << "bxOffset = " << bxOffset << " count = " << diffCount[j] << std::endl;
1746 
1747  // set the counter in the pair to current count
1748  ip->second = currCount;
1749 
1750  } // end for bx j
1751 
1753  // fill the 2D Group paths' BX count per LS
1755  LogTrace("FourVectorHLTOnline") << "Find " << pathname << std::endl;
1756  for(unsigned int i=0; i<fGroupName.size(); i++){
1757 
1758  bool isMember = false;
1759  //check if the path is in this group
1760  for (unsigned int j=0;j<fGroupNamePathsPair.size();j++) {
1761 
1762  LogTrace("FourVectorHLTOnline") << " ---- Group " << fGroupNamePathsPair[j].first << std::endl;
1763  if(fGroupNamePathsPair[j].first != fGroupName[i]) continue;
1764 
1765  for (unsigned int k = 0; k<(fGroupNamePathsPair[j].second).size();k++) {
1766 
1767  LogTrace("FourVectorHLTOnline") << " comparing to " << fGroupNamePathsPair[j].second[k] << std::endl;
1768 
1769  if(fGroupNamePathsPair[j].second[k] == pathname) {
1770 
1771  isMember = true;
1772  break;
1773 
1774  }
1775 
1776  } // end for k
1777  } // end for j
1778 
1779 
1780  if(!isMember) {
1781 
1782  LogTrace("FourVectorHLTOnline") << "Could not find a group to which the path belongs, path = " << pathname << " group = " << fGroupName[i] << std::endl;
1783  continue;
1784 
1785  }
1786 
1787  std::string fullPathToME = pathsSummaryHLTPathsPerBXFolder_ + "HLT_"+fGroupName[i] + "_BX_LS";
1788  MonitorElement* ME_2d = dbe_->get(fullPathToME);
1789 
1790  if ( ME_2d) {
1791 
1792  TH2F* hist_All = ME_2d->getTH2F();
1793 
1794  for (unsigned int j = 0; j<diffCount.size();j++) {
1795 
1796  // find the bin
1797  int binNumber = j+1; // add one to get right bin
1798 
1799  // update the bin content (must do that since events don't ncessarily come in the order
1800  int currentLumiCount = int(hist_All->GetBinContent(lumi+1,binNumber));
1801  int updatedLumiCount = currentLumiCount + diffCount[j];
1802  hist_All->SetBinContent(lumi+1,binNumber,updatedLumiCount);
1803  } // end for bx j
1804 
1805  }
1806  else {
1807 
1808  LogDebug("FourVectorHLTOnline") << " cannot find ME_2d" << ME_2d->getName() << std::endl;
1809 
1810  }
1811 
1812 
1813  } // end for group i
1814 
1815  } // end for ip
1816 
1817 }
1818 
1820 {
1821 
1822  LogTrace("FourVectorHLTOnline") << " countHLTGroupL1HitsEndLumiBlock() lumiSection number " << lumi << std::endl;
1823 
1824  //for(unsigned int i=0; i<fGroupName.size(); i++){
1825  for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
1826 
1827  // get the count of path up to now
1828  std::string fullPathToME = "HLT/FourVector/PathsSummary/HLT_" + fGroupNamePathsPair[i].first+ "_Pass_Any";
1829  MonitorElement* ME_1d = dbe_->get(fullPathToME);
1830 
1831  if(! ME_1d) {
1832 
1833  LogTrace("FourVectorHLTOnline") << " could not find 1d matrix " << fullPathToME << std::endl;
1834 
1835  continue;
1836 
1837  }
1838 
1839  LogTrace("FourVectorHLTOnline") << " Looking in histogram " << fullPathToME << std::endl;
1840 
1841  TH1F * hist_1d = ME_1d->getTH1F();
1842 
1843  for (std::vector<std::pair<std::string, int> >::iterator ip = fGroupL1TempCountPair.begin(); ip != fGroupL1TempCountPair.end(); ++ip) {
1844 
1845  // get the path and its previous count
1846  std::string pathname = ip->first;
1847  int prevCount = ip->second;
1848 
1849  std::string binLabel = "HLT_"+pathname+"_L1_Any";
1850 
1851  LogTrace("FourVectorHLTOnline") << " Looking for binLabel = " << binLabel << std::endl;
1852  // get the current count of path up to now
1853  int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
1854 
1855  LogTrace("FourVectorHLTOnline") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << std::endl;
1856  if(pathBin == -1) {
1857 
1858  LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
1859  continue;
1860 
1861  }
1862 
1863  int currCount = int(hist_1d->GetBinContent(pathBin));
1864 
1865  // count due to prev lumi sec is a difference bw current and previous
1866  int diffCount = currCount - prevCount;
1867 
1868  LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << std::endl;
1869 
1870  // set the counter in the pair to current count
1871  ip->second = currCount;
1872 
1873 
1875  // fill the 1D individual path count per LS
1877  std::string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_L1_Total_LS";
1878  MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
1879  if ( ME_1d) {
1880 
1881  // update the bin content (must do that since events don't ncessarily come in the order
1882  int currentLumiCount = int(ME_1d->getTH1()->GetBinContent(lumi+1));
1883  int updatedLumiCount = currentLumiCount + diffCount;
1884  ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
1885 
1886  }
1887  else {
1888 
1889  LogDebug("FourVectorHLTOnline") << " cannot find ME " << fullPathToME_count << std::endl;
1890 
1891  }
1892 
1893  } // end for ip
1894 
1895  } // end for i
1896 
1897 }
1898 
1899 
1901 {
1902 
1903  LogTrace("FourVectorHLTOnline") << " countHLTGroupHitsEndLumiBlock() lumiSection number " << lumi << std::endl;
1904  //for(unsigned int i=0; i<fGroupName.size(); i++){
1905  for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
1906 
1907  // get the count of path up to now
1908  //string fullPathToME = "HLT/FourVector/PathsSummary/HLT_" + fGroupName[i] + "_Pass_Any";
1909  std::string fullPathToME = "HLT/FourVector/PathsSummary/HLT_" + fGroupNamePathsPair[i].first + "_Pass_Any";
1910  MonitorElement* ME_1d = dbe_->get(fullPathToME);
1911 
1912  if(! ME_1d) {
1913 
1914  LogTrace("FourVectorHLTOnline") << " could not find 1d matrix " << fullPathToME << std::endl;
1915 
1916  continue;
1917 
1918  }
1919 
1920  LogTrace("FourVectorHLTOnline") << " Looking in histogram " << fullPathToME << std::endl;
1921 
1922  TH1F * hist_1d = ME_1d->getTH1F();
1923 
1924  for (std::vector<std::pair<std::string, int> >::iterator ip = fGroupTempCountPair.begin(); ip != fGroupTempCountPair.end(); ++ip) {
1925 
1926  // get the path and its previous count
1927  std::string pathname = ip->first;
1928  int prevCount = ip->second;
1929 
1930  std::string binLabel = "HLT_"+pathname+"_Any";
1931 
1932  LogTrace("FourVectorHLTOnline") << " Looking for binLabel = " << binLabel << std::endl;
1933  // get the current count of path up to now
1934  int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
1935 
1936  LogTrace("FourVectorHLTOnline") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << std::endl;
1937  if(pathBin == -1) {
1938 
1939  LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
1940  continue;
1941 
1942  }
1943 
1944  int currCount = int(hist_1d->GetBinContent(pathBin));
1945 
1946  // count due to prev lumi sec is a difference bw current and previous
1947  int diffCount = currCount - prevCount;
1948 
1949  LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << std::endl;
1950 
1951  // set the counter in the pair to current count
1952  ip->second = currCount;
1953 
1954 
1956  // fill the 1D individual path count per LS
1958  std::string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_Total_LS";
1959  MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
1960  if ( ME_1d) {
1961 
1962  // update the bin content (must do that since events don't ncessarily come in the order
1963  int currentLumiCount = int(ME_1d->getTH1()->GetBinContent(lumi+1));
1964  int updatedLumiCount = currentLumiCount + diffCount;
1965  ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
1966 
1967  }
1968  else {
1969 
1970  LogDebug("FourVectorHLTOnline") << " cannot find ME " << fullPathToME_count << std::endl;
1971 
1972  }
1973 
1974  } // end for ip
1975 
1976  } // end for i
1977 
1978 }
1979 
1980 
1982 {
1983 
1984  LogTrace("FourVectorHLTOnline") << " countHLTPathHitsEndLumiBlock() lumiSection number " << lumi << std::endl;
1985  // get the count of path up to now
1986  std::string fullPathToME = "HLT/FourVector/PathsSummary/HLT_All_PassPass";
1987  MonitorElement* ME_2d = dbe_->get(fullPathToME);
1988 
1989  if(! ME_2d) {
1990 
1991  LogTrace("FourVectorHLTOnline") << " could not fine 2d matrix " << fullPathToME << std::endl;
1992 
1993  return;
1994 
1995  }
1996 
1997  TH2F * hist_2d = ME_2d->getTH2F();
1998 
1999  for (std::vector<std::pair<std::string, int> >::iterator ip = fPathTempCountPair.begin(); ip != fPathTempCountPair.end(); ++ip) {
2000 
2001  // get the path and its previous count
2002  std::string pathname = ip->first;
2003  int prevCount = ip->second;
2004 
2005  // get the current count of path up to now
2006  int pathBin = hist_2d->GetXaxis()->FindBin(pathname.c_str());
2007 
2008  if(pathBin > hist_2d->GetNbinsX()) {
2009 
2010  LogTrace("FourVectorHLTOnline") << " Cannot find the bin for path " << pathname << std::endl;
2011  continue;
2012 
2013  }
2014 
2015  int currCount = int(hist_2d->GetBinContent(pathBin, pathBin));
2016 
2017  // count due to prev lumi sec is a difference bw current and previous
2018  int diffCount = currCount - prevCount;
2019 
2020  LogTrace("FourVectorHLTOnline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << std::endl;
2021 
2022  // set the counter in the pair to current count
2023  ip->second = currCount;
2024 
2026  // fill the 2D All paths' count per LS
2028  if ( ME_HLTAll_LS_) {
2029 
2030  TH2F* hist_All = ME_HLTAll_LS_->getTH2F();
2031 
2032  // find the bin
2033  int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
2034 
2035  // update the bin content (must do that since events don't ncessarily come in the order
2036  int currentLumiCount = int(hist_All->GetBinContent(lumi+1,pathBinNumber));
2037  int updatedLumiCount = currentLumiCount + diffCount;
2038  hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
2039 
2040  }
2041  else {
2042 
2043  LogDebug("FourVectorHLTOnline") << " cannot find ME_HLTAll_LS_" << std::endl;
2044 
2045  }
2046 
2047  for (unsigned int i=0 ; i< v_ME_HLTAll_LS_.size(); i++) {
2048 
2049  MonitorElement* tempME = v_ME_HLTAll_LS_[i];
2050 
2051  if ( tempME ) {
2052 
2053  TH2F* hist_All = tempME->getTH2F();
2054 
2055  // find the bin
2056  int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
2057  // update the bin content (must do that since events don't ncessarily come in the order
2058  int currentLumiCount = int(hist_All->GetBinContent(lumi+1,pathBinNumber));
2059  int updatedLumiCount = currentLumiCount + diffCount;
2060  hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
2061 
2062  }
2063  else {
2064 
2065  LogDebug("FourVectorHLTOnline") << " cannot find tempME " << std::endl;
2066 
2067  }
2068 
2069  }
2070 
2071 
2073  // fill the 1D individual path count per LS
2075  std::string fullPathToME_count = pathsIndividualHLTPathsPerLSFolder_ + pathname + "_count_per_LS";
2076  MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
2077  if ( ME_1d) {
2078 
2079  // update the bin content (must do that since events don't ncessarily come in the order
2080  int currentLumiCount = int(ME_1d->getTH1()->GetBinContent(lumi+1));
2081  int updatedLumiCount = currentLumiCount + diffCount;
2082  ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
2083 
2084  }
2085  else {
2086 
2087  LogDebug("FourVectorHLTOnline") << " cannot find ME " << fullPathToME_count << std::endl;
2088 
2089  }
2090 
2091  } // end for ip
2092 
2093 }
2094 
2096 {
2097 
2098  int objectType = 0;
2099 
2100  if (pathname.find("MET") != std::string::npos)
2101  objectType = trigger::TriggerMET;
2102  if (pathname.find("SumET") != std::string::npos)
2103  objectType = trigger::TriggerTET;
2104  if (pathname.find("HT") != std::string::npos)
2105  objectType = trigger::TriggerTET;
2106  if (pathname.find("Jet") != std::string::npos)
2107  objectType = trigger::TriggerJet;
2108  if (pathname.find("Mu") != std::string::npos)
2109  objectType = trigger::TriggerMuon;
2110  if (pathname.find("Ele") != std::string::npos)
2111  objectType = trigger::TriggerElectron;
2112  if (pathname.find("Photon") != std::string::npos)
2113  objectType = trigger::TriggerPhoton;
2114  if (pathname.find("Tau") != std::string::npos)
2115  objectType = trigger::TriggerTau;
2116  if (pathname.find("IsoTrack") != std::string::npos)
2117  objectType = trigger::TriggerTrack;
2118  if (pathname.find("BTag") != std::string::npos)
2119  objectType = trigger::TriggerBJet;
2120 
2121  return objectType;
2122 }
2123 
2125 {
2126 
2127  // find L1 condition for numpath with numpath objecttype
2128  // find PSet for L1 global seed for numpath,
2129  // list module labels for numpath
2130  std::string l1pathname = "dummy";
2131 
2132  std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
2133 
2134  for(std::vector<std::string>::iterator numpathmodule = numpathmodules.begin();
2135  numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
2136 
2137  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
2138 
2139  l1pathname = *numpathmodule;
2140  break;
2141 
2142  }
2143 
2144  } // end for
2145 
2146  return l1pathname;
2147 
2148 }
2149 
2150 
2152 {
2153 
2154  bool rc = false;
2155 
2156  std::string l1ModuleName = getL1ConditionModuleName(pathname);
2157  int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1ModuleName);
2158 
2159  unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
2160  if(pathByIndex >= triggerResults_->size() ) return rc; // path is not in the menu
2161 
2162  // get index of the last module that issued the decision
2163  int lastModule = triggerResults_->index(pathByIndex);
2164 
2165  // if L1 passed, then it must not be the module that
2166  // issued the last decision
2167  rc = (l1ModuleIndex < lastModule);
2168 
2169  return rc;
2170 
2171 }
2172 
2174 {
2175 
2176  bool rc = false;
2177 
2178  unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
2179  if(pathByIndex >= triggerResults_->size() ) return rc; // path is not in the menu
2180 
2181  rc = triggerResults_->accept(pathByIndex);
2182 
2183  return rc;
2184 
2185 }
#define LogDebug(id)
unsigned int size() const
number of trigger paths in trigger table
LuminosityBlockID id() const
const double Pi
T getParameter(std::string const &) const
edm::Handle< trigger::TriggerEvent > fTriggerObj
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
PathInfoCollection hltPathsDiagonal_
int i
Definition: DBlmapReader.cc:9
const std::string getL1ConditionModuleName(const std::string &pathname)
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:207
edm::InputTag triggerSummaryLabel_
std::string pathsSummaryHLTPathsPerBXFolder_
RunID const & id() const
Definition: RunBase.h:41
const std::string moduleType(const std::string &module) const
C++ class name of module.
virtual void monitorOnline(const int hltIndex, const int l1Index, FourVectorHLTOnline *fv)=0
MonitorElement * scalersSelect
const std::string & triggerName(unsigned int triggerIndex) const
std::vector< std::pair< std::string, std::vector< int > > > fPathBxTempCountPair
virtual void fillOnlineMatch(const int l1Index, FourVectorHLTOnline *fv)=0
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:722
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2535
void setupHltMatrix(std::string label, std::vector< std::string > paths)
enum start value shifted to 81 so as to avoid clashes with PDG codes
tuple lumi
Definition: fjr2json.py:35
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
void countHLTGroupBXHitsEndLumiBlock(const int &lumi)
void fillHltMatrix(const edm::TriggerNames &triggerNames)
int bunchCrossing() const
Definition: EventBase.h:62
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::multimap< float, int > fimmap
const std::string moduleEDMType(const std::string &module) const
C++ base class name of module.
edm::Handle< edm::TriggerResults > triggerResults_
void countHLTPathHitsEndLumiBlock(const int &lumi)
#define NULL
Definition: scimark2.h:8
std::vector< std::pair< std::string, int > > fPathTempCountPair
void cleanDRMatchSet(mmset &tempSet)
Clean DR Match Set.
void endRun(const edm::Run &run, const edm::EventSetup &c)
EndRun.
std::vector< TPRegexp > filters
Definition: eve_filter.cc:25
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
std::string pathsIndividualHLTPathsPerLSFolder_
PathInfoCollection hltPaths_
std::set< fimmap, std::less< fimmap > > mmset
void Fill(long long x)
U second(std::pair< T, U > const &p)
Definition: ME.h:11
std::string pathsSummaryHLTPathsPerLSFolder_
int iEvent
Definition: GenABIO.cc:243
unsigned int moduleIndex(unsigned int trigger, const std::string &module) const
slot position of module on trigger path (0 to size-1)
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void setLimits(float etaMax, float etMin, float drMatch)
std::vector< std::pair< std::string, int > > fGroupTempCountPair
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
int j
Definition: DBlmapReader.cc:9
TH1 * getTH1(void) const
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
std::vector< MonitorElement * > v_ME_HLTAll_LS_
MonitorElement * ME_HLT_BX_
void setVerbose(unsigned level)
Definition: DQMStore.cc:398
MonitorElement * ME_HLT_CUSTOM_BX_
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
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:361
#define LogTrace(id)
int k[5][pyjets_maxn]
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
const std::vector< std::string > & datasetContent(unsigned int dataset) const
names of trigger paths in dataset with index i
virtual void clearSets(void)=0
void countHLTGroupL1HitsEndLumiBlock(const int &lumi)
HLTConfigProvider hltConfig_
std::string muonRecoCollectionName_
std::string pathsSummaryFilterCountsFolder_
MonitorElement * ME_HLTAll_LS_
std::vector< std::string > specialPaths_
bool hasL1Passed(const std::string &pathname, const edm::TriggerNames &triggerNames)
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
TH1F * getTH1F(void) const
LuminosityBlockNumber_t luminosityBlock() const
std::vector< std::string > fGroupName
std::string const & label() const
Definition: InputTag.h:42
std::vector< std::pair< std::string, std::vector< std::string > > > fGroupNamePathsPair
virtual void setPath(FourVectorHLTOnline::PathInfoCollection::iterator v)=0
std::vector< std::pair< std::string, int > > fGroupL1TempCountPair
bool hasHLTPassed(const std::string &pathname, const edm::TriggerNames &triggerNames)
FourVectorHLTOnline(const edm::ParameterSet &)
void beginRun(const edm::Run &run, const edm::EventSetup &c)
int getTriggerTypeParsePathName(const std::string &pathname)
void countHLTGroupHitsEndLumiBlock(const int &lumi)
virtual void monitorL1(const int l1Index, FourVectorHLTOnline *fv)=0
TH2F * getTH2F(void) const
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:850
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void setReco(edm::Handle< T > offColl)
std::string const & instance() const
Definition: InputTag.h:43
tuple size
Write out results.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
std::string pathsSummaryHLTCorrelationsFolder_
Definition: Run.h:36
const std::vector< std::string > & datasetNames() const
edm::InputTag triggerResultsLabel_
void setBJetsFlag(bool flag)