]>
Commit | Line | Data |
---|---|---|
46d29e70 | 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 | ||
16 | /* | |
17 | $Log$ | |
a819a5f7 | 18 | Revision 1.5 2000/12/08 16:07:02 cblume |
19 | Update of the tracking by Sergei | |
20 | ||
bbf92647 | 21 | Revision 1.4 2000/10/16 01:16:53 cblume |
22 | Changed timebin 0 to be the one closest to the readout | |
23 | ||
ea6a8999 | 24 | Revision 1.3 2000/10/15 23:40:01 cblume |
25 | Remove AliTRDconst | |
26 | ||
0e9c2ad5 | 27 | Revision 1.2 2000/10/06 16:49:46 cblume |
28 | Made Getters const | |
29 | ||
46d29e70 | 30 | Revision 1.1.2.2 2000/10/04 16:34:58 cblume |
31 | Replace include files by forward declarations | |
32 | ||
33 | Revision 1.1.2.1 2000/09/22 14:47:52 cblume | |
34 | Add the tracking code | |
35 | ||
36 | */ | |
37 | ||
38 | #include <TObject.h> | |
39 | ||
40 | #include "AliRun.h" | |
41 | ||
42 | #include "AliTRD.h" | |
46d29e70 | 43 | #include "AliTRDgeometry.h" |
44 | #include "AliTRDcluster.h" | |
45 | #include "AliTRDtimeBin.h" | |
46d29e70 | 46 | #include "AliTRDtrackingSector.h" |
47 | ||
46d29e70 | 48 | ClassImp(AliTRDtrackingSector) |
49 | ||
50 | //_______________________________________________________ | |
51 | ||
52 | AliTRDtrackingSector::~AliTRDtrackingSector() | |
53 | { | |
54 | // | |
55 | // Destructor | |
56 | // | |
57 | ||
58 | delete[] fTimeBin; | |
59 | ||
60 | } | |
61 | ||
62 | //_______________________________________________________ | |
63 | AliTRDtimeBin &AliTRDtrackingSector::operator[](Int_t i) | |
64 | { | |
65 | // | |
66 | // Index operator | |
67 | // | |
68 | ||
69 | return *(fTimeBin+i); | |
70 | ||
71 | } | |
72 | ||
73 | //_______________________________________________________ | |
74 | ||
75 | void AliTRDtrackingSector::SetUp() | |
76 | { | |
46d29e70 | 77 | AliTRD *TRD = (AliTRD*) gAlice->GetDetector("TRD"); |
78 | fGeom = TRD->GetGeometry(); | |
79 | ||
80 | fTimeBinSize = fGeom->GetTimeBinSize(); | |
81 | ||
0e9c2ad5 | 82 | fN = AliTRDgeometry::Nplan() * (Int_t(AliTRDgeometry::DrThick() |
83 | /fTimeBinSize) + 1); | |
46d29e70 | 84 | |
85 | fTimeBin = new AliTRDtimeBin[fN]; | |
86 | ||
87 | } | |
88 | ||
89 | //______________________________________________________ | |
90 | ||
a819a5f7 | 91 | Double_t AliTRDtrackingSector::GetX(Int_t tb) const |
46d29e70 | 92 | { |
a819a5f7 | 93 | if( (tb<0) || (tb>fN-1)) { |
46d29e70 | 94 | fprintf(stderr,"AliTRDtrackingSector::GetX: TimeBin index is out of range !\n"); |
95 | return -99999.; | |
96 | } | |
97 | else { | |
98 | ||
0e9c2ad5 | 99 | Int_t tb_per_plane = fN/AliTRDgeometry::Nplan(); |
a819a5f7 | 100 | Int_t local_tb = tb_per_plane - tb%tb_per_plane - 1; |
46d29e70 | 101 | |
a819a5f7 | 102 | Int_t plane = tb/tb_per_plane; |
46d29e70 | 103 | Float_t t0 = fGeom->GetTime0(plane); |
a819a5f7 | 104 | Double_t x = t0 - (local_tb + 0.5) * fTimeBinSize; |
46d29e70 | 105 | |
106 | return x; | |
107 | } | |
108 | } | |
109 | ||
110 | //______________________________________________________ | |
111 | ||
46d29e70 | 112 | Int_t AliTRDtrackingSector::GetTimeBinNumber(Double_t x) const |
113 | { | |
ea6a8999 | 114 | Float_t r_out = fGeom->GetTime0(AliTRDgeometry::Nplan()-1); |
bbf92647 | 115 | Float_t r_in = fGeom->GetTime0(0) - AliTRDgeometry::DrThick(); |
46d29e70 | 116 | |
a819a5f7 | 117 | |
46d29e70 | 118 | if(x >= r_out) return fN-1; |
119 | if(x <= r_in) return 0; | |
120 | ||
a819a5f7 | 121 | Int_t plane; |
122 | for (plane = AliTRDgeometry::Nplan()-1; plane >= 0; plane--) { | |
123 | if(x > (fGeom->GetTime0(plane) - AliTRDgeometry::DrThick())) break; | |
124 | } | |
125 | ||
bbf92647 | 126 | Int_t tb_per_plane = fN/AliTRDgeometry::Nplan(); |
a819a5f7 | 127 | Int_t local_tb = Int_t((fGeom->GetTime0(plane)-x)/fTimeBinSize); |
bbf92647 | 128 | |
a819a5f7 | 129 | if((local_tb < 0) || (local_tb >= tb_per_plane)) { |
130 | printf("AliTRDtrackingSector::GetTimeBinNumber: \n"); | |
131 | printf("local time bin %d is out of bounds [0..%d]: x = %f \n", | |
132 | local_tb,tb_per_plane-1,x); | |
133 | return -1; | |
134 | } | |
135 | ||
136 | Int_t time_bin = (plane + 1) * tb_per_plane - 1 - local_tb; | |
46d29e70 | 137 | |
138 | return time_bin; | |
139 | } | |
140 | ||
141 | //______________________________________________________ | |
142 | ||
143 | Int_t AliTRDtrackingSector::GetTimeBin(Int_t det, Int_t local_tb) const | |
144 | { | |
145 | Int_t plane = fGeom->GetPlane(det); | |
146 | ||
bbf92647 | 147 | Int_t tb_per_plane = fN/AliTRDgeometry::Nplan(); |
148 | ||
a819a5f7 | 149 | Int_t time_bin = (plane + 1) * tb_per_plane - 1 - local_tb; |
bbf92647 | 150 | |
46d29e70 | 151 | return time_bin; |
152 | } | |
153 | ||
a819a5f7 | 154 | |
155 | //______________________________________________________ | |
156 | ||
157 | Bool_t AliTRDtrackingSector::TECframe(Int_t tb, Double_t y, Double_t z) const | |
158 | { | |
159 | // | |
160 | // Returns <true> if point defined by <x(tb),y,z> is within | |
161 | // the TEC G10 frame, otherwise returns <false> | |
162 | // | |
163 | ||
164 | if((tb > (fN-1)) || (tb < 0)) return kFALSE; | |
165 | ||
166 | Int_t tb_per_plane = fN/AliTRDgeometry::Nplan(); | |
167 | Int_t plane = tb/tb_per_plane; | |
168 | ||
169 | Double_t x = GetX(tb); | |
170 | y = TMath::Abs(y); | |
171 | ||
172 | if((y > fGeom->GetChamberWidth(plane)/2.) && | |
173 | (y < x*TMath::Tan(0.5*AliTRDgeometry::GetAlpha()))) return kTRUE; | |
174 | ||
175 | Double_t zmin, zmax; | |
176 | Float_t fRowPadSize, fRow0; | |
177 | Int_t nPadRows; | |
178 | ||
179 | for(Int_t iCha = 1; iCha < AliTRDgeometry::Ncham(); iCha++) { | |
180 | ||
181 | fRow0 = fGeom->GetRow0(plane,iCha-1,0); | |
182 | fRowPadSize = fGeom->GetRowPadSize(plane,iCha-1,0); | |
183 | nPadRows = fGeom->GetRowMax(plane,iCha-1,0); | |
184 | zmin = fRow0 - fRowPadSize/2 + fRowPadSize * nPadRows; | |
185 | ||
186 | fRow0 = fGeom->GetRow0(plane,iCha,0); | |
187 | fRowPadSize = fGeom->GetRowPadSize(plane,iCha,0); | |
188 | zmax = fRow0 - fRowPadSize/2; | |
189 | ||
190 | if((z > zmin) && (z < zmax)) return kTRUE; | |
191 | } | |
192 | ||
193 | return kFALSE; | |
194 | } |