Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:33:42

0001 // author: Mike Schmitt, University of Florida
0002 // first version 8/24/2006
0003 // modification: Bobby Scurlock
0004 // date:  03.11.2006
0005 // note:  added RMS(METx) vs SumET capability
0006 // modification: Rick Cavanaugh
0007 // date:  05.11.2006
0008 // note:  cleaned up constructor and beginJob, removed int conv. warning
0009 //        added configuration params
0010 // modification: Mike Schmitt
0011 // date:  02.28.2007
0012 // note:  code rewrite. Now uses STL map for monitoring element container.
0013 // modification: Bobby Scurlock
0014 // date:  04.03.2007
0015 // note:  Eliminated automated resolution fitting. This is now done in a ROOT
0016 // script.
0017 
0018 // date:  02.04.2009
0019 // note:  Added option to use fine binning or course binning for histos
0020 //
0021 // modification: Samantha Hewamanage, Florida International University
0022 // date: 01.30.2012
0023 // note: Added few hists for various nvtx ranges to study PU effects.
0024 //       Cleaned up the code by making it readable and const'ing the
0025 //       variables that should be changed.
0026 //       Changed the number of bins from odd to even. Odd number of bins
0027 //       makes it impossible to rebin a hist.
0028 #include "METTester.h"
0029 using namespace reco;
0030 using namespace std;
0031 using namespace edm;
0032 
0033 METTester::METTester(const edm::ParameterSet &iConfig) {
0034   inputMETLabel_ = iConfig.getParameter<edm::InputTag>("InputMETLabel");
0035   METType_ = iConfig.getUntrackedParameter<std::string>("METType");
0036 
0037   std::string inputMETCollectionLabel(inputMETLabel_.label());
0038 
0039   isCaloMET = (std::string("calo") == METType_);
0040   isPFMET = (std::string("pf") == METType_);
0041   isGenMET = (std::string("gen") == METType_);
0042   isMiniAODMET = (std::string("miniaod") == METType_);
0043 
0044   pvToken_ = consumes<std::vector<reco::Vertex>>(iConfig.getParameter<edm::InputTag>("PrimaryVertices"));
0045   if (isCaloMET)
0046     caloMETsToken_ = consumes<reco::CaloMETCollection>(inputMETLabel_);
0047   if (isPFMET)
0048     pfMETsToken_ = consumes<reco::PFMETCollection>(inputMETLabel_);
0049   if (isMiniAODMET)
0050     patMETToken_ = consumes<pat::METCollection>(inputMETLabel_);
0051   if (isGenMET)
0052     genMETsToken_ = consumes<reco::GenMETCollection>(inputMETLabel_);
0053   if (!isMiniAODMET) {
0054     genMETsTrueToken_ = consumes<reco::GenMETCollection>(edm::InputTag("genMetTrue"));
0055     genMETsCaloToken_ = consumes<reco::GenMETCollection>(edm::InputTag("genMetCalo"));
0056   }
0057 
0058   // Events variables
0059   mNvertex = nullptr;
0060 
0061   // Common variables
0062   mMEx = nullptr;
0063   mMEy = nullptr;
0064   mMETSig = nullptr;
0065   mMET = nullptr;
0066   mMETFine = nullptr;
0067   mMET_Nvtx = nullptr;
0068   mMETPhi = nullptr;
0069   mSumET = nullptr;
0070   mMETDifference_GenMETTrue = nullptr;
0071   mMETDeltaPhi_GenMETTrue = nullptr;
0072   mMETDifference_GenMETCalo = nullptr;
0073   mMETDeltaPhi_GenMETCalo = nullptr;
0074 
0075   // MET Uncertainities: Only for MiniAOD
0076   mMETUnc_JetResUp = nullptr;
0077   mMETUnc_JetResDown = nullptr;
0078   mMETUnc_JetEnUp = nullptr;
0079   mMETUnc_JetEnDown = nullptr;
0080   mMETUnc_MuonEnUp = nullptr;
0081   mMETUnc_MuonEnDown = nullptr;
0082   mMETUnc_ElectronEnUp = nullptr;
0083   mMETUnc_ElectronEnDown = nullptr;
0084   mMETUnc_TauEnUp = nullptr;
0085   mMETUnc_TauEnDown = nullptr;
0086   mMETUnc_UnclusteredEnUp = nullptr;
0087   mMETUnc_UnclusteredEnDown = nullptr;
0088   mMETUnc_PhotonEnUp = nullptr;
0089   mMETUnc_PhotonEnDown = nullptr;
0090 
0091   // CaloMET variables
0092   mCaloMaxEtInEmTowers = nullptr;
0093   mCaloMaxEtInHadTowers = nullptr;
0094   mCaloEtFractionHadronic = nullptr;
0095   mCaloEmEtFraction = nullptr;
0096   mCaloHadEtInHB = nullptr;
0097   mCaloHadEtInHO = nullptr;
0098   mCaloHadEtInHE = nullptr;
0099   mCaloHadEtInHF = nullptr;
0100   mCaloEmEtInHF = nullptr;
0101   mCaloSETInpHF = nullptr;
0102   mCaloSETInmHF = nullptr;
0103   mCaloEmEtInEE = nullptr;
0104   mCaloEmEtInEB = nullptr;
0105 
0106   // GenMET variables
0107   mNeutralEMEtFraction = nullptr;
0108   mNeutralHadEtFraction = nullptr;
0109   mChargedEMEtFraction = nullptr;
0110   mChargedHadEtFraction = nullptr;
0111   mMuonEtFraction = nullptr;
0112   mInvisibleEtFraction = nullptr;
0113 
0114   // MET variables
0115 
0116   // PFMET variables
0117   mMETDifference_GenMETTrue_MET0to20 = nullptr;
0118   mMETDifference_GenMETTrue_MET20to40 = nullptr;
0119   mMETDifference_GenMETTrue_MET40to60 = nullptr;
0120   mMETDifference_GenMETTrue_MET60to80 = nullptr;
0121   mMETDifference_GenMETTrue_MET80to100 = nullptr;
0122   mMETDifference_GenMETTrue_MET100to150 = nullptr;
0123   mMETDifference_GenMETTrue_MET150to200 = nullptr;
0124   mMETDifference_GenMETTrue_MET200to300 = nullptr;
0125   mMETDifference_GenMETTrue_MET300to400 = nullptr;
0126   mMETDifference_GenMETTrue_MET400to500 = nullptr;
0127   mMETDifference_GenMETTrue_MET500 = nullptr;
0128 }
0129 void METTester::bookHistograms(DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const & /* iSetup */) {
0130   ibooker.setCurrentFolder("JetMET/METValidation/" + inputMETLabel_.label());
0131 
0132   mNvertex = ibooker.book1D("Nvertex", "Nvertex", 80, 0, 80);
0133   mMEx = ibooker.book1D("MEx", "MEx", 160, -800, 800);
0134   mMEy = ibooker.book1D("MEy", "MEy", 160, -800, 800);
0135   mMETSig = ibooker.book1D("METSig", "METSig", 25, 0, 24.5);
0136   mMET = ibooker.book1D("MET", "MET (20 GeV binning)", 100, 0, 2000);
0137   mMETFine = ibooker.book1D("METFine", "MET (2 GeV binning)", 1000, 0, 2000);
0138   mMET_Nvtx = ibooker.bookProfile("MET_Nvtx", "MET vs. nvtx", 60, 0., 60., 0., 2000., " ");
0139   mMETPhi = ibooker.book1D("METPhi", "METPhi", 80, -4, 4);
0140   mSumET = ibooker.book1D("SumET", "SumET", 200, 0, 4000);  // 10GeV
0141   mMETDifference_GenMETTrue = ibooker.book1D("METDifference_GenMETTrue", "METDifference_GenMETTrue", 500, -500, 500);
0142   mMETDeltaPhi_GenMETTrue = ibooker.book1D("METDeltaPhi_GenMETTrue", "METDeltaPhi_GenMETTrue", 80, 0, 4);
0143 
0144   if (isMiniAODMET) {
0145     mMETUnc_JetResUp = ibooker.book1D("METUnc_JetResUp", "METUnc_JetResUp", 200, -10, 10);
0146     mMETUnc_JetResDown = ibooker.book1D("METUnc_JetResDown", "METUnc_JetResDown", 200, -10, 10);
0147     mMETUnc_JetEnUp = ibooker.book1D("METUnc_JetEnUp", "METUnc_JetEnUp", 200, -10, 10);
0148     mMETUnc_JetEnDown = ibooker.book1D("METUnc_JetEnDown", "METUnc_JetEnDown", 200, -10, 10);
0149     mMETUnc_MuonEnUp = ibooker.book1D("METUnc_MuonEnUp", "METUnc_MuonEnUp", 200, -10, 10);
0150     mMETUnc_MuonEnDown = ibooker.book1D("METUnc_MuonEnDown", "METUnc_MuonEnDown", 200, -10, 10);
0151     mMETUnc_ElectronEnUp = ibooker.book1D("METUnc_ElectronEnUp", "METUnc_ElectronEnUp", 200, -10, 10);
0152     mMETUnc_ElectronEnDown = ibooker.book1D("METUnc_ElectronEnDown", "METUnc_ElectronEnDown", 200, -10, 10);
0153     mMETUnc_TauEnUp = ibooker.book1D("METUnc_TauEnUp", "METUnc_TauEnUp", 200, -10, 10);
0154     mMETUnc_TauEnDown = ibooker.book1D("METUnc_TauEnDown", "METUnc_TauEnDown", 200, -10, 10);
0155     mMETUnc_UnclusteredEnUp = ibooker.book1D("METUnc_UnclusteredEnUp", "METUnc_UnclusteredEnUp", 200, -10, 10);
0156     mMETUnc_UnclusteredEnDown = ibooker.book1D("METUnc_UnclusteredEnDown", "METUnc_UnclusteredEnDown", 200, -10, 10);
0157     mMETUnc_PhotonEnUp = ibooker.book1D("METUnc_UnclusteredEnDown", "METUnc_UnclusteredEnDown", 200, -10, 10);
0158     mMETUnc_PhotonEnDown = ibooker.book1D("METUnc_PhotonEnDown", "METUnc_PhotonEnDown", 200, -10, 10);
0159   }
0160   if (!isMiniAODMET) {
0161     mMETDifference_GenMETCalo = ibooker.book1D("METDifference_GenMETCalo", "METDifference_GenMETCalo", 500, -500, 500);
0162     mMETDeltaPhi_GenMETCalo = ibooker.book1D("METDeltaPhi_GenMETCalo", "METDeltaPhi_GenMETCalo", 80, 0, 4);
0163   }
0164   if (!isGenMET) {
0165     mMETDifference_GenMETTrue_MET0to20 =
0166         ibooker.book1D("METResolution_GenMETTrue_MET0to20", "METResolution_GenMETTrue_MET0to20", 500, -500, 500);
0167     mMETDifference_GenMETTrue_MET20to40 =
0168         ibooker.book1D("METResolution_GenMETTrue_MET20to40", "METResolution_GenMETTrue_MET20to40", 500, -500, 500);
0169     mMETDifference_GenMETTrue_MET40to60 =
0170         ibooker.book1D("METResolution_GenMETTrue_MET40to60", "METResolution_GenMETTrue_MET40to60", 500, -500, 500);
0171     mMETDifference_GenMETTrue_MET60to80 =
0172         ibooker.book1D("METResolution_GenMETTrue_MET60to80", "METResolution_GenMETTrue_MET60to80", 500, -500, 500);
0173     mMETDifference_GenMETTrue_MET80to100 =
0174         ibooker.book1D("METResolution_GenMETTrue_MET80to100", "METResolution_GenMETTrue_MET80to100", 500, -500, 500);
0175     mMETDifference_GenMETTrue_MET100to150 =
0176         ibooker.book1D("METResolution_GenMETTrue_MET100to150", "METResolution_GenMETTrue_MET100to150", 500, -500, 500);
0177     mMETDifference_GenMETTrue_MET150to200 =
0178         ibooker.book1D("METResolution_GenMETTrue_MET150to200", "METResolution_GenMETTrue_MET150to200", 500, -500, 500);
0179     mMETDifference_GenMETTrue_MET200to300 =
0180         ibooker.book1D("METResolution_GenMETTrue_MET200to300", "METResolution_GenMETTrue_MET200to300", 500, -500, 500);
0181     mMETDifference_GenMETTrue_MET300to400 =
0182         ibooker.book1D("METResolution_GenMETTrue_MET300to400", "METResolution_GenMETTrue_MET300to400", 500, -500, 500);
0183     mMETDifference_GenMETTrue_MET400to500 =
0184         ibooker.book1D("METResolution_GenMETTrue_MET400to500", "METResolution_GenMETTrue_MET400to500", 500, -500, 500);
0185     mMETDifference_GenMETTrue_MET500 =
0186         ibooker.book1D("METResolution_GenMETTrue_MET500", "METResolution_GenMETTrue_MET500", 500, -500, 500);
0187   }
0188   if (isCaloMET) {
0189     mCaloMaxEtInEmTowers = ibooker.book1D("CaloMaxEtInEmTowers", "CaloMaxEtInEmTowers", 300, 0, 1500);     // 5GeV
0190     mCaloMaxEtInHadTowers = ibooker.book1D("CaloMaxEtInHadTowers", "CaloMaxEtInHadTowers", 300, 0, 1500);  // 5GeV
0191     mCaloEtFractionHadronic = ibooker.book1D("CaloEtFractionHadronic", "CaloEtFractionHadronic", 100, 0, 1);
0192     mCaloEmEtFraction = ibooker.book1D("CaloEmEtFraction", "CaloEmEtFraction", 100, 0, 1);
0193     mCaloHadEtInHB = ibooker.book1D("CaloHadEtInHB", "CaloHadEtInHB", 200, 0, 2000);  // 5GeV
0194     mCaloHadEtInHE = ibooker.book1D("CaloHadEtInHE", "CaloHadEtInHE", 100, 0, 500);   // 5GeV
0195     mCaloHadEtInHO = ibooker.book1D("CaloHadEtInHO", "CaloHadEtInHO", 100, 0, 200);   // 5GeV
0196     mCaloHadEtInHF = ibooker.book1D("CaloHadEtInHF", "CaloHadEtInHF", 100, 0, 200);   // 5GeV
0197     mCaloSETInpHF = ibooker.book1D("CaloSETInpHF", "CaloSETInpHF", 100, 0, 500);
0198     mCaloSETInmHF = ibooker.book1D("CaloSETInmHF", "CaloSETInmHF", 100, 0, 500);
0199     mCaloEmEtInEE = ibooker.book1D("CaloEmEtInEE", "CaloEmEtInEE", 100, 0, 500);  // 5GeV
0200     mCaloEmEtInEB = ibooker.book1D("CaloEmEtInEB", "CaloEmEtInEB", 100, 0, 500);  // 5GeV
0201     mCaloEmEtInHF = ibooker.book1D("CaloEmEtInHF", "CaloEmEtInHF", 100, 0, 500);  // 5GeV
0202   }
0203 
0204   if (isGenMET) {
0205     mNeutralEMEtFraction = ibooker.book1D("GenNeutralEMEtFraction", "GenNeutralEMEtFraction", 120, 0.0, 1.2);
0206     mNeutralHadEtFraction = ibooker.book1D("GenNeutralHadEtFraction", "GenNeutralHadEtFraction", 120, 0.0, 1.2);
0207     mChargedEMEtFraction = ibooker.book1D("GenChargedEMEtFraction", "GenChargedEMEtFraction", 120, 0.0, 1.2);
0208     mChargedHadEtFraction = ibooker.book1D("GenChargedHadEtFraction", "GenChargedHadEtFraction", 120, 0.0, 1.2);
0209     mMuonEtFraction = ibooker.book1D("GenMuonEtFraction", "GenMuonEtFraction", 120, 0.0, 1.2);
0210     mInvisibleEtFraction = ibooker.book1D("GenInvisibleEtFraction", "GenInvisibleEtFraction", 120, 0.0, 1.2);
0211   }
0212 
0213   if (isPFMET || isMiniAODMET) {
0214     mPFphotonEtFraction = ibooker.book1D("photonEtFraction", "photonEtFraction", 100, 0, 1);
0215     mPFneutralHadronEtFraction = ibooker.book1D("neutralHadronEtFraction", "neutralHadronEtFraction", 100, 0, 1);
0216     mPFelectronEtFraction = ibooker.book1D("electronEtFraction", "electronEtFraction", 100, 0, 1);
0217     mPFchargedHadronEtFraction = ibooker.book1D("chargedHadronEtFraction", "chargedHadronEtFraction", 100, 0, 1);
0218     mPFHFHadronEtFraction = ibooker.book1D("HFHadronEtFraction", "HFHadronEtFraction", 100, 0, 1);
0219     mPFmuonEtFraction = ibooker.book1D("muonEtFraction", "muonEtFraction", 100, 0, 1);
0220     mPFHFEMEtFraction = ibooker.book1D("HFEMEtFraction", "HFEMEtFraction", 100, 0, 1);
0221 
0222     if (!isMiniAODMET) {
0223       mPFphotonEt = ibooker.book1D("photonEt", "photonEt", 100, 0, 1000);
0224       mPFneutralHadronEt = ibooker.book1D("neutralHadronEt", "neutralHadronEt", 100, 0, 1000);
0225       mPFelectronEt = ibooker.book1D("electronEt", "electronEt", 100, 0, 1000);
0226       mPFchargedHadronEt = ibooker.book1D("chargedHadronEt", "chargedHadronEt", 100, 0, 1000);
0227       mPFmuonEt = ibooker.book1D("muonEt", "muonEt", 100, 0, 1000);
0228       mPFHFHadronEt = ibooker.book1D("HFHadronEt", "HFHadronEt", 100, 0, 500);
0229       mPFHFEMEt = ibooker.book1D("HFEMEt", "HFEMEt", 100, 0, 300);
0230     }
0231   }
0232 }
0233 
0234 void METTester::analyze(const edm::Event &iEvent,
0235                         const edm::EventSetup &iSetup) {  // int counter(0);
0236 
0237   edm::Handle<reco::VertexCollection> pvHandle;
0238   iEvent.getByToken(pvToken_, pvHandle);
0239   if (!pvHandle.isValid()) {
0240     std::cout << __FUNCTION__ << ":" << __LINE__ << ":pvHandle handle not found!" << std::endl;
0241     assert(false);
0242   }
0243   const int nvtx = pvHandle->size();
0244   mNvertex->Fill(nvtx);
0245   // Collections for all MET collections
0246 
0247   edm::Handle<CaloMETCollection> caloMETs;
0248   edm::Handle<PFMETCollection> pfMETs;
0249   edm::Handle<GenMETCollection> genMETs;
0250   edm::Handle<pat::METCollection> patMET;
0251 
0252   if (isCaloMET)
0253     iEvent.getByToken(caloMETsToken_, caloMETs);
0254   if (isPFMET)
0255     iEvent.getByToken(pfMETsToken_, pfMETs);
0256   if (isGenMET)
0257     iEvent.getByToken(genMETsToken_, genMETs);
0258   if (isMiniAODMET)
0259     iEvent.getByToken(patMETToken_, patMET);
0260   if ((isCaloMET) and !caloMETs.isValid())
0261     return;
0262   if ((isPFMET) and !pfMETs.isValid())
0263     return;
0264   if ((isGenMET) and !genMETs.isValid())
0265     return;
0266   if ((isMiniAODMET) and !patMET.isValid())
0267     return;
0268 
0269   reco::MET met;
0270   if (isCaloMET) {
0271     met = caloMETs->front();
0272   }
0273   if (isPFMET) {
0274     met = pfMETs->front();
0275   }
0276   if (isGenMET) {
0277     met = genMETs->front();
0278   }
0279   if (isMiniAODMET) {
0280     met = patMET->front();
0281   }
0282 
0283   const double SumET = met.sumEt();
0284   const double METSig = met.mEtSig();
0285   const double MET = met.pt();
0286   const double MEx = met.px();
0287   const double MEy = met.py();
0288   const double METPhi = met.phi();
0289   mMEx->Fill(MEx);
0290   mMEy->Fill(MEy);
0291   mMET->Fill(MET);
0292   mMETFine->Fill(MET);
0293   mMET_Nvtx->Fill((double)nvtx, MET);
0294   mMETPhi->Fill(METPhi);
0295   mSumET->Fill(SumET);
0296   mMETSig->Fill(METSig);
0297 
0298   // Get Generated MET for Resolution plots
0299   const reco::GenMET *genMetTrue = nullptr;
0300   bool isvalidgenmet = false;
0301 
0302   if (!isMiniAODMET) {
0303     edm::Handle<GenMETCollection> genTrue;
0304     iEvent.getByToken(genMETsTrueToken_, genTrue);
0305     if (genTrue.isValid()) {
0306       isvalidgenmet = true;
0307       const GenMETCollection *genmetcol = genTrue.product();
0308       genMetTrue = &(genmetcol->front());
0309     }
0310   } else {
0311     genMetTrue = patMET->front().genMET();
0312     isvalidgenmet = true;
0313   }
0314 
0315   if (isvalidgenmet) {
0316     double genMET = genMetTrue->pt();
0317     double genMETPhi = genMetTrue->phi();
0318 
0319     mMETDifference_GenMETTrue->Fill(MET - genMET);
0320     mMETDeltaPhi_GenMETTrue->Fill(TMath::ACos(TMath::Cos(METPhi - genMETPhi)));
0321 
0322     if (!isGenMET) {
0323       // pfMET resolution in pfMET bins : Sam, Feb, 2012
0324       if (MET > 0 && MET < 20)
0325         mMETDifference_GenMETTrue_MET0to20->Fill(MET - genMET);
0326       else if (MET > 20 && MET < 40)
0327         mMETDifference_GenMETTrue_MET20to40->Fill(MET - genMET);
0328       else if (MET > 40 && MET < 60)
0329         mMETDifference_GenMETTrue_MET40to60->Fill(MET - genMET);
0330       else if (MET > 60 && MET < 80)
0331         mMETDifference_GenMETTrue_MET60to80->Fill(MET - genMET);
0332       else if (MET > 80 && MET < 100)
0333         mMETDifference_GenMETTrue_MET80to100->Fill(MET - genMET);
0334       else if (MET > 100 && MET < 150)
0335         mMETDifference_GenMETTrue_MET100to150->Fill(MET - genMET);
0336       else if (MET > 150 && MET < 200)
0337         mMETDifference_GenMETTrue_MET150to200->Fill(MET - genMET);
0338       else if (MET > 200 && MET < 300)
0339         mMETDifference_GenMETTrue_MET200to300->Fill(MET - genMET);
0340       else if (MET > 300 && MET < 400)
0341         mMETDifference_GenMETTrue_MET300to400->Fill(MET - genMET);
0342       else if (MET > 400 && MET < 500)
0343         mMETDifference_GenMETTrue_MET400to500->Fill(MET - genMET);
0344       else if (MET > 500)
0345         mMETDifference_GenMETTrue_MET500->Fill(MET - genMET);
0346 
0347     } else {
0348       edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task:  genMetTrue";
0349     }
0350   }
0351   if (!isMiniAODMET) {
0352     edm::Handle<GenMETCollection> genCalo;
0353     iEvent.getByToken(genMETsCaloToken_, genCalo);
0354     if (genCalo.isValid()) {
0355       const GenMETCollection *genmetcol = genCalo.product();
0356       const GenMET *genMetCalo = &(genmetcol->front());
0357       const double genMET = genMetCalo->pt();
0358       const double genMETPhi = genMetCalo->phi();
0359 
0360       mMETDifference_GenMETCalo->Fill(MET - genMET);
0361       mMETDeltaPhi_GenMETCalo->Fill(TMath::ACos(TMath::Cos(METPhi - genMETPhi)));
0362     } else {
0363       edm::LogInfo("OutputInfo") << " failed to retrieve data required by MET Task:  genMetCalo";
0364     }
0365   }
0366   if (isCaloMET) {
0367     const reco::CaloMET *calomet = &(caloMETs->front());
0368     // ==========================================================
0369     // Reconstructed MET Information
0370     const double caloMaxEtInEMTowers = calomet->maxEtInEmTowers();
0371     const double caloMaxEtInHadTowers = calomet->maxEtInHadTowers();
0372     const double caloEtFractionHadronic = calomet->etFractionHadronic();
0373     const double caloEmEtFraction = calomet->emEtFraction();
0374     const double caloHadEtInHB = calomet->hadEtInHB();
0375     const double caloHadEtInHO = calomet->hadEtInHO();
0376     const double caloHadEtInHE = calomet->hadEtInHE();
0377     const double caloHadEtInHF = calomet->hadEtInHF();
0378     const double caloEmEtInEB = calomet->emEtInEB();
0379     const double caloEmEtInEE = calomet->emEtInEE();
0380     const double caloEmEtInHF = calomet->emEtInHF();
0381     const double caloSETInpHF = calomet->CaloSETInpHF();
0382     const double caloSETInmHF = calomet->CaloSETInmHF();
0383 
0384     mCaloMaxEtInEmTowers->Fill(caloMaxEtInEMTowers);
0385     mCaloMaxEtInHadTowers->Fill(caloMaxEtInHadTowers);
0386     mCaloEtFractionHadronic->Fill(caloEtFractionHadronic);
0387     mCaloEmEtFraction->Fill(caloEmEtFraction);
0388     mCaloHadEtInHB->Fill(caloHadEtInHB);
0389     mCaloHadEtInHO->Fill(caloHadEtInHO);
0390     mCaloHadEtInHE->Fill(caloHadEtInHE);
0391     mCaloHadEtInHF->Fill(caloHadEtInHF);
0392     mCaloEmEtInEB->Fill(caloEmEtInEB);
0393     mCaloEmEtInEE->Fill(caloEmEtInEE);
0394     mCaloEmEtInHF->Fill(caloEmEtInHF);
0395     mCaloSETInpHF->Fill(caloSETInpHF);
0396     mCaloSETInmHF->Fill(caloSETInmHF);
0397   }
0398   if (isGenMET) {
0399     const GenMET *genmet;
0400     // Get Generated MET
0401     genmet = &(genMETs->front());
0402 
0403     const double NeutralEMEtFraction = genmet->NeutralEMEtFraction();
0404     const double NeutralHadEtFraction = genmet->NeutralHadEtFraction();
0405     const double ChargedEMEtFraction = genmet->ChargedEMEtFraction();
0406     const double ChargedHadEtFraction = genmet->ChargedHadEtFraction();
0407     const double MuonEtFraction = genmet->MuonEtFraction();
0408     const double InvisibleEtFraction = genmet->InvisibleEtFraction();
0409 
0410     mNeutralEMEtFraction->Fill(NeutralEMEtFraction);
0411     mNeutralHadEtFraction->Fill(NeutralHadEtFraction);
0412     mChargedEMEtFraction->Fill(ChargedEMEtFraction);
0413     mChargedHadEtFraction->Fill(ChargedHadEtFraction);
0414     mMuonEtFraction->Fill(MuonEtFraction);
0415     mInvisibleEtFraction->Fill(InvisibleEtFraction);
0416   }
0417   if (isPFMET) {
0418     const reco::PFMET *pfmet = &(pfMETs->front());
0419     mPFphotonEtFraction->Fill(pfmet->photonEtFraction());
0420     mPFphotonEt->Fill(pfmet->photonEt());
0421     mPFneutralHadronEtFraction->Fill(pfmet->neutralHadronEtFraction());
0422     mPFneutralHadronEt->Fill(pfmet->neutralHadronEt());
0423     mPFelectronEtFraction->Fill(pfmet->electronEtFraction());
0424     mPFelectronEt->Fill(pfmet->electronEt());
0425     mPFchargedHadronEtFraction->Fill(pfmet->chargedHadronEtFraction());
0426     mPFchargedHadronEt->Fill(pfmet->chargedHadronEt());
0427     mPFmuonEtFraction->Fill(pfmet->muonEtFraction());
0428     mPFmuonEt->Fill(pfmet->muonEt());
0429     mPFHFHadronEtFraction->Fill(pfmet->HFHadronEtFraction());
0430     mPFHFHadronEt->Fill(pfmet->HFHadronEt());
0431     mPFHFEMEtFraction->Fill(pfmet->HFEMEtFraction());
0432     mPFHFEMEt->Fill(pfmet->HFEMEt());
0433     // Reconstructed MET Information
0434   }
0435   if (isMiniAODMET) {
0436     const pat::MET *patmet = &(patMET->front());
0437     mMETUnc_JetResUp->Fill(MET - patmet->shiftedPt(pat::MET::JetResUp));
0438     mMETUnc_JetResDown->Fill(MET - patmet->shiftedPt(pat::MET::JetResDown));
0439     mMETUnc_JetEnUp->Fill(MET - patmet->shiftedPt(pat::MET::JetEnUp));
0440     mMETUnc_JetEnDown->Fill(MET - patmet->shiftedPt(pat::MET::JetEnDown));
0441     mMETUnc_MuonEnUp->Fill(MET - patmet->shiftedPt(pat::MET::MuonEnUp));
0442     mMETUnc_MuonEnDown->Fill(MET - patmet->shiftedPt(pat::MET::MuonEnDown));
0443     mMETUnc_ElectronEnUp->Fill(MET - patmet->shiftedPt(pat::MET::ElectronEnUp));
0444     mMETUnc_ElectronEnDown->Fill(MET - patmet->shiftedPt(pat::MET::ElectronEnDown));
0445     mMETUnc_TauEnUp->Fill(MET - patmet->shiftedPt(pat::MET::TauEnUp));
0446     mMETUnc_TauEnDown->Fill(MET - patmet->shiftedPt(pat::MET::TauEnDown));
0447     mMETUnc_UnclusteredEnUp->Fill(MET - patmet->shiftedPt(pat::MET::UnclusteredEnUp));
0448     mMETUnc_UnclusteredEnDown->Fill(MET - patmet->shiftedPt(pat::MET::UnclusteredEnDown));
0449     mMETUnc_PhotonEnUp->Fill(MET - patmet->shiftedPt(pat::MET::PhotonEnUp));
0450     mMETUnc_PhotonEnDown->Fill(MET - patmet->shiftedPt(pat::MET::PhotonEnDown));
0451 
0452     if (patmet->isPFMET()) {
0453       mPFphotonEtFraction->Fill(patmet->NeutralEMFraction());
0454       mPFneutralHadronEtFraction->Fill(patmet->NeutralHadEtFraction());
0455       mPFelectronEtFraction->Fill(patmet->ChargedEMEtFraction());
0456       mPFchargedHadronEtFraction->Fill(patmet->ChargedHadEtFraction());
0457       mPFmuonEtFraction->Fill(patmet->MuonEtFraction());
0458       mPFHFHadronEtFraction->Fill(patmet->Type6EtFraction());  // HFHadrons
0459       mPFHFEMEtFraction->Fill(patmet->Type7EtFraction());      // HFEMEt
0460     }
0461   }
0462 }