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 
67  void calculatePositionREP();
68 
69  //C neighbours must be initialized correctly !!
70  /* void setNeighbours( const std::vector< unsigned >& neighbours ); */
71  void add4Neighbour( unsigned index );
72  void add8Neighbour( unsigned index );
73  void setEnergyUp( double eUp) { energyUp_ = eUp; }
74  void setRescale( double factor) { rescale_ = factor; }
75 
76  void clearNeighbours() {
77  neighbours4_.clear();
78  neighbours8_.clear();
79  neighbours4_.reserve(4);
80  neighbours8_.reserve(8);
81  }
82 
83 
84 
91  // void findPtrsToNeighbours( const std::map<unsigned, reco::PFRecHit* >& allhits );
92 
93  void setNWCorner( double posx, double posy, double posz );
94  void setSWCorner( double posx, double posy, double posz );
95  void setSECorner( double posx, double posy, double posz );
96  void setNECorner( double posx, double posy, double posz );
97 
99  unsigned detId() const {return detId_;}
100 
102  PFLayer::Layer layer() const { return layer_; }
103 
105  double energy() const { return energy_; }
106 
108  double rescale() const { return rescale_; }
109 
111  double time() const { return rescale_; }
112 
114  double energyUp() const { return energyUp_; }
115 
117  double pt2() const { return energy_ * energy_ *
118  ( position_.X()*position_.X() +
119  position_.Y()*position_.Y() ) /
120  ( position_.X()*position_.X() +
121  position_.Y()*position_.Y() +
122  position_.Z()*position_.Z()) ; }
123 
124  //C remove cause I want to be able to run on const rechits
126  // int seedState() const { return seedState_; }
127 
129  // bool isSeed() const { return (seedState_>0) ? true : false; }
130 
132  // void youAreSeed(int seedstate=1) {seedState_ = seedstate;}
133 
135  const math::XYZPoint& position() const { return position_; }
136 
138  const REPPoint& positionREP() const;
139 
141  const math::XYZVector& getAxisXYZ() const { return axisxyz_; }
142 
144  const std::vector< math::XYZPoint >& getCornersXYZ() const
145  { return cornersxyz_; }
146 
149  { return cornersrep_; }
150 
151  const std::vector< unsigned >& neighbours4() const
152  {return neighbours4_;}
153 
154  const std::vector< unsigned >& neighbours8() const
155  {return neighbours8_;}
156 
157  const std::vector< unsigned >& neighboursIds4() const
158  {return neighboursIds4_;}
159 
160  const std::vector< unsigned >& neighboursIds8() const
161  {return neighboursIds8_;}
162 
163  /* const std::vector< unsigned >& getNeighboursIds4() const */
164  /* {return neighboursIds4_;} */
165 
166  /* const std::vector< unsigned >& getNeighboursIds8() const */
167  /* {return neighboursIds8_;} */
168 
171  bool isNeighbour4(unsigned id) const;
172 
175  bool isNeighbour8(unsigned id) const;
176 
177 
178  void size(double& deta, double& dphi) const;
179 
181  bool operator>=(const PFRecHit& rhs) const { return (energy_>=rhs.energy_); }
182 
184  bool operator> (const PFRecHit& rhs) const { return (energy_> rhs.energy_); }
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 
192  friend std::ostream& operator<<(std::ostream& out,
193  const reco::PFRecHit& hit);
194 
195  private:
196 
198  unsigned detId_;
199 
202 
204  double energy_;
205 
207  double rescale_;
208 
210  double energyUp_;
211 
213  // int seedState_;
214 
217 
220 
223 
225  std::vector< math::XYZPoint > cornersxyz_;
227 
229  std::vector< unsigned > neighbours4_;
230 
232  std::vector< unsigned > neighbours8_;
233 
235  std::vector< unsigned > neighboursIds4_;
236 
238  std::vector< unsigned > neighboursIds8_;
239 
241  static const unsigned nNeighbours_;
242 
244  static const unsigned nCorners_;
245 
247  void setCorner( unsigned i, double posx, double posy, double posz );
248  };
249 
250 }
251 
252 #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:229
REPPoint posrep_
rechit cell centre: rho, eta, phi (transient)
Definition: PFRecHit.h:219
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:225
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:210
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:117
unsigned detId_
C cell detid - should be detid or index in collection ?
Definition: PFRecHit.h:198
unsigned detId() const
rechit detId
Definition: PFRecHit.h:99
double rescale() const
rescaling factor (obsolete)
Definition: PFRecHit.h:108
PFLayer::Layer layer_
rechit layer
Definition: PFRecHit.h:201
bool operator<=(const PFRecHit &rhs) const
comparison &lt;= operator
Definition: PFRecHit.h:187
bool operator<(const PFRecHit &rhs) const
comparison &lt; operator
Definition: PFRecHit.h:190
static const unsigned nNeighbours_
number of neighbours
Definition: PFRecHit.h:241
double energy_
rechit energy
Definition: PFRecHit.h:204
double energyUp() const
For HF hits: rechit energy (and neighbour&#39;s) in the other HF layer.
Definition: PFRecHit.h:114
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:102
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:144
void clearNeighbours()
Definition: PFRecHit.h:76
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:154
math::XYZVector axisxyz_
rechit cell axisxyz
Definition: PFRecHit.h:222
void setEnergyUp(double eUp)
Definition: PFRecHit.h:73
std::vector< unsigned > neighboursIds4_
detids of existing neighbours (1 common side)
Definition: PFRecHit.h:235
const math::XYZVector & getAxisXYZ() const
rechit cell axis x, y, z
Definition: PFRecHit.h:141
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:232
void setRescale(double factor)
Definition: PFRecHit.h:74
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:226
tuple out
Definition: dbtoconf.py:99
Layer
layer definition
Definition: PFLayer.h:31
const math::XYZPoint & position() const
is seed ?
Definition: PFRecHit.h:135
void calculatePositionREP()
calculates rho eta phi position once and for all
Definition: PFRecHit.cc:130
const REPPointVector & getCornersREP() const
rechit corners
Definition: PFRecHit.h:148
const std::vector< unsigned > & neighboursIds8() const
Definition: PFRecHit.h:160
double rescale_
Internal rescaling factor of the energy (1. = default, 0 = killed channels, x = rescaled) ...
Definition: PFRecHit.h:207
bool operator>=(const PFRecHit &rhs) const
comparison &gt;= operator
Definition: PFRecHit.h:181
math::XYZPoint position_
is this a seed ? (-1:unknown, 0:no, 1 yes) (transient)
Definition: PFRecHit.h:216
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
bool operator>(const PFRecHit &rhs) const
comparison &gt; operator
Definition: PFRecHit.h:184
bool isNeighbour4(unsigned id) const
Definition: PFRecHit.cc:248
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
std::vector< unsigned > neighboursIds8_
detids of existing neighbours (1 common side or diagonal)
Definition: PFRecHit.h:238
double energy() const
rechit energy
Definition: PFRecHit.h:105
bool isNeighbour8(unsigned id) const
Definition: PFRecHit.cc:257
const std::vector< unsigned > & neighboursIds4() const
Definition: PFRecHit.h:157
static const unsigned nCorners_
number of corners
Definition: PFRecHit.h:244
double time() const
timing for cleaned hits
Definition: PFRecHit.h:111
const std::vector< unsigned > & neighbours4() const
Definition: PFRecHit.h:151
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