CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TrackAndGSFLinker Class Reference
Inheritance diagram for TrackAndGSFLinker:
BlockElementLinkerBase

Public Member Functions

double testLink (const reco::PFBlockElement *, const reco::PFBlockElement *) const override
 
 TrackAndGSFLinker (const edm::ParameterSet &conf)
 
- Public Member Functions inherited from BlockElementLinkerBase
 BlockElementLinkerBase (const edm::ParameterSet &conf)
 
 BlockElementLinkerBase (const BlockElementLinkerBase &)=delete
 
virtual bool linkPrefilter (const reco::PFBlockElement *, const reco::PFBlockElement *) const
 
const std::string & name () const
 
BlockElementLinkerBaseoperator= (const BlockElementLinkerBase &)=delete
 
virtual ~BlockElementLinkerBase ()=default
 

Private Attributes

bool debug_
 
bool useConvertedBrems_
 
bool useKDTree_
 

Detailed Description

Definition at line 7 of file TrackAndGSFLinker.cc.

Constructor & Destructor Documentation

◆ TrackAndGSFLinker()

TrackAndGSFLinker::TrackAndGSFLinker ( const edm::ParameterSet conf)
inline

Definition at line 9 of file TrackAndGSFLinker.cc.

10  : BlockElementLinkerBase(conf),
11  useKDTree_(conf.getParameter<bool>("useKDTree")),
12  useConvertedBrems_(conf.getParameter<bool>("useConvertedBrems")),
13  debug_(conf.getUntrackedParameter<bool>("debug", false)) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
T getUntrackedParameter(std::string const &, T const &) const
BlockElementLinkerBase(const edm::ParameterSet &conf)

Member Function Documentation

◆ testLink()

double TrackAndGSFLinker::testLink ( const reco::PFBlockElement elem1,
const reco::PFBlockElement elem2 
) const
overridevirtual

Implements BlockElementLinkerBase.

Definition at line 23 of file TrackAndGSFLinker.cc.

References reco::PFBlockElementGsfTrack::GsftrackRefPF(), reco::PFBlockElementTrack::isLinkedToDisplacedVertex(), edm::Ref< C, T, F >::isNonnull(), reco::PFBlockElement::T_FROM_GAMMACONV, reco::PFBlockElementTrack::trackRefPF(), reco::PFBlockElementTrack::trackType(), reco::PFBlockElement::type(), and useConvertedBrems_.

23  {
25  double dist = -1.0;
26  const reco::PFBlockElementGsfTrack* gsfelem(nullptr);
27  const reco::PFBlockElementTrack* tkelem(nullptr);
28  if (elem1->type() < elem2->type()) {
29  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem1);
30  gsfelem = static_cast<const reco::PFBlockElementGsfTrack*>(elem2);
31  } else {
32  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem2);
33  gsfelem = static_cast<const reco::PFBlockElementGsfTrack*>(elem1);
34  }
35 
36  const reco::PFRecTrackRef& trackref = tkelem->trackRefPF();
37  const reco::GsfPFRecTrackRef& gsfref = gsfelem->GsftrackRefPF();
38  const reco::TrackRef& kftrackref = trackref->trackRef();
39  const reco::TrackBaseRef kftrackrefbase(kftrackref);
40  const reco::PFRecTrackRef& refkf = gsfref->kfPFRecTrackRef();
41  if (refkf.isNonnull()) {
42  const reco::TrackRef& gsftrackref = refkf->trackRef();
43  if (gsftrackref.isNonnull() && kftrackref.isNonnull() && kftrackref == gsftrackref) {
44  dist = 0.001;
45  }
46  }
47 
48  //override for converted brems
49  if (useConvertedBrems_) {
50  if (tkelem->isLinkedToDisplacedVertex()) {
51  const std::vector<reco::PFRecTrackRef>& convbrems = gsfref->convBremPFRecTrackRef();
52  for (const auto& convbrem : convbrems) {
53  if (tkelem->trackType(T_FROM_GAMMACONV) && kftrackref == convbrem->trackRef()) {
54  dist = 0.001;
55  } else { // check the base ref as well (for dedicated conversions?)
56  const reco::TrackBaseRef convbrembase(convbrem->trackRef());
57  if (convbrembase == kftrackrefbase) {
58  dist = 0.001;
59  }
60  }
61  }
62  }
63  }
64  return dist;
65 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238

Member Data Documentation

◆ debug_

bool TrackAndGSFLinker::debug_
private

Definition at line 18 of file TrackAndGSFLinker.cc.

◆ useConvertedBrems_

bool TrackAndGSFLinker::useConvertedBrems_
private

Definition at line 18 of file TrackAndGSFLinker.cc.

Referenced by testLink().

◆ useKDTree_

bool TrackAndGSFLinker::useKDTree_
private

Definition at line 18 of file TrackAndGSFLinker.cc.