test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 <iostream>
8 
10 #include "Rtypes.h"
12 #include "Math/GenVector/PositionVector3D.h"
15 
16 //C decide what is the default rechit index.
17 //C maybe 0 ? -> compression
18 //C then the position is index-1.
19 //C provide a helper class to access the rechit.
20 
23 
24 
25 namespace reco {
26 
35  class PFRecHit {
36 
37  public:
38 
39  // Next typedef uses double in ROOT 6 rather than Double32_t due to a bug in ROOT 5,
40  // which otherwise would make ROOT5 files unreadable in ROOT6. This does not increase
41  // the size on disk, because due to the bug, double was actually stored on disk in ROOT 5.
42 
43  typedef ROOT::Math::PositionVector3D<ROOT::Math::CylindricalEta3D<double> > REPPoint;
44 
45  typedef std::vector<REPPoint> REPPointVector;
46 
47  enum {
48  NONE=0
49  };
51  PFRecHit();
52 
54  PFRecHit(unsigned detId,
56  double energy,
57  const math::XYZPoint& posxyz,
58  const math::XYZVector& axisxyz,
59  const std::vector< math::XYZPoint >& cornersxyz);
60 
61  PFRecHit(unsigned detId,
63  double energy,
64  double posx, double posy, double posz,
65  double axisx, double axisy, double axisz);
66 
68  PFRecHit(const PFRecHit& other) = default;
69  PFRecHit(PFRecHit&& other) = default;
70  PFRecHit & operator=(const PFRecHit& other) = default;
71  PFRecHit & operator=(PFRecHit&& other) = default;
72 
73 
75  ~PFRecHit()=default;
76 
77  void setEnergy( double energy) { energy_ = energy; }
78 
79  void calculatePositionREP();
80 
81  void addNeighbour(short x,short y, short z,const PFRecHitRef&);
82  const PFRecHitRef getNeighbour(short x,short y, short z);
83  void setTime( double time) { time_ = time; }
84  void setDepth( int depth) { depth_ = depth; }
85  void clearNeighbours() {
87  }
88 
89  const PFRecHitRefVector& neighbours4() const {
90  return neighbours4_;
91  }
92  const PFRecHitRefVector& neighbours8() const {
93  return neighbours8_;
94  }
95 
96  const PFRecHitRefVector& neighbours() const {
97  return neighbours_;
98  }
99 
100  const std::vector<unsigned short>& neighbourInfos() {
101  return neighbourInfos_;
102  }
103 
104 
105  void setNWCorner( double posx, double posy, double posz );
106  void setSWCorner( double posx, double posy, double posz );
107  void setSECorner( double posx, double posy, double posz );
108  void setNECorner( double posx, double posy, double posz );
109 
111  unsigned detId() const {return detId_;}
112 
114  PFLayer::Layer layer() const { return layer_; }
115 
117  double energy() const { return energy_; }
118 
119 
121  double time() const { return time_; }
122 
124  int depth() const { return depth_; }
125 
127  double pt2() const { return energy_ * energy_ *
128  ( position_.X()*position_.X() +
129  position_.Y()*position_.Y() ) /
130  ( position_.X()*position_.X() +
131  position_.Y()*position_.Y() +
132  position_.Z()*position_.Z()) ; }
133 
134 
136  const math::XYZPoint& position() const { return position_; }
137 
138  const REPPoint& positionREP() const { return positionrep_; }
139 
140 
142  const math::XYZVector& getAxisXYZ() const { return axisxyz_; }
143 
145  const std::vector< math::XYZPoint >& getCornersXYZ() const
146  { return cornersxyz_; }
147 
148  const std::vector<REPPoint>& getCornersREP() const { return cornersrep_; }
149 
150  void size(double& deta, double& dphi) const;
151 
153  bool operator>=(const PFRecHit& rhs) const { return (energy_>=rhs.energy_); }
154 
156  bool operator> (const PFRecHit& rhs) const { return (energy_> rhs.energy_); }
157 
159  bool operator<=(const PFRecHit& rhs) const { return (energy_<=rhs.energy_); }
160 
162  bool operator< (const PFRecHit& rhs) const { return (energy_< rhs.energy_); }
163 
164  friend std::ostream& operator<<(std::ostream& out,
165  const reco::PFRecHit& hit);
166 
168  return originalRecHit_;
169  }
170 
171  template<typename T>
172  void setOriginalRecHit(const T& rh) {
174  }
175 
176  private:
177 
178  // original rechit
180 
182  unsigned detId_;
183 
186 
188  double energy_;
189 
191  double time_;
192 
193 
195  int depth_;
196 
199 
202 
205 
207  std::vector< math::XYZPoint > cornersxyz_;
208 
210  std::vector< REPPoint > cornersrep_;
211 
214  std::vector< unsigned short > neighbourInfos_;
215 
216  //Caching the neighbours4/8 per request of Lindsey
219 
220 
222  static const unsigned nCorners_;
223 
225  void setCorner( unsigned i, double posx, double posy, double posz );
226  };
227 
228 }
229 
230 #endif
void setSECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:120
void setDepth(int depth)
Definition: PFRecHit.h:84
int i
Definition: DBlmapReader.cc:9
std::vector< REPPoint > REPPointVector
Definition: PFRecHit.h:45
std::vector< math::XYZPoint > cornersxyz_
rechit cell corners
Definition: PFRecHit.h:207
friend std::ostream & operator<<(std::ostream &out, const reco::PFRecHit &hit)
void setNECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:125
double pt2() const
rechit momentum transverse to the beam, squared.
Definition: PFRecHit.h:127
const PFRecHitRefVector & neighbours4() const
Definition: PFRecHit.h:89
unsigned detId_
C cell detid - should be detid or index in collection ?
Definition: PFRecHit.h:182
PFRecHitRefVector neighbours4_
Definition: PFRecHit.h:217
unsigned detId() const
rechit detId
Definition: PFRecHit.h:111
PFRecHit & operator=(const PFRecHit &other)=default
int depth_
depth
Definition: PFRecHit.h:195
double time_
time
Definition: PFRecHit.h:191
void addNeighbour(short x, short y, short z, const PFRecHitRef &)
Definition: PFRecHit.cc:161
PFLayer::Layer layer_
rechit layer
Definition: PFRecHit.h:185
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:214
bool operator<=(const PFRecHit &rhs) const
comparison &lt;= operator
Definition: PFRecHit.h:159
bool operator<(const PFRecHit &rhs) const
comparison &lt; operator
Definition: PFRecHit.h:162
double energy_
rechit energy
Definition: PFRecHit.h:188
int depth() const
depth for segemntation
Definition: PFRecHit.h:124
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:114
void setSWCorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:115
const std::vector< math::XYZPoint > & getCornersXYZ() const
rechit corners
Definition: PFRecHit.h:145
void setEnergy(double energy)
Definition: PFRecHit.h:77
const PFRecHitRef getNeighbour(short x, short y, short z)
Definition: PFRecHit.cc:199
void clearNeighbours()
Definition: PFRecHit.h:85
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:35
math::XYZVector axisxyz_
rechit cell axisxyz
Definition: PFRecHit.h:204
const math::XYZVector & getAxisXYZ() const
rechit cell axis x, y, z
Definition: PFRecHit.h:142
const std::vector< REPPoint > & getCornersREP() const
Definition: PFRecHit.h:148
const PFRecHitRefVector & neighbours8() const
Definition: PFRecHit.h:92
void size(double &deta, double &dphi) const
Definition: PFRecHit.cc:224
edm::RefToBase< CaloRecHit > originalRecHit_
Definition: PFRecHit.h:179
void setTime(double time)
Definition: PFRecHit.h:83
void setNWCorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:110
const edm::RefToBase< CaloRecHit > & originalRecHit() const
Definition: PFRecHit.h:167
Layer
layer definition
Definition: PFLayer.h:31
const math::XYZPoint & position() const
rechit cell centre x, y, z
Definition: PFRecHit.h:136
void calculatePositionREP()
Definition: PFRecHit.cc:144
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
Definition: PFRecHit.h:43
PFRecHitRefVector neighbours8_
Definition: PFRecHit.h:218
bool operator>=(const PFRecHit &rhs) const
comparison &gt;= operator
Definition: PFRecHit.h:153
math::XYZPoint position_
rechit cell centre: x, y, z
Definition: PFRecHit.h:198
void clear()
Clear the vector.
Definition: RefVector.h:147
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
bool operator>(const PFRecHit &rhs) const
comparison &gt; operator
Definition: PFRecHit.h:156
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
PFRecHitRefVector neighbours_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:213
std::vector< REPPoint > cornersrep_
rechit cell corners rho/eta/phi
Definition: PFRecHit.h:210
~PFRecHit()=default
destructor
double energy() const
rechit energy
Definition: PFRecHit.h:117
REPPoint positionrep_
rechit cell centre: rho, eta, phi (transient)
Definition: PFRecHit.h:201
const REPPoint & positionREP() const
Definition: PFRecHit.h:138
static const unsigned nCorners_
number of corners
Definition: PFRecHit.h:222
double time() const
timing for cleaned hits
Definition: PFRecHit.h:121
const std::vector< unsigned short > & neighbourInfos()
Definition: PFRecHit.h:100
long double T
void setCorner(unsigned i, double posx, double posy, double posz)
set position of one of the corners
Definition: PFRecHit.cc:130
const PFRecHitRefVector & neighbours() const
Definition: PFRecHit.h:96
PFRecHit()
default constructor. Sets energy and position to zero
Definition: PFRecHit.cc:49
void setOriginalRecHit(const T &rh)
Definition: PFRecHit.h:172