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 
20 
21 namespace reco {
22 
31  class PFRecHit {
32  public:
38 
39  struct Neighbours {
40  using Pointer = unsigned int const*;
42  Neighbours(Pointer ib, unsigned int n) : b(ib), e(ib + n) {}
44  Pointer begin() const { return b; }
45  Pointer end() const { return e; }
46  unsigned int size() const { return e - b; }
47  };
48 
49  enum { NONE = 0 };
51  PFRecHit() {}
52 
53  PFRecHit(std::shared_ptr<const CaloCellGeometry> caloCell,
54  unsigned int detId,
56  float energy,
57  uint32_t flags = 0)
59 
61  PFRecHit(const PFRecHit& other) = default;
62  PFRecHit(PFRecHit&& other) = default;
63  PFRecHit& operator=(const PFRecHit& other) = default;
64  PFRecHit& operator=(PFRecHit&& other) = default;
65 
67  ~PFRecHit() = default;
68 
69  void setEnergy(float energy) { energy_ = energy; }
70 
71  void addNeighbour(short x, short y, short z, unsigned int);
72  unsigned int getNeighbour(short x, short y, short z) const;
73  void setTime(double time) { time_ = time; }
74  void setDepth(int depth) { depth_ = depth; }
75  void clearNeighbours() {
76  neighbours_.clear();
77  neighbourInfos_.clear();
79  }
80 
83 
84  Neighbours neighbours() const { return buildNeighbours(neighbours_.size()); }
85 
86  const std::vector<unsigned short>& neighbourInfos() { return neighbourInfos_; }
87 
89  CaloCellGeometry const& caloCell() const { return *(caloCell_.get()); }
90  bool hasCaloCell() const { return (caloCell_ != nullptr); }
91 
93  unsigned detId() const { return detId_; }
94 
96  PFLayer::Layer layer() const { return layer_; }
97 
99  float energy() const { return energy_; }
100 
102  float time() const { return time_; }
103 
105  int depth() const { return depth_; }
106 
108  double pt2() const { return energy_ * energy_ * (position().perp2() / position().mag2()); }
109 
110  // Detector-dependent status flag
111  uint32_t flags() const { return flags_; }
112 
113  //
114  void setFlags(uint32_t flags) { flags_ = flags; }
115 
117  PositionType const& position() const { return caloCell().getPosition().basicVector(); }
118 
119  RhoEtaPhi const& positionREP() const { return caloCell().repPos(); }
120 
122  CornersVec const& getCornersXYZ() const { return caloCell().getCorners(); }
123 
124  RepCorners const& getCornersREP() const { return caloCell().getCornersREP(); }
125 
127  bool operator>=(const PFRecHit& rhs) const { return (energy_ >= rhs.energy_); }
128 
130  bool operator>(const PFRecHit& rhs) const { return (energy_ > rhs.energy_); }
131 
133  bool operator<=(const PFRecHit& rhs) const { return (energy_ <= rhs.energy_); }
134 
136  bool operator<(const PFRecHit& rhs) const { return (energy_ < rhs.energy_); }
137 
138  private:
139  Neighbours buildNeighbours(unsigned int n) const { return Neighbours(neighbours_.data(), n); }
140 
142  std::shared_ptr<const CaloCellGeometry> caloCell_ = nullptr;
143 
145  unsigned int detId_ = 0;
146 
149 
151  float energy_ = 0;
152 
154  float time_ = -1;
155 
157  int depth_ = 0;
158 
160  std::vector<unsigned int> neighbours_;
161  std::vector<unsigned short> neighbourInfos_;
162 
163  //Caching the neighbours4/8 per request of Lindsey
164  unsigned int neighbours4_ = 0;
165  unsigned int neighbours8_ = 0;
166 
167  // Detector-dependent hit status flag
168  uint32_t flags_ = 0;
169  };
170 
171 } // namespace reco
172 std::ostream& operator<<(std::ostream& out, const reco::PFRecHit& hit);
173 
174 #endif
EZArrayFL< GlobalPoint > CornersVec
float energy_
rechit energy
Definition: PFRecHit.h:151
void setDepth(int depth)
Definition: PFRecHit.h:74
BaseClass::BasicVectorType BasicVectorType
Definition: Point3DBase.h:17
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:161
RepCorners const & getCornersREP() const
Definition: PFRecHit.h:124
bool hasCaloCell() const
Definition: PFRecHit.h:90
RhoEtaPhi const & repPos() const
T perp2() const
Squared magnitude of transverse component.
Pointer begin() const
Definition: PFRecHit.h:44
std::vector< unsigned int > neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:160
unsigned int neighbours4_
Definition: PFRecHit.h:164
Neighbours neighbours4() const
Definition: PFRecHit.h:81
PFRecHit & operator=(const PFRecHit &other)=default
double pt2() const
rechit momentum transverse to the beam, squared.
Definition: PFRecHit.h:108
int depth_
depth
Definition: PFRecHit.h:157
void addNeighbour(short x, short y, short z, unsigned int)
Definition: PFRecHit.cc:5
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:96
unsigned int detId_
cell detid
Definition: PFRecHit.h:145
uint32_t flags_
Definition: PFRecHit.h:168
PFLayer::Layer layer_
rechit layer
Definition: PFRecHit.h:148
float time() const
timing for cleaned hits
Definition: PFRecHit.h:102
std::shared_ptr< const CaloCellGeometry > caloCell_
cell geometry
Definition: PFRecHit.h:142
PositionType const & position() const
rechit cell centre x, y, z
Definition: PFRecHit.h:117
unsigned int neighbours8_
Definition: PFRecHit.h:165
unsigned detId() const
rechit detId
Definition: PFRecHit.h:93
CornersVec const & getCornersXYZ() const
rechit corners
Definition: PFRecHit.h:122
void clearNeighbours()
Definition: PFRecHit.h:75
unsigned int const * Pointer
Definition: PFRecHit.h:40
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
bool operator>=(const PFRecHit &rhs) const
comparison >= operator
Definition: PFRecHit.h:127
bool operator>(const PFRecHit &rhs) const
comparison > operator
Definition: PFRecHit.h:130
float time_
time
Definition: PFRecHit.h:154
void setFlags(uint32_t flags)
Definition: PFRecHit.h:114
std::array< RhoEtaPhi, k_cornerSize > RepCorners
uint32_t flags() const
Definition: PFRecHit.h:111
bool operator<=(const PFRecHit &rhs) const
comparison <= operator
Definition: PFRecHit.h:133
RhoEtaPhi const & positionREP() const
Definition: PFRecHit.h:119
void setTime(double time)
Definition: PFRecHit.h:73
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
PFRecHit(std::shared_ptr< const CaloCellGeometry > caloCell, unsigned int detId, PFLayer::Layer layer, float energy, uint32_t flags=0)
Definition: PFRecHit.h:53
bool operator<(const PFRecHit &rhs) const
comparison < operator
Definition: PFRecHit.h:136
CaloCellGeometry::RepCorners RepCorners
Definition: PFRecHit.h:35
Layer
layer definition
Definition: PFLayer.h:29
RepCorners const & getCornersREP() const
RepCorners REPPointVector
Definition: PFRecHit.h:36
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:45
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Neighbours buildNeighbours(unsigned int n) const
Definition: PFRecHit.h:139
float energy() const
rechit energy
Definition: PFRecHit.h:99
~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:69
Neighbours neighbours() const
Definition: PFRecHit.h:84
Neighbours neighbours8() const
Definition: PFRecHit.h:82
CornersVec const & getCorners() const
Returns the corner points of this cell&#39;s volume.
unsigned int size() const
Definition: PFRecHit.h:46
int depth() const
depth for segemntation
Definition: PFRecHit.h:105
Neighbours(Pointer ib, unsigned int n)
Definition: PFRecHit.h:42
const std::vector< unsigned short > & neighbourInfos()
Definition: PFRecHit.h:86
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:51
CaloCellGeometry const & caloCell() const
calo cell
Definition: PFRecHit.h:89