CMS 3D CMS Logo

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

References testLink().

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

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

Implements BlockElementLinkerBase.

Definition at line 26 of file ECALAndHCALLinker.cc.

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

Referenced by ECALAndHCALLinker().

27  {
28  const reco::PFBlockElementCluster *hcalelem(NULL), *ecalelem(NULL);
29  double dist(-1.0);
30  if( elem1->type() < elem2->type() ) {
31  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
32  hcalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
33  } else {
34  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
35  hcalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
36  }
37  const reco::PFClusterRef& ecalref = ecalelem->clusterRef();
38  const reco::PFClusterRef& hcalref = hcalelem->clusterRef();
39  const reco::PFCluster::REPPoint& ecalreppos = ecalref->positionREP();
40  if( hcalref.isNull() || ecalref.isNull() ) {
41  throw cms::Exception("BadClusterRefs")
42  << "PFBlockElementCluster's refs are null!";
43  }
44  dist = ( std::abs(ecalreppos.Eta()) > 2.5 ?
45  LinkByRecHit::computeDist( ecalreppos.Eta(),
46  ecalreppos.Phi(),
47  hcalref->positionREP().Eta(),
48  hcalref->positionREP().Phi() )
49  : -1.0 );
50  return (dist < 0.2 ? dist : -1.0);
51 }
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
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isNull() const
Checks for null.
Definition: Ref.h:250
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:54

Member Data Documentation

bool ECALAndHCALLinker::_debug
private
bool ECALAndHCALLinker::_useKDTree
private

Definition at line 18 of file ECALAndHCALLinker.cc.