CMS 3D CMS Logo

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

Public Member Functions

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

Private Attributes

const bool debug_
 
const bool useKDTree_
 

Detailed Description

Definition at line 7 of file TrackAndECALLinker.cc.

Constructor & Destructor Documentation

◆ TrackAndECALLinker()

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

Definition at line 9 of file TrackAndECALLinker.cc.

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

Member Function Documentation

◆ linkPrefilter()

bool TrackAndECALLinker::linkPrefilter ( const reco::PFBlockElement elem1,
const reco::PFBlockElement elem2 
) const
overridevirtual

Reimplemented from BlockElementLinkerBase.

Definition at line 24 of file TrackAndECALLinker.cc.

References reco::PFBlockElement::ECAL, relativeConstraints::empty, reco::PFBlockElement::getMultilinks(), reco::PFBlockElement::isMultilinksValide(), mps_fire::result, reco::PFBlockElement::TRACK, reco::PFBlockElement::type(), and useKDTree_.

24  {
25  bool result = false;
26  // Track-ECAL KDTree multilinks are stored to ecal's elem
27  switch (elem1->type()) {
29  result = (elem2->isMultilinksValide(elem1->type()) && !elem2->getMultilinks(elem1->type()).empty() &&
30  elem1->isMultilinksValide(elem2->type()));
31  break;
33  result = (elem1->isMultilinksValide(elem2->type()) && !elem1->getMultilinks(elem2->type()).empty() &&
34  elem2->isMultilinksValide(elem1->type()));
35  default:
36  break;
37  }
38  return (useKDTree_ ? result : true);
39 }
const PFMultilinksType & getMultilinks(Type type) const
bool isMultilinksValide(Type type) const

◆ testLink()

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

Implements BlockElementLinkerBase.

Definition at line 41 of file TrackAndECALLinker.cc.

References reco::PFBlockElementCluster::clusterRef(), LinkByRecHit::computeDist(), gather_cfg::cout, debug_, reco::PFTrajectoryPoint::ECALShowerMax, reco::PFBlockElement::getMultilinks(), reco::PFBlockElement::isMultilinksValide(), reco::PFTrajectoryPoint::isValid(), reco::PFTrajectoryPoint::positionREP(), LinkByRecHit::testTrackAndClusterByRecHit(), reco::PFBlockElementTrack::trackRefPF(), reco::PFBlockElement::type(), and useKDTree_.

41  {
43  const reco::PFBlockElementCluster* ecalelem(nullptr);
44  const reco::PFBlockElementTrack* tkelem(nullptr);
45  double dist(-1.0);
46  if (elem1->type() < elem2->type()) {
47  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem1);
48  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
49  } else {
50  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem2);
51  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
52  }
53  const reco::PFRecTrackRef& trackref = tkelem->trackRefPF();
54  const reco::PFClusterRef& clusterref = ecalelem->clusterRef();
55  const reco::PFCluster::REPPoint& ecalreppos = clusterref->positionREP();
56  const reco::PFTrajectoryPoint& tkAtECAL = trackref->extrapolatedPoint(ECALShowerMax);
57 
58  // Check if the linking has been done using the KDTree algo
59  // Glowinski & Gouzevitch
60  if (useKDTree_ && ecalelem->isMultilinksValide(tkelem->type())) { //KDTree Algo
61  const reco::PFMultilinksType& multilinks = ecalelem->getMultilinks(tkelem->type());
62  const double tracketa = tkAtECAL.positionREP().Eta();
63  const double trackphi = tkAtECAL.positionREP().Phi();
64  // Check if the link Track/Ecal exist
65  reco::PFMultilinksType::const_iterator mlit = multilinks.begin();
66  for (; mlit != multilinks.end(); ++mlit)
67  if (mlit->trackRef == trackref)
68  break;
69 
70  // If the link exist, we fill dist and linktest.
71  if (mlit != multilinks.end()) {
72  dist = LinkByRecHit::computeDist(ecalreppos.Eta(), ecalreppos.Phi(), tracketa, trackphi);
73  }
74 
75  } else { // Old algorithm
76  if (tkAtECAL.isValid())
77  dist = LinkByRecHit::testTrackAndClusterByRecHit(*trackref, *clusterref, false, debug_);
78  }
79 
80  if (debug_) {
81  if (dist > 0.) {
82  std::cout << " Here a link has been established"
83  << " between a track an Ecal with dist " << dist << std::endl;
84  } else
85  std::cout << " No link found " << std::endl;
86  }
87  return dist;
88 }
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
static double computeDist(double eta1, double phi1, double eta2, double phi2, bool etaPhi=true)
computes a chisquare
bool isValid() const
is this point valid ?
std::vector< PFMultilink > PFMultilinksType
collection of PFSuperCluster objects
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:48
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
LayerType
Define the different layers where the track can be propagated.
static double testTrackAndClusterByRecHit(const reco::PFRecTrack &track, const reco::PFCluster &cluster, bool isBrem=false, bool debug=false)
Definition: LinkByRecHit.cc:18

Member Data Documentation

◆ debug_

const bool TrackAndECALLinker::debug_
private

Definition at line 19 of file TrackAndECALLinker.cc.

Referenced by testLink().

◆ useKDTree_

const bool TrackAndECALLinker::useKDTree_
private

Definition at line 19 of file TrackAndECALLinker.cc.

Referenced by linkPrefilter(), and testLink().