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
TrackAndHCALLinker Class Reference
Inheritance diagram for TrackAndHCALLinker:
BlockElementLinkerBase

Public Member Functions

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

Detailed Description

Definition at line 8 of file TrackAndHCALLinker.cc.

Constructor & Destructor Documentation

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

Definition at line 10 of file TrackAndHCALLinker.cc.

10  :
12  _useKDTree(conf.getParameter<bool>("useKDTree")),
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 TrackAndHCALLinker::testLink ( const reco::PFBlockElement elem1,
const reco::PFBlockElement elem2 
) const
overridevirtual

Implements BlockElementLinkerBase.

Definition at line 28 of file TrackAndHCALLinker.cc.

References reco::PFBlockElementCluster::clusterRef(), LinkByRecHit::computeDist(), constexpr, reco::deltaPhi(), edm::hlt::Exception, reco::PFBlockElement::getMultilinks(), reco::PFTrajectoryPoint::HCALEntrance, reco::PFTrajectoryPoint::HCALExit, reco::PFBlockElement::isMultilinksValide(), reco::PFTrajectoryPoint::isValid(), NULL, reco::PFTrajectoryPoint::position(), reco::PFTrajectoryPoint::positionREP(), LinkByRecHit::testTrackAndClusterByRecHit(), reco::PFBlockElementTrack::trackRefPF(), and reco::PFBlockElement::type().

29  {
34  const reco::PFBlockElementCluster *hcalelem(NULL);
35  const reco::PFBlockElementTrack *tkelem(NULL);
36  double dist(-1.0);
37  if( elem1->type() < elem2->type() ) {
38  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem1);
39  hcalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
40  } else {
41  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem2);
42  hcalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
43  }
44  const reco::PFRecTrackRef& trackref = tkelem->trackRefPF();
45  const reco::PFClusterRef& clusterref = hcalelem->clusterRef();
46  const reco::PFCluster::REPPoint& hcalreppos = clusterref->positionREP();
47  const reco::PFTrajectoryPoint& tkAtHCALEnt =
48  trackref->extrapolatedPoint( HCALEntrance );
49  const reco::PFTrajectoryPoint& tkAtHCALEx =
50  trackref->extrapolatedPoint( HCALExit );
51  const double dHEta = ( tkAtHCALEx.positionREP().Eta() -
52  tkAtHCALEnt.positionREP().Eta() );
53  const double dHPhi = reco::deltaPhi( tkAtHCALEx.positionREP().Phi(),
54  tkAtHCALEnt.positionREP().Phi() );
55  if ( _useKDTree && hcalelem->isMultilinksValide() ) { //KDTree Algo
56  const reco::PFMultilinksType& multilinks = hcalelem->getMultilinks();
57  const double tracketa = tkAtHCALEnt.positionREP().Eta();
58  const double trackphi = tkAtHCALEnt.positionREP().Phi();
59 
60  // Check if the link Track/Hcal exist
61  reco::PFMultilinksType::const_iterator mlit = multilinks.begin();
62  for (; mlit != multilinks.end(); ++mlit)
63  if ((mlit->first == trackphi) && (mlit->second == tracketa))
64  break;
65 
66  // If the link exist, we fill dist and linktest.
67  if (mlit != multilinks.end()){
68  if (tkAtHCALEx.position().R()<tkAtHCALEnt.position().R()) {
69  throw cms::Exception("WorkingIn4DSpace")
70  << "Qu'est ce que c'est que ce gag ? "
71  << tkAtHCALEx.position().R() << " is smaller than "
72  << tkAtHCALEnt.position().R() << " !" << std::endl;
73  }
74  dist = LinkByRecHit::computeDist(hcalreppos.Eta(),
75  hcalreppos.Phi(),
76  tracketa + 0.1 * dHEta,
77  trackphi + 0.1 * dHPhi);
78  }
79  } else {// Old algorithm
80  if ( tkAtHCALEnt.isValid() )
82  *clusterref,
83  false, _debug );
84  }
85  return dist;
86 }
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
std::vector< std::pair< double, double > > PFMultilinksType
Abstract This class is used by the KDTree Track / Ecal Cluster linker to store all found links...
static double computeDist(double eta1, double phi1, double eta2, double phi2, bool etaPhi=true)
computes a chisquare
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< Double32_t > > REPPoint
Definition: PFCluster.h:51
const math::XYZPoint & position() const
cartesian position (x, y, z)
Type type() const
#define NULL
Definition: scimark2.h:8
#define constexpr
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
bool isValid() const
is this point valid ?
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:10

Member Data Documentation

bool TrackAndHCALLinker::_debug
private
bool TrackAndHCALLinker::_useKDTree
private

Definition at line 20 of file TrackAndHCALLinker.cc.