Small change to avoid compiler warnings.
[u/mrichter/AliRoot.git] / TRD / AliTRDv2.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Transition Radiation Detector version 2 -- detailed simulation //
4// //
5//Begin_Html
6/*
7<img src="gif/AliTRDv2Class.gif">
8*/
9//End_Html
10// //
11// //
12///////////////////////////////////////////////////////////////////////////////
13
14#include <TMath.h>
fe4da5cc 15#include <TVector.h>
fe4da5cc 16
fe4da5cc 17#include "AliTRDv2.h"
18#include "AliRun.h"
fe4da5cc 19#include "AliMC.h"
d3f347ff 20#include "AliConst.h"
fe4da5cc 21
22ClassImp(AliTRDv2)
23
24//_____________________________________________________________________________
25AliTRDv2::AliTRDv2(const char *name, const char *title)
26 :AliTRD(name, title)
27{
28 //
29 // Standard constructor for Transition Radiation Detector version 2
30 //
d3f347ff 31 for (Int_t icham = 0; icham < ncham; ++icham) {
32 fIdSensI[icham] = 0;
33 fIdSensN[icham] = 0;
34 fIdSensO[icham] = 0;
35 }
36 fDeltaE = NULL;
37
fe4da5cc 38 SetBufferSize(128000);
39}
d3f347ff 40
41AliTRDv2::~AliTRDv2()
42{
43 if (fDeltaE) delete fDeltaE;
44}
fe4da5cc 45
46//_____________________________________________________________________________
47void AliTRDv2::CreateGeometry()
48{
49 //
50 // Create geometry for the Transition Radiation Detector version 2
51 // This version covers the full azimuth.
d3f347ff 52 // --- Author : Christoph Blume (GSI) 20/5/99
53 //
54 // --- Volume names :
55 // TRD --> Mother TRD volume (Al)
56 // UTRS --> Sectors of the sub-detector (Al)
57 // UTRI --> Inner part of the detector frame (Air)
58 // The chambers
59 // UCI1-6 --> The frame of the inner chambers (C)
60 // UCN1-6 --> The frame of the neighbouring chambers (C)
61 // UCO1-6 --> The frame of the outer chambers (C)
62 // UII1-6 --> The inner part of the inner chambers (Air)
63 // UIN1-6 --> The inner part of the neighbouring chambers (Air)
64 // UIO1-6 --> The inner part of the outer chambers (Air)
65 // The layers inside a chamber
66 // UT0I(N,O) --> Radiator seal (G10)
67 // UT1I(N,O) --> Radiator (CO2)
68 // UT2I(N,O) --> Polyethylene of radiator (PE)
69 // UT3I(N,O) --> Entrance window (Mylar)
70 // UXI(N,O)1-6 --> Gas volume (sensitive) (Xe/Isobutane)
71 // UT5I(N,O) --> Pad plane (Cu)
72 // UT6I(N,O) --> Support structure (G10)
73 // UT7I(N,O) --> FEE + signal lines (Cu)
74 // UT8I(N,O) --> Polyethylene of cooling device (PE)
75 // UT9I(N,O) --> Cooling water (Water)
fe4da5cc 76 //
77 //Begin_Html
78 /*
79 <img src="gif/AliTRDv2.gif">
80 */
81 //End_Html
82 //Begin_Html
83 /*
84 <img src="gif/AliTRDv2Tree.gif">
85 */
86 //End_Html
d3f347ff 87
88 Float_t xpos, ypos, zpos;
89 Int_t idmat[2];
fe4da5cc 90
d3f347ff 91 const Int_t nparmo = 10;
92 const Int_t nparfr = 4;
93 const Int_t nparch = 3;
94 const Int_t nparic = 4;
95 const Int_t nparnc = 4;
96 const Int_t nparoc = 11;
fe4da5cc 97
d3f347ff 98 Float_t par_mo[nparmo];
99 Float_t par_fr[nparfr];
100 Float_t par_ch[nparch];
101 Float_t par_ic[nparic];
102 Float_t par_nc[nparnc];
103 Float_t par_oc[nparoc];
fe4da5cc 104
b060c36f 105 Int_t icham;
106
fe4da5cc 107 Int_t *idtmed = gAlice->Idtmed();
108
d3f347ff 109 AliMC* pMC = AliMC::GetMC();
110
111 //////////////////////////////////////////////////////////////////////////
fe4da5cc 112 // Definition of Volumes
d3f347ff 113 //////////////////////////////////////////////////////////////////////////
fe4da5cc 114
d3f347ff 115 // Definition of the mother volume for the TRD (Al)
116 par_mo[0] = 0.;
fe4da5cc 117 par_mo[1] = 360.;
118 par_mo[2] = nsect;
119 par_mo[3] = 2.;
120 par_mo[4] = -zmax1;
121 par_mo[5] = rmin;
122 par_mo[6] = rmax;
d3f347ff 123 par_mo[7] = zmax1;
fe4da5cc 124 par_mo[8] = rmin;
125 par_mo[9] = rmax;
d3f347ff 126 pMC->Gsvolu("TRD ", "PGON", idtmed[1301-1], par_mo, nparmo);
fe4da5cc 127 pMC->Gsdvn("UTRS", "TRD ", nsect, 2);
d3f347ff 128
129 // The minimal width of a sector in rphi-direction
130 Float_t widmi = rmin * TMath::Sin(kPI/nsect);
131 // The maximal width of a sector in rphi-direction
132 Float_t widma = rmax * TMath::Sin(kPI/nsect);
133 // The total thickness of the spaceframe (Al + Air)
134 Float_t frame = widmi - (widpl1 / 2);
135
136 // Definition of the inner part of the detector frame (Air)
137 par_fr[0] = widmi - alframe / 2.;
138 par_fr[1] = widma - alframe / 2.;
139 par_fr[2] = zmax1;
140 par_fr[3] = (rmax - rmin) / 2;
141 pMC->Gsvolu("UTRI", "TRD1", idtmed[1302-1], par_fr, nparfr);
142
143 // Some parameter for the chambers
144 Float_t lendifc = (zmax1 - zmax2) / nmodul;
145 Float_t heightc = (rmax - rmin ) / nmodul;
146 Float_t widdifc = (widma - widmi) / nmodul;
147
148 // Definition of the chambers
149 Char_t ctagc[5], ctagi[5];
b060c36f 150 for (icham = 1; icham <= ncham; ++icham) {
d3f347ff 151
152 // Carbon frame of the inner chambers (C)
153 par_ch[0] = widmi + (icham-1) * widdifc - frame;
154 par_ch[1] = zleni / 2.;
155 par_ch[2] = heightc / 2.;
fe4da5cc 156 sprintf(ctagc,"UCI%1d",icham);
d3f347ff 157 pMC->Gsvolu(ctagc, "BOX ", idtmed[1307-1], par_ch, nparch);
158 // Inner part of the inner chambers (Air)
fe4da5cc 159 par_ch[0] -= ccframe;
160 par_ch[1] -= ccframe;
d3f347ff 161 sprintf(ctagc,"UII%1d",icham);
162 pMC->Gsvolu(ctagc, "BOX ", idtmed[1302-1], par_ch, nparch);
163
164 // Carbon frame of the neighbouring chambers (C)
165 par_ch[0] = widmi + (icham-1) * widdifc - frame;
166 par_ch[1] = zlenn / 2.;
167 par_ch[2] = heightc / 2.;
168 sprintf(ctagc,"UCN%1d",icham);
169 pMC->Gsvolu(ctagc, "BOX ", idtmed[1307-1], par_ch, nparch);
170 // Inner part of the neighbouring chambers (Air)
171 par_ch[0] -= ccframe;
172 par_ch[1] -= ccframe;
173 sprintf(ctagc,"UIN%1d",icham);
174 pMC->Gsvolu(ctagc, "BOX ", idtmed[1302-1], par_ch, nparch);
175
176 // Carbon frame of the outer chambers (C)
177 par_ch[0] = widmi + (icham-1) * widdifc - frame;
178 par_ch[1] = (icham - 6) * lendifc / 2. + zleno / 2.;
fe4da5cc 179 par_ch[2] = heightc / 2.;
180 sprintf(ctagc,"UCO%1d",icham);
d3f347ff 181 pMC->Gsvolu(ctagc, "BOX ", idtmed[1307-1], par_ch, nparch);
182 // Inner part of the outer chambers (Air)
fe4da5cc 183 par_ch[0] -= ccframe;
184 par_ch[1] -= ccframe;
d3f347ff 185 sprintf(ctagc,"UIO%1d",icham);
186 pMC->Gsvolu(ctagc, "BOX ", idtmed[1302-1], par_ch, nparch);
187
fe4da5cc 188 }
d3f347ff 189
190 // Definition of the layers in each inner chamber
fe4da5cc 191 par_ic[0] = -1.;
192 par_ic[1] = -1.;
d3f347ff 193 // G10 layer (radiator layer)
194 par_ic[2] = sethick / 2;
195 pMC->Gsvolu("UT0I", "BOX ", idtmed[1313-1], par_ic, nparic);
196 // CO2 layer (radiator)
197 par_ic[2] = rathick / 2;
198 pMC->Gsvolu("UT1I", "BOX ", idtmed[1312-1], par_ic, nparic);
199 // PE layer (radiator)
200 par_ic[2] = pethick / 2;
201 pMC->Gsvolu("UT2I", "BOX ", idtmed[1303-1], par_ic, nparic);
202 // Mylar layer (entrance window + HV cathode)
203 par_ic[2] = mythick / 2;
204 pMC->Gsvolu("UT3I", "BOX ", idtmed[1308-1], par_ic, nparic);
205 // Xe/Isobutane layer (gasvolume)
206 par_ic[2] = xethick / 2.;
b060c36f 207 for (icham = 1; icham <= 6; ++icham) {
d3f347ff 208 sprintf(ctagc,"UXI%1d",icham);
209 pMC->Gsvolu(ctagc, "BOX ", idtmed[1309-1], par_ic, nparic);
fe4da5cc 210 }
d3f347ff 211 // Cu layer (pad plane)
212 par_ic[2] = cuthick / 2;
213 pMC->Gsvolu("UT5I", "BOX ", idtmed[1305-1], par_ic, nparic);
214 // G10 layer (support structure)
215 par_ic[2] = suthick / 2;
216 pMC->Gsvolu("UT6I", "BOX ", idtmed[1313-1], par_ic, nparic);
217 // Cu layer (FEE + signal lines)
218 par_ic[2] = fethick / 2;
219 pMC->Gsvolu("UT7I", "BOX ", idtmed[1305-1], par_ic, nparic);
220 // PE layer (cooling devices)
221 par_ic[2] = cothick / 2;
222 pMC->Gsvolu("UT8I", "BOX ", idtmed[1303-1], par_ic, nparic);
223 // Water layer (cooling)
224 par_ic[2] = wathick / 2;
225 pMC->Gsvolu("UT9I", "BOX ", idtmed[1314-1], par_ic, nparic);
226
227 // Definition of the layers in each neighbouring chamber
228 par_nc[0] = -1.;
229 par_nc[1] = -1.;
230 // G10 layer (radiator layer)
231 par_nc[2] = sethick / 2;
232 pMC->Gsvolu("UT0N", "BOX ", idtmed[1313-1], par_nc, nparnc);
233 // CO2 layer (radiator)
234 par_nc[2] = rathick / 2;
235 pMC->Gsvolu("UT1N", "BOX ", idtmed[1312-1], par_nc, nparnc);
236 // PE layer (radiator)
237 par_nc[2] = pethick / 2;
238 pMC->Gsvolu("UT2N", "BOX ", idtmed[1303-1], par_nc, nparnc);
239 // Mylar layer (entrance window + HV cathode)
240 par_nc[2] = mythick / 2;
241 pMC->Gsvolu("UT3N", "BOX ", idtmed[1308-1], par_nc, nparnc);
242 // Xe/Isobutane layer (gasvolume)
243 par_nc[2] = xethick / 2.;
b060c36f 244 for (icham = 1; icham <= 6; ++icham) {
d3f347ff 245 sprintf(ctagc,"UXN%1d",icham);
246 pMC->Gsvolu(ctagc, "BOX ", idtmed[1309-1], par_nc, nparnc);
247 }
248 // Cu layer (pad plane)
249 par_nc[2] = cuthick / 2;
250 pMC->Gsvolu("UT5N", "BOX ", idtmed[1305-1], par_nc, nparnc);
251 // G10 layer (support structure)
252 par_nc[2] = suthick / 2;
253 pMC->Gsvolu("UT6N", "BOX ", idtmed[1313-1], par_nc, nparnc);
254 // Cu layer (FEE + signal lines)
255 par_nc[2] = fethick / 2;
256 pMC->Gsvolu("UT7N", "BOX ", idtmed[1305-1], par_nc, nparnc);
257 // PE layer (cooling devices)
258 par_nc[2] = cothick / 2;
259 pMC->Gsvolu("UT8N", "BOX ", idtmed[1303-1], par_nc, nparnc);
260 // Water layer (cooling)
261 par_nc[2] = wathick / 2;
262 pMC->Gsvolu("UT9N", "BOX ", idtmed[1314-1], par_nc, nparnc);
263
264 // Definition of the layers in each outer chamber
fe4da5cc 265 par_oc[0] = -1.;
266 par_oc[1] = -1.;
d3f347ff 267 // G10 layer (radiator layer)
268 par_oc[2] = sethick / 2;
269 pMC->Gsvolu("UT0O", "BOX ", idtmed[1313-1], par_oc, nparoc);
270 // CO2 layer (radiator)
271 par_oc[2] = rathick / 2;
272 pMC->Gsvolu("UT1O", "BOX ", idtmed[1312-1], par_oc, nparoc);
273 // PE layer (radiator)
274 par_oc[2] = pethick / 2;
275 pMC->Gsvolu("UT2O", "BOX ", idtmed[1303-1], par_oc, nparoc);
276 // Mylar layer (entrance window + HV cathode)
277 par_oc[2] = mythick / 2;
278 pMC->Gsvolu("UT3O", "BOX ", idtmed[1308-1], par_oc, nparoc);
279 // Xe/Isobutane layer (gasvolume)
280 par_oc[2] = xethick / 2.;
b060c36f 281 for (icham = 1; icham <= 6; ++icham) {
d3f347ff 282 sprintf(ctagc,"UXO%1d",icham);
283 pMC->Gsvolu(ctagc, "BOX ", idtmed[1309-1], par_oc, nparoc);
fe4da5cc 284 }
d3f347ff 285 // Cu layer (pad plane)
286 par_oc[2] = cuthick / 2;
287 pMC->Gsvolu("UT5O", "BOX ", idtmed[1305-1], par_oc, nparoc);
288 // G10 layer (support structure)
289 par_oc[2] = suthick / 2;
290 pMC->Gsvolu("UT6O", "BOX ", idtmed[1313-1], par_oc, nparoc);
291 // Cu layer (FEE + signal lines)
292 par_oc[2] = fethick / 2;
293 pMC->Gsvolu("UT7O", "BOX ", idtmed[1305-1], par_oc, nparoc);
294 // PE layer (cooling devices)
295 par_oc[2] = cothick / 2;
296 pMC->Gsvolu("UT8O", "BOX ", idtmed[1303-1], par_oc, nparoc);
297 // Water layer (cooling)
298 par_oc[2] = wathick / 2;
299 pMC->Gsvolu("UT9O", "BOX ", idtmed[1314-1], par_oc, nparoc);
300
301 //////////////////////////////////////////////////////////////////////////
302 // Positioning of Volumes
303 //////////////////////////////////////////////////////////////////////////
304
305 // The rotation matrices
306 AliMatrix(idmat[0], 90., 90., 180., 0., 90., 0.);
307 AliMatrix(idmat[1], 90., 90., 0., 0., 90., 0.);
308
309 // Position of the layers in a chamber
310 pMC->Gspos("UT2I", 1, "UT1I", 0., 0., pezpos, 0, "ONLY");
311 pMC->Gspos("UT2N", 1, "UT1N", 0., 0., pezpos, 0, "ONLY");
312 pMC->Gspos("UT2O", 1, "UT1O", 0., 0., pezpos, 0, "ONLY");
b060c36f 313 for (icham = 1; icham <= ncham; ++icham) {
d3f347ff 314 // The inner chambers
fe4da5cc 315 sprintf(ctagi,"UII%1d",icham);
d3f347ff 316 sprintf(ctagc,"UXI%1d",icham);
317 pMC->Gspos("UT9I", icham, ctagi, 0., 0., wazpos, 0, "ONLY");
318 pMC->Gspos("UT8I", icham, ctagi, 0., 0., cozpos, 0, "ONLY");
319 pMC->Gspos("UT7I", icham, ctagi, 0., 0., fezpos, 0, "ONLY");
320 pMC->Gspos("UT6I", icham, ctagi, 0., 0., suzpos, 0, "ONLY");
fe4da5cc 321 pMC->Gspos("UT5I", icham, ctagi, 0., 0., cuzpos, 0, "ONLY");
d3f347ff 322 pMC->Gspos(ctagc , 1, ctagi, 0., 0., xezpos, 0, "ONLY");
fe4da5cc 323 pMC->Gspos("UT3I", icham, ctagi, 0., 0., myzpos, 0, "ONLY");
324 pMC->Gspos("UT1I", icham, ctagi, 0., 0., razpos, 0, "ONLY");
d3f347ff 325 pMC->Gspos("UT0I", icham, ctagi, 0., 0., sezpos, 0, "ONLY");
326 // The neighbouring chambers
327 sprintf(ctagi,"UIN%1d",icham);
328 sprintf(ctagc,"UXN%1d",icham);
329 pMC->Gspos("UT9N", icham, ctagi, 0., 0., wazpos, 0, "ONLY");
330 pMC->Gspos("UT8N", icham, ctagi, 0., 0., cozpos, 0, "ONLY");
331 pMC->Gspos("UT7N", icham, ctagi, 0., 0., fezpos, 0, "ONLY");
332 pMC->Gspos("UT6N", icham, ctagi, 0., 0., suzpos, 0, "ONLY");
333 pMC->Gspos("UT5N", icham, ctagi, 0., 0., cuzpos, 0, "ONLY");
334 pMC->Gspos(ctagc , 1, ctagi, 0., 0., xezpos, 0, "ONLY");
335 pMC->Gspos("UT3N", icham, ctagi, 0., 0., myzpos, 0, "ONLY");
336 pMC->Gspos("UT1N", icham, ctagi, 0., 0., razpos, 0, "ONLY");
337 pMC->Gspos("UT0N", icham, ctagi, 0., 0., sezpos, 0, "ONLY");
338 // The outer chambers
339 sprintf(ctagi,"UIO%1d",icham);
340 sprintf(ctagc,"UXO%1d",icham);
341 pMC->Gspos("UT9O", icham, ctagi, 0., 0., wazpos, 0, "ONLY");
342 pMC->Gspos("UT8O", icham, ctagi, 0., 0., cozpos, 0, "ONLY");
343 pMC->Gspos("UT7O", icham, ctagi, 0., 0., fezpos, 0, "ONLY");
344 pMC->Gspos("UT6O", icham, ctagi, 0., 0., suzpos, 0, "ONLY");
fe4da5cc 345 pMC->Gspos("UT5O", icham, ctagi, 0., 0., cuzpos, 0, "ONLY");
d3f347ff 346 pMC->Gspos(ctagc , 1, ctagi, 0., 0., xezpos, 0, "ONLY");
fe4da5cc 347 pMC->Gspos("UT3O", icham, ctagi, 0., 0., myzpos, 0, "ONLY");
348 pMC->Gspos("UT1O", icham, ctagi, 0., 0., razpos, 0, "ONLY");
d3f347ff 349 pMC->Gspos("UT0O", icham, ctagi, 0., 0., sezpos, 0, "ONLY");
fe4da5cc 350 }
d3f347ff 351
352 // Position of the inner part of the chambers in the carbon-frames
b060c36f 353 for (icham = 1; icham <= ncham; ++icham) {
d3f347ff 354 xpos = 0.;
355 ypos = 0.;
356 zpos = 0.;
357 // The inner chambers
fe4da5cc 358 sprintf(ctagi,"UII%1d",icham);
359 sprintf(ctagc,"UCI%1d",icham);
d3f347ff 360 pMC->Gspos(ctagi, 1, ctagc, xpos, ypos, zpos, 0, "ONLY");
361 // The neighbouring chambers
362 sprintf(ctagi,"UIN%1d",icham);
363 sprintf(ctagc,"UCN%1d",icham);
364 pMC->Gspos(ctagi, 1, ctagc, xpos, ypos, zpos, 0, "ONLY");
365 // The outer chambers
fe4da5cc 366 sprintf(ctagi,"UIO%1d",icham);
367 sprintf(ctagc,"UCO%1d",icham);
d3f347ff 368 pMC->Gspos(ctagi, 1, ctagc, xpos, ypos, zpos, 0, "ONLY");
fe4da5cc 369 }
d3f347ff 370
371 // Position of the chambers in the full TRD-setup
b060c36f 372 for (icham = 1; icham <= ncham; ++icham) {
d3f347ff 373 // The inner chambers
fe4da5cc 374 xpos = 0.;
375 ypos = 0.;
d3f347ff 376 zpos = (icham-0.5) * heightc - (rmax - rmin) / 2;
fe4da5cc 377 sprintf(ctagc,"UCI%1d",icham);
d3f347ff 378 pMC->Gspos(ctagc, 1, "UTRI", xpos, ypos, zpos, 0, "ONLY");
379 // The neighbouring chambers
fe4da5cc 380 xpos = 0.;
d3f347ff 381 ypos = (zleni + zlenn) / 2.;
382 zpos = (icham-0.5) * heightc - (rmax - rmin) / 2;
383 sprintf(ctagc,"UCN%1d",icham);
384 pMC->Gspos(ctagc, 1, "UTRI", xpos, ypos, zpos, 0, "ONLY");
385 ypos = -ypos;
386 sprintf(ctagc,"UCN%1d",icham);
387 pMC->Gspos(ctagc, 2, "UTRI", xpos, ypos, zpos, 0, "ONLY");
388 // The outer chambers
389 xpos = 0.;
390 ypos = (zleni / 2. + zlenn + zmax2 + (icham-1) * lendifc) / 2.;
391 zpos = (icham-0.5) * heightc - (rmax-rmin)/2;
392 sprintf(ctagc,"UCO%1d",icham);
393 pMC->Gspos(ctagc, 1, "UTRI", xpos, ypos, zpos, 0, "ONLY");
394 ypos = -ypos;
fe4da5cc 395 sprintf(ctagc,"UCO%1d",icham);
d3f347ff 396 pMC->Gspos(ctagc, 2, "UTRI", xpos, ypos, zpos, 0, "ONLY");
fe4da5cc 397 }
d3f347ff 398
399 // Position of the inner part of the detector frame
400 xpos = (rmax + rmin) / 2;
401 ypos = 0.;
fe4da5cc 402 zpos = 0.;
d3f347ff 403 pMC->Gspos("UTRI", 1, "UTRS", xpos, ypos, zpos, idmat[0], "ONLY");
404
405 // Position of the TRD mother volume in the ALICE experiment
406 xpos = 0.;
fe4da5cc 407 ypos = 0.;
d3f347ff 408 zpos = 0.;
409 pMC->Gspos("TRD ", 1, "ALIC", xpos, ypos, zpos, 0, "ONLY");
410
fe4da5cc 411}
412
413//_____________________________________________________________________________
05e51f55 414void AliTRDv2::DrawModule()
fe4da5cc 415{
416 //
417 // Draw a shaded view of the Transition Radiation Detector version 1
418 //
419
420 AliMC* pMC = AliMC::GetMC();
421
422 // Set everything unseen
423 pMC->Gsatt("*", "seen", -1);
d3f347ff 424
fe4da5cc 425 // Set ALIC mother transparent
426 pMC->Gsatt("ALIC","SEEN",0);
d3f347ff 427
fe4da5cc 428 // Set the volumes visible
d3f347ff 429 pMC->Gsatt("TRD ","SEEN",0);
fe4da5cc 430 pMC->Gsatt("UTRS","SEEN",0);
d3f347ff 431 pMC->Gsatt("UTRI","SEEN",0);
432 Char_t ctag[5];
433 for (Int_t icham = 0; icham < ncham; ++icham) {
434 sprintf(ctag,"UCI%1d",icham+1);
435 pMC->Gsatt(ctag,"SEEN",0);
436 sprintf(ctag,"UCN%1d",icham+1);
437 pMC->Gsatt(ctag,"SEEN",0);
438 sprintf(ctag,"UCO%1d",icham+1);
439 pMC->Gsatt(ctag,"SEEN",0);
440 sprintf(ctag,"UII%1d",icham+1);
441 pMC->Gsatt(ctag,"SEEN",0);
442 sprintf(ctag,"UIN%1d",icham+1);
443 pMC->Gsatt(ctag,"SEEN",0);
444 sprintf(ctag,"UIO%1d",icham+1);
445 pMC->Gsatt(ctag,"SEEN",0);
446 sprintf(ctag,"UXI%1d",icham+1);
447 pMC->Gsatt(ctag,"SEEN",1);
448 sprintf(ctag,"UXN%1d",icham+1);
449 pMC->Gsatt(ctag,"SEEN",1);
450 sprintf(ctag,"UXO%1d",icham+1);
451 pMC->Gsatt(ctag,"SEEN",1);
452 }
fe4da5cc 453 pMC->Gsatt("UT1I","SEEN",1);
d3f347ff 454 pMC->Gsatt("UT1N","SEEN",1);
fe4da5cc 455 pMC->Gsatt("UT1O","SEEN",1);
d3f347ff 456
fe4da5cc 457 pMC->Gdopt("hide", "on");
458 pMC->Gdopt("shad", "on");
459 pMC->Gsatt("*", "fill", 7);
460 pMC->SetClipBox(".");
461 pMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
462 pMC->DefaultRange();
463 pMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
464 pMC->Gdhead(1111, "Transition Radiation Detector Version 2");
465 pMC->Gdman(18, 4, "MAN");
466 pMC->Gdopt("hide", "off");
467}
468
469//_____________________________________________________________________________
470void AliTRDv2::CreateMaterials()
471{
472 //
473 // Create materials for the Transition Radiation Detector version 2
474 //
fe4da5cc 475 AliTRD::CreateMaterials();
476}
477
478//_____________________________________________________________________________
479void AliTRDv2::Init()
480{
481 //
482 // Initialise Transition Radiation Detector after geometry has been built
483 //
d3f347ff 484
485 // First ionization potential (eV) for the gas mixture (90% Xe + 10% CO2)
486 const Float_t kPoti = 12.1;
487 // Maximum energy (50 keV);
488 const Float_t kEend = 50000.0;
489
fe4da5cc 490 AliTRD::Init();
d3f347ff 491
fe4da5cc 492 AliMC* pMC = AliMC::GetMC();
d3f347ff 493
494 // Get the sensitive volumes
495 Char_t ctag[5];
496 for (Int_t icham = 0; icham < ncham; ++icham) {
497 sprintf(ctag,"UXI%1d",icham+1);
498 fIdSensI[icham] = pMC->VolId(ctag);
499 sprintf(ctag,"UXN%1d",icham+1);
500 fIdSensN[icham] = pMC->VolId(ctag);
501 sprintf(ctag,"UXO%1d",icham+1);
502 fIdSensO[icham] = pMC->VolId(ctag);
503 }
504
505 Float_t Poti = TMath::Log(kPoti);
506 Float_t Eend = TMath::Log(kEend);
507
508 // Ermilova distribution for the delta-ray spectrum
509 fDeltaE = new TF1("deltae",Ermilova,Poti,Eend,0);
510
fe4da5cc 511}
512
513//_____________________________________________________________________________
514void AliTRDv2::StepManager()
515{
516 //
517 // Called at every step in the Transition Radiation Detector version 2
518 //
d3f347ff 519
520 Int_t idSens, icSens, id;
fe4da5cc 521 Int_t iPla, iCha, iSec;
522 Int_t iOut;
523 Int_t vol[3];
524 Int_t iPid;
d3f347ff 525
526 const Double_t kBig = 1.0E+12;
527
528 Float_t hits[4];
529 Float_t mom[4];
fe4da5cc 530 Float_t random[1];
531 Float_t charge;
fe4da5cc 532 Float_t aMass;
d3f347ff 533
534 Double_t pTot;
535 Double_t qTot;
536 Double_t eDelta;
537 Double_t betaGamma, pp;
538
fe4da5cc 539 TClonesArray &lhits = *fHits;
d3f347ff 540
fe4da5cc 541 AliMC* pMC = AliMC::GetMC();
d3f347ff 542
fe4da5cc 543 // Ionization energy
d3f347ff 544 const Float_t kWion = 22.04;
fe4da5cc 545 // Maximum energy for e+ e- g for the step-size calculation
d3f347ff 546 const Float_t kPTotMax = 0.002;
fe4da5cc 547 // Plateau value of the energy-loss for electron in xenon
548 // taken from: Allison + Comb, Ann. Rev. Nucl. Sci. (1980), 30, 253
d3f347ff 549 //const Double_t kPlateau = 1.70;
550 // the averaged value (26/3/99)
551 const Float_t kPlateau = 1.55;
fe4da5cc 552 // dN1/dx|min for the gas mixture (90% Xe + 10% CO2)
d3f347ff 553 const Float_t kPrim = 48.0;
554 // First ionization potential (eV) for the gas mixture (90% Xe + 10% CO2)
555 const Float_t kPoti = 12.1;
556
fe4da5cc 557 // Set the maximum step size to a very large number for all
558 // neutral particles and those outside the driftvolume
559 pMC->SetMaxStep(kBig);
d3f347ff 560
fe4da5cc 561 // Use only charged tracks
562 if (( pMC->TrackCharge() ) &&
563 (!pMC->TrackStop() ) &&
564 (!pMC->TrackDisappear())) {
d3f347ff 565
fe4da5cc 566 // Find the sensitive volume
567 idSens = pMC->CurrentVol(0,icSens);
568 iPla = 0;
569 iOut = 0;
d3f347ff 570 for (Int_t icham = 0; icham < ncham; ++icham) {
571 if (idSens == fIdSensI[icham]) {
572 iOut = 0;
573 iPla = icham + 1;
574 }
575 if (idSens == fIdSensN[icham]) {
576 iOut = 1;
577 iPla = icham + 1;
578 }
579 if (idSens == fIdSensO[icham]) {
580 iOut = 2;
581 iPla = icham + 1;
582 }
583 }
584
fe4da5cc 585 // Inside a sensitive volume?
586 if (iPla) {
d3f347ff 587
588 // Calculate the energy of the delta-electrons
589 eDelta = TMath::Exp(fDeltaE->GetRandom()) - kPoti;
590 eDelta = TMath::Max(eDelta,0.0);
591
592 // The number of secondary electrons created
593 qTot = (Double_t) ((Int_t) (eDelta / kWion) + 1);
594
fe4da5cc 595 // The sector number
d3f347ff 596 id = pMC->CurrentVolOff(4,0,iSec);
597
fe4da5cc 598 // The chamber number
d3f347ff 599 // 1: outer left
600 // 2: neighbouring left
601 // 3: inner
602 // 4: neighbouring right
603 // 5: outer right
604 id = pMC->CurrentVolOff(2,0,iCha);
605 if (iCha == 1)
606 iCha = 3 + iOut;
607 else
608 iCha = 3 - iOut;
609
fe4da5cc 610 vol[0] = iSec;
611 vol[1] = iCha;
612 vol[2] = iPla;
613
d3f347ff 614 // Check on selected volumes
615 Int_t addthishit = 1;
616 if (fSensSelect) {
617 if ((fSensPlane) && (vol[2] != fSensPlane )) addthishit = 0;
618 if ((fSensChamber) && (vol[1] != fSensChamber)) addthishit = 0;
619 if ((fSensSector) && (vol[0] != fSensSector )) addthishit = 0;
620 }
621
622 if (addthishit) {
623
624 // Add this hit
625 pMC->TrackPosition(hits);
626 hits[3] = qTot;
627 new(lhits[fNhits++]) AliTRDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
628
629 // The energy loss according to Bethe Bloch
630 pMC->TrackMomentum(mom);
631 pTot = mom[3];
632 iPid = pMC->TrackPid();
633 if ( (iPid > 3) ||
634 ((iPid <= 3) && (pTot < kPTotMax))) {
635 aMass = pMC->TrackMass();
636 betaGamma = pTot / aMass;
637 pp = kPrim * BetheBloch(betaGamma);
638 // Take charge > 1 into account
639 charge = pMC->TrackCharge();
640 if (TMath::Abs(charge) > 1) pp = pp * charge*charge;
641 }
642 // Electrons above 20 Mev/c are at the plateau
643 else {
644 pp = kPrim * kPlateau;
645 }
fe4da5cc 646
d3f347ff 647 // Calculate the maximum step size for the next tracking step
648 if (pp > 0) {
649 do
650 pMC->Rndm(random,1);
651 while ((random[0] == 1.) || (random[0] == 0.));
652 pMC->SetMaxStep( - TMath::Log(random[0]) / pp);
653 }
654
fe4da5cc 655 }
fe4da5cc 656 else {
d3f347ff 657 // set step size to maximal value
658 pMC->SetMaxStep(kBig);
fe4da5cc 659 }
d3f347ff 660
fe4da5cc 661 }
d3f347ff 662
663 }
664
665}
666
667//_____________________________________________________________________________
668Double_t AliTRDv2::BetheBloch(Double_t bg)
669{
670 //
671 // Parametrization of the Bethe-Bloch-curve
672 // The parametrization is the same as for the TPC and is taken from Lehrhaus.
673 //
674
675 // The parameters have been adjusted to Xe-data found in:
676 // Allison & Cobb, Ann. Rev. Nucl. Sci. (1980), 30, 253
677 //const Double_t kP1 = 0.76176E-1;
678 //const Double_t kP2 = 10.632;
679 //const Double_t kP3 = 3.17983E-6;
680 //const Double_t kP4 = 1.8631;
681 //const Double_t kP5 = 1.9479;
682
683 // This parameters have been adjusted to averaged values from GEANT
684 const Double_t kP1 = 7.17960e-02;
685 const Double_t kP2 = 8.54196;
686 const Double_t kP3 = 1.38065e-06;
687 const Double_t kP4 = 5.30972;
688 const Double_t kP5 = 2.83798;
689
690 if (bg > 0) {
691 Double_t yy = bg / TMath::Sqrt(1. + bg*bg);
692 Double_t aa = TMath::Power(yy,kP4);
693 Double_t bb = TMath::Power((1./bg),kP5);
694 bb = TMath::Log(kP3 + bb);
695 return ((kP2 - aa - bb)*kP1 / aa);
fe4da5cc 696 }
d3f347ff 697 else
698 return 0;
699
700}
701
702//_____________________________________________________________________________
6fe53707 703Double_t Ermilova(Double_t *x, Double_t *)
d3f347ff 704{
705 //
706 // Calculates the delta-ray energy distribution according to Ermilova
707 // Logarithmic scale !
708 //
709
710 Double_t energy;
711 Double_t dpos;
712 Double_t dnde;
713
714 Int_t pos1, pos2;
715
716 const Int_t nV = 31;
717
718 Float_t vxe[nV] = { 2.3026, 2.9957, 3.4012, 3.6889, 3.9120
719 , 4.0943, 4.2485, 4.3820, 4.4998, 4.6052
720 , 4.7005, 5.0752, 5.2983, 5.7038, 5.9915
721 , 6.2146, 6.5221, 6.9078, 7.3132, 7.6009
722 , 8.0064, 8.5172, 8.6995, 8.9872, 9.2103
723 , 9.4727, 9.9035,10.3735,10.5966,10.8198
724 ,11.5129 };
725
726 Float_t vye[nV] = { 80.0 , 31.0 , 23.3 , 21.1 , 21.0
727 , 20.9 , 20.8 , 20.0 , 16.0 , 11.0
728 , 8.0 , 6.0 , 5.2 , 4.6 , 4.0
729 , 3.5 , 3.0 , 1.4 , 0.67 , 0.44
730 , 0.3 , 0.18 , 0.12 , 0.08 , 0.056
731 , 0.04 , 0.023, 0.015, 0.011, 0.01
732 , 0.004 };
733
734 energy = x[0];
735
736 // Find the position
737 pos1 = pos2 = 0;
738 dpos = 0;
739 do {
740 dpos = energy - vxe[pos2++];
741 }
742 while (dpos > 0);
743 pos2--;
744 if (pos2 > nV) pos2 = nV;
745 pos1 = pos2 - 1;
746
747 // Differentiate between the sampling points
748 dnde = (vye[pos1] - vye[pos2]) / (vxe[pos2] - vxe[pos1]);
749
750 return dnde;
751
fe4da5cc 752}