CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/DQMOffline/PFTau/src/PFCandidateBenchmark.cc

Go to the documentation of this file.
00001 #include "DQMOffline/PFTau/interface/PFCandidateBenchmark.h"
00002 
00003 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00004 
00005 // #include "DQMServices/Core/interface/MonitorElement.h"
00006 // #include "DQMServices/Core/interface/DQMStore.h"
00007 
00008 #include <TROOT.h>
00009 #include <TFile.h>
00010 #include <TH1.h>
00011 #include <TH2.h>
00012 
00013 
00014 using namespace std;
00015 
00016 
00017 
00018 PFCandidateBenchmark::~PFCandidateBenchmark() {}
00019 
00020 
00021 void PFCandidateBenchmark::setup() {
00022 
00023   PhaseSpace ecalEnergyPS(100,0,100);
00024   PhaseSpace hcalEnergyPS(100,0,100);
00025   PhaseSpace mva_e_piPS(100,-1,1);
00026   switch(mode_) {
00027   case VALIDATION:
00028     break;
00029   case DQMOFFLINE:
00030   default:
00031     ecalEnergyPS.n = 50;
00032     hcalEnergyPS.n = 50;
00033     mva_e_piPS.n = 50;
00034     break;
00035     break;
00036   }
00037 
00038   particleId_ = book1D("particleId_", "particle ID", 7,1,8);
00039   ecalEnergy_ = book1D("ecalEnergy_", "ECAL energy, corrected;E_{ECAL} (GeV)",
00040                        ecalEnergyPS.n, ecalEnergyPS.m, ecalEnergyPS.M);
00041   hcalEnergy_ = book1D("hcalEnergy_", "HCAL energy, corrected;E_{HCAL} (GeV)",
00042                        ecalEnergyPS.n, ecalEnergyPS.m, ecalEnergyPS.M);
00043   mva_e_pi_ = book1D("mva_e_pi_", "e VS #pi MVA output;MVA", 
00044                      mva_e_piPS.n, mva_e_piPS.m, mva_e_piPS.M);
00045   elementsInBlocksSize_ = book1D("elementsInBlocksSize_", "number of elements used", 10, 0, 10);
00046 }
00047 
00048 
00049 
00050 void PFCandidateBenchmark::fill( const reco::PFCandidateCollection& pfCands) {
00051 
00052   for(unsigned i=0; i<pfCands.size(); ++i) {
00053     fillOne(pfCands[i]);
00054   }
00055 }
00056 
00057 
00058 void PFCandidateBenchmark::fillOne( const reco::PFCandidate& pfCand ) {
00059 
00060   if( !isInRange(pfCand.pt(), pfCand.eta(), pfCand.phi() ) ) return;
00061 
00062   particleId_->Fill( pfCand.particleId() );
00063   ecalEnergy_->Fill( pfCand.ecalEnergy() );
00064   hcalEnergy_->Fill( pfCand.hcalEnergy() );
00065   mva_e_pi_->Fill( pfCand.mva_e_pi() );
00066   elementsInBlocksSize_->Fill( pfCand.elementsInBlocks().size() );
00067 }