CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 

Private Attributes

bool _debug
 
bool _useConvertedBrems
 
bool _useKDTree
 

Detailed Description

Definition at line 7 of file TrackAndGSFLinker.cc.

Constructor & Destructor Documentation

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

Definition at line 9 of file TrackAndGSFLinker.cc.

9  :
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
T getUntrackedParameter(std::string const &, T const &) const
BlockElementLinkerBase(const edm::ParameterSet &conf)

Member Function Documentation

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

Implements BlockElementLinkerBase.

Definition at line 28 of file TrackAndGSFLinker.cc.

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

29  {
32  double dist = -1.0;
33  const reco::PFBlockElementGsfTrack * gsfelem(NULL);
34  const reco::PFBlockElementTrack * tkelem(NULL);
35  if( elem1->type() < elem2->type() ) {
36  tkelem = static_cast<const reco::PFBlockElementTrack *>(elem1);
37  gsfelem = static_cast<const reco::PFBlockElementGsfTrack *>(elem2);
38  } else {
39  tkelem = static_cast<const reco::PFBlockElementTrack *>(elem2);
40  gsfelem = static_cast<const reco::PFBlockElementGsfTrack *>(elem1);
41  }
42 
43  const reco::PFRecTrackRef& trackref = tkelem->trackRefPF();
44  const reco::GsfPFRecTrackRef& gsfref = gsfelem->GsftrackRefPF();
45  const reco::TrackRef& kftrackref= trackref->trackRef();
46  const reco::TrackBaseRef kftrackrefbase(kftrackref);
47  const reco::PFRecTrackRef& refkf = gsfref->kfPFRecTrackRef();
48  if(refkf.isNonnull()) {
49  const reco::TrackRef& gsftrackref = refkf->trackRef();
50  if ( gsftrackref.isNonnull() && kftrackref.isNonnull() &&
51  kftrackref == gsftrackref ) {
52  dist = 0.001;
53  }
54  }
55 
56  //override for converted brems
57  if(_useConvertedBrems) {
58  if(tkelem->isLinkedToDisplacedVertex()){
59  const std::vector<reco::PFRecTrackRef>& convbrems =
60  gsfref->convBremPFRecTrackRef();
61  for( const auto& convbrem : convbrems ) {
62  if( tkelem->trackType(T_FROM_GAMMACONV) &&
63  kftrackref == convbrem->trackRef() ) {
64  dist = 0.001;
65  } else { // check the base ref as well (for dedicated conversions?)
66  const reco::TrackBaseRef convbrembase(convbrem->trackRef());
67  if( convbrembase == kftrackrefbase ) {
68  dist = 0.001;
69  }
70  }
71  }
72  }
73  }
74  return dist;
75 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
Type type() const
#define NULL
Definition: scimark2.h:8
#define constexpr

Member Data Documentation

bool TrackAndGSFLinker::_debug
private
bool TrackAndGSFLinker::_useConvertedBrems
private

Definition at line 20 of file TrackAndGSFLinker.cc.

bool TrackAndGSFLinker::_useKDTree
private

Definition at line 20 of file TrackAndGSFLinker.cc.