Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-11 04:32:53

0001 /*
0002   JetMETHLTOffline DQM code
0003   Migrated to use DQMEDAnalyzer by: Jyothsna Rani Komaragiri, Oct 2014
0004 */
0005 
0006 #include "DQMOffline/Trigger/interface/JetMETHLTOfflineSource.h"
0007 
0008 #include "FWCore/Common/interface/TriggerNames.h"
0009 #include "FWCore/Framework/interface/Run.h"
0010 #include "FWCore/Framework/interface/MakerMacros.h"
0011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0013 
0014 #include "DataFormats/Common/interface/Handle.h"
0015 #include "DataFormats/Common/interface/TriggerResults.h"
0016 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
0017 #include "DataFormats/HLTReco/interface/TriggerObject.h"
0018 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
0019 #include "DataFormats/Math/interface/deltaR.h"
0020 
0021 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0022 
0023 #include "DQMServices/Core/interface/DQMStore.h"
0024 
0025 #include "TMath.h"
0026 #include "TH1F.h"
0027 #include "TH2F.h"
0028 #include "TProfile.h"
0029 #include "TPRegexp.h"
0030 
0031 #include <cmath>
0032 
0033 using namespace edm;
0034 using namespace reco;
0035 using namespace std;
0036 using namespace trigger;
0037 
0038 JetMETHLTOfflineSource::JetMETHLTOfflineSource(const edm::ParameterSet& iConfig) : isSetup_(false) {
0039   LogDebug("JetMETHLTOfflineSource") << "constructor....";
0040 
0041   //
0042   dirname_ = iConfig.getUntrackedParameter("dirname", std::string("HLT/JetMET/"));
0043   processname_ = iConfig.getParameter<std::string>("processname");
0044   triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
0045   triggerResultsLabel_ = iConfig.getParameter<edm::InputTag>("triggerResultsLabel");
0046   triggerSummaryToken = consumes<trigger::TriggerEvent>(triggerSummaryLabel_);
0047   triggerResultsToken = consumes<edm::TriggerResults>(triggerResultsLabel_);
0048   triggerSummaryFUToken = consumes<trigger::TriggerEvent>(
0049       edm::InputTag(triggerSummaryLabel_.label(), triggerSummaryLabel_.instance(), std::string("FU")));
0050   triggerResultsFUToken = consumes<edm::TriggerResults>(
0051       edm::InputTag(triggerResultsLabel_.label(), triggerResultsLabel_.instance(), std::string("FU")));
0052   //
0053   verbose_ = iConfig.getUntrackedParameter<bool>("verbose", false);
0054   runStandalone_ = iConfig.getUntrackedParameter<bool>("runStandalone", false);
0055   //
0056   plotAll_ = iConfig.getUntrackedParameter<bool>("plotAll", true);
0057   plotEff_ = iConfig.getUntrackedParameter<bool>("plotEff", true);
0058   nameForEff_ = iConfig.getUntrackedParameter<bool>("nameForEff", true);
0059   MuonTrigPaths_ = iConfig.getUntrackedParameter<vector<std::string> >("pathnameMuon");
0060   MBTrigPaths_ = iConfig.getUntrackedParameter<vector<std::string> >("pathnameMB");
0061   //CaloJet, CaloMET
0062   caloJetsToken = consumes<reco::CaloJetCollection>(iConfig.getParameter<edm::InputTag>("CaloJetCollectionLabel"));
0063   caloMetToken = consumes<reco::CaloMETCollection>(iConfig.getParameter<edm::InputTag>("CaloMETCollectionLabel"));
0064   //PFJet, PFMET
0065   pfJetsToken = consumes<reco::PFJetCollection>(iConfig.getParameter<edm::InputTag>("PFJetCollectionLabel"));
0066   pfMetToken = consumes<reco::PFMETCollection>(iConfig.getParameter<edm::InputTag>("PFMETCollectionLabel"));
0067   //pfmhtTag_       = iConfig.getParameter<edm::InputTag>("PFMHTCollectionLabel");
0068   //Vertex info
0069   vertexToken = consumes<reco::VertexCollection>(std::string("offlinePrimaryVertices"));
0070   //
0071   CaloJetCorToken_ = consumes<reco::JetCorrector>(iConfig.getParameter<edm::InputTag>("CaloJetCorLabel"));
0072   PFJetCorToken_ = consumes<reco::JetCorrector>(iConfig.getParameter<edm::InputTag>("PFJetCorLabel"));
0073   //JetID
0074   jetID = new reco::helper::JetIDHelper(iConfig.getParameter<ParameterSet>("JetIDParams"), consumesCollector());
0075   _fEMF = iConfig.getUntrackedParameter<double>("fEMF", 0.01);
0076   _feta = iConfig.getUntrackedParameter<double>("feta", 2.60);
0077   _fHPD = iConfig.getUntrackedParameter<double>("fHPD", 0.98);
0078   _n90Hits = iConfig.getUntrackedParameter<double>("n90Hits", 1.0);
0079   _min_NHEF = iConfig.getUntrackedParameter<double>("minNHEF", 0.);
0080   _max_NHEF = iConfig.getUntrackedParameter<double>("maxNHEF", 0.99);
0081   _min_CHEF = iConfig.getUntrackedParameter<double>("minCHEF", 0.);
0082   _max_CHEF = iConfig.getUntrackedParameter<double>("maxCHEF", 1.);
0083   _min_NEMF = iConfig.getUntrackedParameter<double>("minNEMF", 0.);
0084   _max_NEMF = iConfig.getUntrackedParameter<double>("maxNEMF", 0.99);
0085   _min_CEMF = iConfig.getUntrackedParameter<double>("minCEMF", 0.);
0086   _max_CEMF = iConfig.getUntrackedParameter<double>("maxCEMF", 0.99);
0087   //Paths
0088   pathFilter_ = iConfig.getUntrackedParameter<vector<std::string> >("pathFilter");
0089   pathRejectKeyword_ = iConfig.getUntrackedParameter<vector<std::string> >("pathRejectKeyword");
0090   std::vector<edm::ParameterSet> paths = iConfig.getParameter<std::vector<edm::ParameterSet> >("pathPairs");
0091   for (auto& path : paths) {
0092     custompathnamepairs_.push_back(
0093         make_pair(path.getParameter<std::string>("pathname"), path.getParameter<std::string>("denompathname")));
0094   }
0095 }
0096 
0097 //------------------------------------------------------------------------//
0098 JetMETHLTOfflineSource::~JetMETHLTOfflineSource() {
0099   //
0100   // do anything here that needs to be done at desctruction time
0101   // (e.g. close files, deallocate resources etc.)
0102   delete jetID;
0103 }
0104 
0105 //------------------------------------------------------------------------//
0106 void JetMETHLTOfflineSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0107   if (verbose_) {
0108     cout << endl;
0109     cout << "============================================================" << endl;
0110     cout << " New event" << endl << endl;
0111   }
0112 
0113   //---------- triggerResults ----------
0114   iEvent.getByToken(triggerResultsToken, triggerResults_);
0115   if (!triggerResults_.isValid()) {
0116     iEvent.getByToken(triggerResultsFUToken, triggerResults_);
0117     if (!triggerResults_.isValid()) {
0118       if (verbose_)
0119         cout << " triggerResults not valid" << endl;
0120       edm::LogInfo("JetMETHLTOfflineSource") << "TriggerResults not found, "
0121                                                 "skipping event";
0122       return;
0123     }
0124   }
0125   if (verbose_)
0126     cout << " done triggerResults" << endl;
0127 
0128   //---------- triggerResults ----------
0129   triggerNames_ = iEvent.triggerNames(*triggerResults_);
0130 
0131   //---------- triggerSummary ----------
0132   iEvent.getByToken(triggerSummaryToken, triggerObj_);
0133   if (!triggerObj_.isValid()) {
0134     iEvent.getByToken(triggerSummaryFUToken, triggerObj_);
0135     if (!triggerObj_.isValid()) {
0136       edm::LogInfo("JetMETHLTOfflineSource") << "TriggerEvent not found, "
0137                                                 "skipping event";
0138       return;
0139     }
0140   }
0141   if (verbose_)
0142     cout << " done triggerSummary" << endl;
0143 
0144   if (verbose_) {
0145     cout << endl;
0146     cout << "============================================================" << endl;
0147     cout << " Reading in offline objects" << endl << endl;
0148   }
0149 
0150   //------------ Offline Objects -------
0151   iEvent.getByToken(caloJetsToken, calojetColl_);
0152   if (!calojetColl_.isValid())
0153     return;
0154   calojet = *calojetColl_;
0155   //std::stable_sort( calojet.begin(), calojet.end(), PtSorter() );
0156 
0157   if (verbose_)
0158     cout << " done calo" << endl;
0159 
0160   iEvent.getByToken(pfJetsToken, pfjetColl_);
0161   if (!pfjetColl_.isValid())
0162     return;
0163   pfjet = *pfjetColl_;
0164   //std::stable_sort( pfjet.begin(), pfjet.end(), PtSorter() );
0165 
0166   if (verbose_)
0167     cout << " done pf" << endl;
0168 
0169   iEvent.getByToken(caloMetToken, calometColl_);
0170   if (!calometColl_.isValid())
0171     return;
0172 
0173   iEvent.getByToken(pfMetToken, pfmetColl_);
0174   if (!pfmetColl_.isValid())
0175     return;
0176 
0177   if (verbose_) {
0178     cout << endl;
0179     cout << "============================================================" << endl;
0180     cout << " Read in offline objects" << endl << endl;
0181   }
0182 
0183   //---------- Event counting (DEBUG) ----------
0184   if (verbose_ && iEvent.id().event() % 10000 == 0)
0185     cout << "Run = " << iEvent.id().run() << ", LS = " << iEvent.luminosityBlock()
0186          << ", Event = " << iEvent.id().event() << endl;
0187 
0188   //Define on-the-fly correction Jet
0189   for (int i = 0; i < 2; i++) {
0190     CaloJetPx[i] = 0.;
0191     CaloJetPy[i] = 0.;
0192     CaloJetPt[i] = 0.;
0193     CaloJetEta[i] = 0.;
0194     CaloJetPhi[i] = 0.;
0195     CaloJetEMF[i] = 0.;
0196     CaloJetfHPD[i] = 0.;
0197     CaloJetn90[i] = 0.;
0198     PFJetPx[i] = 0.;
0199     PFJetPy[i] = 0.;
0200     PFJetPt[i] = 0.;
0201     PFJetEta[i] = 0.;
0202     PFJetPhi[i] = 0.;
0203     PFJetNHEF[i] = 0.;
0204     PFJetCHEF[i] = 0.;
0205     PFJetNEMF[i] = 0.;
0206     PFJetCEMF[i] = 0.;
0207   }
0208 
0209   //---------- CaloJet Correction (on-the-fly) ----------
0210   edm::Handle<reco::JetCorrector> calocorrector;
0211   iEvent.getByToken(CaloJetCorToken_, calocorrector);
0212   auto calojet_ = calojet.begin();
0213   for (; calojet_ != calojet.end(); ++calojet_) {
0214     double scale = calocorrector->correction(*calojet_);
0215     jetID->calculate(iEvent, iSetup, *calojet_);
0216 
0217     if (scale * calojet_->pt() > CaloJetPt[0]) {
0218       CaloJetPt[1] = CaloJetPt[0];
0219       CaloJetPx[1] = CaloJetPx[0];
0220       CaloJetPy[1] = CaloJetPy[0];
0221       CaloJetEta[1] = CaloJetEta[0];
0222       CaloJetPhi[1] = CaloJetPhi[0];
0223       CaloJetEMF[1] = CaloJetEMF[0];
0224       CaloJetfHPD[1] = CaloJetfHPD[0];
0225       CaloJetn90[1] = CaloJetn90[0];
0226       //
0227       CaloJetPt[0] = scale * calojet_->pt();
0228       CaloJetPx[0] = scale * calojet_->px();
0229       CaloJetPy[0] = scale * calojet_->py();
0230       CaloJetEta[0] = calojet_->eta();
0231       CaloJetPhi[0] = calojet_->phi();
0232       CaloJetEMF[0] = calojet_->emEnergyFraction();
0233       CaloJetfHPD[0] = jetID->fHPD();
0234       CaloJetn90[0] = jetID->n90Hits();
0235     } else if (scale * calojet_->pt() < CaloJetPt[0] && scale * calojet_->pt() > CaloJetPt[1]) {
0236       CaloJetPt[1] = scale * calojet_->pt();
0237       CaloJetPx[1] = scale * calojet_->px();
0238       CaloJetPy[1] = scale * calojet_->py();
0239       CaloJetEta[1] = calojet_->eta();
0240       CaloJetPhi[1] = calojet_->phi();
0241       CaloJetEMF[1] = calojet_->emEnergyFraction();
0242       CaloJetfHPD[1] = jetID->fHPD();
0243       CaloJetn90[1] = jetID->n90Hits();
0244     } else {
0245     }
0246   }
0247 
0248   //---------- PFJet Correction (on-the-fly) ----------
0249   pfMHTx_All = 0.;
0250   pfMHTy_All = 0.;
0251   edm::Handle<reco::JetCorrector> pfcorrector;
0252   iEvent.getByToken(PFJetCorToken_, pfcorrector);
0253   auto pfjet_ = pfjet.begin();
0254   for (; pfjet_ != pfjet.end(); ++pfjet_) {
0255     double scale = pfcorrector->correction(*pfjet_);
0256     pfMHTx_All = pfMHTx_All + scale * pfjet_->px();
0257     pfMHTy_All = pfMHTy_All + scale * pfjet_->py();
0258     if (scale * pfjet_->pt() > PFJetPt[0]) {
0259       PFJetPt[1] = PFJetPt[0];
0260       PFJetPx[1] = PFJetPx[0];
0261       PFJetPy[1] = PFJetPy[0];
0262       PFJetEta[1] = PFJetEta[0];
0263       PFJetPhi[1] = PFJetPhi[0];
0264       PFJetNHEF[1] = PFJetNHEF[0];
0265       PFJetCHEF[1] = PFJetCHEF[0];
0266       PFJetNEMF[1] = PFJetNEMF[0];
0267       PFJetCEMF[1] = PFJetCEMF[0];
0268       //
0269       PFJetPt[0] = scale * pfjet_->pt();
0270       PFJetPx[0] = scale * pfjet_->px();
0271       PFJetPy[0] = scale * pfjet_->py();
0272       PFJetEta[0] = pfjet_->eta();
0273       PFJetPhi[0] = pfjet_->phi();
0274       PFJetNHEF[0] = pfjet_->neutralHadronEnergyFraction();
0275       PFJetCHEF[0] = pfjet_->chargedHadronEnergyFraction();
0276       PFJetNEMF[0] = pfjet_->neutralEmEnergyFraction();
0277       PFJetCEMF[0] = pfjet_->chargedEmEnergyFraction();
0278     } else if (scale * pfjet_->pt() < PFJetPt[0] && scale * pfjet_->pt() > PFJetPt[1]) {
0279       PFJetPt[1] = scale * pfjet_->pt();
0280       PFJetPx[1] = scale * pfjet_->px();
0281       PFJetPy[1] = scale * pfjet_->py();
0282       PFJetEta[1] = pfjet_->eta();
0283       PFJetPhi[1] = pfjet_->phi();
0284       PFJetNHEF[1] = pfjet_->neutralHadronEnergyFraction();
0285       PFJetCHEF[1] = pfjet_->chargedHadronEnergyFraction();
0286       PFJetNEMF[1] = pfjet_->neutralEmEnergyFraction();
0287       PFJetCEMF[1] = pfjet_->chargedEmEnergyFraction();
0288     } else {
0289     }
0290   }
0291 
0292   if (verbose_) {
0293     for (int i = 0; i < 2; i++) {
0294       cout << "CaloJet-0: " << CaloJetPt[i] << ", Eta = " << CaloJetEta[i] << ", Phi = " << CaloJetPhi[i] << endl;
0295       cout << "fHPD = " << CaloJetfHPD[0] << ", n90 = " << CaloJetn90[0] << endl;
0296     }
0297     for (int i = 0; i < 2; i++) {
0298       cout << "PFJet-0: " << PFJetPt[i] << ", Eta = " << PFJetEta[i] << ", Phi = " << PFJetPhi[i] << endl;
0299     }
0300   }
0301 
0302   //---------- RUN ----------
0303   fillMEforMonTriggerSummary(iEvent, iSetup);
0304   if (plotAll_)
0305     fillMEforMonAllTrigger(iEvent, iSetup);
0306   if (plotEff_)
0307     fillMEforEffAllTrigger(iEvent, iSetup);
0308   if (runStandalone_)
0309     fillMEforTriggerNTfired();
0310 }
0311 
0312 //------------------------------------------------------------------------//
0313 // Trigger summary for all paths
0314 void JetMETHLTOfflineSource::fillMEforMonTriggerSummary(const Event& iEvent, const edm::EventSetup& iSetup) {
0315   if (verbose_)
0316     cout << ">> Inside fillMEforMonTriggerSummary " << endl;
0317   bool muTrig = false;
0318 
0319   for (auto const& MuonTrigPath : MuonTrigPaths_) {
0320     const unsigned int nPath(hltConfig_.size());
0321     for (unsigned int j = 0; j != nPath; ++j) {
0322       std::string pathname = hltConfig_.triggerName(j);
0323       if (pathname.find(MuonTrigPath) != std::string::npos) {
0324         if (isHLTPathAccepted(pathname)) {
0325           muTrig = true;
0326           if (verbose_)
0327             cout << "fillMEforMonTriggerSummary: Muon Match" << endl;
0328         }
0329       }
0330       if (muTrig)
0331         break;
0332     }
0333     if (muTrig)
0334       break;
0335   }
0336 
0337   bool mbTrig = false;
0338   for (auto const& MBTrigPath : MBTrigPaths_) {
0339     const unsigned int nPath(hltConfig_.size());
0340     for (unsigned int j = 0; j != nPath; ++j) {
0341       std::string pathname = hltConfig_.triggerName(j);
0342       if (pathname.find(MBTrigPath) != std::string::npos) {
0343         if (isHLTPathAccepted(pathname)) {
0344           mbTrig = true;
0345           if (verbose_)
0346             cout << "fillMEforMonTriggerSummary: MinBias Match" << endl;
0347         }
0348       }
0349       if (mbTrig)
0350         break;
0351     }
0352     if (mbTrig)
0353       break;
0354   }
0355 
0356   auto v = hltPathsAll_.begin();
0357   for (; v != hltPathsAll_.end(); ++v) {
0358     bool trigFirst = false;
0359     double binV = TriggerPosition(v->getPath());
0360     if (isHLTPathAccepted(v->getPath()))
0361       trigFirst = true;
0362     if (!trigFirst)
0363       continue;
0364     if (trigFirst) {
0365       rate_All->Fill(binV);
0366       correlation_All->Fill(binV, binV);
0367       if (muTrig && runStandalone_) {
0368         rate_AllWrtMu->Fill(binV);
0369         correlation_AllWrtMu->Fill(binV, binV);
0370       }
0371       if (mbTrig && runStandalone_) {
0372         rate_AllWrtMB->Fill(binV);
0373         correlation_AllWrtMB->Fill(binV, binV);
0374       }
0375     }
0376     for (auto w = v + 1; w != hltPathsAll_.end(); ++w) {
0377       bool trigSec = false;
0378       double binW = TriggerPosition(w->getPath());
0379       if (isHLTPathAccepted(w->getPath()))
0380         trigSec = true;
0381       if (trigSec && trigFirst) {
0382         correlation_All->Fill(binV, binW);
0383         if (muTrig && runStandalone_)
0384           correlation_AllWrtMu->Fill(binV, binW);
0385         if (mbTrig && runStandalone_)
0386           correlation_AllWrtMB->Fill(binV, binW);
0387       }
0388       if (!trigSec && trigFirst) {
0389         correlation_All->Fill(binW, binV);
0390         if (muTrig && runStandalone_)
0391           correlation_AllWrtMu->Fill(binW, binV);
0392         if (mbTrig && runStandalone_)
0393           correlation_AllWrtMB->Fill(binW, binV);
0394       }
0395     }
0396   }
0397 
0398   //Vertex
0399   edm::Handle<VertexCollection> Vtx;
0400   iEvent.getByToken(vertexToken, Vtx);
0401   int vtxcnt = 0;
0402   for (auto const& itv : *Vtx) {
0403     //if(vtxcnt>=20) break;
0404     PVZ->Fill(itv.z());
0405     //chi2vtx[vtxcnt] = itv->chi2();
0406     //ndofvtx[vtxcnt] = itv->ndof();
0407     //ntrkvtx[vtxcnt] = itv->tracksSize();
0408     vtxcnt++;
0409   }
0410   NVertices->Fill(vtxcnt);
0411 }
0412 
0413 //------------------------------------------------------------------------//
0414 void JetMETHLTOfflineSource::fillMEforTriggerNTfired() {
0415   if (verbose_)
0416     cout << ">> Inside fillMEforTriggerNTfired" << endl;
0417   if (!triggerResults_.isValid())
0418     return;
0419   if (verbose_)
0420     cout << "   ... and triggerResults is valid" << endl;
0421 
0422   //
0423   for (auto& v : hltPathsAll_) {
0424     unsigned index = triggerNames_.triggerIndex(v.getPath());
0425     if (index < triggerNames_.size()) {
0426       v.getMEhisto_TriggerSummary()->Fill(0.);
0427       edm::InputTag l1Tag(v.getl1Path(), "", processname_);
0428       const int l1Index = triggerObj_->filterIndex(l1Tag);
0429       bool l1found = false;
0430       if (l1Index < triggerObj_->sizeFilters())
0431         l1found = true;
0432       if (!l1found)
0433         v.getMEhisto_TriggerSummary()->Fill(1.);
0434       if (!l1found && !(triggerResults_->accept(index)))
0435         v.getMEhisto_TriggerSummary()->Fill(2.);
0436       if (!l1found && (triggerResults_->accept(index)))
0437         v.getMEhisto_TriggerSummary()->Fill(3.);
0438       if (l1found)
0439         v.getMEhisto_TriggerSummary()->Fill(4.);
0440       if (l1found && (triggerResults_->accept(index)))
0441         v.getMEhisto_TriggerSummary()->Fill(5.);
0442       if (l1found && !(triggerResults_->accept(index)))
0443         v.getMEhisto_TriggerSummary()->Fill(6.);
0444       if (!(triggerResults_->accept(index)) && l1found) {
0445         //cout<<v->getTriggerType()<<endl;
0446         if ((v.getTriggerType() == "SingleJet_Trigger") && (calojetColl_.isValid()) && !calojet.empty()) {
0447           auto jet = calojet.begin();
0448           v.getMEhisto_JetPt()->Fill(jet->pt());
0449           v.getMEhisto_EtavsPt()->Fill(jet->eta(), jet->pt());
0450           v.getMEhisto_PhivsPt()->Fill(jet->phi(), jet->pt());
0451         }
0452         // single jet trigger is not fired
0453 
0454         if ((v.getTriggerType() == "DiJet_Trigger") && calojetColl_.isValid() && !calojet.empty()) {
0455           v.getMEhisto_JetSize()->Fill(calojet.size());
0456           if (calojet.size() >= 2) {
0457             auto jet = calojet.begin();
0458             auto jet2 = calojet.begin();
0459             jet2++;
0460             double jet3pt = 0.;
0461             if (calojet.size() > 2) {
0462               auto jet3 = jet2++;
0463               jet3pt = jet3->pt();
0464             }
0465             v.getMEhisto_Pt12()->Fill((jet->pt() + jet2->pt()) / 2.);
0466             v.getMEhisto_Eta12()->Fill((jet->eta() + jet2->eta()) / 2.);
0467             v.getMEhisto_Phi12()->Fill(deltaPhi(jet->phi(), jet2->phi()));
0468             v.getMEhisto_Pt3()->Fill(jet3pt);
0469             v.getMEhisto_Pt12Pt3()->Fill((jet->pt() + jet2->pt()) / 2., jet3pt);
0470             v.getMEhisto_Pt12Phi12()->Fill((jet->pt() + jet2->pt()) / 2., deltaPhi(jet->phi(), jet2->phi()));
0471           }
0472         }  // di jet trigger is not fired
0473 
0474         if (((v.getTriggerType() == "MET_Trigger") || (v.getTriggerType() == "TET_Trigger")) &&
0475             calometColl_.isValid()) {
0476           const CaloMETCollection* calometcol = calometColl_.product();
0477           const CaloMET met = calometcol->front();
0478           v.getMEhisto_JetPt()->Fill(met.pt());
0479         }  //MET trigger is not fired
0480       }  // L1 is fired
0481     }  //
0482   }  // trigger not fired
0483 }
0484 
0485 //------------------------------------------------------------------------//
0486 void JetMETHLTOfflineSource::fillMEforMonAllTrigger(const Event& iEvent, const edm::EventSetup& iSetup) {
0487   if (verbose_)
0488     cout << ">> Inside fillMEforMonAllTrigger " << endl;
0489   if (!triggerResults_.isValid())
0490     return;
0491   if (verbose_)
0492     cout << "   ... and triggerResults is valid" << endl;
0493 
0494   const trigger::TriggerObjectCollection& toc(triggerObj_->getObjects());
0495   for (auto& v : hltPathsAll_) {
0496     if (verbose_)
0497       cout << "   + Checking path " << v.getPath();
0498     if (isHLTPathAccepted(v.getPath()) == false) {
0499       if (verbose_)
0500         cout << " - failed" << endl;
0501       continue;
0502     }
0503     if (verbose_)
0504       cout << " - PASSED! " << endl;
0505 
0506     //New jet collection (after apply JEC)
0507     std::vector<double> jetPtVec;
0508     std::vector<double> jetPhiVec;
0509     std::vector<double> jetEtaVec;
0510     std::vector<double> jetPxVec;
0511     std::vector<double> jetPyVec;
0512     std::vector<double> hltPtVec;
0513     std::vector<double> hltPhiVec;
0514     std::vector<double> hltEtaVec;
0515     std::vector<double> hltPxVec;
0516     std::vector<double> hltPyVec;
0517 
0518     //This will be used to find out punch through trigger
0519     //bool fillL1HLT = false;
0520 
0521     //L1 and HLT indices
0522     if (verbose_) {
0523       cout << "     - L1Path = " << v.getl1Path() << endl;
0524       cout << "     - Label  = " << v.getLabel() << endl;
0525     }
0526 
0527     //edm::InputTag l1Tag(v->getl1Path(),"",processname_);
0528     edm::InputTag l1Tag(v.getLabel(), "", processname_);
0529     const int l1Index = triggerObj_->filterIndex(l1Tag);
0530     if (verbose_)
0531       cout << "     - l1Index = " << l1Index << " - l1Tag = [" << l1Tag << "]" << endl;
0532 
0533     edm::InputTag hltTag(v.getLabel(), "", processname_);
0534     const int hltIndex = triggerObj_->filterIndex(hltTag);
0535     if (verbose_)
0536       cout << "     - hltIndex = " << hltIndex << " - hltTag = [" << hltTag << "]" << endl;
0537 
0538     //bool l1TrigBool = false;
0539     bool hltTrigBool = false;
0540     bool diJetFire = false;
0541     int jetsize = 0;
0542 
0543     if (l1Index >= triggerObj_->sizeFilters()) {
0544       edm::LogInfo("JetMETHLTOfflineSource") << "no index " << l1Index << " of that name " << l1Tag;
0545       if (verbose_)
0546         cout << "[JetMETHLTOfflineSource::fillMEforMonAllTrigger] - No index l1Index=" << l1Index << " of that name \""
0547              << l1Tag << "\"" << endl;
0548     } else {
0549       //l1TrigBool = true;
0550       const trigger::Keys& kl1 = triggerObj_->filterKeys(l1Index);
0551       //
0552       if (v.getObjectType() == trigger::TriggerJet && v.getTriggerType() == "SingleJet_Trigger")
0553         v.getMEhisto_N_L1()->Fill(kl1.size());
0554       //
0555       auto ki = kl1.begin();
0556       for (; ki != kl1.end(); ++ki) {
0557         double l1TrigEta = -100;
0558         double l1TrigPhi = -100;
0559         //
0560         if (v.getObjectType() == trigger::TriggerJet) {
0561           l1TrigEta = toc[*ki].eta();
0562           l1TrigPhi = toc[*ki].phi();
0563           if (v.getTriggerType() == "SingleJet_Trigger") {
0564             v.getMEhisto_Pt_L1()->Fill(toc[*ki].pt());
0565             if (isBarrel(toc[*ki].eta()))
0566               v.getMEhisto_PtBarrel_L1()->Fill(toc[*ki].pt());
0567             if (isEndCap(toc[*ki].eta()))
0568               v.getMEhisto_PtEndcap_L1()->Fill(toc[*ki].pt());
0569             if (isForward(toc[*ki].eta()))
0570               v.getMEhisto_PtForward_L1()->Fill(toc[*ki].pt());
0571             v.getMEhisto_Eta_L1()->Fill(toc[*ki].eta());
0572             v.getMEhisto_Phi_L1()->Fill(toc[*ki].phi());
0573             v.getMEhisto_EtaPhi_L1()->Fill(toc[*ki].eta(), toc[*ki].phi());
0574           }
0575         }
0576         if (v.getObjectType() == trigger::TriggerMET || v.getObjectType() == trigger::TriggerTET) {
0577           v.getMEhisto_Pt_L1()->Fill(toc[*ki].pt());
0578           v.getMEhisto_Phi_L1()->Fill(toc[*ki].phi());
0579         }
0580 
0581         //-----------------------------------------------
0582         if (hltIndex >= triggerObj_->sizeFilters()) {
0583           edm::LogInfo("JetMETHLTOfflineSource") << "no index hlt" << hltIndex << " of that name ";
0584           if (verbose_)
0585             cout << "[JetMETHLTOfflineSource::fillMEforMonAllTrigger] - No index hltIndex=" << hltIndex
0586                  << " of that name " << endl;
0587         } else {
0588           const trigger::Keys& khlt = triggerObj_->filterKeys(hltIndex);
0589           if (v.getObjectType() == trigger::TriggerJet && ki == kl1.begin() &&
0590               v.getTriggerType() == "SingleJet_Trigger")
0591             v.getMEhisto_N_HLT()->Fill(khlt.size());
0592           //
0593           auto kj = khlt.begin();
0594           //Define hltTrigBool
0595           for (; kj != khlt.end(); ++kj) {
0596             if (v.getObjectType() == trigger::TriggerJet) {
0597               double hltTrigEta = -100;
0598               double hltTrigPhi = -100;
0599               hltTrigEta = toc[*kj].eta();
0600               hltTrigPhi = toc[*kj].phi();
0601               if ((deltaR(hltTrigEta, hltTrigPhi, l1TrigEta, l1TrigPhi)) < 0.4 &&
0602                   (v.getTriggerType() == "DiJet_Trigger"))
0603                 hltTrigBool = true;
0604             }
0605           }
0606           //
0607           kj = khlt.begin();
0608           for (; kj != khlt.end(); ++kj) {
0609             double hltTrigEta = -100.;
0610             double hltTrigPhi = -100.;
0611             //fillL1HLT = true;
0612             //MET Triggers
0613             if (verbose_)
0614               cout << "+ MET Triggers plots" << endl;
0615             if (v.getObjectType() == trigger::TriggerMET || (v.getObjectType() == trigger::TriggerTET)) {
0616               v.getMEhisto_Pt_HLT()->Fill(toc[*kj].pt());
0617               v.getMEhisto_Phi_HLT()->Fill(toc[*kj].phi());
0618               v.getMEhisto_PtCorrelation_L1HLT()->Fill(toc[*ki].pt(), toc[*kj].pt());
0619               v.getMEhisto_PhiCorrelation_L1HLT()->Fill(toc[*ki].phi(), toc[*kj].phi());
0620               v.getMEhisto_PtResolution_L1HLT()->Fill((toc[*ki].pt() - toc[*kj].pt()) / (toc[*ki].pt()));
0621               v.getMEhisto_PhiResolution_L1HLT()->Fill(toc[*ki].phi() - toc[*kj].phi());
0622             }
0623             //Jet Triggers
0624             if (verbose_)
0625               cout << "+ Jet Trigger plots" << endl;
0626             if (v.getObjectType() == trigger::TriggerJet) {
0627               if (verbose_)
0628                 cout << "  - Going for those..." << endl;
0629               hltTrigEta = toc[*kj].eta();
0630               hltTrigPhi = toc[*kj].phi();
0631               if ((deltaR(hltTrigEta, hltTrigPhi, l1TrigEta, l1TrigPhi)) < 0.4) {
0632                 if (v.getTriggerType() == "SingleJet_Trigger") {
0633                   v.getMEhisto_PtCorrelation_L1HLT()->Fill(toc[*ki].pt(), toc[*kj].pt());
0634                   v.getMEhisto_EtaCorrelation_L1HLT()->Fill(toc[*ki].eta(), toc[*kj].eta());
0635                   v.getMEhisto_PhiCorrelation_L1HLT()->Fill(toc[*ki].phi(), toc[*kj].phi());
0636                   v.getMEhisto_PtResolution_L1HLT()->Fill((toc[*ki].pt() - toc[*kj].pt()) / (toc[*ki].pt()));
0637                   v.getMEhisto_EtaResolution_L1HLT()->Fill(toc[*ki].eta() - toc[*kj].eta());
0638                   v.getMEhisto_PhiResolution_L1HLT()->Fill(toc[*ki].phi() - toc[*kj].phi());
0639                 }
0640               }
0641               if (((deltaR(hltTrigEta, hltTrigPhi, l1TrigEta, l1TrigPhi) < 0.4) ||
0642                    ((v.getTriggerType() == "DiJet_Trigger") && hltTrigBool)) &&
0643                   !diJetFire) {
0644                 if (v.getTriggerType() == "SingleJet_Trigger") {
0645                   v.getMEhisto_Pt_HLT()->Fill(toc[*kj].pt());
0646                   if (isBarrel(toc[*kj].eta()))
0647                     v.getMEhisto_PtBarrel_HLT()->Fill(toc[*kj].pt());
0648                   if (isEndCap(toc[*kj].eta()))
0649                     v.getMEhisto_PtEndcap_HLT()->Fill(toc[*kj].pt());
0650                   if (isForward(toc[*kj].eta()))
0651                     v.getMEhisto_PtForward_HLT()->Fill(toc[*kj].pt());
0652                   v.getMEhisto_Eta_HLT()->Fill(toc[*kj].eta());
0653                   v.getMEhisto_Phi_HLT()->Fill(toc[*kj].phi());
0654                   v.getMEhisto_EtaPhi_HLT()->Fill(toc[*kj].eta(), toc[*kj].phi());
0655                 }
0656 
0657                 //Calojet
0658                 if (calojetColl_.isValid() && (v.getObjectType() == trigger::TriggerJet) && (v.getPath() == "PFJet")) {
0659                   //CaloJetCollection::const_iterator jet = calojet.begin();
0660                   //for(; jet != calojet.end(); ++jet) {
0661                   for (int iCalo = 0; iCalo < 2; iCalo++) {
0662                     if (deltaR(hltTrigEta, hltTrigPhi, CaloJetEta[iCalo], CaloJetPhi[iCalo]) < 0.4) {
0663                       jetsize++;
0664                       if (v.getTriggerType() == "SingleJet_Trigger") {
0665                         v.getMEhisto_Pt()->Fill(CaloJetPt[iCalo]);
0666                         if (isBarrel(CaloJetEta[iCalo]))
0667                           v.getMEhisto_PtBarrel()->Fill(CaloJetPt[iCalo]);
0668                         if (isEndCap(CaloJetEta[iCalo]))
0669                           v.getMEhisto_PtEndcap()->Fill(CaloJetPt[iCalo]);
0670                         if (isForward(CaloJetEta[iCalo]))
0671                           v.getMEhisto_PtForward()->Fill(CaloJetPt[iCalo]);
0672                         //
0673                         v.getMEhisto_Eta()->Fill(CaloJetEta[iCalo]);
0674                         v.getMEhisto_Phi()->Fill(CaloJetPhi[iCalo]);
0675                         v.getMEhisto_EtaPhi()->Fill(CaloJetEta[iCalo], CaloJetPhi[iCalo]);
0676                         //
0677                         v.getMEhisto_PtCorrelation_HLTRecObj()->Fill(toc[*kj].pt(), CaloJetPt[iCalo]);
0678                         v.getMEhisto_EtaCorrelation_HLTRecObj()->Fill(toc[*kj].eta(), CaloJetEta[iCalo]);
0679                         v.getMEhisto_PhiCorrelation_HLTRecObj()->Fill(toc[*kj].phi(), CaloJetPhi[iCalo]);
0680                         //
0681                         v.getMEhisto_PtResolution_HLTRecObj()->Fill((toc[*kj].pt() - CaloJetPt[iCalo]) /
0682                                                                     (toc[*kj].pt()));
0683                         v.getMEhisto_EtaResolution_HLTRecObj()->Fill(toc[*kj].eta() - CaloJetEta[iCalo]);
0684                         v.getMEhisto_PhiResolution_HLTRecObj()->Fill(toc[*kj].phi() - CaloJetPhi[iCalo]);
0685                       }
0686 
0687                       //-------------------------------------------------------
0688                       if ((v.getTriggerType() == "DiJet_Trigger")) {
0689                         jetPhiVec.push_back(CaloJetPhi[iCalo]);
0690                         jetPtVec.push_back(CaloJetPt[iCalo]);
0691                         jetEtaVec.push_back(CaloJetEta[iCalo]);
0692                         jetPxVec.push_back(CaloJetPx[iCalo]);
0693                         jetPyVec.push_back(CaloJetPy[iCalo]);
0694                         //
0695                         hltPhiVec.push_back(toc[*kj].phi());
0696                         hltPtVec.push_back(toc[*kj].pt());
0697                         hltEtaVec.push_back(toc[*kj].eta());
0698                         hltPxVec.push_back(toc[*kj].px());
0699                         hltPyVec.push_back(toc[*kj].py());
0700                       }
0701                     }  // matching jet
0702                   }  // Jet Loop
0703                 }  // valid calojet collection, with calojet trigger
0704 
0705                 //PFJet trigger
0706                 if (pfjetColl_.isValid() && (v.getObjectType() == trigger::TriggerJet) && (v.getPath() != "PFJet")) {
0707                   //PFJetCollection::const_iterator jet = pfjet.begin();
0708                   //for(; jet != pfjet.end(); ++jet){
0709                   for (int iPF = 0; iPF < 2; iPF++) {
0710                     if (deltaR(hltTrigEta, hltTrigPhi, PFJetEta[iPF], PFJetPhi[iPF]) < 0.4) {
0711                       jetsize++;
0712                       if (v.getTriggerType() == "SingleJet_Trigger") {
0713                         v.getMEhisto_Pt()->Fill(PFJetPt[iPF]);
0714                         if (isBarrel(PFJetEta[iPF]))
0715                           v.getMEhisto_PtBarrel()->Fill(PFJetPt[iPF]);
0716                         if (isEndCap(PFJetEta[iPF]))
0717                           v.getMEhisto_PtEndcap()->Fill(PFJetPt[iPF]);
0718                         if (isForward(PFJetEta[iPF]))
0719                           v.getMEhisto_PtForward()->Fill(PFJetPt[iPF]);
0720                         //
0721                         v.getMEhisto_Eta()->Fill(PFJetEta[iPF]);
0722                         v.getMEhisto_Phi()->Fill(PFJetPhi[iPF]);
0723                         v.getMEhisto_EtaPhi()->Fill(PFJetEta[iPF], PFJetPhi[iPF]);
0724                         //
0725                         v.getMEhisto_PtCorrelation_HLTRecObj()->Fill(toc[*kj].pt(), PFJetPt[iPF]);
0726                         v.getMEhisto_EtaCorrelation_HLTRecObj()->Fill(toc[*kj].eta(), PFJetEta[iPF]);
0727                         v.getMEhisto_PhiCorrelation_HLTRecObj()->Fill(toc[*kj].phi(), PFJetPhi[iPF]);
0728                         //
0729                         v.getMEhisto_PtResolution_HLTRecObj()->Fill((toc[*kj].pt() - PFJetPt[iPF]) / (toc[*kj].pt()));
0730                         v.getMEhisto_EtaResolution_HLTRecObj()->Fill(toc[*kj].eta() - PFJetEta[iPF]);
0731                         v.getMEhisto_PhiResolution_HLTRecObj()->Fill(toc[*kj].phi() - PFJetPhi[iPF]);
0732                       }
0733 
0734                       //-------------------------------------------------------
0735                       if ((v.getTriggerType() == "DiJet_Trigger")) {
0736                         jetPhiVec.push_back(PFJetPhi[iPF]);
0737                         jetPtVec.push_back(PFJetPt[iPF]);
0738                         jetEtaVec.push_back(PFJetEta[iPF]);
0739                         jetPxVec.push_back(PFJetPx[iPF]);
0740                         jetPyVec.push_back(PFJetPy[iPF]);
0741                         //
0742                         hltPhiVec.push_back(toc[*kj].phi());
0743                         hltPtVec.push_back(toc[*kj].pt());
0744                         hltEtaVec.push_back(toc[*kj].eta());
0745                         hltPxVec.push_back(toc[*kj].px());
0746                         hltPyVec.push_back(toc[*kj].py());
0747                       }
0748                     }  // matching jet
0749                   }  //PFJet loop
0750                 }  //valid pfjet collection, with pfjet trigger
0751                 //
0752               }  // hlt matching with l1
0753             }  // jet trigger
0754 
0755             //------------------------------------------------------
0756             if (calometColl_.isValid() &&
0757                 ((v.getObjectType() == trigger::TriggerMET) || (v.getObjectType() == trigger::TriggerTET)) &&
0758                 (v.getPath().find("HLT_PFMET") == std::string::npos)) {
0759               const CaloMETCollection* calometcol = calometColl_.product();
0760               const CaloMET met = calometcol->front();
0761               //
0762               v.getMEhisto_Pt()->Fill(met.et());
0763               v.getMEhisto_Phi()->Fill(met.phi());
0764               //
0765               v.getMEhisto_PtCorrelation_HLTRecObj()->Fill(toc[*kj].et(), met.et());
0766               v.getMEhisto_PhiCorrelation_HLTRecObj()->Fill(toc[*kj].phi(), met.phi());
0767               v.getMEhisto_PtResolution_HLTRecObj()->Fill((toc[*kj].et() - met.et()) / (toc[*kj].et()));
0768               v.getMEhisto_PhiResolution_HLTRecObj()->Fill(toc[*kj].phi() - met.phi());
0769             }
0770 
0771             //--------------------------------------------------------
0772             if (pfmetColl_.isValid() &&
0773                 ((v.getObjectType() == trigger::TriggerMET) || (v.getObjectType() == trigger::TriggerTET)) &&
0774                 (v.getPath().find("HLT_PFMET") != std::string::npos)) {
0775               const PFMETCollection* pfmetcol = pfmetColl_.product();
0776               const PFMET pfmet = pfmetcol->front();
0777               //
0778               v.getMEhisto_Pt()->Fill(pfmet.et());
0779               v.getMEhisto_Phi()->Fill(pfmet.phi());
0780               //
0781               v.getMEhisto_PtCorrelation_HLTRecObj()->Fill(toc[*kj].et(), pfmet.et());
0782               v.getMEhisto_PhiCorrelation_HLTRecObj()->Fill(toc[*kj].phi(), pfmet.phi());
0783               v.getMEhisto_PtResolution_HLTRecObj()->Fill((toc[*kj].et() - pfmet.et()) / (toc[*kj].et()));
0784               v.getMEhisto_PhiResolution_HLTRecObj()->Fill(toc[*kj].phi() - pfmet.phi());
0785             }
0786           }  //Loop over HLT trigger candidates
0787           if ((v.getTriggerType() == "DiJet_Trigger"))
0788             diJetFire = true;
0789         }  // Valid hlt trigger object
0790       }  // Loop over L1 objects
0791     }  // Valid L1 trigger object
0792     v.getMEhisto_N()->Fill(jetsize);
0793 
0794     //--------------------------------------------------------
0795     if ((v.getTriggerType() == "DiJet_Trigger") && jetPtVec.size() > 1) {
0796       double AveJetPt = (jetPtVec[0] + jetPtVec[1]) / 2;
0797       double AveJetEta = (jetEtaVec[0] + jetEtaVec[1]) / 2;
0798       double JetDelPhi = deltaPhi(jetPhiVec[0], jetPhiVec[1]);
0799       double AveHLTPt = (hltPtVec[0] + hltPtVec[1]) / 2;
0800       double AveHLTEta = (hltEtaVec[0] + hltEtaVec[1]) / 2;
0801       double HLTDelPhi = deltaPhi(hltPhiVec[0], hltPhiVec[1]);
0802       v.getMEhisto_AveragePt_RecObj()->Fill(AveJetPt);
0803       v.getMEhisto_AverageEta_RecObj()->Fill(AveJetEta);
0804       v.getMEhisto_DeltaPhi_RecObj()->Fill(JetDelPhi);
0805       //
0806       v.getMEhisto_AveragePt_HLTObj()->Fill(AveHLTPt);
0807       v.getMEhisto_AverageEta_HLTObj()->Fill(AveHLTEta);
0808       v.getMEhisto_DeltaPhi_HLTObj()->Fill(HLTDelPhi);
0809     }
0810   }
0811   if (verbose_)
0812     cout << "<< Exiting fillMEforMonAllTrigger " << endl;
0813 }
0814 
0815 //------------------------------------------------------------------------//
0816 void JetMETHLTOfflineSource::fillMEforEffAllTrigger(const Event& iEvent, const edm::EventSetup& iSetup) {
0817   if (!triggerResults_.isValid())
0818     return;
0819 
0820   bool denompassed = false;
0821   bool numpassed = false;
0822   const trigger::TriggerObjectCollection& toc(triggerObj_->getObjects());
0823 
0824   for (auto& v : hltPathsEff_) {
0825     denompassed = false;
0826     numpassed = false;
0827 
0828     unsigned indexNum = triggerNames_.triggerIndex(v.getPath());
0829     unsigned indexDenom = triggerNames_.triggerIndex(v.getDenomPath());
0830 
0831     if (indexNum < triggerNames_.size() && triggerResults_->accept(indexNum))
0832       numpassed = true;
0833     if (indexDenom < triggerNames_.size() && triggerResults_->accept(indexDenom))
0834       denompassed = true;
0835 
0836     if (denompassed == false)
0837       continue;
0838 
0839     //if(numpassed==true){
0840     edm::InputTag hltTag(v.getLabel(), "", processname_);
0841     const int hltIndex = triggerObj_->filterIndex(hltTag);
0842     edm::InputTag l1Tag(v.getl1Path(), "", processname_);
0843     const int l1Index = triggerObj_->filterIndex(l1Tag);
0844     //}
0845 
0846     //----------------------------------------------------------------------
0847     //double pTcut = 0;
0848     double trigLowpTcut = 0;
0849     double trigMedpTcut = 0;
0850     double trigHighpTcut = 0;
0851     double trigLowpTcutFwd = 0;
0852     double trigMedpTcutFwd = 0;
0853     double trigHighpTcutFwd = 0;
0854     //
0855     //double pTPFcut = 0 ;
0856     double trigLowpTPFcut = 0;
0857     double trigMedpTPFcut = 0;
0858     double trigHighpTPFcut = 0;
0859     double trigLowpTPFcutFwd = 0;
0860     double trigMedpTPFcutFwd = 0;
0861     double trigHighpTPFcutFwd = 0;
0862     //
0863     //cout<<"pre-path" << v->getPath()<<endl;
0864     size_t jetstrfound = v.getPath().find("Jet");
0865     //size_t censtrfound = v->getPath().find("Central"); //shoouldn't be needed?
0866     string tpath = v.getPath();
0867     string jetTrigVal;
0868     float jetVal = 0.;
0869     //
0870     if (jetstrfound != string::npos) {  // && ustrfound != string::npos ){
0871       //cout<<v->getPath()<<endl;
0872       for (int trig = int(jetstrfound) + 3; trig < int(jetstrfound) + 7; trig++) {  // int(ustrfound); trig++){
0873         if (!isdigit(tpath[trig]))
0874           break;
0875         jetTrigVal += tpath[trig];
0876       }
0877       jetVal = atof(jetTrigVal.c_str());
0878       //
0879       if (jetVal > 0.) {
0880         if (jetVal < 50.) {
0881           //pTcut = jetVal / 2.;
0882           trigMedpTcut = jetVal + 5.;
0883           trigHighpTcut = jetVal + 10.;
0884           //
0885           trigLowpTcutFwd = jetVal + 9.;
0886           trigMedpTcutFwd = jetVal + 15.;
0887           trigHighpTcutFwd = jetVal + 21.;
0888         } else {
0889           //pTcut = jetVal - 20. ;
0890           trigMedpTcut = jetVal + 2.;
0891           trigHighpTcut = jetVal + 60.;
0892           //
0893           trigLowpTcutFwd = jetVal + 22.;
0894           trigMedpTcutFwd = jetVal + 25.;
0895           trigHighpTcutFwd = jetVal + 110.;
0896         }
0897         trigLowpTcut = jetVal;
0898       }
0899       //
0900       if (jetVal > 0.) {
0901         if (jetVal < 50.) {
0902           //pTPFcut = jetVal ;
0903           trigMedpTPFcut = jetVal + 20.;
0904           trigHighpTPFcut = jetVal + 40.;
0905           //
0906           trigLowpTPFcutFwd = jetVal + 60.;
0907           trigMedpTPFcutFwd = jetVal + 80.;
0908           trigHighpTPFcutFwd = jetVal + 100.;
0909         } else {
0910           //pTPFcut = jetVal  ;
0911           trigMedpTPFcut = jetVal + 40.;
0912           trigHighpTPFcut = jetVal + 140.;
0913           //
0914           trigLowpTPFcutFwd = jetVal + 110.;
0915           trigMedpTPFcutFwd = jetVal + 130.;
0916           trigHighpTPFcutFwd = jetVal + 190.;
0917         }
0918         trigLowpTPFcut = jetVal;
0919       }
0920     }
0921     //----------------------------------------------------------------------
0922 
0923     //CaloJet paths
0924     if (verbose_)
0925       std::cout << "fillMEforEffAllTrigger: CaloJet -------------------" << std::endl;
0926     if (calojetColl_.isValid() && (v.getObjectType() == trigger::TriggerJet)) {
0927       //cout<<"   - CaloJet "<<endl;
0928       //&& (v->getPath().find("HLT_PFJet")==std::string::npos)
0929       //&& (v->getPath().find("HLT_DiPFJet")==std::string::npos)){
0930       bool jetIDbool = false;
0931       double leadjpt = CaloJetPt[0];
0932       double leadjeta = CaloJetEta[0];
0933       double leadjphi = CaloJetPhi[0];
0934       //double ljemf    = CaloJetEMF[0];
0935       double ljfhpd = CaloJetfHPD[0];
0936       double ljn90 = CaloJetn90[0];
0937       if ((v.getTriggerType() == "SingleJet_Trigger") && !calojet.empty()) {  //this line stops the central jets
0938         if ((ljfhpd < _fHPD) && (ljn90 > _n90Hits)) {
0939           if (verbose_)
0940             cout << "Passed CaloJet ID -------------------" << endl;
0941           jetIDbool = true;
0942           //Denominator fill
0943           v.getMEhisto_DenominatorPt()->Fill(leadjpt);
0944           if (isBarrel(leadjeta))
0945             v.getMEhisto_DenominatorPtBarrel()->Fill(leadjpt);
0946           if (isEndCap(leadjeta))
0947             v.getMEhisto_DenominatorPtEndcap()->Fill(leadjpt);
0948           if (isForward(leadjeta))
0949             v.getMEhisto_DenominatorPtForward()->Fill(leadjpt);
0950           v.getMEhisto_DenominatorEta()->Fill(leadjeta);
0951           v.getMEhisto_DenominatorPhi()->Fill(leadjphi);
0952           v.getMEhisto_DenominatorEtaPhi()->Fill(leadjeta, leadjphi);
0953           if (isBarrel(leadjeta)) {
0954             v.getMEhisto_DenominatorEtaBarrel()->Fill(leadjeta);
0955             v.getMEhisto_DenominatorPhiBarrel()->Fill(leadjphi);
0956           }
0957           if (isEndCap(leadjeta)) {
0958             v.getMEhisto_DenominatorEtaEndcap()->Fill(leadjeta);
0959             v.getMEhisto_DenominatorPhiEndcap()->Fill(leadjphi);
0960           }
0961           if (isForward(leadjeta)) {
0962             v.getMEhisto_DenominatorEtaForward()->Fill(leadjeta);
0963             v.getMEhisto_DenominatorPhiForward()->Fill(leadjphi);
0964           }
0965           if ((leadjpt > trigLowpTcut && !isForward(leadjeta)) || (leadjpt > trigLowpTcutFwd && isForward(leadjeta))) {
0966             v.getMEhisto_DenominatorEta_LowpTcut()->Fill(leadjeta);
0967             v.getMEhisto_DenominatorPhi_LowpTcut()->Fill(leadjphi);
0968             v.getMEhisto_DenominatorEtaPhi_LowpTcut()->Fill(leadjeta, leadjphi);
0969           }
0970           if ((leadjpt > trigMedpTcut && !isForward(leadjeta)) || (leadjpt > trigMedpTcutFwd && isForward(leadjeta))) {
0971             v.getMEhisto_DenominatorEta_MedpTcut()->Fill(leadjeta);
0972             v.getMEhisto_DenominatorPhi_MedpTcut()->Fill(leadjphi);
0973             v.getMEhisto_DenominatorEtaPhi_MedpTcut()->Fill(leadjeta, leadjphi);
0974           }
0975           if ((leadjpt > trigHighpTcut && !isForward(leadjeta)) ||
0976               (leadjpt > trigHighpTcutFwd && isForward(leadjeta))) {
0977             v.getMEhisto_DenominatorEta_HighpTcut()->Fill(leadjeta);
0978             v.getMEhisto_DenominatorPhi_HighpTcut()->Fill(leadjphi);
0979             v.getMEhisto_DenominatorEtaPhi_HighpTcut()->Fill(leadjeta, leadjphi);
0980           }
0981 
0982           //Numerator fill
0983           if (numpassed) {
0984             //
0985             double dRmin = 99999.;
0986             double dPhimin = 9999.;
0987             if (v.getPath().find("L1") != std::string::npos) {
0988               if (l1Index >= triggerObj_->sizeFilters()) {
0989                 edm::LogInfo("JetMETHLTOfflineSource") << "no index hlt" << hltIndex << " of that name ";
0990               } else {
0991                 const trigger::Keys& kl1 = triggerObj_->filterKeys(l1Index);
0992                 for (unsigned short ki : kl1) {
0993                   double dR = deltaR(toc[ki].eta(), toc[ki].phi(), leadjeta, leadjphi);
0994                   if (dR < dRmin) {
0995                     dRmin = dR;
0996                   }
0997                 }
0998               }
0999             } else {
1000               if (hltIndex >= triggerObj_->sizeFilters()) {
1001                 edm::LogInfo("JetMETHLTOfflineSource") << "no index hlt" << hltIndex << " of that name ";
1002               } else {
1003                 const trigger::Keys& khlt = triggerObj_->filterKeys(hltIndex);
1004                 auto kj = khlt.begin();
1005                 for (; kj != khlt.end(); ++kj) {
1006                   double dR = deltaR(toc[*kj].eta(), toc[*kj].phi(), leadjeta, leadjphi);
1007                   if (dR < dRmin) {
1008                     dRmin = dR;
1009                   }
1010                   double dPhi = deltaPhi(toc[*kj].phi(), leadjphi);
1011                   if (dPhi < dPhimin) {
1012                     dPhimin = dPhi;
1013                   }
1014                 }
1015                 //v->getMEhisto_DeltaPhi()->Fill(dPhimin);
1016                 v.getMEhisto_DeltaPhi()->Fill(dPhimin);
1017                 v.getMEhisto_DeltaR()->Fill(dRmin);
1018               }
1019             }
1020             if (dRmin < 0.1 || (v.getPath().find("L1") != std::string::npos && dRmin < 0.4)) {
1021               v.getMEhisto_NumeratorPt()->Fill(leadjpt);
1022               if (isBarrel(leadjeta))
1023                 v.getMEhisto_NumeratorPtBarrel()->Fill(leadjpt);
1024               if (isEndCap(leadjeta))
1025                 v.getMEhisto_NumeratorPtEndcap()->Fill(leadjpt);
1026               if (isForward(leadjeta))
1027                 v.getMEhisto_NumeratorPtForward()->Fill(leadjpt);
1028               v.getMEhisto_NumeratorEta()->Fill(leadjeta);
1029               v.getMEhisto_NumeratorPhi()->Fill(leadjphi);
1030               v.getMEhisto_NumeratorEtaPhi()->Fill(leadjeta, leadjphi);
1031               if (isBarrel(leadjeta)) {
1032                 v.getMEhisto_NumeratorEtaBarrel()->Fill(leadjeta);
1033                 v.getMEhisto_NumeratorPhiBarrel()->Fill(leadjphi);
1034               }
1035               if (isEndCap(leadjeta)) {
1036                 v.getMEhisto_NumeratorEtaEndcap()->Fill(leadjeta);
1037                 v.getMEhisto_NumeratorPhiEndcap()->Fill(leadjphi);
1038               }
1039               if (isForward(leadjeta)) {
1040                 v.getMEhisto_NumeratorEtaForward()->Fill(leadjeta);
1041                 v.getMEhisto_NumeratorPhiForward()->Fill(leadjphi);
1042               }
1043               if ((leadjpt > trigLowpTcut && !isForward(leadjeta)) ||
1044                   (leadjpt > trigLowpTcutFwd && isForward(leadjeta))) {
1045                 v.getMEhisto_NumeratorEta_LowpTcut()->Fill(leadjeta);
1046                 v.getMEhisto_NumeratorPhi_LowpTcut()->Fill(leadjphi);
1047                 v.getMEhisto_NumeratorEtaPhi_LowpTcut()->Fill(leadjeta, leadjphi);
1048               }
1049               if ((leadjpt > trigMedpTcut && !isForward(leadjeta)) ||
1050                   (leadjpt > trigMedpTcutFwd && isForward(leadjeta))) {
1051                 v.getMEhisto_NumeratorEta_MedpTcut()->Fill(leadjeta);
1052                 v.getMEhisto_NumeratorPhi_MedpTcut()->Fill(leadjphi);
1053                 v.getMEhisto_NumeratorEtaPhi_MedpTcut()->Fill(leadjeta, leadjphi);
1054               }
1055               if ((leadjpt > trigHighpTcut && !isForward(leadjeta)) ||
1056                   (leadjpt > trigHighpTcutFwd && isForward(leadjeta))) {
1057                 v.getMEhisto_NumeratorEta_HighpTcut()->Fill(leadjeta);
1058                 v.getMEhisto_NumeratorPhi_HighpTcut()->Fill(leadjphi);
1059                 v.getMEhisto_NumeratorEtaPhi_HighpTcut()->Fill(leadjeta, leadjphi);
1060               }
1061             }
1062           }  //numpassed
1063         }  //CalojetID filter
1064       }
1065 
1066       if (jetIDbool == true && (v.getTriggerType() == "DiJet_Trigger") && calojet.size() > 1) {
1067         if (((CaloJetEMF[1] > _fEMF || std::abs(CaloJetEta[1]) > _feta) && CaloJetfHPD[0] < _fHPD &&
1068              CaloJetn90[0] > _n90Hits)) {
1069           v.getMEhisto_DenominatorPt()->Fill((CaloJetPt[0] + CaloJetPt[1]) / 2.);
1070           v.getMEhisto_DenominatorEta()->Fill((CaloJetEta[0] + CaloJetEta[1]) / 2.);
1071           if (numpassed == true) {
1072             v.getMEhisto_NumeratorPt()->Fill((CaloJetPt[0] + CaloJetPt[1]) / 2.);
1073             v.getMEhisto_NumeratorEta()->Fill((CaloJetEta[0] + CaloJetEta[1]) / 2.);
1074           }
1075         }
1076       }
1077     }  // Jet trigger and valid jet collection
1078 
1079     //PFJet paths
1080     if (verbose_)
1081       std::cout << "fillMEforEffAllTrigger: PFJet -------------------" << std::endl;
1082     if (pfjetColl_.isValid() && (v.getObjectType() == trigger::TriggerJet)) {
1083       //cout<<"   - PFJet "<<endl;
1084       //&& (v->getPath().find("HLT_PFJet")!=std::string::npos)
1085       //&& (v->getPath().find("HLT_DiPFJet")!=std::string::npos)){
1086       bool jetIDbool = false;
1087       double leadjpt = PFJetPt[0];
1088       double leadjeta = PFJetEta[0];
1089       double leadjphi = PFJetPhi[0];
1090       double ljNHEF = PFJetNHEF[0];
1091       double ljCHEF = PFJetCHEF[0];
1092       double ljNEMF = PFJetNEMF[0];
1093       double ljCEMF = PFJetCEMF[0];
1094       //double sleadjpt  = PFJetPt[1];
1095       //double sleadjeta = PFJetEta[1];
1096       //double sleadjphi = PFJetPhi[1];
1097       double sljNHEF = PFJetNHEF[1];
1098       double sljCHEF = PFJetCHEF[1];
1099       double sljNEMF = PFJetNEMF[1];
1100       double sljCEMF = PFJetCEMF[1];
1101       //
1102       double pfMHTx = pfMHTx_All;
1103       double pfMHTy = pfMHTy_All;
1104       //
1105       if ((v.getTriggerType() == "SingleJet_Trigger") && !pfjet.empty()) {  //this line stops the central jets
1106 
1107         //======get pfmht
1108         _pfMHT = sqrt(pfMHTx * pfMHTx + pfMHTy * pfMHTy);
1109         v.getMEhisto_DenominatorPFMHT()->Fill(_pfMHT);
1110 
1111         if (ljNHEF >= _min_NHEF && ljNHEF <= _max_NHEF && ljCHEF >= _min_CHEF && ljCHEF <= _max_CHEF &&
1112             ljNEMF >= _min_NEMF && ljNEMF <= _max_NEMF && ljCEMF >= _min_CEMF && ljCEMF <= _max_CEMF) {
1113           if (verbose_)
1114             cout << "Passed PFJet ID -------------------" << endl;
1115           jetIDbool = true;
1116           v.getMEhisto_DenominatorPFPt()->Fill(leadjpt);
1117           if (isBarrel(leadjeta))
1118             v.getMEhisto_DenominatorPFPtBarrel()->Fill(leadjpt);
1119           if (isEndCap(leadjeta))
1120             v.getMEhisto_DenominatorPFPtEndcap()->Fill(leadjpt);
1121           if (isForward(leadjeta))
1122             v.getMEhisto_DenominatorPFPtForward()->Fill(leadjpt);
1123           v.getMEhisto_DenominatorPFEta()->Fill(leadjeta);
1124           v.getMEhisto_DenominatorPFPhi()->Fill(leadjphi);
1125           v.getMEhisto_DenominatorPFEtaPhi()->Fill(leadjeta, leadjphi);
1126           if (isBarrel(leadjeta)) {
1127             v.getMEhisto_DenominatorPFEtaBarrel()->Fill(leadjeta);
1128             v.getMEhisto_DenominatorPFPhiBarrel()->Fill(leadjphi);
1129           }
1130           if (isEndCap(leadjeta)) {
1131             v.getMEhisto_DenominatorPFEtaEndcap()->Fill(leadjeta);
1132             v.getMEhisto_DenominatorPFPhiEndcap()->Fill(leadjphi);
1133           }
1134           if (isForward(leadjeta)) {
1135             v.getMEhisto_DenominatorPFEtaForward()->Fill(leadjeta);
1136             v.getMEhisto_DenominatorPFPhiForward()->Fill(leadjphi);
1137           }
1138           if ((leadjpt > trigLowpTPFcut && !isForward(leadjeta)) ||
1139               (leadjpt > trigLowpTPFcutFwd && isForward(leadjeta))) {
1140             v.getMEhisto_DenominatorPFEta_LowpTcut()->Fill(leadjeta);
1141             v.getMEhisto_DenominatorPFPhi_LowpTcut()->Fill(leadjphi);
1142             v.getMEhisto_DenominatorPFEtaPhi_LowpTcut()->Fill(leadjeta, leadjphi);
1143           }
1144           if ((leadjpt > trigMedpTPFcut && !isForward(leadjeta)) ||
1145               (leadjpt > trigMedpTPFcutFwd && isForward(leadjeta))) {
1146             v.getMEhisto_DenominatorPFEta_MedpTcut()->Fill(leadjeta);
1147             v.getMEhisto_DenominatorPFPhi_MedpTcut()->Fill(leadjphi);
1148             v.getMEhisto_DenominatorPFEtaPhi_MedpTcut()->Fill(leadjeta, leadjphi);
1149           }
1150           if ((leadjpt > trigHighpTPFcut && !isForward(leadjeta)) ||
1151               (leadjpt > trigHighpTPFcutFwd && isForward(leadjeta))) {
1152             v.getMEhisto_DenominatorPFEta_HighpTcut()->Fill(leadjeta);
1153             v.getMEhisto_DenominatorPFPhi_HighpTcut()->Fill(leadjphi);
1154             v.getMEhisto_DenominatorPFEtaPhi_HighpTcut()->Fill(leadjeta, leadjphi);
1155           }
1156 
1157           //Numerator fill
1158           if (numpassed) {
1159             double dRmin = 99999.;
1160             double dPhimin = 9999.;
1161             if (v.getPath().find("L1") != std::string::npos) {
1162               if (l1Index >= triggerObj_->sizeFilters()) {
1163                 edm::LogInfo("JetMETHLTOfflineSource") << "no index hlt" << hltIndex << " of that name ";
1164               } else {
1165                 const trigger::Keys& kl1 = triggerObj_->filterKeys(l1Index);
1166                 for (unsigned short ki : kl1) {
1167                   double dR = deltaR(toc[ki].eta(), toc[ki].phi(), leadjeta, leadjphi);
1168                   if (dR < dRmin) {
1169                     dRmin = dR;
1170                   }
1171                 }
1172               }
1173             } else {
1174               if (hltIndex >= triggerObj_->sizeFilters()) {
1175                 edm::LogInfo("JetMETHLTOfflineSource") << "no index hlt" << hltIndex << " of that name ";
1176               } else {
1177                 const trigger::Keys& khlt = triggerObj_->filterKeys(hltIndex);
1178                 for (unsigned short kj : khlt) {
1179                   double dR = deltaR(toc[kj].eta(), toc[kj].phi(), leadjeta, leadjphi);
1180                   if (dR < dRmin) {
1181                     dRmin = dR;
1182                   }
1183                   double dPhi = deltaPhi(toc[kj].phi(), leadjphi);
1184                   if (dPhi < dPhimin) {
1185                     dPhimin = dPhi;
1186                   }
1187                 }
1188                 v.getMEhisto_PFDeltaPhi()->Fill(dPhimin);
1189                 v.getMEhisto_PFDeltaR()->Fill(dRmin);
1190               }
1191             }
1192             if (dRmin < 0.1 || (v.getPath().find("L1") != std::string::npos && dRmin < 0.4)) {
1193               v.getMEhisto_NumeratorPFPt()->Fill(leadjpt);
1194               if (isBarrel(leadjeta))
1195                 v.getMEhisto_NumeratorPFPtBarrel()->Fill(leadjpt);
1196               if (isEndCap(leadjeta))
1197                 v.getMEhisto_NumeratorPFPtEndcap()->Fill(leadjpt);
1198               if (isForward(leadjeta))
1199                 v.getMEhisto_NumeratorPFPtForward()->Fill(leadjpt);
1200               v.getMEhisto_NumeratorPFEta()->Fill(leadjeta);
1201               v.getMEhisto_NumeratorPFPhi()->Fill(leadjphi);
1202               v.getMEhisto_NumeratorPFEtaPhi()->Fill(leadjeta, leadjphi);
1203               if (isBarrel(leadjeta)) {
1204                 v.getMEhisto_NumeratorPFEtaBarrel()->Fill(leadjeta);
1205                 v.getMEhisto_NumeratorPFPhiBarrel()->Fill(leadjphi);
1206               }
1207               if (isEndCap(leadjeta)) {
1208                 v.getMEhisto_NumeratorPFEtaEndcap()->Fill(leadjeta);
1209                 v.getMEhisto_NumeratorPFPhiEndcap()->Fill(leadjphi);
1210               }
1211               if (isForward(leadjeta)) {
1212                 v.getMEhisto_NumeratorPFEtaForward()->Fill(leadjeta);
1213                 v.getMEhisto_NumeratorPFPhiForward()->Fill(leadjphi);
1214               }
1215               if ((leadjpt > trigLowpTPFcut && !isForward(leadjeta)) ||
1216                   (leadjpt > trigLowpTPFcutFwd && isForward(leadjeta))) {
1217                 v.getMEhisto_NumeratorPFEta_LowpTcut()->Fill(leadjeta);
1218                 v.getMEhisto_NumeratorPFPhi_LowpTcut()->Fill(leadjphi);
1219                 v.getMEhisto_NumeratorPFEtaPhi_LowpTcut()->Fill(leadjeta, leadjphi);
1220               }
1221               if ((leadjpt > trigMedpTPFcut && !isForward(leadjeta)) ||
1222                   (leadjpt > trigMedpTPFcutFwd && isForward(leadjeta))) {
1223                 v.getMEhisto_NumeratorPFEta_MedpTcut()->Fill(leadjeta);
1224                 v.getMEhisto_NumeratorPFPhi_MedpTcut()->Fill(leadjphi);
1225                 v.getMEhisto_NumeratorPFEtaPhi_MedpTcut()->Fill(leadjeta, leadjphi);
1226               }
1227               if ((leadjpt > trigHighpTPFcut && !isForward(leadjeta)) ||
1228                   (leadjpt > trigHighpTPFcutFwd && isForward(leadjeta))) {
1229                 v.getMEhisto_NumeratorPFEta_HighpTcut()->Fill(leadjeta);
1230                 v.getMEhisto_NumeratorPFPhi_HighpTcut()->Fill(leadjphi);
1231                 v.getMEhisto_NumeratorPFEtaPhi_HighpTcut()->Fill(leadjeta, leadjphi);
1232               }
1233             }
1234           }
1235         }
1236       }
1237       if (jetIDbool == true && (v.getTriggerType() == "DiJet_Trigger") && pfjet.size() > 1) {
1238         if (ljNHEF >= _min_NHEF && ljNHEF <= _max_NHEF && ljCHEF >= _min_CHEF && ljCHEF <= _max_CHEF &&
1239             ljNEMF >= _min_NEMF && ljNEMF <= _max_NEMF && ljCEMF >= _min_CEMF && ljCEMF <= _max_CEMF &&
1240             sljNHEF >= _min_NHEF && sljNHEF <= _max_NHEF && sljCHEF >= _min_CHEF && sljCHEF <= _max_CHEF &&
1241             sljNEMF >= _min_NEMF && sljNEMF <= _max_NEMF && sljCEMF >= _min_CEMF && sljCEMF <= _max_CEMF) {
1242           v.getMEhisto_DenominatorPFPt()->Fill((PFJetPt[0] + PFJetPt[1]) / 2.);
1243           v.getMEhisto_DenominatorPFEta()->Fill((PFJetEta[0] + PFJetEta[1]) / 2.);
1244           if (numpassed) {
1245             v.getMEhisto_NumeratorPFPt()->Fill((PFJetPt[0] + PFJetPt[1]) / 2.);
1246             v.getMEhisto_NumeratorPFEta()->Fill((PFJetEta[0] + PFJetEta[1]) / 2.);
1247           }
1248         }
1249       }
1250     }  // PF Jet trigger and valid jet collection
1251 
1252     //CaloMET path
1253     if (verbose_)
1254       std::cout << "fillMEforEffAllTrigger: CaloMET -------------------" << std::endl;
1255     if (calometColl_.isValid() &&
1256         ((v.getObjectType() == trigger::TriggerMET) || (v.getObjectType() == trigger::TriggerTET)) &&
1257         (v.getPath().find("HLT_PFMET") == std::string::npos)) {
1258       const CaloMETCollection* calometcol = calometColl_.product();
1259       const CaloMET met = calometcol->front();
1260       v.getMEhisto_DenominatorPt()->Fill(met.et());
1261       v.getMEhisto_DenominatorPhi()->Fill(met.phi());
1262       if (numpassed) {
1263         v.getMEhisto_NumeratorPt()->Fill(met.et());
1264         v.getMEhisto_NumeratorPhi()->Fill(met.phi());
1265         if (hltIndex >= triggerObj_->sizeFilters()) {
1266           edm::LogInfo("JetMETHLTOfflineSource") << "no index hlt" << hltIndex << " of that name ";
1267         } else {
1268           double dPhimin = 9999.;  //
1269           const trigger::Keys& khlt = triggerObj_->filterKeys(hltIndex);
1270           for (unsigned short kj : khlt) {
1271             double dPhi = deltaPhi(toc[kj].phi(), met.phi());
1272             if (dPhi < dPhimin) {
1273               dPhimin = dPhi;
1274             }
1275           }
1276           v.getMEhisto_DeltaPhi()->Fill(dPhimin);
1277         }
1278       }
1279     }
1280 
1281     //PFMET
1282     if (verbose_)
1283       std::cout << "fillMEforEffAllTrigger: PFMET -------------------" << std::endl;
1284     if (pfmetColl_.isValid() &&
1285         ((v.getObjectType() == trigger::TriggerMET) || (v.getObjectType() == trigger::TriggerTET)) &&
1286         (v.getPath().find("HLT_PFMET") != std::string::npos)) {
1287       const PFMETCollection* pfmetcol = pfmetColl_.product();
1288       const PFMET met = pfmetcol->front();
1289       v.getMEhisto_DenominatorPt()->Fill(met.et());
1290       v.getMEhisto_DenominatorPhi()->Fill(met.phi());
1291       if (numpassed) {
1292         v.getMEhisto_NumeratorPt()->Fill(met.et());
1293         v.getMEhisto_NumeratorPhi()->Fill(met.phi());
1294         if (hltIndex >= triggerObj_->sizeFilters()) {
1295           edm::LogInfo("JetMETHLTOfflineSource") << "no index hlt" << hltIndex << " of that name ";
1296         } else {
1297           double dPhimin = 9999.;  //
1298           const trigger::Keys& khlt = triggerObj_->filterKeys(hltIndex);
1299           for (unsigned short kj : khlt) {
1300             double dPhi = deltaPhi(toc[kj].phi(), met.phi());
1301             if (dPhi < dPhimin) {
1302               dPhimin = dPhi;
1303             }
1304           }
1305           v.getMEhisto_DeltaPhi()->Fill(dPhimin);
1306         }
1307       }
1308     }
1309 
1310     /*
1311       if(pfmhtColl_.isValid() && ((v->getObjectType() == trigger::TriggerMET)|| (v->getObjectType() == trigger::TriggerTET))){
1312       const PFMHTCollection *pfmhtcol = pfmhtColl_.product();
1313       const PFMHT met = pfmhtcol->front();
1314       v->getMEhisto_DenominatorPFPt()->Fill(met.pt());
1315       v->getMEhisto_DenominatorPFPhi()->Fill(met.phi());
1316       }// PFMHT  trigger and valid MET collection 
1317     */
1318   }  // trigger under study
1319 }
1320 
1321 //------------------------------------------------------------------------//
1322 //This method is called before the booking action in the DQMStore is triggered.
1323 void JetMETHLTOfflineSource::dqmBeginRun(edm::Run const& run, edm::EventSetup const& c) {
1324   if (!isSetup_) {
1325     //--- htlConfig_
1326     bool changed(true);
1327     if (!hltConfig_.init(run, c, processname_, changed)) {
1328       LogDebug("HLTJetMETDQMSource") << "HLTConfigProvider failed to initialize.";
1329     }
1330 
1331     /*
1332       Here we select the Single Jet, DiJet, MET trigger. SingleJet and DiJet trigger are saved under same object type "TriggerJet". 
1333       We can easily separate out single and di jet trigger later. For the first trigger in the list, denominator trigger is dummy 
1334       (empty) whereas for other triggers denom is previous trigger of same type. e.g. SingleJet50 has singleJet30 as denominator.
1335     */
1336 
1337     const unsigned int n(hltConfig_.size());
1338     int singleJet = 0;
1339     int diJet = 0;
1340     int met = 0;
1341     int tet = 0;
1342     for (unsigned int i = 0; i != n; ++i) {
1343       bool denomFound = false;
1344       bool numFound = false;
1345       bool checkPath = false;
1346 
1347       //Look for paths if "path name fraction" is found in the pathname
1348       std::string pathname = hltConfig_.triggerName(i);
1349       //Filter only paths JetMET triggers are interested in
1350       auto controlPathname = pathFilter_.begin();
1351       for (; controlPathname != pathFilter_.end(); ++controlPathname) {
1352         if (pathname.find((*controlPathname)) != std::string::npos) {
1353           checkPath = true;
1354           break;
1355         }
1356       }
1357       if (checkPath == false)
1358         continue;
1359 
1360       //Reject if keyword(s) is found in the pathname
1361       auto rejectPathname = pathRejectKeyword_.begin();
1362       for (; rejectPathname != pathRejectKeyword_.end(); ++rejectPathname) {
1363         if (pathname.find((*rejectPathname)) != std::string::npos) {
1364           checkPath = false;
1365           break;
1366         }
1367       }
1368       if (checkPath == false)
1369         continue;
1370 
1371       //
1372       if (verbose_)
1373         cout << "==pathname==" << pathname << endl;
1374       std::string dpathname = MuonTrigPaths_[0];
1375       std::string l1pathname = "dummy";
1376       std::string denompathname = "";
1377       unsigned int usedPrescale = 1;
1378       unsigned int objectType = 0;
1379       std::string triggerType = "";
1380       std::string filtername("dummy");
1381       std::string Denomfiltername("denomdummy");
1382 
1383       if (pathname.find("Jet") != std::string::npos && !(pathname.find("DoubleJet") != std::string::npos) &&
1384           !(pathname.find("DiJet") != std::string::npos) && !(pathname.find("DiPFJet") != std::string::npos) &&
1385           !(pathname.find("BTag") != std::string::npos) && !(pathname.find("Mu") != std::string::npos) &&
1386           !(pathname.find("Fwd") != std::string::npos)) {
1387         triggerType = "SingleJet_Trigger";
1388         objectType = trigger::TriggerJet;
1389       }
1390       if (pathname.find("DiJet") != std::string::npos || pathname.find("DiPFJet") != std::string::npos ||
1391           pathname.find("DoubleJet") != std::string::npos) {
1392         triggerType = "DiJet_Trigger";
1393         objectType = trigger::TriggerJet;
1394       }
1395       if (pathname.find("MET") != std::string::npos) {
1396         triggerType = "MET_Trigger";
1397         objectType = trigger::TriggerMET;
1398       }
1399       if (pathname.find("HT") != std::string::npos) {
1400         triggerType = "TET_Trigger";
1401         objectType = trigger::TriggerTET;
1402       }
1403 
1404       //
1405       if (objectType == trigger::TriggerJet && !(pathname.find("DiJet") != std::string::npos) &&
1406           !(pathname.find("DiPFJet") != std::string::npos) && !(pathname.find("DoubleJet") != std::string::npos)) {
1407         singleJet++;
1408         if (singleJet > 1)
1409           dpathname = dpathname = hltConfig_.triggerName(i - 1);
1410         if (singleJet == 1)
1411           dpathname = MuonTrigPaths_[0];
1412       }
1413       if (objectType == trigger::TriggerJet &&
1414           ((pathname.find("DiJet") != std::string::npos) || (pathname.find("DiPFJet") != std::string::npos))) {
1415         diJet++;
1416         if (diJet > 1)
1417           dpathname = dpathname = hltConfig_.triggerName(i - 1);
1418         if (diJet == 1)
1419           dpathname = MuonTrigPaths_[0];
1420       }
1421       if (objectType == trigger::TriggerMET) {
1422         met++;
1423         if (met > 1)
1424           dpathname = dpathname = hltConfig_.triggerName(i - 1);
1425         if (met == 1)
1426           dpathname = MuonTrigPaths_[0];
1427       }
1428       if (objectType == trigger::TriggerTET) {
1429         tet++;
1430         if (tet > 1)
1431           dpathname = dpathname = hltConfig_.triggerName(i - 1);
1432         if (tet == 1)
1433           dpathname = MuonTrigPaths_[0];
1434       }
1435 
1436       // find L1 condition for numpath with numpath objecttype
1437       // find PSet for L1 global seed for numpath,sss
1438       // list module labels for numpath
1439 
1440       // Checking if the trigger exist in HLT table or not
1441       for (unsigned int i = 0; i != n; ++i) {
1442         std::string HLTname = hltConfig_.triggerName(i);
1443         if (HLTname == pathname)
1444           numFound = true;
1445         if (HLTname == dpathname)
1446           denomFound = true;
1447       }
1448 
1449       if (numFound) {  //make trigger exist in the menu
1450         //ml needs change l1pathname
1451         l1pathname = getL1ConditionModuleName(pathname);  //ml added L1conditionmodulename
1452         //ml added
1453         std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
1454         for (auto& numpathmodule : numpathmodules) {
1455           edm::InputTag testTag(numpathmodule, "", processname_);
1456           if ((hltConfig_.moduleType(numpathmodule) == "HLT1CaloJet") ||
1457               (hltConfig_.moduleType(numpathmodule) == "HLT1PFJet") ||
1458               (hltConfig_.moduleType(numpathmodule) == "HLTDiJetAveFilter") ||
1459               (hltConfig_.moduleType(numpathmodule) == "HLTDiPFJetAveFilter") ||
1460               (hltConfig_.moduleType(numpathmodule) == "HLT1CaloMET") ||
1461               (hltConfig_.moduleType(numpathmodule) == "HLTMhtFilter") ||
1462               (hltConfig_.moduleType(numpathmodule) == "HLTPrescaler"))
1463             filtername = numpathmodule;
1464         }
1465       }
1466 
1467       if (objectType != 0 && denomFound) {
1468         std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(dpathname);
1469         for (auto& numpathmodule : numpathmodules) {
1470           edm::InputTag testTag(numpathmodule, "", processname_);
1471           if ((hltConfig_.moduleType(numpathmodule) == "HLT1CaloJet") ||
1472               (hltConfig_.moduleType(numpathmodule) == "HLT1PFJet") ||
1473               (hltConfig_.moduleType(numpathmodule) == "HLTDiJetAveFilter") ||
1474               (hltConfig_.moduleType(numpathmodule) == "HLTDiPFJetAveFilter") ||
1475               (hltConfig_.moduleType(numpathmodule) == "HLT1CaloMET") ||
1476               (hltConfig_.moduleType(numpathmodule) == "HLTMhtFilter") ||
1477               (hltConfig_.moduleType(numpathmodule) == "HLTPrescaler"))
1478             Denomfiltername = numpathmodule;
1479         }
1480       }
1481 
1482       if (objectType != 0 && numFound) {
1483         if (verbose_)
1484           cout << "=Pathname= " << pathname << " | =Denompath= " << dpathname << " | =Filtername= " << filtername
1485                << " | =Denomfiltername= " << Denomfiltername << " | =L1pathname= " << l1pathname
1486                << " | =ObjectType= " << objectType << endl;
1487         if (!((pathname.find("HT") != std::string::npos) || (pathname.find("Quad") != std::string::npos))) {
1488           hltPathsAll_.push_back(PathInfo(usedPrescale,
1489                                           dpathname,
1490                                           pathname,
1491                                           l1pathname,
1492                                           filtername,
1493                                           Denomfiltername,
1494                                           processname_,
1495                                           objectType,
1496                                           triggerType));
1497           if (!nameForEff_ && denomFound)
1498             hltPathsEff_.push_back(PathInfo(usedPrescale,
1499                                             dpathname,
1500                                             pathname,
1501                                             l1pathname,
1502                                             filtername,
1503                                             Denomfiltername,
1504                                             processname_,
1505                                             objectType,
1506                                             triggerType));
1507         }
1508         hltPathsAllTriggerSummary_.push_back(PathInfo(usedPrescale,
1509                                                       dpathname,
1510                                                       pathname,
1511                                                       l1pathname,
1512                                                       filtername,
1513                                                       Denomfiltername,
1514                                                       processname_,
1515                                                       objectType,
1516                                                       triggerType));
1517       }
1518     }  //Loop over paths
1519 
1520     if (verbose_)
1521       cout << "get names for efficicncy------------------" << endl;
1522     //---------bool to pick trigger names pair from config file-------------
1523     if (nameForEff_) {
1524       std::string l1pathname = "dummy";
1525       std::string denompathname = "";
1526       unsigned int usedPrescale = 1;
1527       unsigned int objectType = 0;
1528       std::string triggerType = "";
1529       std::string filtername("dummy");
1530       std::string Denomfiltername("denomdummy");
1531       for (auto& custompathnamepair : custompathnamepairs_) {
1532         std::string pathname = custompathnamepair.first;
1533         std::string dpathname = custompathnamepair.second;
1534         bool numFound = false;
1535         bool denomFound = false;
1536         // Checking if the trigger exist in HLT table or not
1537         for (unsigned int i = 0; i != n; ++i) {
1538           std::string HLTname = hltConfig_.triggerName(i);
1539           if (HLTname.find(pathname) != std::string::npos) {
1540             numFound = true;
1541             pathname = HLTname;
1542           }  //changed to get versions
1543           if (HLTname.find(dpathname) != std::string::npos) {
1544             denomFound = true;
1545             dpathname = HLTname;
1546           }
1547         }
1548         if (numFound && denomFound) {
1549           if (pathname.find("Jet") != std::string::npos && !(pathname.find("DiJet") != std::string::npos) &&
1550               !(pathname.find("DiPFJet") != std::string::npos) && !(pathname.find("DoubleJet") != std::string::npos) &&
1551               !(pathname.find("BTag") != std::string::npos) && !(pathname.find("Mu") != std::string::npos) &&
1552               !(pathname.find("Fwd") != std::string::npos)) {
1553             triggerType = "SingleJet_Trigger";
1554             objectType = trigger::TriggerJet;
1555           }
1556           if (pathname.find("DiJet") != std::string::npos || pathname.find("DiPFJet") != std::string::npos ||
1557               pathname.find("DoubleJet") != std::string::npos) {
1558             triggerType = "DiJet_Trigger";
1559             objectType = trigger::TriggerJet;
1560           }
1561           if (pathname.find("MET") != std::string::npos) {
1562             triggerType = "MET_Trigger";
1563             objectType = trigger::TriggerMET;
1564           }
1565           if (pathname.find("TET") != std::string::npos) {
1566             triggerType = "TET_Trigger";
1567             objectType = trigger::TriggerTET;
1568           }
1569 
1570           l1pathname = getL1ConditionModuleName(pathname);  //ml added L1conditionmodulename
1571           std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
1572           for (auto& numpathmodule : numpathmodules) {
1573             edm::InputTag testTag(numpathmodule, "", processname_);
1574             if ((hltConfig_.moduleType(numpathmodule) == "HLT1CaloJet") ||
1575                 (hltConfig_.moduleType(numpathmodule) == "HLT1PFJet") ||
1576                 (hltConfig_.moduleType(numpathmodule) == "HLTDiJetAveFilter") ||
1577                 (hltConfig_.moduleType(numpathmodule) == "HLTDiPFJetAveFilter") ||
1578                 (hltConfig_.moduleType(numpathmodule) == "HLT1CaloMET") ||
1579                 (hltConfig_.moduleType(numpathmodule) == "HLTMhtFilter") ||
1580                 (hltConfig_.moduleType(numpathmodule) == "HLTPrescaler"))
1581               filtername = numpathmodule;
1582           }
1583 
1584           if (objectType != 0) {
1585             std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(dpathname);
1586             for (auto& numpathmodule : numpathmodules) {
1587               edm::InputTag testTag(numpathmodule, "", processname_);
1588               if ((hltConfig_.moduleType(numpathmodule) == "HLT1CaloJet") ||
1589                   (hltConfig_.moduleType(numpathmodule) == "HLT1PFJet") ||
1590                   (hltConfig_.moduleType(numpathmodule) == "HLTDiJetAveFilter") ||
1591                   (hltConfig_.moduleType(numpathmodule) == "HLTDiPFJetAveFilter") ||
1592                   (hltConfig_.moduleType(numpathmodule) == "HLT1CaloMET") ||
1593                   (hltConfig_.moduleType(numpathmodule) == "HLTMhtFilter") ||
1594                   (hltConfig_.moduleType(numpathmodule) == "HLTPrescaler"))
1595                 Denomfiltername = numpathmodule;
1596             }
1597 
1598             if (verbose_)
1599               cout << "==pathname==" << pathname << "==denompath==" << dpathname << "==filtername==" << filtername
1600                    << "==denomfiltername==" << Denomfiltername << "==l1pathname==" << l1pathname
1601                    << "==objectType==" << objectType << endl;
1602             hltPathsEff_.push_back(PathInfo(usedPrescale,
1603                                             dpathname,
1604                                             pathname,
1605                                             l1pathname,
1606                                             filtername,
1607                                             Denomfiltername,
1608                                             processname_,
1609                                             objectType,
1610                                             triggerType));
1611           }
1612         }
1613       }
1614     }
1615 
1616     if (verbose_)
1617       cout << "== end hltPathsEff_.push_back ======" << endl;
1618   }
1619 }
1620 
1621 //------------------------------------------------------------------------//
1622 void JetMETHLTOfflineSource::bookHistograms(DQMStore::IBooker& iBooker, edm::Run const& run, edm::EventSetup const& c) {
1623   if (!isSetup_) {
1624     iBooker.setCurrentFolder(dirname_);
1625 
1626     //-----------------------------------------------------------------
1627     //---book trigger summary histos
1628     if (!isSetup_) {
1629       std::string foldernm = "/TriggerSummary/";
1630       iBooker.setCurrentFolder(dirname_ + foldernm);
1631 
1632       int TrigBins_ = hltPathsAllTriggerSummary_.size();
1633       double TrigMin_ = -0.5;
1634       double TrigMax_ = hltPathsAllTriggerSummary_.size() - 0.5;
1635 
1636       std::string histonm = "JetMET_TriggerRate";
1637       std::string histot = "JetMET TriggerRate Summary";
1638       rate_All = iBooker.book1D(histonm.c_str(), histot.c_str(), TrigBins_, TrigMin_, TrigMax_);
1639 
1640       histonm = "JetMET_TriggerRate_Correlation";
1641       histot = "JetMET TriggerRate Correlation Summary;y&&!x;x&&y";
1642       correlation_All =
1643           iBooker.book2D(histonm.c_str(), histot.c_str(), TrigBins_, TrigMin_, TrigMax_, TrigBins_, TrigMin_, TrigMax_);
1644 
1645       histonm = "JetMET_NVertices";
1646       histot = "No. of vertices";
1647       NVertices = iBooker.book1D(histonm.c_str(), histot.c_str(), 100, 0, 50);
1648 
1649       histonm = "JetMET_PVZ";
1650       histot = "Primary Vertex Z pos";
1651       PVZ = iBooker.book1D(histonm.c_str(), histot.c_str(), 100, -50., 50.);
1652 
1653       if (runStandalone_) {
1654         histonm = "JetMET_TriggerRate_WrtMuTrigger";
1655         histot = "JetMET TriggerRate Summary Wrt Muon Trigger ";
1656         rate_AllWrtMu = iBooker.book1D(histonm.c_str(), histot.c_str(), TrigBins_, TrigMin_, TrigMax_);
1657 
1658         histonm = "JetMET_TriggerRate_Correlation_WrtMuTrigger";
1659         histot = "JetMET TriggerRate Correlation Summary Wrt Muon Trigger;y&&!x;x&&y";
1660         correlation_AllWrtMu = iBooker.book2D(
1661             histonm.c_str(), histot.c_str(), TrigBins_, TrigMin_, TrigMax_, TrigBins_, TrigMin_, TrigMax_);
1662 
1663         histonm = "JetMET_TriggerRate_WrtMBTrigger";
1664         histot = "JetMET TriggerRate Summary Wrt MB Trigger";
1665         rate_AllWrtMB = iBooker.book1D(histonm.c_str(), histot.c_str(), TrigBins_, TrigMin_, TrigMax_);
1666 
1667         histonm = "JetMET_TriggerRate_Correlation_WrtMBTrigger";
1668         histot = "JetMET TriggerRate Correlation Wrt MB Trigger;y&&!x;x&&y";
1669         correlation_AllWrtMB = iBooker.book2D(
1670             histonm.c_str(), histot.c_str(), TrigBins_, TrigMin_, TrigMax_, TrigBins_, TrigMin_, TrigMax_);
1671       }
1672       isSetup_ = true;
1673     }
1674     //---Set bin label
1675 
1676     for (auto& v : hltPathsAllTriggerSummary_) {
1677       std::string labelnm("dummy");
1678       labelnm = v.getPath();
1679       int nbins = rate_All->getTH1()->GetNbinsX();
1680       for (int ibin = 1; ibin < nbins + 1; ibin++) {
1681         const char* binLabel = rate_All->getTH1()->GetXaxis()->GetBinLabel(ibin);
1682         std::string binLabel_str = string(binLabel);
1683         if (binLabel_str == labelnm)
1684           break;
1685         if (binLabel[0] == '\0') {
1686           rate_All->setBinLabel(ibin, labelnm);
1687           correlation_All->setBinLabel(ibin, labelnm, 1);
1688           correlation_All->setBinLabel(ibin, labelnm, 2);
1689           if (runStandalone_) {
1690             rate_AllWrtMu->setBinLabel(ibin, labelnm);
1691             rate_AllWrtMB->setBinLabel(ibin, labelnm);
1692             correlation_AllWrtMu->setBinLabel(ibin, labelnm, 1);
1693             correlation_AllWrtMB->setBinLabel(ibin, labelnm, 1);
1694             correlation_AllWrtMu->setBinLabel(ibin, labelnm, 2);
1695             correlation_AllWrtMB->setBinLabel(ibin, labelnm, 2);
1696           }
1697           break;
1698         }
1699       }
1700     }
1701 
1702     // Now define histos for All triggers
1703     if (plotAll_) {
1704       //
1705       int Nbins_ = 10;
1706       double Nmin_ = -0.5;
1707       double Nmax_ = 9.5;
1708       //
1709       int Ptbins_ = 100;
1710       if (runStandalone_)
1711         Ptbins_ = 1000;
1712       double PtMin_ = 0.;
1713       double PtMax_ = 1000.;
1714       //
1715       int Etabins_ = 50;
1716       if (runStandalone_)
1717         Etabins_ = 100;
1718       double EtaMin_ = -5.;
1719       double EtaMax_ = 5.;
1720       //
1721       int Phibins_ = 35;
1722       double PhiMin_ = -3.5;
1723       double PhiMax_ = 3.5;
1724 
1725       int Resbins_ = 30;
1726       double ResMin_ = -1.5;
1727       double ResMax_ = 1.5;
1728       //
1729       std::string dirName = dirname_ + "/MonitorAllTriggers/";
1730       for (auto& v : hltPathsAll_) {
1731         //
1732         std::string trgPathName = HLTConfigProvider::removeVersion(v.getPath());
1733         std::string subdirName = dirName + trgPathName;
1734         std::string trigPath = "(" + trgPathName + ")";
1735         iBooker.setCurrentFolder(subdirName);
1736 
1737         std::string labelname("ME");
1738         std::string histoname(labelname + "");
1739         std::string title(labelname + "");
1740 
1741         MonitorElement* dummy;
1742         dummy = iBooker.bookFloat("dummy");
1743 
1744         if (v.getObjectType() == trigger::TriggerJet && v.getTriggerType() == "SingleJet_Trigger") {
1745           histoname = labelname + "_recObjN";
1746           title = labelname + "_recObjN;Reco multiplicity()" + trigPath;
1747           MonitorElement* N = iBooker.book1D(histoname.c_str(), title.c_str(), Nbins_, Nmin_, Nmax_);
1748           N->getTH1();
1749 
1750           histoname = labelname + "_recObjPt";
1751           title = labelname + "_recObjPt; Reco Pt[GeV/c]" + trigPath;
1752           MonitorElement* Pt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1753           Pt->getTH1();
1754 
1755           histoname = labelname + "_recObjPtBarrel";
1756           title = labelname + "_recObjPtBarrel;Reco Pt[GeV/c]" + trigPath;
1757           MonitorElement* PtBarrel = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1758           PtBarrel->getTH1();
1759 
1760           histoname = labelname + "_recObjPtEndcap";
1761           title = labelname + "_recObjPtEndcap;Reco Pt[GeV/c]" + trigPath;
1762           MonitorElement* PtEndcap = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1763           PtEndcap->getTH1();
1764 
1765           histoname = labelname + "_recObjPtForward";
1766           title = labelname + "_recObjPtForward;Reco Pt[GeV/c]" + trigPath;
1767           MonitorElement* PtForward = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1768           PtForward->getTH1();
1769 
1770           histoname = labelname + "_recObjEta";
1771           title = labelname + "_recObjEta;Reco #eta" + trigPath;
1772           MonitorElement* Eta = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
1773           Eta->getTH1();
1774 
1775           histoname = labelname + "_recObjPhi";
1776           title = labelname + "_recObjPhi;Reco #Phi" + trigPath;
1777           MonitorElement* Phi = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
1778           Phi->getTH1();
1779 
1780           histoname = labelname + "_recObjEtaPhi";
1781           title = labelname + "_recObjEtaPhi;Reco #eta;Reco #Phi" + trigPath;
1782           MonitorElement* EtaPhi =
1783               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
1784           EtaPhi->getTH1();
1785 
1786           histoname = labelname + "_l1ObjPt";
1787           title = labelname + "_l1ObjPt;L1 Pt[GeV/c]" + trigPath;
1788           MonitorElement* Pt_L1 = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1789           Pt_L1->getTH1();
1790 
1791           histoname = labelname + "_l1ObjEta";
1792           title = labelname + "_l1ObjEta;L1 #eta" + trigPath;
1793           MonitorElement* Eta_L1 = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
1794           Eta_L1->getTH1();
1795 
1796           histoname = labelname + "_l1ObjPhi";
1797           title = labelname + "_l1ObjPhi;L1 #Phi" + trigPath;
1798           MonitorElement* Phi_L1 = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
1799           Phi_L1->getTH1();
1800 
1801           histoname = labelname + "_l1ObjEtaPhi";
1802           title = labelname + "_l1ObjEtaPhi;L1 #eta;L1 #Phi" + trigPath;
1803           MonitorElement* EtaPhi_L1 =
1804               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
1805           EtaPhi_L1->getTH1();
1806 
1807           histoname = labelname + "_l1ObjN";
1808           title = labelname + "_l1ObjN;L1 multiplicity" + trigPath;
1809           MonitorElement* N_L1 = iBooker.book1D(histoname.c_str(), title.c_str(), Nbins_, Nmin_, Nmax_);
1810           N_L1->getTH1();
1811 
1812           histoname = labelname + "_l1ObjPtBarrel";
1813           title = labelname + "_l1ObjPtBarrel;L1 Pt[GeV/c]" + trigPath;
1814           MonitorElement* PtBarrel_L1 = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1815           PtBarrel_L1->getTH1();
1816 
1817           histoname = labelname + "_l1ObjPtEndcap";
1818           title = labelname + "_l1ObjPtEndcap;L1 Pt[GeV/c]" + trigPath;
1819           MonitorElement* PtEndcap_L1 = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1820           PtEndcap_L1->getTH1();
1821 
1822           histoname = labelname + "_l1ObjPtForward";
1823           title = labelname + "_l1ObjPtForward;L1 Pt[GeV/c]" + trigPath;
1824           MonitorElement* PtForward_L1 = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1825           PtForward_L1->getTH1();
1826 
1827           histoname = labelname + "_hltObjN";
1828           title = labelname + "_hltObjN;HLT multiplicity" + trigPath;
1829           MonitorElement* N_HLT = iBooker.book1D(histoname.c_str(), title.c_str(), Nbins_, Nmin_, Nmax_);
1830           N_HLT->getTH1();
1831 
1832           histoname = labelname + "_hltObjPtBarrel";
1833           title = labelname + "_hltObjPtBarrel;HLT Pt[GeV/c]" + trigPath;
1834           MonitorElement* PtBarrel_HLT = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1835           PtBarrel_HLT->getTH1();
1836 
1837           histoname = labelname + "_hltObjPtEndcap";
1838           title = labelname + "_hltObjPtEndcap;HLT Pt[GeV/c]" + trigPath;
1839           MonitorElement* PtEndcap_HLT = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1840           PtEndcap_HLT->getTH1();
1841 
1842           histoname = labelname + "_hltObjPtForward";
1843           title = labelname + "_hltObjPtForward;HLT Pt[GeV/c]" + trigPath;
1844           MonitorElement* PtForward_HLT = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1845           PtForward_HLT->getTH1();
1846 
1847           histoname = labelname + "_hltObjPt";
1848           title = labelname + "_hltObjPt;HLT Pt[GeV/c]" + trigPath;
1849           MonitorElement* Pt_HLT = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1850           Pt_HLT->getTH1();
1851 
1852           histoname = labelname + "_hltObjEta";
1853           title = labelname + "_hltObjEta;HLT #eta" + trigPath;
1854           MonitorElement* Eta_HLT = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
1855           Eta_HLT->getTH1();
1856 
1857           histoname = labelname + "_hltObjPhi";
1858           title = labelname + "_hltObjPhi;HLT #Phi" + trigPath;
1859           MonitorElement* Phi_HLT = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
1860           Phi_HLT->getTH1();
1861 
1862           histoname = labelname + "_hltObjEtaPhi";
1863           title = labelname + "_hltObjEtaPhi;HLT #eta;HLT #Phi" + trigPath;
1864           MonitorElement* EtaPhi_HLT =
1865               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
1866           EtaPhi_HLT->getTH1();
1867 
1868           histoname = labelname + "_l1HLTPtResolution";
1869           title = labelname + "_l1HLTPtResolution;(Pt(L1)-Pt(HLT))/Pt(L1)" + trigPath;
1870           MonitorElement* PtResolution_L1HLT =
1871               iBooker.book1D(histoname.c_str(), title.c_str(), Resbins_, ResMin_, ResMax_);
1872           PtResolution_L1HLT->getTH1();
1873 
1874           histoname = labelname + "_l1HLTEtaResolution";
1875           title = labelname + "_l1HLTEtaResolution;#eta(L1)-#eta(HLT)" + trigPath;
1876           MonitorElement* EtaResolution_L1HLT =
1877               iBooker.book1D(histoname.c_str(), title.c_str(), Resbins_, ResMin_, ResMax_);
1878           EtaResolution_L1HLT->getTH1();
1879 
1880           histoname = labelname + "_l1HLTPhiResolution";
1881           title = labelname + "_l1HLTPhiResolution;#Phi(L1)-#Phi(HLT)" + trigPath;
1882           MonitorElement* PhiResolution_L1HLT =
1883               iBooker.book1D(histoname.c_str(), title.c_str(), Resbins_, ResMin_, ResMax_);
1884           PhiResolution_L1HLT->getTH1();
1885 
1886           histoname = labelname + "_l1HLTPtCorrelation";
1887           title = labelname + "_l1HLTPtCorrelation;Pt(L1)[GeV/c];Pt(HLT)[GeV/c]" + trigPath;
1888           MonitorElement* PtCorrelation_L1HLT =
1889               iBooker.book2D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_, Ptbins_, PtMin_, PtMax_);
1890           PtCorrelation_L1HLT->getTH1();
1891 
1892           histoname = labelname + "_l1HLTEtaCorrelation";
1893           title = labelname + "_l1HLTEtaCorrelation;#eta(L1);#eta(HLT)" + trigPath;
1894           MonitorElement* EtaCorrelation_L1HLT =
1895               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Etabins_, EtaMin_, EtaMax_);
1896           EtaCorrelation_L1HLT->getTH1();
1897 
1898           histoname = labelname + "_l1HLTPhiCorrelation";
1899           title = labelname + "_l1HLTPhiCorrelation;#Phi(L1);#Phi(HLT)" + trigPath;
1900           MonitorElement* PhiCorrelation_L1HLT =
1901               iBooker.book2D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_, Phibins_, PhiMin_, PhiMax_);
1902           PhiCorrelation_L1HLT->getTH1();
1903 
1904           histoname = labelname + "_hltRecObjPtResolution";
1905           title = labelname + "_hltRecObjPtResolution;(Pt(HLT)-Pt(Reco))/Pt(HLT)" + trigPath;
1906           MonitorElement* PtResolution_HLTRecObj =
1907               iBooker.book1D(histoname.c_str(), title.c_str(), Resbins_, ResMin_, ResMax_);
1908           PtResolution_HLTRecObj->getTH1();
1909 
1910           histoname = labelname + "_hltRecObjEtaResolution";
1911           title = labelname + "_hltRecObjEtaResolution;#eta(HLT)-#eta(Reco)" + trigPath;
1912           MonitorElement* EtaResolution_HLTRecObj =
1913               iBooker.book1D(histoname.c_str(), title.c_str(), Resbins_, ResMin_, ResMax_);
1914           EtaResolution_HLTRecObj->getTH1();
1915 
1916           histoname = labelname + "_hltRecObjPhiResolution";
1917           title = labelname + "_hltRecObjPhiResolution;#Phi(HLT)-#Phi(Reco)" + trigPath;
1918           MonitorElement* PhiResolution_HLTRecObj =
1919               iBooker.book1D(histoname.c_str(), title.c_str(), Resbins_, ResMin_, ResMax_);
1920           PhiResolution_HLTRecObj->getTH1();
1921 
1922           histoname = labelname + "_hltRecObjPtCorrelation";
1923           title = labelname + "_hltRecObjPtCorrelation;Pt(HLT)[GeV/c];Pt(Reco)[GeV/c]" + trigPath;
1924           MonitorElement* PtCorrelation_HLTRecObj =
1925               iBooker.book2D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_, Ptbins_, PtMin_, PtMax_);
1926           PtCorrelation_HLTRecObj->getTH1();
1927 
1928           histoname = labelname + "_hltRecObjEtaCorrelation";
1929           title = labelname + "_hltRecObjEtaCorrelation;#eta(HLT);#eta(Reco)" + trigPath;
1930           MonitorElement* EtaCorrelation_HLTRecObj =
1931               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Etabins_, EtaMin_, EtaMax_);
1932           EtaCorrelation_HLTRecObj->getTH1();
1933 
1934           histoname = labelname + "_hltRecObjPhiCorrelation";
1935           title = labelname + "_hltRecObjPhiCorrelation;#Phi(HLT);#Phi(Reco)" + trigPath;
1936           MonitorElement* PhiCorrelation_HLTRecObj =
1937               iBooker.book2D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_, Phibins_, PhiMin_, PhiMax_);
1938           PhiCorrelation_HLTRecObj->getTH1();
1939 
1940           v.setHistos(N,
1941                       Pt,
1942                       PtBarrel,
1943                       PtEndcap,
1944                       PtForward,
1945                       Eta,
1946                       Phi,
1947                       EtaPhi,
1948                       N_L1,
1949                       Pt_L1,
1950                       PtBarrel_L1,
1951                       PtEndcap_L1,
1952                       PtForward_L1,
1953                       Eta_L1,
1954                       Phi_L1,
1955                       EtaPhi_L1,
1956                       N_HLT,
1957                       Pt_HLT,
1958                       PtBarrel_HLT,
1959                       PtEndcap_HLT,
1960                       PtForward_HLT,
1961                       Eta_HLT,
1962                       Phi_HLT,
1963                       EtaPhi_HLT,
1964                       PtResolution_L1HLT,
1965                       EtaResolution_L1HLT,
1966                       PhiResolution_L1HLT,
1967                       PtResolution_HLTRecObj,
1968                       EtaResolution_HLTRecObj,
1969                       PhiResolution_HLTRecObj,
1970                       PtCorrelation_L1HLT,
1971                       EtaCorrelation_L1HLT,
1972                       PhiCorrelation_L1HLT,
1973                       PtCorrelation_HLTRecObj,
1974                       EtaCorrelation_HLTRecObj,
1975                       PhiCorrelation_HLTRecObj,
1976                       dummy,
1977                       dummy,
1978                       dummy,
1979                       dummy,
1980                       dummy,
1981                       dummy,
1982                       dummy,
1983                       dummy,
1984                       dummy);
1985         }  // histos for SingleJet Triggers
1986 
1987         if (v.getObjectType() == trigger::TriggerJet && v.getTriggerType() == "DiJet_Trigger") {
1988           histoname = labelname + "_RecObjAveragePt";
1989           title = labelname + "_RecObjAveragePt;Reco Average Pt[GeV/c]" + trigPath;
1990           MonitorElement* jetAveragePt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
1991           jetAveragePt->getTH1();
1992 
1993           histoname = labelname + "_RecObjAverageEta";
1994           title = labelname + "_RecObjAverageEta;Reco Average #eta" + trigPath;
1995           MonitorElement* jetAverageEta = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
1996           jetAverageEta->getTH1();
1997 
1998           histoname = labelname + "_RecObjPhiDifference";
1999           title = labelname + "_RecObjPhiDifference;Reco #Delta#Phi" + trigPath;
2000           MonitorElement* jetPhiDifference =
2001               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2002           jetPhiDifference->getTH1();
2003 
2004           histoname = labelname + "_hltObjAveragePt";
2005           title = labelname + "_hltObjAveragePt;HLT Average Pt[GeV/c]" + trigPath;
2006           MonitorElement* hltAveragePt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2007           hltAveragePt->getTH1();
2008 
2009           histoname = labelname + "_hltObjAverageEta";
2010           title = labelname + "_hltObjAverageEta;HLT Average #eta" + trigPath;
2011           MonitorElement* hltAverageEta = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2012           hltAverageEta->getTH1();
2013 
2014           histoname = labelname + "_hltObjPhiDifference";
2015           title = labelname + "_hltObjPhiDifference;Reco #Delta#Phi" + trigPath;
2016           MonitorElement* hltPhiDifference =
2017               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2018           hltPhiDifference->getTH1();
2019 
2020           v.setHistos(dummy,
2021                       dummy,
2022                       dummy,
2023                       dummy,
2024                       dummy,
2025                       dummy,
2026                       dummy,
2027                       dummy,
2028                       dummy,
2029                       dummy,
2030                       dummy,
2031                       dummy,
2032                       dummy,
2033                       dummy,
2034                       dummy,
2035                       dummy,
2036                       dummy,
2037                       dummy,
2038                       dummy,
2039                       dummy,
2040                       dummy,
2041                       dummy,
2042                       dummy,
2043                       dummy,
2044                       dummy,
2045                       dummy,
2046                       dummy,
2047                       dummy,
2048                       dummy,
2049                       dummy,
2050                       dummy,
2051                       dummy,
2052                       dummy,
2053                       dummy,
2054                       dummy,
2055                       dummy,
2056                       jetAveragePt,
2057                       jetAverageEta,
2058                       jetPhiDifference,
2059                       hltAveragePt,
2060                       hltAverageEta,
2061                       hltPhiDifference,
2062                       dummy,
2063                       dummy,
2064                       dummy);
2065         }  // histos for DiJet Triggers
2066 
2067         if (v.getObjectType() == trigger::TriggerMET || (v.getObjectType() == trigger::TriggerTET)) {
2068           histoname = labelname + "_recObjPt";
2069           title = labelname + "_recObjPt;Reco Pt[GeV/c]" + trigPath;
2070           MonitorElement* Pt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2071           Pt->getTH1();
2072 
2073           histoname = labelname + "_recObjPhi";
2074           title = labelname + "_recObjPhi;Reco #Phi" + trigPath;
2075           MonitorElement* Phi = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2076           Phi->getTH1();
2077 
2078           histoname = labelname + "_l1ObjPt";
2079           title = labelname + "_l1ObjPt;L1 Pt[GeV/c]" + trigPath;
2080           MonitorElement* Pt_L1 = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2081           Pt_L1->getTH1();
2082 
2083           histoname = labelname + "_l1ObjPhi";
2084           title = labelname + "_l1ObjPhi;L1 #Phi" + trigPath;
2085           MonitorElement* Phi_L1 = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2086           Phi_L1->getTH1();
2087 
2088           histoname = labelname + "_hltObjPt";
2089           title = labelname + "_hltObjPt;HLT Pt[GeV/c]" + trigPath;
2090           MonitorElement* Pt_HLT = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2091           Pt_HLT->getTH1();
2092 
2093           histoname = labelname + "_hltObjPhi";
2094           title = labelname + "_hltObjPhi;HLT #Phi" + trigPath;
2095           MonitorElement* Phi_HLT = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2096           Phi_HLT->getTH1();
2097 
2098           histoname = labelname + "_l1HLTPtResolution";
2099           title = labelname + "_l1HLTPtResolution;(Pt(L1)-Pt(HLT))/Pt(L1)" + trigPath;
2100           MonitorElement* PtResolution_L1HLT =
2101               iBooker.book1D(histoname.c_str(), title.c_str(), Resbins_, ResMin_, ResMax_);
2102           PtResolution_L1HLT->getTH1();
2103 
2104           histoname = labelname + "_l1HLTPhiResolution";
2105           title = labelname + "_l1HLTPhiResolution;#Phi(L1)-#Phi(HLT)" + trigPath;
2106           MonitorElement* PhiResolution_L1HLT =
2107               iBooker.book1D(histoname.c_str(), title.c_str(), Resbins_, ResMin_, ResMax_);
2108           PhiResolution_L1HLT->getTH1();
2109 
2110           histoname = labelname + "_l1HLTPtCorrelation";
2111           title = labelname + "_l1HLTPtCorrelation;Pt(L1)[GeV/c];Pt(HLT)[GeV/c]" + trigPath;
2112           MonitorElement* PtCorrelation_L1HLT =
2113               iBooker.book2D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_, Ptbins_, PtMin_, PtMax_);
2114           PtCorrelation_L1HLT->getTH1();
2115 
2116           histoname = labelname + "_l1HLTPhiCorrelation";
2117           title = labelname + "_l1HLTPhiCorrelation;#Phi(L1);#Phi(HLT)" + trigPath;
2118           MonitorElement* PhiCorrelation_L1HLT =
2119               iBooker.book2D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_, Phibins_, PhiMin_, PhiMax_);
2120           PhiCorrelation_L1HLT->getTH1();
2121 
2122           histoname = labelname + "_hltRecObjPtResolution";
2123           title = labelname + "_hltRecObjPtResolution;(Pt(HLT)-Pt(Reco))/Pt(HLT)" + trigPath;
2124           MonitorElement* PtResolution_HLTRecObj =
2125               iBooker.book1D(histoname.c_str(), title.c_str(), Resbins_, ResMin_, ResMax_);
2126           PtResolution_HLTRecObj->getTH1();
2127 
2128           histoname = labelname + "_hltRecObjPhiResolution";
2129           title = labelname + "_hltRecObjPhiResolution;#Phi(HLT)-#Phi(Reco)" + trigPath;
2130           MonitorElement* PhiResolution_HLTRecObj =
2131               iBooker.book1D(histoname.c_str(), title.c_str(), Resbins_, ResMin_, ResMax_);
2132           PhiResolution_HLTRecObj->getTH1();
2133 
2134           histoname = labelname + "_hltRecObjPtCorrelation";
2135           title = labelname + "_hltRecObjPtCorrelation;Pt(HLT)[GeV/c];Pt(Reco)[GeV/c]" + trigPath;
2136           MonitorElement* PtCorrelation_HLTRecObj =
2137               iBooker.book2D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_, Ptbins_, PtMin_, PtMax_);
2138           PtCorrelation_HLTRecObj->getTH1();
2139 
2140           histoname = labelname + "_hltRecObjPhiCorrelation";
2141           title = labelname + "_hltRecObjPhiCorrelation;#Phi(HLT);#Phi(Reco)" + trigPath;
2142           MonitorElement* PhiCorrelation_HLTRecObj =
2143               iBooker.book2D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_, Phibins_, PhiMin_, PhiMax_);
2144           PhiCorrelation_HLTRecObj->getTH1();
2145 
2146           v.setHistos(dummy,
2147                       Pt,
2148                       dummy,
2149                       dummy,
2150                       dummy,
2151                       dummy,
2152                       Phi,
2153                       dummy,
2154                       dummy,
2155                       Pt_L1,
2156                       dummy,
2157                       dummy,
2158                       dummy,
2159                       dummy,
2160                       Phi_L1,
2161                       dummy,
2162                       dummy,
2163                       Pt_HLT,
2164                       dummy,
2165                       dummy,
2166                       dummy,
2167                       dummy,
2168                       Phi_HLT,
2169                       dummy,
2170                       PtResolution_L1HLT,
2171                       dummy,
2172                       PhiResolution_L1HLT,
2173                       PtResolution_HLTRecObj,
2174                       dummy,
2175                       PhiResolution_HLTRecObj,
2176                       PtCorrelation_L1HLT,
2177                       dummy,
2178                       PhiCorrelation_L1HLT,
2179                       PtCorrelation_HLTRecObj,
2180                       dummy,
2181                       PhiCorrelation_HLTRecObj,
2182                       dummy,
2183                       dummy,
2184                       dummy,
2185                       dummy,
2186                       dummy,
2187                       dummy,
2188                       dummy,
2189                       dummy,
2190                       dummy);
2191         }  // histos for MET Triggers
2192       }
2193     }  //plotAll_
2194 
2195     //-------Now Efficiency histos--------
2196     if (plotEff_) {
2197       int Ptbins_ = 100;
2198       if (runStandalone_)
2199         Ptbins_ = 1000;
2200       double PtMin_ = 0.;
2201       double PtMax_ = 1000.;
2202       //
2203       int Etabins_ = 50;
2204       double EtaMin_ = -5.;
2205       double EtaMax_ = 5.;
2206       //
2207       int Phibins_ = 35;
2208       double PhiMin_ = -3.5;
2209       double PhiMax_ = 3.5;
2210       // Now define histos wrt lower threshold trigger
2211       std::string dirName1 = dirname_ + "/RelativeTriggerEff/";
2212       for (auto& v : hltPathsEff_) {
2213         //
2214         std::string trgPathName = HLTConfigProvider::removeVersion(v.getPath());
2215         std::string trgPathNameD = HLTConfigProvider::removeVersion(v.getDenomPath());
2216         //
2217         std::string labelname("ME");
2218         std::string subdirName = dirName1 + trgPathName + "_wrt_" + trgPathNameD;
2219         iBooker.setCurrentFolder(subdirName);
2220         //
2221         std::string histoname(labelname + "");
2222         std::string title(labelname + "");
2223 
2224         MonitorElement* dummy;
2225         dummy = iBooker.bookFloat("dummy");
2226 
2227         if ((v.getObjectType() == trigger::TriggerJet) && (v.getTriggerType() == "SingleJet_Trigger")) {
2228           histoname = labelname + "_NumeratorPt";
2229           title = labelname + "NumeratorPt;Calo Pt[GeV/c]";
2230           MonitorElement* NumeratorPt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2231           NumeratorPt->getTH1();
2232 
2233           histoname = labelname + "_NumeratorPtBarrel";
2234           title = labelname + "NumeratorPtBarrel;Calo Pt[GeV/c] ";
2235           MonitorElement* NumeratorPtBarrel = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2236           NumeratorPtBarrel->getTH1();
2237 
2238           histoname = labelname + "_NumeratorPtEndcap";
2239           title = labelname + "NumeratorPtEndcap;Calo Pt[GeV/c]";
2240           MonitorElement* NumeratorPtEndcap = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2241           NumeratorPtEndcap->getTH1();
2242 
2243           histoname = labelname + "_NumeratorPtForward";
2244           title = labelname + "NumeratorPtForward;Calo Pt[GeV/c]";
2245           MonitorElement* NumeratorPtForward =
2246               iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2247           NumeratorPtForward->getTH1();
2248 
2249           histoname = labelname + "_NumeratorEta";
2250           title = labelname + "NumeratorEta;Calo #eta ";
2251           MonitorElement* NumeratorEta = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2252           NumeratorEta->getTH1();
2253 
2254           histoname = labelname + "_NumeratorPhi";
2255           title = labelname + "NumeratorPhi;Calo #Phi";
2256           MonitorElement* NumeratorPhi = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2257           NumeratorPhi->getTH1();
2258 
2259           histoname = labelname + "_NumeratorEtaPhi";
2260           title = labelname + "NumeratorEtaPhi;Calo #eta;Calo #Phi";
2261           MonitorElement* NumeratorEtaPhi =
2262               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2263           NumeratorEtaPhi->getTH1();
2264 
2265           histoname = labelname + "_NumeratorEtaBarrel";
2266           title = labelname + "NumeratorEtaBarrel;Calo #eta ";
2267           MonitorElement* NumeratorEtaBarrel =
2268               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2269           NumeratorEtaBarrel->getTH1();
2270 
2271           histoname = labelname + "_NumeratorPhiBarrel";
2272           title = labelname + "NumeratorPhiBarrel;Calo #Phi";
2273           MonitorElement* NumeratorPhiBarrel =
2274               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2275           NumeratorPhiBarrel->getTH1();
2276 
2277           histoname = labelname + "_NumeratorEtaEndcap";
2278           title = labelname + "NumeratorEtaEndcap;Calo #eta ";
2279           MonitorElement* NumeratorEtaEndcap =
2280               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2281           NumeratorEtaEndcap->getTH1();
2282 
2283           histoname = labelname + "_NumeratorPhiEndcap";
2284           title = labelname + "NumeratorPhiEndcap;Calo #Phi";
2285           MonitorElement* NumeratorPhiEndcap =
2286               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2287           NumeratorPhiEndcap->getTH1();
2288 
2289           histoname = labelname + "_NumeratorEtaForward";
2290           title = labelname + "NumeratorEtaForward;Calo #eta ";
2291           MonitorElement* NumeratorEtaForward =
2292               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2293           NumeratorEtaForward->getTH1();
2294 
2295           histoname = labelname + "_NumeratorPhiForward";
2296           title = labelname + "NumeratorPhiForward;Calo #Phi";
2297           MonitorElement* NumeratorPhiForward =
2298               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2299           NumeratorPhiForward->getTH1();
2300 
2301           histoname = labelname + "_NumeratorEta_LowpTcut";
2302           title = labelname + "NumeratorEta_LowpTcut;Calo #eta ";
2303           MonitorElement* NumeratorEta_LowpTcut =
2304               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2305           NumeratorEta_LowpTcut->getTH1();
2306 
2307           histoname = labelname + "_NumeratorPhi_LowpTcut";
2308           title = labelname + "NumeratorPhi_LowpTcut;Calo #Phi";
2309           MonitorElement* NumeratorPhi_LowpTcut =
2310               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2311           NumeratorPhi_LowpTcut->getTH1();
2312 
2313           histoname = labelname + "_NumeratorEtaPhi_LowpTcut";
2314           title = labelname + "NumeratorEtaPhi_LowpTcut;Calo #eta;Calo #Phi";
2315           MonitorElement* NumeratorEtaPhi_LowpTcut =
2316               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2317           NumeratorEtaPhi_LowpTcut->getTH1();
2318 
2319           histoname = labelname + "_NumeratorEta_MedpTcut";
2320           title = labelname + "NumeratorEta_MedpTcut;Calo #eta ";
2321           MonitorElement* NumeratorEta_MedpTcut =
2322               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2323           NumeratorEta_MedpTcut->getTH1();
2324 
2325           histoname = labelname + "_NumeratorPhi_MedpTcut";
2326           title = labelname + "NumeratorPhi_MedpTcut;Calo #Phi";
2327           MonitorElement* NumeratorPhi_MedpTcut =
2328               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2329           NumeratorPhi_MedpTcut->getTH1();
2330 
2331           histoname = labelname + "_NumeratorEtaPhi_MedpTcut";
2332           title = labelname + "NumeratorEtaPhi_MedpTcut;Calo #eta;Calo #Phi";
2333           MonitorElement* NumeratorEtaPhi_MedpTcut =
2334               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2335           NumeratorEtaPhi_MedpTcut->getTH1();
2336 
2337           histoname = labelname + "_NumeratorEta_HighpTcut";
2338           title = labelname + "NumeratorEta_HighpTcut;Calo #eta ";
2339           MonitorElement* NumeratorEta_HighpTcut =
2340               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2341           NumeratorEta_HighpTcut->getTH1();
2342 
2343           histoname = labelname + "_NumeratorPhi_HighpTcut";
2344           title = labelname + "NumeratorPhi_HighpTcut;Calo #Phi";
2345           MonitorElement* NumeratorPhi_HighpTcut =
2346               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2347           NumeratorPhi_HighpTcut->getTH1();
2348 
2349           histoname = labelname + "_NumeratorEtaPhi_HighpTcut";
2350           title = labelname + "NumeratorEtaPhi_HighpTcut;Calo #eta;Calo #Phi";
2351           MonitorElement* NumeratorEtaPhi_HighpTcut =
2352               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2353           NumeratorEtaPhi_HighpTcut->getTH1();
2354 
2355           histoname = labelname + "_DenominatorPt";
2356           title = labelname + "DenominatorPt;Calo Pt[GeV/c]";
2357           MonitorElement* DenominatorPt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2358           DenominatorPt->getTH1();
2359 
2360           histoname = labelname + "_DenominatorPtBarrel";
2361           title = labelname + "DenominatorPtBarrel;Calo Pt[GeV/c]";
2362           MonitorElement* DenominatorPtBarrel =
2363               iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2364           DenominatorPtBarrel->getTH1();
2365 
2366           histoname = labelname + "_DenominatorPtEndcap";
2367           title = labelname + "DenominatorPtEndcap;Calo Pt[GeV/c]";
2368           MonitorElement* DenominatorPtEndcap =
2369               iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2370           DenominatorPtEndcap->getTH1();
2371 
2372           histoname = labelname + "_DenominatorPtForward";
2373           title = labelname + "DenominatorPtForward;Calo Pt[GeV/c] ";
2374           MonitorElement* DenominatorPtForward =
2375               iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2376           DenominatorPtForward->getTH1();
2377 
2378           histoname = labelname + "_DenominatorEta";
2379           title = labelname + "DenominatorEta;Calo #eta ";
2380           MonitorElement* DenominatorEta = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2381           DenominatorEta->getTH1();
2382 
2383           histoname = labelname + "_DenominatorPhi";
2384           title = labelname + "DenominatorPhi;Calo #Phi";
2385           MonitorElement* DenominatorPhi = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2386           DenominatorPhi->getTH1();
2387 
2388           histoname = labelname + "_DenominatorEtaPhi";
2389           title = labelname + "DenominatorEtaPhi;Calo #eta; Calo #Phi";
2390           MonitorElement* DenominatorEtaPhi =
2391               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2392           DenominatorEtaPhi->getTH1();
2393 
2394           histoname = labelname + "_DenominatorEtaBarrel";
2395           title = labelname + "DenominatorEtaBarrel;Calo #eta ";
2396           MonitorElement* DenominatorEtaBarrel =
2397               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2398           DenominatorEtaBarrel->getTH1();
2399 
2400           histoname = labelname + "_DenominatorPhiBarrel";
2401           title = labelname + "DenominatorPhiBarrel;Calo #Phi";
2402           MonitorElement* DenominatorPhiBarrel =
2403               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2404           DenominatorPhiBarrel->getTH1();
2405 
2406           histoname = labelname + "_DenominatorEtaEndcap";
2407           title = labelname + "DenominatorEtaEndcap;Calo #eta ";
2408           MonitorElement* DenominatorEtaEndcap =
2409               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2410           DenominatorEtaEndcap->getTH1();
2411 
2412           histoname = labelname + "_DenominatorPhiEndcap";
2413           title = labelname + "DenominatorPhiEndcap;Calo #Phi";
2414           MonitorElement* DenominatorPhiEndcap =
2415               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2416           DenominatorPhiEndcap->getTH1();
2417 
2418           histoname = labelname + "_DenominatorEtaForward";
2419           title = labelname + "DenominatorEtaForward;Calo #eta ";
2420           MonitorElement* DenominatorEtaForward =
2421               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2422           DenominatorEtaForward->getTH1();
2423 
2424           histoname = labelname + "_DenominatorPhiForward";
2425           title = labelname + "DenominatorPhiForward;Calo #Phi";
2426           MonitorElement* DenominatorPhiForward =
2427               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2428           DenominatorPhiForward->getTH1();
2429 
2430           histoname = labelname + "_DenominatorEta_LowpTcut";
2431           title = labelname + "DenominatorEta_LowpTcut;Calo #eta ";
2432           MonitorElement* DenominatorEta_LowpTcut =
2433               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2434           DenominatorEta_LowpTcut->getTH1();
2435 
2436           histoname = labelname + "_DenominatorPhi_LowpTcut";
2437           title = labelname + "DenominatorPhi_LowpTcut;Calo #Phi";
2438           MonitorElement* DenominatorPhi_LowpTcut =
2439               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2440           DenominatorPhi_LowpTcut->getTH1();
2441 
2442           histoname = labelname + "_DenominatorEtaPhi_LowpTcut";
2443           title = labelname + "DenominatorEtaPhi_LowpTcut;Calo #eta;Calo #Phi";
2444           MonitorElement* DenominatorEtaPhi_LowpTcut =
2445               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2446           DenominatorEtaPhi_LowpTcut->getTH1();
2447 
2448           histoname = labelname + "_DenominatorEta_MedpTcut";
2449           title = labelname + "DenominatorEta_MedpTcut;Calo #eta ";
2450           MonitorElement* DenominatorEta_MedpTcut =
2451               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2452           DenominatorEta_MedpTcut->getTH1();
2453 
2454           histoname = labelname + "_DenominatorPhi_MedpTcut";
2455           title = labelname + "DenominatorPhi_MedpTcut;Calo #Phi";
2456           MonitorElement* DenominatorPhi_MedpTcut =
2457               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2458           DenominatorPhi_MedpTcut->getTH1();
2459 
2460           histoname = labelname + "_DenominatorEtaPhi_MedpTcut";
2461           title = labelname + "DenominatorEtaPhi_MedpTcut;Calo #eta;Calo #Phi";
2462           MonitorElement* DenominatorEtaPhi_MedpTcut =
2463               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2464           DenominatorEtaPhi_MedpTcut->getTH1();
2465 
2466           histoname = labelname + "_DenominatorEta_HighpTcut";
2467           title = labelname + "DenominatorEta_HighpTcut;Calo #eta ";
2468           MonitorElement* DenominatorEta_HighpTcut =
2469               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2470           DenominatorEta_HighpTcut->getTH1();
2471 
2472           histoname = labelname + "_DenominatorPhi_HighpTcut";
2473           title = labelname + "DenominatorPhi_HighpTcut;Calo #Phi";
2474           MonitorElement* DenominatorPhi_HighpTcut =
2475               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2476           DenominatorPhi_HighpTcut->getTH1();
2477 
2478           histoname = labelname + "_DenominatorEtaPhi_HighpTcut";
2479           title = labelname + "DenominatorEtaPhi_HighpTcut;Calo #eta;Calo #Phi";
2480           MonitorElement* DenominatorEtaPhi_HighpTcut =
2481               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2482           DenominatorEtaPhi_HighpTcut->getTH1();
2483 
2484           histoname = labelname + "_DeltaR";
2485           title = labelname + "DeltaR;";
2486           MonitorElement* DeltaR = iBooker.book1D(histoname.c_str(), title.c_str(), 100, 0., 1.5);
2487           DeltaR->getTH1();
2488 
2489           histoname = labelname + "_DeltaPhi";
2490           title = labelname + "DeltaPhi;";
2491           MonitorElement* DeltaPhi = iBooker.book1D(histoname.c_str(), title.c_str(), 500, -5.0, 5.0);
2492           DeltaPhi->getTH1();
2493 
2494           histoname = labelname + "_NumeratorPFMHT";
2495           title = labelname + "NumeratorPFMHT;PFMHT[GeV/c]";
2496           MonitorElement* NumeratorPFMHT = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2497           NumeratorPFMHT->getTH1();
2498 
2499           histoname = labelname + "_NumeratorPFPt";
2500           title = labelname + "NumeratorPFPt;PF Pt[GeV/c]";
2501           MonitorElement* NumeratorPFPt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2502           NumeratorPFPt->getTH1();
2503 
2504           histoname = labelname + "_NumeratorPFPtBarrel";
2505           title = labelname + "NumeratorPFPtBarrel;PF Pt[GeV/c] ";
2506           MonitorElement* NumeratorPFPtBarrel =
2507               iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2508           NumeratorPFPtBarrel->getTH1();
2509 
2510           histoname = labelname + "_NumeratorPFPtEndcap";
2511           title = labelname + "NumeratorPFPtEndcap;PF Pt[GeV/c]";
2512           MonitorElement* NumeratorPFPtEndcap =
2513               iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2514           NumeratorPFPtEndcap->getTH1();
2515 
2516           histoname = labelname + "_NumeratorPFPtForward";
2517           title = labelname + "NumeratorPFPtForward;PF Pt[GeV/c]";
2518           MonitorElement* NumeratorPFPtForward =
2519               iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2520           NumeratorPFPtForward->getTH1();
2521 
2522           histoname = labelname + "_NumeratorPFEta";
2523           title = labelname + "NumeratorPFEta;PF #eta ";
2524           MonitorElement* NumeratorPFEta = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2525           NumeratorPFEta->getTH1();
2526 
2527           histoname = labelname + "_NumeratorPFPhi";
2528           title = labelname + "NumeratorPFPhi;Calo #Phi";
2529           MonitorElement* NumeratorPFPhi = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2530           NumeratorPFPhi->getTH1();
2531 
2532           histoname = labelname + "_NumeratorPFEtaPhi";
2533           title = labelname + "NumeratorPFEtaPhi;PF #eta;Calo #Phi";
2534           MonitorElement* NumeratorPFEtaPhi =
2535               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2536           NumeratorPFEtaPhi->getTH1();
2537 
2538           histoname = labelname + "_NumeratorPFEtaBarrel";
2539           title = labelname + "NumeratorPFEtaBarrel;PF #eta ";
2540           MonitorElement* NumeratorPFEtaBarrel =
2541               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2542           NumeratorPFEtaBarrel->getTH1();
2543 
2544           histoname = labelname + "_NumeratorPFPhiBarrel";
2545           title = labelname + "NumeratorPFPhiBarrel;PF #Phi";
2546           MonitorElement* NumeratorPFPhiBarrel =
2547               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2548           NumeratorPFPhiBarrel->getTH1();
2549 
2550           histoname = labelname + "_NumeratorPFEtaEndcap";
2551           title = labelname + "NumeratorPFEtaEndcap;Calo #eta ";
2552           MonitorElement* NumeratorPFEtaEndcap =
2553               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2554           NumeratorPFEtaEndcap->getTH1();
2555 
2556           histoname = labelname + "_NumeratorPFPhiEndcap";
2557           title = labelname + "NumeratorPFPhiEndcap;PF #Phi";
2558           MonitorElement* NumeratorPFPhiEndcap =
2559               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2560           NumeratorPFPhiEndcap->getTH1();
2561 
2562           histoname = labelname + "_NumeratorPFEtaForward";
2563           title = labelname + "NumeratorPFEtaForward;Calo #eta ";
2564           MonitorElement* NumeratorPFEtaForward =
2565               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2566           NumeratorPFEtaForward->getTH1();
2567 
2568           histoname = labelname + "_NumeratorPFPhiForward";
2569           title = labelname + "NumeratorPFPhiForward;PF #Phi";
2570           MonitorElement* NumeratorPFPhiForward =
2571               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2572           NumeratorPFPhiForward->getTH1();
2573 
2574           histoname = labelname + "_NumeratorPFEta_LowpTcut";
2575           title = labelname + "NumeratorPFEta_LowpTcut;PF #eta ";
2576           MonitorElement* NumeratorPFEta_LowpTcut =
2577               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2578           NumeratorPFEta_LowpTcut->getTH1();
2579 
2580           histoname = labelname + "_NumeratorPFPhi_LowpTcut";
2581           title = labelname + "NumeratorPFPhi_LowpTcut;PF #Phi";
2582           MonitorElement* NumeratorPFPhi_LowpTcut =
2583               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2584           NumeratorPFPhi_LowpTcut->getTH1();
2585 
2586           histoname = labelname + "_NumeratorPFEtaPhi_LowpTcut";
2587           title = labelname + "NumeratorPFEtaPhi_LowpTcut;PF #eta;Calo #Phi";
2588           MonitorElement* NumeratorPFEtaPhi_LowpTcut =
2589               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2590           NumeratorPFEtaPhi_LowpTcut->getTH1();
2591 
2592           histoname = labelname + "_NumeratorPFEta_MedpTcut";
2593           title = labelname + "NumeratorPFEta_MedpTcut;PF #eta ";
2594           MonitorElement* NumeratorPFEta_MedpTcut =
2595               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2596           NumeratorPFEta_MedpTcut->getTH1();
2597 
2598           histoname = labelname + "_NumeratorPFPhi_MedpTcut";
2599           title = labelname + "NumeratorPFPhi_MedpTcut;PF #Phi";
2600           MonitorElement* NumeratorPFPhi_MedpTcut =
2601               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2602           NumeratorPFPhi_MedpTcut->getTH1();
2603 
2604           histoname = labelname + "_NumeratorPFEtaPhi_MedpTcut";
2605           title = labelname + "NumeratorPFEtaPhi_MedpTcut;PF #eta;PF #Phi";
2606           MonitorElement* NumeratorPFEtaPhi_MedpTcut =
2607               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2608           NumeratorPFEtaPhi_MedpTcut->getTH1();
2609 
2610           histoname = labelname + "_NumeratorPFEta_HighpTcut";
2611           title = labelname + "NumeratorPFEta_HighpTcut;Calo #eta ";
2612           MonitorElement* NumeratorPFEta_HighpTcut =
2613               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2614           NumeratorPFEta_HighpTcut->getTH1();
2615 
2616           histoname = labelname + "_NumeratorPFPhi_HighpTcut";
2617           title = labelname + "NumeratorPFPhi_HighpTcut;PF #Phi";
2618           MonitorElement* NumeratorPFPhi_HighpTcut =
2619               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2620           NumeratorPFPhi_HighpTcut->getTH1();
2621 
2622           histoname = labelname + "_NumeratorPFEtaPhi_HighpTcut";
2623           title = labelname + "NumeratorPFEtaPhi_HighpTcut;PF #eta;PF #Phi";
2624           MonitorElement* NumeratorPFEtaPhi_HighpTcut =
2625               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2626           NumeratorPFEtaPhi_HighpTcut->getTH1();
2627 
2628           histoname = labelname + "_DenominatorPFMHT";
2629           title = labelname + "DenominatorPFMHT;PF Pt[GeV/c]";
2630           MonitorElement* DenominatorPFMHT = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2631           DenominatorPFMHT->getTH1();
2632 
2633           histoname = labelname + "_DenominatorPFPt";
2634           title = labelname + "DenominatorPFPt;PF Pt[GeV/c]";
2635           MonitorElement* DenominatorPFPt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2636           DenominatorPFPt->getTH1();
2637 
2638           histoname = labelname + "_DenominatorPFPtBarrel";
2639           title = labelname + "DenominatorPFPtBarrel;Calo Pt[GeV/c]";
2640           MonitorElement* DenominatorPFPtBarrel =
2641               iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2642           DenominatorPFPtBarrel->getTH1();
2643 
2644           histoname = labelname + "_DenominatorPFPtEndcap";
2645           title = labelname + "DenominatorPFPtEndcap;PF Pt[GeV/c]";
2646           MonitorElement* DenominatorPFPtEndcap =
2647               iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2648           DenominatorPFPtEndcap->getTH1();
2649 
2650           histoname = labelname + "_DenominatorPFPtForward";
2651           title = labelname + "DenominatorPFPtForward;PF Pt[GeV/c] ";
2652           MonitorElement* DenominatorPFPtForward =
2653               iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2654           DenominatorPFPtForward->getTH1();
2655 
2656           histoname = labelname + "_DenominatorPFEta";
2657           title = labelname + "DenominatorPFEta;PF #eta ";
2658           MonitorElement* DenominatorPFEta =
2659               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2660           DenominatorPFEta->getTH1();
2661 
2662           histoname = labelname + "_DenominatorPFPhi";
2663           title = labelname + "DenominatorPFPhi;PF #Phi";
2664           MonitorElement* DenominatorPFPhi =
2665               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2666           DenominatorPFPhi->getTH1();
2667 
2668           histoname = labelname + "_DenominatorPFEtaPhi";
2669           title = labelname + "DenominatorPFEtaPhi;PF #eta; Calo #Phi";
2670           MonitorElement* DenominatorPFEtaPhi =
2671               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2672           DenominatorPFEtaPhi->getTH1();
2673 
2674           histoname = labelname + "_DenominatorPFEtaBarrel";
2675           title = labelname + "DenominatorPFEtaBarrel;Calo #eta ";
2676           MonitorElement* DenominatorPFEtaBarrel =
2677               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2678           DenominatorPFEtaBarrel->getTH1();
2679 
2680           histoname = labelname + "_DenominatorPFPhiBarrel";
2681           title = labelname + "DenominatorPFPhiBarrel;PF #Phi";
2682           MonitorElement* DenominatorPFPhiBarrel =
2683               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2684           DenominatorPFPhiBarrel->getTH1();
2685 
2686           histoname = labelname + "_DenominatorPFEtaEndcap";
2687           title = labelname + "DenominatorPFEtaEndcap;PF #eta ";
2688           MonitorElement* DenominatorPFEtaEndcap =
2689               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2690           DenominatorPFEtaEndcap->getTH1();
2691 
2692           histoname = labelname + "_DenominatorPFPhiEndcap";
2693           title = labelname + "DenominatorPFPhiEndcap;Calo #Phi";
2694           MonitorElement* DenominatorPFPhiEndcap =
2695               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2696           DenominatorPFPhiEndcap->getTH1();
2697 
2698           histoname = labelname + "_DenominatorPFEtaForward";
2699           title = labelname + "DenominatorPFEtaForward;PF #eta ";
2700           MonitorElement* DenominatorPFEtaForward =
2701               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2702           DenominatorPFEtaForward->getTH1();
2703 
2704           histoname = labelname + "_DenominatorPFPhiForward";
2705           title = labelname + "DenominatorPFPhiForward;PF #Phi";
2706           MonitorElement* DenominatorPFPhiForward =
2707               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2708           DenominatorPFPhiForward->getTH1();
2709 
2710           histoname = labelname + "_DenominatorPFEta_LowpTcut";
2711           title = labelname + "DenominatorPFEta_LowpTcut;PF #eta ";
2712           MonitorElement* DenominatorPFEta_LowpTcut =
2713               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2714           DenominatorPFEta_LowpTcut->getTH1();
2715 
2716           histoname = labelname + "_DenominatorPFPhi_LowpTcut";
2717           title = labelname + "DenominatorPFPhi_LowpTcut;PF #Phi";
2718           MonitorElement* DenominatorPFPhi_LowpTcut =
2719               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2720           DenominatorPFPhi_LowpTcut->getTH1();
2721 
2722           histoname = labelname + "_DenominatorPFEtaPhi_LowpTcut";
2723           title = labelname + "DenominatorPFEtaPhi_LowpTcut;PF #eta;Calo #Phi";
2724           MonitorElement* DenominatorPFEtaPhi_LowpTcut =
2725               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2726           DenominatorPFEtaPhi_LowpTcut->getTH1();
2727 
2728           histoname = labelname + "_DenominatorPFEta_MedpTcut";
2729           title = labelname + "DenominatorPFEta_MedpTcut;PF #eta ";
2730           MonitorElement* DenominatorPFEta_MedpTcut =
2731               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2732           DenominatorPFEta_MedpTcut->getTH1();
2733 
2734           histoname = labelname + "_DenominatorPFPhi_MedpTcut";
2735           title = labelname + "DenominatorPFPhi_MedpTcut;PF #Phi";
2736           MonitorElement* DenominatorPFPhi_MedpTcut =
2737               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2738           DenominatorPFPhi_MedpTcut->getTH1();
2739 
2740           histoname = labelname + "_DenominatorPFEtaPhi_MedpTcut";
2741           title = labelname + "DenominatorPFEtaPhi_MedpTcut;PF #eta;Calo #Phi";
2742           MonitorElement* DenominatorPFEtaPhi_MedpTcut =
2743               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2744           DenominatorPFEtaPhi_MedpTcut->getTH1();
2745 
2746           histoname = labelname + "_DenominatorPFEta_HighpTcut";
2747           title = labelname + "DenominatorPFEta_HighpTcut;PF #eta ";
2748           MonitorElement* DenominatorPFEta_HighpTcut =
2749               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2750           DenominatorPFEta_HighpTcut->getTH1();
2751 
2752           histoname = labelname + "_DenominatorPFPhi_HighpTcut";
2753           title = labelname + "DenominatorPFPhi_HighpTcut;PF #Phi";
2754           MonitorElement* DenominatorPFPhi_HighpTcut =
2755               iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
2756           DenominatorPFPhi_HighpTcut->getTH1();
2757 
2758           histoname = labelname + "_DenominatorPFEtaPhi_HighpTcut";
2759           title = labelname + "DenominatorPFEtaPhi_HighpTcut;PF #eta;Calo #Phi";
2760           MonitorElement* DenominatorPFEtaPhi_HighpTcut =
2761               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Phibins_, PhiMin_, PhiMax_);
2762           DenominatorPFEtaPhi_HighpTcut->getTH1();
2763 
2764           histoname = labelname + "_PFDeltaR";
2765           title = labelname + "PFDeltaR;";
2766           MonitorElement* PFDeltaR = iBooker.book1D(histoname.c_str(), title.c_str(), 100, 0., 1.5);
2767           PFDeltaR->getTH1();
2768 
2769           histoname = labelname + "_PFDeltaPhi";
2770           title = labelname + "PFDeltaPhi;";
2771           MonitorElement* PFDeltaPhi = iBooker.book1D(histoname.c_str(), title.c_str(), 500, -5.0, 5.0);
2772           PFDeltaPhi->getTH1();
2773 
2774           v.setEffHistos(NumeratorPt,
2775                          NumeratorPtBarrel,
2776                          NumeratorPtEndcap,
2777                          NumeratorPtForward,
2778                          NumeratorEta,
2779                          NumeratorPhi,
2780                          NumeratorEtaPhi,
2781                          //
2782                          NumeratorEtaBarrel,
2783                          NumeratorPhiBarrel,
2784                          NumeratorEtaEndcap,
2785                          NumeratorPhiEndcap,
2786                          NumeratorEtaForward,
2787                          NumeratorPhiForward,
2788                          NumeratorEta_LowpTcut,
2789                          NumeratorPhi_LowpTcut,
2790                          NumeratorEtaPhi_LowpTcut,
2791                          NumeratorEta_MedpTcut,
2792                          NumeratorPhi_MedpTcut,
2793                          NumeratorEtaPhi_MedpTcut,
2794                          NumeratorEta_HighpTcut,
2795                          NumeratorPhi_HighpTcut,
2796                          NumeratorEtaPhi_HighpTcut,
2797                          //
2798                          DenominatorPt,
2799                          DenominatorPtBarrel,
2800                          DenominatorPtEndcap,
2801                          DenominatorPtForward,
2802                          DenominatorEta,
2803                          DenominatorPhi,
2804                          DenominatorEtaPhi,
2805                          //
2806                          DenominatorEtaBarrel,
2807                          DenominatorPhiBarrel,
2808                          DenominatorEtaEndcap,
2809                          DenominatorPhiEndcap,
2810                          DenominatorEtaForward,
2811                          DenominatorPhiForward,
2812                          DenominatorEta_LowpTcut,
2813                          DenominatorPhi_LowpTcut,
2814                          DenominatorEtaPhi_LowpTcut,
2815                          DenominatorEta_MedpTcut,
2816                          DenominatorPhi_MedpTcut,
2817                          DenominatorEtaPhi_MedpTcut,
2818                          DenominatorEta_HighpTcut,
2819                          DenominatorPhi_HighpTcut,
2820                          DenominatorEtaPhi_HighpTcut,
2821                          DeltaR,
2822                          DeltaPhi,
2823                          //
2824                          NumeratorPFPt,
2825                          NumeratorPFMHT,
2826                          NumeratorPFPtBarrel,
2827                          NumeratorPFPtEndcap,
2828                          NumeratorPFPtForward,
2829                          NumeratorPFEta,
2830                          NumeratorPFPhi,
2831                          NumeratorPFEtaPhi,
2832                          NumeratorPFEtaBarrel,
2833                          NumeratorPFPhiBarrel,
2834                          NumeratorPFEtaEndcap,
2835                          NumeratorPFPhiEndcap,
2836                          NumeratorPFEtaForward,
2837                          NumeratorPFPhiForward,
2838                          NumeratorPFEta_LowpTcut,
2839                          NumeratorPFPhi_LowpTcut,
2840                          NumeratorPFEtaPhi_LowpTcut,
2841                          NumeratorPFEta_MedpTcut,
2842                          NumeratorPFPhi_MedpTcut,
2843                          NumeratorPFEtaPhi_MedpTcut,
2844                          NumeratorPFEta_HighpTcut,
2845                          NumeratorPFPhi_HighpTcut,
2846                          NumeratorPFEtaPhi_HighpTcut,
2847                          DenominatorPFPt,
2848                          DenominatorPFMHT,
2849                          DenominatorPFPtBarrel,
2850                          DenominatorPFPtEndcap,
2851                          DenominatorPFPtForward,
2852                          DenominatorPFEta,
2853                          DenominatorPFPhi,
2854                          DenominatorPFEtaPhi,
2855                          DenominatorPFEtaBarrel,
2856                          DenominatorPFPhiBarrel,
2857                          DenominatorPFEtaEndcap,
2858                          DenominatorPFPhiEndcap,
2859                          DenominatorPFEtaForward,
2860                          DenominatorPFPhiForward,
2861                          DenominatorPFEta_LowpTcut,
2862                          DenominatorPFPhi_LowpTcut,
2863                          DenominatorPFEtaPhi_LowpTcut,
2864                          DenominatorPFEta_MedpTcut,
2865                          DenominatorPFPhi_MedpTcut,
2866                          DenominatorPFEtaPhi_MedpTcut,
2867                          DenominatorPFEta_HighpTcut,
2868                          DenominatorPFPhi_HighpTcut,
2869                          DenominatorPFEtaPhi_HighpTcut,
2870                          PFDeltaR,
2871                          PFDeltaPhi);
2872 
2873         }  // Loop over Jet Trigger
2874 
2875         if ((v.getObjectType() == trigger::TriggerJet) && (v.getTriggerType() == "DiJet_Trigger")) {
2876           histoname = labelname + "_NumeratorAvrgPt";
2877           title = labelname + "NumeratorAvrgPt;Calo Pt[GeV/c]";
2878           MonitorElement* NumeratorPt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2879           NumeratorPt->getTH1();
2880 
2881           histoname = labelname + "_NumeratorAvrgEta";
2882           title = labelname + "NumeratorAvrgEta;Calo #eta";
2883           MonitorElement* NumeratorEta = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2884           NumeratorEta->getTH1();
2885 
2886           histoname = labelname + "_DenominatorAvrgPt";
2887           title = labelname + "DenominatorAvrgPt;Calo Pt[GeV/c] ";
2888           MonitorElement* DenominatorPt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2889           DenominatorPt->getTH1();
2890 
2891           histoname = labelname + "_DenominatorAvrgEta";
2892           title = labelname + "DenominatorAvrgEta;Calo #eta";
2893           MonitorElement* DenominatorEta = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2894           DenominatorEta->getTH1();
2895 
2896           histoname = labelname + "_DeltaR";
2897           title = labelname + "DeltaR;";
2898           MonitorElement* DeltaR = iBooker.book1D(histoname.c_str(), title.c_str(), 100, 0., 1.5);
2899           DeltaR->getTH1();
2900 
2901           histoname = labelname + "_DeltaPhi";
2902           title = labelname + "DeltaPhi;";
2903           MonitorElement* DeltaPhi = iBooker.book1D(histoname.c_str(), title.c_str(), 500, -5., 5.);
2904           DeltaPhi->getTH1();
2905 
2906           //add PF histo: SJ
2907           histoname = labelname + "_NumeratorAvrgPFPt";
2908           title = labelname + "NumeratorAvrgPFPt;PF Pt[GeV/c]";
2909           MonitorElement* NumeratorPFPt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2910           NumeratorPFPt->getTH1();
2911 
2912           histoname = labelname + "_NumeratorAvrgPFEta";
2913           title = labelname + "NumeratorAvrgPFEta;PF #eta";
2914           MonitorElement* NumeratorPFEta = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2915           NumeratorPFEta->getTH1();
2916 
2917           histoname = labelname + "_DenominatorAvrgPFPt";
2918           title = labelname + "DenominatorAvrgPFPt;PF Pt[GeV/c] ";
2919           MonitorElement* DenominatorPFPt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
2920           DenominatorPFPt->getTH1();
2921 
2922           histoname = labelname + "_DenominatorAvrgPFEta";
2923           title = labelname + "DenominatorAvrgPFEta;PF #eta";
2924           MonitorElement* DenominatorPFEta =
2925               iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
2926           DenominatorPFEta->getTH1();
2927 
2928           histoname = labelname + "_PFDeltaR";
2929           title = labelname + "PFDeltaR;";
2930           MonitorElement* PFDeltaR = iBooker.book1D(histoname.c_str(), title.c_str(), 100, 0., 1.5);
2931           PFDeltaR->getTH1();
2932 
2933           histoname = labelname + "_PFDeltaPhi";
2934           title = labelname + "PFDeltaPhi;";
2935           MonitorElement* PFDeltaPhi = iBooker.book1D(histoname.c_str(), title.c_str(), 500, -5., 5.);
2936           PFDeltaPhi->getTH1();
2937 
2938           v.setEffHistos(dummy,
2939                          dummy,
2940                          dummy,
2941                          dummy,
2942                          dummy,
2943                          dummy,
2944                          dummy,
2945                          dummy,
2946                          dummy,
2947                          dummy,
2948                          dummy,
2949                          dummy,
2950                          dummy,
2951                          dummy,
2952                          dummy,
2953                          dummy,
2954                          dummy,
2955                          dummy,
2956                          dummy,
2957                          dummy,
2958                          dummy,
2959                          dummy,
2960                          dummy,
2961                          dummy,
2962                          dummy,
2963                          dummy,
2964                          dummy,
2965                          dummy,
2966                          dummy,
2967                          dummy,
2968                          dummy,
2969                          dummy,
2970                          dummy,
2971                          dummy,
2972                          dummy,
2973                          dummy,
2974                          dummy,
2975                          dummy,
2976                          dummy,
2977                          dummy,
2978                          dummy,
2979                          dummy,
2980                          dummy,
2981                          dummy,
2982                          dummy,
2983                          dummy,
2984                          dummy,
2985                          dummy,
2986                          dummy,
2987                          dummy,
2988                          dummy,
2989                          dummy,
2990                          dummy,
2991                          dummy,
2992                          dummy,
2993                          dummy,
2994                          dummy,
2995                          dummy,
2996                          dummy,
2997                          dummy,
2998                          dummy,
2999                          dummy,
3000                          dummy,
3001                          dummy,
3002                          dummy,
3003                          dummy,
3004                          dummy,
3005                          dummy,
3006                          dummy,
3007                          dummy,
3008                          dummy,
3009                          dummy,
3010                          dummy,
3011                          dummy,
3012                          dummy,
3013                          dummy,
3014                          dummy,
3015                          dummy,
3016                          dummy,
3017                          dummy,
3018                          dummy,
3019                          dummy,
3020                          dummy,
3021                          dummy,
3022                          dummy,
3023                          dummy,
3024                          dummy,
3025                          dummy,
3026                          dummy,
3027                          dummy,
3028                          dummy,
3029                          dummy,
3030                          dummy,
3031                          dummy);
3032         }
3033 
3034         if (v.getObjectType() == trigger::TriggerMET || (v.getObjectType() == trigger::TriggerTET)) {
3035           histoname = labelname + "_NumeratorPt";
3036           if (v.getPath().find("HLT_PFMET") == std::string::npos)
3037             title = labelname + "NumeratorPt; CaloMET[GeV/c]";
3038           else
3039             title = labelname + "NumeratorPt; PFMET[GeV/c]";
3040           MonitorElement* NumeratorPt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
3041           NumeratorPt->getTH1();
3042 
3043           histoname = labelname + "_NumeratorPhi";
3044           title = labelname + "NumeratorPhi; #Phi";
3045           MonitorElement* NumeratorPhi = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
3046           NumeratorPhi->getTH1();
3047 
3048           histoname = labelname + "_DenominatorPt";
3049           if (v.getPath().find("HLT_PFMET") == std::string::npos)
3050             title = labelname + "DenominatorPt; CaloMET[GeV/c]";
3051           else
3052             title = labelname + "DenominatorPt; PFMET[GeV/c]";
3053           MonitorElement* DenominatorPt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
3054           DenominatorPt->getTH1();
3055 
3056           histoname = labelname + "_DenominatorPhi";
3057           title = labelname + "DenominatorPhi; #Phi";
3058           MonitorElement* DenominatorPhi = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
3059           DenominatorPhi->getTH1();
3060 
3061           v.setEffHistos(NumeratorPt,
3062                          dummy,
3063                          dummy,
3064                          dummy,
3065                          dummy,
3066                          NumeratorPhi,
3067                          dummy,
3068                          dummy,
3069                          dummy,
3070                          dummy,
3071                          dummy,
3072                          dummy,
3073                          dummy,
3074                          dummy,
3075                          dummy,
3076                          dummy,
3077                          dummy,
3078                          dummy,
3079                          dummy,
3080                          dummy,
3081                          dummy,
3082                          dummy,
3083                          DenominatorPt,
3084                          dummy,
3085                          dummy,
3086                          dummy,
3087                          dummy,
3088                          DenominatorPhi,
3089                          dummy,
3090                          dummy,
3091                          dummy,
3092                          dummy,
3093                          dummy,
3094                          dummy,
3095                          dummy,
3096                          dummy,
3097                          dummy,
3098                          dummy,
3099                          dummy,
3100                          dummy,
3101                          dummy,
3102                          dummy,
3103                          dummy,
3104                          dummy,
3105                          dummy,
3106                          dummy,
3107                          dummy,
3108                          dummy,
3109                          dummy,
3110                          dummy,
3111                          dummy,
3112                          dummy,
3113                          dummy,
3114                          dummy,
3115                          dummy,
3116                          dummy,
3117                          dummy,
3118                          dummy,
3119                          dummy,
3120                          dummy,
3121                          dummy,
3122                          dummy,
3123                          dummy,
3124                          dummy,
3125                          dummy,
3126                          dummy,
3127                          dummy,
3128                          dummy,
3129                          dummy,
3130                          dummy,
3131                          dummy,
3132                          dummy,
3133                          dummy,
3134                          dummy,
3135                          dummy,
3136                          dummy,
3137                          dummy,
3138                          dummy,
3139                          dummy,
3140                          dummy,
3141                          dummy,
3142                          dummy,
3143                          dummy,
3144                          dummy,
3145                          dummy,
3146                          dummy,
3147                          dummy,
3148                          dummy,
3149                          dummy,
3150                          dummy,
3151                          dummy,
3152                          dummy,
3153                          dummy,
3154                          dummy);
3155         }  // Loop over MET trigger
3156       }
3157     }  //plotEff_
3158 
3159     if (runStandalone_) {  //runStandalone
3160       //--------Histos to see WHY trigger is NOT fired----------
3161       int Nbins_ = 10;
3162       int Nmin_ = 0;
3163       int Nmax_ = 10;
3164       int Ptbins_ = 1000;
3165       int Etabins_ = 40;
3166       int Phibins_ = 35;
3167       double PtMin_ = 0.;
3168       double PtMax_ = 1000.;
3169       double EtaMin_ = -5.;
3170       double EtaMax_ = 5.;
3171       double PhiMin_ = -3.14159;
3172       double PhiMax_ = 3.14159;
3173 
3174       std::string dirName4_ = dirname_ + "/TriggerNotFired/";
3175       //      iBooker.setCurrentFolder(dirName4);
3176 
3177       for (auto& v : hltPathsAll_) {
3178         MonitorElement* dummy;
3179         dummy = iBooker.bookFloat("dummy");
3180 
3181         std::string labelname("ME");
3182         std::string histoname(labelname + "");
3183         std::string title(labelname + "");
3184         iBooker.setCurrentFolder(dirName4_ + v.getPath());
3185 
3186         histoname = labelname + "_TriggerSummary";
3187         title = labelname + "Summary of trigger levels";
3188         MonitorElement* TriggerSummary = iBooker.book1D(histoname.c_str(), title.c_str(), 7, -0.5, 6.5);
3189 
3190         std::vector<std::string> trigger;
3191         trigger.emplace_back("Nevt");
3192         trigger.emplace_back("L1 failed");
3193         trigger.emplace_back("L1 & HLT failed");
3194         trigger.emplace_back("L1 failed but not HLT");
3195         trigger.emplace_back("L1 passed");
3196         trigger.emplace_back("L1 & HLT passed");
3197         trigger.emplace_back("L1 passed but not HLT");
3198 
3199         for (unsigned int i = 0; i < trigger.size(); i++)
3200           TriggerSummary->setBinLabel(i + 1, trigger[i]);
3201 
3202         if ((v.getTriggerType() == "SingleJet_Trigger")) {
3203           histoname = labelname + "_JetPt";
3204           title = labelname + "Leading jet pT;Pt[GeV/c]";
3205           MonitorElement* JetPt = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
3206           JetPt->getTH1();
3207 
3208           histoname = labelname + "_JetEtaVsPt";
3209           title = labelname + "Leading jet #eta vs pT;#eta;Pt[GeV/c]";
3210           MonitorElement* JetEtaVsPt =
3211               iBooker.book2D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_, Ptbins_, PtMin_, PtMax_);
3212           JetEtaVsPt->getTH1();
3213 
3214           histoname = labelname + "_JetPhiVsPt";
3215           title = labelname + "Leading jet #Phi vs pT;#Phi;Pt[GeV/c]";
3216           MonitorElement* JetPhiVsPt =
3217               iBooker.book2D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_, Ptbins_, PtMin_, PtMax_);
3218           JetPhiVsPt->getTH1();
3219 
3220           v.setDgnsHistos(
3221               TriggerSummary, dummy, JetPt, JetEtaVsPt, JetPhiVsPt, dummy, dummy, dummy, dummy, dummy, dummy);
3222         }  // single Jet trigger
3223 
3224         if ((v.getTriggerType() == "DiJet_Trigger")) {
3225           histoname = labelname + "_JetSize";
3226           title = labelname + "Jet Size;multiplicity";
3227           MonitorElement* JetSize = iBooker.book1D(histoname.c_str(), title.c_str(), Nbins_, Nmin_, Nmax_);
3228           JetSize->getTH1();
3229 
3230           histoname = labelname + "_AvergPt";
3231           title = labelname + "Average Pt;Pt[GeV/c]";
3232           MonitorElement* Pt12 = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
3233           Pt12->getTH1();
3234 
3235           histoname = labelname + "_AvergEta";
3236           title = labelname + "Average Eta;#eta";
3237           MonitorElement* Eta12 = iBooker.book1D(histoname.c_str(), title.c_str(), Etabins_, EtaMin_, EtaMax_);
3238           Eta12->getTH1();
3239 
3240           histoname = labelname + "_PhiDifference";
3241           title = labelname + "#Delta#Phi;#Delta#Phi";
3242           MonitorElement* Phi12 = iBooker.book1D(histoname.c_str(), title.c_str(), Phibins_, PhiMin_, PhiMax_);
3243           Phi12->getTH1();
3244 
3245           histoname = labelname + "_Pt3Jet";
3246           title = labelname + "Pt of 3rd Jet;Pt[GeV/c]";
3247           MonitorElement* Pt3 = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
3248           Pt3->getTH1();
3249 
3250           histoname = labelname + "_Pt12VsPt3Jet";
3251           title = labelname + "Pt of 3rd Jet vs Average Pt of leading jets;Avergage Pt[GeV/c]; Pt of 3rd Jet [GeV/c]";
3252           MonitorElement* Pt12Pt3 =
3253               iBooker.book2D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_, Ptbins_, PtMin_, PtMax_);
3254           Pt12Pt3->getTH1();
3255 
3256           histoname = labelname + "_Pt12VsPhi12";
3257           title = labelname +
3258                   "Average Pt of leading jets vs #Delta#Phi between leading jets;Avergage Pt[GeV/c]; #Delta#Phi";
3259           MonitorElement* Pt12Phi12 =
3260               iBooker.book2D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_, Phibins_, PhiMin_, PhiMax_);
3261           Pt12Phi12->getTH1();
3262 
3263           v.setDgnsHistos(TriggerSummary, JetSize, dummy, dummy, dummy, Pt12, Eta12, Phi12, Pt3, Pt12Pt3, Pt12Phi12);
3264         }  // Dijet Jet trigger
3265 
3266         if ((v.getTriggerType() == "MET_Trigger")) {
3267           histoname = labelname + "_MET";
3268           title = labelname + "MET;Pt[GeV/c]";
3269           MonitorElement* MET = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
3270           MET->getTH1();
3271 
3272           v.setDgnsHistos(TriggerSummary, dummy, MET, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy);
3273         }  // MET trigger
3274 
3275         if ((v.getTriggerType() == "TET_Trigger")) {
3276           histoname = labelname + "_TET";
3277           title = labelname + "TET;Pt[GeV/c]";
3278           MonitorElement* TET = iBooker.book1D(histoname.c_str(), title.c_str(), Ptbins_, PtMin_, PtMax_);
3279           TET->getTH1();
3280 
3281           v.setDgnsHistos(TriggerSummary, dummy, TET, dummy, dummy, dummy, dummy, dummy, dummy, dummy, dummy);
3282         }  // TET trigger
3283       }
3284     }  //runStandalone
3285   }
3286 }
3287 //------------------------------------------------------------------------//
3288 const std::string JetMETHLTOfflineSource::getL1ConditionModuleName(const std::string& pathname) {
3289   // find L1 condition for numpath with numpath objecttype
3290   // find PSet for L1 global seed for numpath,
3291   // list module labels for numpath
3292   std::string l1pathname = "dummy";
3293 
3294   std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(pathname);
3295 
3296   for (auto& numpathmodule : numpathmodules) {
3297     if (hltConfig_.moduleType(numpathmodule) == "HLTLevel1GTSeed") {
3298       l1pathname = numpathmodule;
3299       break;
3300     }
3301   }
3302   return l1pathname;
3303 }
3304 
3305 //------------------------------------------------------------------------//
3306 bool JetMETHLTOfflineSource::isBarrel(double eta) {
3307   bool output = false;
3308   if (fabs(eta) <= 1.3)
3309     output = true;
3310   return output;
3311 }
3312 
3313 //------------------------------------------------------------------------//
3314 bool JetMETHLTOfflineSource::isEndCap(double eta) {
3315   bool output = false;
3316   if (fabs(eta) <= 3.0 && fabs(eta) > 1.3)
3317     output = true;
3318   return output;
3319 }
3320 
3321 //------------------------------------------------------------------------//
3322 bool JetMETHLTOfflineSource::isForward(double eta) {
3323   bool output = false;
3324   if (fabs(eta) > 3.0)
3325     output = true;
3326   return output;
3327 }
3328 
3329 //------------------------------------------------------------------------//
3330 bool JetMETHLTOfflineSource::validPathHLT(std::string pathname) {
3331   // hltConfig_ has to be defined first before calling this method
3332   bool output = false;
3333   for (unsigned int j = 0; j != hltConfig_.size(); ++j) {
3334     if (hltConfig_.triggerName(j) == pathname)
3335       output = true;
3336   }
3337   return output;
3338 }
3339 
3340 //------------------------------------------------------------------------//
3341 bool JetMETHLTOfflineSource::isHLTPathAccepted(std::string pathName) {
3342   // triggerResults_, triggerNames_ has to be defined first before calling this method
3343   bool output = false;
3344   if (triggerResults_.isValid()) {
3345     unsigned index = triggerNames_.triggerIndex(pathName);
3346     if (index < triggerNames_.size() && triggerResults_->accept(index))
3347       output = true;
3348   }
3349   return output;
3350 }
3351 
3352 //------------------------------------------------------------------------//
3353 // This returns the position of trigger name defined in summary histograms
3354 double JetMETHLTOfflineSource::TriggerPosition(std::string trigName) {
3355   int nbins = rate_All->getTH1()->GetNbinsX();
3356   double binVal = -100;
3357   for (int ibin = 1; ibin < nbins + 1; ibin++) {
3358     const char* binLabel = rate_All->getTH1()->GetXaxis()->GetBinLabel(ibin);
3359     if (binLabel[0] == '\0')
3360       continue;
3361     //       std::string binLabel_str = string(binLabel);
3362     //       if(binLabel_str.compare(trigName)!=0)continue;
3363     if (trigName != binLabel)
3364       continue;
3365 
3366     if (trigName == binLabel) {
3367       binVal = rate_All->getTH1()->GetBinCenter(ibin);
3368       break;
3369     }
3370   }
3371   return binVal;
3372 }
3373 
3374 //------------------------------------------------------------------------//
3375 bool JetMETHLTOfflineSource::isTriggerObjectFound(std::string objectName) {
3376   // processname_, triggerObj_ has to be defined before calling this method
3377   bool output = false;
3378   edm::InputTag testTag(objectName, "", processname_);
3379   const int index = triggerObj_->filterIndex(testTag);
3380   if (index >= triggerObj_->sizeFilters()) {
3381     edm::LogInfo("JetMETHLTOfflineSource") << "no index " << index << " of that name ";
3382   } else {
3383     const trigger::Keys& k = triggerObj_->filterKeys(index);
3384     if (!k.empty())
3385       output = true;
3386   }
3387   return output;
3388 }
3389 //------------------------------------------------------------------------//
3390 
3391 #include "FWCore/Framework/interface/MakerMacros.h"
3392 DEFINE_FWK_MODULE(JetMETHLTOfflineSource);