00001
00044 #ifndef StiHit_HH
00045 #define StiHit_HH
00046 #include "StiDetector.h"
00047 #include "StiPlacement.h"
00048 #include "StMeasuredPoint.h"
00049 #include "StThreeVectorF.hh"
00050 #include "StMatrixF.hh"
00051 class StiHit
00052 {
00053 public:
00054
00055 enum StiHitProperty { kR,
00056 kZ,
00057 kPseudoRapidity,
00058 kPhi};
00060 StiHit();
00061 StiHit(const StiHit&);
00062 const StiHit& operator=(const StiHit& );
00064 ~StiHit();
00065
00067 const Float_t &x() const {return mx;}
00068 const Float_t &y() const {return my;}
00069 const Float_t &z() const {return mz;}
00070 const Float_t y(Float_t time) const {return my + _vy*time;}
00071 const Float_t z(Float_t time) const {return mz + _vz*time;}
00073 Float_t x_g() const {return _xg;}
00074 Float_t y_g() const {return _yg;}
00075 Float_t z_g() const {return _zg;}
00076
00078 Float_t sxx() const {return msxx;}
00079 Float_t syy() const {return msyy;}
00080 Float_t szz() const {return mszz;}
00081 Float_t sxy() const {return msxy;}
00082 Float_t sxz() const {return msxz;}
00083 Float_t syz() const {return msyz;}
00084 const Float_t *errMtx() const {return &msxx;}
00086 Float_t getEloss();
00088 Float_t refangle() const {return mrefangle;}
00090 Float_t position() const {return mposition;}
00093 const StiDetector* detector() const {return mdetector;}
00095 Int_t isDca() const;
00097 void makeDca();
00100
00101 const StMeasuredPoint * stHit() const {return msthit;}
00102
00105
00106
00108 UInt_t timesUsed() const { return mTimesUsed;}
00109
00112
00113
00116 const StThreeVectorF globalPosition() const;
00117
00118 void set(Float_t position, Float_t angle, Float_t y, Float_t z);
00119
00121 void set(const StiDetector * detector,
00122 const StMeasuredPoint * stHit,
00123 Float_t energy,
00124 Float_t x, Float_t y, Float_t z,
00125 Float_t sxx=1, Float_t sxy=1, Float_t sxz=1, Float_t syy=1, Float_t syz=1, Float_t szz=1);
00129 void setGlobal(const StiDetector * detector,
00130 const StMeasuredPoint * stHit,
00131 Float_t x, Float_t y, Float_t z,
00132 Float_t energy);
00133
00136 void setError(const StMatrixF&);
00139 void setError(const Float_t errMx[6]);
00141 void setDetector(const StiDetector*det) {mdetector=det;};
00143 void setStHit(const StMeasuredPoint*hit){msthit=hit;}
00145 void setTimesUsed(unsigned int);
00146 void setVz(Float_t vz) {_vz = vz;}
00147 void setVy(Float_t vy) {_vy = vy;}
00148 void reset();
00149 void unset(){;}
00150 void rotate(double angle);
00151 double getValue(Int_t key) const;
00152 double getPseudoRapidity() const;
00153 Float_t vz() const {return _vz;}
00154 Float_t vy() const {return _vy;}
00155 friend ostream& operator<<(ostream& os, const StiHit& h);
00156 private:
00157 char mBeg[1];
00158 unsigned char mTimesUsed;
00159 Float_t mrefangle;
00160 Float_t mposition;
00161 Float_t mx;
00162 Float_t my;
00163 Float_t mz;
00164 Float_t msxx;
00165 Float_t msxy;
00166 Float_t msyy;
00167 Float_t msxz;
00168 Float_t msyz;
00169 Float_t mszz;
00170
00171 Float_t _xg,_yg,_zg;
00172 const StiDetector* mdetector;
00173 const StMeasuredPoint * msthit;
00174 Float_t _energy;
00175
00176 Float_t _vy, _vz;
00177
00178 char mEnd[1];
00179 public:
00180 Int_t mCount;
00181 };
00182
00183
00184 struct StiHitRadiusLessThan
00185 {
00186 bool operator() (const StiHit*h1, const StiHit*h2) const
00187 {
00188 double x1 = h1->x_g();
00189 double y1 = h1->y_g();
00190 double r1 = sqrt(x1*x1+y1*y1);
00191 double x2 = h2->x_g();
00192 double y2 = h2->y_g();
00193 double r2 = sqrt(x2*x2+y2*y2);
00194 return r1<r2;
00195 }
00196 };
00197
00198 struct StidHitLessThan
00199 {
00200 bool operator() (const StiHit*lhs, const StiHit*rhs) const
00201 {
00202 return (lhs->y() < rhs->y()) ? true : false;
00203 }
00204 };
00205
00206 struct StizHitLessThan
00207 {
00208 bool operator() (const StiHit*lhs, const StiHit*rhs) const
00209 {
00210 return (lhs->z() < rhs->z()) ? true : false;
00211 }
00212 };
00213
00214 struct StiHitIsUsed
00215 {
00216 bool operator() (const StiHit*hit) const
00217 {
00218 return (hit->timesUsed()==0);
00219 }
00220 };
00221
00222
00223 #endif