StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StiHit.h
1 
44 #ifndef StiHit_HH
45 #define StiHit_HH
46 #include "StiDetector.h"
47 #include "StiPlacement.h"
48 #include "StMeasuredPoint.h"
49 #include "StThreeVectorF.hh"
50 #include "StMatrixF.hh"
51 class StiHit
52 {
53 public:
54 
55  enum StiHitProperty { kR,
56  kZ,
57  kPseudoRapidity,
58  kPhi};
60  StiHit();
61  StiHit(const StiHit&);
62  const StiHit& operator=(const StiHit& );
64  ~StiHit();
65 
67  const Float_t &x() const {return mx;}
68  const Float_t &y() const {return my;}
69  const Float_t &z() const {return mz;}
70  const Float_t y(Float_t time) const {return my + _vy*time;}
71  const Float_t z(Float_t time) const {return mz + _vz*time;}
73  Float_t x_g() const {return _xg;}
74  Float_t y_g() const {return _yg;}
75  Float_t z_g() const {return _zg;}
77  float rxy() const {return sqrt(_xg*_xg+_yg*_yg);}
78 
79 
81  Float_t sxx() const {return msxx;}
82  Float_t syy() const {return msyy;}
83  Float_t szz() const {return mszz;}
84  Float_t sxy() const {return msxy;}
85  Float_t sxz() const {return msxz;}
86  Float_t syz() const {return msyz;}
87  const Float_t *errMtx() const {return &msxx;}
89  Float_t getEloss();
91  Float_t refangle() const {return mrefangle;}
93  Float_t position() const {return mposition;}
96  const StiDetector* detector() const {return mdetector;}
98  Int_t isDca() const;
100  void makeDca();
103  //const StHit* stHit() const
104  const StMeasuredPoint * stHit() const {return msthit;}
105 
106 
108  UInt_t timesUsed() const { return mTimesUsed;}
109 
110 
113  const StThreeVectorF globalPosition() const;
114 
115  void set(Float_t position, Float_t angle, Float_t y, Float_t z);
116 
118  void set(const StiDetector * detector,
119  const StMeasuredPoint * stHit,
120  Float_t energy,
121  Float_t x, Float_t y, Float_t z,
122  Float_t sxx=1, Float_t sxy=1, Float_t sxz=1, Float_t syy=1, Float_t syz=1, Float_t szz=1);
126  void setGlobal(const StiDetector * detector,
127  const StMeasuredPoint * stHit,
128  Float_t x, Float_t y, Float_t z,
129  Float_t energy);
130 
133  void setError(const StMatrixF&);
136  void setError(const Float_t errMx[6]);
138  void setDetector(const StiDetector*det) {mdetector=det;};
140  void setStHit(const StMeasuredPoint*hit){msthit=hit;}
142  void setMaxTimes(int set) {mMaxTimes = set;}
143  void setTimesUsed(int set){mTimesUsed=set;}
144  void addTimesUsed();
145  void subTimesUsed();
148  int isUsed() const {return mTimesUsed>=mMaxTimes;}
149  void setVz(Float_t vz) {_vz = vz;}
150  void setVy(Float_t vy) {_vy = vy;}
151  void reset();
152  void unset(){;}
153  void rotate(double angle);
154  double getValue(Int_t key) const;
155  double getPseudoRapidity() const;
156  Float_t vz() const {return _vz;}
157  Float_t vy() const {return _vy;}
158  friend ostream& operator<<(ostream& os, const StiHit& h);
159  int idTruth() const;
160  int qaTruth() const;
161 
162 protected:
163  char mBeg[1];
164  char mMaxTimes;
165  char mTimesUsed;
166  Float_t mrefangle;
167  Float_t mposition;
168  Float_t mx;
169  Float_t my;
170  Float_t mz;
171  Float_t msxx;
172  Float_t msxy;
173  Float_t msyy;
174  Float_t msxz;
175  Float_t msyz;
176  Float_t mszz;
177  // global position
178  Float_t _xg,_yg,_zg;
179  const StiDetector* mdetector;
180  const StMeasuredPoint * msthit;
181  Float_t _energy;
182  // drift velocities cm/mksec( 0 for non driting )
183  Float_t _vy, _vz;
184  char mEnd[1];
185 public:
186  Int_t mCount;
187 };
188 
189 //Functors for ordering hits
191 {
192  bool operator() (const StiHit*h1, const StiHit*h2) const
193  {
194  double x1 = h1->x_g();
195  double y1 = h1->y_g();
196  double r1 = sqrt(x1*x1+y1*y1);
197  double x2 = h2->x_g();
198  double y2 = h2->y_g();
199  double r2 = sqrt(x2*x2+y2*y2);
200  return r1<r2;
201  }
202 };
203 
205 {
206  bool operator() (const StiHit*lhs, const StiHit*rhs) const
207  {
208  return (lhs->y() < rhs->y()) ? true : false;
209  }
210 };
211 
213 {
214  bool operator() (const StiHit*lhs, const StiHit*rhs) const
215  {
216  return (lhs->z() < rhs->z()) ? true : false;
217  }
218 };
219 
221 {
222  bool operator() (const StiHit*hit) const
223  {
224  return (hit->isUsed()==0);
225  }
226 };
227 
228 
229 #endif
StiHit()
Default constructor.
Definition: StiHit.cxx:20
void setError(const StMatrixF &)
Definition: StiHit.cxx:67
void makeDca()
Make fake hit for dca calculation.
Definition: StiHit.cxx:279
friend ostream & operator<<(ostream &os, const StiHit &h)
Definition: StiHit.cxx:89
void setGlobal(const StiDetector *detector, const StMeasuredPoint *stHit, Float_t x, Float_t y, Float_t z, Float_t energy)
Definition: StiHit.cxx:133
void setStHit(const StMeasuredPoint *hit)
Set the pointer to the corresponding StHit object.
Definition: StiHit.h:140
Definition: StiHit.h:51
const Float_t & x() const
Return the local x, y, z values.
Definition: StiHit.h:67
void rotate(double angle)
Definition: StiHit.cxx:46
~StiHit()
Default destructor.
Definition: StiHit.cxx:40
int isUsed() const
Definition: StiHit.h:148
const StiDetector * detector() const
Definition: StiHit.h:96
Float_t x_g() const
Return the global x, y, z values.
Definition: StiHit.h:73
Float_t refangle() const
Return the refAngle of the detector plane from which the hit arose.
Definition: StiHit.h:91
void addTimesUsed()
???
Definition: StiHit.cxx:240
UInt_t timesUsed() const
Return the number of times this hit was assigned to a track.
Definition: StiHit.h:108
Int_t isDca() const
Test for DCA. Fake hit for dca calculation.
Definition: StiHit.cxx:285
Float_t getEloss()
Return the energy deposition associated with this point.
Definition: StiHit.cxx:253
float rxy() const
Return the rxy.
Definition: StiHit.h:77
Float_t sxx() const
Return components of the error matrix.
Definition: StiHit.h:81
void setMaxTimes(int set)
Set the number of times used.
Definition: StiHit.h:142
void setDetector(const StiDetector *det)
Set the pointer to the StiDetector from which the hit arose.
Definition: StiHit.h:138
Float_t position() const
Return the position of the detector plane from which the hit arose.
Definition: StiHit.h:93
const StMeasuredPoint * stHit() const
Definition: StiHit.h:104
const StThreeVectorF globalPosition() const
Definition: StiHit.cxx:259