CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Attributes
CandidateBenchmark Class Reference

To plot Candidate quantities. More...

#include <CandidateBenchmark.h>

Inheritance diagram for CandidateBenchmark:
Benchmark CandidateBenchmarkAnalyzer

Public Member Functions

 CandidateBenchmark (Mode mode)
 
template<class C >
void fill (const C &candidates)
 
void fillOne (const reco::Candidate &candidate)
 fill histograms with a given particle More...
 
void setup ()
 book histograms More...
 
void setup (const edm::ParameterSet &parameterSet)
 book histograms More...
 
virtual ~CandidateBenchmark ()
 
- Public Member Functions inherited from Benchmark
 Benchmark (Mode mode=DEFAULT)
 
bool isInRange (float pt, float eta, float phi) const
 
virtual void setDirectory (TDirectory *dir)
 
void setParameters (Mode mode)
 
void setRange (float ptMin, float ptMax, float etaMin, float etaMax, float phiMin, float phiMax)
 
void write ()
 write to the TFile, in plain ROOT mode. No need to call this function in DQM mode More...
 
virtual ~Benchmark ()
 

Protected Attributes

TH1F * charge_
 
TH1F * eta_
 
bool histogramBooked_
 
TH1F * pdgId_
 COLIN add this histo. More...
 
TH1F * phi_
 
TH1F * pt_
 
- Protected Attributes inherited from Benchmark
TDirectory * dir_
 
float etaMax_
 
float etaMin_
 
Mode mode_
 
float phiMax_
 
float phiMin_
 
float ptMax_
 
float ptMin_
 

Additional Inherited Members

- Public Types inherited from Benchmark
enum  Mode { DEFAULT, DQMOFFLINE, VALIDATION }
 
- Static Public Attributes inherited from Benchmark
static DQMStoreDQM_ = 0
 
- Protected Member Functions inherited from Benchmark
TH1F * book1D (const char *histname, const char *title, int nbins, float xmin, float xmax)
 book a 1D histogram, either with DQM or plain root. More...
 
TH2F * book2D (const char *histname, const char *title, int nbinsx, float xmin, float xmax, int nbinsy, float ymin, float ymax)
 book a 2D histogram, either with DQM or plain root. More...
 
TH2F * book2D (const char *histname, const char *title, int nbinsx, float *xbins, int nbinsy, float ymin, float ymax)
 book a 2D histogram, either with DQM or plain root. More...
 
TProfile * bookProfile (const char *histname, const char *title, int nbinsx, float xmin, float xmax, float ymin, float ymax, const char *option)
 book a TProfile histogram, either with DQM or plain root. More...
 
TProfile * bookProfile (const char *histname, const char *title, int nbinsx, float *xbins, float ymin, float ymax, const char *option)
 book a TProfile histogram, either with DQM or plain root. More...
 

Detailed Description

To plot Candidate quantities.

Definition at line 10 of file CandidateBenchmark.h.

Constructor & Destructor Documentation

CandidateBenchmark::CandidateBenchmark ( Mode  mode)

Definition at line 15 of file CandidateBenchmark.cc.

References charge_, eta_, histogramBooked_, pdgId_, phi_, and pt_.

15  : Benchmark(mode) {
16  pt_ = 0;
17  eta_ = 0;
18  phi_ = 0;
19  charge_ = 0;
20  pdgId_ = 0;
21 
22  histogramBooked_ = false;
23 
24 }
TH1F * pdgId_
COLIN add this histo.
Benchmark(Mode mode=DEFAULT)
Definition: Benchmark.h:42
CandidateBenchmark::~CandidateBenchmark ( )
virtual

Definition at line 26 of file CandidateBenchmark.cc.

26 {}

Member Function Documentation

template<class C >
void CandidateBenchmark::fill ( const C &  candidates)

Definition at line 43 of file CandidateBenchmark.h.

References fillOne(), and i.

Referenced by CandidateBenchmarkAnalyzer::analyze().

43  {
44 
45  for (unsigned int i = 0; i < candCollection.size(); i++) {
46  const reco::Candidate& cand = candCollection[i];
47  fillOne(cand);
48  }
49 }
int i
Definition: DBlmapReader.cc:9
void fillOne(const reco::Candidate &candidate)
fill histograms with a given particle
void CandidateBenchmark::fillOne ( const reco::Candidate candidate)

fill histograms with a given particle

Definition at line 87 of file CandidateBenchmark.cc.

References reco::Candidate::charge(), charge_, reco::Candidate::eta(), eta_, histogramBooked_, Benchmark::isInRange(), reco::Candidate::phi(), phi_, reco::Candidate::pt(), and pt_.

Referenced by fill(), PFCandidateMonitor::fill(), PFJetMonitor::fill(), PFCandidateManager::fill(), and PFMETMonitor::fillOne().

87  {
88 
89  if( !isInRange(cand.pt(), cand.eta(), cand.phi() ) ) return;
90 
91  if (histogramBooked_) {
92  if (pt_) pt_->Fill( cand.pt() );
93  if (eta_) eta_->Fill( cand.eta() );
94  if (phi_) phi_->Fill( cand.phi() );
95  if (charge_) charge_->Fill( cand.charge() );
96  }
97 }
bool isInRange(float pt, float eta, float phi) const
Definition: Benchmark.h:59
void CandidateBenchmark::setup ( void  )

book histograms

Definition at line 29 of file CandidateBenchmark.cc.

References Benchmark::book1D(), charge_, Benchmark::DQMOFFLINE, eta_, histogramBooked_, Benchmark::PhaseSpace::m, Benchmark::PhaseSpace::M, Benchmark::mode_, Benchmark::PhaseSpace::n, phi_, and pt_.

Referenced by CandidateBenchmarkAnalyzer::beginJob(), PFMETMonitor::setup(), PFCandidateMonitor::setup(), and PFJetMonitor::setup().

29  {
30 
31  if (!histogramBooked_) {
32  PhaseSpace ptPS(100,0,100);
33  PhaseSpace phiPS(360, -3.1416, 3.1416);
34  PhaseSpace etaPS(100, -5,5);
35  switch(mode_) {
36  case DQMOFFLINE:
37  default:
38  ptPS = PhaseSpace(50, 0, 100);
39  phiPS.n = 50;
40  etaPS.n = 20;
41  break;
42  }
43 
44  pt_ = book1D("pt_", "pt_;p_{T} (GeV)", ptPS.n, ptPS.m, ptPS.M);
45 
46  eta_ = book1D("eta_", "eta_;#eta", etaPS.n, etaPS.m, etaPS.M);
47 
48  phi_ = book1D("phi_", "phi_;#phi", phiPS.n, phiPS.m, phiPS.M);
49 
50  charge_ = book1D("charge_", "charge_;charge", 3,-1.5,1.5);
51 
52  histogramBooked_ = true;
53  }
54 }
Mode mode_
Definition: Benchmark.h:96
TH1F * book1D(const char *histname, const char *title, int nbins, float xmin, float xmax)
book a 1D histogram, either with DQM or plain root.
Definition: Benchmark.cc:25
void CandidateBenchmark::setup ( const edm::ParameterSet parameterSet)

book histograms

Definition at line 56 of file CandidateBenchmark.cc.

References Benchmark::book1D(), charge_, eta_, edm::ParameterSet::getParameter(), histogramBooked_, phi_, and pt_.

56  {
57  if (!histogramBooked_) {
58  edm::ParameterSet ptPS = parameterSet.getParameter<edm::ParameterSet>("PtHistoParameter");
59  edm::ParameterSet etaPS = parameterSet.getParameter<edm::ParameterSet>("EtaHistoParameter");
60  edm::ParameterSet phiPS = parameterSet.getParameter<edm::ParameterSet>("PhiHistoParameter");
61  edm::ParameterSet chPS = parameterSet.getParameter<edm::ParameterSet>("ChargeHistoParameter");
62 
63  if (ptPS.getParameter<bool>("switchOn")) {
64  pt_ = book1D("pt_", "p_{T};p_{T} (GeV)", ptPS.getParameter<int32_t>("nBin"),
65  ptPS.getParameter<double>("xMin"),
66  ptPS.getParameter<double>("xMax"));
67  }
68  if (etaPS.getParameter<bool>("switchOn")) {
69  eta_ = book1D("eta_", "#eta;#eta", etaPS.getParameter<int32_t>("nBin"),
70  etaPS.getParameter<double>("xMin"),
71  etaPS.getParameter<double>("xMax"));
72  }
73  if (phiPS.getParameter<bool>("switchOn")) {
74  phi_ = book1D("phi_", "#phi;#phi", phiPS.getParameter<int32_t>("nBin"),
75  phiPS.getParameter<double>("xMin"),
76  phiPS.getParameter<double>("xMax"));
77  }
78  if (chPS.getParameter<bool>("switchOn")) {
79  charge_ = book1D("charge_","charge;charge",chPS.getParameter<int32_t>("nBin"),
80  chPS.getParameter<double>("xMin"),
81  chPS.getParameter<double>("xMax"));
82  }
83  histogramBooked_ = true;
84  }
85 }
T getParameter(std::string const &) const
TH1F * book1D(const char *histname, const char *title, int nbins, float xmin, float xmax)
book a 1D histogram, either with DQM or plain root.
Definition: Benchmark.cc:25

Member Data Documentation

TH1F* CandidateBenchmark::charge_
protected

Definition at line 35 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

TH1F* CandidateBenchmark::eta_
protected

Definition at line 33 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

bool CandidateBenchmark::histogramBooked_
protected

Definition at line 39 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

TH1F* CandidateBenchmark::pdgId_
protected

COLIN add this histo.

Definition at line 37 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark().

TH1F* CandidateBenchmark::phi_
protected

Definition at line 34 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().

TH1F* CandidateBenchmark::pt_
protected

Definition at line 32 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark(), fillOne(), and setup().