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

Private Attributes

const bool _debug
 
const bool _useKDTree
 

Detailed Description

Definition at line 7 of file TrackAndECALLinker.cc.

Constructor & Destructor Documentation

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

Definition at line 9 of file TrackAndECALLinker.cc.

9  :
11  _useKDTree(conf.getParameter<bool>("useKDTree")),
12  _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

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

Reimplemented from BlockElementLinkerBase.

Definition at line 29 of file TrackAndECALLinker.cc.

References _useKDTree, reco::PFBlockElement::ECAL, reco::PFBlockElement::getMultilinks(), reco::PFBlockElement::isMultilinksValide(), query::result, reco::PFBlockElement::TRACK, and reco::PFBlockElement::type().

30  {
31  bool result = false;
32  switch( elem1->type() ){
34  result = (elem1->isMultilinksValide() && elem1->getMultilinks().size() > 0);
35  break;
37  result = (elem2->isMultilinksValide() && elem2->getMultilinks().size() > 0);
38  default:
39  break;
40  }
41  return (_useKDTree ? result : true);
42 }
Type type() const
tuple result
Definition: query.py:137
bool isMultilinksValide() const
const PFMultilinksType & getMultilinks() const
double TrackAndECALLinker::testLink ( const reco::PFBlockElement elem1,
const reco::PFBlockElement elem2 
) const
overridevirtual

Implements BlockElementLinkerBase.

Definition at line 45 of file TrackAndECALLinker.cc.

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

46  {
49  const reco::PFBlockElementCluster *ecalelem(NULL);
50  const reco::PFBlockElementTrack *tkelem(NULL);
51  double dist(-1.0);
52  if( elem1->type() < elem2->type() ) {
53  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem1);
54  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
55  } else {
56  tkelem = static_cast<const reco::PFBlockElementTrack*>(elem2);
57  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
58  }
59  const reco::PFRecTrackRef& trackref = tkelem->trackRefPF();
60  const reco::PFClusterRef& clusterref = ecalelem->clusterRef();
61  const reco::PFCluster::REPPoint& ecalreppos = clusterref->positionREP();
62  const reco::PFTrajectoryPoint& tkAtECAL =
63  trackref->extrapolatedPoint( ECALShowerMax );
64  const reco::PFCluster::REPPoint& tkreppos = tkAtECAL.positionREP();
65 
66  // Check if the linking has been done using the KDTree algo
67  // Glowinski & Gouzevitch
68  if ( _useKDTree && tkelem->isMultilinksValide() ) { //KDTree Algo
69  const reco::PFMultilinksType& multilinks = tkelem->getMultilinks();
70  const double ecalphi = ecalreppos.Phi();
71  const double ecaleta = ecalreppos.Eta();
72 
73  // Check if the link Track/Ecal exist
74  reco::PFMultilinksType::const_iterator mlit = multilinks.begin();
75  for (; mlit != multilinks.end(); ++mlit)
76  if ((mlit->first == ecalphi) && (mlit->second == ecaleta))
77  break;
78 
79  // If the link exist, we fill dist and linktest.
80  if (mlit != multilinks.end()){
81  dist = LinkByRecHit::computeDist(ecaleta, ecalphi,
82  tkreppos.Eta(), tkreppos.Phi());
83  }
84 
85  } else {// Old algorithm
86  if ( tkAtECAL.isValid() )
88  *clusterref,
89  false, _debug );
90  }
91 
92  if ( _debug ) {
93  if( dist > 0. ) {
94  std::cout << " Here a link has been established"
95  << " between a track an Ecal with dist "
96  << dist << std::endl;
97  } else
98  std::cout << " No link found " << std::endl;
99  }
100  return dist;
101 }
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
Type type() const
#define NULL
Definition: scimark2.h:8
#define constexpr
bool isValid() const
is this point valid ?
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:54
tuple cout
Definition: gather_cfg.py:121
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

const bool TrackAndECALLinker::_debug
private
const bool TrackAndECALLinker::_useKDTree
private

Definition at line 21 of file TrackAndECALLinker.cc.

Referenced by linkPrefilter(), and testLink().