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 (const edm::ParameterSet &parameterSet)
 set the parameters 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_
 
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 
)
inline

Definition at line 16 of file PFJetMonitor.h.

19  :
20  Benchmark(mode),
22  dRMax_(dRMax), matchCharge_(matchCharge) {}
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:48
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:49
Benchmark(Mode mode=DEFAULT)
Definition: Benchmark.h:41
int mode
Definition: AMPTWrapper.h:139
bool matchCharge_
Definition: PFJetMonitor.h:58
PFJetMonitor::~PFJetMonitor ( )
virtual

Definition at line 13 of file PFJetMonitor.cc.

13 {}

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 65 of file PFJetMonitor.h.

References candBench_, createPFractionHistos_, dRMax_, reco::Candidate::eta(), reco::LeafCandidate::eta(), MatchCandidateBenchmark::fillOne(), CandidateBenchmark::fillOne(), fillOne(), 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().

66  {
67 
68 
69  std::vector<int> matchIndices;
70  PFB::match( jetCollection, matchedJetCollection, matchIndices,
72 
73  for (unsigned int i = 0; i < (jetCollection).size(); i++) {
74  const reco::Jet& jet = jetCollection[i];
75 
76  if( !isInRange(jet.pt(), jet.eta(), jet.phi() ) ) continue;
77 
78  int iMatch = matchIndices[i];
79  assert(iMatch< static_cast<int>(matchedJetCollection.size()));
80 
81  if( iMatch!=-1 ) {
82  const reco::Candidate& matchedJet = matchedJetCollection[ iMatch ];
83  if(!isInRange(matchedJet.pt(),matchedJet.eta(),matchedJet.phi() ) ) continue;
84  float ptRes = (jet.pt() - matchedJet.pt())/matchedJet.pt();
85 
86  if (ptRes > maxVal) maxVal = ptRes;
87  if (ptRes < minVal) minVal = ptRes;
88 
89  candBench_.fillOne(jet);
90  matchCandBench_.fillOne(jet, matchedJetCollection[ iMatch ]);
91  if (createPFractionHistos_) fillOne(jet, matchedJetCollection[ iMatch ]);
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
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:48
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:59
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:49
virtual double eta() const
momentum pseudorapidity
void fillOne(const reco::Jet &jet, const reco::Jet &matchedJet)
Definition: PFJetMonitor.cc:78
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:58
virtual double eta() const =0
momentum pseudorapidity
void PFJetMonitor::fillOne ( const reco::Jet jet,
const reco::Jet matchedJet 
)

Definition at line 78 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().

79  {
80 
81  const reco::PFJet* pfJet = dynamic_cast<const reco::PFJet*>(&jet);
82  const reco::PFJet* pfMatchedJet = dynamic_cast<const reco::PFJet*>(&matchedJet);
83  if (pfJet && pfMatchedJet && createPFractionHistos_) {
84  float frac_muon = -99.9;
85  float frac_elec = -99.9;
86  float frac_phot = -99.9;
87  float frac_ch_had = -99.9;
88  float frac_neu_had = -99.9;
89 
90  if (pfMatchedJet->muonMultiplicity() > 0) frac_muon = (pfJet->muonMultiplicity() - pfMatchedJet->muonMultiplicity())*1.0/pfMatchedJet->muonMultiplicity();
91  if (pfMatchedJet->chargedHadronMultiplicity() > 0) frac_ch_had = (pfJet->chargedHadronMultiplicity() - pfMatchedJet->chargedHadronMultiplicity())*1.0/pfMatchedJet->chargedHadronMultiplicity();
92  if (pfMatchedJet->neutralHadronMultiplicity() > 0) frac_neu_had = (pfJet->neutralHadronMultiplicity() - pfMatchedJet->neutralHadronMultiplicity())*1.0/pfMatchedJet->neutralHadronMultiplicity();
93  if (pfMatchedJet->photonMultiplicity() > 0) frac_phot = (pfJet->photonMultiplicity() - pfMatchedJet->photonMultiplicity())*1.0/pfMatchedJet->photonMultiplicity();
94  if (pfMatchedJet->electronMultiplicity() > 0) frac_elec = (pfJet->electronMultiplicity() - pfMatchedJet->electronMultiplicity())*1.0/pfMatchedJet->electronMultiplicity();
95 
96  delta_frac_VS_frac_muon_->Fill(frac_muon);
97  delta_frac_VS_frac_electron_->Fill(frac_elec);
98  delta_frac_VS_frac_photon_->Fill(frac_phot);
99  delta_frac_VS_frac_charged_hadron_->Fill(frac_ch_had);
100  delta_frac_VS_frac_neutral_hadron_->Fill(frac_neu_had);
101  }
102 }
int photonMultiplicity() const
photonMultiplicity
Definition: PFJet.h:124
bool createPFractionHistos_
Definition: PFJetMonitor.h:59
TH2F * delta_frac_VS_frac_muon_
Definition: PFJetMonitor.h:51
Jets made from PFObjects.
Definition: PFJet.h:22
TH2F * delta_frac_VS_frac_neutral_hadron_
Definition: PFJetMonitor.h:55
int neutralHadronMultiplicity() const
neutralHadronMultiplicity
Definition: PFJet.h:122
TH2F * delta_frac_VS_frac_photon_
Definition: PFJetMonitor.h:52
TH2F * delta_frac_VS_frac_electron_
Definition: PFJetMonitor.h:53
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:54
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 71 of file PFJetMonitor.cc.

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

71  {
73 
76 }
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:48
virtual void setDirectory(TDirectory *dir)
Definition: Benchmark.cc:19
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:49
dbl *** dir
Definition: mlp_gen.cc:35
void PFJetMonitor::setParameters ( const edm::ParameterSet parameterSet)

set the parameters

Definition at line 16 of file PFJetMonitor.cc.

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

Referenced by PFJetDQMAnalyzer::PFJetDQMAnalyzer().

16  {
17 
18  dRMax_ = parameterSet.getParameter<double>( "deltaRMax" );
19  matchCharge_ = parameterSet.getParameter<bool>( "matchCharge" );
20  mode_ = (Benchmark::Mode) parameterSet.getParameter<int>( "mode" );
21  createPFractionHistos_ = parameterSet.getParameter<bool>( "CreatePFractionHistos" );
22 
23 
24  setRange( parameterSet.getParameter<double>("ptMin"),
25  parameterSet.getParameter<double>("ptMax"),
26  parameterSet.getParameter<double>("etaMin"),
27  parameterSet.getParameter<double>("etaMax"),
28  parameterSet.getParameter<double>("phiMin"),
29  parameterSet.getParameter<double>("phiMax") );
30 
33 }
T getParameter(std::string const &) const
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:48
bool createPFractionHistos_
Definition: PFJetMonitor.h:59
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:49
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:58
void PFJetMonitor::setup ( void  )

book histograms

Definition at line 53 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_, matchCandBench_, CandidateBenchmark::setup(), and MatchCandidateBenchmark::setup().

Referenced by PFJetDQMAnalyzer::beginJob().

53  {
54  candBench_.setup();
56 
58  delta_frac_VS_frac_muon_ = book2D("delta_frac_VS_frac_muon_",
59  "#DeltaFraction_Vs_Fraction(muon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
60  delta_frac_VS_frac_photon_ = book2D("delta_frac_VS_frac_photon_",
61  "#DeltaFraction_Vs_Fraction(photon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
62  delta_frac_VS_frac_electron_ = book2D("delta_frac_VS_frac_electron_",
63  "#DeltaFraction_Vs_Fraction(electron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
64  delta_frac_VS_frac_charged_hadron_ = book2D("delta_frac_VS_frac_charged_hadron_",
65  "#DeltaFraction_Vs_Fraction(charged hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
66  delta_frac_VS_frac_neutral_hadron_ = book2D("delta_frac_VS_frac_neutral_hadron_",
67  "#DeltaFraction_Vs_Fraction(neutral hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
68  }
69 
70 }
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:48
void setup()
book histograms
void setup()
book histograms
bool createPFractionHistos_
Definition: PFJetMonitor.h:59
TH2F * delta_frac_VS_frac_muon_
Definition: PFJetMonitor.h:51
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:49
TH2F * delta_frac_VS_frac_neutral_hadron_
Definition: PFJetMonitor.h:55
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:52
TH2F * delta_frac_VS_frac_electron_
Definition: PFJetMonitor.h:53
TH2F * delta_frac_VS_frac_charged_hadron_
Definition: PFJetMonitor.h:54
void PFJetMonitor::setup ( const edm::ParameterSet parameterSet)

book histograms

Definition at line 35 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_, matchCandBench_, CandidateBenchmark::setup(), and MatchCandidateBenchmark::setup().

35  {
36  candBench_.setup(parameterSet);
37  matchCandBench_.setup(parameterSet);
38 
40  delta_frac_VS_frac_muon_ = book2D("delta_frac_VS_frac_muon_",
41  "#DeltaFraction_Vs_Fraction(muon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
42  delta_frac_VS_frac_photon_ = book2D("delta_frac_VS_frac_photon_",
43  "#DeltaFraction_Vs_Fraction(photon)", 100, 0.0, 1.0, 100, -1.0, 1.0);
44  delta_frac_VS_frac_electron_ = book2D("delta_frac_VS_frac_electron_",
45  "#DeltaFraction_Vs_Fraction(electron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
46  delta_frac_VS_frac_charged_hadron_ = book2D("delta_frac_VS_frac_charged_hadron_",
47  "#DeltaFraction_Vs_Fraction(charged hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
48  delta_frac_VS_frac_neutral_hadron_ = book2D("delta_frac_VS_frac_neutral_hadron_",
49  "#DeltaFraction_Vs_Fraction(neutral hadron)", 100, 0.0, 1.0, 100, -1.0, 1.0);
50  }
51 
52 }
CandidateBenchmark candBench_
Definition: PFJetMonitor.h:48
void setup()
book histograms
void setup()
book histograms
bool createPFractionHistos_
Definition: PFJetMonitor.h:59
TH2F * delta_frac_VS_frac_muon_
Definition: PFJetMonitor.h:51
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:49
TH2F * delta_frac_VS_frac_neutral_hadron_
Definition: PFJetMonitor.h:55
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:52
TH2F * delta_frac_VS_frac_electron_
Definition: PFJetMonitor.h:53
TH2F * delta_frac_VS_frac_charged_hadron_
Definition: PFJetMonitor.h:54

Member Data Documentation

CandidateBenchmark PFJetMonitor::candBench_
protected

Definition at line 48 of file PFJetMonitor.h.

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

bool PFJetMonitor::createPFractionHistos_
protected

Definition at line 59 of file PFJetMonitor.h.

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

TH2F* PFJetMonitor::delta_frac_VS_frac_charged_hadron_
protected

Definition at line 54 of file PFJetMonitor.h.

Referenced by fillOne(), and setup().

TH2F* PFJetMonitor::delta_frac_VS_frac_electron_
protected

Definition at line 53 of file PFJetMonitor.h.

Referenced by fillOne(), and setup().

TH2F* PFJetMonitor::delta_frac_VS_frac_muon_
protected

Definition at line 51 of file PFJetMonitor.h.

Referenced by fillOne(), and setup().

TH2F* PFJetMonitor::delta_frac_VS_frac_neutral_hadron_
protected

Definition at line 55 of file PFJetMonitor.h.

Referenced by fillOne(), and setup().

TH2F* PFJetMonitor::delta_frac_VS_frac_photon_
protected

Definition at line 52 of file PFJetMonitor.h.

Referenced by fillOne(), and setup().

float PFJetMonitor::dRMax_
protected

Definition at line 57 of file PFJetMonitor.h.

Referenced by fill(), and setParameters().

MatchCandidateBenchmark PFJetMonitor::matchCandBench_
protected

Definition at line 49 of file PFJetMonitor.h.

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

bool PFJetMonitor::matchCharge_
protected

Definition at line 58 of file PFJetMonitor.h.

Referenced by fill(), and setParameters().