00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 #ifndef StTpcHit_hh
00086 #define StTpcHit_hh
00087
00088 #include "StHit.h"
00089 #include "StMemoryPool.hh"
00090 #include "TMath.h"
00091 class StTpcHit : public StHit {
00092 public:
00093 StTpcHit() : StHit() {mMinpad = mMaxpad = mMintmbk = mMaxtmbk = 0; mMcl_x = mMcl_t = 0; mChargeModified = 0;}
00094 StTpcHit(const StThreeVectorF& p,
00095 const StThreeVectorF& e,
00096 UInt_t hw, float q, UChar_t c = 0,
00097 UShort_t IdTruth=0, UShort_t quality=0,
00098 UShort_t Id =0,
00099 Short_t mnpad=0, Short_t mxpad=0, Short_t mntmbk=0,
00100 Short_t mxtmbk=0, Float_t cl_x = 0, Float_t cl_t = 0, UShort_t Adc = 0)
00101 : StHit(p, e, hw, q, c, IdTruth, quality, Id), mAdc(Adc) {setExtends(cl_x, cl_t, mnpad, mxpad, mntmbk, mxtmbk); mChargeModified = 0;}
00102 ~StTpcHit() {}
00103
00104 void* operator new(size_t ,void *p) { return p;}
00105 void* operator new(size_t) { return mPool.alloc(); }
00106 void operator delete(void* p) { mPool.free(p); }
00107
00108 void setChargeModified(Float_t Charge) {mChargeModified = Charge;}
00109 void setPadTmbk(Float_t cl_x, Float_t cl_t) { mMcl_x = TMath::Nint(cl_x*64); mMcl_t = TMath::Nint(cl_t*64);}
00110 void setExtends(Float_t cl_x, Float_t cl_t, Short_t mnpad, Short_t mxpad, Short_t mntmbk, Short_t mxtmbk);
00111 void setAdc(UShort_t Adc = 0) {mAdc = Adc;}
00112 UInt_t sector() const {return bits(4, 5);}
00113 UInt_t padrow() const {return bits(9, 6);}
00114 UInt_t padsInHit() const {return maxPad() - minPad() + 1;}
00115 UInt_t pixelsInHit() const {return bits(22,10);};
00116 UChar_t minPad() const {return TMath::Nint(mMcl_x/64.) - mMinpad;}
00117 UChar_t maxPad() const {return TMath::Nint(mMcl_x/64.) + mMaxpad;}
00118 Short_t minTmbk() const {return TMath::Nint(mMcl_t/64.) - mMintmbk;}
00119 Short_t maxTmbk() const {return TMath::Nint(mMcl_t/64.) + mMaxtmbk;}
00120 Int_t volumeID() const {return 100 * sector() + padrow();}
00121 Short_t timeBucketsInHit() const {return maxTmbk() - minTmbk() + 1;}
00122 Float_t timeBucket() const {return static_cast<float>(mMcl_t)/64.;}
00123 Float_t pad() const {return static_cast<float>(mMcl_x)/64.;}
00124 UShort_t adc() const {return mAdc;}
00125 Float_t chargeModified() const {return mChargeModified;}
00126 void Print(Option_t *option="") const;
00127 virtual Bool_t IsSortable() const { return kTRUE; }
00128 virtual Int_t Compare(const TObject *obj) const {
00129 StTpcHit *hit = (StTpcHit *) obj;
00130 if (sector() > hit->sector()) return kTRUE;
00131 if (padrow() > hit->padrow()) return kTRUE;
00132 if (TMath::Abs(position().z()) > TMath::Abs(hit->position().z())) return kTRUE;
00133 return kFALSE;
00134 }
00135
00136 protected:
00137 static StMemoryPool mPool;
00138 UChar_t mMinpad;
00139 UChar_t mMaxpad;
00140 UChar_t mMintmbk;
00141 UChar_t mMaxtmbk;
00142 Short_t mMcl_x;
00143 Short_t mMcl_t;
00144 UShort_t mAdc;
00145 Float_t mChargeModified;
00146 ClassDef(StTpcHit,5)
00147 };
00148 ostream& operator<<(ostream& os, StTpcHit const & v);
00149 #endif