test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFCandWithSuperClusterExtractor Class Reference

#include <PFCandWithSuperClusterExtractor.h>

Inheritance diagram for PFCandWithSuperClusterExtractor:
reco::isodeposit::IsoDepositExtractor

Public Member Functions

virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const
 
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &cand) const
 
virtual void fillVetos (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &cand)
 
 PFCandWithSuperClusterExtractor ()
 
 PFCandWithSuperClusterExtractor (const edm::ParameterSet &par, edm::ConsumesCollector &&iC)
 
virtual ~PFCandWithSuperClusterExtractor ()
 
- Public Member Functions inherited from reco::isodeposit::IsoDepositExtractor
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 make single IsoDeposit based on trackRef as input More...
 
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 make single IsoDeposit based on a CandidateBaseRef as input More...
 
virtual std::vector
< reco::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
 
virtual std::vector
< reco::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 
virtual std::vector
< reco::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &track) const
 
virtual std::vector
< reco::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 
virtual void initEvent (const edm::Event &, const edm::EventSetup &)
 perform some constly initialization More...
 
virtual ~IsoDepositExtractor ()
 Destructor. More...
 

Private Member Functions

reco::IsoDeposit depositFromObject (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Photon &cand) const
 
reco::IsoDeposit depositFromObject (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::GsfElectron &cand) const
 
reco::IsoDeposit depositFromObject (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &cand) const
 
reco::IsoDeposit depositFromObject (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::PFCandidate &cand) const
 
reco::IsoDeposit::Veto veto (const reco::IsoDeposit::Direction &dir) const
 

Private Attributes

std::string theDepositLabel
 
double theDiff_r
 
double theDiff_z
 
double theDR_Max
 
double theDR_Veto
 
bool theMissHitVetoSuperClusterMatch
 
edm::EDGetTokenT
< reco::PFCandidateCollection
thePFCandToken
 
bool theVetoSuperClusterMatch
 

Detailed Description

Definition at line 22 of file PFCandWithSuperClusterExtractor.h.

Constructor & Destructor Documentation

PFCandWithSuperClusterExtractor::PFCandWithSuperClusterExtractor ( )
inline

Definition at line 26 of file PFCandWithSuperClusterExtractor.h.

26 {};
PFCandWithSuperClusterExtractor::PFCandWithSuperClusterExtractor ( const edm::ParameterSet par,
edm::ConsumesCollector &&  iC 
)

Definition at line 13 of file PFCandWithSuperClusterExtractor.cc.

13  :
16  theVetoSuperClusterMatch(par.getParameter<bool>("SCMatch_Veto")),
17  theMissHitVetoSuperClusterMatch(par.getParameter<bool>("MissHitSCMatch_Veto")),
18  theDiff_r(par.getParameter<double>("Diff_r")),
19  theDiff_z(par.getParameter<double>("Diff_z")),
20  theDR_Max(par.getParameter<double>("DR_Max")),
21  theDR_Veto(par.getParameter<double>("DR_Veto"))
22 {
23  // std::cout << " Loading PFCandWithSuperClusterExtractor " << std::endl;
24 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< reco::PFCandidateCollection > thePFCandToken
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
virtual PFCandWithSuperClusterExtractor::~PFCandWithSuperClusterExtractor ( )
inlinevirtual

Definition at line 29 of file PFCandWithSuperClusterExtractor.h.

29 {}

Member Function Documentation

virtual reco::IsoDeposit PFCandWithSuperClusterExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const
inlinevirtual

make single IsoDeposit based on track as input purely virtual: have to implement in concrete implementations

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 35 of file PFCandWithSuperClusterExtractor.h.

References depositFromObject().

Referenced by depositFromObject().

36  {
37  return depositFromObject(ev, evSetup, muon);
38  }
reco::IsoDeposit depositFromObject(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Photon &cand) const
virtual reco::IsoDeposit PFCandWithSuperClusterExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Candidate track 
) const
inlinevirtual

make single IsoDeposit based on a candidate as input purely virtual: have to implement in concrete implementations

Reimplemented from reco::isodeposit::IsoDepositExtractor.

Definition at line 40 of file PFCandWithSuperClusterExtractor.h.

References depositFromObject().

41  {
42 
43  const reco::Photon * myPhoton= dynamic_cast<const reco::Photon*>(&cand);
44  if(myPhoton)
45  return depositFromObject(ev, evSetup,*myPhoton);
46 
47  const reco::GsfElectron * myElectron = dynamic_cast<const reco::GsfElectron*>(&cand);
48  if(myElectron)
49  return depositFromObject(ev,evSetup,*myElectron);
50 
51  const reco::PFCandidate * myPFCand = dynamic_cast<const reco::PFCandidate*>(&cand);
52  return depositFromObject(ev, evSetup,*myPFCand);
53  }
reco::IsoDeposit depositFromObject(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Photon &cand) const
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
IsoDeposit PFCandWithSuperClusterExtractor::depositFromObject ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Photon cand 
) const
private

Definition at line 43 of file PFCandWithSuperClusterExtractor.cc.

References funct::abs(), deltaR(), deposit(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, eta, reco::LeafCandidate::eta(), edm::Ref< C, T, F >::isNonnull(), phi, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::Photon::superCluster(), theDiff_r, theDiff_z, theDR_Max, theDR_Veto, thePFCandToken, theVetoSuperClusterMatch, reco::LeafCandidate::vertex(), veto(), and reco::LeafCandidate::vz().

Referenced by deposit().

44 {
45  reco::isodeposit::Direction candDir(cand.eta(), cand.phi());
46  IsoDeposit deposit(candDir );
47  deposit.setVeto( veto(candDir) );
48  deposit.addCandEnergy(cand.pt());
49 
51  event.getByToken(thePFCandToken, PFCandH);
52 
53  double eta = cand.eta(), phi = cand.phi();
54  reco::Particle::Point vtx = cand.vertex();
55  for (PFCandidateCollection::const_iterator it = PFCandH->begin(), ed = PFCandH->end(); it != ed; ++it) {
56  double dR = deltaR(it->eta(), it->phi(), eta, phi);
57  // veto SC
58  if (theVetoSuperClusterMatch && cand.superCluster().isNonnull() && it->superClusterRef().isNonnull() && cand.superCluster() == it->superClusterRef()) continue;
59  if ( (dR < theDR_Max) && (dR > theDR_Veto) &&
60  (std::abs(it->vz() - cand.vz()) < theDiff_z) &&
61  ((it->vertex() - vtx).Rho() < theDiff_r)) {
62  // ok
63  reco::isodeposit::Direction dirTrk(it->eta(), it->phi());
64  deposit.addDeposit(dirTrk, it->pt());
65  }
66  }
67 
68  return deposit;
69 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:80
edm::EDGetTokenT< reco::PFCandidateCollection > thePFCandToken
virtual const Point & vertex() const
vertex position (overwritten by PF...)
virtual double phi() const final
momentum azimuthal angle
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:23
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:139
math::XYZPoint Point
point in the space
Definition: Particle.h:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual double vz() const
z coordinate of vertex position
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual double eta() const final
momentum pseudorapidity
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const
virtual double pt() const final
transverse momentum
IsoDeposit PFCandWithSuperClusterExtractor::depositFromObject ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::GsfElectron cand 
) const
private

Definition at line 72 of file PFCandWithSuperClusterExtractor.cc.

References funct::abs(), deltaR(), deposit(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, eta, reco::LeafCandidate::eta(), reco::GsfElectron::gsfTrack(), edm::Ref< C, T, F >::isNonnull(), reco::HitPattern::MISSING_INNER_HITS, phi, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::GsfElectron::superCluster(), theDiff_r, theDiff_z, theDR_Max, theDR_Veto, theMissHitVetoSuperClusterMatch, thePFCandToken, reco::LeafCandidate::vertex(), veto(), and reco::LeafCandidate::vz().

73 {
74  reco::isodeposit::Direction candDir(cand.eta(), cand.phi());
75  IsoDeposit deposit(candDir );
76  deposit.setVeto( veto(candDir) );
77  deposit.addCandEnergy(cand.pt());
78 
80  event.getByToken(thePFCandToken, PFCandH);
81 
82  double eta = cand.eta(), phi = cand.phi();
83  reco::Particle::Point vtx = cand.vertex();
84  for (PFCandidateCollection::const_iterator it = PFCandH->begin(), ed = PFCandH->end(); it != ed; ++it) {
85  double dR = deltaR(it->eta(), it->phi(), eta, phi);
86  // If MissHits>0 (possibly reconstructed as a photon in the PF in this case, kill the the photon if sharing the same SC)
87  if (cand.gsfTrack()->hitPattern().numberOfHits(reco::HitPattern::MISSING_INNER_HITS) > 0
88  && theMissHitVetoSuperClusterMatch && it->mva_nothing_gamma() > 0.99
89  && cand.superCluster().isNonnull() && it->superClusterRef().isNonnull()
90  && cand.superCluster() == it->superClusterRef()){
91  continue;
92  }
93  if ((dR < theDR_Max) && (dR > theDR_Veto)
94  && (std::abs(it->vz() - cand.vz()) < theDiff_z)
95  && ((it->vertex() - vtx).Rho() < theDiff_r)) {
96  // ok
97  reco::isodeposit::Direction dirTrk(it->eta(), it->phi());
98  deposit.addDeposit(dirTrk, it->pt());
99  }
100  }
101 
102  return deposit;
103 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:80
edm::EDGetTokenT< reco::PFCandidateCollection > thePFCandToken
virtual const Point & vertex() const
vertex position (overwritten by PF...)
virtual double phi() const final
momentum azimuthal angle
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:23
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:182
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:139
math::XYZPoint Point
point in the space
Definition: Particle.h:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual double vz() const
z coordinate of vertex position
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual double eta() const final
momentum pseudorapidity
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:183
virtual double pt() const final
transverse momentum
IsoDeposit PFCandWithSuperClusterExtractor::depositFromObject ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track cand 
) const
private

Definition at line 107 of file PFCandWithSuperClusterExtractor.cc.

References funct::abs(), deltaR(), deposit(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, eta, reco::TrackBase::eta(), phi, reco::TrackBase::phi(), reco::TrackBase::pt(), theDiff_r, theDiff_z, theDR_Max, theDR_Veto, thePFCandToken, reco::TrackBase::vertex(), veto(), and reco::TrackBase::vz().

108 {
109  reco::isodeposit::Direction candDir(cand.eta(), cand.phi());
110  IsoDeposit deposit(candDir );
111  deposit.setVeto( veto(candDir) );
112  deposit.addCandEnergy(cand.pt());
114  event.getByToken(thePFCandToken, PFCandH);
115 
116  double eta = cand.eta(), phi = cand.phi();
117  reco::Particle::Point vtx = cand.vertex();
118  for (PFCandidateCollection::const_iterator it = PFCandH->begin(), ed = PFCandH->end(); it != ed; ++it) {
119  double dR = deltaR(it->eta(), it->phi(), eta, phi);
120 
121  if ( (dR < theDR_Max) && (dR > theDR_Veto) &&
122  (std::abs(it->vz() - cand.vz()) < theDiff_z) &&
123  ((it->vertex() - vtx).Rho() < theDiff_r)) {
124  // ok
125  reco::isodeposit::Direction dirTrk(it->eta(), it->phi());
126  deposit.addDeposit(dirTrk, it->pt());
127  }
128  }
129 
130  return deposit;
131 }
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:80
edm::EDGetTokenT< reco::PFCandidateCollection > thePFCandToken
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:640
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:23
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:682
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:646
double pt() const
track transverse momentum
Definition: TrackBase.h:616
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:139
math::XYZPoint Point
point in the space
Definition: Particle.h:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:664
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const
IsoDeposit PFCandWithSuperClusterExtractor::depositFromObject ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::PFCandidate cand 
) const
private

Definition at line 134 of file PFCandWithSuperClusterExtractor.cc.

References funct::abs(), deltaR(), deposit(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, eta, reco::LeafCandidate::eta(), edm::Ref< C, T, F >::isNonnull(), phi, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::PFCandidate::superClusterRef(), theDiff_r, theDiff_z, theDR_Max, theDR_Veto, thePFCandToken, theVetoSuperClusterMatch, reco::PFCandidate::vertex(), veto(), and reco::PFCandidate::vz().

135 {
136  reco::isodeposit::Direction candDir(cand.eta(), cand.phi());
137  IsoDeposit deposit(candDir );
138  deposit.setVeto( veto(candDir) );
139  deposit.addCandEnergy(cand.pt());
141  event.getByToken(thePFCandToken, PFCandH);
142 
143  double eta = cand.eta(), phi = cand.phi();
144  reco::Particle::Point vtx = cand.vertex();
145  for (PFCandidateCollection::const_iterator it = PFCandH->begin(), ed = PFCandH->end(); it != ed; ++it) {
146  // veto SC
147  if (theVetoSuperClusterMatch && cand.superClusterRef().isNonnull() && it->superClusterRef().isNonnull() && cand.superClusterRef() == it->superClusterRef()) continue;
148  double dR = deltaR(it->eta(), it->phi(), eta, phi);
149 
150  if ( (dR < theDR_Max) && (dR > theDR_Veto) &&
151  (std::abs(it->vz() - cand.vz()) < theDiff_z) &&
152  ((it->vertex() - vtx).Rho() < theDiff_r)) {
153  // ok
154  reco::isodeposit::Direction dirTrk(it->eta(), it->phi());
155  deposit.addDeposit(dirTrk, it->pt());
156  }
157  }
158 
159  return deposit;
160 }
virtual double vz() const
z coordinate of vertex position
Definition: PFCandidate.h:415
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
void setVeto(const Veto &aVeto)
Set veto.
Definition: IsoDeposit.h:80
edm::EDGetTokenT< reco::PFCandidateCollection > thePFCandToken
virtual double phi() const final
momentum azimuthal angle
void addDeposit(double dr, double deposit)
Add deposit (ie. transverse energy or pT)
Definition: IsoDeposit.cc:23
void addCandEnergy(double et)
Set energy or pT attached to cand trajectory.
Definition: IsoDeposit.h:139
math::XYZPoint Point
point in the space
Definition: Particle.h:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual const Point & vertex() const
vertex position (overwritten by PF...)
Definition: PFCandidate.cc:647
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual double eta() const final
momentum pseudorapidity
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const
virtual double pt() const final
transverse momentum
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
Definition: PFCandidate.cc:600
virtual void PFCandWithSuperClusterExtractor::fillVetos ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::TrackCollection tracks 
)
inlinevirtual

fill vetoes: to exclude deposits at IsoDeposit creation stage check concrete extractors if it's no-op !

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 31 of file PFCandWithSuperClusterExtractor.h.

32  { }
reco::IsoDeposit::Veto PFCandWithSuperClusterExtractor::veto ( const reco::IsoDeposit::Direction dir) const
private

Member Data Documentation

std::string PFCandWithSuperClusterExtractor::theDepositLabel
private

Definition at line 72 of file PFCandWithSuperClusterExtractor.h.

double PFCandWithSuperClusterExtractor::theDiff_r
private

Definition at line 75 of file PFCandWithSuperClusterExtractor.h.

Referenced by depositFromObject().

double PFCandWithSuperClusterExtractor::theDiff_z
private

Definition at line 76 of file PFCandWithSuperClusterExtractor.h.

Referenced by depositFromObject().

double PFCandWithSuperClusterExtractor::theDR_Max
private

Definition at line 77 of file PFCandWithSuperClusterExtractor.h.

Referenced by depositFromObject().

double PFCandWithSuperClusterExtractor::theDR_Veto
private

Definition at line 78 of file PFCandWithSuperClusterExtractor.h.

Referenced by depositFromObject(), and veto().

bool PFCandWithSuperClusterExtractor::theMissHitVetoSuperClusterMatch
private

Definition at line 74 of file PFCandWithSuperClusterExtractor.h.

Referenced by depositFromObject().

edm::EDGetTokenT<reco::PFCandidateCollection> PFCandWithSuperClusterExtractor::thePFCandToken
private

Definition at line 71 of file PFCandWithSuperClusterExtractor.h.

Referenced by depositFromObject().

bool PFCandWithSuperClusterExtractor::theVetoSuperClusterMatch
private

Definition at line 73 of file PFCandWithSuperClusterExtractor.h.

Referenced by depositFromObject().