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

#include <PFJetMonitor.h>

Inheritance diagram for PFJetMonitor:
Benchmark

Public Member Functions

template<class T , class C >
void fill (const T &jetCollection, const C &matchedJetCollection, float &minVal, float &maxVal)
 fill histograms with all particle More...
 
void fillOne (const reco::Jet &jet, const reco::Jet &matchedJet)
 
 PFJetMonitor (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 fracHistoFlag=true)
 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 ~PFJetMonitor ()
 
- 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 createPFractionHistos_
 
TH2F * delta_frac_VS_frac_charged_hadron_
 
TH2F * delta_frac_VS_frac_electron_
 
TH2F * delta_frac_VS_frac_muon_
 
TH2F * delta_frac_VS_frac_neutral_hadron_
 
TH2F * delta_frac_VS_frac_photon_
 
float dRMax_
 
bool histogramBooked_
 
MatchCandidateBenchmark matchCandBench_
 
bool matchCharge_
 
- 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 12 of file PFJetMonitor.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file PFJetMonitor.cc.

References createPFractionHistos_, delta_frac_VS_frac_charged_hadron_, delta_frac_VS_frac_electron_, delta_frac_VS_frac_muon_, delta_frac_VS_frac_neutral_hadron_, delta_frac_VS_frac_photon_, histogramBooked_, 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 
29 
30  createPFractionHistos_ = false;
31  histogramBooked_ = false;
32 }
bool histogramBooked_
Definition: PFJetMonitor.h:61
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:49
bool createPFractionHistos_
Definition: PFJetMonitor.h:60
TH2F * delta_frac_VS_frac_muon_
Definition: PFJetMonitor.h:52
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:50
TH2F * delta_frac_VS_frac_neutral_hadron_
Definition: PFJetMonitor.h:56
Benchmark(Mode mode=DEFAULT)
Definition: Benchmark.h:41
TH2F * delta_frac_VS_frac_photon_
Definition: PFJetMonitor.h:53
TH2F * delta_frac_VS_frac_electron_
Definition: PFJetMonitor.h:54
void setRange(float ptMin, float ptMax, float etaMin, float etaMax, float phiMin, float phiMax)
Definition: Benchmark.h:51
TH2F * delta_frac_VS_frac_charged_hadron_
Definition: PFJetMonitor.h:55
bool matchCharge_
Definition: PFJetMonitor.h:59
PFJetMonitor::~PFJetMonitor ( )
virtual

Definition at line 36 of file PFJetMonitor.cc.

36 {}

Member Function Documentation

template<class T , class C >
void PFJetMonitor::fill ( const T jetCollection,
const C &  matchedJetCollection,
float &  minVal,
float &  maxVal 
)

fill histograms with all particle

Definition at line 67 of file PFJetMonitor.h.

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

Referenced by PFJetDQMAnalyzer::analyze(), and PFRootEventManager::processEntry().

68  {
69 
70 
71  std::vector<int> matchIndices;
72  PFB::match( jetCollection, matchedJetCollection, matchIndices,
74 
75  for (unsigned int i = 0; i < (jetCollection).size(); i++) {
76  const reco::Jet& jet = jetCollection[i];
77 
78  if( !isInRange(jet.pt(), jet.eta(), jet.phi() ) ) continue;
79 
80  int iMatch = matchIndices[i];
81  assert(iMatch< static_cast<int>(matchedJetCollection.size()));
82 
83  if( iMatch!=-1 ) {
84  const reco::Candidate& matchedJet = matchedJetCollection[ iMatch ];
85  if(!isInRange(matchedJet.pt(),matchedJet.eta(),matchedJet.phi() ) ) continue;
86  float ptRes = (jet.pt() - matchedJet.pt())/matchedJet.pt();
87 
88  if (ptRes > maxVal) maxVal = ptRes;
89  if (ptRes < minVal) minVal = ptRes;
90 
91  candBench_.fillOne(jet);
92  matchCandBench_.fillOne(jet, matchedJetCollection[ iMatch ]);
93  if (createPFractionHistos_ && histogramBooked_) fillOne(jet, matchedJetCollection[ iMatch ]);
94  }
95  }
96 }
int i
Definition: DBlmapReader.cc:9
bool histogramBooked_
Definition: PFJetMonitor.h:61
void fillOne(const reco::Candidate &candidate, const reco::Candidate &matchedCandidate)
fill histograms with a given particle
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:49
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
Base class for all types of Jets.
Definition: Jet.h:21
bool createPFractionHistos_
Definition: PFJetMonitor.h:60
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:50
virtual double eta() const
momentum pseudorapidity
void fillOne(const reco::Jet &jet, const reco::Jet &matchedJet)
virtual double pt() const
transverse momentum
bool isInRange(float pt, float eta, float phi) const
Definition: Benchmark.h:58
virtual double phi() const
momentum azimuthal angle
tuple size
Write out results.
virtual double phi() const =0
momentum azimuthal angle
bool matchCharge_
Definition: PFJetMonitor.h:59
virtual double eta() const =0
momentum pseudorapidity
void PFJetMonitor::fillOne ( const reco::Jet jet,
const reco::Jet matchedJet 
)

Definition at line 135 of file PFJetMonitor.cc.

References reco::PFJet::chargedHadronMultiplicity(), createPFractionHistos_, delta_frac_VS_frac_charged_hadron_, delta_frac_VS_frac_electron_, delta_frac_VS_frac_muon_, delta_frac_VS_frac_neutral_hadron_, delta_frac_VS_frac_photon_, reco::PFJet::electronMultiplicity(), metsig::jet, reco::PFJet::muonMultiplicity(), reco::PFJet::neutralHadronMultiplicity(), and reco::PFJet::photonMultiplicity().

Referenced by fill().

136  {
137  const reco::PFJet* pfJet = dynamic_cast<const reco::PFJet*>(&jet);
138  const reco::PFJet* pfMatchedJet = dynamic_cast<const reco::PFJet*>(&matchedJet);
139  if (pfJet && pfMatchedJet && createPFractionHistos_) {
140  float frac_muon = -99.9;
141  float frac_elec = -99.9;
142  float frac_phot = -99.9;
143  float frac_ch_had = -99.9;
144  float frac_neu_had = -99.9;
145 
146  if (pfMatchedJet->muonMultiplicity() > 0) frac_muon = (pfJet->muonMultiplicity() - pfMatchedJet->muonMultiplicity())*1.0/pfMatchedJet->muonMultiplicity();
147  if (pfMatchedJet->chargedHadronMultiplicity() > 0) frac_ch_had = (pfJet->chargedHadronMultiplicity() - pfMatchedJet->chargedHadronMultiplicity())*1.0/pfMatchedJet->chargedHadronMultiplicity();
148  if (pfMatchedJet->neutralHadronMultiplicity() > 0) frac_neu_had = (pfJet->neutralHadronMultiplicity() - pfMatchedJet->neutralHadronMultiplicity())*1.0/pfMatchedJet->neutralHadronMultiplicity();
149  if (pfMatchedJet->photonMultiplicity() > 0) frac_phot = (pfJet->photonMultiplicity() - pfMatchedJet->photonMultiplicity())*1.0/pfMatchedJet->photonMultiplicity();
150  if (pfMatchedJet->electronMultiplicity() > 0) frac_elec = (pfJet->electronMultiplicity() - pfMatchedJet->electronMultiplicity())*1.0/pfMatchedJet->electronMultiplicity();
151 
152  delta_frac_VS_frac_muon_->Fill(frac_muon);
153  delta_frac_VS_frac_electron_->Fill(frac_elec);
154  delta_frac_VS_frac_photon_->Fill(frac_phot);
155  delta_frac_VS_frac_charged_hadron_->Fill(frac_ch_had);
156  delta_frac_VS_frac_neutral_hadron_->Fill(frac_neu_had);
157  }
158 }
int photonMultiplicity() const
photonMultiplicity
Definition: PFJet.h:124
bool createPFractionHistos_
Definition: PFJetMonitor.h:60
TH2F * delta_frac_VS_frac_muon_
Definition: PFJetMonitor.h:52
Jets made from PFObjects.
Definition: PFJet.h:22
TH2F * delta_frac_VS_frac_neutral_hadron_
Definition: PFJetMonitor.h:56
int neutralHadronMultiplicity() const
neutralHadronMultiplicity
Definition: PFJet.h:122
TH2F * delta_frac_VS_frac_photon_
Definition: PFJetMonitor.h:53
TH2F * delta_frac_VS_frac_electron_
Definition: PFJetMonitor.h:54
int chargedHadronMultiplicity() const
chargedHadronMultiplicity
Definition: PFJet.h:120
int muonMultiplicity() const
muonMultiplicity
Definition: PFJet.h:128
TH2F * delta_frac_VS_frac_charged_hadron_
Definition: PFJetMonitor.h:55
int electronMultiplicity() const
electronMultiplicity
Definition: PFJet.h:126
void PFJetMonitor::setDirectory ( TDirectory *  dir)
virtual

set directory (to use in ROOT)

Reimplemented from Benchmark.

Definition at line 126 of file PFJetMonitor.cc.

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

Referenced by PFRootEventManager::readOptions().

126  {
128 
131 }
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:49
virtual void setDirectory(TDirectory *dir)
Definition: Benchmark.cc:19
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:50
dbl *** dir
Definition: mlp_gen.cc:35
void PFJetMonitor::setParameters ( float  dRMax,
bool  matchCharge,
Benchmark::Mode  mode,
float  ptmin,
float  ptmax,
float  etamin,
float  etamax,
float  phimin,
float  phimax,
bool  fracHistoFlag = true 
)

set the parameters locally

Definition at line 62 of file PFJetMonitor.cc.

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

Referenced by PFJetDQMAnalyzer::PFJetDQMAnalyzer(), and PFRootEventManager::readOptions().

64  {
65  dRMax_ = dRMax;
66  matchCharge_ = matchCharge;
67  mode_ = mode;
68  createPFractionHistos_ = fracHistoFlag;
69 
70  setRange( ptmin, ptmax, etamin, etamax, phimin, phimax );
71 
74 
75 }
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:49
bool createPFractionHistos_
Definition: PFJetMonitor.h:60
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:50
void setParameters(Mode mode)
Definition: Benchmark.h:49
void setRange(float ptMin, float ptMax, float etaMin, float etaMax, float phiMin, float phiMax)
Definition: Benchmark.h:51
double ptmin
Definition: HydjetWrapper.h:86
Mode mode_
Definition: Benchmark.h:86
bool matchCharge_
Definition: PFJetMonitor.h:59
void PFJetMonitor::setParameters ( const edm::ParameterSet parameterSet)

set the parameters accessing them from ParameterSet

Definition at line 41 of file PFJetMonitor.cc.

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

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

book histograms

Definition at line 102 of file PFJetMonitor.cc.

References Benchmark::book2D(), candBench_, createPFractionHistos_, delta_frac_VS_frac_charged_hadron_, delta_frac_VS_frac_electron_, delta_frac_VS_frac_muon_, delta_frac_VS_frac_neutral_hadron_, delta_frac_VS_frac_photon_, histogramBooked_, matchCandBench_, CandidateBenchmark::setup(), and MatchCandidateBenchmark::setup().

Referenced by PFJetDQMAnalyzer::beginJob(), and PFRootEventManager::readOptions().

102  {
103  candBench_.setup();
105 
107  delta_frac_VS_frac_muon_ = book2D("delta_frac_VS_frac_muon_",
108  "#DeltaFraction_Vs_Fraction(muon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
109  delta_frac_VS_frac_photon_ = book2D("delta_frac_VS_frac_photon_",
110  "#DeltaFraction_Vs_Fraction(photon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
111  delta_frac_VS_frac_electron_ = book2D("delta_frac_VS_frac_electron_",
112  "#DeltaFraction_Vs_Fraction(electron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
113  delta_frac_VS_frac_charged_hadron_ = book2D("delta_frac_VS_frac_charged_hadron_",
114  "#DeltaFraction_Vs_Fraction(charged hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
115  delta_frac_VS_frac_neutral_hadron_ = book2D("delta_frac_VS_frac_neutral_hadron_",
116  "#DeltaFraction_Vs_Fraction(neutral hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
117 
118  histogramBooked_ = true;
119  }
120 
121 }
bool histogramBooked_
Definition: PFJetMonitor.h:61
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:49
void setup()
book histograms
void setup()
book histograms
bool createPFractionHistos_
Definition: PFJetMonitor.h:60
TH2F * delta_frac_VS_frac_muon_
Definition: PFJetMonitor.h:52
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:50
TH2F * delta_frac_VS_frac_neutral_hadron_
Definition: PFJetMonitor.h:56
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.
Definition: Benchmark.cc:43
TH2F * delta_frac_VS_frac_photon_
Definition: PFJetMonitor.h:53
TH2F * delta_frac_VS_frac_electron_
Definition: PFJetMonitor.h:54
TH2F * delta_frac_VS_frac_charged_hadron_
Definition: PFJetMonitor.h:55
void PFJetMonitor::setup ( const edm::ParameterSet parameterSet)

book histograms

Definition at line 79 of file PFJetMonitor.cc.

References Benchmark::book2D(), candBench_, createPFractionHistos_, delta_frac_VS_frac_charged_hadron_, delta_frac_VS_frac_electron_, delta_frac_VS_frac_muon_, delta_frac_VS_frac_neutral_hadron_, delta_frac_VS_frac_photon_, histogramBooked_, matchCandBench_, CandidateBenchmark::setup(), and MatchCandidateBenchmark::setup().

79  {
80  candBench_.setup(parameterSet);
81  matchCandBench_.setup(parameterSet);
82 
84  delta_frac_VS_frac_muon_ = book2D("delta_frac_VS_frac_muon_",
85  "#DeltaFraction_Vs_Fraction(muon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
86  delta_frac_VS_frac_photon_ = book2D("delta_frac_VS_frac_photon_",
87  "#DeltaFraction_Vs_Fraction(photon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
88  delta_frac_VS_frac_electron_ = book2D("delta_frac_VS_frac_electron_",
89  "#DeltaFraction_Vs_Fraction(electron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
90  delta_frac_VS_frac_charged_hadron_ = book2D("delta_frac_VS_frac_charged_hadron_",
91  "#DeltaFraction_Vs_Fraction(charged hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
92  delta_frac_VS_frac_neutral_hadron_ = book2D("delta_frac_VS_frac_neutral_hadron_",
93  "#DeltaFraction_Vs_Fraction(neutral hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
94 
95  histogramBooked_ = true;
96  }
97 
98 }
bool histogramBooked_
Definition: PFJetMonitor.h:61
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:49
void setup()
book histograms
void setup()
book histograms
bool createPFractionHistos_
Definition: PFJetMonitor.h:60
TH2F * delta_frac_VS_frac_muon_
Definition: PFJetMonitor.h:52
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:50
TH2F * delta_frac_VS_frac_neutral_hadron_
Definition: PFJetMonitor.h:56
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.
Definition: Benchmark.cc:43
TH2F * delta_frac_VS_frac_photon_
Definition: PFJetMonitor.h:53
TH2F * delta_frac_VS_frac_electron_
Definition: PFJetMonitor.h:54
TH2F * delta_frac_VS_frac_charged_hadron_
Definition: PFJetMonitor.h:55

Member Data Documentation

CandidateBenchmark PFJetMonitor::candBench_
protected

Definition at line 49 of file PFJetMonitor.h.

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

bool PFJetMonitor::createPFractionHistos_
protected

Definition at line 60 of file PFJetMonitor.h.

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

TH2F* PFJetMonitor::delta_frac_VS_frac_charged_hadron_
protected

Definition at line 55 of file PFJetMonitor.h.

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

TH2F* PFJetMonitor::delta_frac_VS_frac_electron_
protected

Definition at line 54 of file PFJetMonitor.h.

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

TH2F* PFJetMonitor::delta_frac_VS_frac_muon_
protected

Definition at line 52 of file PFJetMonitor.h.

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

TH2F* PFJetMonitor::delta_frac_VS_frac_neutral_hadron_
protected

Definition at line 56 of file PFJetMonitor.h.

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

TH2F* PFJetMonitor::delta_frac_VS_frac_photon_
protected

Definition at line 53 of file PFJetMonitor.h.

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

float PFJetMonitor::dRMax_
protected

Definition at line 58 of file PFJetMonitor.h.

Referenced by fill(), and setParameters().

bool PFJetMonitor::histogramBooked_
protected

Definition at line 61 of file PFJetMonitor.h.

Referenced by fill(), PFJetMonitor(), and setup().

MatchCandidateBenchmark PFJetMonitor::matchCandBench_
protected

Definition at line 50 of file PFJetMonitor.h.

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

bool PFJetMonitor::matchCharge_
protected

Definition at line 59 of file PFJetMonitor.h.

Referenced by fill(), and setParameters().