CMS 3D CMS Logo

PFRecHit.h
Go to the documentation of this file.
1 #ifndef ParticleFlowReco_PFRecHit_h
2 #define ParticleFlowReco_PFRecHit_h
3 
5 #include <vector>
6 #include <map>
7 #include <memory>
8 #include <iostream>
9 
12 #include "Math/GenVector/PositionVector3D.h"
15 
18 
21 
22 namespace reco {
23 
32  class PFRecHit {
33  public:
39 
40  struct Neighbours {
41  using Pointer = unsigned int const*;
43  Neighbours(Pointer ib, unsigned int n) : b(ib), e(ib + n) {}
45  Pointer begin() const { return b; }
46  Pointer end() const { return e; }
47  unsigned int size() const { return e - b; }
48  };
49 
50  enum { NONE = 0 };
52  PFRecHit() {}
53 
55  CaloCellGeometryMayOwnPtr caloCell, unsigned int detId, PFLayer::Layer layer, float energy, uint32_t flags = 0)
57 
59  PFRecHit(const PFRecHit& other) = default;
60  PFRecHit(PFRecHit&& other) = default;
61  PFRecHit& operator=(const PFRecHit& other) = default;
62  PFRecHit& operator=(PFRecHit&& other) = default;
63 
65  ~PFRecHit() = default;
66 
67  void setEnergy(float energy) { energy_ = energy; }
68 
69  void addNeighbour(short x, short y, short z, unsigned int);
70  unsigned int getNeighbour(short x, short y, short z) const;
71  void setTime(double time) { time_ = time; }
72  void setDepth(int depth) { depth_ = depth; }
73  void clearNeighbours() {
74  neighbours_.clear();
75  neighbourInfos_.clear();
77  }
78 
81 
82  Neighbours neighbours() const { return buildNeighbours(neighbours_.size()); }
83 
84  const std::vector<unsigned short>& neighbourInfos() { return neighbourInfos_; }
85 
87  CaloCellGeometry const& caloCell() const { return *(caloCell_.get()); }
88  bool hasCaloCell() const { return (caloCell_ != nullptr); }
89 
91  unsigned detId() const { return detId_; }
92 
94  PFLayer::Layer layer() const { return layer_; }
95 
97  float energy() const { return energy_; }
98 
100  float time() const { return time_; }
101 
103  int depth() const { return depth_; }
104 
106  double pt2() const { return energy_ * energy_ * (position().perp2() / position().mag2()); }
107 
108  // Detector-dependent status flag
109  uint32_t flags() const { return flags_; }
110 
111  //
112  void setFlags(uint32_t flags) { flags_ = flags; }
113 
115  PositionType const& position() const { return caloCell().getPosition().basicVector(); }
116 
117  RhoEtaPhi const& positionREP() const { return caloCell().repPos(); }
118 
120  CornersVec const& getCornersXYZ() const { return caloCell().getCorners(); }
121 
122  RepCorners const& getCornersREP() const { return caloCell().getCornersREP(); }
123 
125  bool operator>=(const PFRecHit& rhs) const { return (energy_ >= rhs.energy_); }
126 
128  bool operator>(const PFRecHit& rhs) const { return (energy_ > rhs.energy_); }
129 
131  bool operator<=(const PFRecHit& rhs) const { return (energy_ <= rhs.energy_); }
132 
134  bool operator<(const PFRecHit& rhs) const { return (energy_ < rhs.energy_); }
135 
136  private:
137  Neighbours buildNeighbours(unsigned int n) const { return Neighbours(neighbours_.data(), n); }
138 
141 
143  unsigned int detId_ = 0;
144 
147 
149  float energy_ = 0;
150 
152  float time_ = -1;
153 
155  int depth_ = 0;
156 
158  std::vector<unsigned int> neighbours_;
159  std::vector<unsigned short> neighbourInfos_;
160 
161  //Caching the neighbours4/8 per request of Lindsey
162  unsigned int neighbours4_ = 0;
163  unsigned int neighbours8_ = 0;
164 
165  // Detector-dependent hit status flag
166  uint32_t flags_ = 0;
167  };
168 
169 } // namespace reco
170 std::ostream& operator<<(std::ostream& out, const reco::PFRecHit& hit);
171 
172 #endif
EZArrayFL< GlobalPoint > CornersVec
float energy_
rechit energy
Definition: PFRecHit.h:149
void setDepth(int depth)
Definition: PFRecHit.h:72
BaseClass::BasicVectorType BasicVectorType
Definition: Point3DBase.h:17
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:159
RepCorners const & getCornersREP() const
Definition: PFRecHit.h:122
bool hasCaloCell() const
Definition: PFRecHit.h:88
RhoEtaPhi const & repPos() const
T perp2() const
Squared magnitude of transverse component.
Pointer begin() const
Definition: PFRecHit.h:45
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:158
unsigned int neighbours4_
Definition: PFRecHit.h:162
Neighbours neighbours4() const
Definition: PFRecHit.h:79
PFRecHit & operator=(const PFRecHit &other)=default
CaloCellGeometry const * get() const
double pt2() const
rechit momentum transverse to the beam, squared.
Definition: PFRecHit.h:106
int depth_
depth
Definition: PFRecHit.h:155
void addNeighbour(short x, short y, short z, unsigned int)
Definition: PFRecHit.cc:5
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:94
unsigned int detId_
cell detid
Definition: PFRecHit.h:143
uint32_t flags_
Definition: PFRecHit.h:166
PFLayer::Layer layer_
rechit layer
Definition: PFRecHit.h:146
float time() const
timing for cleaned hits
Definition: PFRecHit.h:100
PositionType const & position() const
rechit cell centre x, y, z
Definition: PFRecHit.h:115
unsigned int neighbours8_
Definition: PFRecHit.h:163
unsigned detId() const
rechit detId
Definition: PFRecHit.h:91
CornersVec const & getCornersXYZ() const
rechit corners
Definition: PFRecHit.h:120
void clearNeighbours()
Definition: PFRecHit.h:73
unsigned int const * Pointer
Definition: PFRecHit.h:41
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:32
bool operator>=(const PFRecHit &rhs) const
comparison >= operator
Definition: PFRecHit.h:125
bool operator>(const PFRecHit &rhs) const
comparison > operator
Definition: PFRecHit.h:128
float time_
time
Definition: PFRecHit.h:152
void setFlags(uint32_t flags)
Definition: PFRecHit.h:112
std::array< RhoEtaPhi, k_cornerSize > RepCorners
uint32_t flags() const
Definition: PFRecHit.h:109
bool operator<=(const PFRecHit &rhs) const
comparison <= operator
Definition: PFRecHit.h:131
RhoEtaPhi const & positionREP() const
Definition: PFRecHit.h:117
void setTime(double time)
Definition: PFRecHit.h:71
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
bool operator<(const PFRecHit &rhs) const
comparison < operator
Definition: PFRecHit.h:134
CaloCellGeometry::RepCorners RepCorners
Definition: PFRecHit.h:36
Layer
layer definition
Definition: PFLayer.h:29
PFRecHit(CaloCellGeometryMayOwnPtr caloCell, unsigned int detId, PFLayer::Layer layer, float energy, uint32_t flags=0)
Definition: PFRecHit.h:54
RepCorners const & getCornersREP() const
RepCorners REPPointVector
Definition: PFRecHit.h:37
std::ostream & operator<<(std::ostream &out, const reco::PFRecHit &hit)
Definition: PFRecHit.cc:72
unsigned int getNeighbour(short x, short y, short z) const
Definition: PFRecHit.cc:46
Pointer end() const
Definition: PFRecHit.h:46
CaloCellGeometryMayOwnPtr caloCell_
cell geometry
Definition: PFRecHit.h:140
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Neighbours buildNeighbours(unsigned int n) const
Definition: PFRecHit.h:137
float energy() const
rechit energy
Definition: PFRecHit.h:97
~PFRecHit()=default
destructor
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
fixed size matrix
void setEnergy(float energy)
Definition: PFRecHit.h:67
Neighbours neighbours() const
Definition: PFRecHit.h:82
Neighbours neighbours8() const
Definition: PFRecHit.h:80
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
unsigned int size() const
Definition: PFRecHit.h:47
int depth() const
depth for segemntation
Definition: PFRecHit.h:103
Neighbours(Pointer ib, unsigned int n)
Definition: PFRecHit.h:43
const std::vector< unsigned short > & neighbourInfos()
Definition: PFRecHit.h:84
def move(src, dest)
Definition: eostools.py:511
ib
Definition: cuy.py:661
PFRecHit()
default constructor. Sets energy and position to zero
Definition: PFRecHit.h:52
CaloCellGeometry const & caloCell() const
calo cell
Definition: PFRecHit.h:87