TPC module
[u/mrichter/AliRoot.git] / TPC / TPCsim / AliTPCTrackHitsV2.h
CommitLineData
f641f6bd 1#ifndef ALITPCTRACKHITSV2_H
2#define ALITPCTRACKHITSV2_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7////////////////////////////////////////////////
8// Manager class for TPC hits //
9////////////////////////////////////////////////
018a927a 10//
f641f6bd 11
12#include "TObject.h"
ce100063 13#include "TClonesArray.h"
f641f6bd 14
476e5cf2 15
f641f6bd 16class AliTPChit;
17class AliTPCTempHitInfoV2;
18class AliTPCCurrentHitV2;
fce0283f 19class AliHit;
f641f6bd 20
21class AliTrackHitsParamV2 : public TObject {
9b1855ba 22
179c6296 23
f641f6bd 24public:
25 AliTrackHitsParamV2();
179c6296 26
27 AliTrackHitsParamV2(const AliTrackHitsParamV2 &hit): TObject(hit),
28 fTrackID(0),
29 fVolumeID(0),
30 fR(0.),
31 fZ(0.),
32 fFi(0.),
33 fAn(0.),
34 fAd(0.),
35 fTheta(0.),
36 fThetaD(0.),
37 fNHits(0),
38 fHitDistance(0),
39 fCharge(0),
40 fTime(0)
53110b9d 41 {hit.Copy(*this);}
42 AliTrackHitsParamV2& operator = (const AliTrackHitsParamV2 &hit)
43 {hit.Copy(*this); return (*this);}
f641f6bd 44 ~AliTrackHitsParamV2();
53110b9d 45
b9671574 46 Int_t GetTrackID() const {return fTrackID;}
47 Int_t GetVolumeID() const {return fVolumeID;}
48 Float_t GetR() const {return fR;}
49 Float_t GetZ() const {return fZ;}
50 Float_t GetFi() const {return fFi;}
51 Float_t GetAn() const {return fAn;}
52 Float_t GetAd() const {return fAd;}
53 Float_t GetTheta() const {return fTheta;}
54 Float_t GetThetaD() const {return fThetaD;}
55 Int_t GetNHits() const {return fNHits;}
56
57 Short_t HitDistance(Int_t i) const {return fHitDistance[i];}
58 Short_t Charge(Int_t i) const {return fCharge[i];}
59 Short_t Time(Int_t i) const {return fTime[i];}
60
61 Short_t& HitDistance(Int_t i) {return fHitDistance[i];}
62 Short_t& Charge(Int_t i) {return fCharge[i];}
63 Short_t& Time(Int_t i) {return fTime[i];}
64
65 void SetHitDistance(Int_t i)
66 {Short_t *s=new Short_t[i];
67 delete [] fHitDistance; fHitDistance=s;}
68
69 void SetCharge(Int_t i)
70 {Short_t *s=new Short_t[i];
71 delete [] fCharge; fCharge=s;}
72
73 void SetTime(Int_t i)
74 {Short_t *s=new Short_t[i];
75 delete [] fTime; fTime=s;}
76
77 void ResizeHitDistance(Int_t i)
78 {Short_t *s=new Short_t[i];
79 memcpy(s, fHitDistance, sizeof(Short_t)*i);
80 delete [] fHitDistance; fHitDistance=s;}
81
82 void ResizeCharge(Int_t i)
83 {Short_t *s=new Short_t[i];
84 memcpy(s, fCharge, sizeof(Short_t)*i);
85 delete [] fCharge; fCharge=s;}
86
87 void ResizeTime(Int_t i)
88 {Short_t *s=new Short_t[i];
89 memcpy(s, fTime, sizeof(Short_t)*i);
90 delete [] fTime; fTime=s;}
91
92 void SetTrackID(Int_t id) {fTrackID=id;}
93 void SetVolumeID(Short_t id) {fVolumeID=id;}
94 void SetR(Float_t r) {fR=r;}
95 void SetZ(Float_t z) {fZ=z;}
96 void SetFi(Float_t fi) {fFi=fi;}
97 void SetAn(Float_t an) {fAn=an;}
98 void SetAd(Float_t ad) {fAd=ad;}
99 void SetTheta(Float_t t) {fTheta=t;}
100 void SetThetaD(Float_t t) {fThetaD=t;}
101 void SetNHits(Int_t n) {fNHits=n;}
102
af05e6c8 103 Float_t Eta() const;
104
9b1855ba 105 private:
b9671574 106 Int_t fTrackID; // ID of the trac┬ęk
f641f6bd 107 Short_t fVolumeID;// volume ID
108 Float_t fR; //radius
109 Float_t fZ; //z position
110 Float_t fFi; //radial angle
111 Float_t fAn; //angle with the radial vector
112 Float_t fAd; //derivation of angle
113 Float_t fTheta; //theta angle
114 Float_t fThetaD; //theta angle derivation
115 Int_t fNHits; //nuber of thits
116 Short_t * fHitDistance; //[fNHits] array of hits distances
117 Short_t * fCharge; //[fNHits] array of charges
e61fd20d 118 Short_t * fTime; //[fNHits] array of hits time
53110b9d 119 static Int_t fgCounter1; //First internal counter
120 static Int_t fgCounter2; // Second internal counter
121
122 void Copy(TObject &) const
123 {Error("Copy","Not Implemented");}
124
e61fd20d 125 ClassDef(AliTrackHitsParamV2,2)
f641f6bd 126};
127
128
f641f6bd 129class AliTPCTrackHitsV2 : public TObject {
53110b9d 130
f641f6bd 131public:
179c6296 132 AliTPCTrackHitsV2();
f641f6bd 133 ~AliTPCTrackHitsV2();
ce100063 134 AliTPCTrackHitsV2(const AliTPCTrackHitsV2 &hit): TObject(hit),
135 fArray(0),
136 fSize(hit.fSize),
137 fPrecision(hit.fPrecision),
138 fStep(hit.fStep),
139 fMaxDistance(hit.fMaxDistance),
140 fNVolumes(hit.fNVolumes),
141 fVolumes(0),
142 fTempInfo(hit.fTempInfo),
143 fCurrentHit(hit.fCurrentHit),
144 fHit(hit.fHit)
145 { //
146 //copy constructor
147 //
148
476e5cf2 149 (*fArray) = (*hit.fArray);
ce100063 150 //
151 delete [] fVolumes;
152 fVolumes = new Int_t[fNVolumes];
153 memcpy(fVolumes,hit.fVolumes,fNVolumes*sizeof(Int_t));
154 }
53110b9d 155 AliTPCTrackHitsV2& operator = (const AliTPCTrackHitsV2 &hit)
ce100063 156 {
157 if(this!=&hit){
158 TObject::operator=(hit);
159 fSize=hit.fSize;
160 fPrecision=hit.fPrecision;
161 fStep=hit.fStep;
162 fMaxDistance=hit.fMaxDistance;
163 fNVolumes=hit.fNVolumes;
164 fTempInfo=hit.fTempInfo;
165 fCurrentHit=hit.fCurrentHit;
166 fHit=hit.fHit;
167 //
168 //delete fArray;
169 fArray->Clear();
476e5cf2 170 (*fArray)=(*hit.fArray);
ce100063 171 //
172 delete [] fVolumes;
173 fVolumes = new Int_t[fNVolumes];
174 memcpy(fVolumes,hit.fVolumes,fNVolumes*sizeof(Int_t));
175 //
176 }
177
178 return *this;
179 }
180
181
5f6e636c 182 void Clear(Option_t * /*option*/ ="");
f641f6bd 183 void AddHitKartez(Int_t volumeID, Int_t trackID, Double_t x,
e61fd20d 184 Double_t y, Double_t z,Int_t q,Float_t time);
f641f6bd 185 void AddHit(Int_t volumeID, Int_t trackID, Double_t r,
e61fd20d 186 Double_t z, Double_t fi,Int_t q,Float_t time);
f641f6bd 187
188 Bool_t First(); //set current hit to first hit
189 Bool_t Next(); //set current hit to next
53110b9d 190 AliHit * GetHit() const;
f641f6bd 191 AliTrackHitsParamV2 * GetParam();
192
193 TClonesArray * GetArray(){return fArray;}
53110b9d 194 Int_t GetEntriesFast() const { return fSize;}
f641f6bd 195 void SetHitPrecision(Double_t prec) {fPrecision=prec;}
196 void SetStepPrecision(Double_t prec) {fStep=prec;}
197 void SetMaxDistance(UInt_t distance) {fMaxDistance = distance;}
198 Bool_t FlushHitStack(Bool_t force=kTRUE); //
199 Int_t * GetVolumes(){ return fVolumes;}
53110b9d 200 Int_t GetNVolumes() const {return fNVolumes;}
b9671574 201 static Double_t GetKPrecision() {return fgkPrecision;}
202 static Double_t GetKPrecision2() {return fgkPrecision2;}
53110b9d 203
f641f6bd 204public:
205 void AddVolume(Int_t volume); //add volumes to tthe list of volumes
206 void FlushHitStack2(Int_t index1, Int_t index2); //
53110b9d 207
208protected:
f641f6bd 209 TClonesArray * fArray; //array of compressed hits
210 Int_t fSize; //total number of hits in track
211 Double_t fPrecision; // required precision
212 Double_t fStep; //unit step size
213 UInt_t fMaxDistance; //maximal distance between two connected hits
214 Int_t fNVolumes; //number of volumes in track
215 Int_t * fVolumes; //[fNVolumes] list of volumes
216 AliTPCTempHitInfoV2 * fTempInfo; //!information about track
217 AliTPCCurrentHitV2 * fCurrentHit; //!information about current hit
fce0283f 218 AliHit * fHit; //! current hit information
f641f6bd 219 static const Double_t fgkPrecision; //precision
220 static const Double_t fgkPrecision2; //precision
e61fd20d 221 static const Double_t fgkTimePrecision; //hit time precision
53110b9d 222 static Int_t fgCounter1; // First internal counter
223 static Int_t fgCounter2; // Second internal counter
224
225private:
226 void Copy(TObject &) const
227 {Error("Copy","Not Implemented");}
228
229
e61fd20d 230 ClassDef(AliTPCTrackHitsV2,2)
f641f6bd 231};
232
b9671574 233class AliTPCCurrentHitV2 {
234public:
235 Int_t GetStackIndex() const {return fStackIndex;}
236 void SetStackIndex(Int_t i) {fStackIndex=i;}
237 Int_t GetParamIndex() const {return fParamIndex;}
238 void SetParamIndex(Int_t i) {fParamIndex=i;}
239 Double_t GetR() const {return fR;}
240 void SetR(Double_t r) {fR=r;}
241 Bool_t GetStatus() const {return fStatus;}
242 void SetStatus(Bool_t s) {fStatus=s;}
243private:
45bcf167 244 Int_t fParamIndex;// - current param pointer
245 Int_t fStackIndex; // - current hit stack index
fce0283f 246 Double_t fR; //current Radius
247 Bool_t fStatus; //current status
248};
249
250
f641f6bd 251
252#endif //ALITPCTRACKHITSV2_H