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 float getVtxFitProb (const reco::Conversion *conv)
 
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::GsfElectronCore &eleCore, 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::GsfElectronCore &eleCore, 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 35 of file ConversionTools.h.

Constructor & Destructor Documentation

ConversionTools::ConversionTools ( )
inline

Member Function Documentation

float ConversionTools::getVtxFitProb ( const reco::Conversion conv)
static

Definition at line 384 of file ConversionTools.cc.

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

Referenced by ConversionTools(), GsfElectronAlgo::createElectron(), and EG9X105XObjectUpdateModifier::modifyObject().

385 {
386  if (conv!=nullptr) {
387  const reco::Vertex& vtx = conv->conversionVertex();
388  if( vtx.isValid() ) {
389  return TMath::Prob(vtx.chi2(),vtx.ndof()) ;
390  }
391  }
392  return -1;
393 }
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:98
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:68
double chi2() const
chi-squares
Definition: Vertex.h:98
double ndof() const
Definition: Vertex.h:105
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 168 of file ConversionTools.cc.

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

171 {
172  //check if a given electron candidate matches to at least one conversion candidate in the
173  //collection which also passes the selection cuts, optionally match with the closestckf track in
174  //in addition to just the gsf track (enabled in default arguments)
175 
176  for(auto const& it : convCol) {
177  if (!matchesConversion(ele, it, allowCkfMatch)) continue;
178  if (!isGoodConversion(it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
179 
180  return true;
181  }
182 
183  return false;
184 
185 }
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 188 of file ConversionTools.cc.

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

191 {
192  //check if a given track matches to at least one conversion candidate in the
193  //collection which also passes the selection cuts
194 
195  if (trk.isNull()) return false;
196 
197  for(auto const& it : convCol) {
198  if (!matchesConversion(trk, 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)
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 209 of file ConversionTools.cc.

212 {
213 
214  //check if a given SuperCluster matches to at least one conversion candidate in the
215  //collection which also passes the selection cuts
216 
217  for(auto const& it : convCol) {
218  if (!matchesConversion(sc, it)) continue;
219  if (!isGoodConversion(it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
220 
221  return true;
222  }
223 
224  return false;
225 
226 }
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 343 of file ConversionTools.cc.

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

345 {
346 
347  return !(matchedPromptElectron(sc, eleCol, convCol, beamspot,
348  allowCkfMatch, lxyMin, probMin, nHitsBeforeVtxMax) == nullptr);
349 }
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:98
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:162
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 230 of file ConversionTools.cc.

References edm::match().

Referenced by ElectronConversionRejectionValidator::analyze(), ConversionTools(), GsfElectronAlgo::createElectron(), and EG9X105XObjectUpdateModifier::modifyObject().

233 {
234  //check if a given electron candidate matches to at least one conversion candidate in the
235  //collection which also passes the selection cuts, optionally match with the closestckf track in
236  //in addition to just the gsf track (enabled in default arguments)
237  //If multiple conversions are found, returned reference corresponds to minimum
238  //conversion radius
239 
240  reco::Conversion const* match = nullptr;
241 
242  double minRho = 999.;
243  for(auto const& it : convCol) {
244  float rho = it.conversionVertex().position().rho();
245  if (rho>minRho) continue;
246  if (!matchesConversion(ele, it, allowCkfMatch)) continue;
247  if (!isGoodConversion(it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
248 
249  minRho = rho;
250  match = &it;
251  }
252 
253  return match;
254 
255 }
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::GsfElectronCore eleCore,
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 258 of file ConversionTools.cc.

References edm::match().

261 {
262  //check if a given electron candidate matches to at least one conversion candidate in the
263  //collection which also passes the selection cuts, optionally match with the closestckf track in
264  //in addition to just the gsf track (enabled in default arguments)
265  //If multiple conversions are found, returned reference corresponds to minimum
266  //conversion radius
267 
268  reco::Conversion const* match = nullptr;
269 
270  double minRho = 999.;
271  for(auto const& it : convCol) {
272  float rho = it.conversionVertex().position().rho();
273  if (rho>minRho) continue;
274  if (!matchesConversion(eleCore, it, allowCkfMatch)) continue;
275  if (!isGoodConversion(it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
276 
277  minRho = rho;
278  match = &it;
279  }
280 
281  return match;
282 
283 }
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 286 of file ConversionTools.cc.

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

289 {
290  //check if a given track matches to at least one conversion candidate in the
291  //collection which also passes the selection cuts
292  //If multiple conversions are found, returned reference corresponds to minimum
293  //conversion radius
294 
295  reco::Conversion const* match = nullptr;
296 
297  if (trk.isNull()) return match;
298 
299  double minRho = 999.;
300  for(auto const& it : convCol) {
301  float rho = it.conversionVertex().position().rho();
302  if (rho>minRho) continue;
303  if (!matchesConversion(trk, it)) continue;
304  if (!isGoodConversion(it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
305 
306  minRho = rho;
307  match = &it;
308  }
309 
310  return match;
311 
312 }
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 315 of file ConversionTools.cc.

References edm::match().

318 {
319 
320  //check if a given SuperCluster matches to at least one conversion candidate in the
321  //collection which also passes the selection cuts
322  //If multiple conversions are found, returned reference corresponds to minimum
323  //conversion radius
324 
325  reco::Conversion const* match = nullptr;
326 
327  double minRho = 999.;
328  for(auto const& it : convCol) {
329  float rho = it.conversionVertex().position().rho();
330  if (rho>minRho) continue;
331  if (!matchesConversion(sc, it, dRMax,dEtaMax,dPhiMax)) continue;
332  if (!isGoodConversion(it,beamspot,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
333 
334  minRho = rho;
335  match = &it;
336  }
337 
338  return match;
339 
340 }
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 353 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().

355 {
356 
357  //check if a given SuperCluster matches to at least one GsfElectron having zero expected inner hits
358  //and not matching any conversion in the collection passing the quality cuts
359 
360  reco::GsfElectron const* match = nullptr;
361 
362  if (sc.isNull()) return match;
363 
364  for(auto const& it : eleCol) {
365  //match electron to supercluster
366  if (it.superCluster()!=sc) continue;
367 
368  //check expected inner hits
369  if (it.gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) > 0) continue;
370 
371  //check if electron is matching to a conversion
372  if (hasMatchedConversion(it,convCol,beamspot,allowCkfMatch,lxyMin,probMin,nHitsBeforeVtxMax)) continue;
373 
374 
375  match = &it;
376  }
377 
378  return match;
379 
380 
381 }
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:723
GsfTrackRefVector::const_iterator ambiguousGsfTracksEnd() const
Definition: GsfElectron.h:724
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:176
bool ConversionTools::matchesConversion ( const reco::GsfElectronCore eleCore,
const reco::Conversion conv,
bool  allowCkfMatch = true 
)
static

Definition at line 71 of file ConversionTools.cc.

References reco::GsfElectronCore::ctfTrack(), reco::GsfElectronCore::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().

72 {
73 
74  //check if a given GsfElectronCore matches a given conversion (no quality cuts applied)
75  //matching is always attempted through the gsf track ref, and optionally attempted through the
76  //closest ctf track ref
77 
78  for (const auto& trkRef : conv.tracks() ){
79  if ( eleCore.gsfTrack().isNonnull() && eleCore.gsfTrack().id()==trkRef.id() &&
80  eleCore.gsfTrack().key()==trkRef.key()) return true;
81  else if ( allowCkfMatch && eleCore.ctfTrack().isNonnull() &&
82  eleCore.ctfTrack().id()==trkRef.id() &&
83  eleCore.ctfTrack().key()==trkRef.key() ) return true;
84  }
85 
86  return false;
87 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
const GsfTrackRef & gsfTrack() const
key_type key() const
Accessor for product key.
Definition: Ref.h:263
ProductID id() const
Accessor for product ID.
Definition: Ref.h:257
TrackRef ctfTrack() const
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::SuperCluster sc,
const reco::Conversion conv,
float  dRMax = 0.1,
float  dEtaMax = 999.,
float  dPhiMax = 999. 
)
static

Definition at line 91 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().

91  {
92 
93  //check if a given SuperCluster matches a given conversion (no quality cuts applied)
94  //matching is geometric between conversion momentum and vector joining conversion vertex
95  //to supercluster position
96 
97 
99 
100  const math::XYZPoint& scpos(sc.position());
102 
103 
104  math::XYZVector cscvector = scpos - cvtx;
105  float dR = reco::deltaR(mom,cscvector);
106  float dEta = mom.eta() - cscvector.eta();
107  float dPhi = reco::deltaPhi(mom.phi(),cscvector.phi());
108 
109  if (dR>dRMax) return false;
110  if (dEta>dEtaMax) return false;
111  if (dPhi>dPhiMax) return false;
112 
113  return true;
114 
115 }
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:98
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 119 of file ConversionTools.cc.

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

120 {
121 
122  //check if given track matches given conversion (matching by ref)
123 
124  if (trk.isNull()) return false;
125 
126  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
127  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
128  if (trk.id()==it->id() && trk.key()==it->key()) return true;
129  }
130 
131  return false;
132 }
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 135 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().

136 {
137 
138  //check if given track matches given conversion (matching by ref)
139 
140  if (trk.isNull()) return false;
141 
142  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
143  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
144  if (trk.id()==it->id() && trk.key()==it->key()) return true;
145  }
146 
147  return false;
148 }
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 151 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().

152 {
153 
154  //check if given track matches given conversion (matching by ref)
155 
156  if (trk.isNull()) return false;
157 
158  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
159  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it=convTracks.begin(); it!=convTracks.end(); ++it) {
160  if (trk.id()==it->id() && trk.key()==it->key()) return true;
161  }
162 
163  return false;
164 }
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