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 (DQMStore::IBooker &b)
 book histograms More...
 
void setup (DQMStore::IBooker &b, const edm::ParameterSet &parameterSet)
 
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 }
 
- Protected Member Functions inherited from Benchmark
TH1F * book1D (DQMStore::IBooker &b, const char *histname, const char *title, int nbins, float xmin, float xmax)
 book a 1D histogram, either with DQM or plain root depending if DQM_ has been initialized in a child analyzer or not. More...
 
TH2F * book2D (DQMStore::IBooker &b, 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 depending if DQM_ has been initialized in a child analyzer or not. More...
 
TH2F * book2D (DQMStore::IBooker &b, 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 depending if DQM_ has been initialized in a child analyzer or not. More...
 
TProfile * bookProfile (DQMStore::IBooker &b, 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 depending if DQM_ has been initialized in a child analyzer or not. More...
 
TProfile * bookProfile (DQMStore::IBooker &b, 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 depending if DQM_ has been initialized in a child analyzer or not. 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:41
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 42 of file CandidateBenchmark.h.

References fillOne(), and i.

Referenced by CandidateBenchmarkAnalyzer::analyze().

42  {
43 
44  for (unsigned int i = 0; i < candCollection.size(); i++) {
45  const reco::Candidate& cand = candCollection[i];
46  fillOne(cand);
47  }
48 }
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 84 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().

84  {
85 
86  if( !isInRange(cand.pt(), cand.eta(), cand.phi() ) ) return;
87 
88  if (histogramBooked_) {
89  if (pt_) pt_->Fill( cand.pt() );
90  if (eta_) eta_->Fill( cand.eta() );
91  if (phi_) phi_->Fill( cand.phi() );
92  if (charge_) charge_->Fill( cand.charge() );
93  }
94 }
bool isInRange(float pt, float eta, float phi) const
Definition: Benchmark.h:58
void CandidateBenchmark::setup ( DQMStore::IBooker b)

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::bookHistograms(), 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(b, "pt_", "pt_;p_{T} (GeV)", ptPS.n, ptPS.m, ptPS.M);
45  eta_ = book1D(b, "eta_", "eta_;#eta", etaPS.n, etaPS.m, etaPS.M);
46  phi_ = book1D(b, "phi_", "phi_;#phi", phiPS.n, phiPS.m, phiPS.M);
47  charge_ = book1D(b, "charge_", "charge_;charge", 3,-1.5,1.5);
48 
49  histogramBooked_ = true;
50  }
51 }
TH1F * book1D(DQMStore::IBooker &b, const char *histname, const char *title, int nbins, float xmin, float xmax)
book a 1D histogram, either with DQM or plain root depending if DQM_ has been initialized in a child ...
Definition: Benchmark.cc:23
Mode mode_
Definition: Benchmark.h:105
void CandidateBenchmark::setup ( DQMStore::IBooker b,
const edm::ParameterSet parameterSet 
)

Definition at line 53 of file CandidateBenchmark.cc.

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

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

Member Data Documentation

TH1F* CandidateBenchmark::charge_
protected

Definition at line 34 of file CandidateBenchmark.h.

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

TH1F* CandidateBenchmark::eta_
protected

Definition at line 32 of file CandidateBenchmark.h.

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

bool CandidateBenchmark::histogramBooked_
protected

Definition at line 38 of file CandidateBenchmark.h.

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

TH1F* CandidateBenchmark::pdgId_
protected

COLIN add this histo.

Definition at line 36 of file CandidateBenchmark.h.

Referenced by CandidateBenchmark().

TH1F* CandidateBenchmark::phi_
protected

Definition at line 33 of file CandidateBenchmark.h.

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

TH1F* CandidateBenchmark::pt_
protected

Definition at line 31 of file CandidateBenchmark.h.

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