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)
 
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 37 of file ConversionTools.h.

Constructor & Destructor Documentation

ConversionTools::ConversionTools ( )
inline

Definition at line 40 of file ConversionTools.h.

40 {}

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 145 of file ConversionTools.cc.

Referenced by SoftPFElectronTagInfoProducer::produce(), pat::PATElectronProducer::produce(), and EgammaCutBasedEleId::TestWP().

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

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

168 {
169  //check if a given track matches to at least one conversion candidate in the
170  //collection which also passes the selection cuts
171 
172  if (trk.isNull()) return false;
173 
174  for (ConversionCollection::const_iterator it = convCol->begin(); it!=convCol->end(); ++it) {
175  if (!matchesConversion(trk, *it)) continue;
176  if (!isGoodConversion(*it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
177 
178  return true;
179  }
180 
181  return false;
182 
183 }
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)
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true)
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 186 of file ConversionTools.cc.

189 {
190 
191  //check if a given SuperCluster matches to at least one conversion candidate in the
192  //collection which also passes the selection cuts
193 
194  for (ConversionCollection::const_iterator it = convCol->begin(); it!=convCol->end(); ++it) {
195  if (!matchesConversion(sc, *it)) continue;
196  if (!isGoodConversion(*it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
197 
198  return true;
199  }
200 
201  return false;
202 
203 }
static bool isGoodConversion(const reco::Conversion &conv, const math::XYZPoint &beamspot, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=1)
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true)
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 292 of file ConversionTools.cc.

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

Referenced by ggPFPhotons::PFElectronVeto().

294 {
295 
296  //check if a given SuperCluster matches to at least one GsfElectron having zero expected inner hits
297  //and not matching any conversion in the collection passing the quality cuts
298 
299  if (sc.isNull()) return false;
300 
301  for (GsfElectronCollection::const_iterator it = eleCol->begin(); it!=eleCol->end(); ++it) {
302  //match electron to supercluster
303  if (it->superCluster()!=sc) continue;
304 
305  //check expected inner hits
306  if (it->gsfTrack()->trackerExpectedHitsInner().numberOfHits()>0) continue;
307 
308  //check if electron is matching to a conversion
309  if (hasMatchedConversion(*it,convCol,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
310 
311 
312  return true;
313  }
314 
315  return false;
316 
317 
318 }
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 19 of file ConversionTools.cc.

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

20 {
21 
22  //Check if a given conversion candidate passes the conversion selection cuts
23 
24  const reco::Vertex &vtx = conv.conversionVertex();
25 
26  //vertex validity
27  if (!vtx.isValid()) return false;
28 
29  //fit probability
30  if (TMath::Prob( vtx.chi2(), vtx.ndof() )<probMin) return false;
31 
32  //compute transverse decay length
34  double dbsx = vtx.x() - beamspot.x();
35  double dbsy = vtx.y() - beamspot.y();
36  double lxy = (mom.x()*dbsx + mom.y()*dbsy)/mom.rho();
37 
38  //transverse decay length
39  if ( lxy<lxyMin )
40  return false;
41 
42  //loop through daughters to check nhitsbeforevtx
43  for (std::vector<uint8_t>::const_iterator it = conv.nHitsBeforeVtx().begin(); it!=conv.nHitsBeforeVtx().end(); ++it) {
44  if ( (*it)>nHitsBeforeVtxMax ) return false;
45  }
46 
47  return true;
48 }
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:101
double y() const
y coordinate
Definition: Vertex.h:97
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:61
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
Definition: Conversion.cc:262
double chi2() const
chi-squares
Definition: Vertex.h:82
double ndof() const
Definition: Vertex.h:89
double x() const
x coordinate
Definition: Vertex.h:95
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const std::vector< uint8_t > & nHitsBeforeVtx() const
Vector of the number of hits before the vertex along each track trajector.
Definition: Conversion.h:165
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 207 of file ConversionTools.cc.

References edm::match(), and rho.

Referenced by ElectronConversionRejectionValidator::analyze().

210 {
211  //check if a given electron candidate matches to at least one conversion candidate in the
212  //collection which also passes the selection cuts, optionally match with the closestckf track in
213  //in addition to just the gsf track (enabled in default arguments)
214  //If multiple conversions are found, returned reference corresponds to minimum
215  //conversion radius
216 
218 
219  double minRho = 999.;
220  for (ConversionCollection::const_iterator it = convCol->begin(); it!=convCol->end(); ++it) {
221  float rho = it->conversionVertex().position().rho();
222  if (rho>minRho) continue;
223  if (!matchesConversion(ele, *it, allowCkfMatch)) continue;
224  if (!isGoodConversion(*it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
225 
226  minRho = rho;
227  match = ConversionRef(convCol,it-convCol->begin());
228  }
229 
230  return match;
231 
232 }
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)
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true)
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 235 of file ConversionTools.cc.

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

238 {
239  //check if a given track matches to at least one conversion candidate in the
240  //collection which also passes the selection cuts
241  //If multiple conversions are found, returned reference corresponds to minimum
242  //conversion radius
243 
245 
246  if (trk.isNull()) return match;
247 
248  double minRho = 999.;
249  for (ConversionCollection::const_iterator it = convCol->begin(); it!=convCol->end(); ++it) {
250  float rho = it->conversionVertex().position().rho();
251  if (rho>minRho) continue;
252  if (!matchesConversion(trk, *it)) continue;
253  if (!isGoodConversion(*it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
254 
255  minRho = rho;
256  match = ConversionRef(convCol,it-convCol->begin());
257  }
258 
259  return match;
260 
261 }
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)
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true)
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 264 of file ConversionTools.cc.

References edm::match(), and rho.

267 {
268 
269  //check if a given SuperCluster matches to at least one conversion candidate in the
270  //collection which also passes the selection cuts
271  //If multiple conversions are found, returned reference corresponds to minimum
272  //conversion radius
273 
275 
276  double minRho = 999.;
277  for (ConversionCollection::const_iterator it = convCol->begin(); it!=convCol->end(); ++it) {
278  float rho = it->conversionVertex().position().rho();
279  if (rho>minRho) continue;
280  if (!matchesConversion(sc, *it, dRMax,dEtaMax,dPhiMax)) continue;
281  if (!isGoodConversion(*it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
282 
283  minRho = rho;
284  match = ConversionRef(convCol,it-convCol->begin());
285  }
286 
287  return match;
288 
289 }
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)
static bool matchesConversion(const reco::GsfElectron &ele, const reco::Conversion &conv, bool allowCkfMatch=true)
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 322 of file ConversionTools.cc.

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

324 {
325 
326  //check if a given SuperCluster matches to at least one GsfElectron having zero expected inner hits
327  //and not matching any conversion in the collection passing the quality cuts
328 
330 
331  if (sc.isNull()) return match;
332 
333  for (GsfElectronCollection::const_iterator it = eleCol->begin(); it!=eleCol->end(); ++it) {
334  //match electron to supercluster
335  if (it->superCluster()!=sc) continue;
336 
337  //check expected inner hits
338  if (it->gsfTrack()->trackerExpectedHitsInner().numberOfHits()>0) continue;
339 
340  //check if electron is matching to a conversion
341  if (hasMatchedConversion(*it,convCol,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
342 
343 
344  match = GsfElectronRef(eleCol,it-eleCol->begin());
345  }
346 
347  return match;
348 
349 
350 }
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 
)
static

Definition at line 51 of file ConversionTools.cc.

References reco::GsfElectron::closestCtfTrackRef(), convBrem_cff::convTracks, reco::GsfElectron::gsfTrack(), edm::ProductID::id(), edm::Ref< C, T, F >::id(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), and reco::Conversion::tracks().

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

52 {
53 
54  //check if a given GsfElectron matches a given conversion (no quality cuts applied)
55  //matching is always attempted through the gsf track ref, and optionally attempted through the
56  //closest ctf track ref
57 
58  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
59  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
60  if ( ele.gsfTrack().isNonnull() && ele.gsfTrack().id()==it->id() && ele.gsfTrack().key()==it->key()) return true;
61  else if ( allowCkfMatch && ele.closestCtfTrackRef().isNonnull() && ele.closestCtfTrackRef().id()==it->id() && ele.closestCtfTrackRef().key()==it->key() ) return true;
62  }
63 
64  return false;
65 }
tuple convTracks
Definition: convBrem_cff.py:35
TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:185
std::vector< edm::RefToBase< reco::Track > > tracks() const
vector of track to base references
Definition: Conversion.cc:180
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
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
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
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 68 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().

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

Definition at line 96 of file ConversionTools.cc.

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

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

Definition at line 112 of file ConversionTools.cc.

References convBrem_cff::convTracks, 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().

113 {
114 
115  //check if given track matches given conversion (matching by ref)
116 
117  if (trk.isNull()) return false;
118 
119  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
120  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
121  if (trk.id()==it->id() && trk.key()==it->key()) return true;
122  }
123 
124  return false;
125 }
tuple convTracks
Definition: convBrem_cff.py:35
std::vector< edm::RefToBase< reco::Track > > tracks() const
vector of track to base references
Definition: Conversion.cc:180
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
bool ConversionTools::matchesConversion ( const reco::GsfTrackRef trk,
const reco::Conversion conv 
)
static

Definition at line 128 of file ConversionTools.cc.

References convBrem_cff::convTracks, 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().

129 {
130 
131  //check if given track matches given conversion (matching by ref)
132 
133  if (trk.isNull()) return false;
134 
135  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
136  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
137  if (trk.id()==it->id() && trk.key()==it->key()) return true;
138  }
139 
140  return false;
141 }
tuple convTracks
Definition: convBrem_cff.py:35
std::vector< edm::RefToBase< reco::Track > > tracks() const
vector of track to base references
Definition: Conversion.cc:180
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