Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:33:07

0001 #ifndef ValidationRecoJetsJetTester_h
0002 #define ValidationRecoJetsJetTester_h
0003 
0004 // Producer for validation histograms for Calo, JPT and PF jet objects
0005 // F. Ratnikov, Sept. 7, 2006
0006 // Modified by Chiyoung Jeong, Feb. 2, 2010
0007 // Modified by J. Piedra, Sept. 11, 2013
0008 // Rewritten by Viola Sordini, Matthias Artur Weber, Robert Schoefbeck Nov./Dez.
0009 // 2013
0010 
0011 #include <cmath>
0012 #include <string>
0013 
0014 #include "DQMServices/Core/interface/DQMStore.h"
0015 #include "DataFormats/Common/interface/Handle.h"
0016 #include "DataFormats/JetReco/interface/CaloJet.h"
0017 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
0018 #include "DataFormats/JetReco/interface/GenJet.h"
0019 #include "DataFormats/JetReco/interface/GenJetCollection.h"
0020 #include "DataFormats/JetReco/interface/JPTJet.h"
0021 #include "DataFormats/JetReco/interface/JPTJetCollection.h"
0022 #include "DataFormats/JetReco/interface/PFJet.h"
0023 #include "DataFormats/METReco/interface/CaloMET.h"
0024 #include "DataFormats/METReco/interface/CaloMETCollection.h"
0025 #include "DataFormats/METReco/interface/GenMET.h"
0026 #include "DataFormats/METReco/interface/GenMETCollection.h"
0027 #include "DataFormats/METReco/interface/MET.h"
0028 #include "DataFormats/METReco/interface/METCollection.h"
0029 #include "DataFormats/Math/interface/deltaR.h"
0030 #include "DataFormats/PatCandidates/interface/Jet.h"
0031 #include "DataFormats/VertexReco/interface/Vertex.h"
0032 #include "FWCore/Framework/interface/Event.h"
0033 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0034 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0035 #include "FWCore/ServiceRegistry/interface/Service.h"
0036 #include "FWCore/Utilities/interface/EDGetToken.h"
0037 #include "JetMETCorrections/JetCorrector/interface/JetCorrector.h"
0038 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
0039 #include <DQMServices/Core/interface/DQMEDAnalyzer.h>
0040 
0041 class JetTester : public DQMEDAnalyzer {
0042 public:
0043   JetTester(const edm::ParameterSet &);
0044   ~JetTester() override;
0045 
0046   void analyze(const edm::Event &, const edm::EventSetup &) override;
0047   void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0048 
0049 private:
0050   void fillMatchHists(const double GenEta,
0051                       const double GenPhi,
0052                       const double GenPt,
0053                       const double GenMass,
0054                       const double RecoEta,
0055                       const double RecoPhi,
0056                       const double RecoPt,
0057                       const double RecoMass);
0058 
0059   edm::InputTag mInputCollection;
0060   edm::InputTag mInputGenCollection;
0061   edm::InputTag mJetCorrector;
0062   std::string JetType;
0063 
0064   // Tokens
0065   edm::EDGetTokenT<std::vector<reco::Vertex>> pvToken_;
0066   edm::EDGetTokenT<reco::CaloJetCollection> caloJetsToken_;
0067   edm::EDGetTokenT<reco::PFJetCollection> pfJetsToken_;
0068   edm::EDGetTokenT<reco::GenJetCollection> genJetsToken_;
0069   edm::EDGetTokenT<GenEventInfoProduct> evtToken_;
0070   edm::EDGetTokenT<pat::JetCollection> patJetsToken_;
0071   edm::EDGetTokenT<reco::JetCorrector> jetCorrectorToken_;
0072 
0073   // Event variables
0074   MonitorElement *mNvtx;
0075 
0076   // Jet parameters
0077   MonitorElement *mEta;
0078   MonitorElement *mPhi;
0079   MonitorElement *mPt;
0080   MonitorElement *mP;
0081   MonitorElement *mEnergy;
0082   MonitorElement *mMass;
0083   MonitorElement *mConstituents;
0084   MonitorElement *mJetArea;
0085   //  MonitorElement* mRho;
0086 
0087   // Corrected jets
0088   MonitorElement *mCorrJetPt;
0089   MonitorElement *mCorrJetEta;
0090   MonitorElement *mCorrJetPhi;
0091   MonitorElement *mCorrJetEta_Pt40;
0092   MonitorElement *mCorrJetPhi_Pt40;
0093   // Corrected jets profiles
0094   MonitorElement *mPtCorrOverReco_Pt_B;
0095   MonitorElement *mPtCorrOverReco_Pt_E;
0096   MonitorElement *mPtCorrOverReco_Pt_F;
0097   MonitorElement *mPtCorrOverReco_Eta_20_40;
0098   MonitorElement *mPtCorrOverReco_Eta_40_200;
0099   MonitorElement *mPtCorrOverReco_Eta_200_600;
0100   MonitorElement *mPtCorrOverReco_Eta_600_1500;
0101   MonitorElement *mPtCorrOverReco_Eta_1500_3500;
0102   MonitorElement *mPtCorrOverReco_Eta_3500_5000;
0103   MonitorElement *mPtCorrOverReco_Eta_5000_6500;
0104   MonitorElement *mPtCorrOverReco_Eta_3500;
0105   MonitorElement *mPtCorrOverGen_GenPt_B;
0106   MonitorElement *mPtCorrOverGen_GenPt_E;
0107   MonitorElement *mPtCorrOverGen_GenPt_F;
0108   MonitorElement *mPtCorrOverGen_GenEta_20_40;
0109   MonitorElement *mPtCorrOverGen_GenEta_40_200;
0110   MonitorElement *mPtCorrOverGen_GenEta_200_600;
0111   MonitorElement *mPtCorrOverGen_GenEta_600_1500;
0112   MonitorElement *mPtCorrOverGen_GenEta_1500_3500;
0113   MonitorElement *mPtCorrOverGen_GenEta_3500_5000;
0114   MonitorElement *mPtCorrOverGen_GenEta_5000_6500;
0115   MonitorElement *mPtCorrOverGen_GenEta_3500;
0116 
0117   // Generation
0118   MonitorElement *mGenEta;
0119   MonitorElement *mGenPhi;
0120   MonitorElement *mGenPt;
0121   MonitorElement *mGenEtaFirst;
0122   MonitorElement *mGenPhiFirst;
0123   MonitorElement *mPtHat;
0124   MonitorElement *mDeltaEta;
0125   MonitorElement *mDeltaPhi;
0126   MonitorElement *mDeltaPt;
0127 
0128   MonitorElement *mPtRecoOverGen_B_20_40;
0129   MonitorElement *mPtRecoOverGen_E_20_40;
0130   MonitorElement *mPtRecoOverGen_F_20_40;
0131   MonitorElement *mPtRecoOverGen_B_40_200;
0132   MonitorElement *mPtRecoOverGen_E_40_200;
0133   MonitorElement *mPtRecoOverGen_F_40_200;
0134   MonitorElement *mPtRecoOverGen_B_200_600;
0135   MonitorElement *mPtRecoOverGen_E_200_600;
0136   MonitorElement *mPtRecoOverGen_F_200_600;
0137   MonitorElement *mPtRecoOverGen_B_600_1500;
0138   MonitorElement *mPtRecoOverGen_E_600_1500;
0139   MonitorElement *mPtRecoOverGen_F_600_1500;
0140   MonitorElement *mPtRecoOverGen_B_1500_3500;
0141   MonitorElement *mPtRecoOverGen_E_1500_3500;
0142   MonitorElement *mPtRecoOverGen_F_1500_3500;
0143   MonitorElement *mPtRecoOverGen_B_3500_5000;
0144   MonitorElement *mPtRecoOverGen_E_3500_5000;
0145   MonitorElement *mPtRecoOverGen_B_5000_6500;
0146   MonitorElement *mPtRecoOverGen_E_5000_6500;
0147 
0148   // jet mass resolution as function of gen-pt
0149   MonitorElement *mMassRecoOverGen_B_20_40;
0150   MonitorElement *mMassRecoOverGen_E_20_40;
0151   MonitorElement *mMassRecoOverGen_F_20_40;
0152   MonitorElement *mMassRecoOverGen_B_40_200;
0153   MonitorElement *mMassRecoOverGen_E_40_200;
0154   MonitorElement *mMassRecoOverGen_F_40_200;
0155   MonitorElement *mMassRecoOverGen_B_200_500;
0156   MonitorElement *mMassRecoOverGen_E_200_500;
0157   MonitorElement *mMassRecoOverGen_F_200_500;
0158   MonitorElement *mMassRecoOverGen_B_500_750;
0159   MonitorElement *mMassRecoOverGen_E_500_750;
0160   MonitorElement *mMassRecoOverGen_F_500_750;
0161   MonitorElement *mMassRecoOverGen_B_750_1000;
0162   MonitorElement *mMassRecoOverGen_E_750_1000;
0163   MonitorElement *mMassRecoOverGen_F_750_1000;
0164   MonitorElement *mMassRecoOverGen_B_1000_1500;
0165   MonitorElement *mMassRecoOverGen_E_1000_1500;
0166   MonitorElement *mMassRecoOverGen_F_1000_1500;
0167   MonitorElement *mMassRecoOverGen_B_1500_3500;
0168   MonitorElement *mMassRecoOverGen_E_1500_3500;
0169   MonitorElement *mMassRecoOverGen_F_1500;
0170   MonitorElement *mMassRecoOverGen_B_3500_5000;
0171   MonitorElement *mMassRecoOverGen_E_3500_5000;
0172   MonitorElement *mMassRecoOverGen_B_5000;
0173   MonitorElement *mMassRecoOverGen_E_5000;
0174 
0175   MonitorElement *mPtRecoOverGen_B_3500;
0176   MonitorElement *mPtRecoOverGen_E_3500;
0177   MonitorElement *mPtRecoOverGen_F_3500;
0178 
0179   // Generation profiles
0180   MonitorElement *mPtRecoOverGen_GenPt_B;
0181   MonitorElement *mPtRecoOverGen_GenPt_E;
0182   MonitorElement *mPtRecoOverGen_GenPt_F;
0183   MonitorElement *mPtRecoOverGen_GenPhi_B;
0184   MonitorElement *mPtRecoOverGen_GenPhi_E;
0185   MonitorElement *mPtRecoOverGen_GenPhi_F;
0186   MonitorElement *mPtRecoOverGen_GenEta_20_40;
0187   MonitorElement *mPtRecoOverGen_GenEta_40_200;
0188   MonitorElement *mPtRecoOverGen_GenEta_200_600;
0189   MonitorElement *mPtRecoOverGen_GenEta_600_1500;
0190   MonitorElement *mPtRecoOverGen_GenEta_1500_3500;
0191   MonitorElement *mPtRecoOverGen_GenEta_3500_5000;
0192   MonitorElement *mPtRecoOverGen_GenEta_5000_6500;
0193   MonitorElement *mPtRecoOverGen_GenEta_3500;
0194 
0195   // Some jet algebra
0196   MonitorElement *mEtaFirst;
0197   MonitorElement *mPhiFirst;
0198   MonitorElement *mPtFirst;
0199   MonitorElement *mMjj;
0200   MonitorElement *mNJetsEta_B_20_40;
0201   MonitorElement *mNJetsEta_E_20_40;
0202   MonitorElement *mNJetsEta_B_40;
0203   MonitorElement *mNJetsEta_E_40;
0204   MonitorElement *mNJets_40;
0205   MonitorElement *mNJets1;
0206   MonitorElement *mNJets2;
0207 
0208   // ---- Calo Jet specific information ----
0209   MonitorElement *maxEInEmTowers;
0210   MonitorElement *maxEInHadTowers;
0211   MonitorElement *energyFractionHadronic;
0212   MonitorElement *emEnergyFraction;
0213   MonitorElement *hadEnergyInHB;
0214   MonitorElement *hadEnergyInHO;
0215   MonitorElement *hadEnergyInHE;
0216   MonitorElement *hadEnergyInHF;
0217   MonitorElement *emEnergyInEB;
0218   MonitorElement *emEnergyInEE;
0219   MonitorElement *emEnergyInHF;
0220   MonitorElement *towersArea;
0221   MonitorElement *n90;
0222   MonitorElement *n60;
0223 
0224   // ---- JPT or PF Jet specific information ----
0225   MonitorElement *muonMultiplicity;
0226   MonitorElement *chargedMultiplicity;
0227   MonitorElement *chargedEmEnergy;
0228   MonitorElement *neutralEmEnergy;
0229   MonitorElement *chargedHadronEnergy;
0230   MonitorElement *neutralHadronEnergy;
0231   MonitorElement *chargedHadronEnergyFraction;
0232   MonitorElement *neutralHadronEnergyFraction;
0233   MonitorElement *chargedEmEnergyFraction;
0234   MonitorElement *neutralEmEnergyFraction;
0235 
0236   // ---- PF Jet specific information ----
0237   MonitorElement *photonEnergy;
0238   MonitorElement *photonEnergyFraction;
0239   MonitorElement *electronEnergy;
0240   MonitorElement *electronEnergyFraction;
0241   MonitorElement *muonEnergy;
0242   MonitorElement *muonEnergyFraction;
0243   MonitorElement *HFHadronEnergy;
0244   MonitorElement *HFHadronEnergyFraction;
0245   MonitorElement *HFEMEnergy;
0246   MonitorElement *HFEMEnergyFraction;
0247   MonitorElement *chargedHadronMultiplicity;
0248   MonitorElement *neutralHadronMultiplicity;
0249   MonitorElement *photonMultiplicity;
0250   MonitorElement *electronMultiplicity;
0251   MonitorElement *HFHadronMultiplicity;
0252   MonitorElement *HFEMMultiplicity;
0253   MonitorElement *chargedMuEnergy;
0254   MonitorElement *chargedMuEnergyFraction;
0255   MonitorElement *neutralMultiplicity;
0256   MonitorElement *HOEnergy;
0257   MonitorElement *HOEnergyFraction;
0258 
0259   // contained in MiniAOD
0260   MonitorElement *hadronFlavor;
0261   MonitorElement *partonFlavor;
0262   MonitorElement *genPartonPDGID;
0263 
0264   // Parameters
0265   double mRecoJetPtThreshold;
0266   double mMatchGenPtThreshold;
0267   double mRThreshold;
0268   bool isCaloJet;
0269   bool isPFJet;
0270   bool isMiniAODJet;
0271 };
0272 
0273 #endif