CMS 3D CMS Logo

ECALAndHCALLinker.cc
Go to the documentation of this file.
5 
7 public:
10  minAbsEtaEcal_(conf.getParameter<double>("minAbsEtaEcal")),
11  useKDTree_(conf.getParameter<bool>("useKDTree")),
12  debug_(conf.getUntrackedParameter<bool>("debug", false)) {}
13 
14  double testLink(const reco::PFBlockElement*, const reco::PFBlockElement*) const override;
15 
16 private:
19 };
20 
22 
23 double ECALAndHCALLinker::testLink(const reco::PFBlockElement* elem1, const reco::PFBlockElement* elem2) const {
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 }
electrons_cff.bool
bool
Definition: electrons_cff.py:366
funct::false
false
Definition: Factorize.h:29
PFBlockElementCluster.h
edm::Ref::isNull
bool isNull() const
Checks for null.
Definition: Ref.h:235
ECALAndHCALLinker::minAbsEtaEcal_
double minAbsEtaEcal_
Definition: ECALAndHCALLinker.cc:17
BlockElementLinkerBase
Definition: BlockElementLinkerBase.h:10
edm::Ref< PFClusterCollection >
ECALAndHCALLinker::useKDTree_
bool useKDTree_
Definition: ECALAndHCALLinker.cc:18
ECALAndHCALLinker::ECALAndHCALLinker
ECALAndHCALLinker(const edm::ParameterSet &conf)
Definition: ECALAndHCALLinker.cc:8
ECALAndHCALLinker::testLink
double testLink(const reco::PFBlockElement *, const reco::PFBlockElement *) const override
Definition: ECALAndHCALLinker.cc:23
ECALAndHCALLinker::debug_
bool debug_
Definition: ECALAndHCALLinker.cc:18
PFCluster.h
DEFINE_EDM_PLUGIN
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition: PluginFactory.h:124
edm::ParameterSet
Definition: ParameterSet.h:47
edmplugin::PluginFactory
Definition: PluginFactory.h:34
LinkByRecHit.h
ECALAndHCALLinker
Definition: ECALAndHCALLinker.cc:6
reco::PFBlockElement
Abstract base class for a PFBlock element (track, cluster...)
Definition: PFBlockElement.h:26
reco::PFBlockElementCluster
Cluster Element.
Definition: PFBlockElementCluster.h:16
Exception
Definition: hltDiff.cc:245
BlockElementLinkerBase.h
reco::PFBlockElementCluster::clusterRef
const PFClusterRef & clusterRef() const override
Definition: PFBlockElementCluster.h:29
reco::PFBlockElement::type
Type type() const
Definition: PFBlockElement.h:69
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::PFCluster::REPPoint
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:48
LinkByRecHit::computeDist
static double computeDist(double eta1, double phi1, double eta2, double phi2, bool etaPhi=true)
computes a chisquare
Definition: LinkByRecHit.cc:519