File indexing completed on 2024-04-06 12:09:45
0001 #include "DQMOffline/PFTau/interface/PFCandidateBenchmark.h"
0002
0003 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0004
0005 #include <TFile.h>
0006 #include <TH1.h>
0007 #include <TH2.h>
0008 #include <TROOT.h>
0009
0010 using namespace std;
0011
0012 PFCandidateBenchmark::~PFCandidateBenchmark() {}
0013
0014 void PFCandidateBenchmark::setup(DQMStore::IBooker &b) {
0015 PhaseSpace ecalEnergyPS(100, 0, 100);
0016 PhaseSpace hcalEnergyPS(100, 0, 100);
0017 PhaseSpace mva_e_piPS(100, -1, 1);
0018 switch (mode_) {
0019 case VALIDATION:
0020 break;
0021 case DQMOFFLINE:
0022 default:
0023 ecalEnergyPS.n = 50;
0024 hcalEnergyPS.n = 50;
0025 mva_e_piPS.n = 50;
0026 break;
0027 break;
0028 }
0029
0030 particleId_ = book1D(b, "particleId_", "particle ID", 7, 1, 8);
0031 ecalEnergy_ =
0032 book1D(b, "ecalEnergy_", "ECAL energy, corrected;E_{ECAL} (GeV)", ecalEnergyPS.n, ecalEnergyPS.m, ecalEnergyPS.M);
0033 hcalEnergy_ =
0034 book1D(b, "hcalEnergy_", "HCAL energy, corrected;E_{HCAL} (GeV)", ecalEnergyPS.n, ecalEnergyPS.m, ecalEnergyPS.M);
0035 mva_e_pi_ = book1D(b, "mva_e_pi_", "e VS #pi MVA output;MVA", mva_e_piPS.n, mva_e_piPS.m, mva_e_piPS.M);
0036 elementsInBlocksSize_ = book1D(b, "elementsInBlocksSize_", "number of elements used", 10, 0, 10);
0037 }
0038
0039 void PFCandidateBenchmark::fill(const reco::PFCandidateCollection &pfCands) {
0040 for (unsigned i = 0; i < pfCands.size(); ++i) {
0041 fillOne(pfCands[i]);
0042 }
0043 }
0044
0045 void PFCandidateBenchmark::fillOne(const reco::PFCandidate &pfCand) {
0046 if (!isInRange(pfCand.pt(), pfCand.eta(), pfCand.phi()))
0047 return;
0048
0049 particleId_->Fill(pfCand.particleId());
0050 ecalEnergy_->Fill(pfCand.ecalEnergy());
0051 hcalEnergy_->Fill(pfCand.hcalEnergy());
0052 mva_e_pi_->Fill(pfCand.mva_e_pi());
0053 elementsInBlocksSize_->Fill(pfCand.elementsInBlocks().size());
0054 }