CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
PFRecHitCaloNavigatorWithTime< D, T, ownsTopo > Class Template Reference

#include <PFRecHitCaloNavigatorWithTime.h>

Inheritance diagram for PFRecHitCaloNavigatorWithTime< D, T, ownsTopo >:
PFRecHitNavigatorBase

Public Member Functions

void associateNeighbours (reco::PFRecHit &hit, std::unique_ptr< reco::PFRecHitCollection > &hits, edm::RefProd< reco::PFRecHitCollection > &refProd) override
 
 PFRecHitCaloNavigatorWithTime (const edm::ParameterSet &iConfig)
 
 ~PFRecHitCaloNavigatorWithTime () override
 
- Public Member Functions inherited from PFRecHitNavigatorBase
virtual void beginEvent (const edm::EventSetup &)=0
 
 PFRecHitNavigatorBase ()=default
 
 PFRecHitNavigatorBase (const edm::ParameterSet &iConfig)
 
virtual ~PFRecHitNavigatorBase ()=default
 

Protected Member Functions

void associateNeighbour (const DetId &id, reco::PFRecHit &hit, std::unique_ptr< reco::PFRecHitCollection > &hits, edm::RefProd< reco::PFRecHitCollection > &refProd, short eta, short phi)
 
- Protected Member Functions inherited from PFRecHitNavigatorBase
void associateNeighbour (const DetId &id, reco::PFRecHit &hit, std::unique_ptr< reco::PFRecHitCollection > &hits, edm::RefProd< reco::PFRecHitCollection > &refProd, short eta, short phi, short depth)
 

Protected Attributes

std::unique_ptr< CaloRecHitResolutionProvider_timeResolutionCalc
 
double sigmaCut2_
 
std::unique_ptr< const Ttopology_
 

Additional Inherited Members

- Public Types inherited from PFRecHitNavigatorBase
typedef std::unordered_map< unsigned, unsigned > DetIdToHitIdx
 

Detailed Description

template<typename D, typename T, bool ownsTopo = true>
class PFRecHitCaloNavigatorWithTime< D, T, ownsTopo >

Definition at line 26 of file PFRecHitCaloNavigatorWithTime.h.

Constructor & Destructor Documentation

template<typename D, typename T, bool ownsTopo = true>
PFRecHitCaloNavigatorWithTime< D, T, ownsTopo >::PFRecHitCaloNavigatorWithTime ( const edm::ParameterSet iConfig)
inline

Definition at line 28 of file PFRecHitCaloNavigatorWithTime.h.

28  {
29  sigmaCut2_ = pow(iConfig.getParameter<double>("sigmaCut"), 2);
30  const edm::ParameterSet& timeResConf = iConfig.getParameterSet("timeResolutionCalc");
31  _timeResolutionCalc.reset(new CaloRecHitResolutionProvider(timeResConf));
32  }
T getParameter(std::string const &) const
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalc
ParameterSet const & getParameterSet(std::string const &) const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
template<typename D, typename T, bool ownsTopo = true>
PFRecHitCaloNavigatorWithTime< D, T, ownsTopo >::~PFRecHitCaloNavigatorWithTime ( )
inlineoverride

Definition at line 34 of file PFRecHitCaloNavigatorWithTime.h.

34  {
35  if (!ownsTopo) {
36  topology_.release();
37  }
38  }

Member Function Documentation

template<typename D, typename T, bool ownsTopo = true>
void PFRecHitCaloNavigatorWithTime< D, T, ownsTopo >::associateNeighbour ( const DetId id,
reco::PFRecHit hit,
std::unique_ptr< reco::PFRecHitCollection > &  hits,
edm::RefProd< reco::PFRecHitCollection > &  refProd,
short  eta,
short  phi 
)
inlineprotected

Definition at line 113 of file PFRecHitCaloNavigatorWithTime.h.

Referenced by PFRecHitCaloNavigatorWithTime< EEDetId, EcalEndcapTopology >::associateNeighbours().

118  {
119  double sigma2 = 10000.0;
120 
121  auto found_hit = std::lower_bound(hits->begin(), hits->end(), id, [](const reco::PFRecHit& a, DetId b) {
122  if (DetId(a.detId()).det() == DetId::Hcal || b.det() == DetId::Hcal)
123  return (HcalDetId)(a.detId()) < (HcalDetId)(b);
124 
125  else
126  return a.detId() < b.rawId();
127  });
128 
129  if (found_hit != hits->end() &&
130  ((found_hit->detId() == id.rawId()) ||
131  ((id.det() == DetId::Hcal) && ((HcalDetId)(found_hit->detId()) == (HcalDetId)(id))))) {
132  sigma2 = _timeResolutionCalc->timeResolution2(hit.energy()) +
133  _timeResolutionCalc->timeResolution2(found_hit->energy());
134  const double deltaTime = hit.time() - found_hit->time();
135  if (deltaTime * deltaTime < sigmaCut2_ * sigma2) {
136  hit.addNeighbour(eta, phi, 0, found_hit - hits->begin());
137  }
138  }
139  }
float time() const
timing for cleaned hits
Definition: PFRecHit.h:98
void addNeighbour(short x, short y, short z, unsigned int)
Definition: PFRecHit.cc:5
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalc
float energy() const
rechit energy
Definition: PFRecHit.h:95
Definition: DetId.h:17
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
template<typename D, typename T, bool ownsTopo = true>
void PFRecHitCaloNavigatorWithTime< D, T, ownsTopo >::associateNeighbours ( reco::PFRecHit hit,
std::unique_ptr< reco::PFRecHitCollection > &  hits,
edm::RefProd< reco::PFRecHitCollection > &  refProd 
)
inlineoverridevirtual

Implements PFRecHitNavigatorBase.

Definition at line 40 of file PFRecHitCaloNavigatorWithTime.h.

42  {
43  DetId detid(hit.detId());
44 
45  CaloNavigator<D> navigator(detid, topology_.get());
46 
47  DetId N(0);
48  DetId E(0);
49  DetId S(0);
50  DetId W(0);
51  DetId NW(0);
52  DetId NE(0);
53  DetId SW(0);
54  DetId SE(0);
55 
56  N = navigator.north();
57  associateNeighbour(N, hit, hits, refProd, 0, 1);
58 
59  if (N != DetId(0)) {
60  NE = navigator.east();
61  } else {
62  navigator.home();
63  E = navigator.east();
64  NE = navigator.north();
65  }
66  associateNeighbour(NE, hit, hits, refProd, 1, 1);
67  navigator.home();
68 
69  S = navigator.south();
70  associateNeighbour(S, hit, hits, refProd, 0, -1);
71 
72  if (S != DetId(0)) {
73  SW = navigator.west();
74  } else {
75  navigator.home();
76  W = navigator.west();
77  SW = navigator.south();
78  }
79  associateNeighbour(SW, hit, hits, refProd, -1, -1);
80  navigator.home();
81 
82  E = navigator.east();
83  associateNeighbour(E, hit, hits, refProd, 1, 0);
84 
85  if (E != DetId(0)) {
86  SE = navigator.south();
87  } else {
88  navigator.home();
89  S = navigator.south();
90  SE = navigator.east();
91  }
92  associateNeighbour(SE, hit, hits, refProd, 1, -1);
93  navigator.home();
94 
95  W = navigator.west();
96  associateNeighbour(W, hit, hits, refProd, -1, 0);
97 
98  if (W != DetId(0)) {
99  NW = navigator.north();
100  } else {
101  navigator.home();
102  N = navigator.north();
103  NW = navigator.west();
104  }
105  associateNeighbour(NW, hit, hits, refProd, -1, 1);
106  }
unsigned detId() const
rechit detId
Definition: PFRecHit.h:89
void associateNeighbour(const DetId &id, reco::PFRecHit &hit, std::unique_ptr< reco::PFRecHitCollection > &hits, edm::RefProd< reco::PFRecHitCollection > &refProd, short eta, short phi)
Definition: DetId.h:17
#define N
Definition: blowfish.cc:9
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:97

Member Data Documentation

template<typename D, typename T, bool ownsTopo = true>
std::unique_ptr<CaloRecHitResolutionProvider> PFRecHitCaloNavigatorWithTime< D, T, ownsTopo >::_timeResolutionCalc
protected
template<typename D, typename T, bool ownsTopo = true>
double PFRecHitCaloNavigatorWithTime< D, T, ownsTopo >::sigmaCut2_
protected
template<typename D, typename T, bool ownsTopo = true>
std::unique_ptr<const T> PFRecHitCaloNavigatorWithTime< D, T, ownsTopo >::topology_
protected