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 441 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().

441  {
442  if (conv != nullptr) {
443  const reco::Vertex &vtx = conv->conversionVertex();
444  if (vtx.isValid()) {
445  return TMath::Prob(vtx.chi2(), vtx.ndof());
446  }
447  }
448  return -1;
449 }
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:88
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:71
double chi2() const
chi-squares
Definition: Vertex.h:102
double ndof() const
Definition: Vertex.h:109
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 184 of file ConversionTools.cc.

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

190  {
191  //check if a given electron candidate matches to at least one conversion candidate in the
192  //collection which also passes the selection cuts, optionally match with the closestckf track in
193  //in addition to just the gsf track (enabled in default arguments)
194 
195  for (auto const &it : convCol) {
196  if (!matchesConversion(ele, it, allowCkfMatch))
197  continue;
198  if (!isGoodConversion(it, beamspot, lxyMin, probMin, nHitsBeforeVtxMax))
199  continue;
200 
201  return true;
202  }
203 
204  return false;
205 }
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 208 of file ConversionTools.cc.

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

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

241  {
242  //check if a given SuperCluster matches to at least one conversion candidate in the
243  //collection which also passes the selection cuts
244 
245  for (auto const &it : convCol) {
246  if (!matchesConversion(sc, it))
247  continue;
248  if (!isGoodConversion(it, beamspot, lxyMin, probMin, nHitsBeforeVtxMax))
249  continue;
250 
251  return true;
252  }
253 
254  return false;
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)
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 392 of file ConversionTools.cc.

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

399  {
400  return !(matchedPromptElectron(sc, eleCol, convCol, beamspot, allowCkfMatch, lxyMin, probMin, nHitsBeforeVtxMax) ==
401  nullptr);
402 }
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 16 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().

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())
27  return false;
28 
29  //fit probability
30  if (TMath::Prob(vtx.chi2(), vtx.ndof()) < probMin)
31  return false;
32 
33  //compute transverse decay length
35  double dbsx = vtx.x() - beamspot.x();
36  double dbsy = vtx.y() - beamspot.y();
37  double lxy = (mom.x() * dbsx + mom.y() * dbsy) / mom.rho();
38 
39  //transverse decay length
40  if (lxy < lxyMin)
41  return false;
42 
43  //loop through daughters to check nhitsbeforevtx
44  for (std::vector<uint8_t>::const_iterator it = conv.nHitsBeforeVtx().begin(); it != conv.nHitsBeforeVtx().end();
45  ++it) {
46  if ((*it) > nHitsBeforeVtxMax)
47  return false;
48  }
49 
50  return true;
51 }
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:88
double y() const
y coordinate
Definition: Vertex.h:117
bool isValid() const
Tells whether the vertex is valid.
Definition: Vertex.h:71
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
Definition: Conversion.cc:206
double chi2() const
chi-squares
Definition: Vertex.h:102
double ndof() const
Definition: Vertex.h:109
double x() const
x coordinate
Definition: Vertex.h:115
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:154
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 258 of file ConversionTools.cc.

References edm::match().

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

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

References edm::match().

297  {
298  //check if a given electron candidate matches to at least one conversion candidate in the
299  //collection which also passes the selection cuts, optionally match with the closestckf track in
300  //in addition to just the gsf track (enabled in default arguments)
301  //If multiple conversions are found, returned reference corresponds to minimum
302  //conversion radius
303 
304  reco::Conversion const *match = nullptr;
305 
306  double minRho = 999.;
307  for (auto const &it : convCol) {
308  float rho = it.conversionVertex().position().rho();
309  if (rho > minRho)
310  continue;
311  if (!matchesConversion(eleCore, it, allowCkfMatch))
312  continue;
313  if (!isGoodConversion(it, beamspot, lxyMin, probMin, nHitsBeforeVtxMax))
314  continue;
315 
316  minRho = rho;
317  match = &it;
318  }
319 
320  return match;
321 }
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 324 of file ConversionTools.cc.

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

329  {
330  //check if a given track matches to at least one conversion candidate in the
331  //collection which also passes the selection cuts
332  //If multiple conversions are found, returned reference corresponds to minimum
333  //conversion radius
334 
335  reco::Conversion const *match = nullptr;
336 
337  if (trk.isNull())
338  return match;
339 
340  double minRho = 999.;
341  for (auto const &it : convCol) {
342  float rho = it.conversionVertex().position().rho();
343  if (rho > minRho)
344  continue;
345  if (!matchesConversion(trk, it))
346  continue;
347  if (!isGoodConversion(it, beamspot, lxyMin, probMin, nHitsBeforeVtxMax))
348  continue;
349 
350  minRho = rho;
351  match = &it;
352  }
353 
354  return match;
355 }
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:235
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 358 of file ConversionTools.cc.

References edm::match().

366  {
367  //check if a given SuperCluster matches to at least one conversion candidate in the
368  //collection which also passes the selection cuts
369  //If multiple conversions are found, returned reference corresponds to minimum
370  //conversion radius
371 
372  reco::Conversion const *match = nullptr;
373 
374  double minRho = 999.;
375  for (auto const &it : convCol) {
376  float rho = it.conversionVertex().position().rho();
377  if (rho > minRho)
378  continue;
379  if (!matchesConversion(sc, it, dRMax, dEtaMax, dPhiMax))
380  continue;
381  if (!isGoodConversion(it, beamspot, lxyMin, probMin, nHitsBeforeVtxMax))
382  continue;
383 
384  minRho = rho;
385  match = &it;
386  }
387 
388  return match;
389 }
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 405 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().

412  {
413  //check if a given SuperCluster matches to at least one GsfElectron having zero expected inner hits
414  //and not matching any conversion in the collection passing the quality cuts
415 
416  reco::GsfElectron const *match = nullptr;
417 
418  if (sc.isNull())
419  return match;
420 
421  for (auto const &it : eleCol) {
422  //match electron to supercluster
423  if (it.superCluster() != sc)
424  continue;
425 
426  //check expected inner hits
427  if (it.gsfTrack()->hitPattern().numberOfLostHits(reco::HitPattern::MISSING_INNER_HITS) > 0)
428  continue;
429 
430  //check if electron is matching to a conversion
431  if (hasMatchedConversion(it, convCol, beamspot, allowCkfMatch, lxyMin, probMin, nHitsBeforeVtxMax))
432  continue;
433 
434  match = &it;
435  }
436 
437  return match;
438 }
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:235
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 54 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().

57  {
58  //check if a given GsfElectron matches a given conversion (no quality cuts applied)
59  //matching is always attempted through the gsf track ref, and optionally attempted through the
60  //closest ctf track ref
61 
62  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
63  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it = convTracks.begin(); it != convTracks.end();
64  ++it) {
65  if (ele.reco::GsfElectron::gsfTrack().isNonnull() && ele.reco::GsfElectron::gsfTrack().id() == it->id() &&
66  ele.reco::GsfElectron::gsfTrack().key() == it->key())
67  return true;
68  else if (allowCkfMatch && ele.reco::GsfElectron::closestCtfTrackRef().isNonnull() &&
69  ele.reco::GsfElectron::closestCtfTrackRef().id() == it->id() &&
70  ele.reco::GsfElectron::closestCtfTrackRef().key() == it->key())
71  return true;
72  if (allowAmbiguousGsfMatch) {
74  tk != ele.ambiguousGsfTracksEnd();
75  ++tk) {
76  if (tk->isNonnull() && tk->id() == it->id() && tk->key() == it->key())
77  return true;
78  }
79  }
80  }
81 
82  return false;
83 }
GsfTrackRefVector::const_iterator ambiguousGsfTracksBegin() const
Definition: GsfElectron.h:683
GsfTrackRefVector::const_iterator ambiguousGsfTracksEnd() const
Definition: GsfElectron.h:684
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:150
bool ConversionTools::matchesConversion ( const reco::GsfElectronCore eleCore,
const reco::Conversion conv,
bool  allowCkfMatch = true 
)
static

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

88  {
89  //check if a given GsfElectronCore matches a given conversion (no quality cuts applied)
90  //matching is always attempted through the gsf track ref, and optionally attempted through the
91  //closest ctf track ref
92 
93  for (const auto &trkRef : conv.tracks()) {
94  if (eleCore.gsfTrack().isNonnull() && eleCore.gsfTrack().id() == trkRef.id() &&
95  eleCore.gsfTrack().key() == trkRef.key())
96  return true;
97  else if (allowCkfMatch && eleCore.ctfTrack().isNonnull() && eleCore.ctfTrack().id() == trkRef.id() &&
98  eleCore.ctfTrack().key() == trkRef.key())
99  return true;
100  }
101 
102  return false;
103 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
const GsfTrackRef & gsfTrack() const
key_type key() const
Accessor for product key.
Definition: Ref.h:250
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
TrackRef ctfTrack() const
ProductIndex id() const
Definition: ProductID.h:35
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:150
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 106 of file ConversionTools.cc.

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

107  {
108  //check if a given SuperCluster matches a given conversion (no quality cuts applied)
109  //matching is geometric between conversion momentum and vector joining conversion vertex
110  //to supercluster position
111 
113 
114  const math::XYZPoint &scpos(sc.position());
116 
117  math::XYZVector cscvector = scpos - cvtx;
118  float dR = reco::deltaR(mom, cscvector);
119  float dEta = mom.eta() - cscvector.eta();
120  float dPhi = reco::deltaPhi(mom.phi(), cscvector.phi());
121 
122  if (dR > dRMax)
123  return false;
124  if (dEta > dEtaMax)
125  return false;
126  if (dPhi > dPhiMax)
127  return false;
128 
129  return true;
130 }
const reco::Vertex & conversionVertex() const
returns the reco conversion vertex
Definition: Conversion.h:88
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:153
const Point & position() const
position
Definition: Vertex.h:113
math::XYZVectorF refittedPairMomentum() const
Conversion tracks momentum from the tracks refitted with vertex constraint.
Definition: Conversion.cc:206
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
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 133 of file ConversionTools.cc.

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

133  {
134  //check if given track matches given conversion (matching by ref)
135 
136  if (trk.isNull())
137  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();
141  ++it) {
142  if (trk.id() == it->id() && trk.key() == it->key())
143  return true;
144  }
145 
146  return false;
147 }
ProductID id() const
Definition: RefToBase.h:214
size_t key() const
Definition: RefToBase.h:219
bool isNull() const
Checks for null.
Definition: RefToBase.h:295
ProductIndex id() const
Definition: ProductID.h:35
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:150
bool ConversionTools::matchesConversion ( const reco::TrackRef trk,
const reco::Conversion conv 
)
static

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

150  {
151  //check if given track matches given conversion (matching by ref)
152 
153  if (trk.isNull())
154  return false;
155 
156  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
157  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it = convTracks.begin(); it != convTracks.end();
158  ++it) {
159  if (trk.id() == it->id() && trk.key() == it->key())
160  return true;
161  }
162 
163  return false;
164 }
key_type key() const
Accessor for product key.
Definition: Ref.h:250
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
bool isNull() const
Checks for null.
Definition: Ref.h:235
ProductIndex id() const
Definition: ProductID.h:35
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:150
bool ConversionTools::matchesConversion ( const reco::GsfTrackRef trk,
const reco::Conversion conv 
)
static

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

167  {
168  //check if given track matches given conversion (matching by ref)
169 
170  if (trk.isNull())
171  return false;
172 
173  const std::vector<edm::RefToBase<reco::Track> > &convTracks = conv.tracks();
174  for (std::vector<edm::RefToBase<reco::Track> >::const_iterator it = convTracks.begin(); it != convTracks.end();
175  ++it) {
176  if (trk.id() == it->id() && trk.key() == it->key())
177  return true;
178  }
179 
180  return false;
181 }
key_type key() const
Accessor for product key.
Definition: Ref.h:250
ProductID id() const
Accessor for product ID.
Definition: Ref.h:244
bool isNull() const
Checks for null.
Definition: Ref.h:235
ProductIndex id() const
Definition: ProductID.h:35
std::vector< edm::RefToBase< reco::Track > > const & tracks() const
vector of track to base references
Definition: Conversion.cc:150