CMS 3D CMS Logo

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 BlockElementLinkerBase &)=delete
 
 BlockElementLinkerBase (const edm::ParameterSet &conf)
 
const std::string & name () const
 
BlockElementLinkerBaseoperator= (const BlockElementLinkerBase &)=delete
 
virtual ~BlockElementLinkerBase ()=default
 

Private Attributes

bool debug_
 
bool useKDTree_
 

Detailed Description

Definition at line 6 of file PreshowerAndECALLinker.cc.

Constructor & Destructor Documentation

◆ PreshowerAndECALLinker()

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

Definition at line 8 of file PreshowerAndECALLinker.cc.

10  useKDTree_(conf.getParameter<bool>("useKDTree")),
11  debug_(conf.getUntrackedParameter<bool>("debug", false)) {}

Member Function Documentation

◆ linkPrefilter()

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

Reimplemented from BlockElementLinkerBase.

Definition at line 23 of file PreshowerAndECALLinker.cc.

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

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

◆ testLink()

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

Implements BlockElementLinkerBase.

Definition at line 40 of file PreshowerAndECALLinker.cc.

40  {
41  const reco::PFBlockElementCluster *pselem(nullptr), *ecalelem(nullptr);
42  double dist(-1.0);
43  if (elem1->type() < elem2->type()) {
44  pselem = static_cast<const reco::PFBlockElementCluster*>(elem1);
45  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
46  } else {
47  pselem = static_cast<const reco::PFBlockElementCluster*>(elem2);
48  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
49  }
50  const reco::PFClusterRef& psref = pselem->clusterRef();
51  const reco::PFClusterRef& ecalref = ecalelem->clusterRef();
52  if (psref.isNull() || ecalref.isNull()) {
53  throw cms::Exception("BadClusterRefs") << "PFBlockElementCluster's refs are null!";
54  }
55  // Check if the linking has been done using the KDTree algo
56  // Glowinski & Gouzevitch
57  if (useKDTree_ && pselem->isMultilinksValide()) { // KDTree algo
58  const reco::PFMultilinksType& multilinks = pselem->getMultilinks();
59  const reco::PFCluster::REPPoint& ecalreppos = ecalref->positionREP();
60  const math::XYZPoint& ecalxyzpos = ecalref->position();
61  const math::XYZPoint& psxyzpos = psref->position();
62  const double ecalPhi = ecalreppos.Phi();
63  const double ecalEta = ecalreppos.Eta();
64 
65  // Check if the link PS/Ecal exist
66  reco::PFMultilinksType::const_iterator mlit = multilinks.begin();
67  for (; mlit != multilinks.end(); ++mlit)
68  if ((mlit->first == ecalPhi) && (mlit->second == ecalEta))
69  break;
70 
71  // If the link exist, we fill dist and linktest.
72  if (mlit != multilinks.end()) {
74  ecalxyzpos.X() / 1000., ecalxyzpos.Y() / 1000., psxyzpos.X() / 1000., psxyzpos.Y() / 1000., false);
75  }
76  } else { //Old algorithm
77  dist = LinkByRecHit::testECALAndPSByRecHit(*ecalref, *psref, debug_);
78  }
79  return dist;
80 }

References reco::PFBlockElementCluster::clusterRef(), LinkByRecHit::computeDist(), debug_, egammaTools::ecalEta(), egammaTools::ecalPhi(), Exception, edm::Ref< C, T, F >::isNull(), LinkByRecHit::testECALAndPSByRecHit(), reco::PFBlockElement::type(), and useKDTree_.

Member Data Documentation

◆ debug_

bool PreshowerAndECALLinker::debug_
private

Definition at line 18 of file PreshowerAndECALLinker.cc.

Referenced by testLink().

◆ useKDTree_

bool PreshowerAndECALLinker::useKDTree_
private

Definition at line 18 of file PreshowerAndECALLinker.cc.

Referenced by linkPrefilter(), and testLink().

egammaTools::ecalEta
double ecalEta(const math::XYZVector &momentum, const math::XYZPoint &vertex)
Definition: ECALPositionCalculator.cc:71
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
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
PreshowerAndECALLinker::useKDTree_
bool useKDTree_
Definition: PreshowerAndECALLinker.cc:18
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
reco::PFBlockElement::getMultilinks
const PFMultilinksType & getMultilinks() const
Definition: PFBlockElement.h:119
LinkByRecHit::testECALAndPSByRecHit
static double testECALAndPSByRecHit(const reco::PFCluster &clusterECAL, const reco::PFCluster &clusterPS, bool debug=false)
Definition: LinkByRecHit.cc:361
egammaTools::ecalPhi
double ecalPhi(const MagneticField &magField, const math::XYZVector &momentum, const math::XYZPoint &vertex, const int charge)
Definition: ECALPositionCalculator.cc:16
edm::Ref< PFClusterCollection >
BlockElementLinkerBase::BlockElementLinkerBase
BlockElementLinkerBase(const edm::ParameterSet &conf)
Definition: BlockElementLinkerBase.h:12
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::PFBlockElement::ECAL
Definition: PFBlockElement.h:35
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
reco::PFBlockElementCluster
Cluster Element.
Definition: PFBlockElementCluster.h:16
Exception
Definition: hltDiff.cc:246
PreshowerAndECALLinker::debug_
bool debug_
Definition: PreshowerAndECALLinker.cc:18
reco::PFBlockElement::type
Type type() const
Definition: PFBlockElement.h:69
mps_fire.result
result
Definition: mps_fire.py:303
reco::PFBlockElement::PS1
Definition: PFBlockElement.h:33
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
reco::PFBlockElement::PS2
Definition: PFBlockElement.h:34
reco::PFBlockElement::isMultilinksValide
bool isMultilinksValide() const
Definition: PFBlockElement.h:118