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

Public Member Functions

 SCAndHGCalLinker (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 superClusterMatchByRef_
 
bool useKDTree_
 

Detailed Description

Definition at line 8 of file SCAndHGCalLinker.cc.

Constructor & Destructor Documentation

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

Definition at line 10 of file SCAndHGCalLinker.cc.

11  : BlockElementLinkerBase(conf),
12  useKDTree_(conf.getParameter<bool>("useKDTree")),
13  debug_(conf.getUntrackedParameter<bool>("debug", false)),
14  superClusterMatchByRef_(conf.getParameter<bool>("SuperClusterMatchByRef")) {}
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 SCAndHGCalLinker::testLink ( const reco::PFBlockElement elem1,
const reco::PFBlockElement elem2 
) const
overridevirtual

Implements BlockElementLinkerBase.

Definition at line 24 of file SCAndHGCalLinker.cc.

References reco::PFBlockElementCluster::clusterRef(), LinkByRecHit::computeDist(), Exception, edm::Ref< C, T, F >::isNull(), ClusterClusterMapping::overlap(), superClusterMatchByRef_, reco::PFBlockElementCluster::superClusterRef(), reco::PFBlockElementSuperCluster::superClusterRef(), and reco::PFBlockElement::type().

24  {
25  double dist = -1.0;
26  const reco::PFBlockElementCluster* ecalelem(nullptr);
27  const reco::PFBlockElementSuperCluster* scelem(nullptr);
28  if (elem1->type() > elem2->type()) {
29  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
30  scelem = static_cast<const reco::PFBlockElementSuperCluster*>(elem2);
31  } else {
32  ecalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
33  scelem = static_cast<const reco::PFBlockElementSuperCluster*>(elem1);
34  }
35  const reco::PFClusterRef& clus = ecalelem->clusterRef();
36  const reco::SuperClusterRef& sclus = scelem->superClusterRef();
37  if (sclus.isNull()) {
38  throw cms::Exception("BadRef") << "SuperClusterRef is invalid!";
39  }
40 
42  if (sclus == ecalelem->superClusterRef())
43  dist = 0.001;
44  } else {
45  if (ClusterClusterMapping::overlap(*sclus, *clus)) {
47  sclus->position().eta(), sclus->position().phi(), clus->positionREP().Eta(), clus->positionREP().Phi());
48  }
49  }
50 
51  return dist;
52 }
static double computeDist(double eta1, double phi1, double eta2, double phi2, bool etaPhi=true)
computes a chisquare
static bool overlap(const reco::CaloCluster &sc1, const reco::CaloCluster &sc, float minfrac=0.01, bool debug=false)
Type type() const
bool isNull() const
Checks for null.
Definition: Ref.h:235

Member Data Documentation

bool SCAndHGCalLinker::debug_
private

Definition at line 19 of file SCAndHGCalLinker.cc.

bool SCAndHGCalLinker::superClusterMatchByRef_
private

Definition at line 19 of file SCAndHGCalLinker.cc.

Referenced by testLink().

bool SCAndHGCalLinker::useKDTree_
private

Definition at line 19 of file SCAndHGCalLinker.cc.