CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PFRecHitCaloNavigator.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFClusterProducer_PFRecHitCaloNavigator_h
2 #define RecoParticleFlow_PFClusterProducer_PFRecHitCaloNavigator_h
3 
7 
13 
18 
21 
22 template <typename DET, typename TOPO, bool ownsTopo = true>
24 public:
26  if (!ownsTopo) {
27  topology_.release();
28  }
29  }
30 
32  std::unique_ptr<reco::PFRecHitCollection>& hits,
33  edm::RefProd<reco::PFRecHitCollection>& refProd) override {
34  DetId detid(hit.detId());
35 
37 
38  DetId N(0);
39  DetId E(0);
40  DetId S(0);
41  DetId W(0);
42  DetId NW(0);
43  DetId NE(0);
44  DetId SW(0);
45  DetId SE(0);
46 
47  N = navigator.north();
48  associateNeighbour(N, hit, hits, refProd, 0, 1, 0);
49 
50  if (N != DetId(0)) {
51  NE = navigator.east();
52  } else {
53  navigator.home();
54  E = navigator.east();
55  NE = navigator.north();
56  }
57  associateNeighbour(NE, hit, hits, refProd, 1, 1, 0);
58  navigator.home();
59 
60  S = navigator.south();
61  associateNeighbour(S, hit, hits, refProd, 0, -1, 0);
62 
63  if (S != DetId(0)) {
64  SW = navigator.west();
65  } else {
66  navigator.home();
67  W = navigator.west();
68  SW = navigator.south();
69  }
70  associateNeighbour(SW, hit, hits, refProd, -1, -1, 0);
71  navigator.home();
72 
73  E = navigator.east();
74  associateNeighbour(E, hit, hits, refProd, 1, 0, 0);
75 
76  if (E != DetId(0)) {
77  SE = navigator.south();
78  } else {
79  navigator.home();
80  S = navigator.south();
81  SE = navigator.east();
82  }
83  associateNeighbour(SE, hit, hits, refProd, 1, -1, 0);
84  navigator.home();
85 
86  W = navigator.west();
87  associateNeighbour(W, hit, hits, refProd, -1, 0, 0);
88 
89  if (W != DetId(0)) {
90  NW = navigator.north();
91  } else {
92  navigator.home();
93  N = navigator.north();
94  NW = navigator.west();
95  }
96  associateNeighbour(NW, hit, hits, refProd, -1, 1, 0);
97  }
98 
99 protected:
100  std::unique_ptr<const TOPO> topology_;
101 };
102 
103 #endif
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)
unsigned detId() const
rechit detId
Definition: PFRecHit.h:93
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
void associateNeighbours(reco::PFRecHit &hit, std::unique_ptr< reco::PFRecHitCollection > &hits, edm::RefProd< reco::PFRecHitCollection > &refProd) override
Definition: DetId.h:17
#define N
Definition: blowfish.cc:9
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:97
std::unique_ptr< const TOPO > topology_