CMS 3D CMS Logo

PFCandWithSuperClusterExtractor.cc
Go to the documentation of this file.
2 
9 
10 using namespace edm;
11 using namespace reco;
12 
14  thePFCandToken(iC.consumes<PFCandidateCollection>(par.getParameter<edm::InputTag>("inputCandView"))),
15  theDepositLabel(par.getUntrackedParameter<std::string>("DepositLabel")),
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 }
25 /*
26 reco::IsoDeposit::Vetos PFCandWithSuperClusterExtractor::vetos(const edm::Event & ev,
27  const edm::EventSetup & evSetup, const reco::Candidate & cand) const
28 {
29  reco::isodeposit::Direction dir(cand.eta(),cand.phi());
30  return reco::IsoDeposit::Vetos(1,veto(dir));
31 }
32 */
33 
35 {
37  result.vetoDir = dir;
38  result.dR = theDR_Veto;
39  return result;
40 }
41 
42 
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  const 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 }
70 
71 
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  const 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().numberOfLostHits(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 }
104 
105 
106 
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  const 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 }
132 
133 
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  const 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 }
161 
162 
163 
166 
167 
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:185
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
Definition: Photon.py:1
double eta() const final
momentum pseudorapidity
edm::EDGetTokenT< reco::PFCandidateCollection > thePFCandToken
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:645
double pt() const final
transverse momentum
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
const Point & vertex() const override
vertex position (overwritten by PF...)
Definition: PFCandidate.cc:656
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:687
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:651
double pt() const
track transverse momentum
Definition: TrackBase.h:621
const Point & vertex() const override
vertex position (overwritten by PF...)
math::XYZPoint Point
point in the space
Definition: Particle.h:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::IsoDeposit depositFromObject(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Photon &cand) const
reco::IsoDeposit::Veto veto(const reco::IsoDeposit::Direction &dir) const
double vz() const override
z coordinate of vertex position
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:669
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:40
fixed size matrix
HLT enums.
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:184
#define DEFINE_EDM_PLUGIN(factory, type, name)
dbl *** dir
Definition: mlp_gen.cc:35
reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const override
double phi() const final
momentum azimuthal angle
Definition: event.py:1
double vz() const override
z coordinate of vertex position
Definition: PFCandidate.h:416
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
Definition: PFCandidate.cc:609