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  void setTime( double time) { time_ = time; }
75  void clearNeighbours() {
77  }
78 
79  const PFRecHitRefVector& neighbours4() const {
80  return neighbours4_;
81  }
82  const PFRecHitRefVector& neighbours8() const {
83  return neighbours8_;
84  }
85 
86  const PFRecHitRefVector& neighbours() const {
87  return neighbours_;
88  }
89 
90  const std::vector<unsigned short>& neighbourInfos() {
91  return neighbourInfos_;
92  }
93 
94 
95  void setNWCorner( double posx, double posy, double posz );
96  void setSWCorner( double posx, double posy, double posz );
97  void setSECorner( double posx, double posy, double posz );
98  void setNECorner( double posx, double posy, double posz );
99 
101  unsigned detId() const {return detId_;}
102 
104  PFLayer::Layer layer() const { return layer_; }
105 
107  double energy() const { return energy_; }
108 
109 
111  double time() const { return time_; }
112 
114  double pt2() const { return energy_ * energy_ *
115  ( position_.X()*position_.X() +
116  position_.Y()*position_.Y() ) /
117  ( position_.X()*position_.X() +
118  position_.Y()*position_.Y() +
119  position_.Z()*position_.Z()) ; }
120 
121 
123  const math::XYZPoint& position() const { return position_; }
124 
125  const REPPoint& positionREP() const { return positionrep_; }
126 
127 
129  const math::XYZVector& getAxisXYZ() const { return axisxyz_; }
130 
132  const std::vector< math::XYZPoint >& getCornersXYZ() const
133  { return cornersxyz_; }
134 
135  const std::vector<REPPoint>& getCornersREP() const { return cornersrep_; }
136 
137  void size(double& deta, double& dphi) const;
138 
140  bool operator>=(const PFRecHit& rhs) const { return (energy_>=rhs.energy_); }
141 
143  bool operator> (const PFRecHit& rhs) const { return (energy_> rhs.energy_); }
144 
146  bool operator<=(const PFRecHit& rhs) const { return (energy_<=rhs.energy_); }
147 
149  bool operator< (const PFRecHit& rhs) const { return (energy_< rhs.energy_); }
150 
151  friend std::ostream& operator<<(std::ostream& out,
152  const reco::PFRecHit& hit);
153 
155  return originalRecHit_;
156  }
157 
158  template<typename T>
159  void setOriginalRecHit(const T& rh) {
161  }
162 
163  private:
164 
165  // original rechit
167 
169  unsigned detId_;
170 
173 
175  double energy_;
176 
178  double time_;
179 
182 
185 
188 
190  std::vector< math::XYZPoint > cornersxyz_;
191 
193  std::vector< REPPoint > cornersrep_;
194 
197  std::vector< unsigned short > neighbourInfos_;
198 
199  //Caching the neighbours4/8 per request of Lindsey
202 
203 
205  static const unsigned nCorners_;
206 
208  void setCorner( unsigned i, double posx, double posy, double posz );
209  };
210 
211 }
212 
213 #endif
void setSECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:96
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:190
friend std::ostream & operator<<(std::ostream &out, const reco::PFRecHit &hit)
void setNECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:101
double pt2() const
rechit momentum transverse to the beam, squared.
Definition: PFRecHit.h:114
const PFRecHitRefVector & neighbours4() const
Definition: PFRecHit.h:79
unsigned detId_
C cell detid - should be detid or index in collection ?
Definition: PFRecHit.h:169
PFRecHitRefVector neighbours4_
Definition: PFRecHit.h:200
unsigned detId() const
rechit detId
Definition: PFRecHit.h:101
double time_
time
Definition: PFRecHit.h:178
void addNeighbour(short x, short y, short z, const PFRecHitRef &)
Definition: PFRecHit.cc:129
PFLayer::Layer layer_
rechit layer
Definition: PFRecHit.h:172
std::vector< unsigned short > neighbourInfos_
Definition: PFRecHit.h:197
bool operator<=(const PFRecHit &rhs) const
comparison &lt;= operator
Definition: PFRecHit.h:146
bool operator<(const PFRecHit &rhs) const
comparison &lt; operator
Definition: PFRecHit.h:149
double energy_
rechit energy
Definition: PFRecHit.h:175
float float float z
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:104
virtual ~PFRecHit()
destructor
Definition: PFRecHit.cc:82
void setSWCorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:91
const std::vector< math::XYZPoint > & getCornersXYZ() const
rechit corners
Definition: PFRecHit.h:132
void setEnergy(double energy)
Definition: PFRecHit.h:69
void clearNeighbours()
Definition: PFRecHit.h:75
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:187
const math::XYZVector & getAxisXYZ() const
rechit cell axis x, y, z
Definition: PFRecHit.h:129
const std::vector< REPPoint > & getCornersREP() const
Definition: PFRecHit.h:135
const PFRecHitRefVector & neighbours8() const
Definition: PFRecHit.h:82
void size(double &deta, double &dphi) const
Definition: PFRecHit.cc:166
edm::RefToBase< CaloRecHit > originalRecHit_
Definition: PFRecHit.h:166
void setTime(double time)
Definition: PFRecHit.h:74
void setNWCorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:86
const edm::RefToBase< CaloRecHit > & originalRecHit() const
Definition: PFRecHit.h:154
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:123
void calculatePositionREP()
Definition: PFRecHit.cc:117
PFRecHitRefVector neighbours8_
Definition: PFRecHit.h:201
bool operator>=(const PFRecHit &rhs) const
comparison &gt;= operator
Definition: PFRecHit.h:140
math::XYZPoint position_
rechit cell centre: x, y, z
Definition: PFRecHit.h:181
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:143
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:196
std::vector< REPPoint > cornersrep_
rechit cell corners rho/eta/phi
Definition: PFRecHit.h:193
double energy() const
rechit energy
Definition: PFRecHit.h:107
REPPoint positionrep_
rechit cell centre: rho, eta, phi (transient)
Definition: PFRecHit.h:184
const REPPoint & positionREP() const
Definition: PFRecHit.h:125
Definition: DDAxes.h:10
static const unsigned nCorners_
number of corners
Definition: PFRecHit.h:205
double time() const
timing for cleaned hits
Definition: PFRecHit.h:111
const std::vector< unsigned short > & neighbourInfos()
Definition: PFRecHit.h:90
long double T
void setCorner(unsigned i, double posx, double posy, double posz)
set position of one of the corners
Definition: PFRecHit.cc:106
const PFRecHitRefVector & neighbours() const
Definition: PFRecHit.h:86
PFRecHit()
default constructor. Sets energy and position to zero
Definition: PFRecHit.cc:7
void setOriginalRecHit(const T &rh)
Definition: PFRecHit.h:159