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

Public Member Functions

bool linkPrefilter (const reco::PFBlockElement *, const reco::PFBlockElement *) const override
 
 PreshowerAndECALLinker (const edm::ParameterSet &conf)
 
double testLink (const reco::PFBlockElement *, const reco::PFBlockElement *) const override
 
- 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

bool _debug
 
bool _useKDTree
 

Detailed Description

Definition at line 6 of file PreshowerAndECALLinker.cc.

Constructor & Destructor Documentation

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

Definition at line 8 of file PreshowerAndECALLinker.cc.

8  :
10  _useKDTree(conf.getParameter<bool>("useKDTree")),
11  _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 PreshowerAndECALLinker::linkPrefilter ( const reco::PFBlockElement elem1,
const reco::PFBlockElement elem2 
) const
overridevirtual

Reimplemented from BlockElementLinkerBase.

Definition at line 28 of file PreshowerAndECALLinker.cc.

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

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

Implements BlockElementLinkerBase.

Definition at line 48 of file PreshowerAndECALLinker.cc.

References _debug, _useKDTree, reco::PFBlockElementCluster::clusterRef(), LinkByRecHit::computeDist(), Exception, edm::Ref< C, T, F >::isNull(), NULL, LinkByRecHit::testECALAndPSByRecHit(), and reco::PFBlockElement::type().

49  {
50  const reco::PFBlockElementCluster *pselem(NULL), *ecalelem(NULL);
51  double dist(-1.0);
52  if( elem1->type() < elem2->type() ) {
53  pselem = static_cast<const reco::PFBlockElementCluster*>(elem1);
54  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
55  } else {
56  pselem = static_cast<const reco::PFBlockElementCluster*>(elem2);
57  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
58  }
59  const reco::PFClusterRef& psref = pselem->clusterRef();
60  const reco::PFClusterRef& ecalref = ecalelem->clusterRef();
61  if( psref.isNull() || ecalref.isNull() ) {
62  throw cms::Exception("BadClusterRefs")
63  << "PFBlockElementCluster's refs are null!";
64  }
65  // Check if the linking has been done using the KDTree algo
66  // Glowinski & Gouzevitch
67  if ( _useKDTree && pselem->isMultilinksValide() ) { // KDTree algo
68  const reco::PFMultilinksType& multilinks = pselem->getMultilinks();
69  const reco::PFCluster::REPPoint& ecalreppos = ecalref->positionREP();
70  const math::XYZPoint& ecalxyzpos = ecalref->position();
71  const math::XYZPoint& psxyzpos = psref->position();
72  const double ecalPhi = ecalreppos.Phi();
73  const double ecalEta = ecalreppos.Eta();
74 
75  // Check if the link PS/Ecal exist
76  reco::PFMultilinksType::const_iterator mlit = multilinks.begin();
77  for (; mlit != multilinks.end(); ++mlit)
78  if ((mlit->first == ecalPhi) && (mlit->second == ecalEta))
79  break;
80 
81  // If the link exist, we fill dist and linktest.
82  if (mlit != multilinks.end()){
83  dist =
84  LinkByRecHit::computeDist(ecalxyzpos.X()/1000.,ecalxyzpos.Y()/1000.,
85  psxyzpos.X()/1000. ,psxyzpos.Y()/1000.,
86  false);
87  }
88  } else { //Old algorithm
89  dist = LinkByRecHit::testECALAndPSByRecHit( *ecalref, *psref ,_debug);
90  }
91  return dist;
92 }
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
static double testECALAndPSByRecHit(const reco::PFCluster &clusterECAL, const reco::PFCluster &clusterPS, bool debug=false)
Type type() const
#define NULL
Definition: scimark2.h:8
bool isNull() const
Checks for null.
Definition: Ref.h:249
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:54

Member Data Documentation

bool PreshowerAndECALLinker::_debug
private
bool PreshowerAndECALLinker::_useKDTree
private

Definition at line 20 of file PreshowerAndECALLinker.cc.

Referenced by linkPrefilter(), and testLink().