CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
ECALAndHCALLinker Class Reference
Inheritance diagram for ECALAndHCALLinker:
BlockElementLinkerBase

Public Member Functions

 ECALAndHCALLinker (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
 
virtual bool linkPrefilter (const reco::PFBlockElement *, const reco::PFBlockElement *) const
 
const std::string & name () const
 
BlockElementLinkerBaseoperator= (const BlockElementLinkerBase &)=delete
 
virtual ~BlockElementLinkerBase ()=default
 

Private Attributes

bool debug_
 
double minAbsEtaEcal_
 
bool useKDTree_
 

Detailed Description

Definition at line 6 of file ECALAndHCALLinker.cc.

Constructor & Destructor Documentation

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

Definition at line 8 of file ECALAndHCALLinker.cc.

10  minAbsEtaEcal_(conf.getParameter<double>("minAbsEtaEcal")),
11  useKDTree_(conf.getParameter<bool>("useKDTree")),
12  debug_(conf.getUntrackedParameter<bool>("debug", false)) {}
T getUntrackedParameter(std::string const &, T const &) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
BlockElementLinkerBase(const edm::ParameterSet &conf)

Member Function Documentation

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

Implements BlockElementLinkerBase.

Definition at line 23 of file ECALAndHCALLinker.cc.

References funct::abs(), reco::PFBlockElementCluster::clusterRef(), LinkByRecHit::computeDist(), Exception, edm::Ref< C, T, F >::isNull(), minAbsEtaEcal_, and reco::PFBlockElement::type().

23  {
24  const reco::PFBlockElementCluster *hcalelem(nullptr), *ecalelem(nullptr);
25  double dist(-1.0);
26  if (elem1->type() < elem2->type()) {
27  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
28  hcalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
29  } else {
30  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
31  hcalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
32  }
33  const reco::PFClusterRef& ecalref = ecalelem->clusterRef();
34  const reco::PFClusterRef& hcalref = hcalelem->clusterRef();
35  const reco::PFCluster::REPPoint& ecalreppos = ecalref->positionREP();
36  if (hcalref.isNull() || ecalref.isNull()) {
37  throw cms::Exception("BadClusterRefs") << "PFBlockElementCluster's refs are null!";
38  }
39  dist = (std::abs(ecalreppos.Eta()) > minAbsEtaEcal_
41  ecalreppos.Eta(), ecalreppos.Phi(), hcalref->positionREP().Eta(), hcalref->positionREP().Phi())
42  : -1.0);
43  return (dist < 0.2 ? dist : -1.0);
44 }
static double computeDist(double eta1, double phi1, double eta2, double phi2, bool etaPhi=true)
computes a chisquare
Type type() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isNull() const
Checks for null.
Definition: Ref.h:235
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:48

Member Data Documentation

bool ECALAndHCALLinker::debug_
private

Definition at line 18 of file ECALAndHCALLinker.cc.

double ECALAndHCALLinker::minAbsEtaEcal_
private

Definition at line 17 of file ECALAndHCALLinker.cc.

Referenced by testLink().

bool ECALAndHCALLinker::useKDTree_
private

Definition at line 18 of file ECALAndHCALLinker.cc.