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 BlockElementLinkerBase &)=delete
 
 BlockElementLinkerBase (const edm::ParameterSet &conf)
 
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)) {}

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.

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

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

◆ testLink()

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

Implements BlockElementLinkerBase.

Definition at line 39 of file TrackAndECALLinker.cc.

39  {
41  const reco::PFBlockElementCluster* ecalelem(nullptr);
42  const reco::PFBlockElementTrack* tkelem(nullptr);
43  double dist(-1.0);
44  if (elem1->type() < elem2->type()) {
45  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem1);
46  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
47  } else {
48  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem2);
49  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
50  }
51  const reco::PFRecTrackRef& trackref = tkelem->trackRefPF();
52  const reco::PFClusterRef& clusterref = ecalelem->clusterRef();
53  const reco::PFCluster::REPPoint& ecalreppos = clusterref->positionREP();
54  const reco::PFTrajectoryPoint& tkAtECAL = trackref->extrapolatedPoint(ECALShowerMax);
55  const reco::PFCluster::REPPoint& tkreppos = tkAtECAL.positionREP();
56 
57  // Check if the linking has been done using the KDTree algo
58  // Glowinski & Gouzevitch
59  if (useKDTree_ && tkelem->isMultilinksValide()) { //KDTree Algo
60  const reco::PFMultilinksType& multilinks = tkelem->getMultilinks();
61  const double ecalphi = ecalreppos.Phi();
62  const double ecaleta = ecalreppos.Eta();
63 
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->first == ecalphi) && (mlit->second == ecaleta))
68  break;
69 
70  // If the link exist, we fill dist and linktest.
71  if (mlit != multilinks.end()) {
72  dist = LinkByRecHit::computeDist(ecaleta, ecalphi, tkreppos.Eta(), tkreppos.Phi());
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 }

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_.

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

reco::PFMultilinksType
std::vector< std::pair< double, double > > PFMultilinksType
Abstract This class is used by the KDTree Track / Ecal Cluster linker to store all found links.
Definition: PFMultilinksTC.h:13
TrackAndECALLinker::useKDTree_
const bool useKDTree_
Definition: TrackAndECALLinker.cc:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
LinkByRecHit::testTrackAndClusterByRecHit
static double testTrackAndClusterByRecHit(const reco::PFRecTrack &track, const reco::PFCluster &cluster, bool isBrem=false, bool debug=false)
Definition: LinkByRecHit.cc:16
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
reco::PFBlockElement::getMultilinks
const PFMultilinksType & getMultilinks() const
Definition: PFBlockElement.h:119
edm::Ref< PFRecTrackCollection >
reco::PFTrajectoryPoint::positionREP
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
Definition: PFTrajectoryPoint.h:103
reco::PFBlockElement::TRACK
Definition: PFBlockElement.h:32
reco::PFTrajectoryPoint::ECALShowerMax
Definition: PFTrajectoryPoint.h:46
BlockElementLinkerBase::BlockElementLinkerBase
BlockElementLinkerBase(const edm::ParameterSet &conf)
Definition: BlockElementLinkerBase.h:12
reco::PFBlockElement::ECAL
Definition: PFBlockElement.h:35
reco::PFTrajectoryPoint::LayerType
LayerType
Define the different layers where the track can be propagated.
Definition: PFTrajectoryPoint.h:34
reco::PFTrajectoryPoint::isValid
bool isValid() const
is this point valid ?
Definition: PFTrajectoryPoint.h:84
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
reco::PFTrajectoryPoint
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
Definition: PFTrajectoryPoint.h:26
reco::PFBlockElementCluster
Cluster Element.
Definition: PFBlockElementCluster.h:16
reco::PFBlockElementTrack
Track Element.
Definition: PFBlockElementTrack.h:17
reco::PFBlockElement::type
Type type() const
Definition: PFBlockElement.h:69
mps_fire.result
result
Definition: mps_fire.py:303
reco::PFCluster::REPPoint
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:52
LinkByRecHit::computeDist
static double computeDist(double eta1, double phi1, double eta2, double phi2, bool etaPhi=true)
computes a chisquare
Definition: LinkByRecHit.cc:517
TrackAndECALLinker::debug_
const bool debug_
Definition: TrackAndECALLinker.cc:19
reco::PFBlockElement::isMultilinksValide
bool isMultilinksValide() const
Definition: PFBlockElement.h:118