CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HCALAndHOLinker.cc
Go to the documentation of this file.
5 
7 public:
10  useKDTree_(conf.getParameter<bool>("useKDTree")),
11  debug_(conf.getUntrackedParameter<bool>("debug", false)) {}
12 
13  double testLink(const reco::PFBlockElement*, const reco::PFBlockElement*) const override;
14 
15 private:
17 };
18 
20 
21 double HCALAndHOLinker::testLink(const reco::PFBlockElement* elem1, const reco::PFBlockElement* elem2) const {
22  const reco::PFBlockElementCluster *hcalelem(nullptr), *hoelem(nullptr);
23  double dist(-1.0);
24  if (elem1->type() < elem2->type()) {
25  hcalelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
26  hoelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
27  } else {
28  hcalelem = static_cast<const reco::PFBlockElementCluster*>(elem2);
29  hoelem = static_cast<const reco::PFBlockElementCluster*>(elem1);
30  }
31  const reco::PFClusterRef& hcalref = hcalelem->clusterRef();
32  const reco::PFClusterRef& horef = hoelem->clusterRef();
33  const reco::PFCluster::REPPoint& hcalreppos = hcalref->positionREP();
34  if (hcalref.isNull() || horef.isNull()) {
35  throw cms::Exception("BadClusterRefs") << "PFBlockElementCluster's refs are null!";
36  }
37  dist = (std::abs(hcalreppos.Eta()) < 1.5
39  hcalreppos.Eta(), hcalreppos.Phi(), horef->positionREP().Eta(), horef->positionREP().Phi())
40  : -1.0);
41  return (dist < 0.2 ? dist : -1.0);
42 }
Abstract base class for a PFBlock element (track, cluster...)
static double computeDist(double eta1, double phi1, double eta2, double phi2, bool etaPhi=true)
computes a chisquare
Type type() const
double testLink(const reco::PFBlockElement *, const reco::PFBlockElement *) const override
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
HCALAndHOLinker(const edm::ParameterSet &conf)
bool isNull() const
Checks for null.
Definition: Ref.h:235
const PFClusterRef & clusterRef() const override
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:48
#define DEFINE_EDM_PLUGIN(factory, type, name)