CMS 3D CMS Logo

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

#include <ConversionTools.h>

Public Member Functions

 ConversionTools ()
 

Static Public Member Functions

static bool hasMatchedConversion (const reco::GsfElectron &ele, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
 
static bool hasMatchedConversion (const reco::TrackRef &trk, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
 
static bool hasMatchedConversion (const reco::SuperCluster &sc, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, float dRMax=0.1, float dEtaMax=999., float dPhiMax=999., float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
 
static bool hasMatchedPromptElectron (const reco::SuperClusterRef &sc, const edm::Handle< reco::GsfElectronCollection > &eleCol, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
 
static bool isGoodConversion (const reco::Conversion &conv, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
 
static reco::ConversionRef matchedConversion (const reco::GsfElectron &ele, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
 
static reco::ConversionRef matchedConversion (const reco::TrackRef &trk, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
 
static reco::ConversionRef matchedConversion (const reco::SuperCluster &sc, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, float dRMax=0.1, float dEtaMax=999., float dPhiMax=999., float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
 
static reco::GsfElectronRef matchedPromptElectron (const reco::SuperClusterRef &sc, const edm::Handle< reco::GsfElectronCollection > &eleCol, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
 
static bool matchesConversion (const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true, bool allowAmbiguousGsfMatch=false)
 
static bool matchesConversion (const reco::SuperCluster &sc, const reco::Conversion &conv, float dRMax=0.1, float dEtaMax=999., float dPhiMax=999.)
 
static bool matchesConversion (const edm::RefToBase< reco::Track > &trk, const reco::Conversion &conv)
 
static bool matchesConversion (const reco::TrackRef &trk, const reco::Conversion &conv)
 
static bool matchesConversion (const reco::GsfTrackRef &trk, const reco::Conversion &conv)
 

Detailed Description

Definition at line 36 of file ConversionTools.h.

Constructor & Destructor Documentation

ConversionTools::ConversionTools ( )
inline

Definition at line 39 of file ConversionTools.h.

39 {}

Member Function Documentation

bool ConversionTools::hasMatchedConversion ( const reco::GsfElectron ele,
const edm::Handle< reco::ConversionCollection > &  convCol,
const math::XYZPoint beamspot,
bool  allowCkfMatch = true,
float  lxyMin = 2.0,
float  probMin = 1e-6,
unsigned int  nHitsBeforeVtxMax = 0 
)
static

Definition at line 149 of file ConversionTools.cc.

Referenced by DQMExample_Step1::MediumEle(), GsfEleConversionVetoCut::operator()(), SoftPFElectronTagInfoProducer::produce(), pat::PATElectronProducer::produce(), and EgammaCutBasedEleId::TestWP().

152 {
153  //check if a given electron candidate matches to at least one conversion candidate in the
154  //collection which also passes the selection cuts, optionally match with the closestckf track in
155  //in addition to just the gsf track (enabled in default arguments)
156 
157  for (ConversionCollection::const_iterator it = convCol->begin(); it!=convCol->end(); ++it) {
158  if (!matchesConversion(ele, *it, allowCkfMatch)) continue;
159  if (!isGoodConversion(*it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
160 
161  return true;
162  }
163 
164  return false;
165 
166 }
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true, bool allowAmbiguousGsfMatch=false)
static bool isGoodConversion(const reco::Conversion &conv, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
bool ConversionTools::hasMatchedConversion ( const reco::TrackRef trk,
const edm::Handle< reco::ConversionCollection > &  convCol,
const math::XYZPoint beamspot,
float  lxyMin = 2.0,
float  probMin = 1e-6,
unsigned int  nHitsBeforeVtxMax = 1 
)
static

Definition at line 169 of file ConversionTools.cc.

References edm::Ref< C, T, F >::isNull().

172 {
173  //check if a given track matches to at least one conversion candidate in the
174  //collection which also passes the selection cuts
175 
176  if (trk.isNull()) return false;
177 
178  for (ConversionCollection::const_iterator it = convCol->begin(); it!=convCol->end(); ++it) {
179  if (!matchesConversion(trk, *it)) continue;
180  if (!isGoodConversion(*it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
181 
182  return true;
183  }
184 
185  return false;
186 
187 }
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true, bool allowAmbiguousGsfMatch=false)
bool isNull() const
Checks for null.
Definition: Ref.h:247
static bool isGoodConversion(const reco::Conversion &conv, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
bool ConversionTools::hasMatchedConversion ( const reco::SuperCluster sc,
const edm::Handle< reco::ConversionCollection > &  convCol,
const math::XYZPoint beamspot,
float  dRMax = 0.1,
float  dEtaMax = 999.,
float  dPhiMax = 999.,
float  lxyMin = 2.0,
float  probMin = 1e-6,
unsigned int  nHitsBeforeVtxMax = 1 
)
static

Definition at line 190 of file ConversionTools.cc.

193 {
194 
195  //check if a given SuperCluster matches to at least one conversion candidate in the
196  //collection which also passes the selection cuts
197 
198  for (ConversionCollection::const_iterator it = convCol->begin(); it!=convCol->end(); ++it) {
199  if (!matchesConversion(sc, *it)) continue;
200  if (!isGoodConversion(*it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
201 
202  return true;
203  }
204 
205  return false;
206 
207 }
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true, bool allowAmbiguousGsfMatch=false)
static bool isGoodConversion(const reco::Conversion &conv, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
bool ConversionTools::hasMatchedPromptElectron ( const reco::SuperClusterRef sc,
const edm::Handle< reco::GsfElectronCollection > &  eleCol,
const edm::Handle< reco::ConversionCollection > &  convCol,
const math::XYZPoint beamspot,
float  lxyMin = 2.0,
float  probMin = 1e-6,
unsigned int  nHitsBeforeVtxMax = 0 
)
static

Definition at line 296 of file ConversionTools.cc.

References edm::Ref< C, T, F >::isNull().

Referenced by pat::PATPhotonProducer::produce().

298 {
299 
300  //check if a given SuperCluster matches to at least one GsfElectron having zero expected inner hits
301  //and not matching any conversion in the collection passing the quality cuts
302 
303  if (sc.isNull()) return false;
304 
305  for (GsfElectronCollection::const_iterator it = eleCol->begin(); it!=eleCol->end(); ++it) {
306  //match electron to supercluster
307  if (it->reco::GsfElectron::superCluster()!=sc) continue;
308 
309  //check expected inner hits
310  if (it->gsfTrack()->trackerExpectedHitsInner().numberOfHits()>0) continue;
311 
312  //check if electron is matching to a conversion
313  if (hasMatchedConversion(*it,convCol,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
314 
315 
316  return true;
317  }
318 
319  return false;
320 
321 
322 }
bool isNull() const
Checks for null.
Definition: Ref.h:247
static bool hasMatchedConversion(const reco::GsfElectron &ele, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
bool ConversionTools::isGoodConversion ( const reco::Conversion conv,
const math::XYZPoint beamspot,
float  lxyMin = 2.0,
float  probMin = 1e-6,
unsigned int  nHitsBeforeVtxMax = 1 
)
static

Definition at line 18 of file ConversionTools.cc.

References reco::Vertex::chi2(), reco::Conversion::conversionVertex(), reco::Vertex::isValid(), lxy(), reco::Vertex::ndof(), reco::Conversion::nHitsBeforeVtx(), reco::Conversion::refittedPairMomentum(), reco::Vertex::x(), and reco::Vertex::y().

19 {
20 
21  //Check if a given conversion candidate passes the conversion selection cuts
22 
23  const reco::Vertex &vtx = conv.conversionVertex();
24 
25  //vertex validity
26  if (!vtx.isValid()) return false;
27 
28  //fit probability
29  if (TMath::Prob( vtx.chi2(), vtx.ndof() )<probMin) return false;
30 
31  //compute transverse decay length
33  double dbsx = vtx.x() - beamspot.x();
34  double dbsy = vtx.y() - beamspot.y();
35  double lxy = (mom.x()*dbsx + mom.y()*dbsy)/mom.rho();
36 
37  //transverse decay length
38  if ( lxy<lxyMin )
39  return false;
40 
41  //loop through daughters to check nhitsbeforevtx
42  for (std::vector<uint8_t>::const_iterator it = conv.nHitsBeforeVtx().begin(); it!=conv.nHitsBeforeVtx().end(); ++it) {
43  if ( (*it)>nHitsBeforeVtxMax ) return false;
44  }
45 
46  return true;
47 }
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:97
double lxy(const math::XYZPoint &myBeamSpot, const Conversion &conv)
double y() const
y coordinate
Definition: Vertex.h:110
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:60
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
Definition: Conversion.cc:248
double chi2() const
chi-squares
Definition: Vertex.h:95
double ndof() const
Definition: Vertex.h:102
double x() const
x coordinate
Definition: Vertex.h:108
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
const std::vector< uint8_t > & nHitsBeforeVtx() const
Vector of the number of hits before the vertex along each track trajector.
Definition: Conversion.h:161
reco::ConversionRef ConversionTools::matchedConversion ( const reco::GsfElectron ele,
const edm::Handle< reco::ConversionCollection > &  convCol,
const math::XYZPoint beamspot,
bool  allowCkfMatch = true,
float  lxyMin = 2.0,
float  probMin = 1e-6,
unsigned int  nHitsBeforeVtxMax = 0 
)
static

Definition at line 211 of file ConversionTools.cc.

References edm::match(), and rho.

Referenced by ElectronConversionRejectionValidator::analyze().

214 {
215  //check if a given electron candidate matches to at least one conversion candidate in the
216  //collection which also passes the selection cuts, optionally match with the closestckf track in
217  //in addition to just the gsf track (enabled in default arguments)
218  //If multiple conversions are found, returned reference corresponds to minimum
219  //conversion radius
220 
222 
223  double minRho = 999.;
224  for (ConversionCollection::const_iterator it = convCol->begin(); it!=convCol->end(); ++it) {
225  float rho = it->conversionVertex().position().rho();
226  if (rho>minRho) continue;
227  if (!matchesConversion(ele, *it, allowCkfMatch)) continue;
228  if (!isGoodConversion(*it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
229 
230  minRho = rho;
231  match = ConversionRef(convCol,it-convCol->begin());
232  }
233 
234  return match;
235 
236 }
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true, bool allowAmbiguousGsfMatch=false)
Definition: DDAxes.h:10
static bool isGoodConversion(const reco::Conversion &conv, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
edm::Ref< ConversionCollection > ConversionRef
reference to an object in a collection of Conversion objects
Definition: ConversionFwd.h:15
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
reco::ConversionRef ConversionTools::matchedConversion ( const reco::TrackRef trk,
const edm::Handle< reco::ConversionCollection > &  convCol,
const math::XYZPoint beamspot,
float  lxyMin = 2.0,
float  probMin = 1e-6,
unsigned int  nHitsBeforeVtxMax = 1 
)
static

Definition at line 239 of file ConversionTools.cc.

References edm::Ref< C, T, F >::isNull(), edm::match(), and rho.

242 {
243  //check if a given track matches to at least one conversion candidate in the
244  //collection which also passes the selection cuts
245  //If multiple conversions are found, returned reference corresponds to minimum
246  //conversion radius
247 
249 
250  if (trk.isNull()) return match;
251 
252  double minRho = 999.;
253  for (ConversionCollection::const_iterator it = convCol->begin(); it!=convCol->end(); ++it) {
254  float rho = it->conversionVertex().position().rho();
255  if (rho>minRho) continue;
256  if (!matchesConversion(trk, *it)) continue;
257  if (!isGoodConversion(*it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
258 
259  minRho = rho;
260  match = ConversionRef(convCol,it-convCol->begin());
261  }
262 
263  return match;
264 
265 }
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true, bool allowAmbiguousGsfMatch=false)
Definition: DDAxes.h:10
bool isNull() const
Checks for null.
Definition: Ref.h:247
static bool isGoodConversion(const reco::Conversion &conv, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
edm::Ref< ConversionCollection > ConversionRef
reference to an object in a collection of Conversion objects
Definition: ConversionFwd.h:15
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
reco::ConversionRef ConversionTools::matchedConversion ( const reco::SuperCluster sc,
const edm::Handle< reco::ConversionCollection > &  convCol,
const math::XYZPoint beamspot,
float  dRMax = 0.1,
float  dEtaMax = 999.,
float  dPhiMax = 999.,
float  lxyMin = 2.0,
float  probMin = 1e-6,
unsigned int  nHitsBeforeVtxMax = 1 
)
static

Definition at line 268 of file ConversionTools.cc.

References edm::match(), and rho.

271 {
272 
273  //check if a given SuperCluster matches to at least one conversion candidate in the
274  //collection which also passes the selection cuts
275  //If multiple conversions are found, returned reference corresponds to minimum
276  //conversion radius
277 
279 
280  double minRho = 999.;
281  for (ConversionCollection::const_iterator it = convCol->begin(); it!=convCol->end(); ++it) {
282  float rho = it->conversionVertex().position().rho();
283  if (rho>minRho) continue;
284  if (!matchesConversion(sc, *it, dRMax,dEtaMax,dPhiMax)) continue;
285  if (!isGoodConversion(*it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
286 
287  minRho = rho;
288  match = ConversionRef(convCol,it-convCol->begin());
289  }
290 
291  return match;
292 
293 }
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true, bool allowAmbiguousGsfMatch=false)
Definition: DDAxes.h:10
static bool isGoodConversion(const reco::Conversion &conv, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
edm::Ref< ConversionCollection > ConversionRef
reference to an object in a collection of Conversion objects
Definition: ConversionFwd.h:15
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
reco::GsfElectronRef ConversionTools::matchedPromptElectron ( const reco::SuperClusterRef sc,
const edm::Handle< reco::GsfElectronCollection > &  eleCol,
const edm::Handle< reco::ConversionCollection > &  convCol,
const math::XYZPoint beamspot,
float  lxyMin = 2.0,
float  probMin = 1e-6,
unsigned int  nHitsBeforeVtxMax = 0 
)
static

Definition at line 326 of file ConversionTools.cc.

References edm::Ref< C, T, F >::isNull(), and edm::match().

328 {
329 
330  //check if a given SuperCluster matches to at least one GsfElectron having zero expected inner hits
331  //and not matching any conversion in the collection passing the quality cuts
332 
334 
335  if (sc.isNull()) return match;
336 
337  for (GsfElectronCollection::const_iterator it = eleCol->begin(); it!=eleCol->end(); ++it) {
338  //match electron to supercluster
339  if (it->reco::GsfElectron::superCluster()!=sc) continue;
340 
341  //check expected inner hits
342  if (it->gsfTrack()->trackerExpectedHitsInner().numberOfHits()>0) continue;
343 
344  //check if electron is matching to a conversion
345  if (hasMatchedConversion(*it,convCol,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
346 
347 
348  match = GsfElectronRef(eleCol,it-eleCol->begin());
349  }
350 
351  return match;
352 
353 
354 }
bool isNull() const
Checks for null.
Definition: Ref.h:247
static bool hasMatchedConversion(const reco::GsfElectron &ele, const edm::Handle< reco::ConversionCollection > &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
edm::Ref< GsfElectronCollection > GsfElectronRef
reference to an object in a collection of GsfElectron objects
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:6
bool ConversionTools::matchesConversion ( const reco::GsfElectron ele,
const reco::Conversion conv,
bool  allowCkfMatch = true,
bool  allowAmbiguousGsfMatch = false 
)
static

Definition at line 50 of file ConversionTools.cc.

References reco::GsfElectron::ambiguousGsfTracksBegin(), reco::GsfElectron::ambiguousGsfTracksEnd(), and reco::Conversion::tracks().

Referenced by PF_PU_AssoMapAlgos::ComesFromConversion(), pat::PATConversionProducer::produce(), and ReducedEGProducer::produce().

51 {
52 
53  //check if a given GsfElectron matches a given conversion (no quality cuts applied)
54  //matching is always attempted through the gsf track ref, and optionally attempted through the
55  //closest ctf track ref
56 
57  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
58  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
59  if ( ele.reco::GsfElectron::gsfTrack().isNonnull() && ele.reco::GsfElectron::gsfTrack().id()==it->id() && ele.reco::GsfElectron::gsfTrack().key()==it->key()) return true;
60  else if ( allowCkfMatch && ele.reco::GsfElectron::closestCtfTrackRef().isNonnull() && ele.reco::GsfElectron::closestCtfTrackRef().id()==it->id() && ele.reco::GsfElectron::closestCtfTrackRef().key()==it->key() ) return true;
61  if (allowAmbiguousGsfMatch) {
63  if (tk->isNonnull() && tk->id()==it->id() && tk->key()==it->key()) return true;
64  }
65  }
66  }
67 
68  return false;
69 }
GsfTrackRefVector::const_iterator ambiguousGsfTracksBegin() const
Definition: GsfElectron.h:634
GsfTrackRefVector::const_iterator ambiguousGsfTracksEnd() const
Definition: GsfElectron.h:635
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:176
bool ConversionTools::matchesConversion ( const reco::SuperCluster sc,
const reco::Conversion conv,
float  dRMax = 0.1,
float  dEtaMax = 999.,
float  dPhiMax = 999. 
)
static

Definition at line 72 of file ConversionTools.cc.

References reco::Conversion::conversionVertex(), reco::deltaPhi(), reco::deltaR(), dPhi(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::Vertex::position(), reco::CaloCluster::position(), and reco::Conversion::refittedPairMomentum().

72  {
73 
74  //check if a given SuperCluster matches a given conversion (no quality cuts applied)
75  //matching is geometric between conversion momentum and vector joining conversion vertex
76  //to supercluster position
77 
78 
80 
81  math::XYZPoint scpos(sc.position());
83 
84 
85  math::XYZVector cscvector = scpos - cvtx;
86  float dR = reco::deltaR(mom,cscvector);
87  float dEta = mom.eta() - cscvector.eta();
88  float dPhi = reco::deltaPhi(mom.phi(),cscvector.phi());
89 
90  if (dR>dRMax) return false;
91  if (dEta>dEtaMax) return false;
92  if (dPhi>dPhiMax) return false;
93 
94  return true;
95 
96 }
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:97
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:124
const Point & position() const
position
Definition: Vertex.h:106
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
Definition: Conversion.cc:248
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
bool ConversionTools::matchesConversion ( const edm::RefToBase< reco::Track > &  trk,
const reco::Conversion conv 
)
static

Definition at line 100 of file ConversionTools.cc.

References edm::ProductID::id(), edm::RefToBase< T >::id(), edm::RefToBase< T >::isNull(), edm::RefToBase< T >::key(), and reco::Conversion::tracks().

101 {
102 
103  //check if given track matches given conversion (matching by ref)
104 
105  if (trk.isNull()) return false;
106 
107  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
108  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
109  if (trk.id()==it->id() && trk.key()==it->key()) return true;
110  }
111 
112  return false;
113 }
bool isNull() const
Checks for null.
Definition: RefToBase.h:270
ProductID id() const
Definition: RefToBase.h:220
size_t key() const
Definition: RefToBase.h:228
ProductIndex id() const
Definition: ProductID.h:38
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:176
bool ConversionTools::matchesConversion ( const reco::TrackRef trk,
const reco::Conversion conv 
)
static

Definition at line 116 of file ConversionTools.cc.

References edm::ProductID::id(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::isNull(), edm::Ref< C, T, F >::key(), and reco::Conversion::tracks().

117 {
118 
119  //check if given track matches given conversion (matching by ref)
120 
121  if (trk.isNull()) return false;
122 
123  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
124  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
125  if (trk.id()==it->id() && trk.key()==it->key()) return true;
126  }
127 
128  return false;
129 }
bool isNull() const
Checks for null.
Definition: Ref.h:247
key_type key() const
Accessor for product key.
Definition: Ref.h:266
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
ProductIndex id() const
Definition: ProductID.h:38
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:176
bool ConversionTools::matchesConversion ( const reco::GsfTrackRef trk,
const reco::Conversion conv 
)
static

Definition at line 132 of file ConversionTools.cc.

References edm::ProductID::id(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::isNull(), edm::Ref< C, T, F >::key(), and reco::Conversion::tracks().

133 {
134 
135  //check if given track matches given conversion (matching by ref)
136 
137  if (trk.isNull()) return false;
138 
139  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
140  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
141  if (trk.id()==it->id() && trk.key()==it->key()) return true;
142  }
143 
144  return false;
145 }
bool isNull() const
Checks for null.
Definition: Ref.h:247
key_type key() const
Accessor for product key.
Definition: Ref.h:266
ProductID id() const
Accessor for product ID.
Definition: Ref.h:256
ProductIndex id() const
Definition: ProductID.h:38
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:176