CMS 3D CMS Logo

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 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 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 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 reco::GsfElectronCollection &eleCol, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, 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::Conversion const * matchedConversion (const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
 
static reco::Conversion const * matchedConversion (const reco::TrackRef &trk, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
 
static reco::Conversion const * matchedConversion (const reco::SuperCluster &sc, const 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::GsfElectron const * matchedPromptElectron (const reco::SuperClusterRef &sc, const reco::GsfElectronCollection &eleCol, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, 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 35 of file ConversionTools.h.

Constructor & Destructor Documentation

ConversionTools::ConversionTools ( )
inline

Member Function Documentation

bool ConversionTools::hasMatchedConversion ( const reco::GsfElectron ele,
const 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 148 of file ConversionTools.cc.

Referenced by ConversionTools(), AdHocNTupler::fill(), DQMExample_Step1::MediumEle(), GsfEleConversionVetoCut::operator()(), ElectronIdentifier::passID(), SoftPFElectronTagInfoProducer::produce(), pat::PATElectronProducer::produce(), EgammaCutBasedEleId::TestWP(), and GsfEleConversionVetoCut::value().

151 {
152  //check if a given electron candidate matches to at least one conversion candidate in the
153  //collection which also passes the selection cuts, optionally match with the closestckf track in
154  //in addition to just the gsf track (enabled in default arguments)
155 
156  for(auto const& it : convCol) {
157  if (!matchesConversion(ele, it, allowCkfMatch)) continue;
158  if (!isGoodConversion(it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
159 
160  return true;
161  }
162 
163  return false;
164 
165 }
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 reco::ConversionCollection convCol,
const math::XYZPoint beamspot,
float  lxyMin = 2.0,
float  probMin = 1e-6,
unsigned int  nHitsBeforeVtxMax = 1 
)
static

Definition at line 168 of file ConversionTools.cc.

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

171 {
172  //check if a given track matches to at least one conversion candidate in the
173  //collection which also passes the selection cuts
174 
175  if (trk.isNull()) return false;
176 
177  for(auto const& it : convCol) {
178  if (!matchesConversion(trk, it)) continue;
179  if (!isGoodConversion(it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
180 
181  return true;
182  }
183 
184  return false;
185 
186 }
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:248
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 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 189 of file ConversionTools.cc.

192 {
193 
194  //check if a given SuperCluster matches to at least one conversion candidate in the
195  //collection which also passes the selection cuts
196 
197  for(auto const& it : convCol) {
198  if (!matchesConversion(sc, it)) continue;
199  if (!isGoodConversion(it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
200 
201  return true;
202  }
203 
204  return false;
205 
206 }
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 reco::GsfElectronCollection eleCol,
const 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 295 of file ConversionTools.cc.

Referenced by ConversionTools(), AdHocNTupler::fill(), and pat::PATPhotonProducer::produce().

297 {
298 
299  return !(matchedPromptElectron(sc, eleCol, convCol, beamspot,
300  allowCkfMatch, lxyMin, probMin, nHitsBeforeVtxMax) == nullptr);
301 }
static reco::GsfElectron const * matchedPromptElectron(const reco::SuperClusterRef &sc, const reco::GsfElectronCollection &eleCol, const 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 17 of file ConversionTools.cc.

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

Referenced by ConversionTools().

18 {
19 
20  //Check if a given conversion candidate passes the conversion selection cuts
21 
22  const reco::Vertex &vtx = conv.conversionVertex();
23 
24  //vertex validity
25  if (!vtx.isValid()) return false;
26 
27  //fit probability
28  if (TMath::Prob( vtx.chi2(), vtx.ndof() )<probMin) return false;
29 
30  //compute transverse decay length
32  double dbsx = vtx.x() - beamspot.x();
33  double dbsy = vtx.y() - beamspot.y();
34  double lxy = (mom.x()*dbsx + mom.y()*dbsy)/mom.rho();
35 
36  //transverse decay length
37  if ( lxy<lxyMin )
38  return false;
39 
40  //loop through daughters to check nhitsbeforevtx
41  for (std::vector<uint8_t>::const_iterator it = conv.nHitsBeforeVtx().begin(); it!=conv.nHitsBeforeVtx().end(); ++it) {
42  if ( (*it)>nHitsBeforeVtxMax ) return false;
43  }
44 
45  return true;
46 }
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:97
double y() const
y coordinate
Definition: Vertex.h:113
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:68
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:98
double ndof() const
Definition: Vertex.h:105
double x() const
x coordinate
Definition: Vertex.h:111
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::Conversion const * ConversionTools::matchedConversion ( const reco::GsfElectron ele,
const 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 210 of file ConversionTools.cc.

References edm::match().

Referenced by ElectronConversionRejectionValidator::analyze(), ConversionTools(), and ElectronMVAEstimatorRun2::getExtraVars().

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

Definition at line 238 of file ConversionTools.cc.

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

241 {
242  //check if a given track matches to at least one conversion candidate in the
243  //collection which also passes the selection cuts
244  //If multiple conversions are found, returned reference corresponds to minimum
245  //conversion radius
246 
247  reco::Conversion const* match = nullptr;
248 
249  if (trk.isNull()) return match;
250 
251  double minRho = 999.;
252  for(auto const& it : convCol) {
253  float rho = it.conversionVertex().position().rho();
254  if (rho>minRho) continue;
255  if (!matchesConversion(trk, it)) continue;
256  if (!isGoodConversion(it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
257 
258  minRho = rho;
259  match = &it;
260  }
261 
262  return match;
263 
264 }
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:248
static bool isGoodConversion(const reco::Conversion &conv, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
reco::Conversion const * ConversionTools::matchedConversion ( const reco::SuperCluster sc,
const 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 267 of file ConversionTools.cc.

References edm::match().

270 {
271 
272  //check if a given SuperCluster matches to at least one conversion candidate in the
273  //collection which also passes the selection cuts
274  //If multiple conversions are found, returned reference corresponds to minimum
275  //conversion radius
276 
277  reco::Conversion const* match = nullptr;
278 
279  double minRho = 999.;
280  for(auto const& it : convCol) {
281  float rho = it.conversionVertex().position().rho();
282  if (rho>minRho) continue;
283  if (!matchesConversion(sc, it, dRMax,dEtaMax,dPhiMax)) continue;
284  if (!isGoodConversion(it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
285 
286  minRho = rho;
287  match = &it;
288  }
289 
290  return match;
291 
292 }
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)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
reco::GsfElectron const * ConversionTools::matchedPromptElectron ( const reco::SuperClusterRef sc,
const reco::GsfElectronCollection eleCol,
const 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 305 of file ConversionTools.cc.

References edm::Ref< C, T, F >::isNull(), edm::match(), reco::HitPattern::MISSING_INNER_HITS, and SimDataFormats::CaloAnalysis::sc.

Referenced by ConversionTools().

307 {
308 
309  //check if a given SuperCluster matches to at least one GsfElectron having zero expected inner hits
310  //and not matching any conversion in the collection passing the quality cuts
311 
312  reco::GsfElectron const* match = nullptr;
313 
314  if (sc.isNull()) return match;
315 
316  for(auto const& it : eleCol) {
317  //match electron to supercluster
318  if (it.superCluster()!=sc) continue;
319 
320  //check expected inner hits
321  if (it.gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) > 0) continue;
322 
323  //check if electron is matching to a conversion
324  if (hasMatchedConversion(it,convCol,beamspot,allowCkfMatch,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
325 
326 
327  match = &it;
328  }
329 
330  return match;
331 
332 
333 }
static bool hasMatchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
bool isNull() const
Checks for null.
Definition: Ref.h:248
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
bool ConversionTools::matchesConversion ( const reco::GsfElectron ele,
const reco::Conversion conv,
bool  allowCkfMatch = true,
bool  allowAmbiguousGsfMatch = false 
)
static

Definition at line 49 of file ConversionTools.cc.

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

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

50 {
51 
52  //check if a given GsfElectron matches a given conversion (no quality cuts applied)
53  //matching is always attempted through the gsf track ref, and optionally attempted through the
54  //closest ctf track ref
55 
56  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
57  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
58  if ( ele.reco::GsfElectron::gsfTrack().isNonnull() && ele.reco::GsfElectron::gsfTrack().id()==it->id() && ele.reco::GsfElectron::gsfTrack().key()==it->key()) return true;
59  else if ( allowCkfMatch && ele.reco::GsfElectron::closestCtfTrackRef().isNonnull() && ele.reco::GsfElectron::closestCtfTrackRef().id()==it->id() && ele.reco::GsfElectron::closestCtfTrackRef().key()==it->key() ) return true;
60  if (allowAmbiguousGsfMatch) {
62  if (tk->isNonnull() && tk->id()==it->id() && tk->key()==it->key()) return true;
63  }
64  }
65  }
66 
67  return false;
68 }
GsfTrackRefVector::const_iterator ambiguousGsfTracksBegin() const
Definition: GsfElectron.h:713
GsfTrackRefVector::const_iterator ambiguousGsfTracksEnd() const
Definition: GsfElectron.h:714
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 71 of file ConversionTools.cc.

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

71  {
72 
73  //check if a given SuperCluster matches a given conversion (no quality cuts applied)
74  //matching is geometric between conversion momentum and vector joining conversion vertex
75  //to supercluster position
76 
77 
79 
80  const math::XYZPoint& scpos(sc.position());
82 
83 
84  math::XYZVector cscvector = scpos - cvtx;
85  float dR = reco::deltaR(mom,cscvector);
86  float dEta = mom.eta() - cscvector.eta();
87  float dPhi = reco::deltaPhi(mom.phi(),cscvector.phi());
88 
89  if (dR>dRMax) return false;
90  if (dEta>dEtaMax) return false;
91  if (dPhi>dPhiMax) return false;
92 
93  return true;
94 
95 }
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:97
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:131
const Point & position() const
position
Definition: Vertex.h:109
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
Definition: Conversion.cc:248
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
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 99 of file ConversionTools.cc.

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

100 {
101 
102  //check if given track matches given conversion (matching by ref)
103 
104  if (trk.isNull()) return false;
105 
106  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
107  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
108  if (trk.id()==it->id() && trk.key()==it->key()) return true;
109  }
110 
111  return false;
112 }
ProductID id() const
Definition: RefToBase.h:242
size_t key() const
Definition: RefToBase.h:250
bool isNull() const
Checks for null.
Definition: RefToBase.h:331
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 115 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().

116 {
117 
118  //check if given track matches given conversion (matching by ref)
119 
120  if (trk.isNull()) return false;
121 
122  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
123  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
124  if (trk.id()==it->id() && trk.key()==it->key()) return true;
125  }
126 
127  return false;
128 }
key_type key() const
Accessor for product key.
Definition: Ref.h:263
ProductID id() const
Accessor for product ID.
Definition: Ref.h:257
bool isNull() const
Checks for null.
Definition: Ref.h:248
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 131 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().

132 {
133 
134  //check if given track matches given conversion (matching by ref)
135 
136  if (trk.isNull()) return false;
137 
138  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
139  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
140  if (trk.id()==it->id() && trk.key()==it->key()) return true;
141  }
142 
143  return false;
144 }
key_type key() const
Accessor for product key.
Definition: Ref.h:263
ProductID id() const
Accessor for product ID.
Definition: Ref.h:257
bool isNull() const
Checks for null.
Definition: Ref.h:248
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