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