Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:32

0001 /** \class METAnalyzer
0002  *
0003  *  DQM MET analysis monitoring
0004  *
0005  *  \author F. Chlebana - Fermilab
0006  *          K. Hatakeyama - Rockefeller University
0007  *
0008  *          Jan. '14: modified by
0009  *
0010  *          M. Artur Weber
0011  *          R. Schoefbeck
0012  *          V. Sordini
0013  */
0014 
0015 #include "DQMOffline/JetMET/interface/METAnalyzer.h"
0016 #include "DataFormats/Common/interface/Handle.h"
0017 #include "FWCore/Common/interface/TriggerNames.h"
0018 #include "DataFormats/Math/interface/LorentzVector.h"
0019 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0020 
0021 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
0022 #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h"
0023 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0024 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
0025 
0026 #include "DataFormats/Math/interface/LorentzVector.h"
0027 
0028 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
0029 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
0030 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
0031 #include <cmath>
0032 #include "TH2F.h"
0033 #include "TH2.h"
0034 
0035 #include <string>
0036 
0037 using namespace edm;
0038 using namespace reco;
0039 using namespace math;
0040 
0041 // ***********************************************************
0042 METAnalyzer::METAnalyzer(const edm::ParameterSet& pSet) {
0043   parameters = pSet;
0044 
0045   m_l1algoname_ = pSet.getParameter<std::string>("l1algoname");
0046   m_bitAlgTechTrig_ = -1;
0047 
0048   miniaodfilterdec = -1;
0049 
0050   LSBegin_ = pSet.getParameter<int>("LSBegin");
0051   LSEnd_ = pSet.getParameter<int>("LSEnd");
0052   // Smallest track pt
0053   ptMinCand_ = pSet.getParameter<double>("ptMinCand");
0054 
0055   MetType_ = parameters.getUntrackedParameter<std::string>("METType");
0056 
0057   triggerResultsLabel_ = parameters.getParameter<edm::InputTag>("TriggerResultsLabel");
0058   triggerResultsToken_ = consumes<edm::TriggerResults>(edm::InputTag(triggerResultsLabel_));
0059 
0060   isCaloMet_ = (std::string("calo") == MetType_);
0061   //isTCMet_ = (std::string("tc") ==MetType_);
0062   isPFMet_ = (std::string("pf") == MetType_);
0063   isMiniAODMet_ = (std::string("miniaod") == MetType_);
0064   if (!isMiniAODMet_) {
0065     jetCorrectorToken_ = consumes<reco::JetCorrector>(pSet.getParameter<edm::InputTag>("JetCorrections"));
0066   }
0067 
0068   // MET information
0069   metCollectionLabel_ = parameters.getParameter<edm::InputTag>("METCollectionLabel");
0070 
0071   if (/*isTCMet_ || */ isCaloMet_) {
0072     inputJetIDValueMap = pSet.getParameter<edm::InputTag>("InputJetIDValueMap");
0073     jetID_ValueMapToken_ = consumes<edm::ValueMap<reco::JetID> >(inputJetIDValueMap);
0074     jetIDFunctorLoose = JetIDSelectionFunctor(JetIDSelectionFunctor::PURE09, JetIDSelectionFunctor::LOOSE);
0075   }
0076 
0077   if (isPFMet_) {
0078     pflowToken_ = consumes<std::vector<reco::PFCandidate> >(pSet.getParameter<edm::InputTag>("srcPFlow"));
0079     pfjetIDFunctorLoose = PFJetIDSelectionFunctor(PFJetIDSelectionFunctor::WINTER16, PFJetIDSelectionFunctor::LOOSE);
0080   }
0081   if (isMiniAODMet_) {
0082     pflowPackedToken_ = consumes<std::vector<pat::PackedCandidate> >(pSet.getParameter<edm::InputTag>("srcPFlow"));
0083     pfjetIDFunctorLoose = PFJetIDSelectionFunctor(PFJetIDSelectionFunctor::WINTER16, PFJetIDSelectionFunctor::LOOSE);
0084   }
0085   MuonsToken_ = consumes<reco::MuonCollection>(pSet.getParameter<edm::InputTag>("muonsrc"));
0086 
0087   ptThreshold_ = parameters.getParameter<double>("ptThreshold");
0088 
0089   if (isPFMet_) {
0090     pfMetToken_ = consumes<reco::PFMETCollection>(edm::InputTag(metCollectionLabel_));
0091   }
0092   if (isCaloMet_) {
0093     caloMetToken_ = consumes<reco::CaloMETCollection>(edm::InputTag(metCollectionLabel_));
0094   }
0095   if (isMiniAODMet_) {
0096     patMetToken_ = consumes<pat::METCollection>(edm::InputTag(metCollectionLabel_));
0097   }
0098   //if(isTCMet_){
0099   // tcMetToken_= consumes<reco::METCollection>(edm::InputTag(metCollectionLabel_));
0100   //}
0101 
0102   fill_met_high_level_histo = parameters.getParameter<bool>("fillMetHighLevel");
0103   fillCandidateMap_histos = parameters.getParameter<bool>("fillCandidateMaps");
0104 
0105   //jet cleanup parameters
0106   cleaningParameters_ = pSet.getParameter<ParameterSet>("CleaningParameters");
0107 
0108   diagnosticsParameters_ = pSet.getParameter<std::vector<edm::ParameterSet> >("METDiagonisticsParameters");
0109 
0110   edm::ConsumesCollector iC = consumesCollector();
0111   //DCS
0112   DCSFilter_ = new JetMETDQMDCSFilter(parameters.getParameter<ParameterSet>("DCSFilter"), iC);
0113 
0114   //Vertex requirements
0115   bypassAllPVChecks_ = cleaningParameters_.getParameter<bool>("bypassAllPVChecks");
0116   bypassAllDCSChecks_ = cleaningParameters_.getParameter<bool>("bypassAllDCSChecks");
0117   runcosmics_ = parameters.getUntrackedParameter<bool>("runcosmics");
0118   onlyCleaned_ = parameters.getUntrackedParameter<bool>("onlyCleaned");
0119   vertexTag_ = cleaningParameters_.getParameter<edm::InputTag>("vertexCollection");
0120   vertexToken_ = consumes<std::vector<reco::Vertex> >(edm::InputTag(vertexTag_));
0121 
0122   //Trigger parameters
0123   gtTag_ = cleaningParameters_.getParameter<edm::InputTag>("gtLabel");
0124   gtToken_ = consumes<L1GlobalTriggerReadoutRecord>(edm::InputTag(gtTag_));
0125 
0126   // Other data collections
0127   jetCollectionLabel_ = parameters.getParameter<edm::InputTag>("JetCollectionLabel");
0128   if (isCaloMet_)
0129     caloJetsToken_ = consumes<reco::CaloJetCollection>(jetCollectionLabel_);
0130   //if (isTCMet_)   jptJetsToken_ = consumes<reco::JPTJetCollection>(jetCollectionLabel_);
0131   if (isPFMet_)
0132     pfJetsToken_ = consumes<reco::PFJetCollection>(jetCollectionLabel_);
0133   if (isMiniAODMet_)
0134     patJetsToken_ = consumes<pat::JetCollection>(jetCollectionLabel_);
0135 
0136   HBHENoiseStringMiniAOD = parameters.getParameter<std::string>("HBHENoiseLabelMiniAOD");
0137   HBHEIsoNoiseStringMiniAOD = parameters.getParameter<std::string>("HBHEIsoNoiseLabelMiniAOD");
0138 
0139   hbheNoiseFilterResultTag_ = parameters.getParameter<edm::InputTag>("HBHENoiseFilterResultLabel");
0140   hbheNoiseFilterResultToken_ = consumes<bool>(hbheNoiseFilterResultTag_);
0141   hbheNoiseIsoFilterResultTag_ = parameters.getParameter<edm::InputTag>("HBHENoiseIsoFilterResultLabel");
0142   hbheIsoNoiseFilterResultToken_ = consumes<bool>(hbheNoiseIsoFilterResultTag_);
0143   CSCHaloResultTag_ = parameters.getParameter<edm::InputTag>("CSCHaloResultLabel");
0144   CSCHaloResultToken_ = consumes<bool>(CSCHaloResultTag_);
0145   CSCHalo2015ResultTag_ = parameters.getParameter<edm::InputTag>("CSCHalo2015ResultLabel");
0146   CSCHalo2015ResultToken_ = consumes<bool>(CSCHalo2015ResultTag_);
0147   EcalDeadCellTriggerTag_ = parameters.getParameter<edm::InputTag>("EcalDeadCellTriggerPrimitiveFilterLabel");
0148   EcalDeadCellTriggerToken_ = consumes<bool>(EcalDeadCellTriggerTag_);
0149   EcalDeadCellBoundaryTag_ = parameters.getParameter<edm::InputTag>("EcalDeadCellBoundaryEnergyFilterLabel");
0150   EcalDeadCellBoundaryToken_ = consumes<bool>(EcalDeadCellBoundaryTag_);
0151   eeBadScFilterTag_ = parameters.getParameter<edm::InputTag>("eeBadScFilterLabel");
0152   eeBadScFilterToken_ = consumes<bool>(eeBadScFilterTag_);
0153   HcalStripHaloTag_ = parameters.getParameter<edm::InputTag>("HcalStripHaloFilterLabel");
0154   HcalStripHaloToken_ = consumes<bool>(HcalStripHaloTag_);
0155 
0156   if (isMiniAODMet_) {
0157     METFilterMiniAODLabel_ = parameters.getParameter<edm::InputTag>("FilterResultsLabelMiniAOD");
0158     METFilterMiniAODToken_ = consumes<edm::TriggerResults>(METFilterMiniAODLabel_);
0159 
0160     METFilterMiniAODLabel2_ = parameters.getParameter<edm::InputTag>("FilterResultsLabelMiniAOD2");
0161     METFilterMiniAODToken2_ = consumes<edm::TriggerResults>(METFilterMiniAODLabel2_);
0162   }
0163 
0164   //
0165   nbinsPV_ = parameters.getParameter<int>("pVBin");
0166   nPVMin_ = parameters.getParameter<double>("pVMin");
0167   nPVMax_ = parameters.getParameter<double>("pVMax");
0168 
0169   triggerSelectedSubFolders_ = parameters.getParameter<edm::VParameterSet>("triggerSelectedSubFolders");
0170   for (edm::VParameterSet::const_iterator it = triggerSelectedSubFolders_.begin();
0171        it != triggerSelectedSubFolders_.end();
0172        it++) {
0173     triggerFolderEventFlag_.push_back(new GenericTriggerEventFlag(*it, consumesCollector(), *this));
0174     triggerFolderExpr_.push_back(it->getParameter<std::vector<std::string> >("hltPaths"));
0175     triggerFolderLabels_.push_back(it->getParameter<std::string>("label"));
0176   }
0177 
0178   cleaningParameters_ = parameters.getParameter<ParameterSet>("CleaningParameters");
0179 
0180   verbose_ = parameters.getParameter<int>("verbose");
0181 
0182   FolderName_ = parameters.getUntrackedParameter<std::string>("FolderName");
0183 
0184   l1gtTrigMenuToken_ = esConsumes<edm::Transition::BeginRun>();
0185 }
0186 
0187 // ***********************************************************
0188 METAnalyzer::~METAnalyzer() {
0189   for (std::vector<GenericTriggerEventFlag*>::const_iterator it = triggerFolderEventFlag_.begin();
0190        it != triggerFolderEventFlag_.end();
0191        it++) {
0192     delete *it;
0193   }
0194   delete DCSFilter_;
0195 }
0196 
0197 void METAnalyzer::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const& iRun, edm::EventSetup const&) {
0198   std::string DirName = FolderName_ + metCollectionLabel_.label();
0199   ibooker.setCurrentFolder(DirName);
0200   // since this module does things in dqmEndRun, we need to make sure to have
0201   // per-run histograms.
0202   ibooker.setScope(MonitorElementData::Scope::RUN);
0203 
0204   if (!folderNames_.empty()) {
0205     folderNames_.clear();
0206   }
0207   if (runcosmics_) {
0208     folderNames_.push_back("Uncleaned");
0209   } else {
0210     if (!onlyCleaned_) {
0211       folderNames_.push_back("Uncleaned");
0212     }
0213     folderNames_.push_back("Cleaned");
0214     folderNames_.push_back("DiJet");
0215     if (!isMiniAODMet_) {
0216       folderNames_.push_back("ZJets");
0217     }
0218   }
0219   for (std::vector<std::string>::const_iterator ic = folderNames_.begin(); ic != folderNames_.end(); ic++) {
0220     bookMESet(DirName + "/" + *ic, ibooker, map_dijet_MEs);
0221   }
0222 }
0223 
0224 // ***********************************************************
0225 void METAnalyzer::bookMESet(std::string DirName,
0226                             DQMStore::IBooker& ibooker,
0227                             std::map<std::string, MonitorElement*>& map_of_MEs) {
0228   bool bLumiSecPlot = fill_met_high_level_histo;
0229   //bool inTriggerPathPlots=false;
0230   bool fillPFCandidatePlots = false;
0231   bool fillZPlots = false;
0232 
0233   if (DirName.find("Cleaned") != std::string::npos) {
0234     fillPFCandidatePlots = true;
0235     bookMonitorElement(DirName, ibooker, map_of_MEs, bLumiSecPlot, fillPFCandidatePlots, fillZPlots);
0236     //for (unsigned int i = 0; i<triggerFolderEventFlag_.size(); i++) {
0237     //fillPFCandidatePlots=false;
0238     //if (triggerFolderEventFlag_[i]->on()) {
0239     //bookMonitorElement(DirName+"/"+triggerFolderLabels_[i],ibooker,map_of_MEs,bLumiSecPlot,fillPFCandidatePlots,fillZPlots);
0240     //}
0241     //}
0242   } else if (DirName.find("ZJets") != std::string::npos) {
0243     fillPFCandidatePlots = false;
0244     fillZPlots = true;
0245     bookMonitorElement(DirName, ibooker, map_of_MEs, bLumiSecPlot, fillPFCandidatePlots, fillZPlots);
0246   } else {
0247     bookMonitorElement(DirName, ibooker, map_of_MEs, bLumiSecPlot, fillPFCandidatePlots, fillZPlots);
0248   }
0249 }
0250 
0251 // ***********************************************************
0252 void METAnalyzer::bookMonitorElement(std::string DirName,
0253                                      DQMStore::IBooker& ibooker,
0254                                      std::map<std::string, MonitorElement*>& map_of_MEs,
0255                                      bool bLumiSecPlot = false,
0256                                      bool fillPFCandPlots = false,
0257                                      bool fillZPlots = false) {
0258   if (verbose_)
0259     std::cout << "bookMonitorElement " << DirName << std::endl;
0260 
0261   ibooker.setCurrentFolder(DirName);
0262   if (fillZPlots) {
0263     if (isCaloMet_) {
0264       meZJets_u_par = ibooker.book1D("u_parallel_Z_inc", "u_parallel_Z_inc", 50, -1000., 75);
0265     } else {
0266       meZJets_u_par = ibooker.book1D("u_parallel_Z_inc", "u_parallel_Z_inc", 50, -800., 75);
0267     }
0268     meZJets_u_par_ZPt_0_15 = ibooker.book1D("u_parallel_ZPt_0_15", "u_parallel_ZPt_0_15", 50, -100, 75);
0269     meZJets_u_par_ZPt_15_30 = ibooker.book1D("u_parallel_ZPt_15_30", "u_parallel_ZPt_15_30", 50, -100, 50);
0270     meZJets_u_par_ZPt_30_55 = ibooker.book1D("u_parallel_ZPt_30_55", "u_parallel_ZPt_30_55", 50, -175, 50);
0271     meZJets_u_par_ZPt_55_75 = ibooker.book1D("u_parallel_ZPt_55_75", "u_parallel_ZPt_55_75", 50, -175, 0);
0272     meZJets_u_par_ZPt_75_150 = ibooker.book1D("u_parallel_ZPt_75_150", "u_parallel_ZPt_75_150", 50, -300, 0);
0273     if (isCaloMet_) {
0274       meZJets_u_par_ZPt_150_290 = ibooker.book1D("u_parallel_ZPt_150_290", "u_parallel_ZPt_150_290", 50, -750, -100);
0275     } else {
0276       meZJets_u_par_ZPt_150_290 = ibooker.book1D("u_parallel_ZPt_150_290", "u_parallel_ZPt_150_290", 50, -450, -50);
0277     }
0278     if (isCaloMet_) {
0279       meZJets_u_par_ZPt_290 = ibooker.book1D("u_parallel_ZPt_290", "u_parallel_ZPt_290", 50, -1000., -350.);
0280     } else {
0281       meZJets_u_par_ZPt_290 = ibooker.book1D("u_parallel_ZPt_290", "u_parallel_ZPt_290", 50, -750., -150.);
0282     }
0283     meZJets_u_perp = ibooker.book1D("u_perp_Z_inc", "u_perp_Z_inc", 50, -85., 85.);
0284     meZJets_u_perp_ZPt_0_15 = ibooker.book1D("u_perp_ZPt_0_15", "u_perp_ZPt_0_15", 50, -85., 85.);
0285     meZJets_u_perp_ZPt_15_30 = ibooker.book1D("u_perp_ZPt_15_30", "u_perp_ZPt_15_30", 50, -85., 85.);
0286     meZJets_u_perp_ZPt_30_55 = ibooker.book1D("u_perp_ZPt_30_55", "u_perp_ZPt_30_55", 50, -85., 85.);
0287     meZJets_u_perp_ZPt_55_75 = ibooker.book1D("u_perp_ZPt_55_75", "u_perp_ZPt_55_75", 50, -85., 85.);
0288     meZJets_u_perp_ZPt_75_150 = ibooker.book1D("u_perp_ZPt_75_150", "u_perp_ZPt_75_150", 50, -85., 85.);
0289     meZJets_u_perp_ZPt_150_290 = ibooker.book1D("u_perp_ZPt_150_290", "u_perp_ZPt_150_290", 50, -85., 85.);
0290     meZJets_u_perp_ZPt_290 = ibooker.book1D("u_perp_ZPt_290", "u_perp_ZPt_290", 50, -85., 85.);
0291 
0292     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_Z_inc", meZJets_u_par));
0293     map_of_MEs.insert(
0294         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_0_15", meZJets_u_par_ZPt_0_15));
0295     map_of_MEs.insert(
0296         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_15_30", meZJets_u_par_ZPt_15_30));
0297     map_of_MEs.insert(
0298         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_30_55", meZJets_u_par_ZPt_30_55));
0299     map_of_MEs.insert(
0300         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_55_75", meZJets_u_par_ZPt_55_75));
0301     map_of_MEs.insert(
0302         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_75_150", meZJets_u_par_ZPt_75_150));
0303     map_of_MEs.insert(
0304         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_150_290", meZJets_u_par_ZPt_150_290));
0305     map_of_MEs.insert(
0306         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_parallel_ZPt_290", meZJets_u_par_ZPt_290));
0307 
0308     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_Z_inc", meZJets_u_perp));
0309     map_of_MEs.insert(
0310         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_0_15", meZJets_u_perp_ZPt_0_15));
0311     map_of_MEs.insert(
0312         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_15_30", meZJets_u_perp_ZPt_15_30));
0313     map_of_MEs.insert(
0314         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_30_55", meZJets_u_perp_ZPt_30_55));
0315     map_of_MEs.insert(
0316         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_55_75", meZJets_u_perp_ZPt_55_75));
0317     map_of_MEs.insert(
0318         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_75_150", meZJets_u_perp_ZPt_75_150));
0319     map_of_MEs.insert(
0320         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_150_290", meZJets_u_perp_ZPt_150_290));
0321     map_of_MEs.insert(
0322         std::pair<std::string, MonitorElement*>(DirName + "/" + "u_perp_ZPt_290", meZJets_u_perp_ZPt_290));
0323   }
0324 
0325   if (!fillZPlots) {
0326     hMEx = ibooker.book1D("MEx", "MEx", 200, -500, 500);
0327     hMEy = ibooker.book1D("MEy", "MEy", 200, -500, 500);
0328     hMET = ibooker.book1D("MET", "MET", 200, 0, 1000);
0329 
0330     {
0331       auto scope = DQMStore::IBooker::UseLumiScope(ibooker);
0332       hMET_2 = ibooker.book1D("MET_2", "MET Range 2", 200, 0, 2000);
0333       hSumET = ibooker.book1D("SumET", "SumET", 400, 0, 4000);
0334       hMETSig = ibooker.book1D("METSig", "METSig", 51, 0, 51);
0335       hMETPhi = ibooker.book1D("METPhi", "METPhi", 60, -M_PI, M_PI);
0336     }
0337 
0338     hMET_logx = ibooker.book1D("MET_logx", "MET_logx", 40, -1, 9);
0339     hSumET_logx = ibooker.book1D("SumET_logx", "SumET_logx", 40, -1, 9);
0340 
0341     hMEx->setAxisTitle("MEx [GeV]", 1);
0342     hMEy->setAxisTitle("MEy [GeV]", 1);
0343     hMET->setAxisTitle("MET [GeV]", 1);
0344     hMET_2->setAxisTitle("MET [GeV]", 1);
0345     hSumET->setAxisTitle("SumET [GeV]", 1);
0346     hMETSig->setAxisTitle("METSig", 1);
0347     hMETPhi->setAxisTitle("METPhi [rad]", 1);
0348     hMET_logx->setAxisTitle("log(MET) [GeV]", 1);
0349     hSumET_logx->setAxisTitle("log(SumET) [GeV]", 1);
0350 
0351     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MEx", hMEx));
0352     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MEy", hMEy));
0353     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET", hMET));
0354     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_2", hMET_2));
0355     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "SumET", hSumET));
0356     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METSig", hMETSig));
0357     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhi", hMETPhi));
0358     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_logx", hMET_logx));
0359     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "SumET_logx", hSumET_logx));
0360 
0361     hMET_HBHENoiseFilter = ibooker.book1D("MET_HBHENoiseFilter", "MET_HBHENoiseFiltered", 200, 0, 1000);
0362     hMET_CSCTightHaloFilter = ibooker.book1D("MET_CSCTightHaloFilter", "MET_CSCTightHaloFiltered", 200, 0, 1000);
0363     hMET_eeBadScFilter = ibooker.book1D("MET_eeBadScFilter", "MET_eeBadScFiltered", 200, 0, 1000);
0364     hMET_HBHEIsoNoiseFilter = ibooker.book1D("MET_HBHEIsoNoiseFilter", "MET_HBHEIsoNoiseFiltered", 200, 0, 1000);
0365     hMET_CSCTightHalo2015Filter =
0366         ibooker.book1D("MET_CSCTightHalo2015Filter", "MET_CSCTightHalo2015Filtered", 200, 0, 1000);
0367     hMET_EcalDeadCellTriggerFilter =
0368         ibooker.book1D("MET_EcalDeadCellTriggerFilter", "MET_EcalDeadCellTriggerFiltered", 200, 0, 1000);
0369     hMET_EcalDeadCellBoundaryFilter =
0370         ibooker.book1D("MET_EcalDeadCellBoundaryFilter", "MET_EcalDeadCellBoundaryFiltered", 200, 0, 1000);
0371     hMET_HcalStripHaloFilter = ibooker.book1D("MET_HcalStripHaloFilter", "MET_HcalStripHaloFiltered", 200, 0, 1000);
0372 
0373     map_of_MEs.insert(
0374         std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_HBHENoiseFilter", hMET_HBHENoiseFilter));
0375     map_of_MEs.insert(
0376         std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_CSCTightHaloFilter", hMET_CSCTightHaloFilter));
0377     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_eeBadScFilter", hMET_eeBadScFilter));
0378     map_of_MEs.insert(
0379         std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_HBHEIsoNoiseFilter", hMET_HBHEIsoNoiseFilter));
0380     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_CSCTightHalo2015Filter",
0381                                                               hMET_CSCTightHalo2015Filter));
0382     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_EcalDeadCellTriggerFilter",
0383                                                               hMET_EcalDeadCellTriggerFilter));
0384     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_EcalDeadCellBoundaryFilter",
0385                                                               hMET_EcalDeadCellBoundaryFilter));
0386     map_of_MEs.insert(
0387         std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_HcalStripHaloFilter", hMET_HcalStripHaloFilter));
0388 
0389     // Book NPV profiles --> would some of these profiles be interesting for other MET types too
0390     //----------------------------------------------------------------------------
0391     meMEx_profile = ibooker.bookProfile("MEx_profile", "met.px()", nbinsPV_, nPVMin_, nPVMax_, 200, -500, 500);
0392     meMEy_profile = ibooker.bookProfile("MEy_profile", "met.py()", nbinsPV_, nPVMin_, nPVMax_, 200, -500, 500);
0393     meMET_profile = ibooker.bookProfile("MET_profile", "met.pt()", nbinsPV_, nPVMin_, nPVMax_, 200, 0, 1000);
0394     meSumET_profile = ibooker.bookProfile("SumET_profile", "met.sumEt()", nbinsPV_, nPVMin_, nPVMax_, 400, 0, 4000);
0395     // Set NPV profiles x-axis title
0396     //----------------------------------------------------------------------------
0397     meMEx_profile->setAxisTitle("nvtx", 1);
0398     meMEy_profile->setAxisTitle("nvtx", 1);
0399     meMET_profile->setAxisTitle("nvtx", 1);
0400     meSumET_profile->setAxisTitle("nvtx", 1);
0401 
0402     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MEx_profile", meMEx_profile));
0403     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MEy_profile", meMEy_profile));
0404     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_profile", meMET_profile));
0405     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "SumET_profile", meSumET_profile));
0406 
0407     if (isCaloMet_) {
0408       hCaloHadEtInHB = ibooker.book1D("CaloHadEtInHB", "CaloHadEtInHB", 50, 0, 2000);
0409       hCaloHadEtInHB->setAxisTitle("Had Et [GeV]", 1);
0410       hCaloHadEtInHO = ibooker.book1D("CaloHadEtInHO", "CaloHadEtInHO", 25, 0, 500);
0411       hCaloHadEtInHO->setAxisTitle("Had Et [GeV]", 1);
0412       hCaloHadEtInHE = ibooker.book1D("CaloHadEtInHE", "CaloHadEtInHE", 50, 0, 2000);
0413       hCaloHadEtInHE->setAxisTitle("Had Et [GeV]", 1);
0414       hCaloHadEtInHF = ibooker.book1D("CaloHadEtInHF", "CaloHadEtInHF", 50, 0, 1000);
0415       hCaloHadEtInHF->setAxisTitle("Had Et [GeV]", 1);
0416       hCaloEmEtInHF = ibooker.book1D("CaloEmEtInHF", "CaloEmEtInHF", 25, 0, 500);
0417       hCaloEmEtInHF->setAxisTitle("EM Et [GeV]", 1);
0418       hCaloEmEtInEE = ibooker.book1D("CaloEmEtInEE", "CaloEmEtInEE", 50, 0, 1000);
0419       hCaloEmEtInEE->setAxisTitle("EM Et [GeV]", 1);
0420       hCaloEmEtInEB = ibooker.book1D("CaloEmEtInEB", "CaloEmEtInEB", 50, 0, 2000);
0421       hCaloEmEtInEB->setAxisTitle("EM Et [GeV]", 1);
0422 
0423       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloHadEtInHO", hCaloHadEtInHO));
0424       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloHadEtInHF", hCaloHadEtInHF));
0425       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloHadEtInHE", hCaloHadEtInHE));
0426       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloHadEtInHB", hCaloHadEtInHB));
0427       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEmEtInHF", hCaloEmEtInHF));
0428       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEmEtInEE", hCaloEmEtInEE));
0429       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEmEtInEB", hCaloEmEtInEB));
0430 
0431       hCaloMETPhi020 = ibooker.book1D("CaloMETPhi020", "CaloMETPhi020", 60, -M_PI, M_PI);
0432       hCaloMETPhi020->setAxisTitle("METPhi [rad] (MET>20 GeV)", 1);
0433 
0434       hCaloEtFractionHadronic = ibooker.book1D("CaloEtFractionHadronic", "CaloEtFractionHadronic", 50, 0, 1);
0435       hCaloEtFractionHadronic->setAxisTitle("Hadronic Et Fraction", 1);
0436       hCaloEmEtFraction = ibooker.book1D("CaloEmEtFraction", "CaloEmEtFraction", 50, 0, 1);
0437       hCaloEmEtFraction->setAxisTitle("EM Et Fraction", 1);
0438 
0439       hCaloEmEtFraction020 = ibooker.book1D("CaloEmEtFraction020", "CaloEmEtFraction020", 50, 0, 1);
0440       hCaloEmEtFraction020->setAxisTitle("EM Et Fraction (MET>20 GeV)", 1);
0441 
0442       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloMETPhi020", hCaloMETPhi020));
0443       map_of_MEs.insert(
0444           std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEtFractionHadronic", hCaloEtFractionHadronic));
0445       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEmEtFraction", hCaloEmEtFraction));
0446       map_of_MEs.insert(
0447           std::pair<std::string, MonitorElement*>(DirName + "/" + "CaloEmEtFraction020", hCaloEmEtFraction020));
0448     }
0449 
0450     if (isPFMet_) {
0451       if (fillPFCandPlots &&
0452           fillCandidateMap_histos) {  //first bool internal checks for subdirectory filling, second bool given in cfg file, checks that we fill maps only in one module in total
0453 
0454         meCHF_Barrel = ibooker.book1D("PfChargedHadronEtFractionBarrel", "chargedHadronEtFractionBarrel", 50, 0, 1);
0455         meCHF_EndcapPlus =
0456             ibooker.book1D("PfChargedHadronEtFractionEndcapPlus", "chargedHadronEtFractionEndcapPlus", 50, 0, 1);
0457         meCHF_EndcapMinus =
0458             ibooker.book1D("PfChargedHadronEtFractionEndcapMinus", "chargedHadronEtFractionEndcapMinus", 50, 0, 1);
0459         meCHF_Barrel_BXm1Empty = ibooker.book1D(
0460             "PfChargedHadronEtFractionBarrel_BXm1Empty", "chargedHadronEtFractionBarrel prev empty bunch", 50, 0, 1);
0461         meCHF_EndcapPlus_BXm1Empty = ibooker.book1D("PfChargedHadronEtFractionEndcapPlus_BXm1Empty",
0462                                                     "chargedHadronEtFractionEndcapPlus prev empty bunch",
0463                                                     50,
0464                                                     0,
0465                                                     1);
0466         meCHF_EndcapMinus_BXm1Empty = ibooker.book1D("PfChargedHadronEtFractionEndcapMinus_BXm1Empty",
0467                                                      "chargedHadronEtFractionEndcapMinus prev empty bunch",
0468                                                      50,
0469                                                      0,
0470                                                      1);
0471         meCHF_Barrel_BXm1Filled = ibooker.book1D("PfChargedHadronEtFractionBarrel_BXm1Filled",
0472                                                  "chargedHadronEtFractionBarrel prev filled 2 bunches",
0473                                                  50,
0474                                                  0,
0475                                                  1);
0476         meCHF_EndcapPlus_BXm1Filled = ibooker.book1D("PfChargedHadronEtFractionEndcapPlus_BXm1Filled",
0477                                                      "chargedHadronEtFractionEndcapPlus prev filled bunch",
0478                                                      50,
0479                                                      0,
0480                                                      1);
0481         meCHF_EndcapMinus_BXm1Filled = ibooker.book1D("PfChargedHadronEtFractionEndcapMinus_BXm1Filled",
0482                                                       "chargedHadronEtFractionEndcapMinus prev filled bunch",
0483                                                       50,
0484                                                       0,
0485                                                       1);
0486 
0487         map_of_MEs.insert(
0488             std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEtFractionBarrel", meCHF_Barrel));
0489         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEtFractionEndcapPlus",
0490                                                                   meCHF_EndcapPlus));
0491         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0492             DirName + "/" + "PfChargedHadronEtFractionEndcapMinus", meCHF_EndcapMinus));
0493         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0494             DirName + "/" + "PfChargedHadronEtFractionBarrel_BXm1Empty", meCHF_Barrel_BXm1Empty));
0495         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0496             DirName + "/" + "PfChargedHadronEtFractionEndcapPlus_BXm1Empty", meCHF_EndcapPlus_BXm1Empty));
0497         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0498             DirName + "/" + "PfChargedHadronEtFractionEndcapMinus_BXm1Empty", meCHF_EndcapMinus_BXm1Empty));
0499         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm2BXm1Empty",         meCHF_Barrel_BXm2BXm1Empty));
0500         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm2BXm1Empty",     meCHF_EndcapPlus_BXm2BXm1Empty));
0501         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm2BXm1Empty",    meCHF_EndcapMinus_BXm2BXm1Empty));
0502         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0503             DirName + "/" + "PfChargedHadronEtFractionBarrel_BXm1Filled", meCHF_Barrel_BXm1Filled));
0504         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0505             DirName + "/" + "PfChargedHadronEtFractionEndcapPlus_BXm1Filled", meCHF_EndcapPlus_BXm1Filled));
0506         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0507             DirName + "/" + "PfChargedHadronEtFractionEndcapMinus_BXm1Filled", meCHF_EndcapMinus_BXm1Filled));
0508         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm2BXm1Filled",        meCHF_Barrel_BXm2BXm1Filled));
0509         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm2BXm1Filled",    meCHF_EndcapPlus_BXm2BXm1Filled));
0510         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm2BXm1Filled",   meCHF_EndcapMinus_BXm2BXm1Filled));
0511 
0512         meNHF_Barrel = ibooker.book1D("PfNeutralHadronEtFractionBarrel", "neutralHadronEtFractionBarrel", 50, 0, 1);
0513         meNHF_EndcapPlus =
0514             ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus", "neutralHadronEtFractionEndcapPlus", 50, 0, 1);
0515         meNHF_EndcapMinus =
0516             ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus", "neutralHadronEtFractionEndcapMinus", 50, 0, 1);
0517         meNHF_Barrel_BXm1Empty = ibooker.book1D(
0518             "PfNeutralHadronEtFractionBarrel_BXm1Empty", "neutralHadronEtFractionBarrel prev empty bunch", 50, 0, 1);
0519         meNHF_EndcapPlus_BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm1Empty",
0520                                                     "neutralHadronEtFractionEndcapPlus prev empty bunch",
0521                                                     50,
0522                                                     0,
0523                                                     1);
0524         meNHF_EndcapMinus_BXm1Empty = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm1Empty",
0525                                                      "neutralHadronEtFractionEndcapMinus prev empty bunch",
0526                                                      50,
0527                                                      0,
0528                                                      1);
0529         //meNHF_Barrel_BXm2BXm1Empty         = ibooker.book1D("PfNeutralHadronEtFractionBarrel_BXm2BXm1Empty",         "neutralHadronEtFractionBarrel prev empty 2 bunches",         50, 0,    1);
0530         //meNHF_EndcapPlus_BXm2BXm1Empty     = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Empty",     "neutralHadronEtFractionEndcapPlus prev empty 2 bunches",     50, 0,    1);
0531         //meNHF_EndcapMinus_BXm2BXm1Empty    = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Empty",    "neutralHadronEtFractionEndcapMinus prev empty 2 bunches",    50, 0,    1);
0532         meNHF_Barrel_BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionBarrel_BXm1Filled",
0533                                                  "neutralHadronEtFractionBarrel prev filled 2 bunches",
0534                                                  50,
0535                                                  0,
0536                                                  1);
0537         meNHF_EndcapPlus_BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm1Filled",
0538                                                      "neutralHadronEtFractionEndcapPlus prev filled bunch",
0539                                                      50,
0540                                                      0,
0541                                                      1);
0542         meNHF_EndcapMinus_BXm1Filled = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm1Filled",
0543                                                       "neutralHadronEtFractionEndcapMinus prev filled bunch",
0544                                                       50,
0545                                                       0,
0546                                                       1);
0547         //meNHF_Barrel_BXm2BXm1Filled        = ibooker.book1D("PfNeutralHadronEtFractionBarrel_BXm2BXm1Filled",        "neutralHadronEtFractionBarrel prev filled 2 bunches",        50, 0,    1);
0548         //meNHF_EndcapPlus_BXm2BXm1Filled    = ibooker.book1D("PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Filled",    "neutralHadronEtFractionEndcapPlus prev filled 2 bunches",    50, 0,    1);
0549         //meNHF_EndcapMinus_BXm2BXm1Filled   = ibooker.book1D("PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Filled",   "neutralHadronEtFractionEndcapMinus prev filled 2 bunches",   50, 0,    1);
0550 
0551         map_of_MEs.insert(
0552             std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEtFractionBarrel", meNHF_Barrel));
0553         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus",
0554                                                                   meNHF_EndcapPlus));
0555         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0556             DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus", meNHF_EndcapMinus));
0557         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0558             DirName + "/" + "PfNeutralHadronEtFractionBarrel_BXm1Empty", meNHF_Barrel_BXm1Empty));
0559         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0560             DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus_BXm1Empty", meNHF_EndcapPlus_BXm1Empty));
0561         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0562             DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus_BXm1Empty", meNHF_EndcapMinus_BXm1Empty));
0563         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm2BXm1Empty",         meNHF_Barrel_BXm2BXm1Empty));
0564         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Empty",     meNHF_EndcapPlus_BXm2BXm1Empty));
0565         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Empty",    meNHF_EndcapMinus_BXm2BXm1Empty));
0566         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0567             DirName + "/" + "PfNeutralHadronEtFractionBarrel_BXm1Filled", meNHF_Barrel_BXm1Filled));
0568         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0569             DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus_BXm1Filled", meNHF_EndcapPlus_BXm1Filled));
0570         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0571             DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus_BXm1Filled", meNHF_EndcapMinus_BXm1Filled));
0572         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm2BXm1Filled",        meNHF_Barrel_BXm2BXm1Filled));
0573         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Filled",    meNHF_EndcapPlus_BXm2BXm1Filled));
0574         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Filled",   meNHF_EndcapMinus_BXm2BXm1Filled));
0575 
0576         mePhF_Barrel = ibooker.book1D("PfPhotonEtFractionBarrel", "photonEtFractionBarrel", 50, 0, 1);
0577         mePhF_EndcapPlus = ibooker.book1D("PfPhotonEtFractionEndcapPlus", "photonEtFractionEndcapPlus", 50, 0, 1);
0578         mePhF_EndcapMinus = ibooker.book1D("PfPhotonEtFractionEndcapMinus", "photonEtFractionEndcapMinus", 50, 0, 1);
0579         mePhF_Barrel_BXm1Empty =
0580             ibooker.book1D("PfPhotonEtFractionBarrel_BXm1Empty", "photonEtFractionBarrel prev empty bunch", 50, 0, 1);
0581         mePhF_EndcapPlus_BXm1Empty = ibooker.book1D(
0582             "PfPhotonEtFractionEndcapPlus_BXm1Empty", "photonEtFractionEndcapPlus prev empty bunch", 50, 0, 1);
0583         mePhF_EndcapMinus_BXm1Empty = ibooker.book1D(
0584             "PfPhotonEtFractionEndcapMinus_BXm1Empty", "photonEtFractionEndcapMinus prev empty bunch", 50, 0, 1);
0585         //mePhF_Barrel_BXm2BXm1Empty         = ibooker.book1D("PfPhotonEtFractionBarrel_BXm2BXm1Empty",         "photonEtFractionBarrel prev empty 2 bunches",         50, 0,    1);
0586         //mePhF_EndcapPlus_BXm2BXm1Empty     = ibooker.book1D("PfPhotonEtFractionEndcapPlus_BXm2BXm1Empty",     "photonEtFractionEndcapPlus prev empty 2 bunches",     50, 0,    1);
0587         //mePhF_EndcapMinus_BXm2BXm1Empty    = ibooker.book1D("PfPhotonEtFractionEndcapMinus_BXm2BXm1Empty",    "photonEtFractionEndcapMinus prev empty 2 bunches",    50, 0,    1);
0588         mePhF_Barrel_BXm1Filled = ibooker.book1D(
0589             "PfPhotonEtFractionBarrel_BXm1Filled", "photonEtFractionBarrel prev filled 2 bunches", 50, 0, 1);
0590         mePhF_EndcapPlus_BXm1Filled = ibooker.book1D(
0591             "PfPhotonEtFractionEndcapPlus_BXm1Filled", "photonEtFractionEndcapPlus prev filled bunch", 50, 0, 1);
0592         mePhF_EndcapMinus_BXm1Filled = ibooker.book1D(
0593             "PfPhotonEtFractionEndcapMinus_BXm1Filled", "photonEtFractionEndcapMinus prev filled bunch", 50, 0, 1);
0594         //mePhF_Barrel_BXm2BXm1Filled        = ibooker.book1D("PfPhotonEtFractionBarrel_BXm2BXm1Filled",        "photonEtFractionBarrel prev filled 2 bunches",        50, 0,    1);
0595         //mePhF_EndcapPlus_BXm2BXm1Filled    = ibooker.book1D("PfPhotonEtFractionEndcapPlus_BXm2BXm1Filled",    "photonEtFractionEndcapPlus prev filled 2 bunches",    50, 0,    1);
0596         //mePhF_EndcapMinus_BXm2BXm1Filled   = ibooker.book1D("PfPhotonEtFractionEndcapMinus_BXm2BXm1Filled",   "photonEtFractionEndcapMinus prev filled 2 bunches",   50, 0,    1);
0597 
0598         map_of_MEs.insert(
0599             std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFractionBarrel", mePhF_Barrel));
0600         map_of_MEs.insert(
0601             std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFractionEndcapPlus", mePhF_EndcapPlus));
0602         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFractionEndcapMinus",
0603                                                                   mePhF_EndcapMinus));
0604         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFractionBarrel_BXm1Empty",
0605                                                                   mePhF_Barrel_BXm1Empty));
0606         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0607             DirName + "/" + "PfPhotonEtFractionEndcapPlus_BXm1Empty", mePhF_EndcapPlus_BXm1Empty));
0608         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0609             DirName + "/" + "PfPhotonEtFractionEndcapMinus_BXm1Empty", mePhF_EndcapMinus_BXm1Empty));
0610         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionBarrel_BXm2BXm1Empty",         mePhF_Barrel_BXm2BXm1Empty));
0611         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm2BXm1Empty",     mePhF_EndcapPlus_BXm2BXm1Empty));
0612         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm2BXm1Empty",    mePhF_EndcapMinus_BXm2BXm1Empty));
0613         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFractionBarrel_BXm1Filled",
0614                                                                   mePhF_Barrel_BXm1Filled));
0615         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0616             DirName + "/" + "PfPhotonEtFractionEndcapPlus_BXm1Filled", mePhF_EndcapPlus_BXm1Filled));
0617         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0618             DirName + "/" + "PfPhotonEtFractionEndcapMinus_BXm1Filled", mePhF_EndcapMinus_BXm1Filled));
0619         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionBarrel_BXm2BXm1Filled",        mePhF_Barrel_BXm2BXm1Filled));
0620         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm2BXm1Filled",    mePhF_EndcapPlus_BXm2BXm1Filled));
0621         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm2BXm1Filled",   mePhF_EndcapMinus_BXm2BXm1Filled));
0622 
0623         meHFHadF_Plus = ibooker.book1D("PfHFHadronEtFractionPlus", "HFHadronEtFractionPlus", 50, 0, 1);
0624         meHFHadF_Minus = ibooker.book1D("PfHFHadronEtFractionMinus", "HFHadronEtFractionMinus", 50, 0, 1);
0625         meHFHadF_Plus_BXm1Empty =
0626             ibooker.book1D("PfHFHadronEtFractionPlus_BXm1Empty", "HFHadronEtFractionPlus prev empty bunch", 50, 0, 1);
0627         meHFHadF_Minus_BXm1Empty =
0628             ibooker.book1D("PfHFHadronEtFractionMinus_BXm1Empty", "HFHadronEtFractionMinus prev empty bunch", 50, 0, 1);
0629         //meHFHadF_Plus_BXm2BXm1Empty     = ibooker.book1D("PfHFHadronEtFractionPlus_BXm2BXm1Empty",     "HFHadronEtFractionPlus prev empty 2 bunches",     50, 0,    1);
0630         //meHFHadF_Minus_BXm2BXm1Empty    = ibooker.book1D("PfHFHadronEtFractionMinus_BXm2BXm1Empty",    "HFHadronEtFractionMinus prev empty 2 bunches",    50, 0,    1);
0631         meHFHadF_Plus_BXm1Filled =
0632             ibooker.book1D("PfHFHadronEtFractionPlus_BXm1Filled", "HFHadronEtFractionPlus prev filled bunch", 50, 0, 1);
0633         meHFHadF_Minus_BXm1Filled = ibooker.book1D(
0634             "PfHFHadronEtFractionMinus_BXm1Filled", "HFHadronEtFractionMinus prev filled bunch", 50, 0, 1);
0635         //meHFHadF_Plus_BXm2BXm1Filled    = ibooker.book1D("PfHFHadronEtFractionPlus_BXm2BXm1Filled",    "HFHadronEtFractionPlus prev filled 2 bunches",    50, 0,    1);
0636         //meHFHadF_Minus_BXm2BXm1Filled   = ibooker.book1D("PfHFHadronEtFractionMinus_BXm2BXm1Filled",   "HFHadronEtFractionMinus prev filled 2 bunches",   50, 0,    1);
0637 
0638         map_of_MEs.insert(
0639             std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFractionPlus", meHFHadF_Plus));
0640         map_of_MEs.insert(
0641             std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFractionMinus", meHFHadF_Minus));
0642         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFractionPlus_BXm1Empty",
0643                                                                   meHFHadF_Plus_BXm1Empty));
0644         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFractionMinus_BXm1Empty",
0645                                                                   meHFHadF_Minus_BXm1Empty));
0646         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionPlus_BXm2BXm1Empty",     meHFHadF_Plus_BXm2BXm1Empty));
0647         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionMinus_BXm2BXm1Empty",    meHFHadF_Minus_BXm2BXm1Empty));
0648         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFractionPlus_BXm1Filled",
0649                                                                   meHFHadF_Plus_BXm1Filled));
0650         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0651             DirName + "/" + "PfHFHadronEtFractionMinus_BXm1Filled", meHFHadF_Minus_BXm1Filled));
0652         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionPlus_BXm2BXm1Filled",    meHFHadF_Plus_BXm2BXm1Filled));
0653         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFHadronEtFractionMinus_BXm2BXm1Filled",   meHFHadF_Minus_BXm2BXm1Filled));
0654 
0655         meHFEMF_Plus = ibooker.book1D("PfHFEMEtFractionPlus", "HFEMEtFractionPlus", 50, 0, 1);
0656         meHFEMF_Minus = ibooker.book1D("PfHFEMEtFractionMinus", "HFEMEtFractionMinus", 50, 0, 1);
0657         meHFEMF_Plus_BXm1Empty =
0658             ibooker.book1D("PfHFEMEtFractionPlus_BXm1Empty", "HFEMEtFractionPlus prev empty bunch", 50, 0, 1);
0659         meHFEMF_Minus_BXm1Empty =
0660             ibooker.book1D("PfHFEMEtFractionMinus_BXm1Empty", "HFEMEtFractionMinus prev empty bunch", 50, 0, 1);
0661         //meHFEMF_Plus_BXm2BXm1Empty     = ibooker.book1D("PfHFEMEtFractionPlus_BXm2BXm1Empty",     "HFEMEtFractionPlus prev empty 2 bunches",     50, 0,    1);
0662         //meHFEMF_Minus_BXm2BXm1Empty    = ibooker.book1D("PfHFEMEtFractionMinus_BXm2BXm1Empty",    "HFEMEtFractionMinus prev empty 2 bunches",    50, 0,    1);
0663         meHFEMF_Plus_BXm1Filled =
0664             ibooker.book1D("PfHFEMEtFractionPlus_BXm1Filled", "HFEMEtFractionPlus prev filled bunch", 50, 0, 1);
0665         meHFEMF_Minus_BXm1Filled =
0666             ibooker.book1D("PfHFEMEtFractionMinus_BXm1Filled", "HFEMEtFractionMinus prev filled bunch", 50, 0, 1);
0667         //meHFEMF_Plus_BXm2BXm1Filled    = ibooker.book1D("PfHFEMEtFractionPlus_BXm2BXm1Filled",    "HFEMEtFractionPlus prev filled 2 bunches",    50, 0,    1);
0668         //meHFEMF_Minus_BXm2BXm1Filled   = ibooker.book1D("PfHFEMEtFractionMinus_BXm2BXm1Filled",   "HFEMEtFractionMinus prev filled 2 bunches",   50, 0,    1);
0669 
0670         map_of_MEs.insert(
0671             std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionPlus", meHFEMF_Plus));
0672         map_of_MEs.insert(
0673             std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionMinus", meHFEMF_Minus));
0674         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionPlus_BXm1Empty",
0675                                                                   meHFEMF_Plus_BXm1Empty));
0676         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionMinus_BXm1Empty",
0677                                                                   meHFEMF_Minus_BXm1Empty));
0678         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionPlus_BXm2BXm1Empty",     meHFEMF_Plus_BXm2BXm1Empty));
0679         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionMinus_BXm2BXm1Empty",    meHFEMF_Minus_BXm2BXm1Empty));
0680         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionPlus_BXm1Filled",
0681                                                                   meHFEMF_Plus_BXm1Filled));
0682         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFractionMinus_BXm1Filled",
0683                                                                   meHFEMF_Minus_BXm1Filled));
0684         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionPlus_BXm2BXm1Filled",    meHFEMF_Plus_BXm2BXm1Filled));
0685         //map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"PfHFEMEtFractionMinus_BXm2BXm1Filled",   meHFEMF_Minus_BXm2BXm1Filled));
0686         /*
0687     meMETPhiChargedHadronsBarrel_BXm2BXm1Filled       = ibooker.book1D("METPhiChargedHadronsBarrel_BXm2BXm1Filled",     "METPhi_PFChargedHadronsBarrel prev two bunches filled",       50, -M_PI,M_PI);
0688     meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled   = ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm2BXm1Filled", "METPhi_PFChargedHadronsEndcapPlus prev two bunches filled",   50, -M_PI,M_PI);
0689     meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled  = ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm2BXm1Filled","METPhi_PFChargedHadronsEndcapMinus prev two bunches filled",  50, -M_PI,M_PI);
0690     meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled       = ibooker.book1D("METPhiNeutralHadronsBarrel_BXm2BXm1Filled",     "METPhi_PFNeutralHadronsBarrel prev two bunches filled",       50, -M_PI,M_PI);
0691     meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled   = ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled", "METPhi_PFNeutralHadronsEndcapPlus prev two bunches filled",   50, -M_PI,M_PI);
0692     meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled  = ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled","METPhi_PFNeutralHadronsEndcapMinus prev two bunches filled",  50, -M_PI,M_PI);
0693     meMETPhiPhotonsBarrel_BXm2BXm1Filled              = ibooker.book1D("METPhiPhotonsBarrel_BXm2BXm1Filled",            "METPhi_PFPhotonsBarrel prev two bunches filled",              50, -M_PI,M_PI);
0694     meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled          = ibooker.book1D("METPhiPhotonsEndcapPlus_BXm2BXm1Filled",        "METPhi_PFPhotonsEndcapPlus prev two bunches filled",          50, -M_PI,M_PI);
0695     meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled         = ibooker.book1D("METPhiPhotonsEndcapMinus_BXm2BXm1Filled",       "METPhi_PFPhotonsEndcapMinus prev two bunches filled",         50, -M_PI,M_PI);
0696     meMETPhiHFHadronsPlus_BXm2BXm1Filled              = ibooker.book1D("METPhiHFHadronsPlus_BXm2BXm1Filled",            "METPhi_PFHFHadronsPlus prev two bunches filled",              50, -M_PI,M_PI);
0697     meMETPhiHFHadronsMinus_BXm2BXm1Filled             = ibooker.book1D("METPhiHFHadronsMinus_BXm2BXm1Filled",           "METPhi_PFHFHadronsMinus prev two bunches filled",             50, -M_PI,M_PI);
0698     meMETPhiHFEGammasPlus_BXm2BXm1Filled              = ibooker.book1D("METPhiHFEGammasPlus_BXm2BXm1Filled",            "METPhi_PFHFEGammasPlus prev two bunches filled",              50, -M_PI,M_PI);
0699     meMETPhiHFEGammasMinus_BXm2BXm1Filled             = ibooker.book1D("METPhiHFEGammasMinus_BXm2BXm1Filled",           "METPhi_PFHFEGammasMinus prev two bunches filled",             50, -M_PI,M_PI);
0700     
0701     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Filled"         ,meMETPhiChargedHadronsBarrel_BXm2BXm1Filled));
0702     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Filled"     ,meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled));
0703     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Filled"    ,meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled));
0704     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Filled"         ,meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled));
0705     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled"     ,meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled));
0706     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled"    ,meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled));
0707     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Filled"                ,meMETPhiPhotonsBarrel_BXm2BXm1Filled));
0708     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Filled"            ,meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled));
0709     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Filled"           ,meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled));
0710     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Filled"                ,meMETPhiHFHadronsPlus_BXm2BXm1Filled));
0711     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Filled"               ,meMETPhiHFHadronsMinus_BXm2BXm1Filled));
0712     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Filled"                ,meMETPhiHFEGammasPlus_BXm2BXm1Filled));
0713     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Filled"               ,meMETPhiHFEGammasMinus_BXm2BXm1Filled));
0714     
0715     meMETPhiChargedHadronsBarrel_BXm2BXm1Empty       = ibooker.book1D("METPhiChargedHadronsBarrel_BXm2BXm1Empty",     "METPhi_PFChargedHadronsBarrel prev two bunches empty",       50, -M_PI,M_PI);
0716     meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty   = ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm2BXm1Empty", "METPhi_PFChargedHadronsEndcapPlus prev two bunches empty",   50, -M_PI,M_PI);
0717     meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty  = ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm2BXm1Empty","METPhi_PFChargedHadronsEndcapMinus prev two bunches empty",  50, -M_PI,M_PI);
0718     meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty       = ibooker.book1D("METPhiNeutralHadronsBarrel_BXm2BXm1Empty",     "METPhi_PFNeutralHadronsBarrel prev two bunches empty",       50, -M_PI,M_PI);
0719     meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty   = ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty", "METPhi_PFNeutralHadronsEndcapPlus prev two bunches empty",   50, -M_PI,M_PI);
0720     meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty  = ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty","METPhi_PFNeutralHadronsEndcapMinus prev two bunches empty",  50, -M_PI,M_PI);
0721     meMETPhiPhotonsBarrel_BXm2BXm1Empty              = ibooker.book1D("METPhiPhotonsBarrel_BXm2BXm1Empty",            "METPhi_PFPhotonsBarrel prev two bunches empty",              50, -M_PI,M_PI);
0722     meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty          = ibooker.book1D("METPhiPhotonsEndcapPlus_BXm2BXm1Empty",        "METPhi_PFPhotonsEndcapPlus prev two bunches empty",          50, -M_PI,M_PI);
0723     meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty         = ibooker.book1D("METPhiPhotonsEndcapMinus_BXm2BXm1Empty",       "METPhi_PFPhotonsEndcapMinus prev two bunches empty",         50, -M_PI,M_PI);
0724     meMETPhiHFHadronsPlus_BXm2BXm1Empty              = ibooker.book1D("METPhiHFHadronsPlus_BXm2BXm1Empty",            "METPhi_PFHFHadronsPlus prev two bunches empty",              50, -M_PI,M_PI);
0725     meMETPhiHFHadronsMinus_BXm2BXm1Empty             = ibooker.book1D("METPhiHFHadronsMinus_BXm2BXm1Empty",           "METPhi_PFHFHadronsMinus prev two bunches empty",             50, -M_PI,M_PI);
0726     meMETPhiHFEGammasPlus_BXm2BXm1Empty              = ibooker.book1D("METPhiHFEGammasPlus_BXm2BXm1Empty",            "METPhi_PFHFEGammasPlus prev two bunches empty",              50, -M_PI,M_PI);
0727     meMETPhiHFEGammasMinus_BXm2BXm1Empty             = ibooker.book1D("METPhiHFEGammasMinus_BXm2BXm1Empty",           "METPhi_PFHFEGammasMinus prev two bunches empty",             50, -M_PI,M_PI);
0728     
0729     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Empty"         ,meMETPhiChargedHadronsBarrel_BXm2BXm1Empty));
0730     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Empty"     ,meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty));
0731     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Empty"    ,meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty));
0732     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Empty"         ,meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty));
0733     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty"     ,meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty));
0734     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty"    ,meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty));
0735     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Empty"                ,meMETPhiPhotonsBarrel_BXm2BXm1Empty));
0736     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Empty"            ,meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty));
0737     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Empty"           ,meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty));
0738     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Empty"                ,meMETPhiHFHadronsPlus_BXm2BXm1Empty));
0739     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Empty"               ,meMETPhiHFHadronsMinus_BXm2BXm1Empty));
0740     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Empty"                ,meMETPhiHFEGammasPlus_BXm2BXm1Empty));
0741     map_of_MEs.insert(std::pair<std::string,MonitorElement*>(DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Empty"               ,meMETPhiHFEGammasMinus_BXm2BXm1Empty));
0742     */
0743         //histos where one previous bunch was empty/filled
0744         mePhotonEtFraction_BXm1Empty =
0745             ibooker.book1D("PfPhotonEtFraction_BXm1Empty", "photonEtFraction() prev empty bunch", 50, 0, 1);
0746         mePhotonEtFraction_BXm1Filled =
0747             ibooker.book1D("PfPhotonEtFraction_BXm1Filled", "photonEtFraction() prev filled bunch", 50, 0, 1);
0748         meNeutralHadronEtFraction_BXm1Empty = ibooker.book1D(
0749             "PfNeutralHadronEtFraction_BXm1Empty", "neutralHadronEtFraction() prev empty bunch", 50, 0, 1);
0750         meNeutralHadronEtFraction_BXm1Filled = ibooker.book1D(
0751             "PfNeutralHadronEtFraction_BXm1Filled", "neutralHadronEtFraction() prev filled bunch", 50, 0, 1);
0752         meChargedHadronEtFraction_BXm1Empty = ibooker.book1D(
0753             "PfChargedHadronEtFraction_BXm1Empty", "chargedHadronEtFraction() prev empty bunch", 50, 0, 1);
0754         meChargedHadronEtFraction_BXm1Filled = ibooker.book1D(
0755             "PfChargedHadronEtFraction_BXm1Filled", "chargedHadronEtFraction() prev filled bunch", 50, 0, 1);
0756         meMET_BXm1Empty = ibooker.book1D("MET_BXm1Empty", "MET prev empty bunch", 200, 0, 1000);
0757         meMET_BXm1Filled = ibooker.book1D("MET_BXm1Filled", "MET prev filled bunch", 200, 0, 1000);
0758         meSumET_BXm1Empty = ibooker.book1D("SumET_BXm1Empty", "SumET prev empty bunch", 400, 0, 4000);
0759         meSumET_BXm1Filled = ibooker.book1D("SumET_BXm1Filled", "SumET prev filled bunch", 400, 0, 4000);
0760 
0761         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFraction_BXm1Empty",
0762                                                                   mePhotonEtFraction_BXm1Empty));
0763         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFraction_BXm1Filled",
0764                                                                   mePhotonEtFraction_BXm1Filled));
0765         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEtFraction_BXm1Empty",
0766                                                                   meNeutralHadronEtFraction_BXm1Empty));
0767         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralEtFraction_BXm1Filled",
0768                                                                   meNeutralHadronEtFraction_BXm1Filled));
0769         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEtFraction_BXm1Empty",
0770                                                                   meChargedHadronEtFraction_BXm1Empty));
0771         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedEtFraction_BXm1Filled",
0772                                                                   meChargedHadronEtFraction_BXm1Filled));
0773         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_BXm1Empty", meMET_BXm1Empty));
0774         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MET_BXm1Filled", meMET_BXm1Filled));
0775         map_of_MEs.insert(
0776             std::pair<std::string, MonitorElement*>(DirName + "/" + "SumET_BXm1Empty", meSumET_BXm1Empty));
0777         map_of_MEs.insert(
0778             std::pair<std::string, MonitorElement*>(DirName + "/" + "SumET_BXm1Filled", meSumET_BXm1Filled));
0779 
0780         meMETPhiChargedHadronsBarrel_BXm1Filled = ibooker.book1D(
0781             "METPhiChargedHadronsBarrel_BXm1Filled", "METPhi_PFChargedHadronsBarrel prev bunch filled", 50, -M_PI, M_PI);
0782         meMETPhiChargedHadronsEndcapPlus_BXm1Filled =
0783             ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm1Filled",
0784                            "METPhi_PFChargedHadronsEndcapPlus prev bunch filled",
0785                            50,
0786                            -M_PI,
0787                            M_PI);
0788         meMETPhiChargedHadronsEndcapMinus_BXm1Filled =
0789             ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm1Filled",
0790                            "METPhi_PFChargedHadronsEndcapMinus prev bunch filled",
0791                            50,
0792                            -M_PI,
0793                            M_PI);
0794         meMETPhiNeutralHadronsBarrel_BXm1Filled = ibooker.book1D(
0795             "METPhiNeutralHadronsBarrel_BXm1Filled", "METPhi_PFNeutralHadronsBarrel prev bunch filled", 50, -M_PI, M_PI);
0796         meMETPhiNeutralHadronsEndcapPlus_BXm1Filled =
0797             ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm1Filled",
0798                            "METPhi_PFNeutralHadronsEndcapPlus prev bunch filled",
0799                            50,
0800                            -M_PI,
0801                            M_PI);
0802         meMETPhiNeutralHadronsEndcapMinus_BXm1Filled =
0803             ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm1Filled",
0804                            "METPhi_PFNeutralHadronsEndcapMinus prev bunch filled",
0805                            50,
0806                            -M_PI,
0807                            M_PI);
0808         meMETPhiPhotonsBarrel_BXm1Filled = ibooker.book1D(
0809             "METPhiPhotonsBarrel_BXm1Filled", "METPhi_PFPhotonsBarrel prev bunch filled", 50, -M_PI, M_PI);
0810         meMETPhiPhotonsEndcapPlus_BXm1Filled = ibooker.book1D(
0811             "METPhiPhotonsEndcapPlus_BXm1Filled", "METPhi_PFPhotonsEndcapPlus prev bunch filled", 50, -M_PI, M_PI);
0812         meMETPhiPhotonsEndcapMinus_BXm1Filled = ibooker.book1D(
0813             "METPhiPhotonsEndcapMinus_BXm1Filled", "METPhi_PFPhotonsEndcapMinus prev bunch filled", 50, -M_PI, M_PI);
0814         meMETPhiHFHadronsPlus_BXm1Filled = ibooker.book1D(
0815             "METPhiHFHadronsPlus_BXm1Filled", "METPhi_PFHFHadronsPlus prev bunch filled", 50, -M_PI, M_PI);
0816         meMETPhiHFHadronsMinus_BXm1Filled = ibooker.book1D(
0817             "METPhiHFHadronsMinus_BXm1Filled", "METPhi_PFHFHadronsMinus prev bunch filled", 50, -M_PI, M_PI);
0818         meMETPhiHFEGammasPlus_BXm1Filled = ibooker.book1D(
0819             "METPhiHFEGammasPlus_BXm1Filled", "METPhi_PFHFEGammasPlus prev bunch filled", 50, -M_PI, M_PI);
0820         meMETPhiHFEGammasMinus_BXm1Filled = ibooker.book1D(
0821             "METPhiHFEGammasMinus_BXm1Filled", "METPhi_PFHFEGammasMinus prev bunch filled", 50, -M_PI, M_PI);
0822 
0823         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0824             DirName + "/" + "METPhiChargedHadronsBarrel_BXm1Filled", meMETPhiChargedHadronsBarrel_BXm1Filled));
0825         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0826             DirName + "/" + "METPhiChargedHadronsEndcapPlus_BXm1Filled", meMETPhiChargedHadronsEndcapPlus_BXm1Filled));
0827         map_of_MEs.insert(
0828             std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiChargedHadronsEndcapMinus_BXm1Filled",
0829                                                     meMETPhiChargedHadronsEndcapMinus_BXm1Filled));
0830         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0831             DirName + "/" + "METPhiNeutralHadronsBarrel_BXm1Filled", meMETPhiNeutralHadronsBarrel_BXm1Filled));
0832         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0833             DirName + "/" + "METPhiNeutralHadronsEndcapPlus_BXm1Filled", meMETPhiNeutralHadronsEndcapPlus_BXm1Filled));
0834         map_of_MEs.insert(
0835             std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiNeutralHadronsEndcapMinus_BXm1Filled",
0836                                                     meMETPhiNeutralHadronsEndcapMinus_BXm1Filled));
0837         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsBarrel_BXm1Filled",
0838                                                                   meMETPhiPhotonsBarrel_BXm1Filled));
0839         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapPlus_BXm1Filled",
0840                                                                   meMETPhiPhotonsEndcapPlus_BXm1Filled));
0841         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapMinus_BXm1Filled",
0842                                                                   meMETPhiPhotonsEndcapMinus_BXm1Filled));
0843         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsPlus_BXm1Filled",
0844                                                                   meMETPhiHFHadronsPlus_BXm1Filled));
0845         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsMinus_BXm1Filled",
0846                                                                   meMETPhiHFHadronsMinus_BXm1Filled));
0847         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasPlus_BXm1Filled",
0848                                                                   meMETPhiHFEGammasPlus_BXm1Filled));
0849         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasMinus_BXm1Filled",
0850                                                                   meMETPhiHFEGammasMinus_BXm1Filled));
0851 
0852         meMETPhiChargedHadronsBarrel_BXm1Empty = ibooker.book1D(
0853             "METPhiChargedHadronsBarrel_BXm1Empty", "METPhi_PFChargedHadronsBarrel prev bunch empty", 50, -M_PI, M_PI);
0854         meMETPhiChargedHadronsEndcapPlus_BXm1Empty =
0855             ibooker.book1D("METPhiChargedHadronsEndcapPlus_BXm1Empty",
0856                            "METPhi_PFChargedHadronsEndcapPlus prev bunch empty",
0857                            50,
0858                            -M_PI,
0859                            M_PI);
0860         meMETPhiChargedHadronsEndcapMinus_BXm1Empty =
0861             ibooker.book1D("METPhiChargedHadronsEndcapMinus_BXm1Empty",
0862                            "METPhi_PFChargedHadronsEndcapMinus prev bunch empty",
0863                            50,
0864                            -M_PI,
0865                            M_PI);
0866         meMETPhiNeutralHadronsBarrel_BXm1Empty = ibooker.book1D(
0867             "METPhiNeutralHadronsBarrel_BXm1Empty", "METPhi_PFNeutralHadronsBarrel prev bunch empty", 50, -M_PI, M_PI);
0868         meMETPhiNeutralHadronsEndcapPlus_BXm1Empty =
0869             ibooker.book1D("METPhiNeutralHadronsEndcapPlus_BXm1Empty",
0870                            "METPhi_PFNeutralHadronsEndcapPlus prev bunch empty",
0871                            50,
0872                            -M_PI,
0873                            M_PI);
0874         meMETPhiNeutralHadronsEndcapMinus_BXm1Empty =
0875             ibooker.book1D("METPhiNeutralHadronsEndcapMinus_BXm1Empty",
0876                            "METPhi_PFNeutralHadronsEndcapMinus prev bunch empty",
0877                            50,
0878                            -M_PI,
0879                            M_PI);
0880         meMETPhiPhotonsBarrel_BXm1Empty =
0881             ibooker.book1D("METPhiPhotonsBarrel_BXm1Empty", "METPhi_PFPhotonsBarrel prev bunch empty", 50, -M_PI, M_PI);
0882         meMETPhiPhotonsEndcapPlus_BXm1Empty = ibooker.book1D(
0883             "METPhiPhotonsEndcapPlus_BXm1Empty", "METPhi_PFPhotonsEndcapPlus prev bunch empty", 50, -M_PI, M_PI);
0884         meMETPhiPhotonsEndcapMinus_BXm1Empty = ibooker.book1D(
0885             "METPhiPhotonsEndcapMinus_BXm1Empty", "METPhi_PFPhotonsEndcapMinus prev bunch empty", 50, -M_PI, M_PI);
0886         meMETPhiHFHadronsPlus_BXm1Empty =
0887             ibooker.book1D("METPhiHFHadronsPlus_BXm1Empty", "METPhi_PFHFHadronsPlus prev bunch empty", 50, -M_PI, M_PI);
0888         meMETPhiHFHadronsMinus_BXm1Empty = ibooker.book1D(
0889             "METPhiHFHadronsMinus_BXm1Empty", "METPhi_PFHFHadronsMinus prev bunch empty", 50, -M_PI, M_PI);
0890         meMETPhiHFEGammasPlus_BXm1Empty =
0891             ibooker.book1D("METPhiHFEGammasPlus_BXm1Empty", "METPhi_PFHFEGammasPlus prev bunch empty", 50, -M_PI, M_PI);
0892         meMETPhiHFEGammasMinus_BXm1Empty = ibooker.book1D(
0893             "METPhiHFEGammasMinus_BXm1Empty", "METPhi_PFHFEGammasMinus prev bunch empty", 50, -M_PI, M_PI);
0894 
0895         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0896             DirName + "/" + "METPhiChargedHadronsBarrel_BXm1Empty", meMETPhiChargedHadronsBarrel_BXm1Empty));
0897         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0898             DirName + "/" + "METPhiChargedHadronsEndcapPlus_BXm1Empty", meMETPhiChargedHadronsEndcapPlus_BXm1Empty));
0899         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0900             DirName + "/" + "METPhiChargedHadronsEndcapMinus_BXm1Empty", meMETPhiChargedHadronsEndcapMinus_BXm1Empty));
0901         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0902             DirName + "/" + "METPhiNeutralHadronsBarrel_BXm1Empty", meMETPhiNeutralHadronsBarrel_BXm1Empty));
0903         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0904             DirName + "/" + "METPhiNeutralHadronsEndcapPlus_BXm1Empty", meMETPhiNeutralHadronsEndcapPlus_BXm1Empty));
0905         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
0906             DirName + "/" + "METPhiNeutralHadronsEndcapMinus_BXm1Empty", meMETPhiNeutralHadronsEndcapMinus_BXm1Empty));
0907         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsBarrel_BXm1Empty",
0908                                                                   meMETPhiPhotonsBarrel_BXm1Empty));
0909         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapPlus_BXm1Empty",
0910                                                                   meMETPhiPhotonsEndcapPlus_BXm1Empty));
0911         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapMinus_BXm1Empty",
0912                                                                   meMETPhiPhotonsEndcapMinus_BXm1Empty));
0913         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsPlus_BXm1Empty",
0914                                                                   meMETPhiHFHadronsPlus_BXm1Empty));
0915         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsMinus_BXm1Empty",
0916                                                                   meMETPhiHFHadronsMinus_BXm1Empty));
0917         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasPlus_BXm1Empty",
0918                                                                   meMETPhiHFEGammasPlus_BXm1Empty));
0919         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasMinus_BXm1Empty",
0920                                                                   meMETPhiHFEGammasMinus_BXm1Empty));
0921 
0922         meMETPhiChargedHadronsBarrel =
0923             ibooker.book1D("METPhiChargedHadronsBarrel", "METPhi_PFChargedHadronsBarrel", 50, -M_PI, M_PI);
0924         meMETPhiChargedHadronsEndcapPlus =
0925             ibooker.book1D("METPhiChargedHadronsEndcapPlus", "METPhi_PFChargedHadronsEndcapPlus", 50, -M_PI, M_PI);
0926         meMETPhiChargedHadronsEndcapMinus =
0927             ibooker.book1D("METPhiChargedHadronsEndcapMinus", "METPhi_PFChargedHadronsEndcapMinus", 50, -M_PI, M_PI);
0928         meMETPhiNeutralHadronsBarrel =
0929             ibooker.book1D("METPhiNeutralHadronsBarrel", "METPhi_PFNeutralHadronsBarrel", 50, -M_PI, M_PI);
0930         meMETPhiNeutralHadronsEndcapPlus =
0931             ibooker.book1D("METPhiNeutralHadronsEndcapPlus", "METPhi_PFNeutralHadronsEndcapPlus", 50, -M_PI, M_PI);
0932         meMETPhiNeutralHadronsEndcapMinus =
0933             ibooker.book1D("METPhiNeutralHadronsEndcapMinus", "METPhi_PFNeutralHadronsEndcapMinus", 50, -M_PI, M_PI);
0934         meMETPhiPhotonsBarrel = ibooker.book1D("METPhiPhotonsBarrel", "METPhi_PFPhotonsBarrel", 50, -M_PI, M_PI);
0935         meMETPhiPhotonsEndcapPlus =
0936             ibooker.book1D("METPhiPhotonsEndcapPlus", "METPhi_PFPhotonsEndcapPlus", 50, -M_PI, M_PI);
0937         meMETPhiPhotonsEndcapMinus =
0938             ibooker.book1D("METPhiPhotonsEndcapMinus", "METPhi_PFPhotonsEndcapMinus", 50, -M_PI, M_PI);
0939         meMETPhiHFHadronsPlus = ibooker.book1D("METPhiHFHadronsPlus", "METPhi_PFHFHadronsPlus", 50, -M_PI, M_PI);
0940         meMETPhiHFHadronsMinus = ibooker.book1D("METPhiHFHadronsMinus", "METPhi_PFHFHadronsMinus", 50, -M_PI, M_PI);
0941         meMETPhiHFEGammasPlus = ibooker.book1D("METPhiHFEGammasPlus", "METPhi_PFHFEGammasPlus", 50, -M_PI, M_PI);
0942         meMETPhiHFEGammasMinus = ibooker.book1D("METPhiHFEGammasMinus", "METPhi_PFHFEGammasMinus", 50, -M_PI, M_PI);
0943 
0944         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiChargedHadronsBarrel",
0945                                                                   meMETPhiChargedHadronsBarrel));
0946         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiChargedHadronsEndcapPlus",
0947                                                                   meMETPhiChargedHadronsEndcapPlus));
0948         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiChargedHadronsEndcapMinus",
0949                                                                   meMETPhiChargedHadronsEndcapMinus));
0950         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiNeutralHadronsBarrel",
0951                                                                   meMETPhiNeutralHadronsBarrel));
0952         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiNeutralHadronsEndcapPlus",
0953                                                                   meMETPhiNeutralHadronsEndcapPlus));
0954         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiNeutralHadronsEndcapMinus",
0955                                                                   meMETPhiNeutralHadronsEndcapMinus));
0956         map_of_MEs.insert(
0957             std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsBarrel", meMETPhiPhotonsBarrel));
0958         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapPlus",
0959                                                                   meMETPhiPhotonsEndcapPlus));
0960         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiPhotonsEndcapMinus",
0961                                                                   meMETPhiPhotonsEndcapMinus));
0962         map_of_MEs.insert(
0963             std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsPlus", meMETPhiHFHadronsPlus));
0964         map_of_MEs.insert(
0965             std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFHadronsMinus", meMETPhiHFHadronsMinus));
0966         map_of_MEs.insert(
0967             std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasPlus", meMETPhiHFEGammasPlus));
0968         map_of_MEs.insert(
0969             std::pair<std::string, MonitorElement*>(DirName + "/" + "METPhiHFEGammasMinus", meMETPhiHFEGammasMinus));
0970       }
0971 
0972       if (fillPFCandPlots && fillCandidateMap_histos) {
0973         if (!profilePFCand_x_.empty()) {
0974           etaMinPFCand_.clear();
0975           etaMaxPFCand_.clear();
0976           typePFCand_.clear();
0977           countsPFCand_.clear();
0978           MExPFCand_.clear();
0979           MEyPFCand_.clear();
0980           profilePFCand_x_.clear();
0981           profilePFCand_y_.clear();
0982           profilePFCand_x_name_.clear();
0983           profilePFCand_y_name_.clear();
0984         }
0985         for (std::vector<edm::ParameterSet>::const_iterator v = diagnosticsParameters_.begin();
0986              v != diagnosticsParameters_.end();
0987              v++) {
0988           double etaMinPFCand = v->getParameter<double>("etaMin");
0989           double etaMaxPFCand = v->getParameter<double>("etaMax");
0990           int nMinPFCand = v->getParameter<int>("nMin");
0991           int nMaxPFCand = v->getParameter<int>("nMax");
0992           int nbinsPFCand = v->getParameter<double>("nbins");
0993 
0994           // etaNBins_.push_back(etaNBins);
0995           etaMinPFCand_.push_back(etaMinPFCand);
0996           etaMaxPFCand_.push_back(etaMaxPFCand);
0997           typePFCand_.push_back(v->getParameter<int>("type"));
0998           countsPFCand_.push_back(0);
0999           MExPFCand_.push_back(0.);
1000           MEyPFCand_.push_back(0.);
1001 
1002           profilePFCand_x_.push_back(
1003               ibooker.bookProfile(std::string(v->getParameter<std::string>("name")).append("_Px_").c_str(),
1004                                   std::string(v->getParameter<std::string>("name")) + "Px",
1005                                   nbinsPFCand,
1006                                   nMinPFCand,
1007                                   nMaxPFCand,
1008                                   -300,
1009                                   300));
1010           profilePFCand_x_name_.push_back(std::string(v->getParameter<std::string>("name")).append("_Px_"));
1011           map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
1012               DirName + "/" + profilePFCand_x_name_[profilePFCand_x_name_.size() - 1],
1013               profilePFCand_x_[profilePFCand_x_.size() - 1]));
1014           profilePFCand_y_.push_back(
1015               ibooker.bookProfile(std::string(v->getParameter<std::string>("name")).append("_Py_").c_str(),
1016                                   std::string(v->getParameter<std::string>("name")) + "Py",
1017                                   nbinsPFCand,
1018                                   nMinPFCand,
1019                                   nMaxPFCand,
1020                                   -300,
1021                                   300));
1022           profilePFCand_y_name_.push_back(std::string(v->getParameter<std::string>("name")).append("_Py_"));
1023           map_of_MEs.insert(std::pair<std::string, MonitorElement*>(
1024               DirName + "/" + profilePFCand_y_name_[profilePFCand_y_name_.size() - 1],
1025               profilePFCand_y_[profilePFCand_y_.size() - 1]));
1026         }
1027       }
1028     }
1029     if (isMiniAODMet_) {
1030       if (fillPFCandPlots &&
1031           fillCandidateMap_histos) {  //first bool internal checks for subdirectory filling, second bool given in cfg file, checks that we fill maps only in one module in total
1032         if (!profilePFCand_x_.empty()) {
1033           etaMinPFCand_.clear();
1034           etaMaxPFCand_.clear();
1035           typePFCand_.clear();
1036           countsPFCand_.clear();
1037           profilePFCand_x_.clear();
1038           profilePFCand_y_.clear();
1039         }
1040         for (std::vector<edm::ParameterSet>::const_iterator v = diagnosticsParameters_.begin();
1041              v != diagnosticsParameters_.end();
1042              v++) {
1043           double etaMinPFCand = v->getParameter<double>("etaMin");
1044           double etaMaxPFCand = v->getParameter<double>("etaMax");
1045 
1046           etaMinPFCand_.push_back(etaMinPFCand);
1047           etaMaxPFCand_.push_back(etaMaxPFCand);
1048           typePFCand_.push_back(v->getParameter<int>("type"));
1049           countsPFCand_.push_back(0);
1050           MExPFCand_.push_back(0.);
1051           MEyPFCand_.push_back(0.);
1052         }
1053       }
1054     }
1055 
1056     if (isPFMet_ || isMiniAODMet_) {
1057       mePhotonEtFraction = ibooker.book1D("PfPhotonEtFraction", "photonEtFraction()", 50, 0, 1);
1058       meNeutralHadronEtFraction = ibooker.book1D("PfNeutralHadronEtFraction", "neutralHadronEtFraction()", 50, 0, 1);
1059       meChargedHadronEtFraction = ibooker.book1D("PfChargedHadronEtFraction", "chargedHadronEtFraction()", 50, 0, 1);
1060       meHFHadronEtFraction = ibooker.book1D("PfHFHadronEtFraction", "HFHadronEtFraction()", 50, 0, 1);
1061       meHFEMEtFraction = ibooker.book1D("PfHFEMEtFraction", "HFEMEtFraction()", 50, 0, 1);
1062 
1063       map_of_MEs.insert(
1064           std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFraction", mePhotonEtFraction));
1065       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEtFraction",
1066                                                                 meNeutralHadronEtFraction));
1067       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEtFraction",
1068                                                                 meChargedHadronEtFraction));
1069       map_of_MEs.insert(
1070           std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFraction", meHFHadronEtFraction));
1071       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFraction", meHFEMEtFraction));
1072 
1073       mePhotonEtFraction_profile =
1074           ibooker.bookProfile("PfPhotonEtFraction_profile", "photonEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
1075       meNeutralHadronEtFraction_profile = ibooker.bookProfile(
1076           "PfNeutralHadronEtFraction_profile", "neutralHadronEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
1077       meChargedHadronEtFraction_profile = ibooker.bookProfile(
1078           "PfChargedHadronEtFraction_profile", "chargedHadronEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
1079       meHFHadronEtFraction_profile = ibooker.bookProfile(
1080           "PfHFHadronEtFraction_profile", "HFHadronEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
1081       meHFEMEtFraction_profile =
1082           ibooker.bookProfile("PfHFEMEtFraction_profile", "HFEMEtFraction()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1);
1083       mePhotonEtFraction_profile->setAxisTitle("nvtx", 1);
1084       meNeutralHadronEtFraction_profile->setAxisTitle("nvtx", 1);
1085       meChargedHadronEtFraction_profile->setAxisTitle("nvtx", 1);
1086       meHFHadronEtFraction_profile->setAxisTitle("nvtx", 1);
1087       meHFEMEtFraction_profile->setAxisTitle("nvtx", 1);
1088 
1089       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEtFraction_profile",
1090                                                                 mePhotonEtFraction_profile));
1091       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEtFraction_profile",
1092                                                                 meNeutralHadronEtFraction_profile));
1093       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEtFraction_profile",
1094                                                                 meChargedHadronEtFraction_profile));
1095       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEtFraction_profile",
1096                                                                 meHFHadronEtFraction_profile));
1097       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEtFraction_profile",
1098                                                                 meHFEMEtFraction_profile));
1099 
1100       mePhotonEt = ibooker.book1D("PfPhotonEt", "photonEt()", 50, 0, 1000);
1101       meNeutralHadronEt = ibooker.book1D("PfNeutralHadronEt", "neutralHadronEt()", 50, 0, 1000);
1102       meElectronEt = ibooker.book1D("PfElectronEt", "electronEt()", 50, 0, 100);
1103       meChargedHadronEt = ibooker.book1D("PfChargedHadronEt", "chargedHadronEt()", 50, 0, 2000);
1104       meMuonEt = ibooker.book1D("PfMuonEt", "muonEt()", 50, 0, 100);
1105       meHFHadronEt = ibooker.book1D("PfHFHadronEt", "HFHadronEt()", 50, 0, 2000);
1106       meHFEMEt = ibooker.book1D("PfHFEMEt", "HFEMEt()", 50, 0, 1000);
1107 
1108       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEt", mePhotonEt));
1109       map_of_MEs.insert(
1110           std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEt", meNeutralHadronEt));
1111       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfElectronEt", meElectronEt));
1112       map_of_MEs.insert(
1113           std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEt", meChargedHadronEt));
1114       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfMuonEt", meMuonEt));
1115       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEt", meHFHadronEt));
1116       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEt", meHFEMEt));
1117 
1118       mePhotonEt_profile =
1119           ibooker.bookProfile("PfPhotonEt_profile", "photonEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
1120       meNeutralHadronEt_profile = ibooker.bookProfile(
1121           "PfNeutralHadronEt_profile", "neutralHadronEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
1122       meChargedHadronEt_profile = ibooker.bookProfile(
1123           "PfChargedHadronEt_profile", "chargedHadronEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
1124       meHFHadronEt_profile =
1125           ibooker.bookProfile("PfHFHadronEt_profile", "HFHadronEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
1126       meHFEMEt_profile = ibooker.bookProfile("PfHFEMEt_profile", "HFEMEt()", nbinsPV_, nPVMin_, nPVMax_, 50, 0, 1000);
1127 
1128       mePhotonEt_profile->setAxisTitle("nvtx", 1);
1129       meNeutralHadronEt_profile->setAxisTitle("nvtx", 1);
1130       meChargedHadronEt_profile->setAxisTitle("nvtx", 1);
1131       meHFHadronEt_profile->setAxisTitle("nvtx", 1);
1132       meHFEMEt_profile->setAxisTitle("nvtx", 1);
1133 
1134       map_of_MEs.insert(
1135           std::pair<std::string, MonitorElement*>(DirName + "/" + "PfPhotonEt_profile", mePhotonEt_profile));
1136       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfNeutralHadronEt_profile",
1137                                                                 meNeutralHadronEt_profile));
1138       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfChargedHadronEt_profile",
1139                                                                 meChargedHadronEt_profile));
1140       map_of_MEs.insert(
1141           std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFHadronEt_profile", meHFHadronEt_profile));
1142       map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "PfHFEMEt_profile", meHFEMEt_profile));
1143     }
1144 
1145     if (isCaloMet_) {
1146       if (fill_met_high_level_histo) {  //now configurable in python file
1147         hMExLS = ibooker.book2D("MExLS", "MEx_LS", 200, -200, 200, 250, 0., 2500.);
1148         hMExLS->setAxisTitle("MEx [GeV]", 1);
1149         hMExLS->setAxisTitle("Lumi Section", 2);
1150         hMExLS->setOption("colz");
1151         hMEyLS = ibooker.book2D("MEyLS", "MEy_LS", 200, -200, 200, 250, 0., 2500.);
1152         hMEyLS->setAxisTitle("MEy [GeV]", 1);
1153         hMEyLS->setAxisTitle("Lumi Section", 2);
1154         hMEyLS->setOption("colz");
1155         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MExLS", hMExLS));
1156         map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "MEyLS", hMEyLS));
1157       }
1158     }
1159 
1160     hMETRate = ibooker.book1D("METRate", "METRate", 200, 0, 1000);
1161     map_of_MEs.insert(std::pair<std::string, MonitorElement*>(DirName + "/" + "METRate", hMETRate));
1162 
1163     ibooker.setCurrentFolder("JetMET");
1164     lumisecME = ibooker.book1D("lumisec", "lumisec", 2501, -1., 2500.);
1165     map_of_MEs.insert(std::pair<std::string, MonitorElement*>("JetMET/lumisec", lumisecME));
1166   }  //all non Z plots (restrict Z Plots only for resolution study)
1167 }
1168 
1169 // ***********************************************************
1170 void METAnalyzer::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
1171   const L1GtTriggerMenu* menu = &iSetup.getData(l1gtTrigMenuToken_);
1172   for (CItAlgo techTrig = menu->gtTechnicalTriggerMap().begin(); techTrig != menu->gtTechnicalTriggerMap().end();
1173        ++techTrig) {
1174     if ((techTrig->second).algoName() == m_l1algoname_) {
1175       m_bitAlgTechTrig_ = (techTrig->second).algoBitNumber();
1176       break;
1177     }
1178   }
1179 
1180   //  std::cout  << "Run " << iRun.run() << " hltconfig.init "
1181   //             << hltConfig_.init(iRun,iSetup,triggerResultsLabel_.process(),changed_) << " length: "<<hltConfig_.triggerNames().size()<<" changed "<<changed_<<std::endl;
1182   bool changed(true);
1183   if (hltConfig_.init(iRun, iSetup, triggerResultsLabel_.process(), changed)) {
1184     if (changed) {
1185       //hltConfig_.dump("ProcessName");
1186       //hltConfig_.dump("GlobalTag");
1187       //hltConfig_.dump("TableName");
1188       //      hltConfig_.dump("Streams");
1189       //      hltConfig_.dump("Datasets");
1190       //      hltConfig_.dump("PrescaleTable");
1191       //      hltConfig_.dump("ProcessPSet");
1192     }
1193   } else {
1194     if (verbose_)
1195       std::cout << "HLTEventAnalyzerAOD::analyze:"
1196                 << " config extraction failure with process name " << triggerResultsLabel_.process() << std::endl;
1197   }
1198 
1199   triggerSelectedSubFolders_ = parameters.getParameter<edm::VParameterSet>("triggerSelectedSubFolders");
1200   for (std::vector<GenericTriggerEventFlag*>::const_iterator it = triggerFolderEventFlag_.begin();
1201        it != triggerFolderEventFlag_.end();
1202        it++) {
1203     int pos = it - triggerFolderEventFlag_.begin();
1204     if ((*it)->on()) {
1205       (*it)->initRun(iRun, iSetup);
1206       if (triggerSelectedSubFolders_[pos].exists(std::string("hltDBKey"))) {
1207         if ((*it)->expressionsFromDB((*it)->hltDBKey(), iSetup)[0] != "CONFIG_ERROR")
1208           triggerFolderExpr_[pos] = (*it)->expressionsFromDB((*it)->hltDBKey(), iSetup);
1209       }
1210     }
1211   }
1212   if (isMiniAODMet_) {
1213     bool changed_filter = true;
1214     std::vector<int> initializeFilter(8, -1);  //we have 8 filters at the moment
1215     miniaodFilterIndex_ = initializeFilter;
1216     if (FilterhltConfig_.init(iRun, iSetup, METFilterMiniAODLabel_.process(), changed_filter)) {
1217       miniaodfilterdec = 0;
1218       for (unsigned int i = 0; i < FilterhltConfig_.size(); i++) {
1219         std::string search = FilterhltConfig_.triggerName(i).substr(
1220             5);  //actual label of filter, the first 5 items are Flag_, so stripped off
1221         std::string search2 =
1222             HBHENoiseStringMiniAOD;  //all filters end with DQM, which is not in the flag --> ONLY not for HBHEFilters
1223         std::size_t found = search2.find(search);
1224         if (found != std::string::npos) {
1225           miniaodFilterIndex_[0] = i;
1226         }
1227         search2 = CSCHaloResultTag_.label().substr(0, CSCHaloResultTag_.label().size() - 3);
1228         found = search2.find(search);
1229         if (found != std::string::npos) {
1230           miniaodFilterIndex_[1] = i;
1231         }
1232         search2 = eeBadScFilterTag_.label().substr(0, eeBadScFilterTag_.label().size() - 3);
1233         found = search2.find(search);
1234         if (found != std::string::npos) {
1235           miniaodFilterIndex_[2] = i;
1236         }
1237         search2 = HBHEIsoNoiseStringMiniAOD;
1238         found = search2.find(search);
1239         if (found != std::string::npos) {
1240           miniaodFilterIndex_[3] = i;
1241         }
1242         search2 = CSCHalo2015ResultTag_.label().substr(0, CSCHalo2015ResultTag_.label().size() - 3);
1243         found = search2.find(search);
1244         if (found != std::string::npos) {
1245           miniaodFilterIndex_[4] = i;
1246         }
1247         search2 = EcalDeadCellTriggerTag_.label().substr(0, EcalDeadCellTriggerTag_.label().size() - 3);
1248         found = search2.find(search);
1249         if (found != std::string::npos) {
1250           miniaodFilterIndex_[5] = i;
1251         }
1252         search2 = EcalDeadCellBoundaryTag_.label().substr(0, EcalDeadCellBoundaryTag_.label().size() - 3);
1253         found = search2.find(search);
1254         if (found != std::string::npos) {
1255           miniaodFilterIndex_[6] = i;
1256         }
1257         search2 = HcalStripHaloTag_.label().substr(0, HcalStripHaloTag_.label().size() - 3);
1258         found = search2.find(search);
1259         if (found != std::string::npos) {
1260           miniaodFilterIndex_[7] = i;
1261         }
1262       }
1263     } else if (FilterhltConfig_.init(iRun, iSetup, METFilterMiniAODLabel2_.process(), changed_filter)) {
1264       miniaodfilterdec = 1;
1265       for (unsigned int i = 0; i < FilterhltConfig_.size(); i++) {
1266         std::string search = FilterhltConfig_.triggerName(i).substr(
1267             5);  //actual label of filter, the first 5 items are Flag_, so stripped off
1268         std::string search2 =
1269             HBHENoiseStringMiniAOD;  //all filters end with DQM, which is not in the flag --> ONLY not for HBHEFilters
1270         std::size_t found = search2.find(search);
1271         if (found != std::string::npos) {
1272           miniaodFilterIndex_[0] = i;
1273         }
1274         search2 = CSCHaloResultTag_.label().substr(0, CSCHaloResultTag_.label().size() - 3);
1275         found = search2.find(search);
1276         if (found != std::string::npos) {
1277           miniaodFilterIndex_[1] = i;
1278         }
1279         search2 = eeBadScFilterTag_.label().substr(0, eeBadScFilterTag_.label().size() - 3);
1280         found = search2.find(search);
1281         if (found != std::string::npos) {
1282           miniaodFilterIndex_[2] = i;
1283         }
1284         search2 = HBHEIsoNoiseStringMiniAOD;
1285         found = search2.find(search);
1286         if (found != std::string::npos) {
1287           miniaodFilterIndex_[3] = i;
1288         }
1289         search2 = CSCHalo2015ResultTag_.label().substr(0, CSCHalo2015ResultTag_.label().size() - 3);
1290         found = search2.find(search);
1291         if (found != std::string::npos) {
1292           miniaodFilterIndex_[4] = i;
1293         }
1294         search2 = EcalDeadCellTriggerTag_.label().substr(0, EcalDeadCellTriggerTag_.label().size() - 3);
1295         found = search2.find(search);
1296         if (found != std::string::npos) {
1297           miniaodFilterIndex_[5] = i;
1298         }
1299         search2 = EcalDeadCellBoundaryTag_.label().substr(0, EcalDeadCellBoundaryTag_.label().size() - 3);
1300         found = search2.find(search);
1301         if (found != std::string::npos) {
1302           miniaodFilterIndex_[6] = i;
1303         }
1304         search2 = HcalStripHaloTag_.label().substr(0, HcalStripHaloTag_.label().size() - 3);
1305         found = search2.find(search);
1306         if (found != std::string::npos) {
1307           miniaodFilterIndex_[7] = i;
1308         }
1309       }
1310     } else {
1311       edm::LogWarning("MiniAOD METAN Filter HLT OBject version")
1312           << "nothing found with both RECO and reRECO label" << std::endl;
1313     }
1314   }
1315 }
1316 
1317 // ***********************************************************
1318 void METAnalyzer::dqmEndRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
1319   //
1320   //--- Check the time length of the Run from the lumi section plots
1321 
1322   TH1F* tlumisec;
1323 
1324   MonitorElement* meLumiSec = map_dijet_MEs["aaa"];
1325   meLumiSec = map_dijet_MEs["JetMET/lumisec"];
1326 
1327   int totlsec = 0;
1328   int totlssecsum = 0;
1329   double totltime = 0.;
1330   if (meLumiSec && meLumiSec->getRootObject()) {
1331     tlumisec = meLumiSec->getTH1F();
1332     //check overflow bin (if we have more than 2500 LS in a run)
1333     //lumisec is filled every time the analyze section is processed
1334     //we know an LS is present only once in a run: normalize how many events we had on average
1335     //if lumi fluctuates strongly might be unreliable for overflow bin though
1336     for (int i = 0; i < (tlumisec->GetNbinsX()); i++) {
1337       if (tlumisec->GetBinContent(i) != 0) {
1338         totlsec += 1;
1339         totlssecsum += tlumisec->GetBinContent(i);
1340       }
1341     }
1342     int num_per_ls = (double)totlssecsum / (double)totlsec;
1343     totlsec = totlsec + tlumisec->GetBinContent(tlumisec->GetNbinsX() + 1) / (double)num_per_ls;
1344     totltime = double(totlsec * 90);  // one lumi sec ~ 90 (sec)
1345   }
1346 
1347   if (totltime == 0.)
1348     totltime = 1.;
1349 
1350   std::string dirName = FolderName_ + metCollectionLabel_.label() + "/";
1351   //dbe_->setCurrentFolder(dirName);
1352 
1353   //below is the original METAnalyzer formulation
1354 
1355   for (std::vector<std::string>::const_iterator ic = folderNames_.begin(); ic != folderNames_.end(); ic++) {
1356     std::string DirName;
1357     DirName = dirName + *ic;
1358     makeRatePlot(DirName, totltime);
1359     for (std::vector<GenericTriggerEventFlag*>::const_iterator it = triggerFolderEventFlag_.begin();
1360          it != triggerFolderEventFlag_.end();
1361          it++) {
1362       int pos = it - triggerFolderEventFlag_.begin();
1363       if ((*it)->on()) {
1364         makeRatePlot(DirName + "/" + triggerFolderLabels_[pos], totltime);
1365       }
1366     }
1367   }
1368 }
1369 
1370 // ***********************************************************
1371 void METAnalyzer::makeRatePlot(std::string DirName, double totltime) {
1372   //dbe_->setCurrentFolder(DirName);
1373   MonitorElement* meMET = map_dijet_MEs[DirName + "/" + "MET"];
1374   MonitorElement* mMETRate = map_dijet_MEs[DirName + "/" + "METRate"];
1375 
1376   TH1F* tMET;
1377   TH1F* tMETRate;
1378 
1379   if (meMET && mMETRate) {
1380     if (meMET->getRootObject() && mMETRate->getRootObject()) {
1381       tMET = meMET->getTH1F();
1382 
1383       // Integral plot & convert number of events to rate (hz)
1384       tMETRate = (TH1F*)tMET->Clone("METRateHist");
1385       for (int i = tMETRate->GetNbinsX() - 1; i >= 0; i--) {
1386         tMETRate->SetBinContent(i + 1, tMETRate->GetBinContent(i + 2) + tMET->GetBinContent(i + 1));
1387       }
1388       for (int i = 0; i < tMETRate->GetNbinsX(); i++) {
1389         tMETRate->SetBinContent(i + 1, tMETRate->GetBinContent(i + 1) / double(totltime));
1390         mMETRate->setBinContent(i + 1, tMETRate->GetBinContent(i + 1));
1391       }
1392     }
1393   }
1394 }
1395 
1396 // ***********************************************************
1397 void METAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
1398   // *** Fill lumisection ME
1399   int myLuminosityBlock;
1400   myLuminosityBlock = iEvent.luminosityBlock();
1401   if (fill_met_high_level_histo) {
1402     lumisecME = map_dijet_MEs["JetMET/lumisec"];
1403     if (lumisecME && lumisecME->getRootObject())
1404       lumisecME->Fill(myLuminosityBlock);
1405   }
1406 
1407   if (myLuminosityBlock < LSBegin_)
1408     return;
1409   if (myLuminosityBlock > LSEnd_ && LSEnd_ > 0)
1410     return;
1411 
1412   if (verbose_)
1413     std::cout << "METAnalyzer analyze" << std::endl;
1414 
1415   std::string DirName = FolderName_ + metCollectionLabel_.label();
1416 
1417   // ==========================================================
1418   // Trigger information
1419   //
1420   //  trigJetMB_=0;
1421   //  trigHighPtJet_=0;
1422   //  trigLowPtJet_=0;
1423   //  trigMinBias_=0;
1424   //  trigHighMET_=0;
1425   //  //  _trig_LowMET=0;
1426   //  trigEle_=0;
1427   //  trigMuon_=0;
1428   //  trigPhysDec_=0;
1429   std::vector<int> triggerFolderDecisions;
1430   triggerFolderDecisions_ = std::vector<int>(triggerFolderEventFlag_.size(), 0);
1431   // **** Get the TriggerResults container
1432   edm::Handle<edm::TriggerResults> triggerResults;
1433   iEvent.getByToken(triggerResultsToken_, triggerResults);
1434 
1435   if (triggerResults.isValid()) {
1436     /////////// Analyzing HLT Trigger Results (TriggerResults) //////////
1437     // Check how many HLT triggers are in triggerResults
1438     int ntrigs = (*triggerResults).size();
1439     if (verbose_)
1440       std::cout << "ntrigs=" << ntrigs << std::endl;
1441     // If index=ntrigs, this HLT trigger doesn't exist in the HLT table for this data.
1442     for (std::vector<GenericTriggerEventFlag*>::const_iterator it = triggerFolderEventFlag_.begin();
1443          it != triggerFolderEventFlag_.end();
1444          it++) {
1445       unsigned int pos = it - triggerFolderEventFlag_.begin();
1446       bool fd = (*it)->accept(iEvent, iSetup);
1447       triggerFolderDecisions_[pos] = fd;
1448     }
1449   }
1450 
1451   // ==========================================================
1452   // MET information
1453 
1454   // **** Get the MET container
1455   edm::Handle<reco::METCollection> tcmetcoll;
1456   edm::Handle<reco::CaloMETCollection> calometcoll;
1457   edm::Handle<reco::PFMETCollection> pfmetcoll;
1458   edm::Handle<pat::METCollection> patmetcoll;
1459 
1460   //if(isTCMet_){
1461   //iEvent.getByToken(tcMetToken_, tcmetcoll);
1462   //if(!tcmetcoll.isValid()) return;
1463   //}
1464   if (isCaloMet_) {
1465     iEvent.getByToken(caloMetToken_, calometcoll);
1466     if (!calometcoll.isValid())
1467       return;
1468   }
1469   if (isPFMet_) {
1470     iEvent.getByToken(pfMetToken_, pfmetcoll);
1471     if (!pfmetcoll.isValid())
1472       return;
1473   }
1474   if (isMiniAODMet_) {
1475     iEvent.getByToken(patMetToken_, patmetcoll);
1476     if (!patmetcoll.isValid())
1477       return;
1478   }
1479 
1480   const MET* met = nullptr;
1481   const pat::MET* patmet = nullptr;
1482   const PFMET* pfmet = nullptr;
1483   const CaloMET* calomet = nullptr;
1484   //if(isTCMet_){
1485   //met=&(tcmetcoll->front());
1486   //}
1487   if (isPFMet_) {
1488     assert(!pfmetcoll->empty());
1489     met = &(pfmetcoll->front());
1490     pfmet = &(pfmetcoll->front());
1491   }
1492   if (isCaloMet_) {
1493     assert(!calometcoll->empty());
1494     met = &(calometcoll->front());
1495     calomet = &(calometcoll->front());
1496   }
1497   if (isMiniAODMet_) {
1498     assert(!patmetcoll->empty());
1499     met = &(patmetcoll->front());
1500     patmet = &(patmetcoll->front());
1501   }
1502 
1503   LogTrace("METAnalyzer") << "[METAnalyzer] Call to the MET analyzer";
1504 
1505   // ==========================================================
1506   // TCMET
1507 
1508   //if (/*isTCMet_ || */(isCaloMet_ && metCollectionLabel_.label() == "corMetGlobalMuons")) {
1509 
1510   //iEvent.getByToken(MuonToken_, muonHandle_);
1511   //iEvent.getByToken(TrackToken_, trackHandle_);
1512   //iEvent.getByToken(ElectronToken_, electronHandle_);
1513   //iEvent.getByToken(BeamspotToken_, beamSpotHandle_);
1514   //iEvent.getByToken(tcMETValueMapToken_,tcMetValueMapHandle_);
1515 
1516   //if(!muonHandle_.isValid())     edm::LogInfo("OutputInfo") << "falied to retrieve muon data require by MET Task";
1517   //if(!trackHandle_.isValid())    edm::LogInfo("OutputInfo") << "falied to retrieve track data require by MET Task";
1518   //if(!electronHandle_.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve electron data require by MET Task";
1519   //if(!beamSpotHandle_.isValid()) edm::LogInfo("OutputInfo") << "falied to retrieve beam spot data require by MET Task";
1520 
1521   //beamSpot_ = ( beamSpotHandle_.isValid() ) ? beamSpotHandle_->position() : math::XYZPoint(0, 0, 0);
1522   //}
1523 
1524   // ==========================================================
1525   bool bJetID = false;
1526   bool bDiJetID = false;
1527   // Jet ID -------------------------------------------------------
1528   //
1529 
1530   edm::Handle<CaloJetCollection> caloJets;
1531   edm::Handle<JPTJetCollection> jptJets;
1532   edm::Handle<PFJetCollection> pfJets;
1533   edm::Handle<pat::JetCollection> patJets;
1534 
1535   int collsize = -1;
1536 
1537   if (isCaloMet_) {
1538     iEvent.getByToken(caloJetsToken_, caloJets);
1539     if (!caloJets.isValid()) {
1540       LogDebug("") << "METAnalyzer: Could not find calojet product" << std::endl;
1541       if (verbose_)
1542         std::cout << "METAnalyzer: Could not find calojet product" << std::endl;
1543     }
1544     collsize = caloJets->size();
1545   }
1546   ///*
1547   //if (isTCMet_){
1548   //iEvent.getByToken(jptJetsToken_, jptJets);
1549   //if (!jptJets.isValid()) {
1550   //  LogDebug("") << "METAnalyzer: Could not find jptjet product" << std::endl;
1551   //  if (verbose_) std::cout << "METAnalyzer: Could not find jptjet product" << std::endl;
1552   //}
1553   //collsize=jptJets->size();
1554   //}*/
1555 
1556   edm::Handle<edm::ValueMap<reco::JetID> > jetID_ValueMap_Handle;
1557   if (/*isTCMet_ || */ isCaloMet_) {
1558     if (!runcosmics_) {
1559       iEvent.getByToken(jetID_ValueMapToken_, jetID_ValueMap_Handle);
1560     }
1561   }
1562 
1563   if (isMiniAODMet_) {
1564     iEvent.getByToken(patJetsToken_, patJets);
1565     if (!patJets.isValid()) {
1566       LogDebug("") << "METAnalyzer: Could not find patjet product" << std::endl;
1567       if (verbose_)
1568         std::cout << "METAnalyzer: Could not find patjet product" << std::endl;
1569     }
1570     collsize = patJets->size();
1571   }
1572 
1573   if (isPFMet_) {
1574     iEvent.getByToken(pfJetsToken_, pfJets);
1575     if (!pfJets.isValid()) {
1576       LogDebug("") << "METAnalyzer: Could not find pfjet product" << std::endl;
1577       if (verbose_)
1578         std::cout << "METAnalyzer: Could not find pfjet product" << std::endl;
1579     }
1580     collsize = pfJets->size();
1581   }
1582 
1583   unsigned int ind1 = -1;
1584   double pt1 = -1;
1585   bool pass_jetID1 = false;
1586   unsigned int ind2 = -1;
1587   double pt2 = -1;
1588   bool pass_jetID2 = false;
1589 
1590   edm::Handle<reco::JetCorrector> jetCorr;
1591   bool pass_correction_flag = false;
1592   if (!isMiniAODMet_) {
1593     iEvent.getByToken(jetCorrectorToken_, jetCorr);
1594     if (jetCorr.isValid()) {
1595       pass_correction_flag = true;
1596     }
1597   } else {
1598     pass_correction_flag = true;
1599   }
1600   //do loose jet ID-> check threshold on corrected jets
1601   for (int ijet = 0; ijet < collsize; ijet++) {
1602     double pt_jet = -10;
1603     double scale = 1.;
1604     bool iscleaned = false;
1605     if (pass_correction_flag) {
1606       if (isCaloMet_) {
1607         scale = jetCorr->correction((*caloJets)[ijet]);
1608       }
1609       //if(isTCMet_){
1610       //scale = jetCorr->correction((*jptJets)[ijet]);
1611       //}
1612       if (isPFMet_) {
1613         scale = jetCorr->correction((*pfJets)[ijet]);
1614       }
1615     }
1616     if (isCaloMet_) {
1617       pt_jet = scale * (*caloJets)[ijet].pt();
1618       if (pt_jet > ptThreshold_) {
1619         reco::CaloJetRef calojetref(caloJets, ijet);
1620         if (!runcosmics_) {
1621           reco::JetID jetID = (*jetID_ValueMap_Handle)[calojetref];
1622           iscleaned = jetIDFunctorLoose((*caloJets)[ijet], jetID);
1623         } else {
1624           iscleaned = true;
1625         }
1626       }
1627     }
1628     ///*
1629     //if(isTCMet_){
1630     //pt_jet=scale*(*jptJets)[ijet].pt();
1631     //if(pt_jet> ptThreshold_){
1632     //  const edm::RefToBase<reco::Jet>&  rawJet = (*jptJets)[ijet].getCaloJetRef();
1633     //  const reco::CaloJet *rawCaloJet = dynamic_cast<const reco::CaloJet*>(&*rawJet);
1634     //  reco::CaloJetRef const theCaloJetRef = (rawJet).castTo<reco::CaloJetRef>();
1635     //  if(!runcosmics_){
1636     //    reco::JetID jetID = (*jetID_ValueMap_Handle)[theCaloJetRef];
1637     //    iscleaned = jetIDFunctorLoose(*rawCaloJet, jetID);
1638     //  }else{
1639     //    iscleaned=true;
1640     //  }
1641     //}
1642     //}*/
1643     if (isPFMet_) {
1644       pt_jet = scale * (*pfJets)[ijet].pt();
1645       if (pt_jet > ptThreshold_) {
1646         iscleaned = pfjetIDFunctorLoose((*pfJets)[ijet]);
1647       }
1648     }
1649     if (isMiniAODMet_) {
1650       pt_jet = (*patJets)[ijet].pt();
1651       if (pt_jet > ptThreshold_) {
1652         pat::strbitset stringbitset = pfjetIDFunctorLoose.getBitTemplate();
1653         iscleaned = pfjetIDFunctorLoose((*patJets)[ijet], stringbitset);
1654       }
1655     }
1656     if (iscleaned) {
1657       bJetID = true;
1658     }
1659     if (pt_jet > pt1) {
1660       pt2 = pt1;
1661       ind2 = ind1;
1662       pass_jetID2 = pass_jetID1;
1663       pt1 = pt_jet;
1664       ind1 = ijet;
1665       pass_jetID1 = iscleaned;
1666     } else if (pt_jet > pt2) {
1667       pt2 = pt_jet;
1668       ind2 = ijet;
1669       pass_jetID2 = iscleaned;
1670     }
1671   }
1672   if (pass_jetID1 && pass_jetID2) {
1673     double dphi = -1.0;
1674     if (isCaloMet_) {
1675       dphi = fabs((*caloJets)[ind1].phi() - (*caloJets)[ind2].phi());
1676     }
1677     ///* if(isTCMet_){
1678     //dphi=fabs((*jptJets)[ind1].phi()-(*jptJets)[ind2].phi());
1679     //}*/
1680     if (isPFMet_) {
1681       dphi = fabs((*pfJets)[ind1].phi() - (*pfJets)[ind2].phi());
1682     }
1683     if (isMiniAODMet_) {
1684       dphi = fabs((*patJets)[0].phi() - (*patJets)[1].phi());
1685     }
1686     if (dphi > acos(-1.)) {
1687       dphi = 2 * acos(-1.) - dphi;
1688     }
1689     if (dphi > 2.7) {
1690       bDiJetID = true;
1691     }
1692   }
1693   // ==========================================================
1694   // ==========================================================
1695   //Vertex information
1696   Handle<VertexCollection> vertexHandle;
1697   iEvent.getByToken(vertexToken_, vertexHandle);
1698 
1699   if (!vertexHandle.isValid()) {
1700     LogDebug("") << "CaloMETAnalyzer: Could not find vertex collection" << std::endl;
1701     if (verbose_)
1702       std::cout << "CaloMETAnalyzer: Could not find vertex collection" << std::endl;
1703   }
1704   numPV_ = 0;
1705   if (vertexHandle.isValid()) {
1706     VertexCollection vertexCollection = *(vertexHandle.product());
1707     numPV_ = vertexCollection.size();
1708   }
1709   bool bPrimaryVertex = (bypassAllPVChecks_ || (numPV_ > 0));
1710 
1711   bool bZJets = false;
1712 
1713   edm::Handle<MuonCollection> Muons;
1714   iEvent.getByToken(MuonsToken_, Muons);
1715 
1716   reco::Candidate::PolarLorentzVector zCand;
1717 
1718   double pt_muon0 = -1;
1719   double pt_muon1 = -1;
1720   int mu_index0 = -1;
1721   int mu_index1 = -1;
1722   //fill it only for cleaned jets
1723   if (Muons.isValid() && Muons->size() > 1) {
1724     for (unsigned int i = 0; i < Muons->size(); i++) {
1725       bool pass_muon_id = false;
1726       bool pass_muon_iso = false;
1727       double dxy = fabs((*Muons)[i].muonBestTrack()->dxy());
1728       double dz = fabs((*Muons)[i].muonBestTrack()->dz());
1729       if (numPV_ > 0) {
1730         dxy = fabs((*Muons)[i].muonBestTrack()->dxy((*vertexHandle)[0].position()));
1731         dz = fabs((*Muons)[i].muonBestTrack()->dz((*vertexHandle)[0].position()));
1732       }
1733       if ((*Muons)[i].pt() > 20 && fabs((*Muons)[i].eta()) < 2.3) {
1734         if ((*Muons)[i].isGlobalMuon() && (*Muons)[i].isPFMuon() &&
1735             (*Muons)[i].globalTrack()->hitPattern().numberOfValidMuonHits() > 0 &&
1736             (*Muons)[i].numberOfMatchedStations() > 1 && dxy < 0.2 && (*Muons)[i].numberOfMatchedStations() > 1 &&
1737             dz < 0.5 && (*Muons)[i].innerTrack()->hitPattern().numberOfValidPixelHits() > 0 &&
1738             (*Muons)[i].innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5) {
1739           pass_muon_id = true;
1740         }
1741         // Muon pf isolation DB corrected
1742         float muonIsoPFdb =
1743             ((*Muons)[i].pfIsolationR04().sumChargedHadronPt +
1744              std::max(0.,
1745                       (*Muons)[i].pfIsolationR04().sumNeutralHadronEt + (*Muons)[i].pfIsolationR04().sumPhotonEt -
1746                           0.5 * (*Muons)[i].pfIsolationR04().sumPUPt)) /
1747             (*Muons)[i].pt();
1748         if (muonIsoPFdb < 0.12) {
1749           pass_muon_iso = true;
1750         }
1751 
1752         if (pass_muon_id && pass_muon_iso) {
1753           if ((*Muons)[i].pt() > pt_muon0) {
1754             mu_index1 = mu_index0;
1755             pt_muon1 = pt_muon0;
1756             mu_index0 = i;
1757             pt_muon0 = (*Muons)[i].pt();
1758           } else if ((*Muons)[i].pt() > pt_muon1) {
1759             mu_index1 = i;
1760             pt_muon1 = (*Muons)[i].pt();
1761           }
1762         }
1763       }
1764     }
1765     if (mu_index0 >= 0 && mu_index1 >= 0) {
1766       if ((*Muons)[mu_index0].charge() * (*Muons)[mu_index1].charge() < 0) {
1767         zCand = (*Muons)[mu_index0].polarP4() + (*Muons)[mu_index1].polarP4();
1768         if (fabs(zCand.M() - 91.) < 20) {
1769           bZJets = true;
1770         }
1771       }
1772     }
1773   }
1774 
1775   // ==========================================================
1776 
1777   edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecord;
1778   iEvent.getByToken(gtToken_, gtReadoutRecord);
1779 
1780   bool techTriggerResultBxM2 = false;
1781   bool techTriggerResultBxM1 = false;
1782   bool techTriggerResultBx0 = false;
1783 
1784   if (!gtReadoutRecord.isValid()) {
1785     LogDebug("") << "METAnalyzer: Could not find GT readout record" << std::endl;
1786     if (verbose_)
1787       std::cout << "METAnalyzer: Could not find GT readout record product" << std::endl;
1788   } else {
1789     // trigger results before mask for BxInEvent -2 (E), -1 (F), 0 (L1A), 1, 2
1790     const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBxM2 = gtReadoutRecord->technicalTriggerWord(-2);
1791     const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBxM1 = gtReadoutRecord->technicalTriggerWord(-1);
1792     const TechnicalTriggerWord& technicalTriggerWordBeforeMaskBx0 = gtReadoutRecord->technicalTriggerWord();
1793     //const TechnicalTriggerWord&  technicalTriggerWordBeforeMaskBxG = gtReadoutRecord->technicalTriggerWord(1);
1794     //const TechnicalTriggerWord&  technicalTriggerWordBeforeMaskBxH = gtReadoutRecord->technicalTriggerWord(2);
1795     if (m_bitAlgTechTrig_ > -1 && !technicalTriggerWordBeforeMaskBx0.empty()) {
1796       techTriggerResultBx0 = technicalTriggerWordBeforeMaskBx0.at(m_bitAlgTechTrig_);
1797       if (techTriggerResultBx0 != 0) {
1798         techTriggerResultBxM2 = technicalTriggerWordBeforeMaskBxM2.at(m_bitAlgTechTrig_);
1799         techTriggerResultBxM1 = technicalTriggerWordBeforeMaskBxM1.at(m_bitAlgTechTrig_);
1800       }
1801     }
1802   }
1803 
1804   std::vector<bool> trigger_flag(4, false);
1805   if (techTriggerResultBx0 && techTriggerResultBxM2 &&
1806       techTriggerResultBxM1) {  //current and previous two bunches filled
1807     trigger_flag[0] = true;
1808   }
1809   if (techTriggerResultBx0 && techTriggerResultBxM1) {  //current and previous bunch filled
1810     trigger_flag[1] = true;
1811   }
1812   if (techTriggerResultBx0 && !techTriggerResultBxM1) {  //current bunch filled, but  previous bunch emtpy
1813     trigger_flag[2] = true;
1814   }
1815   if (techTriggerResultBx0 && !techTriggerResultBxM2 &&
1816       !techTriggerResultBxM1) {  //current bunch filled, but previous two bunches emtpy
1817     trigger_flag[3] = true;
1818   }
1819   std::vector<bool> filter_decisions(
1820       8, false);  //include all recommended filters, old filters in MiniAOD, and 2 new filters in testing phase
1821   if (!isMiniAODMet_ &&
1822       !runcosmics_) {  //not checked for MiniAOD -> for miniaod decision filled as "triggerResults" bool
1823     edm::Handle<bool> HBHENoiseFilterResultHandle;
1824     iEvent.getByToken(hbheNoiseFilterResultToken_, HBHENoiseFilterResultHandle);
1825     if (!HBHENoiseFilterResultHandle.isValid()) {
1826       LogDebug("") << "METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
1827       if (verbose_)
1828         std::cout << "METAnalyzer: Could not find HBHENoiseFilterResult" << std::endl;
1829     }
1830     filter_decisions[0] = *HBHENoiseFilterResultHandle;
1831     edm::Handle<bool> CSCTightHaloFilterResultHandle;
1832     iEvent.getByToken(CSCHaloResultToken_, CSCTightHaloFilterResultHandle);
1833     if (!CSCTightHaloFilterResultHandle.isValid()) {
1834       LogDebug("") << "METAnalyzer: Could not find CSCTightHaloFilterResultHandle" << std::endl;
1835       if (verbose_)
1836         std::cout << "METAnalyzer: CSCTightHaloFilterResultHandle" << std::endl;
1837     }
1838     filter_decisions[1] = *CSCTightHaloFilterResultHandle;
1839     edm::Handle<bool> eeBadScFilterResultHandle;
1840     iEvent.getByToken(eeBadScFilterToken_, eeBadScFilterResultHandle);
1841     if (!eeBadScFilterResultHandle.isValid()) {
1842       LogDebug("") << "METAnalyzer: Could not find eeBadScFilterResultHandle" << std::endl;
1843       if (verbose_)
1844         std::cout << "METAnalyzer: eeBadScFilterResultHandle" << std::endl;
1845     }
1846     filter_decisions[2] = *eeBadScFilterResultHandle;
1847     edm::Handle<bool> HBHENoiseIsoFilterResultHandle;
1848     iEvent.getByToken(hbheIsoNoiseFilterResultToken_, HBHENoiseIsoFilterResultHandle);
1849     if (!HBHENoiseIsoFilterResultHandle.isValid()) {
1850       LogDebug("") << "METAnalyzer: Could not find HBHENoiseIsoFilterResult" << std::endl;
1851       if (verbose_)
1852         std::cout << "METAnalyzer: Could not find HBHENoiseIsoFilterResult" << std::endl;
1853     }
1854     filter_decisions[3] = *HBHENoiseIsoFilterResultHandle;
1855     edm::Handle<bool> CSCTightHalo2015FilterResultHandle;
1856     iEvent.getByToken(CSCHalo2015ResultToken_, CSCTightHalo2015FilterResultHandle);
1857     if (!CSCTightHalo2015FilterResultHandle.isValid()) {
1858       LogDebug("") << "METAnalyzer: Could not find CSCTightHalo2015FilterResultHandle" << std::endl;
1859       if (verbose_)
1860         std::cout << "METAnalyzer: CSCTightHalo2015FilterResultHandle" << std::endl;
1861     }
1862     filter_decisions[4] = *CSCTightHalo2015FilterResultHandle;
1863     edm::Handle<bool> EcalDeadCellTriggerFilterResultHandle;
1864     iEvent.getByToken(EcalDeadCellTriggerToken_, EcalDeadCellTriggerFilterResultHandle);
1865     if (!EcalDeadCellTriggerFilterResultHandle.isValid()) {
1866       LogDebug("") << "METAnalyzer: Could not find EcalDeadCellTriggerFilterResultHandle" << std::endl;
1867       if (verbose_)
1868         std::cout << "METAnalyzer: EcalDeadCellTriggerFilterResultHandle" << std::endl;
1869     }
1870     filter_decisions[5] = *EcalDeadCellTriggerFilterResultHandle;
1871     edm::Handle<bool> EcalDeadCellBoundaryHandle;
1872     iEvent.getByToken(EcalDeadCellBoundaryToken_, EcalDeadCellBoundaryHandle);
1873     if (!EcalDeadCellBoundaryHandle.isValid()) {
1874       LogDebug("") << "METAnalyzer: Could not find EcalDeadCellBoundaryHandle" << std::endl;
1875       if (verbose_)
1876         std::cout << "METAnalyzer: EcalDeadCellBoundaryHandle" << std::endl;
1877     }
1878     filter_decisions[6] = *EcalDeadCellBoundaryHandle;
1879     edm::Handle<bool> HcalStripHaloFilterHandle;
1880     iEvent.getByToken(HcalStripHaloToken_, HcalStripHaloFilterHandle);
1881     if (!HcalStripHaloFilterHandle.isValid()) {
1882       LogDebug("") << "METAnalyzer: Could not find CSCTightHalo2015FilterResultHandle" << std::endl;
1883       if (verbose_)
1884         std::cout << "METAnalyzer: CSCTightHalo2015FilterResultHandle" << std::endl;
1885     }
1886     filter_decisions[7] = *HcalStripHaloFilterHandle;
1887   } else if (isMiniAODMet_) {
1888     //miniaodFilterIndex_ is only filled in dqmBeginRun if isMiniAODMet_ true
1889     edm::Handle<edm::TriggerResults> metFilterResults;
1890     iEvent.getByToken(METFilterMiniAODToken_, metFilterResults);
1891     if (metFilterResults.isValid()) {
1892       if (miniaodFilterIndex_[0] != -1) {
1893         filter_decisions[0] = metFilterResults->accept(miniaodFilterIndex_[0]);
1894       }
1895       if (miniaodFilterIndex_[1] != -1) {
1896         filter_decisions[1] = metFilterResults->accept(miniaodFilterIndex_[1]);
1897       }
1898       if (miniaodFilterIndex_[2] != -1) {
1899         filter_decisions[2] = metFilterResults->accept(miniaodFilterIndex_[2]);
1900       }
1901       if (miniaodFilterIndex_[3] != -1) {
1902         filter_decisions[3] = metFilterResults->accept(miniaodFilterIndex_[3]);
1903       }
1904       if (miniaodFilterIndex_[4] != -1) {
1905         filter_decisions[4] = metFilterResults->accept(miniaodFilterIndex_[4]);
1906       }
1907       if (miniaodFilterIndex_[5] != -1) {
1908         filter_decisions[5] = metFilterResults->accept(miniaodFilterIndex_[5]);
1909       }
1910       if (miniaodFilterIndex_[6] != -1) {
1911         filter_decisions[6] = metFilterResults->accept(miniaodFilterIndex_[6]);
1912       }
1913       if (miniaodFilterIndex_[7] != -1) {
1914         filter_decisions[7] = metFilterResults->accept(miniaodFilterIndex_[7]);
1915       }
1916     } else {
1917       iEvent.getByToken(METFilterMiniAODToken2_, metFilterResults);
1918       if (metFilterResults.isValid()) {
1919         if (miniaodFilterIndex_[0] != -1) {
1920           filter_decisions[0] = metFilterResults->accept(miniaodFilterIndex_[0]);
1921         }
1922         if (miniaodFilterIndex_[1] != -1) {
1923           filter_decisions[1] = metFilterResults->accept(miniaodFilterIndex_[1]);
1924         }
1925         if (miniaodFilterIndex_[2] != -1) {
1926           filter_decisions[2] = metFilterResults->accept(miniaodFilterIndex_[2]);
1927         }
1928         if (miniaodFilterIndex_[3] != -1) {
1929           filter_decisions[3] = metFilterResults->accept(miniaodFilterIndex_[3]);
1930         }
1931         if (miniaodFilterIndex_[4] != -1) {
1932           filter_decisions[4] = metFilterResults->accept(miniaodFilterIndex_[4]);
1933         }
1934         if (miniaodFilterIndex_[5] != -1) {
1935           filter_decisions[5] = metFilterResults->accept(miniaodFilterIndex_[5]);
1936         }
1937         if (miniaodFilterIndex_[6] != -1) {
1938           filter_decisions[6] = metFilterResults->accept(miniaodFilterIndex_[6]);
1939         }
1940         if (miniaodFilterIndex_[7] != -1) {
1941           filter_decisions[7] = metFilterResults->accept(miniaodFilterIndex_[7]);
1942         }
1943       }
1944     }
1945   }
1946   bool HBHENoiseFilterResultFlag = filter_decisions[0];  //setup for RECO and MINIAOD
1947   // ==========================================================
1948   // HCAL Noise filter
1949   bool bHBHENoiseFilter = HBHENoiseFilterResultFlag;
1950 
1951   // DCS Filter
1952   bool bDCSFilter = (bypassAllDCSChecks_ || DCSFilter_->filter(iEvent, iSetup));
1953   // ==========================================================
1954   // Reconstructed MET Information - fill MonitorElements
1955   std::string DirName_old = DirName;
1956   for (std::vector<std::string>::const_iterator ic = folderNames_.begin(); ic != folderNames_.end(); ic++) {
1957     bool pass_selection = false;
1958     if ((*ic == "Uncleaned") && (isCaloMet_ || bPrimaryVertex)) {
1959       fillMESet(iEvent,
1960                 DirName_old + "/" + *ic,
1961                 *met,
1962                 patmet,
1963                 pfmet,
1964                 calomet,
1965                 zCand,
1966                 map_dijet_MEs,
1967                 trigger_flag,
1968                 filter_decisions);
1969       pass_selection = true;
1970     }
1971     //take two lines out for first check
1972     if ((*ic == "Cleaned") && bDCSFilter && bHBHENoiseFilter && bPrimaryVertex && bJetID) {
1973       fillMESet(iEvent,
1974                 DirName_old + "/" + *ic,
1975                 *met,
1976                 patmet,
1977                 pfmet,
1978                 calomet,
1979                 zCand,
1980                 map_dijet_MEs,
1981                 trigger_flag,
1982                 filter_decisions);
1983       pass_selection = true;
1984     }
1985     if ((*ic == "DiJet") && bDCSFilter && bHBHENoiseFilter && bPrimaryVertex && bDiJetID) {
1986       fillMESet(iEvent,
1987                 DirName_old + "/" + *ic,
1988                 *met,
1989                 patmet,
1990                 pfmet,
1991                 calomet,
1992                 zCand,
1993                 map_dijet_MEs,
1994                 trigger_flag,
1995                 filter_decisions);
1996       pass_selection = true;
1997     }
1998     if ((*ic == "ZJets") && bDCSFilter && bHBHENoiseFilter && bPrimaryVertex && bZJets) {
1999       fillMESet(iEvent,
2000                 DirName_old + "/" + *ic,
2001                 *met,
2002                 patmet,
2003                 pfmet,
2004                 calomet,
2005                 zCand,
2006                 map_dijet_MEs,
2007                 trigger_flag,
2008                 filter_decisions);
2009       pass_selection = true;
2010     }
2011     if (pass_selection && isPFMet_) {
2012       DirName = DirName_old + "/" + *ic;
2013     }
2014   }
2015 }
2016 
2017 // ***********************************************************
2018 void METAnalyzer::fillMESet(const edm::Event& iEvent,
2019                             std::string DirName,
2020                             const reco::MET& met,
2021                             const pat::MET* patmet,
2022                             const reco::PFMET* pfmet,
2023                             const reco::CaloMET* calomet,
2024                             const reco::Candidate::PolarLorentzVector& zCand,
2025                             std::map<std::string, MonitorElement*>& map_of_MEs,
2026                             std::vector<bool> techTriggerCase,
2027                             std::vector<bool> METFilterDecision) {
2028   bool bLumiSecPlot = fill_met_high_level_histo;
2029   bool fillPFCandidatePlots = false;
2030   if (DirName.find("Cleaned") != std::string::npos) {
2031     fillPFCandidatePlots = true;
2032     fillMonitorElement(iEvent,
2033                        DirName,
2034                        std::string(""),
2035                        met,
2036                        patmet,
2037                        pfmet,
2038                        calomet,
2039                        zCand,
2040                        map_of_MEs,
2041                        bLumiSecPlot,
2042                        fillPFCandidatePlots,
2043                        techTriggerCase,
2044                        METFilterDecision);
2045     for (unsigned int i = 0; i < triggerFolderLabels_.size(); i++) {
2046       fillPFCandidatePlots = false;
2047       if (triggerFolderDecisions_[i]) {
2048         fillMonitorElement(iEvent,
2049                            DirName,
2050                            triggerFolderLabels_[i],
2051                            met,
2052                            patmet,
2053                            pfmet,
2054                            calomet,
2055                            zCand,
2056                            map_of_MEs,
2057                            bLumiSecPlot,
2058                            fillPFCandidatePlots,
2059                            techTriggerCase,
2060                            METFilterDecision);
2061       }
2062     }
2063   } else if (DirName.find("DiJet") != std::string::npos) {
2064     fillMonitorElement(iEvent,
2065                        DirName,
2066                        std::string(""),
2067                        met,
2068                        patmet,
2069                        pfmet,
2070                        calomet,
2071                        zCand,
2072                        map_of_MEs,
2073                        bLumiSecPlot,
2074                        fillPFCandidatePlots,
2075                        techTriggerCase,
2076                        METFilterDecision);
2077     for (unsigned int i = 0; i < triggerFolderLabels_.size(); i++) {
2078       if (triggerFolderDecisions_[i])
2079         fillMonitorElement(iEvent,
2080                            DirName,
2081                            triggerFolderLabels_[i],
2082                            met,
2083                            patmet,
2084                            pfmet,
2085                            calomet,
2086                            zCand,
2087                            map_of_MEs,
2088                            bLumiSecPlot,
2089                            fillPFCandidatePlots,
2090                            techTriggerCase,
2091                            METFilterDecision);
2092     }
2093   } else if (DirName.find("ZJets") != std::string::npos) {
2094     fillMonitorElement(iEvent,
2095                        DirName,
2096                        std::string(""),
2097                        met,
2098                        patmet,
2099                        pfmet,
2100                        calomet,
2101                        zCand,
2102                        map_of_MEs,
2103                        bLumiSecPlot,
2104                        fillPFCandidatePlots,
2105                        techTriggerCase,
2106                        METFilterDecision);
2107   } else {
2108     fillMonitorElement(iEvent,
2109                        DirName,
2110                        std::string(""),
2111                        met,
2112                        patmet,
2113                        pfmet,
2114                        calomet,
2115                        zCand,
2116                        map_of_MEs,
2117                        bLumiSecPlot,
2118                        fillPFCandidatePlots,
2119                        techTriggerCase,
2120                        METFilterDecision);
2121   }
2122 }
2123 
2124 // ***********************************************************
2125 void METAnalyzer::fillMonitorElement(const edm::Event& iEvent,
2126                                      std::string DirName,
2127                                      std::string subFolderName,
2128                                      const reco::MET& met,
2129                                      const pat::MET* patmet,
2130                                      const reco::PFMET* pfmet,
2131                                      const reco::CaloMET* calomet,
2132                                      const reco::Candidate::PolarLorentzVector& zCand,
2133                                      std::map<std::string, MonitorElement*>& map_of_MEs,
2134                                      bool bLumiSecPlot,
2135                                      bool fillPFCandidatePlots,
2136                                      std::vector<bool> techTriggerCase,
2137                                      std::vector<bool> METFilterDecision) {
2138   bool do_only_Z_histograms = false;
2139   if (DirName.find("ZJets") != std::string::npos) {  //do Z plots only
2140     do_only_Z_histograms = true;
2141     //\vec{p}_{T}^{Z}+vec{u}_{T}+\vec{MET}=0
2142 
2143     double u_x = -met.px() - zCand.Px();
2144     double u_y = -met.py() - zCand.Py();
2145 
2146     //protection for VERY special case where Z-Pt==0
2147     double u_par = 0;
2148     double u_perp = sqrt(u_x * u_x + u_y * u_y);
2149     double e_Z_x = 0;
2150     double e_Z_y = 0;
2151     if (zCand.Pt() != 0) {
2152       e_Z_x = zCand.Px() / zCand.Pt();
2153       e_Z_y = zCand.Py() / zCand.Pt();
2154     }
2155     u_par = u_x * e_Z_x + u_y * e_Z_y;
2156     u_perp = -e_Z_y * u_x + e_Z_x * u_y;
2157 
2158     meZJets_u_par = map_of_MEs[DirName + "/" + "u_parallel_Z_inc"];
2159     if (meZJets_u_par && meZJets_u_par->getRootObject())
2160       meZJets_u_par->Fill(u_par);
2161     if (zCand.Pt() < 15) {
2162       meZJets_u_par_ZPt_0_15 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_0_15"];
2163       if (meZJets_u_par_ZPt_0_15 && meZJets_u_par_ZPt_0_15->getRootObject())
2164         meZJets_u_par_ZPt_0_15->Fill(u_par);
2165     } else if (zCand.Pt() < 30) {
2166       meZJets_u_par_ZPt_15_30 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_15_30"];
2167       if (meZJets_u_par_ZPt_15_30 && meZJets_u_par_ZPt_15_30->getRootObject())
2168         meZJets_u_par_ZPt_15_30->Fill(u_par);
2169     } else if (zCand.Pt() < 55) {
2170       meZJets_u_par_ZPt_30_55 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_30_55"];
2171       if (meZJets_u_par_ZPt_30_55 && meZJets_u_par_ZPt_30_55->getRootObject())
2172         meZJets_u_par_ZPt_30_55->Fill(u_par);
2173     } else if (zCand.Pt() < 75) {
2174       meZJets_u_par_ZPt_55_75 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_55_75"];
2175       if (meZJets_u_par_ZPt_55_75 && meZJets_u_par_ZPt_55_75->getRootObject())
2176         meZJets_u_par_ZPt_55_75->Fill(u_par);
2177     } else if (zCand.Pt() < 150) {
2178       meZJets_u_par_ZPt_75_150 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_75_150"];
2179       if (meZJets_u_par_ZPt_75_150 && meZJets_u_par_ZPt_75_150->getRootObject())
2180         meZJets_u_par_ZPt_75_150->Fill(u_par);
2181     } else if (zCand.Pt() < 290) {
2182       meZJets_u_par_ZPt_150_290 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_150_290"];
2183       if (meZJets_u_par_ZPt_150_290 && meZJets_u_par_ZPt_150_290->getRootObject())
2184         meZJets_u_par_ZPt_150_290->Fill(u_par);
2185     } else {
2186       meZJets_u_par_ZPt_290 = map_of_MEs[DirName + "/" + "u_parallel_ZPt_290"];
2187       if (meZJets_u_par_ZPt_290 && meZJets_u_par_ZPt_290->getRootObject())
2188         meZJets_u_par_ZPt_290->Fill(u_par);
2189     }
2190 
2191     meZJets_u_perp = map_of_MEs[DirName + "/" + "u_perp_Z_inc"];
2192     if (meZJets_u_perp && meZJets_u_perp->getRootObject())
2193       meZJets_u_perp->Fill(u_perp);
2194     if (zCand.Pt() < 15) {
2195       meZJets_u_perp_ZPt_0_15 = map_of_MEs[DirName + "/" + "u_perp_ZPt_0_15"];
2196       if (meZJets_u_perp_ZPt_0_15 && meZJets_u_perp_ZPt_0_15->getRootObject())
2197         meZJets_u_perp_ZPt_0_15->Fill(u_perp);
2198     } else if (zCand.Pt() < 30) {
2199       meZJets_u_perp_ZPt_15_30 = map_of_MEs[DirName + "/" + "u_perp_ZPt_15_30"];
2200       if (meZJets_u_perp_ZPt_15_30 && meZJets_u_perp_ZPt_15_30->getRootObject())
2201         meZJets_u_perp_ZPt_15_30->Fill(u_perp);
2202     } else if (zCand.Pt() < 55) {
2203       meZJets_u_perp_ZPt_30_55 = map_of_MEs[DirName + "/" + "u_perp_ZPt_30_55"];
2204       if (meZJets_u_perp_ZPt_30_55 && meZJets_u_perp_ZPt_30_55->getRootObject())
2205         meZJets_u_perp_ZPt_30_55->Fill(u_perp);
2206     } else if (zCand.Pt() < 75) {
2207       meZJets_u_perp_ZPt_55_75 = map_of_MEs[DirName + "/" + "u_perp_ZPt_55_75"];
2208       if (meZJets_u_perp_ZPt_55_75 && meZJets_u_perp_ZPt_55_75->getRootObject())
2209         meZJets_u_perp_ZPt_55_75->Fill(u_perp);
2210     } else if (zCand.Pt() < 150) {
2211       meZJets_u_perp_ZPt_75_150 = map_of_MEs[DirName + "/" + "u_perp_ZPt_75_150"];
2212       if (meZJets_u_perp_ZPt_75_150 && meZJets_u_perp_ZPt_75_150->getRootObject())
2213         meZJets_u_perp_ZPt_75_150->Fill(u_perp);
2214     } else if (zCand.Pt() < 290) {
2215       meZJets_u_perp_ZPt_150_290 = map_of_MEs[DirName + "/" + "u_perp_ZPt_150_290"];
2216       if (meZJets_u_perp_ZPt_150_290 && meZJets_u_perp_ZPt_150_290->getRootObject())
2217         meZJets_u_perp_ZPt_150_290->Fill(u_perp);
2218     } else {
2219       meZJets_u_perp_ZPt_290 = map_of_MEs[DirName + "/" + "u_perp_ZPt_290"];
2220       if (meZJets_u_perp_ZPt_290 && meZJets_u_perp_ZPt_290->getRootObject())
2221         meZJets_u_perp_ZPt_290->Fill(u_perp);
2222     }
2223   }
2224   if (!do_only_Z_histograms) {
2225     // Reconstructed MET Information
2226     double SumET = met.sumEt();
2227     double METSig = met.mEtSig();
2228     //double Ez     = met.e_longitudinal();
2229     double MET = met.pt();
2230     double MEx = met.px();
2231     double MEy = met.py();
2232     double METPhi = met.phi();
2233     //
2234     int myLuminosityBlock;
2235     myLuminosityBlock = iEvent.luminosityBlock();
2236     //
2237 
2238     if (!subFolderName.empty()) {
2239       DirName = DirName + "/" + subFolderName;
2240     }
2241 
2242     hMEx = map_of_MEs[DirName + "/" + "MEx"];
2243     if (hMEx && hMEx->getRootObject())
2244       hMEx->Fill(MEx);
2245     hMEy = map_of_MEs[DirName + "/" + "MEy"];
2246     if (hMEy && hMEy->getRootObject())
2247       hMEy->Fill(MEy);
2248     hMET = map_of_MEs[DirName + "/" + "MET"];
2249     if (hMET && hMET->getRootObject())
2250       hMET->Fill(MET);
2251     hMET_2 = map_of_MEs[DirName + "/" + "MET_2"];
2252     if (hMET_2 && hMET_2->getRootObject())
2253       hMET_2->Fill(MET);
2254 
2255     //hMET_HBHENoiseFilter        = ibooker.book1D("MET_HBHENoiseFilter",        "MET_HBHENoiseFiltered",        200,    0, 1000);
2256     //hMET_CSCTightHaloFilter    = ibooker.book1D("MET_CSCTightHaloFilter",        "MET_CSCTightHaloFiltered",        200,    0, 1000);
2257     //hMET_eeBadScFilter    = ibooker.book1D("MET_eeBadScFilter",        "MET_eeBadScFiltered",        200,    0, 1000);
2258     //hMET_HBHEIsoNoiseFilter        = ibooker.book1D("MET_HBHEIsoNoiseFilter",        "MET_HBHEIsoNoiseFiltered",        200,    0, 1000);
2259     //hMET_CSCTightHalo2015Filter    = ibooker.book1D("MET_CSCTightHalo2015Filter",        "MET_CSCTightHalo2015Filtered",        200,    0, 1000);
2260     //hMET_EcalDeadCellTriggerFilter    = ibooker.book1D("MET_EcalDeadCellTriggerFilter",        "MET_EcalDeadCellTriggerFiltered",        200,    0, 1000);
2261     //hMET_EcalDeadCellBoundaryFilter    = ibooker.book1D("MET_EcalDeadCellBoundaryFilter",        "MET_EcalDeadCellBoundaryFiltered",        200,    0, 1000);
2262     //hMET_HcalStripHaloFilter    = ibooker.book1D("MET_HcalStripHaloFilter",        "MET_HcalStripHaloFiltered",        200,    0, 1000);
2263 
2264     bool HBHENoiseFilterResult = false;
2265     bool CSCTightHaloFilterResult = false;
2266     bool eeBadScFilterResult = false;
2267     bool HBHEIsoNoiseFilterResult = false;
2268     bool CSCTightHalo2015FilterResult = false;
2269     bool EcalDeadCellTriggerFilterResult = false;
2270     bool EcalDeadCellBoundaryFilterResult = false;
2271     bool HcalStripHaloFilterResult = false;
2272     HBHENoiseFilterResult = METFilterDecision[0];
2273     if (HBHENoiseFilterResult) {
2274       hMET_HBHENoiseFilter = map_of_MEs[DirName + "/" + "MET_HBHENoiseFilter"];
2275       if (hMET_HBHENoiseFilter && hMET_HBHENoiseFilter->getRootObject())
2276         hMET_HBHENoiseFilter->Fill(MET);
2277     }
2278     CSCTightHaloFilterResult = METFilterDecision[1];
2279     if (CSCTightHaloFilterResult) {
2280       hMET_CSCTightHaloFilter = map_of_MEs[DirName + "/" + "MET_CSCTightHaloFilter"];
2281       if (hMET_CSCTightHaloFilter && hMET_CSCTightHaloFilter->getRootObject())
2282         hMET_CSCTightHaloFilter->Fill(MET);
2283     }
2284     eeBadScFilterResult = METFilterDecision[2];
2285     if (eeBadScFilterResult) {
2286       hMET_eeBadScFilter = map_of_MEs[DirName + "/" + "MET_eeBadScFilter"];
2287       if (hMET_eeBadScFilter && hMET_eeBadScFilter->getRootObject())
2288         hMET_eeBadScFilter->Fill(MET);
2289     }
2290     HBHEIsoNoiseFilterResult = METFilterDecision[3];
2291     if (HBHEIsoNoiseFilterResult) {
2292       hMET_HBHEIsoNoiseFilter = map_of_MEs[DirName + "/" + "MET_HBHEIsoNoiseFilter"];
2293       if (hMET_HBHEIsoNoiseFilter && hMET_HBHEIsoNoiseFilter->getRootObject())
2294         hMET_HBHEIsoNoiseFilter->Fill(MET);
2295     }
2296     CSCTightHalo2015FilterResult = METFilterDecision[4];
2297     if (CSCTightHalo2015FilterResult) {
2298       hMET_CSCTightHalo2015Filter = map_of_MEs[DirName + "/" + "MET_CSCTightHalo2015Filter"];
2299       if (hMET_CSCTightHalo2015Filter && hMET_CSCTightHalo2015Filter->getRootObject())
2300         hMET_CSCTightHalo2015Filter->Fill(MET);
2301     }
2302     EcalDeadCellTriggerFilterResult = METFilterDecision[5];
2303     if (EcalDeadCellTriggerFilterResult) {
2304       hMET_EcalDeadCellTriggerFilter = map_of_MEs[DirName + "/" + "MET_EcalDeadCellTriggerFilter"];
2305       if (hMET_EcalDeadCellTriggerFilter && hMET_EcalDeadCellTriggerFilter->getRootObject())
2306         hMET_EcalDeadCellTriggerFilter->Fill(MET);
2307     }
2308     EcalDeadCellBoundaryFilterResult = METFilterDecision[6];
2309     if (EcalDeadCellBoundaryFilterResult) {
2310       hMET_EcalDeadCellBoundaryFilter = map_of_MEs[DirName + "/" + "MET_EcalDeadCellBoundaryFilter"];
2311       if (hMET_EcalDeadCellBoundaryFilter && hMET_EcalDeadCellBoundaryFilter->getRootObject())
2312         hMET_EcalDeadCellBoundaryFilter->Fill(MET);
2313     }
2314     HcalStripHaloFilterResult = METFilterDecision[7];
2315     if (HcalStripHaloFilterResult) {
2316       hMET_HcalStripHaloFilter = map_of_MEs[DirName + "/" + "MET_HcalStripHaloFilter"];
2317       if (hMET_HcalStripHaloFilter && hMET_HcalStripHaloFilter->getRootObject())
2318         hMET_HcalStripHaloFilter->Fill(MET);
2319     }
2320     hMETPhi = map_of_MEs[DirName + "/" + "METPhi"];
2321     if (hMETPhi && hMETPhi->getRootObject())
2322       hMETPhi->Fill(METPhi);
2323     hSumET = map_of_MEs[DirName + "/" + "SumET"];
2324     if (hSumET && hSumET->getRootObject())
2325       hSumET->Fill(SumET);
2326     hMETSig = map_of_MEs[DirName + "/" + "METSig"];
2327     if (hMETSig && hMETSig->getRootObject())
2328       hMETSig->Fill(METSig);
2329     hMET_logx = map_of_MEs[DirName + "/" + "MET_logx"];
2330     if (hMET_logx && hMET_logx->getRootObject())
2331       hMET_logx->Fill(log10(MET));
2332     hSumET_logx = map_of_MEs[DirName + "/" + "SumET_logx"];
2333     if (hSumET_logx && hSumET_logx->getRootObject())
2334       hSumET_logx->Fill(log10(SumET));
2335 
2336     // Fill NPV profiles
2337     //--------------------------------------------------------------------------
2338     meMEx_profile = map_of_MEs[DirName + "/MEx_profile"];
2339     meMEy_profile = map_of_MEs[DirName + "/MEy_profile"];
2340     meMET_profile = map_of_MEs[DirName + "/MET_profile"];
2341     meSumET_profile = map_of_MEs[DirName + "/SumET_profile"];
2342 
2343     if (meMEx_profile && meMEx_profile->getRootObject())
2344       meMEx_profile->Fill(numPV_, MEx);
2345     if (meMEy_profile && meMEy_profile->getRootObject())
2346       meMEy_profile->Fill(numPV_, MEy);
2347     if (meMET_profile && meMET_profile->getRootObject())
2348       meMET_profile->Fill(numPV_, MET);
2349     if (meSumET_profile && meSumET_profile->getRootObject())
2350       meSumET_profile->Fill(numPV_, SumET);
2351 
2352     if (isCaloMet_) {
2353       //const reco::CaloMETCollection *calometcol = calometcoll.product();
2354       //const reco::CaloMET *calomet;
2355       //calomet = &(calometcol->front());
2356 
2357       double caloEtFractionHadronic = calomet->etFractionHadronic();
2358       double caloEmEtFraction = calomet->emEtFraction();
2359 
2360       double caloHadEtInHB = calomet->hadEtInHB();
2361       double caloHadEtInHO = calomet->hadEtInHO();
2362       double caloHadEtInHE = calomet->hadEtInHE();
2363       double caloHadEtInHF = calomet->hadEtInHF();
2364       double caloEmEtInEB = calomet->emEtInEB();
2365       double caloEmEtInEE = calomet->emEtInEE();
2366       double caloEmEtInHF = calomet->emEtInHF();
2367 
2368       hCaloHadEtInHB = map_of_MEs[DirName + "/" + "CaloHadEtInHB"];
2369       if (hCaloHadEtInHB && hCaloHadEtInHB->getRootObject())
2370         hCaloHadEtInHB->Fill(caloHadEtInHB);
2371       hCaloHadEtInHO = map_of_MEs[DirName + "/" + "CaloHadEtInHO"];
2372       if (hCaloHadEtInHO && hCaloHadEtInHO->getRootObject())
2373         hCaloHadEtInHO->Fill(caloHadEtInHO);
2374       hCaloHadEtInHE = map_of_MEs[DirName + "/" + "CaloHadEtInHE"];
2375       if (hCaloHadEtInHE && hCaloHadEtInHE->getRootObject())
2376         hCaloHadEtInHE->Fill(caloHadEtInHE);
2377       hCaloHadEtInHF = map_of_MEs[DirName + "/" + "CaloHadEtInHF"];
2378       if (hCaloHadEtInHF && hCaloHadEtInHF->getRootObject())
2379         hCaloHadEtInHF->Fill(caloHadEtInHF);
2380       hCaloEmEtInEB = map_of_MEs[DirName + "/" + "CaloEmEtInEB"];
2381       if (hCaloEmEtInEB && hCaloEmEtInEB->getRootObject())
2382         hCaloEmEtInEB->Fill(caloEmEtInEB);
2383       hCaloEmEtInEE = map_of_MEs[DirName + "/" + "CaloEmEtInEE"];
2384       if (hCaloEmEtInEE && hCaloEmEtInEE->getRootObject())
2385         hCaloEmEtInEE->Fill(caloEmEtInEE);
2386       hCaloEmEtInHF = map_of_MEs[DirName + "/" + "CaloEmEtInHF"];
2387       if (hCaloEmEtInHF && hCaloEmEtInHF->getRootObject())
2388         hCaloEmEtInHF->Fill(caloEmEtInHF);
2389 
2390       hCaloMETPhi020 = map_of_MEs[DirName + "/" + "CaloMETPhi020"];
2391       if (MET > 20. && hCaloMETPhi020 && hCaloMETPhi020->getRootObject()) {
2392         hCaloMETPhi020->Fill(METPhi);
2393       }
2394 
2395       hCaloEtFractionHadronic = map_of_MEs[DirName + "/" + "CaloEtFractionHadronic"];
2396       if (hCaloEtFractionHadronic && hCaloEtFractionHadronic->getRootObject())
2397         hCaloEtFractionHadronic->Fill(caloEtFractionHadronic);
2398       hCaloEmEtFraction = map_of_MEs[DirName + "/" + "CaloEmEtFraction"];
2399       if (hCaloEmEtFraction && hCaloEmEtFraction->getRootObject())
2400         hCaloEmEtFraction->Fill(caloEmEtFraction);
2401       hCaloEmEtFraction020 = map_of_MEs[DirName + "/" + "CaloEmEtFraction020"];
2402       if (MET > 20. && hCaloEmEtFraction020 && hCaloEmEtFraction020->getRootObject())
2403         hCaloEmEtFraction020->Fill(caloEmEtFraction);
2404     }
2405     if (isPFMet_) {
2406       if (fillPFCandidatePlots && fillCandidateMap_histos) {
2407         for (unsigned int i = 0; i < countsPFCand_.size(); i++) {
2408           countsPFCand_[i] = 0;
2409           MExPFCand_[i] = 0.;
2410           MEyPFCand_[i] = 0.;
2411         }
2412 
2413         // typedef std::vector<reco::PFCandidate> pfCand;
2414         edm::Handle<std::vector<reco::PFCandidate> > particleFlow;
2415         iEvent.getByToken(pflowToken_, particleFlow);
2416 
2417         float pt_sum_CHF_Barrel = 0;
2418         float pt_sum_CHF_Endcap_plus = 0;
2419         float pt_sum_CHF_Endcap_minus = 0;
2420         float pt_sum_NHF_Barrel = 0;
2421         float pt_sum_NHF_Endcap_plus = 0;
2422         float pt_sum_NHF_Endcap_minus = 0;
2423         float pt_sum_PhF_Barrel = 0;
2424         float pt_sum_PhF_Endcap_plus = 0;
2425         float pt_sum_PhF_Endcap_minus = 0;
2426         float pt_sum_HFH_plus = 0;
2427         float pt_sum_HFH_minus = 0;
2428         float pt_sum_HFE_plus = 0;
2429         float pt_sum_HFE_minus = 0;
2430 
2431         float px_chargedHadronsBarrel = 0;
2432         float py_chargedHadronsBarrel = 0;
2433         float px_chargedHadronsEndcapPlus = 0;
2434         float py_chargedHadronsEndcapPlus = 0;
2435         float px_chargedHadronsEndcapMinus = 0;
2436         float py_chargedHadronsEndcapMinus = 0;
2437         float px_neutralHadronsBarrel = 0;
2438         float py_neutralHadronsBarrel = 0;
2439         float px_neutralHadronsEndcapPlus = 0;
2440         float py_neutralHadronsEndcapPlus = 0;
2441         float px_neutralHadronsEndcapMinus = 0;
2442         float py_neutralHadronsEndcapMinus = 0;
2443         float px_PhotonsBarrel = 0;
2444         float py_PhotonsBarrel = 0;
2445         float px_PhotonsEndcapPlus = 0;
2446         float py_PhotonsEndcapPlus = 0;
2447         float px_PhotonsEndcapMinus = 0;
2448         float py_PhotonsEndcapMinus = 0;
2449         float px_HFHadronsPlus = 0;
2450         float py_HFHadronsPlus = 0;
2451         float px_HFHadronsMinus = 0;
2452         float py_HFHadronsMinus = 0;
2453         float px_HFEGammasPlus = 0;
2454         float py_HFEGammasPlus = 0;
2455         float px_HFEGammasMinus = 0;
2456         float py_HFEGammasMinus = 0;
2457         for (unsigned int i = 0; i < particleFlow->size(); i++) {
2458           const reco::PFCandidate& c = particleFlow->at(i);
2459           if (c.particleId() == 1) {  //charged hadrons
2460             //endcap minus
2461             if (c.eta() > (-3.0) && c.eta() < (-1.392)) {
2462               px_chargedHadronsEndcapMinus -= c.px();
2463               py_chargedHadronsEndcapMinus -= c.py();
2464               pt_sum_CHF_Endcap_minus += c.et();
2465             } else if (c.eta() >= (-1.392) && c.eta() <= 1.392) {  //barrel
2466               px_chargedHadronsBarrel -= c.px();
2467               py_chargedHadronsBarrel -= c.py();
2468               pt_sum_CHF_Barrel += c.et();
2469             } else if (c.eta() > 1.392 && c.eta() < 3.0) {  //endcap plus
2470               px_chargedHadronsEndcapPlus -= c.px();
2471               py_chargedHadronsEndcapPlus -= c.py();
2472               pt_sum_CHF_Endcap_plus += c.et();
2473             }
2474           }
2475           if (c.particleId() == 5) {  //neutral hadrons
2476             //endcap minus
2477             if (c.eta() > (-3.0) && c.eta() < (-1.392)) {
2478               px_neutralHadronsEndcapMinus -= c.px();
2479               py_neutralHadronsEndcapMinus -= c.py();
2480               pt_sum_NHF_Endcap_minus += c.et();
2481             } else if (c.eta() >= (-1.392) && c.eta() <= 1.392) {
2482               px_neutralHadronsBarrel -= c.px();
2483               py_neutralHadronsBarrel -= c.py();
2484               pt_sum_NHF_Barrel += c.et();
2485             } else if (c.eta() > 1.392 && c.eta() < 3.0) {
2486               px_neutralHadronsEndcapPlus -= c.px();
2487               py_neutralHadronsEndcapPlus -= c.py();
2488               pt_sum_NHF_Endcap_plus += c.et();
2489             }
2490           }
2491           if (c.particleId() == 4) {  //photons
2492             //endcap minus
2493             if (c.eta() > (-3.0) && c.eta() < (-1.479)) {
2494               px_PhotonsEndcapMinus -= c.px();
2495               py_PhotonsEndcapMinus -= c.py();
2496               pt_sum_PhF_Endcap_minus += c.et();
2497             } else if (c.eta() >= (-1.479) && c.eta() <= 1.479) {
2498               px_PhotonsBarrel -= c.px();
2499               py_PhotonsBarrel -= c.py();
2500               pt_sum_PhF_Barrel += c.et();
2501             } else if (c.eta() > 1.479 && c.eta() < 3.0) {
2502               px_PhotonsEndcapPlus -= c.px();
2503               py_PhotonsEndcapPlus -= c.py();
2504               pt_sum_PhF_Endcap_plus += c.et();
2505             }
2506           }
2507           if (c.particleId() == 6) {  //HFHadrons
2508             //forward minus
2509             if (c.eta() > (-5.20) && c.eta() < -2.901376) {
2510               pt_sum_HFH_minus += c.et();
2511               px_HFHadronsMinus -= c.px();
2512               py_HFHadronsMinus -= c.py();
2513             } else if (c.eta() > 2.901376 && c.eta() < 5.20) {  //forward plus
2514               px_HFHadronsPlus -= c.px();
2515               py_HFHadronsPlus -= c.py();
2516               pt_sum_HFH_plus += c.et();
2517             }
2518           }
2519           if (c.particleId() == 7) {  //HFEGammas
2520             //forward minus
2521             if (c.eta() > (-5.20) && c.eta() < -2.901376) {
2522               pt_sum_HFE_minus += c.et();
2523               px_HFEGammasMinus -= c.px();
2524               py_HFEGammasMinus -= c.py();
2525             } else if (c.eta() > 2.901376 && c.eta() < 5.20) {  //forward plus
2526               px_HFEGammasPlus -= c.px();
2527               py_HFEGammasPlus -= c.py();
2528               pt_sum_HFE_plus += c.et();
2529             }
2530           }
2531           for (unsigned int j = 0; j < typePFCand_.size(); j++) {
2532             if (c.particleId() == typePFCand_[j]) {
2533               //second check for endcap, if inside barrel Max and Min symmetric around 0
2534               if (((c.eta() > etaMinPFCand_[j]) && (c.eta() < etaMaxPFCand_[j])) ||
2535                   ((c.eta() > (-etaMaxPFCand_[j])) && (c.eta() < (-etaMinPFCand_[j])))) {
2536                 countsPFCand_[j] += 1;
2537                 MExPFCand_[j] -= c.px();
2538                 MEyPFCand_[j] -= c.py();
2539               }
2540             }
2541           }
2542         }
2543 
2544         for (unsigned int j = 0; j < countsPFCand_.size(); j++) {
2545           profilePFCand_x_[j] = map_of_MEs[DirName + "/" + profilePFCand_x_name_[j]];
2546           if (profilePFCand_x_[j] && profilePFCand_x_[j]->getRootObject())
2547             profilePFCand_x_[j]->Fill(countsPFCand_[j], MExPFCand_[j]);
2548           profilePFCand_y_[j] = map_of_MEs[DirName + "/" + profilePFCand_y_name_[j]];
2549           if (profilePFCand_y_[j] && profilePFCand_y_[j]->getRootObject())
2550             profilePFCand_y_[j]->Fill(countsPFCand_[j], MEyPFCand_[j]);
2551         }
2552         meCHF_Barrel = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionBarrel"];
2553         if (meCHF_Barrel && meCHF_Barrel->getRootObject())
2554           meCHF_Barrel->Fill(pt_sum_CHF_Barrel / pfmet->sumEt());
2555         meCHF_EndcapPlus = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapPlus"];
2556         if (meCHF_EndcapPlus && meCHF_EndcapPlus->getRootObject())
2557           meCHF_EndcapPlus->Fill(pt_sum_CHF_Endcap_plus / pfmet->sumEt());
2558         meCHF_EndcapMinus = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapMinus"];
2559         if (meCHF_EndcapMinus && meCHF_EndcapMinus->getRootObject())
2560           meCHF_EndcapMinus->Fill(pt_sum_CHF_Endcap_minus / pfmet->sumEt());
2561         meNHF_Barrel = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionBarrel"];
2562         if (meNHF_Barrel && meNHF_Barrel->getRootObject())
2563           meNHF_Barrel->Fill(pt_sum_NHF_Barrel / pfmet->sumEt());
2564         meNHF_EndcapPlus = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus"];
2565         if (meNHF_EndcapPlus && meNHF_EndcapPlus->getRootObject())
2566           meNHF_EndcapPlus->Fill(pt_sum_NHF_Endcap_plus / pfmet->sumEt());
2567         meNHF_EndcapMinus = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus"];
2568         if (meNHF_EndcapMinus && meNHF_EndcapMinus->getRootObject())
2569           meNHF_EndcapMinus->Fill(pt_sum_NHF_Endcap_minus / pfmet->sumEt());
2570         mePhF_Barrel = map_of_MEs[DirName + "/" + "PfPhotonEtFractionBarrel"];
2571         if (mePhF_Barrel && mePhF_Barrel->getRootObject())
2572           mePhF_Barrel->Fill(pt_sum_PhF_Barrel / pfmet->sumEt());
2573         mePhF_EndcapPlus = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapPlus"];
2574         if (mePhF_EndcapPlus && mePhF_EndcapPlus->getRootObject())
2575           mePhF_EndcapPlus->Fill(pt_sum_PhF_Endcap_plus / pfmet->sumEt());
2576         mePhF_EndcapMinus = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapMinus"];
2577         if (mePhF_EndcapMinus && mePhF_EndcapMinus->getRootObject())
2578           mePhF_EndcapMinus->Fill(pt_sum_PhF_Endcap_minus / pfmet->sumEt());
2579         meHFHadF_Plus = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionPlus"];
2580         if (meHFHadF_Plus && meHFHadF_Plus->getRootObject())
2581           meHFHadF_Plus->Fill(pt_sum_HFH_plus / pfmet->sumEt());
2582         meHFHadF_Minus = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionMinus"];
2583         if (meHFHadF_Minus && meHFHadF_Minus->getRootObject())
2584           meHFHadF_Minus->Fill(pt_sum_HFH_minus / pfmet->sumEt());
2585         meHFEMF_Plus = map_of_MEs[DirName + "/" + "PfHFEMEtFractionPlus"];
2586         if (meHFEMF_Plus && meHFEMF_Plus->getRootObject())
2587           meHFEMF_Plus->Fill(pt_sum_HFE_plus / pfmet->sumEt());
2588         meHFEMF_Minus = map_of_MEs[DirName + "/" + "PfHFEMEtFractionMinus"];
2589         if (meHFEMF_Minus && meHFEMF_Minus->getRootObject())
2590           meHFEMF_Minus->Fill(pt_sum_HFE_minus / pfmet->sumEt());
2591         //sanity check if we have any type of the respective species in the events
2592         //else don't fill phi, as else we have a results of a biased peak at 0
2593         //if pt_sum of species part is 0, obviously that would be the case
2594         if (pt_sum_CHF_Barrel) {
2595           meMETPhiChargedHadronsBarrel = map_of_MEs[DirName + "/" + "METPhiChargedHadronsBarrel"];
2596           if (meMETPhiChargedHadronsBarrel && meMETPhiChargedHadronsBarrel->getRootObject())
2597             meMETPhiChargedHadronsBarrel->Fill(atan2(py_chargedHadronsBarrel, px_chargedHadronsBarrel));
2598         }
2599         if (pt_sum_CHF_Endcap_plus) {
2600           meMETPhiChargedHadronsEndcapPlus = map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapPlus"];
2601           if (meMETPhiChargedHadronsEndcapPlus && meMETPhiChargedHadronsEndcapPlus->getRootObject())
2602             meMETPhiChargedHadronsEndcapPlus->Fill(atan2(py_chargedHadronsEndcapPlus, px_chargedHadronsEndcapPlus));
2603         }
2604         if (pt_sum_CHF_Endcap_minus) {
2605           meMETPhiChargedHadronsEndcapMinus = map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapMinus"];
2606           if (meMETPhiChargedHadronsEndcapMinus && meMETPhiChargedHadronsEndcapMinus->getRootObject())
2607             meMETPhiChargedHadronsEndcapMinus->Fill(atan2(py_chargedHadronsEndcapMinus, px_chargedHadronsEndcapMinus));
2608         }
2609         if (pt_sum_NHF_Barrel) {
2610           meMETPhiNeutralHadronsBarrel = map_of_MEs[DirName + "/" + "METPhiNeutralHadronsBarrel"];
2611           if (meMETPhiNeutralHadronsBarrel && meMETPhiNeutralHadronsBarrel->getRootObject())
2612             meMETPhiNeutralHadronsBarrel->Fill(atan2(py_neutralHadronsBarrel, px_neutralHadronsBarrel));
2613         }
2614         if (pt_sum_NHF_Endcap_plus) {
2615           meMETPhiNeutralHadronsEndcapPlus = map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapPlus"];
2616           if (meMETPhiNeutralHadronsEndcapPlus && meMETPhiNeutralHadronsEndcapPlus->getRootObject())
2617             meMETPhiNeutralHadronsEndcapPlus->Fill(atan2(py_neutralHadronsEndcapPlus, px_neutralHadronsEndcapPlus));
2618         }
2619         if (pt_sum_NHF_Endcap_minus) {
2620           meMETPhiNeutralHadronsEndcapMinus = map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapMinus"];
2621           if (meMETPhiNeutralHadronsEndcapMinus && meMETPhiNeutralHadronsEndcapMinus->getRootObject())
2622             meMETPhiNeutralHadronsEndcapMinus->Fill(atan2(py_neutralHadronsEndcapMinus, px_neutralHadronsEndcapMinus));
2623         }
2624         if (pt_sum_PhF_Barrel) {
2625           meMETPhiPhotonsBarrel = map_of_MEs[DirName + "/" + "METPhiPhotonsBarrel"];
2626           if (meMETPhiPhotonsBarrel && meMETPhiPhotonsBarrel->getRootObject())
2627             meMETPhiPhotonsBarrel->Fill(atan2(py_PhotonsBarrel, px_PhotonsBarrel));
2628         }
2629         if (pt_sum_PhF_Endcap_plus) {
2630           meMETPhiPhotonsEndcapPlus = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapPlus"];
2631           if (meMETPhiPhotonsEndcapPlus && meMETPhiPhotonsEndcapPlus->getRootObject())
2632             meMETPhiPhotonsEndcapPlus->Fill(atan2(py_PhotonsEndcapPlus, px_PhotonsEndcapPlus));
2633         }
2634         if (pt_sum_PhF_Endcap_minus) {
2635           meMETPhiPhotonsEndcapMinus = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapMinus"];
2636           if (meMETPhiPhotonsEndcapMinus && meMETPhiPhotonsEndcapMinus->getRootObject())
2637             meMETPhiPhotonsEndcapMinus->Fill(atan2(py_PhotonsEndcapMinus, px_PhotonsEndcapMinus));
2638         }
2639         if (pt_sum_HFH_plus) {
2640           meMETPhiHFHadronsPlus = map_of_MEs[DirName + "/" + "METPhiHFHadronsPlus"];
2641           if (meMETPhiHFHadronsPlus && meMETPhiHFHadronsPlus->getRootObject())
2642             meMETPhiHFHadronsPlus->Fill(atan2(py_HFHadronsPlus, px_HFHadronsPlus));
2643         }
2644         if (pt_sum_HFH_minus) {
2645           meMETPhiHFHadronsMinus = map_of_MEs[DirName + "/" + "METPhiHFHadronsMinus"];
2646           if (meMETPhiHFHadronsMinus && meMETPhiHFHadronsMinus->getRootObject())
2647             meMETPhiHFHadronsMinus->Fill(atan2(py_HFHadronsMinus, px_HFHadronsMinus));
2648         }
2649         if (pt_sum_HFE_plus) {
2650           meMETPhiHFEGammasPlus = map_of_MEs[DirName + "/" + "METPhiHFEGammasPlus"];
2651           if (meMETPhiHFEGammasPlus && meMETPhiHFEGammasPlus->getRootObject())
2652             meMETPhiHFEGammasPlus->Fill(atan2(py_HFEGammasPlus, px_HFEGammasPlus));
2653         }
2654         if (pt_sum_HFE_minus) {
2655           meMETPhiHFEGammasMinus = map_of_MEs[DirName + "/" + "METPhiHFEGammasMinus"];
2656           if (meMETPhiHFEGammasMinus && meMETPhiHFEGammasMinus->getRootObject())
2657             meMETPhiHFEGammasMinus->Fill(atan2(py_HFEGammasMinus, px_HFEGammasMinus));
2658         }
2659         //fill other diagnostic plots based on trigger decision
2660         /*if(techTriggerCase[0]){//techTriggerResultBx0 && techTriggerResultBxM2 && techTriggerResultBxM1 -> both previous bunches filled
2661       meCHF_Barrel_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm2BXm1Filled"]; if(meCHF_Barrel_BXm2BXm1Filled && meCHF_Barrel_BXm2BXm1Filled->getRootObject()) meCHF_Barrel_BXm2BXm1Filled->Fill(pt_sum_CHF_Barrel/pfmet->sumEt()); 
2662       meCHF_EndcapPlus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm2BXm1Filled"]; if(meCHF_EndcapPlus_BXm2BXm1Filled && meCHF_EndcapPlus_BXm2BXm1Filled->getRootObject()) meCHF_EndcapPlus_BXm2BXm1Filled->Fill(pt_sum_CHF_Endcap_plus/pfmet->sumEt()); 
2663       meCHF_EndcapMinus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm2BXm1Filled"]; if(meCHF_EndcapMinus_BXm2BXm1Filled && meCHF_EndcapMinus_BXm2BXm1Filled->getRootObject()) meCHF_EndcapMinus_BXm2BXm1Filled->Fill(pt_sum_CHF_Endcap_minus/pfmet->sumEt()); 
2664       meNHF_Barrel_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm2BXm1Filled"]; if(meNHF_Barrel_BXm2BXm1Filled && meNHF_Barrel_BXm2BXm1Filled->getRootObject()) meNHF_Barrel_BXm2BXm1Filled->Fill(pt_sum_NHF_Barrel/pfmet->sumEt()); 
2665       meNHF_EndcapPlus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Filled"]; if(meNHF_EndcapPlus_BXm2BXm1Filled && meNHF_EndcapPlus_BXm2BXm1Filled->getRootObject()) meNHF_EndcapPlus_BXm2BXm1Filled->Fill(pt_sum_NHF_Endcap_plus/pfmet->sumEt()); 
2666       meNHF_EndcapMinus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Filled"]; if(meNHF_EndcapMinus_BXm2BXm1Filled && meNHF_EndcapMinus_BXm2BXm1Filled->getRootObject()) meNHF_EndcapMinus_BXm2BXm1Filled->Fill(pt_sum_NHF_Endcap_minus/pfmet->sumEt()); 
2667       mePhF_Barrel_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfPhotonEtFractionBarrel_BXm2BXm1Filled"]; if(mePhF_Barrel_BXm2BXm1Filled && mePhF_Barrel_BXm2BXm1Filled->getRootObject()) mePhF_Barrel_BXm2BXm1Filled->Fill(pt_sum_PhF_Barrel/pfmet->sumEt()); 
2668       mePhF_EndcapPlus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm2BXm1Filled"]; if(mePhF_EndcapPlus_BXm2BXm1Filled && mePhF_EndcapPlus_BXm2BXm1Filled->getRootObject()) mePhF_EndcapPlus_BXm2BXm1Filled->Fill(pt_sum_PhF_Endcap_plus/pfmet->sumEt()); 
2669       mePhF_EndcapMinus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm2BXm1Filled"]; if(mePhF_EndcapMinus_BXm2BXm1Filled && mePhF_EndcapMinus_BXm2BXm1Filled->getRootObject()) mePhF_EndcapMinus_BXm2BXm1Filled->Fill(pt_sum_PhF_Endcap_minus/pfmet->sumEt()); 
2670           meHFHadF_Plus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionPlus_BXm2BXm1Filled"]; if(meHFHadF_Plus_BXm2BXm1Filled && meHFHadF_Plus_BXm2BXm1Filled->getRootObject()) meHFHadF_Plus_BXm2BXm1Filled->Fill(pt_sum_HFH_plus/pfmet->sumEt()); 
2671       meHFHadF_Minus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionMinus_BXm2BXm1Filled"]; if(meHFHadF_Minus_BXm2BXm1Filled && meHFHadF_Minus_BXm2BXm1Filled->getRootObject()) meHFHadF_Minus_BXm2BXm1Filled->Fill(pt_sum_HFH_minus/pfmet->sumEt()); 
2672       meHFEMF_Plus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfHFEMEtFractionPlus_BXm2BXm1Filled"]; if(meHFEMF_Plus_BXm2BXm1Filled && meHFEMF_Plus_BXm2BXm1Filled->getRootObject()) meHFEMF_Plus_BXm2BXm1Filled->Fill(pt_sum_HFE_plus/pfmet->sumEt()); 
2673       meHFEMF_Minus_BXm2BXm1Filled=map_of_MEs[DirName+"/"+"PfHFEMEtFractionMinus_BXm2BXm1Filled"]; if(meHFEMF_Minus_BXm2BXm1Filled && meHFEMF_Minus_BXm2BXm1Filled->getRootObject()) meHFEMF_Minus_BXm2BXm1Filled->Fill(pt_sum_HFE_minus/pfmet->sumEt());
2674       mePhotonEtFraction_BXm2BXm1Filled    = map_of_MEs[DirName+"/"+"PfPhotonEtFraction_BXm2BXm1Filled"];     if (  mePhotonEtFraction_BXm2BXm1Filled  && mePhotonEtFraction_BXm2BXm1Filled ->getRootObject())  mePhotonEtFraction_BXm2BXm1Filled  ->Fill(pfmet->photonEtFraction());
2675       meNeutralHadronEtFraction_BXm2BXm1Filled    = map_of_MEs[DirName+"/"+"PfNeutralHadronEtFraction_BXm2BXm1Filled"];     if (  meNeutralHadronEtFraction_BXm2BXm1Filled  && meNeutralHadronEtFraction_BXm2BXm1Filled ->getRootObject())  meNeutralHadronEtFraction_BXm2BXm1Filled  ->Fill(pfmet->neutralHadronEtFraction());
2676       meChargedHadronEtFraction_BXm2BXm1Filled    = map_of_MEs[DirName+"/"+"PfChargedHadronEtFraction_BXm2BXm1Filled"];     if (  meChargedHadronEtFraction_BXm2BXm1Filled  && meChargedHadronEtFraction_BXm2BXm1Filled ->getRootObject())  meChargedHadronEtFraction_BXm2BXm1Filled  ->Fill(pfmet->chargedHadronEtFraction());
2677       meMET_BXm2BXm1Filled    = map_of_MEs[DirName+"/"+"MET_BXm2BXm1Filled"];     if (  meMET_BXm2BXm1Filled  && meMET_BXm2BXm1Filled ->getRootObject())  meMET_BXm2BXm1Filled  ->Fill(pfmet->pt());
2678       meSumET_BXm2BXm1Filled    = map_of_MEs[DirName+"/"+"SumET_BXm2BXm1Filled"];     if (  meSumET_BXm2BXm1Filled  && meSumET_BXm2BXm1Filled ->getRootObject())  meSumET_BXm2BXm1Filled  ->Fill(pfmet->sumEt());
2679       if(pt_sum_CHF_Barrel){
2680         meMETPhiChargedHadronsBarrel_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Filled"];if(meMETPhiChargedHadronsBarrel_BXm2BXm1Filled  && meMETPhiChargedHadronsBarrel_BXm2BXm1Filled ->getRootObject())meMETPhiChargedHadronsBarrel_BXm2BXm1Filled->Fill(atan2(py_chargedHadronsBarrel,px_chargedHadronsBarrel));
2681       }
2682       if(pt_sum_CHF_Endcap_plus){
2683         meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled  = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Filled"];if(meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled  && meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled ->getRootObject())meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Filled->Fill(atan2(py_chargedHadronsEndcapPlus,px_chargedHadronsEndcapPlus));
2684       }
2685       if(pt_sum_CHF_Endcap_minus){
2686         meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Filled"];if(meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled  && meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled ->getRootObject())meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Filled->Fill(atan2(py_chargedHadronsEndcapMinus,px_chargedHadronsEndcapMinus));
2687       }
2688       if(pt_sum_NHF_Barrel){
2689         meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Filled"];if(meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled  && meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled ->getRootObject())meMETPhiNeutralHadronsBarrel_BXm2BXm1Filled->Fill(atan2(py_neutralHadronsBarrel,px_neutralHadronsBarrel));
2690       }
2691       if(pt_sum_NHF_Endcap_plus){
2692         meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled"];if(meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled  && meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled ->getRootObject())meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Filled->Fill(atan2(py_neutralHadronsEndcapPlus,px_neutralHadronsEndcapPlus));
2693       }
2694       if(pt_sum_NHF_Endcap_minus){
2695         meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled"];if(meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled  && meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled ->getRootObject())meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Filled->Fill(atan2(py_neutralHadronsEndcapMinus,px_neutralHadronsEndcapMinus));
2696       }
2697       if(pt_sum_PhF_Barrel){
2698         meMETPhiPhotonsBarrel_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Filled"];if(meMETPhiPhotonsBarrel_BXm2BXm1Filled  && meMETPhiPhotonsBarrel_BXm2BXm1Filled ->getRootObject())meMETPhiPhotonsBarrel_BXm2BXm1Filled->Fill(atan2(py_PhotonsBarrel,px_PhotonsBarrel));
2699       }
2700       if(pt_sum_PhF_Endcap_plus){
2701         meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Filled"];if(meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled  && meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled ->getRootObject())meMETPhiPhotonsEndcapPlus_BXm2BXm1Filled->Fill(atan2(py_PhotonsEndcapPlus,px_PhotonsEndcapPlus));
2702       }
2703       if(pt_sum_PhF_Endcap_minus){
2704         meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Filled"];if(meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled  && meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled ->getRootObject())meMETPhiPhotonsEndcapMinus_BXm2BXm1Filled->Fill(atan2(py_PhotonsEndcapMinus,px_PhotonsEndcapMinus));
2705       }
2706       if(pt_sum_HFH_plus){
2707         meMETPhiHFHadronsPlus_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Filled"];if(meMETPhiHFHadronsPlus_BXm2BXm1Filled  && meMETPhiHFHadronsPlus_BXm2BXm1Filled ->getRootObject())meMETPhiHFHadronsPlus_BXm2BXm1Filled->Fill(atan2(py_HFHadronsPlus,px_HFHadronsPlus));
2708       }
2709       if(pt_sum_HFH_minus){
2710         meMETPhiHFHadronsMinus_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Filled"];if(meMETPhiHFHadronsMinus_BXm2BXm1Filled  && meMETPhiHFHadronsMinus_BXm2BXm1Filled ->getRootObject())meMETPhiHFHadronsMinus_BXm2BXm1Filled->Fill(atan2(py_HFHadronsMinus,px_HFHadronsMinus));
2711       }
2712       if(pt_sum_HFE_plus){
2713         meMETPhiHFEGammasPlus_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Filled"];if(meMETPhiHFEGammasPlus_BXm2BXm1Filled  && meMETPhiHFEGammasPlus_BXm2BXm1Filled ->getRootObject())meMETPhiHFEGammasPlus_BXm2BXm1Filled->Fill(atan2(py_HFEGammasPlus,px_HFEGammasPlus));
2714       }
2715       if(pt_sum_HFE_minus){
2716         meMETPhiHFEGammasMinus_BXm2BXm1Filled     = map_of_MEs[DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Filled"];if(meMETPhiHFEGammasMinus_BXm2BXm1Filled  && meMETPhiHFEGammasMinus_BXm2BXm1Filled ->getRootObject())meMETPhiHFEGammasMinus_BXm2BXm1Filled->Fill(atan2(py_HFEGammasMinus,px_HFEGammasMinus));
2717       }
2718       }*/
2719         if (techTriggerCase[1]) {  //techTriggerResultBx0 && techTriggerResultBxM1 -> previous bunch filled
2720           meCHF_Barrel_BXm1Filled = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionBarrel_BXm1Filled"];
2721           if (meCHF_Barrel_BXm1Filled && meCHF_Barrel_BXm1Filled->getRootObject())
2722             meCHF_Barrel_BXm1Filled->Fill(pt_sum_CHF_Barrel / pfmet->sumEt());
2723           meCHF_EndcapPlus_BXm1Filled = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapPlus_BXm1Filled"];
2724           if (meCHF_EndcapPlus_BXm1Filled && meCHF_EndcapPlus_BXm1Filled->getRootObject())
2725             meCHF_EndcapPlus_BXm1Filled->Fill(pt_sum_CHF_Endcap_plus / pfmet->sumEt());
2726           meCHF_EndcapMinus_BXm1Filled = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapMinus_BXm1Filled"];
2727           if (meCHF_EndcapMinus_BXm1Filled && meCHF_EndcapMinus_BXm1Filled->getRootObject())
2728             meCHF_EndcapMinus_BXm1Filled->Fill(pt_sum_CHF_Endcap_minus / pfmet->sumEt());
2729           meNHF_Barrel_BXm1Filled = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionBarrel_BXm1Filled"];
2730           if (meNHF_Barrel_BXm1Filled && meNHF_Barrel_BXm1Filled->getRootObject())
2731             meNHF_Barrel_BXm1Filled->Fill(pt_sum_NHF_Barrel / pfmet->sumEt());
2732           meNHF_EndcapPlus_BXm1Filled = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus_BXm1Filled"];
2733           if (meNHF_EndcapPlus_BXm1Filled && meNHF_EndcapPlus_BXm1Filled->getRootObject())
2734             meNHF_EndcapPlus_BXm1Filled->Fill(pt_sum_NHF_Endcap_plus / pfmet->sumEt());
2735           meNHF_EndcapMinus_BXm1Filled = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus_BXm1Filled"];
2736           if (meNHF_EndcapMinus_BXm1Filled && meNHF_EndcapMinus_BXm1Filled->getRootObject())
2737             meNHF_EndcapMinus_BXm1Filled->Fill(pt_sum_NHF_Endcap_minus / pfmet->sumEt());
2738           mePhF_Barrel_BXm1Filled = map_of_MEs[DirName + "/" + "PfPhotonEtFractionBarrel_BXm1Filled"];
2739           if (mePhF_Barrel_BXm1Filled && mePhF_Barrel_BXm1Filled->getRootObject())
2740             mePhF_Barrel_BXm1Filled->Fill(pt_sum_PhF_Barrel / pfmet->sumEt());
2741           mePhF_EndcapPlus_BXm1Filled = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapPlus_BXm1Filled"];
2742           if (mePhF_EndcapPlus_BXm1Filled && mePhF_EndcapPlus_BXm1Filled->getRootObject())
2743             mePhF_EndcapPlus_BXm1Filled->Fill(pt_sum_PhF_Endcap_plus / pfmet->sumEt());
2744           mePhF_EndcapMinus_BXm1Filled = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapMinus_BXm1Filled"];
2745           if (mePhF_EndcapMinus_BXm1Filled && mePhF_EndcapMinus_BXm1Filled->getRootObject())
2746             mePhF_EndcapMinus_BXm1Filled->Fill(pt_sum_PhF_Endcap_minus / pfmet->sumEt());
2747           meHFHadF_Plus_BXm1Filled = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionPlus_BXm1Filled"];
2748           if (meHFHadF_Plus_BXm1Filled && meHFHadF_Plus_BXm1Filled->getRootObject())
2749             meHFHadF_Plus_BXm1Filled->Fill(pt_sum_HFH_plus / pfmet->sumEt());
2750           meHFHadF_Minus_BXm1Filled = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionMinus_BXm1Filled"];
2751           if (meHFHadF_Minus_BXm1Filled && meHFHadF_Minus_BXm1Filled->getRootObject())
2752             meHFHadF_Minus_BXm1Filled->Fill(pt_sum_HFH_minus / pfmet->sumEt());
2753           meHFEMF_Plus_BXm1Filled = map_of_MEs[DirName + "/" + "PfHFEMEtFractionPlus_BXm1Filled"];
2754           if (meHFEMF_Plus_BXm1Filled && meHFEMF_Plus_BXm1Filled->getRootObject())
2755             meHFEMF_Plus_BXm1Filled->Fill(pt_sum_HFE_plus / pfmet->sumEt());
2756           meHFEMF_Minus_BXm1Filled = map_of_MEs[DirName + "/" + "PfHFEMEtFractionMinus_BXm1Filled"];
2757           if (meHFEMF_Minus_BXm1Filled && meHFEMF_Minus_BXm1Filled->getRootObject())
2758             meHFEMF_Minus_BXm1Filled->Fill(pt_sum_HFE_minus / pfmet->sumEt());
2759           mePhotonEtFraction_BXm1Filled = map_of_MEs[DirName + "/" + "PfPhotonEtFraction_BXm1Filled"];
2760           if (mePhotonEtFraction_BXm1Filled && mePhotonEtFraction_BXm1Filled->getRootObject())
2761             mePhotonEtFraction_BXm1Filled->Fill(pfmet->photonEtFraction());
2762           meNeutralHadronEtFraction_BXm1Filled = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFraction_BXm1Filled"];
2763           if (meNeutralHadronEtFraction_BXm1Filled && meNeutralHadronEtFraction_BXm1Filled->getRootObject())
2764             meNeutralHadronEtFraction_BXm1Filled->Fill(pfmet->neutralHadronEtFraction());
2765           meChargedHadronEtFraction_BXm1Filled = map_of_MEs[DirName + "/" + "PfChargedHadronEtFraction_BXm1Filled"];
2766           if (meChargedHadronEtFraction_BXm1Filled && meChargedHadronEtFraction_BXm1Filled->getRootObject())
2767             meChargedHadronEtFraction_BXm1Filled->Fill(pfmet->chargedHadronEtFraction());
2768           meMET_BXm1Filled = map_of_MEs[DirName + "/" + "MET_BXm1Filled"];
2769           if (meMET_BXm1Filled && meMET_BXm1Filled->getRootObject())
2770             meMET_BXm1Filled->Fill(pfmet->pt());
2771           meSumET_BXm1Filled = map_of_MEs[DirName + "/" + "SumET_BXm1Filled"];
2772           if (meSumET_BXm1Filled && meSumET_BXm1Filled->getRootObject())
2773             meSumET_BXm1Filled->Fill(pfmet->sumEt());
2774           if (pt_sum_CHF_Barrel) {
2775             meMETPhiChargedHadronsBarrel_BXm1Filled =
2776                 map_of_MEs[DirName + "/" + "METPhiChargedHadronsBarrel_BXm1Filled"];
2777             if (meMETPhiChargedHadronsBarrel_BXm1Filled && meMETPhiChargedHadronsBarrel_BXm1Filled->getRootObject())
2778               meMETPhiChargedHadronsBarrel_BXm1Filled->Fill(atan2(py_chargedHadronsBarrel, px_chargedHadronsBarrel));
2779           }
2780           if (pt_sum_CHF_Endcap_plus) {
2781             meMETPhiChargedHadronsEndcapPlus_BXm1Filled =
2782                 map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapPlus_BXm1Filled"];
2783             if (meMETPhiChargedHadronsEndcapPlus_BXm1Filled &&
2784                 meMETPhiChargedHadronsEndcapPlus_BXm1Filled->getRootObject())
2785               meMETPhiChargedHadronsEndcapPlus_BXm1Filled->Fill(
2786                   atan2(py_chargedHadronsEndcapPlus, px_chargedHadronsEndcapPlus));
2787           }
2788           if (pt_sum_CHF_Endcap_minus) {
2789             meMETPhiChargedHadronsEndcapMinus_BXm1Filled =
2790                 map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapMinus_BXm1Filled"];
2791             if (meMETPhiChargedHadronsEndcapMinus_BXm1Filled &&
2792                 meMETPhiChargedHadronsEndcapMinus_BXm1Filled->getRootObject())
2793               meMETPhiChargedHadronsEndcapMinus_BXm1Filled->Fill(
2794                   atan2(py_chargedHadronsEndcapMinus, px_chargedHadronsEndcapMinus));
2795           }
2796           if (pt_sum_NHF_Barrel) {
2797             meMETPhiNeutralHadronsBarrel_BXm1Filled =
2798                 map_of_MEs[DirName + "/" + "METPhiNeutralHadronsBarrel_BXm1Filled"];
2799             if (meMETPhiNeutralHadronsBarrel_BXm1Filled && meMETPhiNeutralHadronsBarrel_BXm1Filled->getRootObject())
2800               meMETPhiNeutralHadronsBarrel_BXm1Filled->Fill(atan2(py_neutralHadronsBarrel, px_neutralHadronsBarrel));
2801           }
2802           if (pt_sum_NHF_Endcap_plus) {
2803             meMETPhiNeutralHadronsEndcapPlus_BXm1Filled =
2804                 map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapPlus_BXm1Filled"];
2805             if (meMETPhiNeutralHadronsEndcapPlus_BXm1Filled &&
2806                 meMETPhiNeutralHadronsEndcapPlus_BXm1Filled->getRootObject())
2807               meMETPhiNeutralHadronsEndcapPlus_BXm1Filled->Fill(
2808                   atan2(py_neutralHadronsEndcapPlus, px_neutralHadronsEndcapPlus));
2809           }
2810           if (pt_sum_NHF_Endcap_minus) {
2811             meMETPhiNeutralHadronsEndcapMinus_BXm1Filled =
2812                 map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapMinus_BXm1Filled"];
2813             if (meMETPhiNeutralHadronsEndcapMinus_BXm1Filled &&
2814                 meMETPhiNeutralHadronsEndcapMinus_BXm1Filled->getRootObject())
2815               meMETPhiNeutralHadronsEndcapMinus_BXm1Filled->Fill(
2816                   atan2(py_neutralHadronsEndcapMinus, px_neutralHadronsEndcapMinus));
2817           }
2818           if (pt_sum_PhF_Barrel) {
2819             meMETPhiPhotonsBarrel_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiPhotonsBarrel_BXm1Filled"];
2820             if (meMETPhiPhotonsBarrel_BXm1Filled && meMETPhiPhotonsBarrel_BXm1Filled->getRootObject())
2821               meMETPhiPhotonsBarrel_BXm1Filled->Fill(atan2(py_PhotonsBarrel, px_PhotonsBarrel));
2822           }
2823           if (pt_sum_PhF_Endcap_plus) {
2824             meMETPhiPhotonsEndcapPlus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapPlus_BXm1Filled"];
2825             if (meMETPhiPhotonsEndcapPlus_BXm1Filled && meMETPhiPhotonsEndcapPlus_BXm1Filled->getRootObject())
2826               meMETPhiPhotonsEndcapPlus_BXm1Filled->Fill(atan2(py_PhotonsEndcapPlus, px_PhotonsEndcapPlus));
2827           }
2828           if (pt_sum_PhF_Endcap_minus) {
2829             meMETPhiPhotonsEndcapMinus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapMinus_BXm1Filled"];
2830             if (meMETPhiPhotonsEndcapMinus_BXm1Filled && meMETPhiPhotonsEndcapMinus_BXm1Filled->getRootObject())
2831               meMETPhiPhotonsEndcapMinus_BXm1Filled->Fill(atan2(py_PhotonsEndcapMinus, px_PhotonsEndcapMinus));
2832           }
2833           if (pt_sum_HFH_plus) {
2834             meMETPhiHFHadronsPlus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiHFHadronsPlus_BXm1Filled"];
2835             if (meMETPhiHFHadronsPlus_BXm1Filled && meMETPhiHFHadronsPlus_BXm1Filled->getRootObject())
2836               meMETPhiHFHadronsPlus_BXm1Filled->Fill(atan2(py_HFHadronsPlus, px_HFHadronsPlus));
2837           }
2838           if (pt_sum_HFH_minus) {
2839             meMETPhiHFHadronsMinus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiHFHadronsMinus_BXm1Filled"];
2840             if (meMETPhiHFHadronsMinus_BXm1Filled && meMETPhiHFHadronsMinus_BXm1Filled->getRootObject())
2841               meMETPhiHFHadronsMinus_BXm1Filled->Fill(atan2(py_HFHadronsMinus, px_HFHadronsMinus));
2842           }
2843           if (pt_sum_HFE_plus) {
2844             meMETPhiHFEGammasPlus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiHFEGammasPlus_BXm1Filled"];
2845             if (meMETPhiHFEGammasPlus_BXm1Filled && meMETPhiHFEGammasPlus_BXm1Filled->getRootObject())
2846               meMETPhiHFEGammasPlus_BXm1Filled->Fill(atan2(py_HFEGammasPlus, px_HFEGammasPlus));
2847           }
2848           if (pt_sum_HFE_minus) {
2849             meMETPhiHFEGammasMinus_BXm1Filled = map_of_MEs[DirName + "/" + "METPhiHFEGammasMinus_BXm1Filled"];
2850             if (meMETPhiHFEGammasMinus_BXm1Filled && meMETPhiHFEGammasMinus_BXm1Filled->getRootObject())
2851               meMETPhiHFEGammasMinus_BXm1Filled->Fill(atan2(py_HFEGammasMinus, px_HFEGammasMinus));
2852           }
2853         }
2854         /*if(techTriggerCase[3]){//techTriggerResultBx0 && !techTriggerResultBxM2 && !techTriggerResultBxM1 ->previous two bunches empty
2855       meCHF_Barrel_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionBarrel_BXm2BXm1Empty"]; if(meCHF_Barrel_BXm2BXm1Empty && meCHF_Barrel_BXm2BXm1Empty->getRootObject()) meCHF_Barrel_BXm2BXm1Empty->Fill(pt_sum_CHF_Barrel/pfmet->sumEt()); 
2856       meCHF_EndcapPlus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapPlus_BXm2BXm1Empty"]; if(meCHF_EndcapPlus_BXm2BXm1Empty && meCHF_EndcapPlus_BXm2BXm1Empty->getRootObject()) meCHF_EndcapPlus_BXm2BXm1Empty->Fill(pt_sum_CHF_Endcap_plus/pfmet->sumEt()); 
2857       meCHF_EndcapMinus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfChargedHadronEtFractionEndcapMinus_BXm2BXm1Empty"]; if(meCHF_EndcapMinus_BXm2BXm1Empty && meCHF_EndcapMinus_BXm2BXm1Empty->getRootObject()) meCHF_EndcapMinus_BXm2BXm1Empty->Fill(pt_sum_CHF_Endcap_minus/pfmet->sumEt()); 
2858       meNHF_Barrel_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionBarrel_BXm2BXm1Empty"]; if(meNHF_Barrel_BXm2BXm1Empty && meNHF_Barrel_BXm2BXm1Empty->getRootObject()) meNHF_Barrel_BXm2BXm1Empty->Fill(pt_sum_NHF_Barrel/pfmet->sumEt()); 
2859       meNHF_EndcapPlus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapPlus_BXm2BXm1Empty"]; if(meNHF_EndcapPlus_BXm2BXm1Empty && meNHF_EndcapPlus_BXm2BXm1Empty->getRootObject()) meNHF_EndcapPlus_BXm2BXm1Empty->Fill(pt_sum_NHF_Endcap_plus/pfmet->sumEt()); 
2860       meNHF_EndcapMinus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfNeutralHadronEtFractionEndcapMinus_BXm2BXm1Empty"]; if(meNHF_EndcapMinus_BXm2BXm1Empty && meNHF_EndcapMinus_BXm2BXm1Empty->getRootObject()) meNHF_EndcapMinus_BXm2BXm1Empty->Fill(pt_sum_NHF_Endcap_minus/pfmet->sumEt()); 
2861       mePhF_Barrel_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfPhotonEtFractionBarrel_BXm2BXm1Empty"]; if(mePhF_Barrel_BXm2BXm1Empty && mePhF_Barrel_BXm2BXm1Empty->getRootObject()) mePhF_Barrel_BXm2BXm1Empty->Fill(pt_sum_PhF_Barrel/pfmet->sumEt()); 
2862       mePhF_EndcapPlus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapPlus_BXm2BXm1Empty"]; if(mePhF_EndcapPlus_BXm2BXm1Empty && mePhF_EndcapPlus_BXm2BXm1Empty->getRootObject()) mePhF_EndcapPlus_BXm2BXm1Empty->Fill(pt_sum_PhF_Endcap_plus/pfmet->sumEt()); 
2863       mePhF_EndcapMinus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfPhotonEtFractionEndcapMinus_BXm2BXm1Empty"]; if(mePhF_EndcapMinus_BXm2BXm1Empty && mePhF_EndcapMinus_BXm2BXm1Empty->getRootObject()) mePhF_EndcapMinus_BXm2BXm1Empty->Fill(pt_sum_PhF_Endcap_minus/pfmet->sumEt()); 
2864       meHFHadF_Plus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionPlus_BXm2BXm1Empty"]; if(meHFHadF_Plus_BXm2BXm1Empty && meHFHadF_Plus_BXm2BXm1Empty->getRootObject()) meHFHadF_Plus_BXm2BXm1Empty->Fill(pt_sum_HFH_plus/pfmet->sumEt()); 
2865       meHFHadF_Minus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfHFHadronEtFractionMinus_BXm2BXm1Empty"]; if(meHFHadF_Minus_BXm2BXm1Empty && meHFHadF_Minus_BXm2BXm1Empty->getRootObject()) meHFHadF_Minus_BXm2BXm1Empty->Fill(pt_sum_HFH_minus/pfmet->sumEt()); 
2866       meHFEMF_Plus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfHFEMEtFractionPlus_BXm2BXm1Empty"]; if(meHFEMF_Plus_BXm2BXm1Empty && meHFEMF_Plus_BXm2BXm1Empty->getRootObject()) meHFEMF_Plus_BXm2BXm1Empty->Fill(pt_sum_HFE_plus/pfmet->sumEt()); 
2867       meHFEMF_Minus_BXm2BXm1Empty=map_of_MEs[DirName+"/"+"PfHFEMEtFractionMinus_BXm2BXm1Empty"]; if(meHFEMF_Minus_BXm2BXm1Empty && meHFEMF_Minus_BXm2BXm1Empty->getRootObject()) meHFEMF_Minus_BXm2BXm1Empty->Fill(pt_sum_HFE_minus/pfmet->sumEt());
2868       mePhotonEtFraction_BXm2BXm1Empty    = map_of_MEs[DirName+"/"+"PfPhotonEtFraction_BXm2BXm1Empty"];     if (  mePhotonEtFraction_BXm2BXm1Empty  && mePhotonEtFraction_BXm2BXm1Empty ->getRootObject())  mePhotonEtFraction_BXm2BXm1Empty  ->Fill(pfmet->photonEtFraction());
2869       meNeutralHadronEtFraction_BXm2BXm1Empty    = map_of_MEs[DirName+"/"+"PfNeutralHadronEtFraction_BXm2BXm1Empty"];     if (  meNeutralHadronEtFraction_BXm2BXm1Empty  && meNeutralHadronEtFraction_BXm2BXm1Empty ->getRootObject())  meNeutralHadronEtFraction_BXm2BXm1Empty  ->Fill(pfmet->neutralHadronEtFraction());
2870       meChargedHadronEtFraction_BXm2BXm1Empty    = map_of_MEs[DirName+"/"+"PfChargedHadronEtFraction_BXm2BXm1Empty"];     if (  meChargedHadronEtFraction_BXm2BXm1Empty  && meChargedHadronEtFraction_BXm2BXm1Empty ->getRootObject())  meChargedHadronEtFraction_BXm2BXm1Empty  ->Fill(pfmet->chargedHadronEtFraction());
2871       meMET_BXm2BXm1Empty    = map_of_MEs[DirName+"/"+"MET_BXm2BXm1Empty"];     if (  meMET_BXm2BXm1Empty  && meMET_BXm2BXm1Empty ->getRootObject())  meMET_BXm2BXm1Empty  ->Fill(pfmet->pt());
2872       meSumET_BXm2BXm1Empty    = map_of_MEs[DirName+"/"+"SumET_BXm2BXm1Empty"];     if (  meSumET_BXm2BXm1Empty  && meSumET_BXm2BXm1Empty ->getRootObject())  meSumET_BXm2BXm1Empty  ->Fill(pfmet->sumEt());
2873       if(pt_sum_CHF_Barrel){
2874         meMETPhiChargedHadronsBarrel_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiChargedHadronsBarrel_BXm2BXm1Empty"];if(meMETPhiChargedHadronsBarrel_BXm2BXm1Empty  && meMETPhiChargedHadronsBarrel_BXm2BXm1Empty ->getRootObject())meMETPhiChargedHadronsBarrel_BXm2BXm1Empty->Fill(atan2(py_chargedHadronsBarrel,px_chargedHadronsBarrel));
2875       }
2876       if(pt_sum_CHF_Endcap_plus){
2877         meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty  = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapPlus_BXm2BXm1Empty"];if(meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty  && meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty ->getRootObject())meMETPhiChargedHadronsEndcapPlus_BXm2BXm1Empty->Fill(atan2(py_chargedHadronsEndcapPlus,px_chargedHadronsEndcapPlus));
2878       }
2879       if(pt_sum_CHF_Endcap_minus){
2880         meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiChargedHadronsEndcapMinus_BXm2BXm1Empty"];if(meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty  && meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty ->getRootObject())meMETPhiChargedHadronsEndcapMinus_BXm2BXm1Empty->Fill(atan2(py_chargedHadronsEndcapMinus,px_chargedHadronsEndcapMinus));
2881       }
2882       if(pt_sum_NHF_Barrel){
2883         meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsBarrel_BXm2BXm1Empty"];if(meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty  && meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty ->getRootObject())meMETPhiNeutralHadronsBarrel_BXm2BXm1Empty->Fill(atan2(py_neutralHadronsBarrel,px_neutralHadronsBarrel));
2884       }
2885       if(pt_sum_NHF_Endcap_plus){
2886         meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty"];if(meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty  && meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty ->getRootObject())meMETPhiNeutralHadronsEndcapPlus_BXm2BXm1Empty->Fill(atan2(py_neutralHadronsEndcapPlus,px_neutralHadronsEndcapPlus));
2887       }
2888       if(pt_sum_NHF_Endcap_minus){
2889         meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty"];if(meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty  && meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty ->getRootObject())meMETPhiNeutralHadronsEndcapMinus_BXm2BXm1Empty->Fill(atan2(py_neutralHadronsEndcapMinus,px_neutralHadronsEndcapMinus));
2890       }
2891       if(pt_sum_PhF_Barrel){
2892         meMETPhiPhotonsBarrel_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiPhotonsBarrel_BXm2BXm1Empty"];if(meMETPhiPhotonsBarrel_BXm2BXm1Empty  && meMETPhiPhotonsBarrel_BXm2BXm1Empty ->getRootObject())meMETPhiPhotonsBarrel_BXm2BXm1Empty->Fill(atan2(py_PhotonsBarrel,px_PhotonsBarrel));
2893       }
2894       if(pt_sum_PhF_Endcap_plus){
2895         meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapPlus_BXm2BXm1Empty"];if(meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty  && meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty ->getRootObject())meMETPhiPhotonsEndcapPlus_BXm2BXm1Empty->Fill(atan2(py_PhotonsEndcapPlus,px_PhotonsEndcapPlus));
2896       }
2897       if(pt_sum_PhF_Endcap_minus){
2898         meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiPhotonsEndcapMinus_BXm2BXm1Empty"];if(meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty  && meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty ->getRootObject())meMETPhiPhotonsEndcapMinus_BXm2BXm1Empty->Fill(atan2(py_PhotonsEndcapMinus,px_PhotonsEndcapMinus));
2899       }
2900       if(pt_sum_HFH_plus){
2901         meMETPhiHFHadronsPlus_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiHFHadronsPlus_BXm2BXm1Empty"];if(meMETPhiHFHadronsPlus_BXm2BXm1Empty  && meMETPhiHFHadronsPlus_BXm2BXm1Empty ->getRootObject())meMETPhiHFHadronsPlus_BXm2BXm1Empty->Fill(atan2(py_HFHadronsPlus,px_HFHadronsPlus));
2902       }
2903       if(pt_sum_HFH_minus){
2904         meMETPhiHFHadronsMinus_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiHFHadronsMinus_BXm2BXm1Empty"];if(meMETPhiHFHadronsMinus_BXm2BXm1Empty  && meMETPhiHFHadronsMinus_BXm2BXm1Empty ->getRootObject())meMETPhiHFHadronsMinus_BXm2BXm1Empty->Fill(atan2(py_HFHadronsMinus,px_HFHadronsMinus));
2905       }
2906       if(pt_sum_HFE_plus){
2907         meMETPhiHFEGammasPlus_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiHFEGammasPlus_BXm2BXm1Empty"];if(meMETPhiHFEGammasPlus_BXm2BXm1Empty  && meMETPhiHFEGammasPlus_BXm2BXm1Empty ->getRootObject())meMETPhiHFEGammasPlus_BXm2BXm1Empty->Fill(atan2(py_HFEGammasPlus,px_HFEGammasPlus));
2908       }
2909       if(pt_sum_HFE_minus){
2910         meMETPhiHFEGammasMinus_BXm2BXm1Empty     = map_of_MEs[DirName+"/"+"METPhiHFEGammasMinus_BXm2BXm1Empty"];if(meMETPhiHFEGammasMinus_BXm2BXm1Empty  && meMETPhiHFEGammasMinus_BXm2BXm1Empty ->getRootObject())meMETPhiHFEGammasMinus_BXm2BXm1Empty->Fill(atan2(py_HFEGammasMinus,px_HFEGammasMinus));
2911       }
2912       }*/
2913         if (techTriggerCase[2]) {  //techTriggerResultBx0 && !techTriggerResultBxM1 --> previous bunch empty
2914           meCHF_Barrel_BXm1Empty = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionBarrel_BXm1Empty"];
2915           if (meCHF_Barrel_BXm1Empty && meCHF_Barrel_BXm1Empty->getRootObject())
2916             meCHF_Barrel_BXm1Empty->Fill(pt_sum_CHF_Barrel / pfmet->sumEt());
2917           meCHF_EndcapPlus_BXm1Empty = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapPlus_BXm1Empty"];
2918           if (meCHF_EndcapPlus_BXm1Empty && meCHF_EndcapPlus_BXm1Empty->getRootObject())
2919             meCHF_EndcapPlus_BXm1Empty->Fill(pt_sum_CHF_Endcap_plus / pfmet->sumEt());
2920           meCHF_EndcapMinus_BXm1Empty = map_of_MEs[DirName + "/" + "PfChargedHadronEtFractionEndcapMinus_BXm1Empty"];
2921           if (meCHF_EndcapMinus_BXm1Empty && meCHF_EndcapMinus_BXm1Empty->getRootObject())
2922             meCHF_EndcapMinus_BXm1Empty->Fill(pt_sum_CHF_Endcap_minus / pfmet->sumEt());
2923           meNHF_Barrel_BXm1Empty = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionBarrel_BXm1Empty"];
2924           if (meNHF_Barrel_BXm1Empty && meNHF_Barrel_BXm1Empty->getRootObject())
2925             meNHF_Barrel_BXm1Empty->Fill(pt_sum_NHF_Barrel / pfmet->sumEt());
2926           meNHF_EndcapPlus_BXm1Empty = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapPlus_BXm1Empty"];
2927           if (meNHF_EndcapPlus_BXm1Empty && meNHF_EndcapPlus_BXm1Empty->getRootObject())
2928             meNHF_EndcapPlus_BXm1Empty->Fill(pt_sum_NHF_Endcap_plus / pfmet->sumEt());
2929           meNHF_EndcapMinus_BXm1Empty = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFractionEndcapMinus_BXm1Empty"];
2930           if (meNHF_EndcapMinus_BXm1Empty && meNHF_EndcapMinus_BXm1Empty->getRootObject())
2931             meNHF_EndcapMinus_BXm1Empty->Fill(pt_sum_NHF_Endcap_minus / pfmet->sumEt());
2932           mePhF_Barrel_BXm1Empty = map_of_MEs[DirName + "/" + "PfPhotonEtFractionBarrel_BXm1Empty"];
2933           if (mePhF_Barrel_BXm1Empty && mePhF_Barrel_BXm1Empty->getRootObject())
2934             mePhF_Barrel_BXm1Empty->Fill(pt_sum_PhF_Barrel / pfmet->sumEt());
2935           mePhF_EndcapPlus_BXm1Empty = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapPlus_BXm1Empty"];
2936           if (mePhF_EndcapPlus_BXm1Empty && mePhF_EndcapPlus_BXm1Empty->getRootObject())
2937             mePhF_EndcapPlus_BXm1Empty->Fill(pt_sum_PhF_Endcap_plus / pfmet->sumEt());
2938           mePhF_EndcapMinus_BXm1Empty = map_of_MEs[DirName + "/" + "PfPhotonEtFractionEndcapMinus_BXm1Empty"];
2939           if (mePhF_EndcapMinus_BXm1Empty && mePhF_EndcapMinus_BXm1Empty->getRootObject())
2940             mePhF_EndcapMinus_BXm1Empty->Fill(pt_sum_PhF_Endcap_minus / pfmet->sumEt());
2941           meHFHadF_Plus_BXm1Empty = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionPlus_BXm1Empty"];
2942           if (meHFHadF_Plus_BXm1Empty && meHFHadF_Plus_BXm1Empty->getRootObject())
2943             meHFHadF_Plus_BXm1Empty->Fill(pt_sum_HFH_plus / pfmet->sumEt());
2944           meHFHadF_Minus_BXm1Empty = map_of_MEs[DirName + "/" + "PfHFHadronEtFractionMinus_BXm1Empty"];
2945           if (meHFHadF_Minus_BXm1Empty && meHFHadF_Minus_BXm1Empty->getRootObject())
2946             meHFHadF_Minus_BXm1Empty->Fill(pt_sum_HFH_minus / pfmet->sumEt());
2947           meHFEMF_Plus_BXm1Empty = map_of_MEs[DirName + "/" + "PfHFEMEtFractionPlus_BXm1Empty"];
2948           if (meHFEMF_Plus_BXm1Empty && meHFEMF_Plus_BXm1Empty->getRootObject())
2949             meHFEMF_Plus_BXm1Empty->Fill(pt_sum_HFE_plus / pfmet->sumEt());
2950           meHFEMF_Minus_BXm1Empty = map_of_MEs[DirName + "/" + "PfHFEMEtFractionMinus_BXm1Empty"];
2951           if (meHFEMF_Minus_BXm1Empty && meHFEMF_Minus_BXm1Empty->getRootObject())
2952             meHFEMF_Minus_BXm1Empty->Fill(pt_sum_HFE_minus / pfmet->sumEt());
2953           mePhotonEtFraction_BXm1Empty = map_of_MEs[DirName + "/" + "PfPhotonEtFraction_BXm1Empty"];
2954           if (mePhotonEtFraction_BXm1Empty && mePhotonEtFraction_BXm1Empty->getRootObject())
2955             mePhotonEtFraction_BXm1Empty->Fill(pfmet->photonEtFraction());
2956           meNeutralHadronEtFraction_BXm1Empty = map_of_MEs[DirName + "/" + "PfNeutralHadronEtFraction_BXm1Empty"];
2957           if (meNeutralHadronEtFraction_BXm1Empty && meNeutralHadronEtFraction_BXm1Empty->getRootObject())
2958             meNeutralHadronEtFraction_BXm1Empty->Fill(pfmet->neutralHadronEtFraction());
2959           meChargedHadronEtFraction_BXm1Empty = map_of_MEs[DirName + "/" + "PfChargedHadronEtFraction_BXm1Empty"];
2960           if (meChargedHadronEtFraction_BXm1Empty && meChargedHadronEtFraction_BXm1Empty->getRootObject())
2961             meChargedHadronEtFraction_BXm1Empty->Fill(pfmet->chargedHadronEtFraction());
2962           meMET_BXm1Empty = map_of_MEs[DirName + "/" + "MET_BXm1Empty"];
2963           if (meMET_BXm1Empty && meMET_BXm1Empty->getRootObject())
2964             meMET_BXm1Empty->Fill(pfmet->pt());
2965           meSumET_BXm1Empty = map_of_MEs[DirName + "/" + "SumET_BXm1Empty"];
2966           if (meSumET_BXm1Empty && meSumET_BXm1Empty->getRootObject())
2967             meSumET_BXm1Empty->Fill(pfmet->sumEt());
2968           if (pt_sum_CHF_Barrel) {
2969             meMETPhiChargedHadronsBarrel_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiChargedHadronsBarrel_BXm1Empty"];
2970             if (meMETPhiChargedHadronsBarrel_BXm1Empty && meMETPhiChargedHadronsBarrel_BXm1Empty->getRootObject())
2971               meMETPhiChargedHadronsBarrel_BXm1Empty->Fill(atan2(py_chargedHadronsBarrel, px_chargedHadronsBarrel));
2972           }
2973           if (pt_sum_CHF_Endcap_plus) {
2974             meMETPhiChargedHadronsEndcapPlus_BXm1Empty =
2975                 map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapPlus_BXm1Empty"];
2976             if (meMETPhiChargedHadronsEndcapPlus_BXm1Empty &&
2977                 meMETPhiChargedHadronsEndcapPlus_BXm1Empty->getRootObject())
2978               meMETPhiChargedHadronsEndcapPlus_BXm1Empty->Fill(
2979                   atan2(py_chargedHadronsEndcapPlus, px_chargedHadronsEndcapPlus));
2980           }
2981           if (pt_sum_CHF_Endcap_minus) {
2982             meMETPhiChargedHadronsEndcapMinus_BXm1Empty =
2983                 map_of_MEs[DirName + "/" + "METPhiChargedHadronsEndcapMinus_BXm1Empty"];
2984             if (meMETPhiChargedHadronsEndcapMinus_BXm1Empty &&
2985                 meMETPhiChargedHadronsEndcapMinus_BXm1Empty->getRootObject())
2986               meMETPhiChargedHadronsEndcapMinus_BXm1Empty->Fill(
2987                   atan2(py_chargedHadronsEndcapMinus, px_chargedHadronsEndcapMinus));
2988           }
2989           if (pt_sum_NHF_Barrel) {
2990             meMETPhiNeutralHadronsBarrel_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiNeutralHadronsBarrel_BXm1Empty"];
2991             if (meMETPhiNeutralHadronsBarrel_BXm1Empty && meMETPhiNeutralHadronsBarrel_BXm1Empty->getRootObject())
2992               meMETPhiNeutralHadronsBarrel_BXm1Empty->Fill(atan2(py_neutralHadronsBarrel, px_neutralHadronsBarrel));
2993           }
2994           if (pt_sum_NHF_Endcap_plus) {
2995             meMETPhiNeutralHadronsEndcapPlus_BXm1Empty =
2996                 map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapPlus_BXm1Empty"];
2997             if (meMETPhiNeutralHadronsEndcapPlus_BXm1Empty &&
2998                 meMETPhiNeutralHadronsEndcapPlus_BXm1Empty->getRootObject())
2999               meMETPhiNeutralHadronsEndcapPlus_BXm1Empty->Fill(
3000                   atan2(py_neutralHadronsEndcapPlus, px_neutralHadronsEndcapPlus));
3001           }
3002           if (pt_sum_NHF_Endcap_minus) {
3003             meMETPhiNeutralHadronsEndcapMinus_BXm1Empty =
3004                 map_of_MEs[DirName + "/" + "METPhiNeutralHadronsEndcapMinus_BXm1Empty"];
3005             if (meMETPhiNeutralHadronsEndcapMinus_BXm1Empty &&
3006                 meMETPhiNeutralHadronsEndcapMinus_BXm1Empty->getRootObject())
3007               meMETPhiNeutralHadronsEndcapMinus_BXm1Empty->Fill(
3008                   atan2(py_neutralHadronsEndcapMinus, px_neutralHadronsEndcapMinus));
3009           }
3010           if (pt_sum_PhF_Barrel) {
3011             meMETPhiPhotonsBarrel_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiPhotonsBarrel_BXm1Empty"];
3012             if (meMETPhiPhotonsBarrel_BXm1Empty && meMETPhiPhotonsBarrel_BXm1Empty->getRootObject())
3013               meMETPhiPhotonsBarrel_BXm1Empty->Fill(atan2(py_PhotonsBarrel, px_PhotonsBarrel));
3014           }
3015           if (pt_sum_PhF_Endcap_plus) {
3016             meMETPhiPhotonsEndcapPlus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapPlus_BXm1Empty"];
3017             if (meMETPhiPhotonsEndcapPlus_BXm1Empty && meMETPhiPhotonsEndcapPlus_BXm1Empty->getRootObject())
3018               meMETPhiPhotonsEndcapPlus_BXm1Empty->Fill(atan2(py_PhotonsEndcapPlus, px_PhotonsEndcapPlus));
3019           }
3020           if (pt_sum_PhF_Endcap_minus) {
3021             meMETPhiPhotonsEndcapMinus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiPhotonsEndcapMinus_BXm1Empty"];
3022             if (meMETPhiPhotonsEndcapMinus_BXm1Empty && meMETPhiPhotonsEndcapMinus_BXm1Empty->getRootObject())
3023               meMETPhiPhotonsEndcapMinus_BXm1Empty->Fill(atan2(py_PhotonsEndcapMinus, px_PhotonsEndcapMinus));
3024           }
3025           if (pt_sum_HFH_plus) {
3026             meMETPhiHFHadronsPlus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiHFHadronsPlus_BXm1Empty"];
3027             if (meMETPhiHFHadronsPlus_BXm1Empty && meMETPhiHFHadronsPlus_BXm1Empty->getRootObject())
3028               meMETPhiHFHadronsPlus_BXm1Empty->Fill(atan2(py_HFHadronsPlus, px_HFHadronsPlus));
3029           }
3030           if (pt_sum_HFH_minus) {
3031             meMETPhiHFHadronsMinus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiHFHadronsMinus_BXm1Empty"];
3032             if (meMETPhiHFHadronsMinus_BXm1Empty && meMETPhiHFHadronsMinus_BXm1Empty->getRootObject())
3033               meMETPhiHFHadronsMinus_BXm1Empty->Fill(atan2(py_HFHadronsMinus, px_HFHadronsMinus));
3034           }
3035           if (pt_sum_HFE_plus) {
3036             meMETPhiHFEGammasPlus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiHFEGammasPlus_BXm1Empty"];
3037             if (meMETPhiHFEGammasPlus_BXm1Empty && meMETPhiHFEGammasPlus_BXm1Empty->getRootObject())
3038               meMETPhiHFEGammasPlus_BXm1Empty->Fill(atan2(py_HFEGammasPlus, px_HFEGammasPlus));
3039           }
3040           if (pt_sum_HFE_minus) {
3041             meMETPhiHFEGammasMinus_BXm1Empty = map_of_MEs[DirName + "/" + "METPhiHFEGammasMinus_BXm1Empty"];
3042             if (meMETPhiHFEGammasMinus_BXm1Empty && meMETPhiHFEGammasMinus_BXm1Empty->getRootObject())
3043               meMETPhiHFEGammasMinus_BXm1Empty->Fill(atan2(py_HFEGammasMinus, px_HFEGammasMinus));
3044           }
3045         }
3046 
3047       }  //fill candidate plots only then
3048 
3049       // PFMET getters
3050       //----------------------------------------------------------------------------
3051       double pfPhotonEtFraction = pfmet->photonEtFraction();
3052       double pfPhotonEt = pfmet->photonEt();
3053       double pfNeutralHadronEtFraction = pfmet->neutralHadronEtFraction();
3054       double pfNeutralHadronEt = pfmet->neutralHadronEt();
3055       double pfElectronEt = pfmet->electronEt();
3056       double pfChargedHadronEtFraction = pfmet->chargedHadronEtFraction();
3057       double pfChargedHadronEt = pfmet->chargedHadronEt();
3058       double pfMuonEt = pfmet->muonEt();
3059       double pfHFHadronEtFraction = pfmet->HFHadronEtFraction();
3060       double pfHFHadronEt = pfmet->HFHadronEt();
3061       double pfHFEMEtFraction = pfmet->HFEMEtFraction();
3062       double pfHFEMEt = pfmet->HFEMEt();
3063       mePhotonEtFraction = map_of_MEs[DirName + "/PfPhotonEtFraction"];
3064       mePhotonEt = map_of_MEs[DirName + "/PfPhotonEt"];
3065       meNeutralHadronEtFraction = map_of_MEs[DirName + "/PfNeutralHadronEtFraction"];
3066       meNeutralHadronEt = map_of_MEs[DirName + "/PfNeutralHadronEt"];
3067       meElectronEt = map_of_MEs[DirName + "/PfElectronEt"];
3068       meChargedHadronEtFraction = map_of_MEs[DirName + "/PfChargedHadronEtFraction"];
3069       meChargedHadronEt = map_of_MEs[DirName + "/PfChargedHadronEt"];
3070       meMuonEt = map_of_MEs[DirName + "/PfMuonEt"];
3071       meHFHadronEtFraction = map_of_MEs[DirName + "/PfHFHadronEtFraction"];
3072       meHFHadronEt = map_of_MEs[DirName + "/PfHFHadronEt"];
3073       meHFEMEtFraction = map_of_MEs[DirName + "/PfHFEMEtFraction"];
3074       meHFEMEt = map_of_MEs[DirName + "/PfHFEMEt"];
3075 
3076       if (mePhotonEtFraction && mePhotonEtFraction->getRootObject())
3077         mePhotonEtFraction->Fill(pfPhotonEtFraction);
3078       if (mePhotonEt && mePhotonEt->getRootObject())
3079         mePhotonEt->Fill(pfPhotonEt);
3080       if (meNeutralHadronEtFraction && meNeutralHadronEtFraction->getRootObject())
3081         meNeutralHadronEtFraction->Fill(pfNeutralHadronEtFraction);
3082       if (meNeutralHadronEt && meNeutralHadronEt->getRootObject())
3083         meNeutralHadronEt->Fill(pfNeutralHadronEt);
3084       if (meElectronEt && meElectronEt->getRootObject())
3085         meElectronEt->Fill(pfElectronEt);
3086       if (meChargedHadronEtFraction && meChargedHadronEtFraction->getRootObject())
3087         meChargedHadronEtFraction->Fill(pfChargedHadronEtFraction);
3088       if (meChargedHadronEt && meChargedHadronEt->getRootObject())
3089         meChargedHadronEt->Fill(pfChargedHadronEt);
3090       if (meMuonEt && meMuonEt->getRootObject())
3091         meMuonEt->Fill(pfMuonEt);
3092       if (meHFHadronEtFraction && meHFHadronEtFraction->getRootObject())
3093         meHFHadronEtFraction->Fill(pfHFHadronEtFraction);
3094       if (meHFHadronEt && meHFHadronEt->getRootObject())
3095         meHFHadronEt->Fill(pfHFHadronEt);
3096       if (meHFEMEtFraction && meHFEMEtFraction->getRootObject())
3097         meHFEMEtFraction->Fill(pfHFEMEtFraction);
3098       if (meHFEMEt && meHFEMEt->getRootObject())
3099         meHFEMEt->Fill(pfHFEMEt);
3100 
3101       //NPV profiles
3102 
3103       mePhotonEtFraction_profile = map_of_MEs[DirName + "/PfPhotonEtFraction_profile"];
3104       mePhotonEt_profile = map_of_MEs[DirName + "/PfPhotonEt_profile"];
3105       meNeutralHadronEtFraction_profile = map_of_MEs[DirName + "/PfNeutralHadronEtFraction_profile"];
3106       meNeutralHadronEt_profile = map_of_MEs[DirName + "/PfNeutralHadronEt_profile"];
3107       meChargedHadronEtFraction_profile = map_of_MEs[DirName + "/PfChargedHadronEtFraction_profile"];
3108       meChargedHadronEt_profile = map_of_MEs[DirName + "/PfChargedHadronEt_profile"];
3109       meHFHadronEtFraction_profile = map_of_MEs[DirName + "/PfHFHadronEtFraction_profile"];
3110       meHFHadronEt_profile = map_of_MEs[DirName + "/PfHFHadronEt_profile"];
3111       meHFEMEtFraction_profile = map_of_MEs[DirName + "/PfHFEMEtFraction_profile"];
3112       meHFEMEt_profile = map_of_MEs[DirName + "/PfHFEMEt_profile"];
3113 
3114       if (mePhotonEtFraction_profile && mePhotonEtFraction_profile->getRootObject())
3115         mePhotonEtFraction_profile->Fill(numPV_, pfPhotonEtFraction);
3116       if (mePhotonEt_profile && mePhotonEt_profile->getRootObject())
3117         mePhotonEt_profile->Fill(numPV_, pfPhotonEt);
3118       if (meNeutralHadronEtFraction_profile && meNeutralHadronEtFraction_profile->getRootObject())
3119         meNeutralHadronEtFraction_profile->Fill(numPV_, pfNeutralHadronEtFraction);
3120       if (meNeutralHadronEt_profile && meNeutralHadronEt_profile->getRootObject())
3121         meNeutralHadronEt_profile->Fill(numPV_, pfNeutralHadronEt);
3122       if (meChargedHadronEtFraction_profile && meChargedHadronEtFraction_profile->getRootObject())
3123         meChargedHadronEtFraction_profile->Fill(numPV_, pfChargedHadronEtFraction);
3124       if (meChargedHadronEt_profile && meChargedHadronEt_profile->getRootObject())
3125         meChargedHadronEt_profile->Fill(numPV_, pfChargedHadronEt);
3126       if (meHFHadronEtFraction_profile && meHFHadronEtFraction_profile->getRootObject())
3127         meHFHadronEtFraction_profile->Fill(numPV_, pfHFHadronEtFraction);
3128       if (meHFHadronEt_profile && meHFHadronEt_profile->getRootObject())
3129         meHFHadronEt_profile->Fill(numPV_, pfHFHadronEt);
3130       if (meHFEMEtFraction_profile && meHFEMEtFraction_profile->getRootObject())
3131         meHFEMEtFraction_profile->Fill(numPV_, pfHFEMEtFraction);
3132       if (meHFEMEt_profile && meHFEMEt_profile->getRootObject())
3133         meHFEMEt_profile->Fill(numPV_, pfHFEMEt);
3134     }
3135 
3136     if (isMiniAODMet_) {
3137       mePhotonEtFraction = map_of_MEs[DirName + "/PfPhotonEtFraction"];
3138       meNeutralHadronEtFraction = map_of_MEs[DirName + "/PfNeutralHadronEtFraction"];
3139       meChargedHadronEtFraction = map_of_MEs[DirName + "/PfChargedHadronEtFraction"];
3140       meHFHadronEtFraction = map_of_MEs[DirName + "/PfHFHadronEtFraction"];
3141       meHFEMEtFraction = map_of_MEs[DirName + "/PfHFEMEtFraction"];
3142 
3143       if (mePhotonEtFraction && mePhotonEtFraction->getRootObject())
3144         mePhotonEtFraction->Fill(patmet->NeutralEMFraction());
3145       if (meNeutralHadronEtFraction && meNeutralHadronEtFraction->getRootObject())
3146         meNeutralHadronEtFraction->Fill(patmet->NeutralHadEtFraction());
3147       if (meChargedHadronEtFraction && meChargedHadronEtFraction->getRootObject())
3148         meChargedHadronEtFraction->Fill(patmet->ChargedHadEtFraction());
3149       if (meHFHadronEtFraction && meHFHadronEtFraction->getRootObject())
3150         meHFHadronEtFraction->Fill(patmet->Type6EtFraction());  //HFHadrons
3151       if (meHFEMEtFraction && meHFEMEtFraction->getRootObject())
3152         meHFEMEtFraction->Fill(patmet->Type7EtFraction());
3153 
3154       //NPV profiles
3155       mePhotonEtFraction_profile = map_of_MEs[DirName + "/PfPhotonEtFraction_profile"];
3156       meNeutralHadronEtFraction_profile = map_of_MEs[DirName + "/PfNeutralHadronEtFraction_profile"];
3157       meChargedHadronEtFraction_profile = map_of_MEs[DirName + "/PfChargedHadronEtFraction_profile"];
3158       meHFHadronEtFraction_profile = map_of_MEs[DirName + "/PfHFHadronEtFraction_profile"];
3159       meHFEMEtFraction_profile = map_of_MEs[DirName + "/PfHFEMEtFraction_profile"];
3160 
3161       if (mePhotonEtFraction_profile && mePhotonEtFraction_profile->getRootObject())
3162         mePhotonEtFraction_profile->Fill(numPV_, patmet->NeutralEMFraction());
3163       if (meNeutralHadronEtFraction_profile && meNeutralHadronEtFraction_profile->getRootObject())
3164         meNeutralHadronEtFraction_profile->Fill(numPV_, patmet->NeutralHadEtFraction());
3165       if (meChargedHadronEtFraction_profile && meChargedHadronEtFraction_profile->getRootObject())
3166         meChargedHadronEtFraction_profile->Fill(numPV_, patmet->ChargedHadEtFraction());
3167       if (meHFHadronEtFraction_profile && meHFHadronEtFraction_profile->getRootObject())
3168         meHFHadronEtFraction_profile->Fill(numPV_, patmet->Type6EtFraction());
3169       if (meHFEMEtFraction_profile && meHFEMEtFraction_profile->getRootObject())
3170         meHFEMEtFraction_profile->Fill(numPV_, patmet->Type7EtFraction());
3171 
3172       mePhotonEt = map_of_MEs[DirName + "/PfPhotonEt"];
3173       meNeutralHadronEt = map_of_MEs[DirName + "/PfNeutralHadronEt"];
3174       meChargedHadronEt = map_of_MEs[DirName + "/PfChargedHadronEt"];
3175       meHFHadronEt = map_of_MEs[DirName + "/PfHFHadronEt"];
3176       meHFEMEt = map_of_MEs[DirName + "/PfHFEMEt"];
3177       meMuonEt = map_of_MEs[DirName + "/PfMuonEt"];
3178       meElectronEt = map_of_MEs[DirName + "/PfElectronEt"];
3179 
3180       if (mePhotonEt && mePhotonEt->getRootObject())
3181         mePhotonEt->Fill(patmet->NeutralEMFraction() * patmet->sumEt());
3182       if (meNeutralHadronEt && meNeutralHadronEt->getRootObject())
3183         meNeutralHadronEt->Fill(patmet->NeutralHadEtFraction() * patmet->sumEt());
3184       if (meChargedHadronEt && meChargedHadronEt->getRootObject())
3185         meChargedHadronEt->Fill(patmet->ChargedHadEtFraction() * patmet->sumEt());
3186       if (meHFHadronEt && meHFHadronEt->getRootObject())
3187         meHFHadronEt->Fill(patmet->Type6EtFraction() * patmet->sumEt());  //HFHadrons
3188       if (meHFEMEt && meHFEMEt->getRootObject())
3189         meHFEMEt->Fill(patmet->Type7EtFraction() * patmet->sumEt());
3190       if (meMuonEt && meMuonEt->getRootObject())
3191         meMuonEt->Fill(patmet->MuonEtFraction() * patmet->sumEt());
3192       if (meElectronEt && meElectronEt->getRootObject())
3193         meElectronEt->Fill(patmet->ChargedEMEtFraction() * patmet->sumEt());
3194 
3195       //NPV profiles
3196       mePhotonEt_profile = map_of_MEs[DirName + "/PfPhotonEt_profile"];
3197       meNeutralHadronEt_profile = map_of_MEs[DirName + "/PfNeutralHadronEt_profile"];
3198       meChargedHadronEt_profile = map_of_MEs[DirName + "/PfChargedHadronEt_profile"];
3199       meHFHadronEt_profile = map_of_MEs[DirName + "/PfHFHadronEt_profile"];
3200       meHFEMEt_profile = map_of_MEs[DirName + "/PfHFEMEt_profile"];
3201 
3202       if (mePhotonEt_profile && mePhotonEt_profile->getRootObject())
3203         mePhotonEt_profile->Fill(numPV_, patmet->NeutralEMFraction() * patmet->sumEt());
3204       if (meNeutralHadronEt_profile && meNeutralHadronEt_profile->getRootObject())
3205         meNeutralHadronEt_profile->Fill(numPV_, patmet->NeutralHadEtFraction() * patmet->sumEt());
3206       if (meChargedHadronEt_profile && meChargedHadronEt_profile->getRootObject())
3207         meChargedHadronEt_profile->Fill(numPV_, patmet->ChargedHadEtFraction() * patmet->sumEt());
3208       if (meHFHadronEt_profile && meHFHadronEt_profile->getRootObject())
3209         meHFHadronEt_profile->Fill(numPV_, patmet->Type6EtFraction() * patmet->sumEt());
3210       if (meHFEMEt_profile && meHFEMEt_profile->getRootObject())
3211         meHFEMEt_profile->Fill(numPV_, patmet->Type7EtFraction() * patmet->sumEt());
3212     }
3213 
3214     if (isCaloMet_) {
3215       //if (bLumiSecPlot){//get from config level
3216       if (fill_met_high_level_histo) {
3217         hMExLS = map_of_MEs[DirName + "/" + "MExLS"];
3218         if (hMExLS && hMExLS->getRootObject())
3219           hMExLS->Fill(MEx, myLuminosityBlock);
3220         hMEyLS = map_of_MEs[DirName + "/" + "MEyLS"];
3221         if (hMEyLS && hMEyLS->getRootObject())
3222           hMEyLS->Fill(MEy, myLuminosityBlock);
3223       }
3224     }
3225   }  //check if we only wanna do Z plots
3226 }