00001
00002
00003
00004
00005
00006
00007 #include "DQMOffline/JetMET/interface/JetPtAnalyzer.h"
00008 #include "DataFormats/Common/interface/Handle.h"
00009
00010 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00011 #include "DataFormats/JetReco/interface/CaloJet.h"
00012
00013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00014
00015 #include <string>
00016 using namespace edm;
00017
00018
00019 JetPtAnalyzer::JetPtAnalyzer(const edm::ParameterSet& pSet) {
00020
00021 parameters = pSet;
00022
00023
00024
00025
00026
00027 }
00028
00029
00030 JetPtAnalyzer::~JetPtAnalyzer() { }
00031
00032
00033
00034 void JetPtAnalyzer::beginJob(DQMStore * dbe) {
00035
00036 jetname = "jetPtAnalyzer";
00037
00038 LogTrace(jetname)<<"[JetPtAnalyzer] Parameters initialization";
00039 dbe->setCurrentFolder("JetMET/Jet/"+_source);
00040
00041 jetME = dbe->book1D("jetReco", "jetReco", 3, 1, 4);
00042 jetME->setBinLabel(1,"CaloJets",1);
00043
00044
00045 jetID = new reco::helper::JetIDHelper(parameters.getParameter<ParameterSet>("JetIDParams"));
00046
00047
00048 etaBin = parameters.getParameter<int>("etaBin");
00049 etaMin = parameters.getParameter<double>("etaMin");
00050 etaMax = parameters.getParameter<double>("etaMax");
00051
00052
00053 phiBin = parameters.getParameter<int>("phiBin");
00054 phiMin = parameters.getParameter<double>("phiMin");
00055 phiMax = parameters.getParameter<double>("phiMax");
00056
00057
00058 ptBin = parameters.getParameter<int>("ptBin");
00059 ptMin = parameters.getParameter<double>("ptMin");
00060 ptMax = parameters.getParameter<double>("ptMax");
00061
00062 mEta = dbe->book2D("EtaVsPt", "EtaVsPt",ptBin, ptMin, ptMax, etaBin, etaMin, etaMax);
00063 mPhi = dbe->book2D("PhiVsPt", "PhiVsPt",ptBin, ptMin, ptMax, phiBin, phiMin, phiMax);
00064 mConstituents = dbe->book2D("ConstituentsVsPt", "# of ConstituentsVsPt",ptBin, ptMin, ptMax, 100, 0, 100);
00065
00066
00067
00068 mHFrac = dbe->book2D("HFracVsPt", "HFracVsPt",ptBin, ptMin, ptMax, 120, -0.1, 1.1);
00069 mEFrac = dbe->book2D("EFracVsPt", "EFracVsPt", ptBin, ptMin, ptMax,120, -0.1, 1.1);
00070 mMaxEInEmTowers = dbe->book2D("MaxEInEmTowersVsPt", "MaxEInEmTowersVsPt", ptBin, ptMin, ptMax,100, 0, 100);
00071 mMaxEInHadTowers = dbe->book2D("MaxEInHadTowersVsPt", "MaxEInHadTowersVsPt",ptBin, ptMin, ptMax, 100, 0, 100);
00072 mHadEnergyInHO = dbe->book2D("HadEnergyInHOVsPt", "HadEnergyInHOVsPt",ptBin, ptMin, ptMax, 100, 0, 10);
00073 mHadEnergyInHB = dbe->book2D("HadEnergyInHBVsPt", "HadEnergyInHBVsPt",ptBin, ptMin, ptMax, 100, 0, 50);
00074 mHadEnergyInHF = dbe->book2D("HadEnergyInHFVsPt", "HadEnergyInHFVsPt",ptBin, ptMin, ptMax ,100, 0, 50);
00075 mHadEnergyInHE = dbe->book2D("HadEnergyInHEVsPt", "HadEnergyInHEVsPt",ptBin, ptMin, ptMax, 100, 0, 100);
00076 mEmEnergyInEB = dbe->book2D("EmEnergyInEBVsPt", "EmEnergyInEBVsPt",ptBin, ptMin, ptMax, 100, 0, 50);
00077 mEmEnergyInEE = dbe->book2D("EmEnergyInEEVsPt", "EmEnergyInEEVsPt",ptBin, ptMin, ptMax, 100, 0, 50);
00078 mEmEnergyInHF = dbe->book2D("EmEnergyInHFVsPt", "EmEnergyInHFVsPt",ptBin, ptMin, ptMax, 120, -20, 100);
00079
00080 mN90Hits = dbe->book2D("N90HitsVsPt", "N90HitsVsPt",ptBin, ptMin, ptMax, 50, 0, 50);
00081 mresEMF = dbe->book2D("resEMFVsPt", "resEMFVsPt",ptBin, ptMin, ptMax,50, 0., 1.);
00082 mfHPD = dbe->book2D("fHPDVsPt", "fHPDVsPt",ptBin, ptMin, ptMax,50, 0., 1.);
00083 mfRBX = dbe->book2D("fRBXVsPt", "fRBXVsPt",ptBin, ptMin, ptMax,50, 0., 1.);
00084
00085
00086 }
00087 void JetPtAnalyzer::endJob() {
00088
00089 delete jetID;
00090
00091 }
00092
00093
00094
00095 void JetPtAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup,
00096 const reco::CaloJetCollection& caloJets) {
00097
00098 LogTrace(jetname)<<"[JetPtAnalyzer] Analyze Calo Jet";
00099
00100 for (reco::CaloJetCollection::const_iterator jet = caloJets.begin(); jet!=caloJets.end(); ++jet){
00101
00102 jetME->Fill(1);
00103
00104 jetID->calculate(iEvent, *jet);
00105
00106 if (mEta) mEta->Fill (jet->pt(),jet->eta());
00107 if (mPhi) mPhi->Fill (jet->pt(),jet->phi());
00108
00109
00110 if (mConstituents) mConstituents->Fill (jet->pt(),jet->nConstituents());
00111 if (mHFrac) mHFrac->Fill (jet->pt(),jet->energyFractionHadronic());
00112 if (mEFrac) mEFrac->Fill (jet->pt(),jet->emEnergyFraction());
00113
00114
00115 if (mMaxEInEmTowers) mMaxEInEmTowers->Fill (jet->pt(),jet->maxEInEmTowers());
00116 if (mMaxEInHadTowers) mMaxEInHadTowers->Fill (jet->pt(),jet->maxEInHadTowers());
00117
00118 if (mHadEnergyInHO) mHadEnergyInHO->Fill (jet->pt(),jet->hadEnergyInHO());
00119 if (mHadEnergyInHB) mHadEnergyInHB->Fill (jet->pt(),jet->hadEnergyInHB());
00120 if (mHadEnergyInHF) mHadEnergyInHF->Fill (jet->pt(),jet->hadEnergyInHF());
00121 if (mHadEnergyInHE) mHadEnergyInHE->Fill (jet->pt(),jet->hadEnergyInHE());
00122 if (mEmEnergyInEB) mEmEnergyInEB->Fill (jet->pt(),jet->emEnergyInEB());
00123 if (mEmEnergyInEE) mEmEnergyInEE->Fill (jet->pt(),jet->emEnergyInEE());
00124 if (mEmEnergyInHF) mEmEnergyInHF->Fill (jet->pt(),jet->emEnergyInHF());
00125
00126 if (mN90Hits) mN90Hits->Fill (jet->pt(),jetID->n90Hits());
00127 if (mresEMF) mresEMF->Fill(jet->pt(),jetID->restrictedEMF());
00128 if (mfHPD) mfHPD->Fill(jet->pt(),jetID->fHPD());
00129 if (mfRBX) mfRBX->Fill(jet->pt(),jetID->fRBX());
00130
00131 }
00132 }