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, edm::ConsumesCollector &cc)
 
 ~PFRecHitCaloNavigatorWithTime () override
 
- Public Member Functions inherited from PFRecHitNavigatorBase
virtual void init (const edm::EventSetup &)=0
 
 PFRecHitNavigatorBase ()=default
 
 PFRecHitNavigatorBase (const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
 
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 29 of file PFRecHitCaloNavigatorWithTime.h.

Constructor & Destructor Documentation

◆ PFRecHitCaloNavigatorWithTime()

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

Definition at line 31 of file PFRecHitCaloNavigatorWithTime.h.

31  {
32  sigmaCut2_ = pow(iConfig.getParameter<double>("sigmaCut"), 2);
33  const edm::ParameterSet& timeResConf = iConfig.getParameterSet("timeResolutionCalc");
34  _timeResolutionCalc = std::make_unique<CaloRecHitResolutionProvider>(timeResConf);
35  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ParameterSet const & getParameterSet(std::string const &) const
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalc
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ ~PFRecHitCaloNavigatorWithTime()

template<typename D, typename T, bool ownsTopo = true>
PFRecHitCaloNavigatorWithTime< D, T, ownsTopo >::~PFRecHitCaloNavigatorWithTime ( )
inlineoverride

Definition at line 37 of file PFRecHitCaloNavigatorWithTime.h.

37  {
38  if (!ownsTopo) {
39  topology_.release();
40  }
41  }

Member Function Documentation

◆ associateNeighbour()

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 116 of file PFRecHitCaloNavigatorWithTime.h.

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

121  {
122  double sigma2 = 10000.0;
123 
124  auto found_hit = std::lower_bound(hits->begin(), hits->end(), id, [](const reco::PFRecHit& a, DetId b) {
125  if (DetId(a.detId()).det() == DetId::Hcal || b.det() == DetId::Hcal)
126  return (HcalDetId)(a.detId()) < (HcalDetId)(b);
127 
128  else
129  return a.detId() < b.rawId();
130  });
131 
132  if (found_hit != hits->end() &&
133  ((found_hit->detId() == id.rawId()) ||
134  ((id.det() == DetId::Hcal) && ((HcalDetId)(found_hit->detId()) == (HcalDetId)(id))))) {
135  sigma2 = _timeResolutionCalc->timeResolution2(hit.energy()) +
136  _timeResolutionCalc->timeResolution2(found_hit->energy());
137  const double deltaTime = hit.time() - found_hit->time();
138  if (deltaTime * deltaTime < sigmaCut2_ * sigma2) {
139  hit.addNeighbour(eta, phi, 0, found_hit - hits->begin());
140  }
141  }
142  }
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
std::unique_ptr< CaloRecHitResolutionProvider > _timeResolutionCalc
Definition: DetId.h:17
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121

◆ associateNeighbours()

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 43 of file PFRecHitCaloNavigatorWithTime.h.

45  {
46  DetId detid(hit.detId());
47 
49 
50  DetId N(0);
51  DetId E(0);
52  DetId S(0);
53  DetId W(0);
54  DetId NW(0);
55  DetId NE(0);
56  DetId SW(0);
57  DetId SE(0);
58 
59  N = navigator.north();
60  associateNeighbour(N, hit, hits, refProd, 0, 1);
61 
62  if (N != DetId(0)) {
63  NE = navigator.east();
64  } else {
65  navigator.home();
66  E = navigator.east();
67  NE = navigator.north();
68  }
69  associateNeighbour(NE, hit, hits, refProd, 1, 1);
70  navigator.home();
71 
72  S = navigator.south();
73  associateNeighbour(S, hit, hits, refProd, 0, -1);
74 
75  if (S != DetId(0)) {
76  SW = navigator.west();
77  } else {
78  navigator.home();
79  W = navigator.west();
80  SW = navigator.south();
81  }
82  associateNeighbour(SW, hit, hits, refProd, -1, -1);
83  navigator.home();
84 
85  E = navigator.east();
86  associateNeighbour(E, hit, hits, refProd, 1, 0);
87 
88  if (E != DetId(0)) {
89  SE = navigator.south();
90  } else {
91  navigator.home();
92  S = navigator.south();
93  SE = navigator.east();
94  }
95  associateNeighbour(SE, hit, hits, refProd, 1, -1);
96  navigator.home();
97 
98  W = navigator.west();
99  associateNeighbour(W, hit, hits, refProd, -1, 0);
100 
101  if (W != DetId(0)) {
102  NW = navigator.north();
103  } else {
104  navigator.home();
105  N = navigator.north();
106  NW = navigator.west();
107  }
108  associateNeighbour(NW, hit, hits, refProd, -1, 1);
109  }
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

Member Data Documentation

◆ _timeResolutionCalc

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

◆ sigmaCut2_

template<typename D, typename T, bool ownsTopo = true>
double PFRecHitCaloNavigatorWithTime< D, T, ownsTopo >::sigmaCut2_
protected

◆ topology_

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