CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FourVectorHLTOffline.cc
Go to the documentation of this file.
1 // $Id: FourVectorHLTOffline.cc,v 1.106 2012/02/01 14:27:45 muzaffar Exp $
2 // See header file for information.
3 #include "TMath.h"
6 
7 #include <map>
8 #include <utility>
9 
10 using namespace edm;
11 using namespace trigger;
12 using namespace std;
13 using namespace muon;
14 
16 {
17 
18  LogDebug("FourVectorHLTOffline") << "constructor...." ;
19 
20  useUM = false;
21  fIsSetup = false;
27  //fSelectedTaus = new reco::CaloTauCollection;
29 
31  if ( ! dbe_ ) {
32  LogInfo("FourVectorHLTOffline") << "unabel to get DQMStore service?";
33  }
34  if (iConfig.getUntrackedParameter < bool > ("DQMStore", false)) {
35  dbe_->setVerbose(0);
36  }
37 
38  dirname_ = iConfig.getUntrackedParameter("dirname", std::string("HLT/FourVector/"));
39  //dirname_ += iConfig.getParameter<std::string>("@module_label");
40 
41  if (dbe_ != 0 ) {
43  }
44 
45 
46  doCombineRuns_ = iConfig.getUntrackedParameter<bool>("doCombineRuns", false);
47 
48  processname_ = iConfig.getParameter<std::string>("processname");
49  fCustomBXPath = iConfig.getUntrackedParameter<std::string>("customBXPath", std::string("HLT_MinBiasBSC"));
50 
51  referenceBX_ = iConfig.getUntrackedParameter<unsigned int>("referenceBX",51);
52  Nbx_ = iConfig.getUntrackedParameter<unsigned int>("Nbx",3564);
53 
54  // plotting paramters
55  ptMin_ = iConfig.getUntrackedParameter<double>("ptMin",0.);
56  ptMax_ = iConfig.getUntrackedParameter<double>("ptMax",1000.);
57  nBins_ = iConfig.getUntrackedParameter<unsigned int>("Nbins",20);
58  nBins2D_ = iConfig.getUntrackedParameter<unsigned int>("Nbins2D",40);
59  dRMax_ = iConfig.getUntrackedParameter<double>("dRMax",1.0);
60  nBinsDR_ = iConfig.getUntrackedParameter<unsigned int>("NbinsDR",10);
61  nBinsOneOverEt_ = iConfig.getUntrackedParameter<unsigned int>("NbinsOneOverEt",10000);
62  nLS_ = iConfig.getUntrackedParameter<unsigned int>("NLuminositySegments",10);
63  LSsize_ = iConfig.getUntrackedParameter<double>("LuminositySegmentSize",23);
64  thresholdFactor_ = iConfig.getUntrackedParameter<double>("thresholdFactor",1.5);
65 
66 
67  plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", false);
68  // this is the list of paths to look at.
69  std::vector<edm::ParameterSet> paths =
70  iConfig.getParameter<std::vector<edm::ParameterSet> >("paths");
71 
72  for(std::vector<edm::ParameterSet>::iterator pathconf = paths.begin() ; pathconf != paths.end(); pathconf++) {
73 
74  //std::pair<std::string, std::string> custompathnamepair;
75  //custompathnamepair.first =pathconf->getParameter<std::string>("pathname");
76  //custompathnamepair.second = pathconf->getParameter<std::string>("denompathname");
77  //custompathnamepairs_.push_back(custompathnamepair);
78  custompathnamepairs_.push_back(
79  make_pair(
80  pathconf->getParameter<std::string>("pathname"),
81  pathconf->getParameter<std::string>("denompathname")
82  )
83  );
84 
85  }
86 
87  if (hltPaths_.size() > 0)
88  {
89  // book a histogram of scalers
90  scalersSelect = dbe_->book1D("selectedScalers","Selected Scalers", hltPaths_.size(), 0.0, (double)hltPaths_.size());
91 
92  }
93 
94  triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
95  triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
96  muonRecoCollectionName_ = iConfig.getUntrackedParameter("muonRecoCollectionName", std::string("muons"));
97 
98  electronEtaMax_ = iConfig.getUntrackedParameter<double>("electronEtaMax",2.5);
99  electronEtMin_ = iConfig.getUntrackedParameter<double>("electronEtMin",3.0);
100  electronDRMatch_ =iConfig.getUntrackedParameter<double>("electronDRMatch",0.3);
101  electronL1DRMatch_ =iConfig.getUntrackedParameter<double>("electronL1DRMatch",0.3);
102 
103  muonEtaMax_ = iConfig.getUntrackedParameter<double>("muonEtaMax",2.1);
104  muonEtMin_ = iConfig.getUntrackedParameter<double>("muonEtMin",3.0);
105  muonDRMatch_ =iConfig.getUntrackedParameter<double>("muonDRMatch",0.3);
106  muonL1DRMatch_ =iConfig.getUntrackedParameter<double>("muonL1DRMatch",0.3);
107 
108  tauEtaMax_ = iConfig.getUntrackedParameter<double>("tauEtaMax",2.5);
109  tauEtMin_ = iConfig.getUntrackedParameter<double>("tauEtMin",3.0);
110  tauDRMatch_ =iConfig.getUntrackedParameter<double>("tauDRMatch",0.3);
111  tauL1DRMatch_ =iConfig.getUntrackedParameter<double>("tauL1DRMatch",0.5);
112 
113  jetEtaMax_ = iConfig.getUntrackedParameter<double>("jetEtaMax",5.0);
114  jetEtMin_ = iConfig.getUntrackedParameter<double>("jetEtMin",10.0);
115  jetDRMatch_ =iConfig.getUntrackedParameter<double>("jetDRMatch",0.3);
116  jetL1DRMatch_ =iConfig.getUntrackedParameter<double>("jetL1DRMatch",0.5);
117 
118  bjetEtaMax_ = iConfig.getUntrackedParameter<double>("bjetEtaMax",2.5);
119  bjetEtMin_ = iConfig.getUntrackedParameter<double>("bjetEtMin",10.0);
120  bjetDRMatch_ =iConfig.getUntrackedParameter<double>("bjetDRMatch",0.3);
121  bjetL1DRMatch_ =iConfig.getUntrackedParameter<double>("bjetL1DRMatch",0.3);
122 
123  photonEtaMax_ = iConfig.getUntrackedParameter<double>("photonEtaMax",2.5);
124  photonEtMin_ = iConfig.getUntrackedParameter<double>("photonEtMin",3.0);
125  photonDRMatch_ =iConfig.getUntrackedParameter<double>("photonDRMatch",0.3);
126  photonL1DRMatch_ =iConfig.getUntrackedParameter<double>("photonL1DRMatch",0.3);
127 
128  trackEtaMax_ = iConfig.getUntrackedParameter<double>("trackEtaMax",2.5);
129  trackEtMin_ = iConfig.getUntrackedParameter<double>("trackEtMin",3.0);
130  trackDRMatch_ =iConfig.getUntrackedParameter<double>("trackDRMatch",0.3);
131  trackL1DRMatch_ =iConfig.getUntrackedParameter<double>("trackL1DRMatch",0.3);
132 
133  metEtaMax_ = iConfig.getUntrackedParameter<double>("metEtaMax",5);
134  metMin_ = iConfig.getUntrackedParameter<double>("metMin",10.0);
135  metDRMatch_ =iConfig.getUntrackedParameter<double>("metDRMatch",0.5);
136  metL1DRMatch_ =iConfig.getUntrackedParameter<double>("metL1DRMatch",0.5);
137 
138  htEtaMax_ = iConfig.getUntrackedParameter<double>("htEtaMax",5);
139  htMin_ = iConfig.getUntrackedParameter<double>("htMin",10.0);
140  htDRMatch_ =iConfig.getUntrackedParameter<double>("htDRMatch",0.5);
141  htL1DRMatch_ =iConfig.getUntrackedParameter<double>("htL1DRMatch",0.5);
142 
143  sumEtMin_ = iConfig.getUntrackedParameter<double>("sumEtMin",10.0);
144 
145  // Muon quality cuts
147  dxyCut_ = iConfig.getUntrackedParameter<double>("DxyCut", 0.2); // dxy < 0.2 cm
148  normalizedChi2Cut_ = iConfig.getUntrackedParameter<double>("NormalizedChi2Cut", 10.); // chi2/ndof (of global fit) <10.0
149  trackerHitsCut_ = iConfig.getUntrackedParameter<int>("TrackerHitsCut", 11); // Tracker Hits >10
150  pixelHitsCut_ = iConfig.getUntrackedParameter<int>("PixelHitsCut", 1); // Pixel Hits >0
151  muonHitsCut_ = iConfig.getUntrackedParameter<int>("MuonHitsCut", 1); // Valid Muon Hits >0
152  isAlsoTrackerMuon_ = iConfig.getUntrackedParameter<bool>("IsAlsoTrackerMuon", true);
153  nMatchesCut_ = iConfig.getUntrackedParameter<int>("NMatchesCut", 2); // At least 2 Chambers with matches
154 
155  // Electron quality cuts
157  eleMaxOver3x3_ = iConfig.getUntrackedParameter<double>("eleMaxOver3x3", 0.9);
158  // Ecal Barrel
159  dr03TkSumPtEB_ = iConfig.getUntrackedParameter<double>("dr03TkSumPtEB", 3.0);
160  dr04EcalRecHitSumEtEB_ = iConfig.getUntrackedParameter<double>("dr04EcalRecHitSumEtEB", 4.0);
161  dr04HcalTowerSumEtEB_ = iConfig.getUntrackedParameter<double>("dr04HcalTowerSumEtEB", 5.0);
162  hadronicOverEmEB_ = iConfig.getUntrackedParameter<double>("hadronicOverEmEB", 0.05);
163  deltaPhiSuperClusterTrackAtVtxEB_ = iConfig.getUntrackedParameter<double>("deltaPhiSuperClusterTrackAtVtxEB", 0.2);
164  deltaEtaSuperClusterTrackAtVtxEB_ = iConfig.getUntrackedParameter<double>("deltaEtaSuperClusterTrackAtVtxEB", 0.006);
165  sigmaIetaIetaEB_ = iConfig.getUntrackedParameter<double>("sigmaIetaIetaEB", 0.01);
166  //spikes
167  sigmaIetaIetaSpikesEB_ = iConfig.getUntrackedParameter<double>("sigmaIetaIetaSpikesEB", 0.002);
168 
169  // Ecal Endcap
170  dr03TkSumPtEC_ = iConfig.getUntrackedParameter<double>("dr03TkSumPtEC", 1.5);
171  dr04EcalRecHitSumEtEC_ = iConfig.getUntrackedParameter<double>("dr04EcalRecHitSumEtEC", 2.5);
172  dr04HcalTowerSumEtEC_ = iConfig.getUntrackedParameter<double>("dr04HcalTowerSumEtEC", 0.7);
173  hadronicOverEmEC_ = iConfig.getUntrackedParameter<double>("hadronicOverEmEC", 0.025);
174  deltaPhiSuperClusterTrackAtVtxEC_ = iConfig.getUntrackedParameter<double>("deltaPhiSuperClusterTrackAtVtxEC", 0.2);
175  deltaEtaSuperClusterTrackAtVtxEC_ = iConfig.getUntrackedParameter<double>("deltaEtaSuperClusterTrackAtVtxEC", 0.006);
176  sigmaIetaIetaEC_ = iConfig.getUntrackedParameter<double>("sigmaIetaIetaEC", 0.03);
177  //spikes
178  sigmaIetaIetaSpikesEC_ = iConfig.getUntrackedParameter<double>("sigmaIetaIetaSpikesEC", 0.002);
179 
180  // Jet ID cuts
182  emEnergyFractionJet_ = iConfig.getUntrackedParameter<double>("emEnergyFractionJet",0.01);
183  fHPDJet_ = iConfig.getUntrackedParameter<double>("fHPDJet",0.98);
184  n90Jet_ = iConfig.getUntrackedParameter<int>("n90Jet",2);
185 
186  // Tau discriminators
188  tauDscrmtrLabel1_ = iConfig.getUntrackedParameter("tauDscrmtrLabel1", std::string("shrinkingConePFTauDiscriminationByLeadingTrackFinding"));
189  tauDscrmtrLabel2_ = iConfig.getUntrackedParameter("tauDscrmtrLabel2", std::string("shrinkingConePFTauDiscriminationByLeadingTrackPtCut"));
190  tauDscrmtrLabel3_ = iConfig.getUntrackedParameter("tauDscrmtrLabel3", std::string("shrinkingConePFTauDiscriminationByIsolation"));
191 
192  specialPaths_ = iConfig.getParameter<std::vector<std::string > >("SpecialPaths");
193 
194  pathsSummaryFolder_ = iConfig.getUntrackedParameter ("pathsSummaryFolder",std::string("HLT/FourVector/PathsSummary/"));
195  pathsSummaryHLTCorrelationsFolder_ = iConfig.getUntrackedParameter ("hltCorrelationsFolder",std::string("HLT/FourVector/PathsSummary/HLT Correlations/"));
196  pathsSummaryFilterCountsFolder_ = iConfig.getUntrackedParameter ("filterCountsFolder",std::string("HLT/FourVector/PathsSummary/Filters Counts/"));
197 
198  pathsSummaryHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("pathsPerLSFolder",std::string("HLT/FourVector/PathsSummary/HLT LS/"));
199  // pathsIndividualHLTPathsPerLSFolder_ = iConfig.getUntrackedParameter ("individualPathsPerLSFolder",std::string("HLT/FourVector/PathsSummary/HLT LS/Paths/"));
200  // pathsSummaryHLTPathsPerBXFolder_ = iConfig.getUntrackedParameter ("individualPathsPerBXFolder",std::string("HLT/FourVector/PathsSummary/HLT BX/"));
201 
202  fLumiFlag = true;
203  ME_HLTAll_LS = NULL;
204  ME_HLT_BX = NULL;
206 
207  jetID = new reco::helper::JetIDHelper(iConfig.getParameter<ParameterSet>("JetIDParams"));
208 
209  recHitsEBTag_ = iConfig.getUntrackedParameter<edm::InputTag>("RecHitsEBTag",edm::InputTag("reducedEcalRecHitsEB"));
210  recHitsEETag_ = iConfig.getUntrackedParameter<edm::InputTag>("RecHitsEETag",edm::InputTag("reducedEcalRecHitsEE"));
211 
212 
213 }
214 
215 
217 {
218 
219  // do anything here that needs to be done at desctruction time
220  // (e.g. close files, deallocate resources etc.)
221  delete fSelectedMuons;
222  delete fSelectedElectrons;
223  delete fSelectedPhotons;
224  delete fSelectedJets;
225  delete fSelectedMet;
226  delete fSelectedTaus;
227 
228 }
229 
230 
231 //
232 // member functions
233 //
234 
235 // ------------ method called to for each event ------------
236 void
238 {
239 
240  //if(! fLumiFlag ) return;
241 
242  using namespace edm;
243  using namespace trigger;
244  ++nev_;
245  LogDebug("FourVectorHLTOffline")<< " analyze...." ;
246 
247 
248 
249  /*
250  Handle<GenParticleCollection> genParticles;
251  iEvent.getByLabel("genParticles", genParticles);
252  if(!genParticles.isValid()) {
253  edm::LogInfo("FourVectorHLTOffline") << "genParticles not found, "
254  "skipping event";
255  return;
256  }
257 
258  Handle<GenJetCollection> genJets;
259  iEvent.getByLabel("iterativeCone5GenJets",genJets);
260  if(!genJets.isValid()) {
261  edm::LogInfo("FourVectorHLTOffline") << "genJets not found, "
262  "skipping event";
263  return;
264  }
265 
266  Handle<GenMETCollection> genMets;
267  iEvent.getByLabel("genMetTrue",genMets);
268  if(!genMets.isValid()) {
269  edm::LogInfo("FourVectorHLTOffline") << "genMets not found, "
270  "skipping event";
271  return;
272  }
273  */
274 
277  if(!triggerResults.isValid()) {
278  edm::InputTag triggerResultsLabelFU(triggerResultsLabel_.label(),triggerResultsLabel_.instance(), "FU");
279  iEvent.getByLabel(triggerResultsLabelFU,triggerResults);
280  if(!triggerResults.isValid()) {
281  edm::LogInfo("FourVectorHLTOffline") << "TriggerResults not found, "
282  "skipping event";
283  return;
284  }
285  }
287  const edm::TriggerNames & triggerNames = iEvent.triggerNames(*triggerResults);
288  int npath = triggerResults->size();
289 
291  if(!fTriggerObj.isValid()) {
292 
293  edm::InputTag triggerSummaryLabelFU(triggerSummaryLabel_.label(),triggerSummaryLabel_.instance(), "FU");
294  iEvent.getByLabel(triggerSummaryLabelFU,fTriggerObj);
295 
296  if(!fTriggerObj.isValid()) {
297 
298  edm::LogInfo("FourVectorHLTOffline") << "TriggerEvent not found, " "skipping event";
299  return;
300 
301  }
302 
303  }
304 
305  // Beam spot
306  if (!iEvent.getByLabel(InputTag("offlineBeamSpot"), fBeamSpotHandle)) {
307  edm::LogInfo("") << ">>> No beam spot found !!!";
308  }
309 
311  iEvent.getByLabel(muonRecoCollectionName_,muonHandle);
312  if(!muonHandle.isValid())
313  edm::LogInfo("FourVectorHLTOffline") << "muonHandle not found, ";
314  selectMuons(muonHandle);
315 
317  iEvent.getByLabel("gsfElectrons",gsfElectrons);
318  if(!gsfElectrons.isValid())
319  edm::LogInfo("FourVectorHLTOffline") << "gsfElectrons not found, ";
320  selectElectrons(iEvent, iSetup, gsfElectrons);
321 
322  //edm::Handle<reco::CaloTauCollection> tauHandle;
324  iEvent.getByLabel("caloRecoTauProducer",tauHandle);
325  if(!tauHandle.isValid())
326  edm::LogInfo("FourVectorHLTOffline") << "tauHandle not found, ";
327  //selectTaus(tauHandle);
328  selectTaus(iEvent);
329 
331  iEvent.getByLabel("iterativeCone5CaloJets",jetHandle);
332  if(!jetHandle.isValid())
333  edm::LogInfo("FourVectorHLTOffline") << "jetHandle not found, ";
334  selectJets(iEvent,jetHandle);
335 
336  // Get b tag information
338  iEvent.getByLabel("jetProbabilityBJetTags", bTagIPHandle);
339  if (!bTagIPHandle.isValid())
340  edm::LogInfo("FourVectorHLTOffline") << "mTagIPHandle trackCountingHighEffJetTags not found, ";
341 
342  // Get b tag information
344  iEvent.getByLabel("softMuonBJetTags", bTagMuHandle);
345  if (!bTagMuHandle.isValid())
346  edm::LogInfo("FourVectorHLTOffline") << "bTagMuHandle not found, ";
347 
349  iEvent.getByLabel("met",metHandle);
350  if(!metHandle.isValid())
351  edm::LogInfo("FourVectorHLTOffline") << "metHandle not found, ";
352  selectMet(metHandle);
353 
355  iEvent.getByLabel("photons",photonHandle);
356  if(!photonHandle.isValid())
357  edm::LogInfo("FourVectorHLTOffline") << "photonHandle not found, ";
358  selectPhotons(photonHandle);
359 
361  iEvent.getByLabel("pixelTracks",trackHandle);
362  if(!trackHandle.isValid())
363  edm::LogInfo("FourVectorHLTOffline") << "trackHandle not found, ";
364 
365 
366  // ---------------------
367  // Monitors
368  // ---------------------
369 
370  // electron Monitor
372  //eleMon.setReco(gsfElectrons);
374  eleMon.setRecoEle(fSelElectronsHandle);
376 
377  eleMon.pushTriggerType(TriggerElectron);
378  eleMon.pushTriggerType(TriggerL1NoIsoEG);
379  eleMon.pushTriggerType(TriggerL1IsoEG);
380 
381  eleMon.pushL1TriggerType(TriggerL1NoIsoEG);
382  eleMon.pushL1TriggerType(TriggerL1IsoEG);
383 
384  // muon Monitor
386  //muoMon.setReco(muonHandle);
387  muoMon.setReco(fSelMuonsHandle);
388  muoMon.setRecoMu(fSelMuonsHandle);
390 
391  muoMon.pushTriggerType(TriggerMuon);
392  muoMon.pushTriggerType(TriggerL1Mu);
393 
394  muoMon.pushL1TriggerType(TriggerL1Mu);
395 
396  // tau Monitor
397  //objMonData<reco::CaloTauCollection> tauMon;
399  //tauMon.setReco(tauHandle);
400  tauMon.setReco(fSelTausHandle);
402 
403  tauMon.pushTriggerType(TriggerTau);
404  tauMon.pushTriggerType(TriggerL1TauJet);
405 
406  tauMon.pushL1TriggerType(TriggerL1TauJet);
407  tauMon.pushL1TriggerType(TriggerL1ForJet);
408 
409  // photon Monitor
410  //objMonData<reco::PhotonCollection> phoMon;
411  //phoMon.setReco(photonHandle);
412  //phoMon.setReco(fSelPhotonsHandle);
413  // -----------------------------------------------
414  // Use RECO Electrons instead of RECO Photons
415  // to measure HLT_Photon efficiency
416  // -----------------------------------------------
419  phoMon.setRecoEle(fSelElectronsHandle);
420 
421 
423 
424  phoMon.pushTriggerType(TriggerPhoton);
425 
426  phoMon.pushL1TriggerType(TriggerL1NoIsoEG);
427  phoMon.pushL1TriggerType(TriggerL1IsoEG);
428 
429  // jet Monitor - NOTICE: we use genJets for MC
431  //jetMon.setReco(jetHandle);
432  jetMon.setReco(fSelJetsHandle);
434 
435  jetMon.pushTriggerType(TriggerJet);
436  jetMon.pushTriggerType(TriggerL1CenJet);
437  jetMon.pushTriggerType(TriggerL1ForJet);
438 
439  jetMon.pushL1TriggerType(TriggerL1CenJet);
440  jetMon.pushL1TriggerType(TriggerL1ForJet);
441  jetMon.pushL1TriggerType(TriggerL1TauJet);
442 
443  // bjet Monitor - NOTICE: we use genJets for MC
444  objMonData<reco::CaloJetCollection> btagIPMon; // CaloJet will not be used, this is only place holder
445  //btagIPMon.setReco(jetHandle);
446  btagIPMon.setRecoB(bTagIPHandle);
447  btagIPMon.setBJetsFlag(true);
449 
450  btagIPMon.pushTriggerType(TriggerBJet);
451  btagIPMon.pushTriggerType(TriggerJet);
452 
453  btagIPMon.pushL1TriggerType(TriggerL1CenJet);
454  btagIPMon.pushL1TriggerType(TriggerL1ForJet);
455  btagIPMon.pushL1TriggerType(TriggerL1TauJet);
456 
457  objMonData<reco::CaloJetCollection> btagMuMon; // CaloJet will not be used, this is only place holder
458  //btagMuMon.setReco(jetHandle);
459  btagMuMon.setRecoB(bTagMuHandle);
460  btagMuMon.setBJetsFlag(true);
462 
463  btagMuMon.pushTriggerType(TriggerBJet);
464  btagMuMon.pushTriggerType(TriggerJet);
465 
466  btagMuMon.pushL1TriggerType(TriggerL1CenJet);
467  btagMuMon.pushL1TriggerType(TriggerL1ForJet);
468  btagMuMon.pushL1TriggerType(TriggerL1TauJet);
469 
470 
471  objMonData<reco::CaloJetCollection> btagMon; // Generic btagMon
472 
473  // met Monitor
475  //metMon.setReco(metHandle);
476  metMon.setReco(fSelMetHandle);
478 
479  metMon.pushTriggerType(TriggerMET);
480 
481  metMon.pushL1TriggerType(TriggerL1ETM);
482 
483  // tet Monitor
485  //tetMon.setReco(metHandle);
486  tetMon.setReco(fSelMetHandle);
487  //tetMon.setLimits(tetEtaMax_=999., tetEtMin_=10, tetDRMatch_=999);
488  tetMon.setLimits(999., 10., 999., 999., dRMax_, thresholdFactor_);
489 
490  tetMon.pushTriggerType(TriggerTET);
491 
492  tetMon.pushL1TriggerType(TriggerL1ETT);
493 
494  // default Monitor
495  //objMonData<trigger::TriggerEvent> defMon;
497  defMon.setLimits(999., 3., 999., 999., dRMax_, thresholdFactor_);
498 
499  // vector to hold monitors
500  // interface is through virtual class BaseMonitor
501  std::vector<BaseMonitor*> monitors;
502 
503  //monitors.push_back(&jetMon);
504 
505  monitors.push_back(&muoMon);
506  monitors.push_back(&eleMon);
507  monitors.push_back(&tauMon);
508  monitors.push_back(&phoMon);
509  monitors.push_back(&jetMon);
510  monitors.push_back(&btagMon);
511  monitors.push_back(&metMon);
512  monitors.push_back(&tetMon);
513  /*
514  */
515 
516  // int bx = iEvent.bunchCrossing();
517  /*
518  // Fill HLTPassed_Correlation Matrix bin (i,j) = (Any,Any)
519  // --------------------------------------------------------
520  int anyBinNumber = ME_HLTPassPass_->getTH2F()->GetXaxis()->FindBin("HLT_Any");
521  // any triger accepted
522  if(triggerResults->accept()){
523 
524  ME_HLTPassPass_->Fill(anyBinNumber-1,anyBinNumber-1);//binNumber1 = 0 = first filter
525 
526  }
527  */
528 
529  fillHltMatrix(triggerNames);
530 
531 
532  // Loop over paths
533  // --------------------
534  for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
535 
536  LogTrace("FourVectorHLTOffline") << " unique path " << v->getPath() << endl;
537 
538  unsigned int pathByIndex = triggerNames.triggerIndex(v->getPath());
539 
540  // path must be in the menu
541  if(pathByIndex >= fTriggerResults->size() ) continue;
542 
543 
544  // Fill HLTPassed Matrix and HLTPassFail Matrix
545  // --------------------------------------------------------
546 
547 // if(triggerResults->accept(pathByIndex)){
548 
549 // int pathBinNumber = ME_HLT_BX->getTH2F()->GetYaxis()->FindBin(v->getPath().c_str());
550 // ME_HLT_BX->Fill(bx,pathBinNumber-1);
551 
552 // //if(hasHLTPassed(fCustomBXPath,triggerNames)) {
553 
554 // //ME_HLT_CUSTOM_BX->Fill(bx,pathBinNumber-1);
555 
556 // //}
557 
558 // } // end if accept
559 
560  // Fill histogram of filter ocupancy for each HLT path
561  // ---------------------------------
562  unsigned int lastModule = triggerResults->index(pathByIndex);
563 
564  //check if hlt passed
565  bool hltPathPassed = triggerResults->accept(pathByIndex);
566 
567  //go through the list of filters
568  for(unsigned int filt = 0; filt < v->filtersAndIndices.size(); filt++){
569 
570  int binNumber = v->getFiltersHisto()->getTH1()->GetXaxis()->FindBin(v->filtersAndIndices[filt].first.c_str());
571 
572  // if hlt path passed, then all the modules passed
573  // otherwise the module that issued the decision is the first fail
574  // this means that all modules before it passed
575  if(hltPathPassed) {
576 
577  v->getFiltersHisto()->Fill(binNumber-1);//binNumber1 = 0 = first filter
578  }
579  else if(v->filtersAndIndices[filt].second < lastModule){
580  v->getFiltersHisto()->Fill(binNumber-1);//binNumber1 = 0 = first filter
581  }
582 
583  } // end for filt
584 
585  } // end for diag paths
586 
587  // Main loop over paths
588  // --------------------
589  for(PathInfoCollection::iterator v = hltPaths_.begin(); v!= hltPaths_.end(); ++v ) {
590 
591  LogTrace("FourVectorHLTOffline") << " path " << v->getPath() << endl;
592 
593  if (v->getPath().find("BTagIP") != std::string::npos ) btagMon = btagIPMon;
594  else btagMon = btagMuMon;
595 
596  // set flag for muon monitor if L2-muon or L1-muon type path
597  if (v->getPath().find("L2Mu") != std::string::npos || v->getPath().find("L1Mu") != std::string::npos ) muoMon.setL2MuFlag(true);
598  else muoMon.setL2MuFlag(false);
599 
600  //if (v->getPath().find("HLT_Jet15U") == std::string::npos ) continue;
601  //if(*v != "HLT_L1Jet6U") continue;
602 
603  unsigned int pathByIndex = triggerNames.triggerIndex(v->getPath());
604 
605  if(pathByIndex >= fTriggerResults->size() ) continue;
606 
607  // did we pass the denomPath?
608  bool denompassed = false;
609 
610  for(int i = 0; i < npath; ++i) {
611 
612  if (triggerResults->accept(i) && triggerNames.triggerName(i).find(v->getDenomPath()) != std::string::npos && triggerNames.triggerName(i).find("HLT_Mult") == std::string::npos )
613  {
614  denompassed = true;
615  break;
616  }
617  }
618 
619  if (denompassed)
620  {
621 
622  //LogTrace("FourVectorHLTOffline") << " denominator path " << v->getPath() << endl;
623 
624 
625  // Get the righe monitor for this path
626  // -----------------------------------
627  BaseMonitor* mon = NULL;
628 
629  for(std::vector<BaseMonitor*>::iterator mit = monitors.begin(); mit!= monitors.end(); ++mit ) {
630 
631  if((*mit)->isTriggerType(v->getObjectType())) {
632 
633  mon = *mit;
634  break;
635 
636  }
637 
638  }
639 
640  // if cannot find moniotor for the path, go to next path
641  //if(!mon) continue;
642 
643  // if cannot find moniotor for the path, assign the default
644  if(!mon) mon = &defMon;
645 
646  // attach this path to mon
647  mon->setPath(v);
648 
649  // clear sets of matched objects
650  mon->clearSets();
651 
652  v->getObjectType();
653 
654  // monitor offline (RECO objects)
656  mon->monitorOffline();
657 
658  // monitor L1 (only if L1 passed and can find GTSeed)
660  bool l1accept = false;
661  edm::InputTag l1testTag(v->getl1Path(),"",processname_);
662  const int l1Index = fTriggerObj->filterIndex(l1testTag);
663 
664  if ( l1Index >= fTriggerObj->sizeFilters() ) {
665 
666  LogTrace("FourVectorHLTOffline") << "Cannot find L1GTSeed of the path " << v->getPath() << endl;
667  LogTrace("FourVectorHLTOffline") << "\t L1GTSeed name = " << v->getl1Path() << endl;
668  LogTrace("FourVectorHLTOffline") << "\t tried with tag " << l1testTag << endl;
669  LogTrace("FourVectorHLTOffline") <<"\t module index = "<< l1Index << endl;
670 
671  }
672 
673  // monitor L1 object
674  mon->monitorL1(l1Index, this);
675 
676  // fill matching b/w Offline and L1 objects
677  mon->fillL1Match(this);
678 
679  // monitor Online (only if HLT passed)
681  bool numpassed = false;
682 
683  // did we pass the numerator path, i.e. HLT path?
684  for(int i = 0; i < npath; ++i) {
685 
686  if ( triggerResults->accept(i) && triggerNames.triggerName(i) == v->getPath() ) numpassed = true;
687 
688  }
689 
690  if (!numpassed) continue;
691 
692  if (!l1accept) {
693 
694  LogDebug("FourVectorHLTOffline")
695  << "This should not happen. HLT passed, but L1 Seed not passed for hlt path "<< endl
696  << "HLT path: " << v->getPath() << "\t HLTLevel1GTSeed: " << v->getl1Path();
697 
698  }
699 
700  // fill scaler histograms
701  edm::InputTag filterTag = v->getTag();
702 
703  // loop through indices and see if the filter is
704  // on the list of filters used by this path
705  //----------------------------------------------
706  if (v->getLabel() == "dummy"){
707  const vector<string> filterLabels = hltConfig_.moduleLabels(v->getPath());
708 
709  //loop over labels
710  for (vector<string>::const_iterator labelIter= filterLabels.begin(); labelIter!=filterLabels.end(); labelIter++) {
711 
712  edm::InputTag testTag(*labelIter,"",processname_);
713 
714  int testindex = fTriggerObj->filterIndex(testTag);
715 
716  // last match wins...
717  if ( !(testindex >= fTriggerObj->sizeFilters()) ) {
718 
719  filterTag = testTag;
720  v->setLabel(*labelIter);}
721 
722  }
723 
724  } // end for
725 
726  const int hltIndex = fTriggerObj->filterIndex(filterTag);
727  if ( hltIndex >= fTriggerObj->sizeFilters() ) {
728 
729  LogTrace("FourVectorHLTOffline") << "WTF no index "<< hltIndex << " of that name " << filterTag << endl;
730  continue; // not in this event
731 
732  }
733 
734  mon->monitorOnline(hltIndex, l1Index, this);
735 
736  mon->fillOnlineMatch(l1Index, this);
737 
738  } //denompassed
739 
740 
741  } //pathinfo loop
742 
743 }
744 
745 
746 
747 // -- method called once each job just before starting event loop --------
748 void
750 {
751  nev_ = 0;
752  DQMStore *dbe = 0;
753  dbe = Service<DQMStore>().operator->();
754 
755  if (dbe) {
757  dbe->rmdir(dirname_);
758  }
759 
760 
761  if (dbe) {
763  }
764 }
765 
766 // - method called once each job just after ending the event loop ------------
767 void
769 {
770  LogInfo("FourVectorHLTOffline") << "analyzed " << nev_ << " events";
771  return;
772 }
773 
774 
775 // BeginRun
777 {
778 
779  LogDebug("FourVectorHLTOffline") << "beginRun, run " << run.id();
780 
781  if(fIsSetup) return;
782 
783  // HLT config does not change within runs!
784  bool changed=false;
785 
786  if (!hltConfig_.init(run, c, processname_, changed)) {
787 
788  processname_ = "FU";
789 
790  if (!hltConfig_.init(run, c, processname_, changed)){
791 
792  LogDebug("FourVectorHLTOffline") << "HLTConfigProvider failed to initialize.";
793 
794  }
795 
796  // check if trigger name in (new) config
797  // cout << "Available TriggerNames are: " << endl;
798  // hltConfig_.dump("Triggers");
799  }
800 
801  if (1) {
802 
803  DQMStore *dbe = 0;
804  dbe = Service<DQMStore>().operator->();
805 
806  if (dbe) {
808  }
809 
810  const unsigned int n(hltConfig_.size());
811 
812  if (plotAll_){
813 
814  for (unsigned int j=0; j!=n; ++j) {
815 
817 
818  string l1pathname = getL1ConditionModuleName(pathname);
819 
820  int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1pathname);
821 
822  int objectType = getTriggerTypeParsePathName(pathname);
823 
824  for (unsigned int i=0; i!=n; ++i) {
825 
826  std::string denompathname = hltConfig_.triggerName(i);
827  int denomobjectType = getTriggerTypeParsePathName(denompathname);
828 
829 
830 
831  std::string filtername("dummy");
832  float ptMin = 0.0;
833  float ptMax = 100.0;
834  if (plotAll_ && denomobjectType == objectType && objectType != 0) {
835 
836  int hltThreshold = getHltThresholdFromName(pathname);
837  int l1Threshold = getHltThresholdFromName(l1pathname);
838  hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
839 
840  }
841 
842  }
843  }
844 
845  } // end if plotAll
846  else {
847 
848  // plot all diagonal combinations plus any other specified pairs
849  for (unsigned int i=0; i!=n; ++i) {
850 
851  std::string denompathname = "";
853  //parse pathname to guess object type
854  int objectType = getTriggerTypeParsePathName(pathname);
855 
856  string l1pathname = getL1ConditionModuleName(pathname);
857  int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1pathname);
858 
859  std::string filtername("dummy");
860  float ptMin = 0.0;
861  float ptMax = 100.0;
862 
863  if (objectType == trigger::TriggerPhoton) ptMax = 400.0;
864  if (objectType == trigger::TriggerElectron) ptMax = 300.0;
865  if (objectType == trigger::TriggerMuon) ptMax = 300.0;
866  if (objectType == trigger::TriggerTau) ptMax = 300.0;
867  if (objectType == trigger::TriggerJet) ptMax = 700.0;
868  if (objectType == trigger::TriggerBJet) ptMax = 300.0;
869  if (objectType == trigger::TriggerMET) ptMax = 500.0;
870  if (objectType == trigger::TriggerTET) ptMax = 1000.0;
871  if (objectType == trigger::TriggerTrack) ptMax = 100.0;
872 
873  // keep track of all paths, except for FinalPath
874  if (objectType != -1 && pathname.find("FinalPath") == std::string::npos){
875 
876  int hltThreshold = getHltThresholdFromName(pathname);
877  int l1Threshold = getHltThresholdFromName(l1pathname);
878 
879  hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
880 
881  hltPathsDiagonal_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
882 
883  }
884 
885  } // end for i
886 
887  // now loop over denom/num path pairs specified in cfg,
888  // recording the off-diagonal ones
889  for (std::vector<std::pair<std::string, std::string> >::iterator custompathnamepair = custompathnamepairs_.begin(); custompathnamepair != custompathnamepairs_.end(); ++custompathnamepair) {
890 
891  std::string numpathname = custompathnamepair->first;
892  std::string denompathname = custompathnamepair->second;
893 
894  if (numpathname != denompathname) {
895 
896  // check that denominator exists
897  bool founddenominator = false;
898  for (unsigned int k=0; k!=n; ++k) {
899 
900  string n_pathname = hltConfig_.triggerName(k);
901 
902  if (n_pathname.find(denompathname) != std::string::npos) {
903 
904  LogDebug("FourVectorHLTOffline") << "denompathname is selected to be = " << n_pathname << endl;;
905  founddenominator = true;
906 
907  break;
908 
909  }
910  }
911 
912  if (!founddenominator) {
913 
914  edm::LogInfo("FourVectorHLTOffline") << "denompathname not found, go to the next pair numearator-denominator" << endl;
915 
916  // go to the next pair
917  continue;
918 
919  }
920 
921  // check that numerator exists
922  for (unsigned int j=0; j!=n; ++j) {
923  bool foundnumerator = false;
924 
925  string pathname = hltConfig_.triggerName(j);
926 
927  LogDebug("FourVectorHLTOffline") << "check if path " << pathname << " is numpathname = " << numpathname << endl;
928  if (hltConfig_.triggerName(j).find(numpathname)!= std::string::npos) {
929 
930  LogDebug("FourVectorHLTOffline") << "pathname is selected to be = " << denompathname << endl;;
931  foundnumerator = true;
932 
933  }
934 
935 
936  if (!foundnumerator) {
937 
938  edm::LogInfo("FourVectorHLTOffline") << "pathname not found, ignoring " << pathname;
939  continue;
940 
941  }
942 
943  string l1pathname = getL1ConditionModuleName(pathname);
944  int l1ModuleIndex = hltConfig_.moduleIndex(pathname, l1pathname);
945  int objectType = getTriggerTypeParsePathName(pathname);
946 
947  std::string filtername("dummy");
948  float ptMin = 0.0;
949  float ptMax = 100.0;
950 
951  if (objectType == trigger::TriggerPhoton) ptMax = 400.0;
952  if (objectType == trigger::TriggerElectron) ptMax = 300.0;
953  if (objectType == trigger::TriggerMuon) ptMax = 300.0;
954  if (objectType == trigger::TriggerTau) ptMax = 300.0;
955  if (objectType == trigger::TriggerJet) ptMax = 700.0;
956  if (objectType == trigger::TriggerBJet) ptMax = 300.0;
957  if (objectType == trigger::TriggerMET) ptMax = 500.0;
958  if (objectType == trigger::TriggerTET) ptMax = 1000.0;
959  if (objectType == trigger::TriggerTrack) ptMax = 100.0;
960 
961  // monitor regardless of the objectType of the path
962  if (objectType != 0) {
963  int hltThreshold = getHltThresholdFromName(pathname);
964  int l1Threshold = getHltThresholdFromName(l1pathname);
965  hltPaths_.push_back(PathInfo(denompathname, pathname, l1pathname, l1ModuleIndex, filtername, processname_, objectType, ptMin, ptMax, hltThreshold, l1Threshold));
966 
967  }
968 
969  } // end for j, loop over paths
970 
971  } // end if not same num and denominator
972 
973  } // end for pair
974 
975  } // end else
976 
977 
978  vector<string> allPaths;
979  // fill vectors of Muon, Egamma, JetMet, Rest, and Special paths
980 
981  int vi = 0;
982 
983  for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
984 
985  std::string pathName = removeVersions(v->getPath());
986  //int objectType = v->getObjectType();
987 
988  vector<int> tempCount(5,0);
989 
990  fPathTempCountPair.push_back(make_pair(pathName,0));
991  fPathBxTempCountPair.push_back(make_pair(pathName,tempCount));
992 
993  allPaths.push_back(pathName);
994 
995  }
996 
997  fPathTempCountPair.push_back(make_pair("HLT_Any",0));
998 
999  fGroupName.push_back("All");
1000 
1001  for(unsigned int g=0; g<fGroupName.size(); g++) {
1002 
1003  //fGroupTempCountPair.push_back(make_pair(fGroupName[g],0));
1004  //fGroupL1TempCountPair.push_back(make_pair(fGroupName[g],0));
1005 
1006  }
1007 
1009 
1010  fGroupNamePathsPair.push_back(make_pair("All",allPaths));
1011 
1013  vector<string> datasetNames = hltConfig_.datasetNames() ;
1014  for (unsigned int i=0;i<datasetNames.size();i++) {
1015 
1016  vector<string> datasetPaths = hltConfig_.datasetContent(datasetNames[i]);
1017  fGroupNamePathsPair.push_back(make_pair(datasetNames[i],datasetPaths));
1018 
1019  }
1020 
1021 
1022  for (unsigned int g=0;g<fGroupNamePathsPair.size();g++) {
1023 
1024  fGroupTempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
1025  fGroupL1TempCountPair.push_back(make_pair(fGroupNamePathsPair[g].first,0));
1027 
1028  }
1029 
1030  // setupHltLsPlots();
1031  // setupHltBxPlots();
1032 
1033  vi = 0;
1034 
1035  for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
1036  vi++;
1037 
1038  // -------------------------
1039  //
1040  // Filters for each path
1041  //
1042  // -------------------------
1043 
1044  // get all modules in this HLT path
1045  std::string pathName = removeVersions(v->getPath());
1046  vector<string> moduleNames = hltConfig_.moduleLabels(v->getPath());
1047 
1048  int numModule = 0;
1049  string moduleName, moduleType, moduleEDMType;
1050  unsigned int moduleIndex;
1051 
1052  //print module name
1053  vector<string>::const_iterator iDumpModName;
1054  for (iDumpModName = moduleNames.begin();iDumpModName != moduleNames.end();iDumpModName++) {
1055 
1056  moduleName = *iDumpModName;
1057  moduleType = hltConfig_.moduleType(moduleName);
1058  moduleEDMType = hltConfig_.moduleEDMType(moduleName);
1059  moduleIndex = hltConfig_.moduleIndex(v->getPath(), moduleName);
1060 
1061  LogTrace ("FourVectorHLTOffline") << "Module " << numModule
1062  << " is called " << moduleName
1063  << " , type = " << moduleType
1064  << " , EDMtype = " << moduleEDMType
1065  << " , index = " << moduleIndex
1066  << endl;
1067 
1068  numModule++;
1069 
1070  if((moduleType.find("Filter") != string::npos && moduleType.find("HLTTriggerTypeFilter") == string::npos ) ||
1071  (moduleType.find("Associator") != string::npos) ||
1072  (moduleType.find("HLTLevel1GTSeed") != string::npos) ||
1073  (moduleType.find("HLTGlobalSumsCaloMET") != string::npos) ||
1074  (moduleType.find("HLTPrescaler") != string::npos) ||
1075  (moduleEDMType.find("EDFilter") != string::npos) ) {
1076 
1077  //std::pair<std::string, int> filterIndexPair;
1078  //filterIndexPair.first = moduleName;
1079  //filterIndexPair.second = moduleIndex;
1080  //v->filtersAndIndices.push_back(filterIndexPair);
1081  v->filtersAndIndices.push_back(make_pair(moduleName,moduleIndex));
1082 
1083  }
1084 
1085 
1086  }//end for modulesName
1087 
1089 
1090  //int nbin_sub = 5;
1091  int nbin_sub = v->filtersAndIndices.size()+2;
1092 
1093 
1094  //TString thisPath = v->getPath();
1095 
1096  // count plots for subfilter
1097  MonitorElement* filters = dbe_->book1D("Filters_" + pathName,
1098  "Filters_" + pathName,
1099  nbin_sub+1, -0.5, 0.5+(double)nbin_sub);
1100 
1101  for(unsigned int filt = 0; filt < v->filtersAndIndices.size(); filt++){
1102 
1103  if (filters)
1104  filters->setBinLabel(filt+1, (v->filtersAndIndices[filt]).first);
1105 
1106  }
1107 
1108  // bjk here
1109 // // book Count vs LS
1110 // dbe_->setCurrentFolder(pathsIndividualHLTPathsPerLSFolder_.c_str());
1111 // MonitorElement* tempME = dbe_->book1D(v->getPath() + "_count_per_LS",
1112 // pathName + " count per LS",
1113 // nLS_, 0,nLS_);
1114 // tempME->setAxisTitle("Luminosity Section");
1115 
1116  v->setFilterHistos(filters);
1117 
1118  } // end for paths
1119 
1120  // now set up all of the histos for each path-denom
1121  for(PathInfoCollection::iterator v = hltPaths_.begin(); v!= hltPaths_.end(); ++v ) {
1122 
1123  MonitorElement *NOn=0;
1124  MonitorElement *onEtOn=0;
1125  MonitorElement *onOneOverEtOn=0;
1126  MonitorElement *onEtavsonPhiOn=0;
1127  MonitorElement *NOff=0;
1128  MonitorElement *offEtOff=0;
1129  MonitorElement *offEtavsoffPhiOff=0;
1130  MonitorElement *NL1=0;
1131  MonitorElement *l1EtL1=0;
1132  MonitorElement *l1Etavsl1PhiL1=0;
1133  MonitorElement *NL1On=0;
1134  MonitorElement *l1EtL1On=0;
1135  MonitorElement *l1Etavsl1PhiL1On=0;
1136  MonitorElement *NL1Off=0;
1137  MonitorElement *offEtL1Off=0;
1138  MonitorElement *offEtavsoffPhiL1Off=0;
1139  MonitorElement *NOnOff=0;
1140  MonitorElement *offEtOnOff=0;
1141  MonitorElement *offEtavsoffPhiOnOff=0;
1142  MonitorElement *NL1OnUM=0;
1143  MonitorElement *l1EtL1OnUM=0;
1144  MonitorElement *l1Etavsl1PhiL1OnUM=0;
1145  MonitorElement *NL1OffUM=0;
1146  MonitorElement *offEtL1OffUM=0;
1147  MonitorElement *offEtavsoffPhiL1OffUM=0;
1148  MonitorElement *NOnOffUM=0;
1149  MonitorElement *offEtOnOffUM=0;
1150  MonitorElement *offEtavsoffPhiOnOffUM=0;
1151  MonitorElement *offDRL1Off=0;
1152  MonitorElement *offDROnOff=0;
1153  MonitorElement *l1DRL1On=0;
1154 
1155  std::string pathName = removeVersions(v->getPath());
1156  std::string labelname("dummy");
1157  labelname = pathName + "_wrt_" + v->getDenomPath();
1158 
1159  std::string histoname(labelname+"_NOn");
1160  std::string title(labelname+" N online");
1161  double histEtaMax = 2.5;
1162 
1163  if (v->getObjectType() == trigger::TriggerMuon || v->getObjectType() == trigger::TriggerL1Mu) {
1164 
1165  histEtaMax = muonEtaMax_;
1166 
1167  }
1168  else if (v->getObjectType() == trigger::TriggerElectron || v->getObjectType() == trigger::TriggerL1NoIsoEG || v->getObjectType() == trigger::TriggerL1IsoEG )
1169  {
1170  histEtaMax = electronEtaMax_;
1171  }
1172  else if (v->getObjectType() == trigger::TriggerTau || v->getObjectType() == trigger::TriggerL1TauJet )
1173  {
1174  histEtaMax = tauEtaMax_;
1175  }
1176  else if (v->getObjectType() == trigger::TriggerJet || v->getObjectType() == trigger::TriggerL1CenJet || v->getObjectType() == trigger::TriggerL1ForJet )
1177  {
1178  histEtaMax = jetEtaMax_;
1179  }
1180  else if (v->getObjectType() == trigger::TriggerBJet)
1181  {
1182  histEtaMax = bjetEtaMax_;
1183  }
1184  else if (v->getObjectType() == trigger::TriggerMET || v->getObjectType() == trigger::TriggerL1ETM )
1185  {
1186  histEtaMax = metEtaMax_;
1187  }
1188  else if (v->getObjectType() == trigger::TriggerPhoton)
1189  {
1190  histEtaMax = photonEtaMax_;
1191  }
1192  else if (v->getObjectType() == trigger::TriggerTrack)
1193  {
1194  histEtaMax = trackEtaMax_;
1195  }
1196 
1197  TString pathfolder = dirname_ + TString("/") + pathName;
1198  dbe_->setCurrentFolder(pathfolder.Data());
1199 
1200  NOn = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1201 
1202 
1203  histoname = labelname+"_NOff";
1204  title = labelname+" N Off";
1205  NOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1206 
1207  histoname = labelname+"_NL1";
1208  title = labelname+" N L1";
1209  NL1 = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1210 
1211  histoname = labelname+"_NL1On";
1212  title = labelname+" N L1On";
1213  NL1On = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1214 
1215  histoname = labelname+"_NL1Off";
1216  title = labelname+" N L1Off";
1217  NL1Off = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1218 
1219  histoname = labelname+"_NOnOff";
1220  title = labelname+" N OnOff";
1221  NOnOff = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1222 
1223  histoname = labelname+"_onEtOn";
1224  title = labelname+" onE_t online";
1225  onEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1226 
1227  histoname = labelname+"_onOneOverEtOn";
1228  title = labelname+" 1 / onE_t online";
1229  onOneOverEtOn = dbe->book1D(histoname.c_str(), title.c_str(),nBinsOneOverEt_, 0, 0.1);
1230  onOneOverEtOn->setAxisTitle("HLT 1/Et [1/GeV]");
1231 
1232  histoname = labelname+"_offEtOff";
1233  title = labelname+" offE_t offline";
1234  offEtOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1235 
1236  histoname = labelname+"_l1EtL1";
1237  title = labelname+" l1E_t L1";
1238  l1EtL1 = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1239 
1240  histoname = labelname+"_onEtaonPhiOn";
1241  title = labelname+" on#eta vs on#phi online";
1242  onEtavsonPhiOn = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
1243 
1244  histoname = labelname+"_offEtaoffPhiOff";
1245  title = labelname+" off#eta vs off#phi offline";
1246  offEtavsoffPhiOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
1247 
1248  histoname = labelname+"_l1Etal1PhiL1";
1249  title = labelname+" l1#eta vs l1#phi L1";
1250  l1Etavsl1PhiL1 = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
1251 
1252  histoname = labelname+"_l1EtL1On";
1253  title = labelname+" l1E_t L1+online";
1254  l1EtL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1255 
1256  histoname = labelname+"_offEtL1Off";
1257  title = labelname+" offE_t L1+offline";
1258  offEtL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1259 
1260  histoname = labelname+"_offEtOnOff";
1261  title = labelname+" offE_t online+offline";
1262  offEtOnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1263 
1264  histoname = labelname+"_l1Etal1PhiL1On";
1265  title = labelname+" l1#eta vs l1#phi L1+online";
1266  l1Etavsl1PhiL1On = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
1267 
1268  histoname = labelname+"_offEtaoffPhiL1Off";
1269  title = labelname+" off#eta vs off#phi L1+offline";
1270  offEtavsoffPhiL1Off = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
1271 
1272  histoname = labelname+"_offEtaoffPhiOnOff";
1273  title = labelname+" off#eta vs off#phi online+offline";
1274  offEtavsoffPhiOnOff = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
1275 
1276  if (useUM) {
1277 
1278  histoname = labelname+"_NL1OnUM";
1279  title = labelname+" N L1OnUM";
1280  NL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1281 
1282  histoname = labelname+"_NL1OffUM";
1283  title = labelname+" N L1OffUM";
1284  NL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1285 
1286  histoname = labelname+"_NOnOffUM";
1287  title = labelname+" N OnOffUM";
1288  NOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),10, 0.5, 10.5);
1289 
1290  histoname = labelname+"_l1EtL1OnUM";
1291  title = labelname+" l1E_t L1+onlineUM";
1292  l1EtL1OnUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1293 
1294  histoname = labelname+"_offEtL1OffUM";
1295  title = labelname+" offE_t L1+offlineUM";
1296  offEtL1OffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1297 
1298  histoname = labelname+"_offEtOnOffUM";
1299  title = labelname+" offE_t online+offlineUM";
1300  offEtOnOffUM = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, v->getPtMin(), v->getPtMax());
1301 
1302  histoname = labelname+"_l1Etal1PhiL1OnUM";
1303  title = labelname+" l1#eta vs l1#phi L1+onlineUM";
1304  l1Etavsl1PhiL1OnUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
1305 
1306  histoname = labelname+"_offEtaoffPhiL1OffUM";
1307  title = labelname+" off#eta vs off#phi L1+offlineUM";
1308  offEtavsoffPhiL1OffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
1309 
1310  histoname = labelname+"_offEtaoffPhiOnOffUM";
1311  title = labelname+" off#eta vs off#phi online+offlineUM";
1312  offEtavsoffPhiOnOffUM = dbe->book2D(histoname.c_str(), title.c_str(), nBins2D_,-histEtaMax,histEtaMax, nBins2D_,-TMath::Pi(), TMath::Pi());
1313 
1314  }
1315 
1316  histoname = labelname+"_l1DRL1On";
1317  title = labelname+" l1DR L1+online";
1318  l1DRL1On = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, dRMax_);
1319 
1320  histoname = labelname+"_offDRL1Off";
1321  title = labelname+" offDR L1+offline";
1322  offDRL1Off = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, dRMax_);
1323 
1324  histoname = labelname+"_offDROnOff";
1325  title = labelname+" offDR online+offline";
1326  offDROnOff = dbe->book1D(histoname.c_str(), title.c_str(),nBins_, 0, dRMax_);
1327 
1328 
1329  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
1330 );
1331 
1332  } // end for hltPath
1333 
1334  // bjk here
1335 // // HLT_Any
1336 // // book Count vs LS
1337 // dbe_->setCurrentFolder(pathsIndividualHLTPathsPerLSFolder_.c_str());
1338 // MonitorElement* tempME = dbe_->book1D("HLT_Any_count_per_LS",
1339 // "HLT_Any count per LS",
1340 // nLS_, 0,nLS_);
1341 // tempME->setAxisTitle("Luminosity Section");
1342 
1343  } // end if(1) dummy
1344 
1345  if(!doCombineRuns_) fIsSetup = true;
1346 
1347  return;
1348 
1349 }
1350 
1353 {
1354 
1355  LogDebug("FourVectorHLTOffline") << "endRun, run " << run.id();
1356 
1357 }
1358 
1361 {
1362 
1363  LogDebug("FourVectorHLTOffline") << "cleanDRMatchSet(mmset& tempSet) " << "size of the set (before CLEANING) = " << tempSet.size() << " maps." << endl;
1364 
1365  if(tempSet.size() < 2) return;
1366 
1367  if(tempSet.size() > 10) {
1368 
1369  LogDebug("FourVectorHLTOffline") << "size of the set is too large. It will be truncated to 10." << endl;
1370  mmset::iterator it = tempSet.begin();
1371  for (int i=0;i<10;i++) { it++; }
1372  tempSet.erase( it, tempSet.end());
1373  LogDebug("FourVectorHLTOffline") << "size of the set is now = " << tempSet.size() << " maps." << endl;
1374 
1375  }
1376 
1377  bool cleanedOneMap = false;
1378 
1379  // cleaning needed if the set has at least two maps
1380 
1381  while(! cleanedOneMap && tempSet.size() > 1) {
1382 
1383  cleanedOneMap=false;
1384 
1385  //LogTrace("FourVectorHLTOffline") << "cleaning: size of the set = " << tempSet.size() << " maps." << endl;
1386 
1387  int imap = 0;
1388  for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ ) {
1389 
1390  fimmap tempMap_j = *setIter_i;
1391 
1392  //LogTrace("FourVectorHLTOffline") << " map " << imap << endl;
1393  //LogTrace("FourVectorHLTOffline") << " --------" << endl;
1394 
1395  for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it) {
1396 
1397  //LogTrace("FourVectorHLTOffline") << " " << (*it).first << " : " << (*it).second << endl;
1398 
1399  }
1400 
1401  imap++;
1402 
1403  }
1404 
1405  // loop i
1406  for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ ) {
1407 
1408  fimmap tempMap_i = *setIter_i;
1409  fimmap::iterator it = tempMap_i.begin();
1410  int topValue = (*it).second;
1411  //LogTrace("FourVectorHLTOffline") << " topValue = " << topValue << endl;
1412 
1413 
1414  mmset::iterator tempIter_i = setIter_i;
1415 
1416  // from all the other maps, clean entries that have mapped value "topValue"
1417  // loop j
1418  mmset::iterator setIter_j = ++tempIter_i;
1419  while ( setIter_j != tempSet.end( ) ) {
1420 
1421  fimmap tempMap_j = *setIter_j;
1422  //LogTrace("FourVectorHLTOffline") << " size of the map = " << tempMap_j.size() << endl;
1423 
1424  fimmap::iterator it = tempMap_j.begin();
1425  while ( it != tempMap_j.end() ) {
1426 
1427  if(topValue == (*it).second) {
1428 
1429  //LogTrace("FourVectorHLTOffline") << " Ridding map of a doubly-matched object." << endl;
1430  fimmap::iterator tempIt = it;
1431  ++it; //no longer points to item that is going away
1432  tempMap_j.erase(tempIt);
1433  cleanedOneMap = true;
1434 
1435  } else {
1436  ++it;
1437  } // end if
1438 
1439  } //end while
1440 
1441  if(cleanedOneMap) {
1442 
1443  //remove the old map from the set
1444  mmset::iterator tempIt = setIter_j;
1445  ++setIter_j; //no longer points to item that is going away
1446  tempSet.erase(tempIt);
1447 
1448  // insert in the set the new map if it is not an empty map
1449  if(! tempMap_j.empty()) tempSet.insert(tempMap_j);
1450 
1451  break; // break from loop j
1452 
1453  } else {
1454  ++setIter_j;
1455  } // end if
1456 
1457 
1458  }// end while j
1459 
1460  if(cleanedOneMap) break; // break from loop i
1461 
1462  } // end loop i
1463 
1464  if(cleanedOneMap) {
1465 
1466  // continue cleaning (in while loop)
1467  // but reset flag first
1468  cleanedOneMap=false;
1469  continue;
1470 
1471  }
1472  else {
1473 
1474  // finished cleaing (break from while loop)
1475  break;
1476 
1477  }
1478 
1479  } // end while
1480 
1481  //LogTrace("FourVectorHLTOffline") << "cleaned: size of the set = " << tempSet.size() << " maps." << endl;
1482  int jmap = 0;
1483 
1484  for ( mmset::iterator setIter_i = tempSet.begin( ); setIter_i != tempSet.end( ); setIter_i++ )
1485  {
1486 
1487  fimmap tempMap_j = *setIter_i;
1488 
1489  //LogTrace("FourVectorHLTOffline") << " map " << jmap << endl;
1490  //LogTrace("FourVectorHLTOffline") << " --------" << endl;
1491 
1492  for (fimmap::iterator it = tempMap_j.begin(); it != tempMap_j.end(); ++it) {
1493 
1494  //LogTrace("FourVectorHLTOffline") << " " << (*it).first << " : " << (*it).second << endl;
1495 
1496  }
1497 
1498  jmap++;
1499 
1500  } // end for
1501 
1502  return;
1503 
1504 }
1505 
1506 void FourVectorHLTOffline::setupHltMatrix(const std::string& label, vector<std::string>& paths) {
1507 
1508  //string groupLabelAny = "HLT_"+label+"_Any";
1509  //paths.push_back(groupLabelAny.c_str());
1510  paths.push_back("HLT_"+label+"_L1_Any");
1511  paths.push_back("HLT_"+label+"_Any");
1512  paths.push_back("HLT_Any");
1513 
1514  string h_name;
1515  string h_title;
1516 
1518 
1519  MonitorElement* ME = 0;
1520  MonitorElement* ME_Any = 0;
1521  MonitorElement* ME_Normalized = 0;
1522  MonitorElement* ME_Normalized_Any = 0;
1523 
1524  if (label != "OfflineMonitor" && label != "OnlineHltMonitor" && label != "OnlineMonitor") {
1525  h_name= "HLT_"+label+"_PassPass";
1526  h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass)";
1527  ME = dbe_->book2D(h_name.c_str(), h_title.c_str(),
1528  paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
1529 
1530  h_name= "HLT_"+label+"_Pass_Any";
1531  h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
1532  ME_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
1533  paths.size(), -0.5, paths.size()-0.5);
1534 
1536  h_name= "HLT_"+label+"_PassPass_Normalized";
1537  h_title = "HLT_"+label+"_PassPass (x=Pass, y=Pass) normalized to xBin=Pass";
1538  ME_Normalized = dbe_->book2D(h_name.c_str(), h_title.c_str(),
1539  paths.size(), -0.5, paths.size()-0.5, paths.size(), -0.5, paths.size()-0.5);
1540  h_name= "HLT_"+label+"_Pass_Normalized_Any";
1541  h_title = "HLT_"+label+"_Pass (x=Pass, Any=Pass) normalized to HLT_Any Pass";
1542  ME_Normalized_Any = dbe_->book1D(h_name.c_str(), h_title.c_str(),
1543  paths.size(), -0.5, paths.size()-0.5);
1544  }
1545 
1546  if (label != "All" && label != "OfflineMonitor" && label != "OnlineHltMonitor" && label != "OnlineMonitor")
1547  {
1549  h_name= "HLT_"+label+"_Total_LS";
1550  h_title = label+" HLT paths total count combined per LS ";
1551  MonitorElement* ME_Total_LS = dbe_->book1D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_);
1552  ME_Total_LS->setAxisTitle("LS");
1553 
1554 // for(std::vector<std::string>::iterator i = paths.begin(), e=paths.end(); i!=e; ++i)
1555 // {
1556 // h_name= "HLT_"+removeVersions(*i)+"_LS";
1557 // h_title = removeVersions(*i) + " inside " + label + " HLT paths count per LS ";
1558 // MonitorElement* ME_Group_LS = dbe_->book1D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_);
1559 // ME_Group_LS->setAxisTitle("LS");
1560 // /// add this path to the vector of 2D LS paths
1561 // v_ME_HLTAll_LS.push_back(ME_Group_LS);
1562 // }
1563 
1564  }
1565 
1566 
1567 // dbe_->setCurrentFolder(pathsSummaryHLTPathsPerBXFolder_.c_str());
1568 // h_name= "HLT_"+label+"_BX_LS";
1569 // h_title = label+" HLT paths total count combined per BX ";
1570 // MonitorElement* ME_Total_BX = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, 5, -2.5, 2.5);
1571 // ME_Total_BX->setAxisTitle("LS",1);
1572 // v_ME_Total_BX.push_back(ME_Total_BX);
1573 
1574 // h_name= "HLT_"+label+"_BX_LS_Norm";
1575 // h_title = label+" HLT paths total count combined per BX Normalized to LS";
1576 // MonitorElement* ME_Total_BX_Norm = dbe_->book2D(h_name.c_str(), h_title.c_str(), nLS_, 0, nLS_, 5, -2.5, 2.5);
1577 // ME_Total_BX_Norm->setAxisTitle("LS",1);
1578 // v_ME_Total_BX_Norm.push_back(ME_Total_BX_Norm);
1579 
1580 // bjk: These are OK
1581  if (label != "OfflineMonitor" && label != "OnlineHltMonitor" && label != "OnlineMonitor") {
1582  for(unsigned int i = 0; i < paths.size(); i++){
1583 
1584  if (ME) {
1585  ME->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1586  ME->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1587  }
1588  // ME_Group_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1589  if (ME_Normalized){
1590  ME_Normalized->getTH2F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1591  ME_Normalized->getTH2F()->GetYaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1592  }
1593  if (ME_Normalized_Any)
1594  ME_Normalized_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1595 
1596  if (ME_Any)
1597  ME_Any->getTH1F()->GetXaxis()->SetBinLabel(i+1, (paths[i]).c_str());
1598  }
1599  }
1600 
1601 }
1602 
1604 
1605 
1606  string fullPathToME;
1607 
1608  //for (unsigned int mi=0;mi<fGroupName.size();mi++) {
1609  for (unsigned int mi=0;mi<fGroupNamePathsPair.size();mi++) {
1610 
1611 
1612  fullPathToME = "HLT/FourVector/PathsSummary/HLT_"+fGroupNamePathsPair[mi].first+"_PassPass";
1613  MonitorElement* ME_2d = dbe_->get(fullPathToME);
1614  fullPathToME = "HLT/FourVector/PathsSummary/HLT_"+fGroupNamePathsPair[mi].first+"_Pass_Any";
1615  MonitorElement* ME_1d = dbe_->get(fullPathToME);
1616  if(!ME_2d || !ME_1d) {
1617 
1618  LogTrace("FourVectorHLTOffline") << " ME not valid although I gave full path" << endl;
1619  continue;
1620 
1621  }
1622 
1623  TH2F * hist_2d = ME_2d->getTH2F();
1624  TH1F * hist_1d = ME_1d->getTH1F();
1625 
1626  // Fill HLTPassed Matrix bin (i,j) = (Any,Any)
1627  // --------------------------------------------------------
1628  int anyBinNumber = hist_2d->GetXaxis()->FindBin("HLT_Any");
1629 
1630  string groupBinLabel = "HLT_"+fGroupNamePathsPair[mi].first+"_Any";
1631  int groupBinNumber = hist_2d->GetXaxis()->FindBin(groupBinLabel.c_str());
1632 
1633  // any trigger accepted
1634  if(fTriggerResults->accept()){
1635 
1636  hist_2d->Fill(anyBinNumber-1,anyBinNumber-1);//binNumber1 = 0 = first filter
1637  hist_1d->Fill(anyBinNumber-1);//binNumber1 = 0 = first filter
1638 
1639  }
1640 
1641  bool groupPassed = false;
1642  //bool groupL1Passed = false;
1643 
1644  // Main loop over paths
1645  // --------------------
1646 
1647  //for (int i=1; i< hist_2d->GetNbinsX();i++)
1648  for (unsigned int i=0; i< fGroupNamePathsPair[mi].second.size(); i++)
1649  {
1650 
1651  //string hltPathName = hist_2d->GetXaxis()->GetBinLabel(i);
1652  string hltPathName = fGroupNamePathsPair[mi].second[i];
1653 
1654  // check if this is hlt path name
1655  //unsigned int pathByIndex = triggerNames.triggerIndex(hltPathName);
1656  unsigned int pathByIndex = triggerNames.triggerIndex(fGroupNamePathsPair[mi].second[i]);
1657  if(pathByIndex >= fTriggerResults->size() ) continue;
1658 
1659  // check if its L1 passed
1660  // comment out below but set groupL1Passed to true always
1661  //if(hasL1Passed(hltPathName,triggerNames)) groupL1Passed = true;
1662  //groupL1Passed = true;
1663 
1664  // Fill HLTPassed Matrix and HLTPassFail Matrix
1665  // --------------------------------------------------------
1666 
1667  if(fTriggerResults->accept(pathByIndex)){
1668 
1669  groupPassed = true;
1670  //groupL1Passed = true;
1671 
1672  hist_2d->Fill(i,anyBinNumber-1);//binNumber1 = 0 = first filter
1673  hist_2d->Fill(anyBinNumber-1,i);//binNumber1 = 0 = first filter
1674 
1675  hist_2d->Fill(i,groupBinNumber-1);//binNumber1 = 0 = first filter
1676  hist_2d->Fill(groupBinNumber-1,i);//binNumber1 = 0 = first filter
1677 
1678  hist_1d->Fill(i);//binNumber1 = 0 = first filter
1679 
1680 
1681  //for (int j=1; j< hist_2d->GetNbinsY();j++)
1682  for (unsigned int j=0; j< fGroupNamePathsPair[mi].second.size(); j++)
1683  {
1684 
1685  string crossHltPathName = fGroupNamePathsPair[mi].second[j];
1686 
1687  //unsigned int crosspathByIndex = triggerNames.triggerIndex(hist_2d->GetXaxis()->GetBinLabel(j));
1688  //unsigned int crosspathByIndex = triggerNames.triggerIndex(crossHltPathName);
1689  unsigned int crosspathByIndex = triggerNames.triggerIndex(fGroupNamePathsPair[mi].second[j]);
1690 
1691  if(crosspathByIndex >= fTriggerResults->size() ) continue;
1692 
1693  if(fTriggerResults->accept(crosspathByIndex)){
1694 
1695  hist_2d->Fill(i,j);//binNumber1 = 0 = first filter
1696 
1697  } // end if j path passed
1698 
1699  } // end for j
1700 
1701  } // end if i passed
1702 
1703 
1704  } // end for i
1705 
1706  if(groupPassed) {
1707 
1708  hist_1d->Fill(groupBinNumber-1);//binNumber1 = 0 = first filter
1709  hist_1d->Fill(groupBinNumber-2);//binNumber1 = 0 = first filter -> Fill L1group as well
1710  hist_2d->Fill(groupBinNumber-1,groupBinNumber-1);//binNumber1 = 0 = first filter
1711  hist_2d->Fill(anyBinNumber-1,groupBinNumber-1);//binNumber1 = 0 = first filter
1712  hist_2d->Fill(groupBinNumber-1,anyBinNumber-1);//binNumber1 = 0 = first filter
1713 
1714  }
1715 
1716  /*
1717  string groupL1BinLabel = "HLT_"+fGroupNamePathsPair[mi].first+"_L1_Any";
1718  int groupL1BinNumber = hist_2d->GetXaxis()->FindBin(groupL1BinLabel.c_str());
1719 
1720  if(groupL1Passed) hist_1d->Fill(groupL1BinNumber-1);//binNumber1 = 0 = first filter
1721  */
1722  } // end for mi
1723 
1724 }
1725 
1727 {
1728 
1729  //pathsSummaryFolder_ = TString("HLT/FourVector/PathsSummary/");
1730  //dbe_->setCurrentFolder(pathsSummaryFolder_.c_str());
1732 
1733  // setup HLT bx plot
1734  unsigned int npaths = hltPathsDiagonal_.size();
1735 
1736  ME_HLT_BX = dbe_->book2D("HLT_bx",
1737  "HLT counts vs Event bx",
1738  Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
1739  /*
1740  ME_HLT_CUSTOM_BX = dbe_->book2D("HLT_Custom_bx",
1741  "HLT counts vs Event bx",
1742  Nbx_+1, -0.5, Nbx_+1-0.5, npaths, -0.5, npaths-0.5);
1743  */
1744  ME_HLT_BX->setAxisTitle("Bunch Crossing");
1745  //ME_HLT_CUSTOM_BX->setAxisTitle("Bunch Crossing");
1746 
1747 
1748  // Set up bin labels on Y axis continuing to cover all npaths
1749  for(unsigned int i = 0; i < npaths; i++){
1750 
1751  if (ME_HLT_BX)
1752  ME_HLT_BX->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
1753  //ME_HLT_CUSTOM_BX->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
1754 
1755  }
1756 
1757 
1758 }
1759 
1761 {
1762 
1763  unsigned int npaths = hltPathsDiagonal_.size();
1764 
1765  //pathsSummaryHLTPathsPerLSFolder_ = TString("HLT/FourVector/PathsSummary/HLT LS/");
1766  //dbe_->setCurrentFolder(pathsSummaryHLTPathsPerLSFolder_.c_str());
1768 
1769  ME_HLTAll_LS = dbe_->book2D("All_count_LS",
1770  "All paths per LS ",
1771  nLS_, 0, nLS_, npaths+1, -0.5, npaths+1-0.5);
1772  ME_HLTAll_LS->setAxisTitle("Luminosity Section");
1773 
1774  // Set up bin labels on Y axis continuing to cover all npaths
1775  for(unsigned int i = 0; i < npaths; i++){
1776  if (ME_HLTAll_LS)
1777  ME_HLTAll_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, (hltPathsDiagonal_[i]).getPath().c_str());
1778 
1779  }
1780 
1781  unsigned int i = npaths;
1782 
1783  if (ME_HLTAll_LS)
1784  ME_HLTAll_LS->getTH2F()->GetYaxis()->SetBinLabel(i+1, "HLT_Any");
1785 
1786 
1787 }
1788 
1789 
1791 
1792  //int lumi = int(lumiSeg.id().luminosityBlock());
1793  //if(lumi < 74 || lumi > 77) fLumiFlag = false;
1794  //else fLumiFlag = true;
1795 
1796 }
1797 
1799 {
1800 
1801  int lumi = int(lumiSeg.id().luminosityBlock());
1802  LogTrace("FourVectorHLTOffline") << " end lumiSection number " << lumi << endl;
1803 
1804  // countHLTPathHitsEndLumiBlock(lumi);
1807 
1808  // countHLTGroupBXHitsEndLumiBlock(lumi);
1809 
1810 }
1811 
1812 // bjk: we have commented this out
1814 {
1815 
1816  LogTrace("FourVectorHLTOffline") << " countHLTGroupBXHitsEndLumiBlock() lumiSection number " << lumi << endl;
1817 
1818  TH2F * hist_2d_bx = ME_HLT_BX->getTH2F();
1819 
1820  for (std::vector<std::pair<std::string, vector<int> > >::iterator ip = fPathBxTempCountPair.begin(); ip != fPathBxTempCountPair.end(); ++ip) {
1821 
1822  // get the path and its previous count
1823  std::string pathname = ip->first;
1824  vector<int> prevCount = ip->second;
1825 
1826  // vector of 5 zeros
1827  vector<int> currCount (5,0);
1828  vector<int> diffCount (5,0);
1829 
1830  // get the current count of path up to now
1831  int pathBin = hist_2d_bx->GetYaxis()->FindBin(pathname.c_str());
1832 
1833  if(pathBin > hist_2d_bx->GetNbinsY()) {
1834 
1835  LogTrace("FourVectorHLTOffline") << " Cannot find the bin for path " << pathname << endl;
1836  continue;
1837 
1838  }
1839 
1840  for (unsigned int b =0;b<currCount.size();b++) {
1841 
1842  int bxOffset = b-2;
1843  int bunch = referenceBX_+bxOffset;
1844  if(bunch < 1) bunch += Nbx_ ;
1845  int bxBin = bunch +1; // add one to get the right bin
1846 
1847 
1848  currCount[b] = int(hist_2d_bx->GetBinContent(bxBin, pathBin)); // add one to get the right bin
1849 
1850  LogTrace("FourVectorHLTOffline") << "currCount = " << currCount[b] << endl;
1851 
1852  // count due to prev lumi sec is a difference bw current and previous
1853  diffCount[b] = currCount[b] - prevCount[b];
1854 
1855  LogTrace("FourVectorHLTOffline") << " lumi = " << lumi << " path " << pathname << "bxOffset = " << bxOffset << " count = " << diffCount[b] << endl;
1856 
1857  } // end for bx b
1858 
1859  // set the counter in the pair to current count
1860  ip->second = currCount;
1861 
1863  // fill the 2D Group paths' BX count per LS, using currCount
1865  LogTrace("FourVectorHLTOffline") << "Find " << pathname << endl;
1866 
1867  //check if the path is in this group
1868  for (unsigned int j=0;j<fGroupNamePathsPair.size();j++) {
1869 
1870  bool isMember = false;
1871 
1872  LogTrace("FourVectorHLTOffline") << " ---- Group " << fGroupNamePathsPair[j].first << endl;
1873 
1874  // decide if pathname is member of this group
1875  for (unsigned int k = 0; k<(fGroupNamePathsPair[j].second).size();k++) {
1876 
1877  LogTrace("FourVectorHLTOffline") << " comparing to " << fGroupNamePathsPair[j].second[k] << endl;
1878 
1879  if(fGroupNamePathsPair[j].second[k] == pathname) {
1880 
1881  isMember = true;
1882  break;
1883 
1884  }
1885 
1886  } // end for k
1887 
1888  if(!isMember) {
1889 
1890  LogTrace("FourVectorHLTOffline") << "Could not find a group to which the path belongs, path = " << pathname << " group = " << fGroupNamePathsPair[j].first << endl;
1891  continue;
1892 
1893  }
1894 
1895  MonitorElement* ME_2d = v_ME_Total_BX[j];
1896 
1897  if (! ME_2d) {
1898 
1899  LogDebug("FourVectorHLTOffline") << " cannot find ME_2d for group " << fGroupNamePathsPair[j].first << endl;
1900  continue;
1901 
1902  }
1903 
1904  vector<int> updatedLumiCount(5,0);
1905 
1906  float entireBXWindowUpdatedLumiCount = 0;
1907 
1908  TH2F* hist_All = ME_2d->getTH2F();
1909 
1910  for (unsigned int b = 0; b<diffCount.size();b++) {
1911 
1912  // find the bin
1913  int binNumber = b+1; // add one to get right bin
1914 
1915  // update the bin content (must do that since events don't ncessarily come in the order
1916  int currentLumiCount = int(hist_All->GetBinContent(lumi+1,binNumber));
1917  updatedLumiCount[b] = currentLumiCount + diffCount[b];
1918  hist_All->SetBinContent(lumi+1,binNumber,updatedLumiCount[b]);
1919 
1920  entireBXWindowUpdatedLumiCount += updatedLumiCount[b];
1921 
1922  } // end for bx b
1923 
1924  MonitorElement* ME_2d_Norm = v_ME_Total_BX_Norm[j];
1925 
1926  if (! ME_2d_Norm) {
1927 
1928  LogDebug("FourVectorHLTOffline") << " cannot find ME_2d_Norm for group " << fGroupNamePathsPair[j].first << endl;
1929  continue;
1930 
1931  }
1932 
1933  TH2F* hist_All_Norm = ME_2d_Norm->getTH2F();
1934 
1935  for (unsigned int b = 0; b<diffCount.size();b++) {
1936 
1937  // find the bin
1938  int binNumber = b+1; // add one to get right bin
1939 
1940  // update the bin content but normalized to the whole columb (BX windw +/- 2)
1941  if(entireBXWindowUpdatedLumiCount != 0)
1942  hist_All_Norm->SetBinContent(lumi+1,binNumber,float(updatedLumiCount[b])/entireBXWindowUpdatedLumiCount);
1943 
1944  } // end for bx b
1945 
1946  } // end for group j
1947 
1948  } // end for ip
1949 
1950 }
1951 
1953 {
1954 
1955  LogTrace("FourVectorHLTOffline") << " countHLTGroupL1HitsEndLumiBlock() lumiSection number " << lumi << endl;
1956 
1957  for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
1958 
1959  // get the count of path up to now
1960  string fullPathToME = "HLT/FourVector/PathsSummary/HLT_" + fGroupNamePathsPair[i].first+ "_Pass_Any";
1961  MonitorElement* ME_1d = dbe_->get(fullPathToME);
1962 
1963  if(! ME_1d) {
1964 
1965  LogTrace("FourVectorHLTOffline") << " could not find 1d matrix " << fullPathToME << endl;
1966 
1967  continue;
1968 
1969  }
1970 
1971  LogTrace("FourVectorHLTOffline") << " Looking in histogram " << fullPathToME << endl;
1972 
1973  TH1F * hist_1d = ME_1d->getTH1F();
1974 
1975  for (std::vector<std::pair<std::string, float> >::iterator ip = fGroupL1TempCountPair.begin(); ip != fGroupL1TempCountPair.end(); ++ip) {
1976 
1977  // get the path and its previous count
1978  string pathname = ip->first;
1979  float prevCount = ip->second;
1980 
1981  string binLabel = "HLT_"+pathname+"_L1_Any";
1982 
1983  LogTrace("FourVectorHLTOffline") << " Looking for binLabel = " << binLabel << endl;
1984  // get the current count of path up to now
1985  int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
1986 
1987  LogTrace("FourVectorHLTOffline") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << endl;
1988  if(pathBin == -1) {
1989 
1990  LogTrace("FourVectorHLTOffline") << " Cannot find the bin for path " << pathname << endl;
1991  continue;
1992 
1993  }
1994 
1995  float currCount = hist_1d->GetBinContent(pathBin)/LSsize_;
1996 
1997  // count due to prev lumi sec is a difference bw current and previous
1998  float diffCount = currCount - prevCount;
1999 
2000  LogTrace("FourVectorHLTOffline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << endl;
2001 
2002  // set the counter in the pair to current count
2003  ip->second = currCount;
2004 
2005 
2007  // fill the 1D individual path count per LS
2009  string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_L1_Total_LS";
2010  MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
2011  if ( ME_1d) {
2012 
2013  // update the bin content (must do that since events don't ncessarily come in the order
2014  float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
2015  float updatedLumiCount = currentLumiCount + diffCount;
2016  ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
2017  }
2018  else {
2019 
2020  LogDebug("FourVectorHLTOffline") << " cannot find ME " << fullPathToME_count << endl;
2021 
2022  }
2023 
2024  } // end for ip
2025 
2026  } // end for i
2027 
2028 }
2029 
2030 
2032 {
2033 
2034  LogTrace("FourVectorHLTOffline") << " countHLTGroupHitsEndLumiBlock() lumiSection number " << lumi << endl;
2035  for(unsigned int i=0; i<fGroupNamePathsPair.size(); i++){
2036 
2037  // get the count of path up to now
2038  string fullPathToME = "HLT/FourVector/PathsSummary/HLT_" + fGroupNamePathsPair[i].first + "_Pass_Any";
2039  MonitorElement* ME_1d = dbe_->get(fullPathToME);
2040 
2041  if(! ME_1d) {
2042 
2043  LogTrace("FourVectorHLTOffline") << " could not find 1d matrix " << fullPathToME << endl;
2044 
2045  continue;
2046 
2047  }
2048 
2049  LogTrace("FourVectorHLTOffline") << " Looking in histogram " << fullPathToME << endl;
2050 
2051  TH1F * hist_1d = ME_1d->getTH1F();
2052 
2053  for (std::vector<std::pair<std::string, float> >::iterator ip = fGroupTempCountPair.begin(); ip != fGroupTempCountPair.end(); ++ip) {
2054 
2055  // get the path and its previous count
2056  string pathname = ip->first;
2057  float prevCount = ip->second;
2058 
2059  string binLabel = "HLT_"+pathname+"_Any";
2060 
2061  LogTrace("FourVectorHLTOffline") << " Looking for binLabel = " << binLabel << endl;
2062  // get the current count of path up to now
2063  int pathBin = hist_1d->GetXaxis()->FindBin(binLabel.c_str());
2064 
2065  LogTrace("FourVectorHLTOffline") << " pathBin = " << pathBin << " out of histogram total number of bins " << hist_1d->GetNbinsX() << endl;
2066  if(pathBin == -1) {
2067 
2068  LogTrace("FourVectorHLTOffline") << " Cannot find the bin for path " << pathname << endl;
2069  continue;
2070 
2071  }
2072 
2073  float currCount = hist_1d->GetBinContent(pathBin)/LSsize_;
2074 
2075  // count due to prev lumi sec is a difference bw current and previous
2076  float diffCount = currCount - prevCount;
2077 
2078  LogTrace("FourVectorHLTOffline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << endl;
2079 
2080  // set the counter in the pair to current count
2081  ip->second = currCount;
2082 
2083 
2085  // fill the 1D individual path count per LS
2087  string fullPathToME_count = pathsSummaryHLTPathsPerLSFolder_ +"HLT_" + pathname + "_Total_LS";
2088  MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
2089  if ( ME_1d) {
2090 
2091  // update the bin content (must do that since events don't ncessarily come in the order
2092  float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
2093  float updatedLumiCount = currentLumiCount + diffCount;
2094  ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
2095 
2096  }
2097  else {
2098 
2099  LogDebug("FourVectorHLTOffline") << " cannot find ME " << fullPathToME_count << endl;
2100 
2101  }
2102 
2103  } // end for ip
2104 
2105  } // end for i
2106 
2107 }
2108 
2109 
2111 {
2112 
2113  LogTrace("FourVectorHLTOffline") << " countHLTPathHitsEndLumiBlock() lumiSection number " << lumi << endl;
2114  // get the count of path up to now
2115  string fullPathToME = "HLT/FourVector/PathsSummary/HLT_All_PassPass";
2116  MonitorElement* ME_2d = dbe_->get(fullPathToME);
2117 
2118  if(! ME_2d) {
2119 
2120  LogTrace("FourVectorHLTOffline") << " could not fine 2d matrix " << fullPathToME << endl;
2121 
2122  return;
2123 
2124  }
2125 
2126  TH2F * hist_2d = ME_2d->getTH2F();
2127 
2128  for (std::vector<std::pair<std::string, float> >::iterator ip = fPathTempCountPair.begin(); ip != fPathTempCountPair.end(); ++ip) {
2129 
2130  // get the path and its previous count
2131  std::string pathname = ip->first;
2132  float prevCount = ip->second;
2133 
2134  // get the current count of path up to now
2135  float pathBin = hist_2d->GetXaxis()->FindBin(pathname.c_str());
2136 
2137  if(pathBin > hist_2d->GetNbinsX()) {
2138 
2139  LogTrace("FourVectorHLTOffline") << " Cannot find the bin for path " << pathname << endl;
2140  continue;
2141 
2142  }
2143 
2144  float currCount = hist_2d->GetBinContent(pathBin, pathBin)/LSsize_;
2145 
2146  // count due to prev lumi sec is a difference bw current and previous
2147  float diffCount = currCount - prevCount;
2148 
2149  LogTrace("FourVectorHLTOffline") << " lumi = " << lumi << " path " << pathname << " count " << diffCount << endl;
2150 
2151  // set the counter in the pair to current count
2152  ip->second = currCount;
2153 
2155  // fill the 2D All paths' count per LS
2157  if ( ME_HLTAll_LS) {
2158 
2159  TH2F* hist_All = ME_HLTAll_LS->getTH2F();
2160 
2161  // find the bin
2162  int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
2163 
2164  // update the bin content (must do that since events don't ncessarily come in the order
2165  float currentLumiCount = hist_All->GetBinContent(lumi+1,pathBinNumber);
2166  float updatedLumiCount = currentLumiCount + diffCount;
2167  hist_All->SetBinContent(lumi+1,pathBinNumber,updatedLumiCount);
2168 
2169  }
2170  else {
2171 
2172  LogDebug("FourVectorHLTOffline") << " cannot find ME_HLTAll_LS" << endl;
2173 
2174  }
2175 
2176 // for (unsigned int i=0 ; i< v_ME_HLTAll_LS.size(); i++) {
2177 
2178 // MonitorElement* tempME = v_ME_HLTAll_LS[i];
2179 
2180 // if (tempME && tempME->getName().find(pathname) != std::string::npos) {
2181 
2182 // TH1F* hist_All = tempME->getTH1F();
2183 
2184 // // // find the bin
2185 // // int pathBinNumber = hist_All->GetYaxis()->FindBin(pathname.c_str());
2186 // // // update the bin content (must do that since events don't ncessarily come in the order
2187 // float currentLumiCount = hist_All->GetBinContent(lumi+1);
2188 // float updatedLumiCount = currentLumiCount + diffCount;
2189 // hist_All->SetBinContent(lumi+1,updatedLumiCount);
2190 
2191 // }
2192 // else {
2193 
2194 // LogDebug("FourVectorHLTOffline") << " cannot find tempME " << endl;
2195 
2196 // }
2197 
2198 // }
2199 
2200 
2201  // bjk here
2202 // ///////////////////////////////////////////
2203 // // fill the 1D individual path count per LS
2204 // ///////////////////////////////////////////
2205 // string fullPathToME_count = pathsIndividualHLTPathsPerLSFolder_ + pathname + "_count_per_LS";
2206 // MonitorElement* ME_1d = dbe_->get(fullPathToME_count);
2207 // if ( ME_1d) {
2208 
2209 // // update the bin content (must do that since events don't ncessarily come in the order
2210 // float currentLumiCount = ME_1d->getTH1()->GetBinContent(lumi+1);
2211 // float updatedLumiCount = currentLumiCount + diffCount;
2212 // ME_1d->getTH1()->SetBinContent(lumi+1,updatedLumiCount);
2213 
2214 // }
2215 // else {
2216 
2217 // LogDebug("FourVectorHLTOffline") << " cannot find ME " << fullPathToME_count << endl;
2218 
2219 // }
2220 
2221  } // end for ip
2222 
2223 }
2224 
2226 {
2227 
2228  int objectType = 0;
2229 
2230  if (pathname.find("MET") != std::string::npos)
2231  objectType = trigger::TriggerMET;
2232  if (pathname.find("SumET") != std::string::npos || pathname.find("SumEt") != std::string::npos || pathname.find("ETT") != std::string::npos)
2233  objectType = trigger::TriggerTET;
2234  if (pathname.find("HT") != std::string::npos)
2235  objectType = trigger::TriggerTET;
2236  if (pathname.find("Jet") != std::string::npos)
2237  objectType = trigger::TriggerJet;
2238  if (pathname.find("Mu") != std::string::npos)
2239  objectType = trigger::TriggerMuon;
2240  if (pathname.find("Ele") != std::string::npos)
2241  objectType = trigger::TriggerElectron;
2242  if (pathname.find("Photon") != std::string::npos)
2243  objectType = trigger::TriggerPhoton;
2244  if (pathname.find("EG") != std::string::npos)
2245  objectType = trigger::TriggerPhoton;
2246  if (pathname.find("Tau") != std::string::npos)
2247  objectType = trigger::TriggerTau;
2248  if (pathname.find("IsoTrack") != std::string::npos)
2249  objectType = trigger::TriggerTrack;
2250  if (pathname.find("BTag") != std::string::npos)
2251  objectType = trigger::TriggerBJet;
2252 
2253  return objectType;
2254 }
2255 
2257 {
2258 
2259  // find L1 condition for numpath with numpath objecttype
2260  // find PSet for L1 global seed for numpath,
2261  // list module labels for numpath
2262  string l1pathname = "dummy";
2263 
2264  vector<string> numpathmodules = hltConfig_.moduleLabels(pathname);
2265 
2266  for(vector<string>::iterator numpathmodule = numpathmodules.begin();
2267  numpathmodule!= numpathmodules.end(); ++numpathmodule ) {
2268 
2269  if (hltConfig_.moduleType(*numpathmodule) == "HLTLevel1GTSeed") {
2270 
2271  l1pathname = *numpathmodule;
2272  break;
2273 
2274  }
2275 
2276  } // end for
2277 
2278  return l1pathname;
2279 
2280 }
2281 
2282 
2283 bool FourVectorHLTOffline::hasL1Passed(const string& pathname, const edm::TriggerNames & triggerNames)
2284 {
2285 
2286  bool rc = false;
2287  int l1ModuleIndex = 999;
2288  // --------------------
2289  for(PathInfoCollection::iterator v = hltPathsDiagonal_.begin(); v!= hltPathsDiagonal_.end(); ++v ) {
2290 
2291  if(v->getPath() == pathname ) l1ModuleIndex = v->getL1ModuleIndex();
2292 
2293  }
2294 
2295  unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
2296  if(pathByIndex >= fTriggerResults->size() ) return rc; // path is not in the menu
2297 
2298  // get index of the last module that issued the decision
2299  int lastModule = fTriggerResults->index(pathByIndex);
2300 
2301  // if L1 passed, then it must not be the module that
2302  // issued the last decision
2303  rc = (l1ModuleIndex < lastModule);
2304 
2305  return rc;
2306 
2307 }
2308 
2309 bool FourVectorHLTOffline::hasHLTPassed(const string& pathname, const edm::TriggerNames & triggerNames)
2310 {
2311 
2312  bool rc = false;
2313 
2314  unsigned int pathByIndex = triggerNames.triggerIndex(pathname);
2315  if(pathByIndex >= fTriggerResults->size() ) return rc; // path is not in the menu
2316 
2317  rc = fTriggerResults->accept(pathByIndex);
2318 
2319  return rc;
2320 
2321 }
2322 
2324 {
2325  // for every event, first clear vector of selected objects
2326  fSelectedMuons->clear();
2327 
2328  if(muonHandle.isValid()) {
2329 
2330  for( reco::MuonCollection::const_iterator iter = muonHandle->begin(), iend = muonHandle->end(); iter != iend; ++iter )
2331  {
2332 
2335  {
2336  if(isVBTFMuon(*iter)) fSelectedMuons->push_back(*iter);
2337  }
2338  } // end for
2339 
2340  edm::Handle<reco::MuonCollection> localSelMuonsHandle(fSelectedMuons,muonHandle.provenance());
2341  fSelMuonsHandle = localSelMuonsHandle;
2342 
2343  } // end if
2344 
2345 
2346 }
2347 
2349 {
2350 
2351  // for every event, first clear vector of selected objects
2352  fSelectedElectrons->clear();
2353 
2354 
2355 
2356 
2357  if(eleHandle.isValid()) {
2358 
2359  for( reco::GsfElectronCollection::const_iterator iter = eleHandle->begin(), iend = eleHandle->end(); iter != iend; ++iter )
2360  {
2361 
2363  iEvent.getByLabel( recHitsEBTag_, pEBRecHits );
2364 
2366  iEvent.getByLabel( recHitsEETag_, pEERecHits );
2367 
2368  if(pEBRecHits.isValid() && pEERecHits.isValid()) {
2369 
2370  EcalClusterLazyTools lazyTool(iEvent, iSetup, recHitsEBTag_, recHitsEETag_);
2371  const reco::CaloCluster* bc = iter->superCluster()->seed().get(); // get the basic cluster
2372 
2373  float eleMaxOver3x3 = ( lazyTool.eMax(*bc) / lazyTool.e3x3(*bc) );
2374 
2375  if(eleMaxOver3x3 > eleMaxOver3x3_) continue;
2376 
2377  }
2378 
2379  // Only ecalDriven electrons
2380  if(! iter->ecalDriven() ) continue;
2381 
2382 
2383  // Barrel
2384  if(iter->isEB()) {
2385 
2386  if (
2387  iter->dr03TkSumPt() < dr03TkSumPtEB_ &&
2388  iter->dr04EcalRecHitSumEt() < dr04EcalRecHitSumEtEB_ &&
2389  iter->dr04HcalTowerSumEt() < dr04HcalTowerSumEtEB_ &&
2390  iter->hadronicOverEm() < hadronicOverEmEB_ &&
2391  fabs(iter->deltaPhiSuperClusterTrackAtVtx()) < deltaPhiSuperClusterTrackAtVtxEB_ &&
2392  fabs(iter->deltaEtaSuperClusterTrackAtVtx()) < deltaEtaSuperClusterTrackAtVtxEB_ &&
2393  iter->sigmaIetaIeta() < sigmaIetaIetaEB_ &&
2394  //spikes
2395  iter->sigmaIetaIeta() > sigmaIetaIetaSpikesEB_
2396  ) {
2397 
2398  fSelectedElectrons->push_back(*iter);
2399 
2400  }
2401 
2402  } // end if
2403 
2404  // EndCap
2405  else if(iter->isEE()) {
2406  if (
2407  iter->dr03TkSumPt() < dr03TkSumPtEC_ &&
2408  iter->dr04EcalRecHitSumEt() < dr04EcalRecHitSumEtEC_ &&
2409  iter->dr04HcalTowerSumEt() < dr04HcalTowerSumEtEC_ &&
2410  iter->hadronicOverEm() < hadronicOverEmEC_ &&
2411  fabs(iter->deltaPhiSuperClusterTrackAtVtx()) < deltaPhiSuperClusterTrackAtVtxEC_ &&
2412  fabs(iter->deltaEtaSuperClusterTrackAtVtx()) < deltaEtaSuperClusterTrackAtVtxEC_ &&
2413  iter->sigmaIetaIeta() < sigmaIetaIetaEC_ &&
2414  //spikes
2415  iter->sigmaIetaIeta() > sigmaIetaIetaSpikesEC_
2416  ) {
2417 
2418  fSelectedElectrons->push_back(*iter);
2419 
2420  }
2421 
2422  } // end else if
2423 
2424 
2425  } // end for
2426 
2427  edm::Handle<reco::GsfElectronCollection> localSelElectronsHandle(fSelectedElectrons,eleHandle.provenance());
2428  fSelElectronsHandle = localSelElectronsHandle;
2429 
2430  } // end if
2431 
2432 
2433 }
2434 
2436 {
2437  // for every event, first clear vector of selected objects
2438  fSelectedPhotons->clear();
2439 
2440  if(phoHandle.isValid()) {
2441 
2442  for( reco::PhotonCollection::const_iterator iter = phoHandle->begin(), iend = phoHandle->end(); iter != iend; ++iter )
2443  {
2444 
2445  if(
2446 
2447  //spikes
2448  iter->sigmaIetaIeta() > 0.002 &&
2449  iter->maxEnergyXtal() / iter->e3x3() < 0.9
2450 
2451  ) {
2452 
2453  fSelectedPhotons->push_back(*iter);
2454 
2455  } // end if
2456 
2457  } // end for
2458 
2459  edm::Handle<reco::PhotonCollection> localSelPhotonsHandle(fSelectedPhotons,phoHandle.provenance());
2460  fSelPhotonsHandle = localSelPhotonsHandle;
2461 
2462  } // end if
2463 
2464 
2465 }
2466 
2468 {
2469  // for every event, first clear vector of selected objects
2470  fSelectedJets->clear();
2471 
2472  if(jetHandle.isValid()) {
2473 
2474  for( reco::CaloJetCollection::const_iterator iter = jetHandle->begin(), iend = jetHandle->end(); iter != iend; ++iter )
2475  {
2476 
2477  jetID->calculate(iEvent, *iter);
2478  if (iter->emEnergyFraction() > emEnergyFractionJet_ &&
2479  jetID->fHPD() < fHPDJet_ &&
2480  iter->n90() >= n90Jet_
2481  ){
2482 
2483  fSelectedJets->push_back(*iter);
2484 
2485  }
2486 
2487  } // end for
2488 
2489  edm::Handle<reco::CaloJetCollection> localSelJetsHandle(fSelectedJets,jetHandle.provenance());
2490  fSelJetsHandle = localSelJetsHandle;
2491 
2492  } // end if
2493 
2494 
2495 }
2496 
2498 {
2499  // for every event, first clear vector of selected objects
2500  fSelectedMet->clear();
2501 
2502  if(metHandle.isValid()) {
2503 
2504  for( reco::CaloMETCollection::const_iterator iter = metHandle->begin(), iend = metHandle->end(); iter != iend; ++iter )
2505  {
2506 
2507  fSelectedMet->push_back(*iter);
2508 
2509  } // end for
2510 
2511  edm::Handle<reco::CaloMETCollection> localSelMetHandle(fSelectedMet,metHandle.provenance());
2512  fSelMetHandle = localSelMetHandle;
2513 
2514  } // end if
2515 
2516 
2517 }
2518 
2519 
2521 {
2522  // for every event, first clear vector of selected objects
2523  fSelectedTaus->clear();
2524 
2525  //first read the tau collection
2527  iEvent.getByLabel("hpsPFTauProducer",tauHandle);
2528 
2529  //Now access a discriminator and see if it passed the tag
2531  iEvent.getByLabel(tauDscrmtrLabel1_,dscrmt1H);
2533  iEvent.getByLabel(tauDscrmtrLabel2_,dscrmt2H);
2535  iEvent.getByLabel(tauDscrmtrLabel3_,dscrmt3H);
2536 
2537  if(tauHandle.isValid() && dscrmt1H.isValid() && dscrmt2H.isValid() && dscrmt3H.isValid()) {
2538 
2539  for(unsigned int i=0;i<tauHandle->size();++i) {
2540 
2541  //create a ref to the PF Tau
2542  reco::PFTauRef pfTauRef(tauHandle,i);
2543 
2544  float outputDiscmnt1 = (*dscrmt1H)[pfTauRef]; // this should be >0.5 to pass
2545  float outputDiscmnt2 = (*dscrmt2H)[pfTauRef]; // this should be >0.5 to pass
2546  float outputDiscmnt3 = (*dscrmt3H)[pfTauRef]; // this should be >0.5 to pass
2547 
2548  if(outputDiscmnt1>0.5 && outputDiscmnt2>0.5 && outputDiscmnt3 >0.5) {
2549 
2550  fSelectedTaus->push_back((*tauHandle)[i]);
2551 
2552  }
2553 
2554  } // end for
2555 
2556 
2557  edm::Handle<reco::PFTauCollection> localSelTauHandle(fSelectedTaus,tauHandle.provenance());
2558  fSelTausHandle = localSelTauHandle;
2559 
2560  } // end if
2561 
2562 }
2563 
2564 
2566 {
2567 
2569  //cout << "----------------------------------------------" << endl;
2570  //cout << pathname << endl;
2571 
2572  //remove "L1" substr
2573  if(pathname.find("L1") != std::string::npos) pathname.replace(pathname.find("L1"),2,"");
2574  //remove "L2" substr
2575  if(pathname.find("L2") != std::string::npos) pathname.replace(pathname.find("L2"),2,"");
2576  //remove "8E29" substr
2577  if(pathname.find("8E29") != std::string::npos) pathname.replace(pathname.find("8E29"),4,"");
2578 
2579  int digitLocation=0;
2580  for (unsigned int i=0; i < pathname.length(); i++)
2581  {
2582  if (isdigit(pathname.at(i))) {
2583 
2584  digitLocation = i;
2585  break;
2586 
2587  }
2588  }
2589 
2590  // get the string from the location of the first digit to the end
2591  string hltThresholdString = pathname.substr(digitLocation);
2592 
2593  int hltThreshold = 0;
2594 
2595  // get intiger at the begining of the string
2596  sscanf (hltThresholdString.c_str(),"%d%*s",&hltThreshold);
2597  //printf ("%s -> %s -> %d\n",pathname.c_str(), hltThresholdString.c_str(), hltThreshold);
2598 
2599  return hltThreshold;
2600 
2601 }
2602 
2604 {
2605 
2606  reco::TrackRef gm = muon.globalTrack();
2607  reco::TrackRef tk = muon.innerTrack();
2608 
2609  // Quality cuts
2610  // ------------
2611 
2612  // Must have BeamSpot for the 1st qualityCut
2613  if(!fBeamSpotHandle.isValid()) return 0;
2614 
2615  double dxy = gm->dxy(fBeamSpotHandle->position());
2616  double normalizedChi2 = gm->normalizedChi2();
2617  int trackerHits = tk->hitPattern().numberOfValidTrackerHits();
2618  int pixelHits = tk->hitPattern().numberOfValidPixelHits();
2619  int muonHits = gm->hitPattern().numberOfValidMuonHits();
2620  int nMatches = muon.numberOfMatches();
2621 
2622  if (fabs(dxy)>dxyCut_) {return 0;}
2623  // if(plotHistograms_){ h1_["hNormChi2"]->Fill(normalizedChi2);}
2624  if (normalizedChi2>normalizedChi2Cut_) {return 0;}
2625  // if(plotHistograms_){ h1_["hNHits"]->Fill(trackerHits);}
2626  if (trackerHits<trackerHitsCut_) {return 0;}
2627  // if(plotHistograms_){ h1_["hNMuonHits"]->Fill(muonHits);}
2628  if (pixelHits<pixelHitsCut_) {return 0;}
2629  // if(plotHistograms_){ h1_["hNPixelHits"]->Fill(pixelHits);}
2630  if (muonHits<muonHitsCut_) {return 0;}
2631  // if(plotHistograms_){ h1_["hTracker"]->Fill(mu.isTrackerMuon());}
2632  if (!muon.isTrackerMuon()) {return 0;}
2633  // if(plotHistograms_){ h1_["hNMatches"]->Fill(nMatches);}
2634  if (nMatches<nMatchesCut_) {return 0;}
2635 
2636  return true;
2637 
2638 }
2639 
2641  for (int ii = 100; ii >= 0; ii--) {
2642  string ver = "_v";
2643  string version ="";
2644  stringstream ss;
2645  ss << ver << ii;
2646  ss >> version;
2647 
2648  size_t pos = histVersion.find(version);
2649  if (pos != std::string::npos)
2650  histVersion.erase(pos,version.size());
2651 
2652  }
2653 
2654  return histVersion;
2655  }
2656 
#define LogDebug(id)
unsigned int size() const
number of trigger paths in trigger table
void setupHltMatrix(const std::string &label, std::vector< std::string > &paths)
reco::helper::JetIDHelper * jetID
LuminosityBlockID id() const
const double Pi
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
bool hasL1Passed(const std::string &pathname, const edm::TriggerNames &triggerNames)
virtual void fillL1Match(FourVectorHLTOffline *fv)=0
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:207
void selectPhotons(const edm::Handle< reco::PhotonCollection > &phoHandle)
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
RunID const & id() const
Definition: RunBase.h:41
const std::string moduleType(const std::string &module) const
C++ class name of module.
void countHLTPathHitsEndLumiBlock(const int &lumi)
virtual void monitorOnline(const int hltIndex, const int l1Index, FourVectorHLTOnline *fv)=0
void countHLTGroupBXHitsEndLumiBlock(const int &lumi)
edm::Handle< reco::GsfElectronCollection > fSelElectronsHandle
edm::Handle< reco::CaloMETCollection > fSelMetHandle
const std::string & triggerName(unsigned int triggerIndex) const
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
reco::CaloMETCollection * fSelectedMet
PathInfoCollection hltPaths_
virtual TrackRef innerTrack() const
Definition: Muon.h:49
enum start value shifted to 81 so as to avoid clashes with PDG codes
reco::PFTauCollection * fSelectedTaus
void endRun(const edm::Run &run, const edm::EventSetup &c)
EndRun.
tuple lumi
Definition: fjr2json.py:35
std::string pathsSummaryHLTPathsPerLSFolder_
bool isTrackerMuon() const
Definition: Muon.h:220
int getTriggerTypeParsePathName(const std::string &pathname)
void fillHltMatrix(const edm::TriggerNames &triggerNames)
std::vector< std::pair< std::string, std::vector< int > > > fPathBxTempCountPair
std::vector< std::string > specialPaths_
double fHPD() const
Definition: JetIDHelper.h:33
FourVectorHLTOffline(const edm::ParameterSet &)
void cleanDRMatchSet(mmset &tempSet)
Clean DR Match Set.
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)
float e3x3(const reco::BasicCluster &cluster)
std::multimap< float, int > fimmap
const std::string moduleEDMType(const std::string &module) const
C++ base class name of module.
float eMax(const reco::BasicCluster &cluster)
edm::Handle< reco::MuonCollection > fSelMuonsHandle
#define NULL
Definition: scimark2.h:8
edm::Handle< reco::BeamSpot > fBeamSpotHandle
int ii
Definition: cuy.py:588
virtual void monitorOffline(void)=0
edm::Handle< reco::PFTauCollection > fSelTausHandle
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::vector< TPRegexp > filters
Definition: eve_filter.cc:25
edm::InputTag triggerSummaryLabel_
void countHLTGroupL1HitsEndLumiBlock(const int &lumi)
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
void setRecoB(edm::Handle< reco::JetTagCollection > offCollB)
PathInfoCollection hltPathsDiagonal_
std::vector< std::pair< std::string, std::string > > custompathnamepairs_
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
std::set< fimmap, std::less< fimmap > > mmset
edm::Handle< reco::PhotonCollection > fSelPhotonsHandle
reco::GsfElectronCollection * fSelectedElectrons
U second(std::pair< T, U > const &p)
Definition: ME.h:11
const std::string getL1ConditionModuleName(const std::string &pathname)
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
void setLimits(float etaMax, float etMin, float drMatch)
edm::Handle< edm::TriggerResults > fTriggerResults
void selectJets(const edm::Event &iEvent, const edm::Handle< reco::CaloJetCollection > &jetHandle)
std::vector< MonitorElement * > v_ME_Total_BX
std::vector< std::pair< std::string, float > > fPathTempCountPair
int j
Definition: DBlmapReader.cc:9
TH1 * getTH1(void) const
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
HLTConfigProvider hltConfig_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void setVerbose(unsigned level)
Definition: DQMStore.cc:398
reco::PhotonCollection * fSelectedPhotons
std::vector< MonitorElement * > v_ME_Total_BX_Norm
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
void selectTaus(const edm::Event &iEvent)
bool first
Definition: L1TdeRCT.cc:94
bool isValid() const
Definition: HandleBase.h:76
bool isVBTFMuon(const reco::Muon &muon)
MonitorElement * ME_HLT_BX
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
#define LogTrace(id)
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
void selectElectrons(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::Handle< reco::GsfElectronCollection > &eleHandle)
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
Definition: Muon.cc:60
int k[5][pyjets_maxn]
reco::MuonCollection * fSelectedMuons
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
edm::InputTag triggerResultsLabel_
const std::vector< std::string > & datasetContent(unsigned int dataset) const
names of trigger paths in dataset with index i
virtual void clearSets(void)=0
DetId seed() const
return DetId of seed
Definition: CaloCluster.h:199
void beginRun(const edm::Run &run, const edm::EventSetup &c)
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
MonitorElement * ME_HLT_CUSTOM_BX
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
edm::Handle< reco::CaloJetCollection > fSelJetsHandle
TH1F * getTH1F(void) const
double b
Definition: hdecay.h:120
LuminosityBlockNumber_t luminosityBlock() const
std::vector< Photon > PhotonCollection
collectin of Photon objects
Definition: PhotonFwd.h:9
std::vector< std::pair< std::string, float > > fGroupTempCountPair
std::vector< std::pair< std::string, std::vector< std::string > > > fGroupNamePathsPair
std::string removeVersions(std::string histVersion)
std::string const & label() const
Definition: InputTag.h:42
virtual void setPath(FourVectorHLTOnline::PathInfoCollection::iterator v)=0
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
std::string pathsSummaryHLTCorrelationsFolder_
std::string pathsSummaryFilterCountsFolder_
void selectMet(const edm::Handle< reco::CaloMETCollection > &metHandle)
MonitorElement * ME_HLTAll_LS
std::vector< std::string > fGroupName
void countHLTGroupHitsEndLumiBlock(const int &lumi)
virtual void monitorL1(const int l1Index, FourVectorHLTOnline *fv)=0
std::vector< std::pair< std::string, float > > fGroupL1TempCountPair
reco::CaloJetCollection * fSelectedJets
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
int getHltThresholdFromName(const std::string &pathname)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
edm::Handle< trigger::TriggerEvent > fTriggerObj
void setReco(edm::Handle< T > offColl)
std::string const & instance() const
Definition: InputTag.h:43
MonitorElement * scalersSelect
tuple size
Write out results.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void calculate(const edm::Event &event, const reco::CaloJet &jet, const int iDbg=0)
Definition: JetIDHelper.cc:86
Definition: Run.h:36
const std::vector< std::string > & datasetNames() const
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
Provenance const * provenance() const
Definition: HandleBase.h:84
void selectMuons(const edm::Handle< reco::MuonCollection > &muonHandle)
bool hasHLTPassed(const std::string &pathname, const edm::TriggerNames &triggerNames)
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:55