]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDtrackHits.cxx
Remove the last print statements
[u/mrichter/AliRoot.git] / TRD / AliTRDtrackHits.cxx
CommitLineData
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
a2cb5b3d 22#include <Riostream.h>
92af1877 23
3bc9d03e 24#include <TClonesArray.h>
25
26#include "AliTRDtrackHits.h"
27#include "AliTRDhit.h"
92af1877 28
29ClassImp(AliTRDtrackHits)
30
3bc9d03e 31//_____________________________________________________________________________
32void AliTRDtrackHits::AddHitTRD(Int_t volumeID, Int_t trackID, Double_t x
33 , Double_t y, Double_t z, Int_t q, Bool_t inDrift)
92af1877 34{
0a29d0f1 35 //
36 // Add one TRD hit
37 //
38
3bc9d03e 39 if (inDrift) {
40 q = 2 * q + 1;
41 }
42 else {
43 q = 2 * q;
44 }
45
46 AddHitKartez(volumeID,trackID,x,y,z,q,0);
47
92af1877 48}
49
3bc9d03e 50//_____________________________________________________________________________
92af1877 51Bool_t AliTRDtrackHits::First()
52{
53 //
3bc9d03e 54 // Set Current hit for the first hit
92af1877 55 //
38c5a455 56
3bc9d03e 57 if (fArray->GetSize() <= 0) {
38c5a455 58 fCurrentHit->fStatus = kFALSE;
59 return kFALSE;
60 }
61
3bc9d03e 62 AliTrackHitsParamV2 *param = (AliTrackHitsParamV2 *) fArray->At(0);
63 if (!fHit) {
92af1877 64 fHit = new AliTRDhit;
3bc9d03e 65 }
66 if (!(param)) {
92af1877 67 fCurrentHit->fStatus = kFALSE;
68 return kFALSE;
69 }
3bc9d03e 70
92af1877 71 fCurrentHit->fParamIndex = 0;
72 fCurrentHit->fStackIndex = 0;
3bc9d03e 73
74 ((AliTRDhit *) fHit)->SetDetector(param->fVolumeID);
75 ((AliTRDhit *) fHit)->SetTrack(param->fTrackID);
76 ((AliTRDhit *) fHit)->SetX(param->fR * TMath::Cos(param->fFi));
77 ((AliTRDhit *) fHit)->SetY(param->fR * TMath::Sin(param->fFi));
78 ((AliTRDhit *) fHit)->SetZ(param->fZ);
79 ((AliTRDhit *) fHit)->SetQ(param->fCharge[0] / 2);
80 if ((param->fCharge[0] % 2) == 0) {
81 ((AliTRDhit *) fHit)->SetAmplification();
82 }
83 else {
84 ((AliTRDhit *) fHit)->SetDrift();
85 }
92af1877 86 fCurrentHit->fR = param->fR;
87
88 return fCurrentHit->fStatus = kTRUE;
92af1877 89
3bc9d03e 90}
91//set current hit to next
92//_____________________________________________________________________________
92af1877 93Bool_t AliTRDtrackHits::Next()
94{
95 //
3bc9d03e 96 // Set current hit to next
97 //
92af1877 98
3bc9d03e 99 if (!(fCurrentHit->fStatus)) {
100 return kFALSE;
101 }
92af1877 102 fCurrentHit->fStackIndex++;
103
3bc9d03e 104 AliTrackHitsParamV2 *param = (AliTrackHitsParamV2 *)
105 fArray->At(fCurrentHit->fParamIndex);
106
107 if (fCurrentHit->fStackIndex >= param->fNHits) {
92af1877 108 fCurrentHit->fParamIndex++;
3bc9d03e 109 if (fCurrentHit->fParamIndex >= fArray->GetEntriesFast()) {
110 fCurrentHit->fStatus = kFALSE;
92af1877 111 return kFALSE;
112 }
3bc9d03e 113 param = (AliTrackHitsParamV2 *) fArray->At(fCurrentHit->fParamIndex);
114 fCurrentHit->fStackIndex = 0;
115 fCurrentHit->fR = param->fR;
92af1877 116 }
117
92af1877 118 Double_t ratio;
92af1877 119 Double_t dfi2 = param->fAn;
3bc9d03e 120 dfi2 *= dfi2 * fCurrentHit->fR * fCurrentHit->fR;
121 Double_t ddz2 = param->fTheta;
122 ddz2 *= ddz2;
123 ratio = TMath::Sqrt(1.0 + dfi2 + ddz2);
92af1877 124
3bc9d03e 125 fCurrentHit->fR += fStep * param->fHitDistance[fCurrentHit->fStackIndex] / ratio;
92af1877 126
127 Double_t dR = fCurrentHit->fR - param->fR;
3bc9d03e 128 Double_t fi = param->fFi + (param->fAn * dR + param->fAd * dR*dR);
129 Double_t z = param->fZ + (param->fTheta * dR + param->fThetaD * dR*dR);
130
131 ((AliTRDhit *) fHit)->SetQ(param->fCharge[fCurrentHit->fStackIndex] / 2);
132 if ((param->fCharge[fCurrentHit->fStackIndex] % 2) ==0) {
133 ((AliTRDhit *) fHit)->SetAmplification();
134 }
135 else {
136 ((AliTRDhit *) fHit)->SetDrift();
137 }
138 ((AliTRDhit *) fHit)->SetX(fCurrentHit->fR * TMath::Cos(fi));
139 ((AliTRDhit *) fHit)->SetY(fCurrentHit->fR * TMath::Sin(fi));
140 ((AliTRDhit *) fHit)->SetZ(z);
141 ((AliTRDhit *) fHit)->SetDetector(param->fVolumeID);
142 ((AliTRDhit *) fHit)->SetTrack(param->fTrackID);
92af1877 143
144 return kTRUE;
3bc9d03e 145
92af1877 146}
147