]>
Commit | Line | Data |
---|---|---|
92af1877 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
0a29d0f1 | 16 | //////////////////////////////////////////////// |
17 | // // | |
18 | // Manager class for TRD hits // | |
19 | // // | |
20 | //////////////////////////////////////////////// | |
21 | ||
92af1877 | 22 | #include "AliTRDtrackHits.h" |
23 | #include "TClonesArray.h" | |
24 | #include "AliTRDhit.h" | |
25 | ||
a2cb5b3d | 26 | #include <Riostream.h> |
92af1877 | 27 | |
28 | ||
29 | ClassImp(AliTRDtrackHits) | |
30 | ||
31 | void AliTRDtrackHits::AddHitTRD(Int_t volumeID, Int_t trackID, Double_t x, | |
32 | Double_t y, Double_t z,Int_t q, Bool_t inDrift) | |
33 | { | |
0a29d0f1 | 34 | // |
35 | // Add one TRD hit | |
36 | // | |
37 | ||
92af1877 | 38 | if (inDrift) q=2*q+1; |
39 | else q=2*q; | |
40 | AddHitKartez(volumeID, trackID,x,y,z,q); | |
41 | } | |
42 | ||
43 | Bool_t AliTRDtrackHits::First() | |
44 | { | |
45 | // | |
46 | //set Current hit for the first hit | |
47 | // | |
38c5a455 | 48 | |
49 | if (fArray->GetSize()<=0) { | |
50 | fCurrentHit->fStatus = kFALSE; | |
51 | return kFALSE; | |
52 | } | |
53 | ||
92af1877 | 54 | AliTrackHitsParamV2 *param = (AliTrackHitsParamV2 *)fArray->At(0); |
55 | if (!fHit) | |
56 | fHit = new AliTRDhit; | |
57 | if (!(param) ) { | |
58 | fCurrentHit->fStatus = kFALSE; | |
59 | return kFALSE; | |
60 | } | |
61 | // | |
62 | fCurrentHit->fParamIndex = 0; | |
63 | fCurrentHit->fStackIndex = 0; | |
64 | // | |
65 | // | |
66 | ((AliTRDhit*)fHit)->SetDetector(param->fVolumeID); | |
67 | ((AliTRDhit*)fHit)->SetTrack(param->fTrackID); | |
68 | ((AliTRDhit*)fHit)->SetX(param->fR*TMath::Cos(param->fFi)); | |
69 | ((AliTRDhit*)fHit)->SetY(param->fR*TMath::Sin(param->fFi)); | |
70 | ((AliTRDhit*)fHit)->SetZ(param->fZ); | |
71 | ((AliTRDhit*)fHit)->SetQ(param->fCharge[0]/2); | |
72 | if (param->fCharge[0]%2==0) ((AliTRDhit*)fHit)->SetAmplification(); | |
73 | else ((AliTRDhit*)fHit)->SetDrift(); | |
74 | fCurrentHit->fR = param->fR; | |
75 | ||
76 | return fCurrentHit->fStatus = kTRUE; | |
77 | } | |
78 | ||
79 | Bool_t AliTRDtrackHits::Next() | |
80 | { | |
81 | // | |
82 | // | |
83 | if (!(fCurrentHit->fStatus)) | |
84 | return kFALSE; | |
85 | ||
86 | fCurrentHit->fStackIndex++; | |
87 | ||
88 | AliTrackHitsParamV2 *param = (AliTrackHitsParamV2 *)fArray->At(fCurrentHit->fParamIndex); | |
73ae7b59 | 89 | if (fCurrentHit->fStackIndex>= param->fNHits){ |
92af1877 | 90 | fCurrentHit->fParamIndex++; |
73ae7b59 | 91 | if (fCurrentHit->fParamIndex>= fArray->GetEntriesFast()){ |
92af1877 | 92 | fCurrentHit->fStatus=kFALSE; |
93 | return kFALSE; | |
94 | } | |
95 | param = (AliTrackHitsParamV2 *)fArray->At(fCurrentHit->fParamIndex); | |
96 | fCurrentHit->fStackIndex=0; | |
97 | fCurrentHit->fR = param->fR; | |
98 | } | |
99 | ||
100 | ||
101 | ||
102 | Double_t ratio; | |
103 | ||
104 | // Double_t dfi2 = param->fAn+2*param->fAd*(fCurrentHit->fR-param->fR); | |
105 | Double_t dfi2 = param->fAn; | |
106 | dfi2*=dfi2*fCurrentHit->fR*fCurrentHit->fR; | |
107 | // Double_t ddz2 = param->fTheta+2*param->fThetaD*(fCurrentHit->fR-param->fR); | |
108 | Double_t ddz2 = param->fTheta; | |
109 | ddz2*=ddz2; | |
110 | ratio = TMath::Sqrt(1.+ dfi2+ ddz2); | |
111 | ||
112 | ||
113 | fCurrentHit->fR += fStep*param->fHitDistance[fCurrentHit->fStackIndex]/ratio; | |
114 | ||
115 | Double_t dR = fCurrentHit->fR - param->fR; | |
116 | Double_t fi = param->fFi + (param->fAn*dR+param->fAd*dR*dR); | |
117 | Double_t z = param->fZ + (param->fTheta*dR+param->fThetaD*dR*dR); | |
118 | ||
119 | ((AliTRDhit*)fHit)->SetQ(param->fCharge[fCurrentHit->fStackIndex]/2); | |
120 | if ( param->fCharge[fCurrentHit->fStackIndex]%2==0) ((AliTRDhit*)fHit)->SetAmplification(); | |
121 | else ((AliTRDhit*)fHit)->SetDrift(); | |
122 | ((AliTRDhit*)fHit)->SetX(fCurrentHit->fR*TMath::Cos(fi)); | |
123 | ((AliTRDhit*)fHit)->SetY(fCurrentHit->fR*TMath::Sin(fi)); | |
124 | ((AliTRDhit*)fHit)->SetZ(z); | |
125 | ((AliTRDhit*)fHit)->SetDetector(param->fVolumeID); | |
126 | ((AliTRDhit*)fHit)->SetTrack(param->fTrackID); | |
127 | ||
128 | return kTRUE; | |
129 | } | |
130 |