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  typedef ROOT::Math::PositionVector3D<ROOT::Math::CylindricalEta3D<Double32_t> > REPPoint;
40 
41  typedef std::vector<REPPoint> REPPointVector;
42 
43  enum {
44  NONE=0
45  };
47  PFRecHit();
48 
50  PFRecHit(unsigned detId,
52  double energy,
53  const math::XYZPoint& posxyz,
54  const math::XYZVector& axisxyz,
55  const std::vector< math::XYZPoint >& cornersxyz);
56 
57  PFRecHit(unsigned detId,
59  double energy,
60  double posx, double posy, double posz,
61  double axisx, double axisy, double axisz);
62 
64  PFRecHit(const PFRecHit& other);
65 
67  virtual ~PFRecHit();
68 
69  void setEnergy( double energy) { energy_ = energy; }
70 
71  void calculatePositionREP();
72 
73  void addNeighbour(short x,short y, short z,const PFRecHitRef&);
74  const PFRecHitRef getNeighbour(short x,short y, short z);
75  void setTime( double time) { time_ = time; }
76  void setDepth( int depth) { depth_ = depth; }
77  void clearNeighbours() {
79  }
80 
81  const PFRecHitRefVector& neighbours4() const {
82  return neighbours4_;
83  }
84  const PFRecHitRefVector& neighbours8() const {
85  return neighbours8_;
86  }
87 
88  const PFRecHitRefVector& neighbours() const {
89  return neighbours_;
90  }
91 
92  const std::vector<unsigned short>& neighbourInfos() {
93  return neighbourInfos_;
94  }
95 
96 
97  void setNWCorner( double posx, double posy, double posz );
98  void setSWCorner( double posx, double posy, double posz );
99  void setSECorner( double posx, double posy, double posz );
100  void setNECorner( double posx, double posy, double posz );
101 
103  unsigned detId() const {return detId_;}
104 
106  PFLayer::Layer layer() const { return layer_; }
107 
109  double energy() const { return energy_; }
110 
111 
113  double time() const { return time_; }
114 
116  int depth() const { return depth_; }
117 
119  double pt2() const { return energy_ * energy_ *
120  ( position_.X()*position_.X() +
121  position_.Y()*position_.Y() ) /
122  ( position_.X()*position_.X() +
123  position_.Y()*position_.Y() +
124  position_.Z()*position_.Z()) ; }
125 
126 
128  const math::XYZPoint& position() const { return position_; }
129 
130  const REPPoint& positionREP() const { return positionrep_; }
131 
132 
134  const math::XYZVector& getAxisXYZ() const { return axisxyz_; }
135 
137  const std::vector< math::XYZPoint >& getCornersXYZ() const
138  { return cornersxyz_; }
139 
140  const std::vector<REPPoint>& getCornersREP() const { return cornersrep_; }
141 
142  void size(double& deta, double& dphi) const;
143 
145  bool operator>=(const PFRecHit& rhs) const { return (energy_>=rhs.energy_); }
146 
148  bool operator> (const PFRecHit& rhs) const { return (energy_> rhs.energy_); }
149 
151  bool operator<=(const PFRecHit& rhs) const { return (energy_<=rhs.energy_); }
152 
154  bool operator< (const PFRecHit& rhs) const { return (energy_< rhs.energy_); }
155 
156  friend std::ostream& operator<<(std::ostream& out,
157  const reco::PFRecHit& hit);
158 
160  return originalRecHit_;
161  }
162 
163  template<typename T>
164  void setOriginalRecHit(const T& rh) {
166  }
167 
168  private:
169 
170  // original rechit
172 
174  unsigned detId_;
175 
178 
180  double energy_;
181 
183  double time_;
184 
185 
187  int depth_;
188 
191 
194 
197 
199  std::vector< math::XYZPoint > cornersxyz_;
200 
202  std::vector< REPPoint > cornersrep_;
203 
206  std::vector< unsigned short > neighbourInfos_;
207 
208  //Caching the neighbours4/8 per request of Lindsey
211 
212 
214  static const unsigned nCorners_;
215 
217  void setCorner( unsigned i, double posx, double posy, double posz );
218  };
219 
220 }
221 
222 #endif
void setSECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:100
void setDepth(int depth)
Definition: PFRecHit.h:76
int i
Definition: DBlmapReader.cc:9
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< Double32_t > > REPPoint
Definition: PFRecHit.h:39
std::vector< REPPoint > REPPointVector
Definition: PFRecHit.h:41
std::vector< math::XYZPoint > cornersxyz_
rechit cell corners
Definition: PFRecHit.h:199
friend std::ostream & operator<<(std::ostream &out, const reco::PFRecHit &hit)
void setNECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:105
double pt2() const
rechit momentum transverse to the beam, squared.
Definition: PFRecHit.h:119
const PFRecHitRefVector & neighbours4() const
Definition: PFRecHit.h:81
unsigned detId_
C cell detid - should be detid or index in collection ?
Definition: PFRecHit.h:174
PFRecHitRefVector neighbours4_
Definition: PFRecHit.h:209
unsigned detId() const
rechit detId
Definition: PFRecHit.h:103
int depth_
depth
Definition: PFRecHit.h:187
double time_
time
Definition: PFRecHit.h:183
void addNeighbour(short x, short y, short z, const PFRecHitRef &)
Definition: PFRecHit.cc:133
PFLayer::Layer layer_
rechit layer
Definition: PFRecHit.h:177
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:206
bool operator<=(const PFRecHit &rhs) const
comparison &lt;= operator
Definition: PFRecHit.h:151
bool operator<(const PFRecHit &rhs) const
comparison &lt; operator
Definition: PFRecHit.h:154
double energy_
rechit energy
Definition: PFRecHit.h:180
float float float z
int depth() const
depth for segemntation
Definition: PFRecHit.h:116
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:106
virtual ~PFRecHit()
destructor
Definition: PFRecHit.cc:86
void setSWCorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:95
const std::vector< math::XYZPoint > & getCornersXYZ() const
rechit corners
Definition: PFRecHit.h:137
void setEnergy(double energy)
Definition: PFRecHit.h:69
const PFRecHitRef getNeighbour(short x, short y, short z)
Definition: PFRecHit.cc:171
void clearNeighbours()
Definition: PFRecHit.h:77
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:196
const math::XYZVector & getAxisXYZ() const
rechit cell axis x, y, z
Definition: PFRecHit.h:134
const std::vector< REPPoint > & getCornersREP() const
Definition: PFRecHit.h:140
const PFRecHitRefVector & neighbours8() const
Definition: PFRecHit.h:84
void size(double &deta, double &dphi) const
Definition: PFRecHit.cc:196
edm::RefToBase< CaloRecHit > originalRecHit_
Definition: PFRecHit.h:171
void setTime(double time)
Definition: PFRecHit.h:75
void setNWCorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:90
const edm::RefToBase< CaloRecHit > & originalRecHit() const
Definition: PFRecHit.h:159
tuple out
Definition: dbtoconf.py:99
Layer
layer definition
Definition: PFLayer.h:31
const math::XYZPoint & position() const
rechit cell centre x, y, z
Definition: PFRecHit.h:128
void calculatePositionREP()
Definition: PFRecHit.cc:121
PFRecHitRefVector neighbours8_
Definition: PFRecHit.h:210
bool operator>=(const PFRecHit &rhs) const
comparison &gt;= operator
Definition: PFRecHit.h:145
math::XYZPoint position_
rechit cell centre: x, y, z
Definition: PFRecHit.h:190
void clear()
Clear the vector.
Definition: RefVector.h:133
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
bool operator>(const PFRecHit &rhs) const
comparison &gt; operator
Definition: PFRecHit.h:148
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:205
std::vector< REPPoint > cornersrep_
rechit cell corners rho/eta/phi
Definition: PFRecHit.h:202
double energy() const
rechit energy
Definition: PFRecHit.h:109
REPPoint positionrep_
rechit cell centre: rho, eta, phi (transient)
Definition: PFRecHit.h:193
const REPPoint & positionREP() const
Definition: PFRecHit.h:130
Definition: DDAxes.h:10
static const unsigned nCorners_
number of corners
Definition: PFRecHit.h:214
double time() const
timing for cleaned hits
Definition: PFRecHit.h:113
const std::vector< unsigned short > & neighbourInfos()
Definition: PFRecHit.h:92
long double T
void setCorner(unsigned i, double posx, double posy, double posz)
set position of one of the corners
Definition: PFRecHit.cc:110
const PFRecHitRefVector & neighbours() const
Definition: PFRecHit.h:88
PFRecHit()
default constructor. Sets energy and position to zero
Definition: PFRecHit.cc:7
void setOriginalRecHit(const T &rh)
Definition: PFRecHit.h:164