fe4da5cc |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // // |
3 | // Time Of Flight // |
4 | // This class contains the functions for version 3 of the Time Of Flight // |
5 | // detector. // |
6 | // // |
7 | //Begin_Html |
8 | /* |
9 | <img src="gif/AliTOFv3Class.gif"> |
10 | */ |
11 | //End_Html |
12 | // // |
13 | /////////////////////////////////////////////////////////////////////////////// |
14 | |
15 | #include "AliTOFv3.h" |
16 | #include <TNode.h> |
17 | #include <TTUBE.h> |
18 | #include "AliRun.h" |
19 | #include "AliMC.h" |
20 | |
21 | ClassImp(AliTOFv3) |
22 | |
23 | //_____________________________________________________________________________ |
24 | AliTOFv3::AliTOFv3() : AliTOF() |
25 | { |
26 | // |
27 | // Default constructor |
28 | // |
29 | } |
30 | |
31 | //_____________________________________________________________________________ |
32 | AliTOFv3::AliTOFv3(const char *name, const char *title) |
33 | : AliTOF(name,title) |
34 | { |
35 | // |
36 | // Standard constructor |
37 | // |
38 | } |
39 | |
40 | //_____________________________________________________________________________ |
41 | void AliTOFv3::CreateGeometry() |
42 | { |
43 | // |
44 | // Create geometry for Time Of Flight version 2 |
45 | // |
46 | //Begin_Html |
47 | /* |
48 | <img src="gif/AliTOFv3.gif"> |
49 | */ |
50 | //End_Html |
51 | // |
52 | |
53 | // |
54 | // Create common geometry between version 2 and 3 |
55 | // |
56 | AliTOF::CreateGeometry(); |
57 | } |
58 | |
59 | //_____________________________________________________________________________ |
60 | void AliTOFv3::TOFpc(Float_t xm, Float_t ym, Float_t zm0, |
61 | Float_t zm1, Float_t zm2) |
62 | { |
63 | // |
64 | // Definition of the Time Of Fligh Parallel Plate Chambers |
65 | // |
66 | |
67 | AliMC* pMC = AliMC::GetMC(); |
68 | |
69 | Int_t inum; |
70 | Float_t xcor, zcor, ytop; |
71 | Int_t inum1; |
72 | Float_t xcor1, xcor2, ycoor; |
73 | Float_t stepx, stepz, dx, dy, dz, xp, yp, zp, shiftx, shiftz, ywidth; |
74 | Float_t shiftx1, shiftx2, xad, zad; |
75 | Int_t ink; |
76 | Float_t par[10]; |
77 | Int_t inz; |
78 | Float_t xzd; |
79 | Int_t nxp, npx, npz; |
80 | Float_t xsz, ysz, zsz; |
81 | Int_t nzp0, nzp1, nzp2; |
82 | |
83 | Int_t *idtmed = gAlice->Idtmed(); |
84 | |
85 | // X size of PPC plate |
86 | xsz = 54.; |
87 | // Y size of PPC plate |
88 | ysz = .2; |
89 | // Z size of PPC plate |
90 | zsz = 48.; |
91 | // First return additional shift along X |
92 | xad = 1.5; |
93 | // Second return additional shift along X |
94 | xzd = .5; |
95 | // Return additional shift along Z |
96 | zad = .25; |
97 | // Width of DME box |
98 | ywidth = 4.; |
99 | // X size of PPC chamber |
100 | xp = 5.7; |
101 | // Y size of PPC chamber |
102 | yp = .32; |
103 | // Z size of PPC chamber |
104 | zp = 5.7; |
105 | // Frame width along X,Y and Z axis of PPC chambers |
106 | dx = .2; |
107 | dy = .1; |
108 | dz = .2; |
109 | // No sensitive volumes with DME |
110 | par[0] = xm / 2.; |
111 | par[1] = ywidth / 2.; |
112 | par[2] = zm0 / 2.; |
113 | ycoor = ym / 3. - ywidth / 2.; |
114 | pMC->Gsvolu("FBT1", "BOX ", idtmed[505], par, 3); |
115 | pMC->Gspos("FBT1", 0, "FTO1", 0., 0., 0., 0, "ONLY"); |
116 | par[2] = zm1 / 2.; |
117 | pMC->Gsvolu("FBT2", "BOX ", idtmed[505], par, 3); |
118 | pMC->Gspos("FBT2", 1, "FTO2", 0., 0., 0., 0, "ONLY"); |
119 | par[2] = zm2 / 2.; |
120 | pMC->Gsvolu("FBT3", "BOX ", idtmed[505], par, 3); |
121 | pMC->Gspos("FBT3", 2, "FTO3", 0., 0., 0., 0, "ONLY"); |
122 | // Electronic plate |
123 | par[1] = ysz / 2.; |
124 | par[2] = zm0 / 2.; |
125 | ycoor = ywidth / 2. - ysz / 2.; |
126 | pMC->Gsvolu("FPE1", "BOX ", idtmed[504], par, 3); |
127 | pMC->Gspos("FPE1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY"); |
128 | pMC->Gspos("FPE1", 1, "FBT1", 0., -ycoor, 0., 0, "ONLY"); |
129 | par[2] = zm1 / 2.; |
130 | pMC->Gsvolu("FPE2", "BOX ", idtmed[504], par, 3); |
131 | pMC->Gspos("FPE2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY"); |
132 | pMC->Gspos("FPE2", 1, "FBT2", 0., -ycoor, 0., 0, "ONLY"); |
133 | par[2] = zm2 / 2.; |
134 | pMC->Gsvolu("FPE3", "BOX ", idtmed[504], par, 3); |
135 | pMC->Gspos("FPE3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY"); |
136 | pMC->Gspos("FPE3", 1, "FBT3", 0., -ycoor, 0., 0, "ONLY"); |
137 | // Electronic insensitive volumes |
138 | par[1] = yp / 2.; |
139 | par[2] = zm0 / 2.; |
140 | ytop = ywidth / 2. - (ysz * 2 + yp) / 2.; |
141 | pMC->Gsvolu("FST1", "BOX ", idtmed[505], par, 3); |
142 | pMC->Gsvolu("FLT1", "BOX ", idtmed[505], par, 3); |
143 | pMC->Gspos("FST1", 0, "FBT1", 0., ytop, 0., 0, "ONLY"); |
144 | pMC->Gspos("FLT1", 0, "FBT1", 0., -ytop, 0., 0, "ONLY"); |
145 | par[2] = zm1 / 2.; |
146 | pMC->Gsvolu("FST2", "BOX ", idtmed[505], par, 3); |
147 | pMC->Gsvolu("FLT2", "BOX ", idtmed[505], par, 3); |
148 | pMC->Gspos("FST2", 0, "FBT2", 0., ytop, 0., 0, "ONLY"); |
149 | pMC->Gspos("FLT2", 0, "FBT2", 0., -ytop, 0., 0, "ONLY"); |
150 | par[2] = zm2 / 2.; |
151 | pMC->Gsvolu("FST3", "BOX ", idtmed[505], par, 3); |
152 | pMC->Gsvolu("FLT3", "BOX ", idtmed[505], par, 3); |
153 | pMC->Gspos("FST3", 0, "FBT3", 0., ytop, 0., 0, "ONLY"); |
154 | pMC->Gspos("FLT3", 0, "FBT3", 0., -ytop, 0., 0, "ONLY"); |
155 | // PPC-plate number along X axis |
156 | nxp = Int_t (xm / xsz); |
157 | // PPC-plate number along Z axis |
158 | nzp0 = Int_t (zm0 / zsz); |
159 | nzp1 = Int_t (zm1 / zsz); |
160 | nzp2 = Int_t (zm2 / zsz); |
161 | // Position of big PPC-plate |
162 | par[0] = xm * .5 / nxp; |
163 | par[2] = zm0 * .5 / nzp0; |
164 | pMC->Gsvolu("FSK1", "BOX ", idtmed[505], par, 3); |
165 | pMC->Gsvolu("FLK1", "BOX ", idtmed[505], par, 3); |
166 | inum = 0; |
167 | for (ink = 1; ink <= nxp; ++ink) { |
168 | xcor = xm * .5 * ((ink * 2 - 1) / (Float_t) nxp - 1.); |
169 | for (inz = 1; inz <= nzp0; ++inz) { |
170 | zcor = zm0 * .5 * ((inz * 2 - 1) / (Float_t) nzp0 - 1.); |
171 | ++inum; |
172 | pMC->Gspos("FSK1", inum, "FST1", xcor, 0., zcor, 0, "ONLY"); |
173 | pMC->Gspos("FLK1", inum, "FLT1", xcor, 0., zcor, 0, "ONLY"); |
174 | } |
175 | for (inz = 1; inz <= nzp1; ++inz) { |
176 | zcor = zm1 * .5 * ((inz * 2 - 1) / (Float_t) nzp1 - 1.); |
177 | ++inum; |
178 | pMC->Gspos("FSK1", inum, "FST2", xcor, 0., zcor, 0, "ONLY"); |
179 | pMC->Gspos("FLK1", inum, "FLT2", xcor, 0., zcor, 0, "ONLY"); |
180 | } |
181 | for (inz = 1; inz <= nzp2; ++inz) { |
182 | zcor = zm2 * .5 * ((inz * 2 - 1) / (Float_t) nzp2 - 1.); |
183 | ++inum; |
184 | pMC->Gspos("FSK1", inum, "FST3", xcor, 0., zcor, 0, "ONLY"); |
185 | pMC->Gspos("FLK1", inum, "FLT3", xcor, 0., zcor, 0, "ONLY"); |
186 | } |
187 | } |
188 | par[0] = xsz / 2.; |
189 | par[1] = yp / 2.; |
190 | par[2] = zsz / 2.; |
191 | pMC->Gsvolu("FSL1", "BOX ", idtmed[505], par, 3); |
192 | pMC->Gsvolu("FLL1", "BOX ", idtmed[505], par, 3); |
193 | shiftx = (xp / 2. + xad / 2.) / 2.; |
194 | shiftz = (zm0 / nzp0 - zsz) / 2.; |
195 | pMC->Gspos("FSL1", 0, "FSK1", -shiftx, 0., -shiftz, 0, "ONLY"); |
196 | pMC->Gspos("FLL1", 0, "FLK1", shiftx, 0., shiftz, 0, "ONLY"); |
197 | // PPC position on PPC-plate |
198 | npx = 4; |
199 | npz = 8; |
200 | par[0] = xp / 2.; |
201 | par[1] = yp / 2.; |
202 | par[2] = zp / 2.; |
203 | stepx = (xad + xzd + xp * 2) / 2.; |
204 | stepz = (zp + zad) / 2.; |
205 | shiftz = npz * (zad + zp) / 2.; |
206 | shiftx = npx * (xp * 2 + xad + xzd) / 2.; |
207 | shiftx1 = (xp * 2 + xzd + xad) / 2. - xp / 2.; |
208 | shiftx2 = (xp * 2 + xzd + xad) / 2. - xp / 2. - xzd; |
209 | pMC->Gsvolu("FPG1", "BOX ", idtmed[507], par, 3); |
210 | for (ink = 1; ink <= npx; ++ink) { |
211 | xcor1 = -shiftx + stepx * (ink * 2 - 1) - shiftx1; |
212 | xcor2 = -shiftx + stepx * (ink * 2 - 1) + shiftx2; |
213 | for (inz = 1; inz <= npz; ++inz) { |
214 | zcor = -shiftz + stepz * (inz * 2 - 1); |
215 | ++inum; |
216 | inum1 = npx * npz + inum; |
217 | pMC->Gspos("FPG1", inum, "FSL1", xcor1, 0., zcor, 0, "ONLY"); |
218 | pMC->Gspos("FPG1", inum1, "FSL1", xcor2, 0., zcor, 0, "ONLY"); |
219 | pMC->Gspos("FPG1", inum, "FLL1", xcor1, 0., zcor, 0, "ONLY"); |
220 | pMC->Gspos("FPG1", inum1, "FLL1", xcor2, 0., zcor, 0, "ONLY"); |
221 | } |
222 | } |
223 | par[0] = xp / 2. - dx; |
224 | par[1] = yp / 2. - dy; |
225 | par[2] = zp / 2. - dz; |
226 | pMC->Gsvolu("FPG2", "BOX ", idtmed[509], par, 3); |
227 | pMC->Gspos("FPG2", 0, "FPG1", 0., 0., 0., 0, "ONLY"); |
228 | } |
229 | |
230 | //_____________________________________________________________________________ |
231 | void AliTOFv3::DrawDetector() |
232 | { |
233 | // |
234 | // Draw a shaded view of the Time Of Flight version 3 |
235 | // |
236 | |
237 | AliMC* pMC = AliMC::GetMC(); |
238 | |
239 | // Set everything unseen |
240 | pMC->Gsatt("*", "seen", -1); |
241 | // |
242 | // Set ALIC mother transparent |
243 | pMC->Gsatt("ALIC","SEEN",0); |
244 | // |
245 | // Set the volumes visible |
246 | pMC->Gsatt("ALIC","SEEN",0); |
247 | pMC->Gsatt("FBAR","SEEN",0); |
248 | pMC->Gsatt("FTO1","SEEN",0); |
249 | pMC->Gsatt("FTO2","SEEN",0); |
250 | pMC->Gsatt("FTO3","SEEN",0); |
251 | pMC->Gsatt("FBT1","SEEN",0); |
252 | pMC->Gsatt("FBT2","SEEN",0); |
253 | pMC->Gsatt("FBT3","SEEN",0); |
254 | pMC->Gsatt("FST1","SEEN",0); |
255 | pMC->Gsatt("FLT1","SEEN",0); |
256 | pMC->Gsatt("FST2","SEEN",0); |
257 | pMC->Gsatt("FLT2","SEEN",0); |
258 | pMC->Gsatt("FST3","SEEN",0); |
259 | pMC->Gsatt("FLT3","SEEN",0); |
260 | pMC->Gsatt("FSK1","SEEN",0); |
261 | pMC->Gsatt("FLK1","SEEN",0); |
262 | pMC->Gsatt("FSL1","SEEN",1); |
263 | pMC->Gsatt("FLL1","SEEN",1); |
264 | // |
265 | pMC->Gdopt("hide", "on"); |
266 | pMC->Gdopt("shad", "on"); |
267 | pMC->Gsatt("*", "fill", 7); |
268 | pMC->SetClipBox("."); |
269 | pMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000); |
270 | pMC->DefaultRange(); |
271 | pMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02); |
272 | pMC->Gdhead(1111, "Time Of Flight"); |
273 | pMC->Gdman(18, 4, "MAN"); |
274 | pMC->Gdopt("hide","off"); |
275 | } |
276 | |
277 | //_____________________________________________________________________________ |
278 | void AliTOFv3::CreateMaterials() |
279 | { |
280 | // |
281 | // Define materials for the Time Of Flight |
282 | // |
283 | AliTOF::CreateMaterials(); |
284 | } |
285 | |
286 | //_____________________________________________________________________________ |
287 | void AliTOFv3::Init() |
288 | { |
289 | // |
290 | // Initialise the detector after the geometry has been defined |
291 | // |
292 | |
293 | AliMC* pMC = AliMC::GetMC(); |
294 | |
295 | AliTOF::Init(); |
296 | fIdFTO2=pMC->VolId("FTO2"); |
297 | fIdFTO3=pMC->VolId("FTO3"); |
298 | fIdFLT1=pMC->VolId("FLT1"); |
299 | fIdFLT2=pMC->VolId("FLT2"); |
300 | fIdFLT3=pMC->VolId("FLT3"); |
301 | } |
302 | |
303 | //_____________________________________________________________________________ |
304 | void AliTOFv3::StepManager() |
305 | { |
306 | // |
307 | // Procedure called at each step in the Time Of Flight |
308 | // |
309 | Float_t hits[8]; |
310 | Int_t vol[3]; |
311 | Int_t copy, id; |
312 | AliMC *pMC= AliMC::GetMC(); |
313 | Int_t *idtmed = gAlice->Idtmed(); |
314 | if(pMC->GetMedium()==idtmed[510-1] && |
315 | pMC->TrackEntering() && pMC->TrackCharge() |
316 | && pMC->CurrentVol(0,copy)==fIdSens) { |
317 | TClonesArray &lhits = *fHits; |
318 | // |
319 | // Record only charged tracks at entrance |
320 | pMC->CurrentVolOff(1,0,copy); |
321 | vol[2]=copy; |
322 | pMC->CurrentVolOff(3,0,copy); |
323 | vol[1]=copy; |
324 | id=pMC->CurrentVolOff(6,0,copy); |
325 | vol[0]=copy; |
326 | if(id==fIdFTO3) { |
327 | vol[0]+=22; |
328 | id=pMC->CurrentVolOff(4,0,copy); |
329 | if(id==fIdFLT3) vol[1]+=6; |
330 | } else if (id==fIdFTO2) { |
331 | vol[0]+=20; |
332 | id=pMC->CurrentVolOff(4,0,copy); |
333 | if(id==fIdFLT2) vol[1]+=8; |
334 | } else { |
335 | id=pMC->CurrentVolOff(4,0,copy); |
336 | if(id==fIdFLT1) vol[1]+=14; |
337 | } |
338 | pMC->TrackPosition(hits); |
339 | pMC->TrackMomentum(&hits[3]); |
340 | hits[7]=pMC->TrackTime(); |
341 | new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits); |
342 | } |
343 | } |