CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ECALAndHCALCaloJetLinker.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
14  ( const reco::PFBlockElement*,
15  const reco::PFBlockElement* ) const override;
16 
17 private:
19 };
20 
23  "ECALAndHCALCaloJetLinker");
24 
26  ( const reco::PFBlockElement* elem1,
27  const reco::PFBlockElement* elem2) const {
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  dist = LinkByRecHit::computeDist( ecalreppos.Eta(),
52  ecalreppos.Phi(),
53  hcalref->positionREP().Eta(),
54  hcalref->positionREP().Phi() ) ;
55 
56  return (dist < 0.2 ? dist : -1.0);
57 }
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
#define NULL
Definition: scimark2.h:8
const PFClusterRef & clusterRef() const
double testLink(const reco::PFBlockElement *, const reco::PFBlockElement *) const override
ECALAndHCALCaloJetLinker(const edm::ParameterSet &conf)
bool isNull() const
Checks for null.
Definition: Ref.h:249
tuple conf
Definition: dbtoconf.py:185
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFCluster.h:54
#define DEFINE_EDM_PLUGIN(factory, type, name)
volatile std::atomic< bool > shutdown_flag false