CMS 3D CMS Logo

TrackAndGSFLinker.cc
Go to the documentation of this file.
6 
8 public:
10  : BlockElementLinkerBase(conf),
11  useKDTree_(conf.getParameter<bool>("useKDTree")),
12  useConvertedBrems_(conf.getParameter<bool>("useConvertedBrems")),
13  debug_(conf.getUntrackedParameter<bool>("debug", false)) {}
14 
15  double testLink(const reco::PFBlockElement*, const reco::PFBlockElement*) const override;
16 
17 private:
19 };
20 
22 
23 double TrackAndGSFLinker::testLink(const reco::PFBlockElement* elem1, const reco::PFBlockElement* elem2) const {
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 }
reco::PFBlockElementTrack::trackType
bool trackType(TrackType trType) const override
Definition: PFBlockElementTrack.h:28
electrons_cff.bool
bool
Definition: electrons_cff.py:393
funct::false
false
Definition: Factorize.h:29
reco::PFBlockElementTrack::isLinkedToDisplacedVertex
bool isLinkedToDisplacedVertex() const override
Definition: PFBlockElementTrack.h:58
TrackAndGSFLinker::useConvertedBrems_
bool useConvertedBrems_
Definition: TrackAndGSFLinker.cc:18
BlockElementLinkerBase
Definition: BlockElementLinkerBase.h:10
edm::Ref< PFRecTrackCollection >
reco::PFBlockElementTrack::trackRefPF
const PFRecTrackRef & trackRefPF() const override
Definition: PFBlockElementTrack.h:46
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
TrackAndGSFLinker
Definition: TrackAndGSFLinker.cc:7
TrackAndGSFLinker::debug_
bool debug_
Definition: TrackAndGSFLinker.cc:18
reco::PFBlockElement::TrackType
TrackType
Definition: PFBlockElement.h:47
edm::ParameterSet
Definition: ParameterSet.h:47
edmplugin::PluginFactory
Definition: PluginFactory.h:34
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
LinkByRecHit.h
reco::PFBlockElement::T_FROM_GAMMACONV
Definition: PFBlockElement.h:47
PFRecTrack.h
reco::PFBlockElement
Abstract base class for a PFBlock element (track, cluster...)
Definition: PFBlockElement.h:26
TrackAndGSFLinker::TrackAndGSFLinker
TrackAndGSFLinker(const edm::ParameterSet &conf)
Definition: TrackAndGSFLinker.cc:9
reco::PFBlockElementGsfTrack
Track Element.
Definition: PFBlockElementGsfTrack.h:18
reco::PFBlockElementTrack
Track Element.
Definition: PFBlockElementTrack.h:17
edm::RefToBase< reco::Track >
BlockElementLinkerBase.h
reco::PFBlockElementGsfTrack::GsftrackRefPF
const GsfPFRecTrackRef & GsftrackRefPF() const
Definition: PFBlockElementGsfTrack.h:44
reco::PFBlockElement::type
Type type() const
Definition: PFBlockElement.h:69
PFBlockElementGsfTrack.h
PFBlockElementTrack.h
TrackAndGSFLinker::useKDTree_
bool useKDTree_
Definition: TrackAndGSFLinker.cc:18
TrackAndGSFLinker::testLink
double testLink(const reco::PFBlockElement *, const reco::PFBlockElement *) const override
Definition: TrackAndGSFLinker.cc:23