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
PFCandidateMonitor Class Reference

#include <PFCandidateMonitor.h>

Inheritance diagram for PFCandidateMonitor:
Benchmark

Public Member Functions

template<class T , class C >
void fill (const T &candidateCollection, const C &matchedCandCollection, float &minVal, float &maxVal)
 fill histograms with all particle More...
 
void fillOne (const reco::Candidate &cand)
 
 PFCandidateMonitor (float dRMax=0.3, bool matchCharge=true, Benchmark::Mode mode=Benchmark::DEFAULT)
 
void setDirectory (TDirectory *dir)
 set directory (to use in ROOT) More...
 
void setParameters (float dRMax, bool matchCharge, Benchmark::Mode mode, float ptmin, float ptmax, float etamin, float etamax, float phimin, float phimax, bool refHistoFlag)
 set the parameters locally More...
 
void setParameters (const edm::ParameterSet &parameterSet)
 set the parameters accessing them from ParameterSet More...
 
void setup ()
 book histograms More...
 
void setup (const edm::ParameterSet &parameterSet)
 book histograms More...
 
virtual ~PFCandidateMonitor ()
 
- Public Member Functions inherited from Benchmark
 Benchmark (Mode mode=DEFAULT)
 
bool isInRange (float pt, float eta, float phi) const
 
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

CandidateBenchmark candBench_
 
bool createReferenceHistos_
 
float dRMax_
 
TH1F * eta_ref_
 
bool histogramBooked_
 
MatchCandidateBenchmark matchCandBench_
 
bool matchCharge_
 
TH1F * phi_ref_
 
TH1F * pt_ref_
 
- 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...
 

Detailed Description

Definition at line 13 of file PFCandidateMonitor.h.

Constructor & Destructor Documentation

PFCandidateMonitor::PFCandidateMonitor ( float  dRMax = 0.3,
bool  matchCharge = true,
Benchmark::Mode  mode = Benchmark::DEFAULT 
)

Definition at line 15 of file PFCandidateMonitor.cc.

References createReferenceHistos_, eta_ref_, histogramBooked_, phi_ref_, pt_ref_, and Benchmark::setRange().

15  :
16  Benchmark(mode),
17  candBench_(mode),
19  dRMax_(dRMax),
20  matchCharge_(matchCharge) {
21 
22  setRange( 0.0, 10e10, -10.0, 10.0, -3.14, 3.14);
23 
24  pt_ref_ = 0;
25  eta_ref_ = 0;
26  phi_ref_ = 0;
27 
28  createReferenceHistos_ = false;
29  histogramBooked_ = false;
30 }
Benchmark(Mode mode=DEFAULT)
Definition: Benchmark.h:41
CandidateBenchmark candBench_
void setRange(float ptMin, float ptMax, float etaMin, float etaMax, float phiMin, float phiMax)
Definition: Benchmark.h:51
MatchCandidateBenchmark matchCandBench_
PFCandidateMonitor::~PFCandidateMonitor ( )
virtual

Definition at line 34 of file PFCandidateMonitor.cc.

34 {}

Member Function Documentation

template<class T , class C >
void PFCandidateMonitor::fill ( const T candidateCollection,
const C &  matchedCandCollection,
float &  minVal,
float &  maxVal 
)

fill histograms with all particle

Definition at line 65 of file PFCandidateMonitor.h.

References candBench_, createReferenceHistos_, dRMax_, reco::Candidate::eta(), CandidateBenchmark::fillOne(), MatchCandidateBenchmark::fillOne(), fillOne(), i, Benchmark::isInRange(), PFB::match(), matchCandBench_, matchCharge_, reco::Candidate::phi(), reco::Candidate::pt(), and findQualityFiles::size.

Referenced by PFCandidateDQMAnalyzer::analyze().

66  {
67 
68 
69  std::vector<int> matchIndices;
70  PFB::match( candCollection, matchedCandCollection, matchIndices,
72 
73  for (unsigned int i = 0; i < (candCollection).size(); i++) {
74  const reco::Candidate& cand = candCollection[i];
75 
76  if( !isInRange(cand.pt(), cand.eta(), cand.phi() ) ) continue;
77 
78  int iMatch = matchIndices[i];
79  assert(iMatch< static_cast<int>(matchedCandCollection.size()));
80 
81  if( iMatch!=-1 ) {
82  const reco::Candidate& matchedCand = matchedCandCollection[ iMatch ];
83  if(!isInRange(matchedCand.pt(),matchedCand.eta(),matchedCand.phi() ) ) continue;
84  float ptRes = (cand.pt() - matchedCand.pt())/matchedCand.pt();
85 
86  if (ptRes > maxVal) maxVal = ptRes;
87  if (ptRes < minVal) minVal = ptRes;
88 
89  candBench_.fillOne(cand);
90  matchCandBench_.fillOne(cand, matchedCand);
91  if (createReferenceHistos_) fillOne(matchedCand);
92  }
93  }
94 }
int i
Definition: DBlmapReader.cc:9
void fillOne(const reco::Candidate &candidate, const reco::Candidate &matchedCandidate)
fill histograms with a given particle
void match(const C &candCollection, const M &matchedCandCollection, std::vector< int > &matchIndices, bool matchCharge=false, float dRMax=-1)
Definition: Matchers.h:13
virtual double pt() const =0
transverse momentum
void fillOne(const reco::Candidate &candidate)
fill histograms with a given particle
CandidateBenchmark candBench_
void fillOne(const reco::Candidate &cand)
MatchCandidateBenchmark matchCandBench_
bool isInRange(float pt, float eta, float phi) const
Definition: Benchmark.h:58
tuple size
Write out results.
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity
void PFCandidateMonitor::fillOne ( const reco::Candidate cand)

Definition at line 136 of file PFCandidateMonitor.cc.

References createReferenceHistos_, reco::Candidate::eta(), eta_ref_, histogramBooked_, reco::Candidate::phi(), phi_ref_, reco::Candidate::pt(), and pt_ref_.

Referenced by fill().

136  {
137 
139 
140  if (pt_ref_) pt_ref_->Fill(cand.pt());
141  if (eta_ref_) eta_ref_->Fill(cand.eta() );
142  if (phi_ref_) phi_ref_->Fill(cand.phi() );
143  }
144 }
virtual double pt() const =0
transverse momentum
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity
void PFCandidateMonitor::setDirectory ( TDirectory *  dir)
virtual

set directory (to use in ROOT)

Reimplemented from Benchmark.

Definition at line 127 of file PFCandidateMonitor.cc.

References candBench_, matchCandBench_, and Benchmark::setDirectory().

127  {
129 
132 }
virtual void setDirectory(TDirectory *dir)
Definition: Benchmark.cc:19
CandidateBenchmark candBench_
MatchCandidateBenchmark matchCandBench_
dbl *** dir
Definition: mlp_gen.cc:35
void PFCandidateMonitor::setParameters ( float  dRMax,
bool  matchCharge,
Benchmark::Mode  mode,
float  ptmin,
float  ptmax,
float  etamin,
float  etamax,
float  phimin,
float  phimax,
bool  refHistoFlag 
)

set the parameters locally

Definition at line 60 of file PFCandidateMonitor.cc.

References candBench_, createReferenceHistos_, dRMax_, matchCandBench_, matchCharge_, alignBH_cfg::mode, Benchmark::mode_, Benchmark::setParameters(), and Benchmark::setRange().

Referenced by PFCandidateDQMAnalyzer::PFCandidateDQMAnalyzer().

62  {
63  dRMax_ = dRMax;
64  matchCharge_ = matchCharge;
65  mode_ = mode;
66  createReferenceHistos_ = refHistoFlag;
67 
68  setRange( ptmin, ptmax, etamin, etamax, phimin, phimax );
69 
72 }
void setParameters(Mode mode)
Definition: Benchmark.h:49
CandidateBenchmark candBench_
void setRange(float ptMin, float ptMax, float etaMin, float etaMax, float phiMin, float phiMax)
Definition: Benchmark.h:51
double ptmin
Definition: HydjetWrapper.h:86
MatchCandidateBenchmark matchCandBench_
Mode mode_
Definition: Benchmark.h:86
void PFCandidateMonitor::setParameters ( const edm::ParameterSet parameterSet)

set the parameters accessing them from ParameterSet

Definition at line 39 of file PFCandidateMonitor.cc.

References candBench_, createReferenceHistos_, dRMax_, edm::ParameterSet::getParameter(), matchCandBench_, matchCharge_, Benchmark::mode_, Benchmark::setParameters(), and Benchmark::setRange().

39  {
40 
41  dRMax_ = parameterSet.getParameter<double>( "deltaRMax" );
42  matchCharge_ = parameterSet.getParameter<bool>( "matchCharge" );
43  mode_ = (Benchmark::Mode) parameterSet.getParameter<int>( "mode" );
44  createReferenceHistos_ = parameterSet.getParameter<bool>( "CreateReferenceHistos" );
45 
46 
47  setRange( parameterSet.getParameter<double>("ptMin"),
48  parameterSet.getParameter<double>("ptMax"),
49  parameterSet.getParameter<double>("etaMin"),
50  parameterSet.getParameter<double>("etaMax"),
51  parameterSet.getParameter<double>("phiMin"),
52  parameterSet.getParameter<double>("phiMax") );
53 
56 }
T getParameter(std::string const &) const
void setParameters(Mode mode)
Definition: Benchmark.h:49
CandidateBenchmark candBench_
void setRange(float ptMin, float ptMax, float etaMin, float etaMax, float phiMin, float phiMax)
Definition: Benchmark.h:51
MatchCandidateBenchmark matchCandBench_
Mode mode_
Definition: Benchmark.h:86
void PFCandidateMonitor::setup ( void  )

book histograms

Definition at line 106 of file PFCandidateMonitor.cc.

References Benchmark::book1D(), candBench_, createReferenceHistos_, eta_ref_, histogramBooked_, Benchmark::PhaseSpace::m, Benchmark::PhaseSpace::M, matchCandBench_, Benchmark::PhaseSpace::n, phi_ref_, pt_ref_, CandidateBenchmark::setup(), and MatchCandidateBenchmark::setup().

Referenced by PFCandidateDQMAnalyzer::beginJob().

106  {
107  candBench_.setup();
109 
111  PhaseSpace ptPS(100,0,100);
112  PhaseSpace phiPS(360, -3.1416, 3.1416);
113  PhaseSpace etaPS(100, -5,5);
114 
115  pt_ref_ = book1D("pt_ref_", "pt_ref_;p_{T} (GeV)", ptPS.n, ptPS.m, ptPS.M);
116 
117  eta_ref_ = book1D("eta_ref_", "eta_ref_;#eta", etaPS.n, etaPS.m, etaPS.M);
118 
119  phi_ref_ = book1D("phi_ref_", "phi_ref_;#phi", phiPS.n, phiPS.m, phiPS.M);
120 
121  histogramBooked_ = true;
122  }
123 }
void setup()
book histograms
void setup()
book histograms
CandidateBenchmark candBench_
MatchCandidateBenchmark matchCandBench_
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 PFCandidateMonitor::setup ( const edm::ParameterSet parameterSet)

book histograms

Definition at line 76 of file PFCandidateMonitor.cc.

References Benchmark::book1D(), candBench_, createReferenceHistos_, eta_ref_, edm::ParameterSet::getParameter(), histogramBooked_, matchCandBench_, phi_ref_, pt_ref_, CandidateBenchmark::setup(), and MatchCandidateBenchmark::setup().

76  {
77  candBench_.setup(parameterSet);
78  matchCandBench_.setup(parameterSet);
79 
81  edm::ParameterSet ptPS = parameterSet.getParameter<edm::ParameterSet>("PtHistoParameter");
82  edm::ParameterSet etaPS = parameterSet.getParameter<edm::ParameterSet>("EtaHistoParameter");
83  edm::ParameterSet phiPS = parameterSet.getParameter<edm::ParameterSet>("PhiHistoParameter");
84  if (ptPS.getParameter<bool>("switchOn")) {
85  pt_ref_ = book1D("pt_ref_", "pt_ref_;p_{T} (GeV)", ptPS.getParameter<int32_t>("nBin"),
86  ptPS.getParameter<double>("xMin"),
87  ptPS.getParameter<double>("xMax"));
88  }
89 
90  if (etaPS.getParameter<bool>("switchOn")) {
91  eta_ref_ = book1D("eta_ref_", "eta_ref_;#eta_ref_", etaPS.getParameter<int32_t>("nBin"),
92  etaPS.getParameter<double>("xMin"),
93  etaPS.getParameter<double>("xMax"));
94  }
95  if (phiPS.getParameter<bool>("switchOn")) {
96  phi_ref_ = book1D("phi_ref_", "phi_ref_;#phref_i", phiPS.getParameter<int32_t>("nBin"),
97  phiPS.getParameter<double>("xMin"),
98  phiPS.getParameter<double>("xMax"));
99  }
100  histogramBooked_ = true;
101  }
102 }
T getParameter(std::string const &) const
void setup()
book histograms
void setup()
book histograms
CandidateBenchmark candBench_
MatchCandidateBenchmark matchCandBench_
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

CandidateBenchmark PFCandidateMonitor::candBench_
protected

Definition at line 49 of file PFCandidateMonitor.h.

Referenced by fill(), setDirectory(), setParameters(), and setup().

bool PFCandidateMonitor::createReferenceHistos_
protected

Definition at line 58 of file PFCandidateMonitor.h.

Referenced by fill(), fillOne(), PFCandidateMonitor(), setParameters(), and setup().

float PFCandidateMonitor::dRMax_
protected

Definition at line 56 of file PFCandidateMonitor.h.

Referenced by fill(), and setParameters().

TH1F* PFCandidateMonitor::eta_ref_
protected

Definition at line 53 of file PFCandidateMonitor.h.

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

bool PFCandidateMonitor::histogramBooked_
protected

Definition at line 59 of file PFCandidateMonitor.h.

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

MatchCandidateBenchmark PFCandidateMonitor::matchCandBench_
protected

Definition at line 50 of file PFCandidateMonitor.h.

Referenced by fill(), setDirectory(), setParameters(), and setup().

bool PFCandidateMonitor::matchCharge_
protected

Definition at line 57 of file PFCandidateMonitor.h.

Referenced by fill(), and setParameters().

TH1F* PFCandidateMonitor::phi_ref_
protected

Definition at line 54 of file PFCandidateMonitor.h.

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

TH1F* PFCandidateMonitor::pt_ref_
protected

Definition at line 52 of file PFCandidateMonitor.h.

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