CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFCandWithSuperClusterExtractor.cc
Go to the documentation of this file.
2 
9 
10 using namespace edm;
11 using namespace reco;
12 
14  thePFCandTag(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.getByLabel(thePFCandTag, 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 }
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.getByLabel(thePFCandTag, 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()->trackerExpectedHitsInner().numberOfHits()>0 && theMissHitVetoSuperClusterMatch &&
88  it->mva_nothing_gamma() > 0.99 && cand.superCluster().isNonnull()
89  && it->superClusterRef().isNonnull()
90  && cand.superCluster() == it->superClusterRef()) continue;
91  if ( (dR < theDR_Max) && (dR > theDR_Veto) &&
92  (std::abs(it->vz() - cand.vz()) < theDiff_z) &&
93  ((it->vertex() - vtx).Rho() < theDiff_r)) {
94  // ok
95  reco::isodeposit::Direction dirTrk(it->eta(), it->phi());
96  deposit.addDeposit(dirTrk, it->pt());
97  }
98  }
99 
100  return deposit;
101 }
102 
103 
104 
106 {
107  reco::isodeposit::Direction candDir(cand.eta(), cand.phi());
108  IsoDeposit deposit(candDir );
109  deposit.setVeto( veto(candDir) );
110  deposit.addCandEnergy(cand.pt());
112  event.getByLabel(thePFCandTag, PFCandH);
113 
114  double eta = cand.eta(), phi = cand.phi();
115  reco::Particle::Point vtx = cand.vertex();
116  for (PFCandidateCollection::const_iterator it = PFCandH->begin(), ed = PFCandH->end(); it != ed; ++it) {
117  double dR = deltaR(it->eta(), it->phi(), eta, phi);
118 
119  if ( (dR < theDR_Max) && (dR > theDR_Veto) &&
120  (std::abs(it->vz() - cand.vz()) < theDiff_z) &&
121  ((it->vertex() - vtx).Rho() < theDiff_r)) {
122  // ok
123  reco::isodeposit::Direction dirTrk(it->eta(), it->phi());
124  deposit.addDeposit(dirTrk, it->pt());
125  }
126  }
127 
128  return deposit;
129 }
130 
131 
133 {
134  reco::isodeposit::Direction candDir(cand.eta(), cand.phi());
135  IsoDeposit deposit(candDir );
136  deposit.setVeto( veto(candDir) );
137  deposit.addCandEnergy(cand.pt());
139  event.getByLabel(thePFCandTag, PFCandH);
140 
141  double eta = cand.eta(), phi = cand.phi();
142  reco::Particle::Point vtx = cand.vertex();
143  for (PFCandidateCollection::const_iterator it = PFCandH->begin(), ed = PFCandH->end(); it != ed; ++it) {
144  // veto SC
145  if (theVetoSuperClusterMatch && cand.superClusterRef().isNonnull() && it->superClusterRef().isNonnull() && cand.superClusterRef() == it->superClusterRef()) continue;
146  double dR = deltaR(it->eta(), it->phi(), eta, phi);
147 
148  if ( (dR < theDR_Max) && (dR > theDR_Veto) &&
149  (std::abs(it->vz() - cand.vz()) < theDiff_z) &&
150  ((it->vertex() - vtx).Rho() < theDiff_r)) {
151  // ok
152  reco::isodeposit::Direction dirTrk(it->eta(), it->phi());
153  deposit.addDeposit(dirTrk, it->pt());
154  }
155  }
156 
157  return deposit;
158 }
159 
160 
161 
164 
165 
virtual double vz() const
z coordinate of vertex position
Definition: PFCandidate.h:377
virtual const Point & vertex() const
vertex position
#define abs(x)
Definition: mlp_lapack.h:159
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
Definition: Photon.cc:59
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:139
T eta() const
virtual double eta() const
momentum pseudorapidity
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:168
double pt() const
track transverse momentum
Definition: TrackBase.h:131
tuple result
Definition: query.py:137
math::XYZPoint Point
point in the space
Definition: Particle.h:29
virtual const Point & vertex() const
vertex position
Definition: PFCandidate.cc:546
reco::IsoDeposit depositFromObject(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Photon &cand) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
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
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:156
double vz() const
z coordinate of the reference point on track
Definition: TrackBase.h:147
virtual double pt() const
transverse momentum
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:33
#define DEFINE_EDM_PLUGIN(factory, type, name)
dbl *** dir
Definition: mlp_gen.cc:35
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &muon) const
virtual double phi() const
momentum azimuthal angle
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
reco::SuperClusterRef superClusterRef() const
return a reference to the corresponding SuperCluster if any
Definition: PFCandidate.cc:502
Definition: DDAxes.h:10