CMS 3D CMS Logo

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

Public Member Functions

bool linkPrefilter (const reco::PFBlockElement *, const reco::PFBlockElement *) const override
 
double testLink (const reco::PFBlockElement *, const reco::PFBlockElement *) const override
 
 TrackAndHCALLinker (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

bool checkExit_
 
bool debug_
 
reco::PFTrajectoryPoint::LayerType trajectoryLayerEntrance_
 
std::string trajectoryLayerEntranceString_
 
reco::PFTrajectoryPoint::LayerType trajectoryLayerExit_
 
std::string trajectoryLayerExitString_
 
bool useKDTree_
 

Detailed Description

Definition at line 10 of file TrackAndHCALLinker.cc.

Constructor & Destructor Documentation

◆ TrackAndHCALLinker()

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

Definition at line 12 of file TrackAndHCALLinker.cc.

References cms::cuda::assert(), checkExit_, reco::PFTrajectoryPoint::HCALEntrance, reco::PFTrajectoryPoint::HCALExit, reco::PFTrajectoryPoint::layerTypeByName(), trajectoryLayerEntrance_, trajectoryLayerEntranceString_, trajectoryLayerExit_, trajectoryLayerExitString_, reco::PFTrajectoryPoint::Unknown, and reco::PFTrajectoryPoint::VFcalEntrance.

Member Function Documentation

◆ linkPrefilter()

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

Reimplemented from BlockElementLinkerBase.

Definition at line 48 of file TrackAndHCALLinker.cc.

48  {
49  bool result = false;
50  // Track-HCAL KDTree multilinks are stored to track's elem
51  switch (elem1->type()) {
53  result = (elem1->isMultilinksValide(elem2->type()) && !elem1->getMultilinks(elem2->type()).empty() &&
54  elem2->isMultilinksValide(elem1->type()));
55  break;
57  result = (elem2->isMultilinksValide(elem1->type()) && !elem2->getMultilinks(elem1->type()).empty() &&
58  elem1->isMultilinksValide(elem2->type()));
59  default:
60  break;
61  }
62  return (useKDTree_ ? result : true);
63 }

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

◆ testLink()

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

Implements BlockElementLinkerBase.

Definition at line 65 of file TrackAndHCALLinker.cc.

65  {
66  const reco::PFBlockElementCluster* hcalelem(nullptr);
67  const reco::PFBlockElementTrack* tkelem(nullptr);
68  double dist(-1.0);
69  if (elem1->type() < elem2->type()) {
70  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem1);
71  hcalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
72  } else {
73  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem2);
74  hcalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
75  }
76  const reco::PFRecTrackRef& trackref = tkelem->trackRefPF();
77  const reco::PFClusterRef& clusterref = hcalelem->clusterRef();
78  const reco::PFCluster::REPPoint& hcalreppos = clusterref->positionREP();
79  const reco::PFTrajectoryPoint& tkAtHCALEnt = trackref->extrapolatedPoint(trajectoryLayerEntrance_);
80  const reco::PFCluster::REPPoint& tkreppos = tkAtHCALEnt.positionREP();
81  // Check exit point
82  double dHEta = 0.;
83  double dHPhi = 0.;
84  double dRHCALEx = 0.;
85  if (checkExit_) {
86  const reco::PFTrajectoryPoint& tkAtHCALEx = trackref->extrapolatedPoint(trajectoryLayerExit_);
87  dHEta = (tkAtHCALEx.positionREP().Eta() - tkAtHCALEnt.positionREP().Eta());
88  dHPhi = reco::deltaPhi(tkAtHCALEx.positionREP().Phi(), tkAtHCALEnt.positionREP().Phi());
89  dRHCALEx = tkAtHCALEx.position().R();
90  }
91 
92  // Check if the linking has been done using the KDTree algo
93  // Glowinski & Gouzevitch
94  if (useKDTree_ && tkelem->isMultilinksValide(hcalelem->type())) { //KDTree Algo
95  const reco::PFMultilinksType& multilinks = tkelem->getMultilinks(hcalelem->type());
96  const double hcalphi = hcalreppos.Phi();
97  const double hcaleta = hcalreppos.Eta();
98 
99  // Check if the link Track/Hcal exist
100  reco::PFMultilinksType::const_iterator mlit = multilinks.begin();
101  for (; mlit != multilinks.end(); ++mlit)
102  if ((mlit->first == hcalphi) && (mlit->second == hcaleta))
103  break;
104 
105  // If the link exist, we fill dist and linktest.
106 
107  if (mlit != multilinks.end()) {
108  // when checkExit_ is false
109  if (!checkExit_) {
110  dist = LinkByRecHit::computeDist(hcaleta, hcalphi, tkreppos.Eta(), tkreppos.Phi());
111  }
112  // when checkExit_ is true
113  else {
114  //special case ! A looper can exit the barrel inwards and hit the endcap
115  //In this case calculate the distance based on the first crossing since
116  //the looper will probably never make it to the endcap
117  if (dRHCALEx < tkAtHCALEnt.position().R()) {
118  dist = LinkByRecHit::computeDist(hcaleta, hcalphi, tkreppos.Eta(), tkreppos.Phi());
119  edm::LogWarning("TrackHCALLinker ")
120  << "Special case of linking with track hitting HCAL and looping back in the tracker ";
121  } else {
122  dist =
123  LinkByRecHit::computeDist(hcaleta, hcalphi, tkreppos.Eta() + 0.1 * dHEta, tkreppos.Phi() + 0.1 * dHPhi);
124  }
125  } // checkExit_
126  } // multilinks
127 
128  } else { // Old algorithm
129  if (tkAtHCALEnt.isValid())
130  dist = LinkByRecHit::testTrackAndClusterByRecHit(*trackref, *clusterref, false, debug_);
131  }
132  return dist;
133 }

References checkExit_, reco::PFBlockElementCluster::clusterRef(), LinkByRecHit::computeDist(), debug_, reco::deltaPhi(), reco::PFBlockElement::getMultilinks(), reco::PFBlockElement::isMultilinksValide(), reco::PFTrajectoryPoint::isValid(), reco::PFTrajectoryPoint::position(), reco::PFTrajectoryPoint::positionREP(), LinkByRecHit::testTrackAndClusterByRecHit(), reco::PFBlockElementTrack::trackRefPF(), trajectoryLayerEntrance_, trajectoryLayerExit_, reco::PFBlockElement::type(), and useKDTree_.

Member Data Documentation

◆ checkExit_

bool TrackAndHCALLinker::checkExit_
private

Definition at line 43 of file TrackAndHCALLinker.cc.

Referenced by testLink(), and TrackAndHCALLinker().

◆ debug_

bool TrackAndHCALLinker::debug_
private

Definition at line 42 of file TrackAndHCALLinker.cc.

Referenced by testLink().

◆ trajectoryLayerEntrance_

reco::PFTrajectoryPoint::LayerType TrackAndHCALLinker::trajectoryLayerEntrance_
private

Definition at line 40 of file TrackAndHCALLinker.cc.

Referenced by testLink(), and TrackAndHCALLinker().

◆ trajectoryLayerEntranceString_

std::string TrackAndHCALLinker::trajectoryLayerEntranceString_
private

Definition at line 38 of file TrackAndHCALLinker.cc.

Referenced by TrackAndHCALLinker().

◆ trajectoryLayerExit_

reco::PFTrajectoryPoint::LayerType TrackAndHCALLinker::trajectoryLayerExit_
private

Definition at line 41 of file TrackAndHCALLinker.cc.

Referenced by testLink(), and TrackAndHCALLinker().

◆ trajectoryLayerExitString_

std::string TrackAndHCALLinker::trajectoryLayerExitString_
private

Definition at line 39 of file TrackAndHCALLinker.cc.

Referenced by TrackAndHCALLinker().

◆ useKDTree_

bool TrackAndHCALLinker::useKDTree_
private

Definition at line 37 of file TrackAndHCALLinker.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
TrackAndHCALLinker::trajectoryLayerEntranceString_
std::string trajectoryLayerEntranceString_
Definition: TrackAndHCALLinker.cc:38
reco::deltaPhi
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
reco::PFTrajectoryPoint::HCALExit
HCAL exit.
Definition: PFTrajectoryPoint.h:50
LinkByRecHit::testTrackAndClusterByRecHit
static double testTrackAndClusterByRecHit(const reco::PFRecTrack &track, const reco::PFCluster &cluster, bool isBrem=false, bool debug=false)
Definition: LinkByRecHit.cc:18
cms::cuda::assert
assert(be >=bs)
reco::PFBlockElement::isMultilinksValide
bool isMultilinksValide(Type type) const
Definition: PFBlockElement.h:117
reco::PFBlockElement::HCAL
Definition: PFBlockElement.h:36
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
edm::Ref< PFRecTrackCollection >
reco::PFTrajectoryPoint::positionREP
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
Definition: PFTrajectoryPoint.h:103
TrackAndHCALLinker::checkExit_
bool checkExit_
Definition: TrackAndHCALLinker.cc:43
reco::PFBlockElement::TRACK
Definition: PFBlockElement.h:32
TrackAndHCALLinker::trajectoryLayerExit_
reco::PFTrajectoryPoint::LayerType trajectoryLayerExit_
Definition: TrackAndHCALLinker.cc:41
BlockElementLinkerBase::BlockElementLinkerBase
BlockElementLinkerBase(const edm::ParameterSet &conf)
Definition: BlockElementLinkerBase.h:12
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
reco::PFTrajectoryPoint::position
const math::XYZPoint & position() const
cartesian position (x, y, z)
Definition: PFTrajectoryPoint.h:100
reco::PFTrajectoryPoint::HCALEntrance
HCAL front face.
Definition: PFTrajectoryPoint.h:48
reco::PFTrajectoryPoint::layerTypeByName
static LayerType layerTypeByName(const std::string &name)
Definition: PFTrajectoryPoint.cc:42
reco::PFTrajectoryPoint::isValid
bool isValid() const
is this point valid ?
Definition: PFTrajectoryPoint.h:84
reco::PFTrajectoryPoint::VFcalEntrance
VFcal(HF) front face.
Definition: PFTrajectoryPoint.h:54
TrackAndHCALLinker::debug_
bool debug_
Definition: TrackAndHCALLinker.cc:42
reco::PFTrajectoryPoint::Unknown
Definition: PFTrajectoryPoint.h:58
reco::PFTrajectoryPoint
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
Definition: PFTrajectoryPoint.h:26
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
reco::PFBlockElementCluster
Cluster Element.
Definition: PFBlockElementCluster.h:16
reco::PFBlockElementTrack
Track Element.
Definition: PFBlockElementTrack.h:17
TrackAndHCALLinker::trajectoryLayerEntrance_
reco::PFTrajectoryPoint::LayerType trajectoryLayerEntrance_
Definition: TrackAndHCALLinker.cc:40
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
reco::PFBlockElement::type
Type type() const
Definition: PFBlockElement.h:69
mps_fire.result
result
Definition: mps_fire.py:311
TrackAndHCALLinker::trajectoryLayerExitString_
std::string trajectoryLayerExitString_
Definition: TrackAndHCALLinker.cc:39
reco::PFCluster::REPPoint
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:48
TrackAndHCALLinker::useKDTree_
bool useKDTree_
Definition: TrackAndHCALLinker.cc:37
reco::PFBlockElement::getMultilinks
const PFMultilinksType & getMultilinks(Type type) const
Definition: PFBlockElement.h:124
LinkByRecHit::computeDist
static double computeDist(double eta1, double phi1, double eta2, double phi2, bool etaPhi=true)
computes a chisquare
Definition: LinkByRecHit.cc:519