CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFJetMonitor.h
Go to the documentation of this file.
1 #ifndef DQMOffline_PFTau_PFJetMonitor_h
2 #define DQMOffline_PFTau_PFJetMonitor_h
3 
8 
10 
11 #include <vector>
12 class PFJetMonitor : public Benchmark {
13 
14  public:
15 
16 
17  PFJetMonitor( float dRMax = 0.3, bool matchCharge = true,
19 
20  virtual ~PFJetMonitor();
21 
23  void setParameters(float dRMax, bool matchCharge,
24  Benchmark::Mode mode,float ptmin,
25  float ptmax, float etamin, float etamax,
26  float phimin, float phimax, bool fracHistoFlag=true);
27 
29  void setParameters( const edm::ParameterSet& parameterSet);
30 
32  void setDirectory(TDirectory* dir);
33 
35  void setup();
36 
38  void setup(const edm::ParameterSet & parameterSet);
39 
41  template< class T, class C>
42  void fill(const T& jetCollection,
43  const C& matchedJetCollection, float& minVal, float& maxVal);
44 
45  void fillOne(const reco::Jet& jet,
46  const reco::Jet& matchedJet);
47 
48  protected:
51 
57 
58  float dRMax_;
62 
63 };
64 
66 template< class T, class C>
67 void PFJetMonitor::fill(const T& jetCollection,
68  const C& matchedJetCollection, float& minVal, float& maxVal) {
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 }
97 #endif
int i
Definition: DBlmapReader.cc:9
bool histogramBooked_
Definition: PFJetMonitor.h:61
To plot Candidate quantities.
void fillOne(const reco::Candidate &candidate, const reco::Candidate &matchedCandidate)
fill histograms with a given particle
To plot Candidate quantities.
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
void setDirectory(TDirectory *dir)
set directory (to use in ROOT)
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
void fill(const T &jetCollection, const C &matchedJetCollection, float &minVal, float &maxVal)
fill histograms with all particle
Definition: PFJetMonitor.h:67
abstract base class
Definition: Benchmark.h:20
bool createPFractionHistos_
Definition: PFJetMonitor.h:60
TH2F * delta_frac_VS_frac_muon_
Definition: PFJetMonitor.h:52
MatchCandidateBenchmark matchCandBench_
Definition: PFJetMonitor.h:50
virtual double eta() const
momentum pseudorapidity
virtual ~PFJetMonitor()
Definition: PFJetMonitor.cc:36
TH2F * delta_frac_VS_frac_neutral_hadron_
Definition: PFJetMonitor.h:56
void setup()
book histograms
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
Definition: PFJetMonitor.cc:62
PFJetMonitor(float dRMax=0.3, bool matchCharge=true, Benchmark::Mode mode=Benchmark::DEFAULT)
Definition: PFJetMonitor.cc:15
void fillOne(const reco::Jet &jet, const reco::Jet &matchedJet)
TH2F * delta_frac_VS_frac_photon_
Definition: PFJetMonitor.h:53
TH2F * delta_frac_VS_frac_electron_
Definition: PFJetMonitor.h:54
virtual double pt() const
transverse momentum
double ptmin
Definition: HydjetWrapper.h:86
TH2F * delta_frac_VS_frac_charged_hadron_
Definition: PFJetMonitor.h:55
dbl *** dir
Definition: mlp_gen.cc:35
bool isInRange(float pt, float eta, float phi) const
Definition: Benchmark.h:58
long double T
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