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