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 "DataFormats/DetId/interface/DetId.h"
13 #include "Math/GenVector/PositionVector3D.h"
14 
16 
17 //C decide what is the default rechit index.
18 //C maybe 0 ? -> compression
19 //C then the position is index-1.
20 //C provide a helper class to access the rechit.
21 
22 
23 namespace reco {
24 
31  class PFRecHit {
32 
33  public:
34 
35  enum {
36  NONE=0
37  };
38 
39  typedef ROOT::Math::PositionVector3D<ROOT::Math::CylindricalEta3D<Double32_t> > REPPoint;
40 
41  typedef std::vector<REPPoint> REPPointVector;
42 
44  PFRecHit();
45 
47  PFRecHit(unsigned detId,
49  double energy,
50  const math::XYZPoint& posxyz,
51  const math::XYZVector& axisxyz,
52  const std::vector< math::XYZPoint >& cornersxyz);
53 
54  PFRecHit(unsigned detId,
56  double energy,
57  double posx, double posy, double posz,
58  double axisx, double axisy, double axisz);
59 
61  PFRecHit(const PFRecHit& other);
62 
64  virtual ~PFRecHit();
65 
66 
69 
70  void setEnergy( double energy) { energy_ = energy; }
71 
73  void calculatePositionREP();
74 
75  //C neighbours must be initialized correctly !!
76  /* void setNeighbours( const std::vector< unsigned >& neighbours ); */
77  void add4Neighbour( unsigned index );
78  void add8Neighbour( unsigned index );
79  void setEnergyUp( double eUp) { energyUp_ = eUp; }
80  void setRescale( double factor) { rescale_ = factor; }
81 
82  void clearNeighbours() {
83  neighbours4_.clear();
84  neighbours8_.clear();
85  neighbours4_.reserve(4);
86  neighbours8_.reserve(8);
87  }
88 
89 
90 
97  // void findPtrsToNeighbours( const std::map<unsigned, reco::PFRecHit* >& allhits );
98 
99  void setNWCorner( double posx, double posy, double posz );
100  void setSWCorner( double posx, double posy, double posz );
101  void setSECorner( double posx, double posy, double posz );
102  void setNECorner( double posx, double posy, double posz );
103 
105  unsigned detId() const {return detId_;}
106 
108  PFLayer::Layer layer() const { return layer_; }
109 
111  double energy() const { return energy_; }
112 
114  double rescale() const { return rescale_; }
115 
117  double time() const { return rescale_; }
118 
120  double energyUp() const { return energyUp_; }
121 
123  double pt2() const { return energy_ * energy_ *
124  ( position_.X()*position_.X() +
125  position_.Y()*position_.Y() ) /
126  ( position_.X()*position_.X() +
127  position_.Y()*position_.Y() +
128  position_.Z()*position_.Z()) ; }
129 
130  //C remove cause I want to be able to run on const rechits
132  // int seedState() const { return seedState_; }
133 
135  // bool isSeed() const { return (seedState_>0) ? true : false; }
136 
138  // void youAreSeed(int seedstate=1) {seedState_ = seedstate;}
139 
141  const math::XYZPoint& position() const { return position_; }
142 
144  const REPPoint& positionREP() const;
145 
147  const math::XYZVector& getAxisXYZ() const { return axisxyz_; }
148 
150  const std::vector< math::XYZPoint >& getCornersXYZ() const
151  { return cornersxyz_; }
152 
155  { return cornersrep_; }
156 
157  const std::vector< unsigned >& neighbours4() const
158  {return neighbours4_;}
159 
160  const std::vector< unsigned >& neighbours8() const
161  {return neighbours8_;}
162 
163  const std::vector< unsigned >& neighboursIds4() const
164  {return neighboursIds4_;}
165 
166  const std::vector< unsigned >& neighboursIds8() const
167  {return neighboursIds8_;}
168 
169  /* const std::vector< unsigned >& getNeighboursIds4() const */
170  /* {return neighboursIds4_;} */
171 
172  /* const std::vector< unsigned >& getNeighboursIds8() const */
173  /* {return neighboursIds8_;} */
174 
177  bool isNeighbour4(unsigned id) const;
178 
181  bool isNeighbour8(unsigned id) const;
182 
183 
184  void size(double& deta, double& dphi) const;
185 
187  bool operator>=(const PFRecHit& rhs) const { return (energy_>=rhs.energy_); }
188 
190  bool operator> (const PFRecHit& rhs) const { return (energy_> rhs.energy_); }
191 
193  bool operator<=(const PFRecHit& rhs) const { return (energy_<=rhs.energy_); }
194 
196  bool operator< (const PFRecHit& rhs) const { return (energy_< rhs.energy_); }
197 
198  friend std::ostream& operator<<(std::ostream& out,
199  const reco::PFRecHit& hit);
200 
201  private:
202 
204  unsigned detId_;
205 
208 
210  double energy_;
211 
213  double rescale_;
214 
216  double energyUp_;
217 
219  // int seedState_;
220 
223 
226 
229 
231  std::vector< math::XYZPoint > cornersxyz_;
233 
235  std::vector< unsigned > neighbours4_;
236 
238  std::vector< unsigned > neighbours8_;
239 
241  std::vector< unsigned > neighboursIds4_;
242 
244  std::vector< unsigned > neighboursIds8_;
245 
247  static const unsigned nNeighbours_;
248 
250  static const unsigned nCorners_;
251 
253  void setCorner( unsigned i, double posx, double posy, double posz );
254  };
255 
256 }
257 
258 #endif
void setSECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:226
void add4Neighbour(unsigned index)
Definition: PFRecHit.cc:176
int i
Definition: DBlmapReader.cc:9
std::vector< unsigned > neighbours4_
indices to existing neighbours (1 common side)
Definition: PFRecHit.h:235
REPPoint posrep_
rechit cell centre: rho, eta, phi (transient)
Definition: PFRecHit.h:225
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:231
friend std::ostream & operator<<(std::ostream &out, const reco::PFRecHit &hit)
void add8Neighbour(unsigned index)
Definition: PFRecHit.cc:181
double energyUp_
For HF hits : hit energy in the other layer (EM for HAD, and HAD for EM)
Definition: PFRecHit.h:216
void setNECorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:231
double pt2() const
rechit momentum transverse to the beam, squared.
Definition: PFRecHit.h:123
unsigned detId_
C cell detid - should be detid or index in collection ?
Definition: PFRecHit.h:204
unsigned detId() const
rechit detId
Definition: PFRecHit.h:105
double rescale() const
rescaling factor (obsolete)
Definition: PFRecHit.h:114
PFLayer::Layer layer_
rechit layer
Definition: PFRecHit.h:207
bool operator<=(const PFRecHit &rhs) const
comparison &lt;= operator
Definition: PFRecHit.h:193
bool operator<(const PFRecHit &rhs) const
comparison &lt; operator
Definition: PFRecHit.h:196
static const unsigned nNeighbours_
number of neighbours
Definition: PFRecHit.h:247
double energy_
rechit energy
Definition: PFRecHit.h:210
double energyUp() const
For HF hits: rechit energy (and neighbour&#39;s) in the other HF layer.
Definition: PFRecHit.h:120
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:108
virtual ~PFRecHit()
destructor
Definition: PFRecHit.cc:116
void setSWCorner(double posx, double posy, double posz)
Definition: PFRecHit.cc:221
const std::vector< math::XYZPoint > & getCornersXYZ() const
rechit corners
Definition: PFRecHit.h:150
void setEnergy(double energy)
Definition: PFRecHit.h:70
void clearNeighbours()
Definition: PFRecHit.h:82
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
const std::vector< unsigned > & neighbours8() const
Definition: PFRecHit.h:160
math::XYZVector axisxyz_
rechit cell axisxyz
Definition: PFRecHit.h:228
void setEnergyUp(double eUp)
Definition: PFRecHit.h:79
std::vector< unsigned > neighboursIds4_
detids of existing neighbours (1 common side)
Definition: PFRecHit.h:241
const math::XYZVector & getAxisXYZ() const
rechit cell axis x, y, z
Definition: PFRecHit.h:147
void size(double &deta, double &dphi) const
Definition: PFRecHit.cc:266
std::vector< unsigned > neighbours8_
indices to existing neighbours (1 common side or diagonal)
Definition: PFRecHit.h:238
void setRescale(double factor)
Definition: PFRecHit.h:80
void setNWCorner(double posx, double posy, double posz)
search for pointers to neighbours, using neighbours&#39; DetId.
Definition: PFRecHit.cc:216
REPPointVector cornersrep_
Definition: PFRecHit.h:232
tuple out
Definition: dbtoconf.py:99
Layer
layer definition
Definition: PFLayer.h:31
const math::XYZPoint & position() const
is seed ?
Definition: PFRecHit.h:141
void calculatePositionREP()
calculates rho eta phi position once and for all
Definition: PFRecHit.cc:130
const REPPointVector & getCornersREP() const
rechit corners
Definition: PFRecHit.h:154
const std::vector< unsigned > & neighboursIds8() const
Definition: PFRecHit.h:166
double rescale_
Internal rescaling factor of the energy (1. = default, 0 = killed channels, x = rescaled) ...
Definition: PFRecHit.h:213
bool operator>=(const PFRecHit &rhs) const
comparison &gt;= operator
Definition: PFRecHit.h:187
math::XYZPoint position_
is this a seed ? (-1:unknown, 0:no, 1 yes) (transient)
Definition: PFRecHit.h:222
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
bool operator>(const PFRecHit &rhs) const
comparison &gt; operator
Definition: PFRecHit.h:190
bool isNeighbour4(unsigned id) const
Definition: PFRecHit.cc:248
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< unsigned > neighboursIds8_
detids of existing neighbours (1 common side or diagonal)
Definition: PFRecHit.h:244
double energy() const
rechit energy
Definition: PFRecHit.h:111
bool isNeighbour8(unsigned id) const
Definition: PFRecHit.cc:257
const std::vector< unsigned > & neighboursIds4() const
Definition: PFRecHit.h:163
static const unsigned nCorners_
number of corners
Definition: PFRecHit.h:250
double time() const
timing for cleaned hits
Definition: PFRecHit.h:117
const std::vector< unsigned > & neighbours4() const
Definition: PFRecHit.h:157
void setCorner(unsigned i, double posx, double posy, double posz)
set position of one of the corners
Definition: PFRecHit.cc:236
PFRecHit()
default constructor. Sets energy and position to zero
Definition: PFRecHit.cc:9
const REPPoint & positionREP() const
rechit cell centre rho, eta, phi. call calculatePositionREP before !
Definition: PFRecHit.cc:121