Avoid warnings on SunOS
[u/mrichter/AliRoot.git] / TRD / AliTRDv1.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
d3f347ff 3// Transition Radiation Detector version 1 -- coarse simulation //
4// This version has two detector arms, leaving the space in front of the //
5// HMPID and PHOS empty //
fe4da5cc 6// //
7//Begin_Html
8/*
1439f98e 9<img src="picts/AliTRDv1Class.gif">
fe4da5cc 10*/
11//End_Html
12// //
13// //
14///////////////////////////////////////////////////////////////////////////////
15
16#include <TMath.h>
17#include <TRandom.h>
18#include <TVector.h>
fe4da5cc 19
fe4da5cc 20#include "AliTRDv1.h"
21#include "AliRun.h"
fe4da5cc 22#include "AliMC.h"
d3f347ff 23#include "AliConst.h"
fe4da5cc 24
25ClassImp(AliTRDv1)
26
27//_____________________________________________________________________________
28AliTRDv1::AliTRDv1(const char *name, const char *title)
29 :AliTRD(name, title)
30{
31 //
32 // Standard constructor for the Transition Radiation Detector version 1
33 //
34 fIdSens1 = fIdSens2 = fIdSens3 = 0;
35}
36
37//_____________________________________________________________________________
38void AliTRDv1::CreateGeometry()
39{
40 //
41 // Create the geometry for the Transition Radiation Detector version 1
42 // --- The coarse geometry of the TRD, that can be used for background
43 // studies. This version leaves the space in front of the PHOS and
44 // HMPID empty.
d3f347ff 45 // --- Author : Christoph Blume (GSI) 18/5/99
46 //
47 // --- Volume names :
48 // TRD --> Mother TRD volume (Air)
49 // UTRD --> The detector arms (Al)
50 // UTRS --> Sectors of the sub-detector (Al)
51 // UTRI --> Inner part of the detector frame (Air)
52 // UTCI(N,O) --> Frames of the inner, neighbouring and outer chambers (C)
53 // UTII(N,O) --> Inner part of the chambers (Air)
54 // UTMI(N,O) --> Modules in the chambers (Air)
55 // UT0I(N,O) --> Radiator seal (G10)
56 // UT1I(N,O) --> Radiator (CO2)
57 // UT2I(N,O) --> Polyethylene of radiator (PE)
58 // UT3I(N,O) --> Entrance window (Mylar)
59 // UT4I(N,O) --> Gas volume (sensitive) (Xe/Isobutane)
60 // UT5I(N,O) --> Pad plane (Cu)
61 // UT6I(N,O) --> Support structure (G10)
62 // UT7I(N,O) --> FEE + signal lines (Cu)
63 // UT8I(N,O) --> Polyethylene of cooling device (PE)
64 // UT9I(N,O) --> Cooling water (Water)
fe4da5cc 65 //
66 //Begin_Html
67 /*
1439f98e 68 <img src="picts/AliTRDv1.gif">
fe4da5cc 69 */
70 //End_Html
71 //Begin_Html
72 /*
1439f98e 73 <img src="picts/AliTRDv1Tree.gif">
fe4da5cc 74 */
75 //End_Html
76
77 Float_t xpos, ypos, zpos, f;
d3f347ff 78 Int_t idmat[5];
79
80 const Int_t nparmo = 10;
81 const Int_t nparar = 10;
82 const Int_t nparfr = 4;
83 const Int_t nparic = 4;
84 const Int_t nparnc = 4;
85 const Int_t nparoc = 11;
86
87 Float_t par_mo[nparmo];
88 Float_t par_ar[nparar];
89 Float_t par_fr[nparfr];
90 Float_t par_ic[nparic];
91 Float_t par_nc[nparnc];
92 Float_t par_oc[nparoc];
fe4da5cc 93
ad51aeb0 94 Int_t *idtmed = fIdtmed->GetArray()-1299;
fe4da5cc 95
d3f347ff 96 //////////////////////////////////////////////////////////////////////////
97 // Definition of Volumes
98 //////////////////////////////////////////////////////////////////////////
99
100 // Definition of the mother volume for the TRD (Air)
101 par_mo[0] = 0.;
fe4da5cc 102 par_mo[1] = 360.;
103 par_mo[2] = nsect;
104 par_mo[3] = 2.;
105 par_mo[4] = -zmax1;
106 par_mo[5] = rmin;
107 par_mo[6] = rmax;
d3f347ff 108 par_mo[7] = zmax1;
fe4da5cc 109 par_mo[8] = rmin;
110 par_mo[9] = rmax;
cfce8870 111 gMC->Gsvolu("TRD ", "PGON", idtmed[1302-1], par_mo, nparmo);
d3f347ff 112
113 Float_t phisec = 360. / nsect;
114 // Definition of the two detector arms (Al)
115 par_ar[0] = 120.;
116 par_ar[1] = narmsec * phisec;
117 par_ar[2] = narmsec;
118 par_ar[3] = 2.;
119 par_ar[4] = -zmax1;
120 par_ar[5] = rmin;
121 par_ar[6] = rmax;
122 par_ar[7] = zmax1;
123 par_ar[8] = rmin;
124 par_ar[9] = rmax;
cfce8870 125 gMC->Gsvolu("UTRD", "PGON", idtmed[1301-1], par_ar, nparar);
126 gMC->Gsdvn("UTRS", "UTRD", narmsec, 2);
d3f347ff 127
128 // The minimal width of a sector in rphi-direction
c2ba0804 129 Float_t widmi = rmin * TMath::Tan(kPI/nsect);
d3f347ff 130 // The maximal width of a sector in rphi-direction
c2ba0804 131 Float_t widma = rmax * TMath::Tan(kPI/nsect);
d3f347ff 132 // The total thickness of the spaceframe (Al + Air)
133 Float_t frame = widmi - (widpl1 / 2);
134
135 // Definition of the inner part of the detector frame (Air)
136 par_fr[0] = widmi - alframe / 2;
137 par_fr[1] = widma - alframe / 2;
138 par_fr[2] = zmax1;
139 par_fr[3] = (rmax - rmin) / 2;
cfce8870 140 gMC->Gsvolu("UTRI", "TRD1", idtmed[1302-1], par_fr, nparfr);
d3f347ff 141
142 //
143 // The outer chambers
144 //
145
146 // Calculate some shape-parameter
147 Float_t tanzr = (zmax1 - zmax2) / (rmax - rmin);
148 Float_t theoc = -kRaddeg * TMath::ATan(tanzr / 2);
149
150 // The carbon frame (C)
151 par_oc[0] = (rmax - rmin) / 2;
152 par_oc[1] = theoc;
153 par_oc[2] = 90.;
154 par_oc[3] = (zmax2 - zlenn - zleni/2) / 2;
155 par_oc[4] = widmi - frame;
156 par_oc[5] = widmi - frame;
157 par_oc[6] = 0.;
158 par_oc[7] = (zmax1 - zlenn - zleni/2) / 2;
159 par_oc[8] = widma - frame;
160 par_oc[9] = widma - frame;
fe4da5cc 161 par_oc[10] = 0.;
cfce8870 162 gMC->Gsvolu("UTCO", "TRAP", idtmed[1307-1], par_oc, nparoc);
d3f347ff 163
164 // The inner part (Air)
fe4da5cc 165 par_oc[3] -= ccframe;
166 par_oc[4] -= ccframe;
d3f347ff 167 par_oc[5] -= ccframe;
fe4da5cc 168 par_oc[7] -= ccframe;
169 par_oc[8] -= ccframe;
170 par_oc[9] -= ccframe;
cfce8870 171 gMC->Gsvolu("UTIO", "TRAP", idtmed[1302-1], par_oc, nparoc);
d3f347ff 172
173 // Definition of the six modules within each chamber
cfce8870 174 gMC->Gsdvn("UTMO", "UTIO", nmodul, 3);
d3f347ff 175
176 // Definition of the layers of each chamber
177 par_oc[1] = theoc;
178 par_oc[2] = 90.;
179 par_oc[3] = -1.;
180 par_oc[4] = -1.;
181 par_oc[5] = -1.;
182 par_oc[6] = 0.;
183 par_oc[7] = -1.;
184 par_oc[8] = -1.;
185 par_oc[9] = -1.;
186 par_oc[10] = 0.;
187 // G10 layer (radiator layer)
188 par_oc[0] = sethick / 2;
cfce8870 189 gMC->Gsvolu("UT0O", "TRAP", idtmed[1313-1], par_oc, nparoc);
d3f347ff 190 // CO2 layer (radiator)
191 par_oc[0] = rathick / 2;
cfce8870 192 gMC->Gsvolu("UT1O", "TRAP", idtmed[1312-1], par_oc, nparoc);
d3f347ff 193 // PE layer (radiator)
194 par_oc[0] = pethick / 2;
cfce8870 195 gMC->Gsvolu("UT2O", "TRAP", idtmed[1303-1], par_oc, nparoc);
d3f347ff 196 // Mylar layer (entrance window + HV cathode)
197 par_oc[0] = mythick / 2;
cfce8870 198 gMC->Gsvolu("UT3O", "TRAP", idtmed[1308-1], par_oc, nparoc);
d3f347ff 199 // Xe/Isobutane layer (gasvolume)
200 par_oc[0] = xethick / 2;
cfce8870 201 gMC->Gsvolu("UT4O", "TRAP", idtmed[1309-1], par_oc, nparoc);
d3f347ff 202 // Cu layer (pad plane)
203 par_oc[0] = cuthick / 2;
cfce8870 204 gMC->Gsvolu("UT5O", "TRAP", idtmed[1305-1], par_oc, nparoc);
d3f347ff 205 // G10 layer (support structure)
206 par_oc[0] = suthick / 2;
cfce8870 207 gMC->Gsvolu("UT6O", "TRAP", idtmed[1313-1], par_oc, nparoc);
d3f347ff 208 // Cu layer (FEE + signal lines)
209 par_oc[0] = fethick / 2;
cfce8870 210 gMC->Gsvolu("UT7O", "TRAP", idtmed[1305-1], par_oc, nparoc);
d3f347ff 211 // PE layer (cooling devices)
212 par_oc[0] = cothick / 2;
cfce8870 213 gMC->Gsvolu("UT8O", "TRAP", idtmed[1303-1], par_oc, nparoc);
d3f347ff 214 // Water layer (cooling)
215 par_oc[0] = wathick / 2;
cfce8870 216 gMC->Gsvolu("UT9O", "TRAP", idtmed[1314-1], par_oc, nparoc);
d3f347ff 217
218 //
219 // The neighbouring chambers
220 //
221
222 // The carbon frame (C)
223 par_nc[0] = widmi - frame;
224 par_nc[1] = widma - frame;
225 par_nc[2] = zlenn / 2;
226 par_nc[3] = (rmax - rmin) / 2;
cfce8870 227 gMC->Gsvolu("UTCN", "TRD1", idtmed[1307-1], par_nc, nparnc);
d3f347ff 228
229 // The inner part (Air)
230 par_nc[0] -= ccframe;
231 par_nc[1] -= ccframe;
232 par_nc[2] -= ccframe;
cfce8870 233 gMC->Gsvolu("UTIN", "TRD1", idtmed[1302-1], par_nc, nparnc);
d3f347ff 234
235 // Definition of the six modules within each outer chamber
cfce8870 236 gMC->Gsdvn("UTMN", "UTIN", nmodul, 3);
d3f347ff 237
238 // Definition of the layers of each chamber
239 par_nc[0] = -1.;
240 par_nc[1] = -1.;
241 par_nc[2] = -1.;
242 // G10 layer (radiator layer)
243 par_nc[3] = sethick / 2;
cfce8870 244 gMC->Gsvolu("UT0N", "TRD1", idtmed[1313-1], par_nc, nparnc);
d3f347ff 245 // CO2 layer (radiator)
246 par_nc[3] = rathick / 2;
cfce8870 247 gMC->Gsvolu("UT1N", "TRD1", idtmed[1312-1], par_nc, nparnc);
d3f347ff 248 // PE layer (radiator)
249 par_nc[3] = pethick / 2;
cfce8870 250 gMC->Gsvolu("UT2N", "TRD1", idtmed[1303-1], par_nc, nparnc);
d3f347ff 251 // Mylar layer (entrance window + HV cathode)
252 par_nc[3] = mythick / 2;
cfce8870 253 gMC->Gsvolu("UT3N", "TRD1", idtmed[1308-1], par_nc, nparnc);
d3f347ff 254 // Xe/Isobutane layer (gasvolume)
255 par_nc[3] = xethick / 2;
cfce8870 256 gMC->Gsvolu("UT4N", "TRD1", idtmed[1309-1], par_nc, nparnc);
d3f347ff 257 // Cu layer (pad plane)
258 par_nc[3] = cuthick / 2;
cfce8870 259 gMC->Gsvolu("UT5N", "TRD1", idtmed[1305-1], par_nc, nparnc);
d3f347ff 260 // G10 layer (support structure)
261 par_nc[3] = suthick / 2;
cfce8870 262 gMC->Gsvolu("UT6N", "TRD1", idtmed[1313-1], par_nc, nparnc);
d3f347ff 263 // Cu layer (FEE + signal lines)
264 par_nc[3] = fethick / 2;
cfce8870 265 gMC->Gsvolu("UT7N", "TRD1", idtmed[1305-1], par_nc, nparnc);
d3f347ff 266 // PE layer (cooling devices)
267 par_nc[3] = cothick / 2;
cfce8870 268 gMC->Gsvolu("UT8N", "TRD1", idtmed[1303-1], par_nc, nparnc);
d3f347ff 269 // Water layer (cooling)
270 par_nc[3] = wathick / 2;
cfce8870 271 gMC->Gsvolu("UT9N", "TRD1", idtmed[1314-1], par_nc, nparnc);
d3f347ff 272
273 //
274 // The inner chamber
275 //
276
277 // The carbon frame (C)
278 par_ic[0] = widmi - frame;
279 par_ic[1] = widma - frame;
280 par_ic[2] = zleni / 2;
281 par_ic[3] = (rmax - rmin) / 2;
cfce8870 282 gMC->Gsvolu("UTCI", "TRD1", idtmed[1307-1], par_ic, nparic);
d3f347ff 283
284 // The inner part (Air)
fe4da5cc 285 par_ic[0] -= ccframe;
286 par_ic[1] -= ccframe;
287 par_ic[2] -= ccframe;
cfce8870 288 gMC->Gsvolu("UTII", "TRD1", idtmed[1302-1], par_ic, nparic);
d3f347ff 289
290 // Definition of the six modules within each outer chamber
cfce8870 291 gMC->Gsdvn("UTMI", "UTII", nmodul, 3);
d3f347ff 292
293 // Definition of the layers of each inner chamber
fe4da5cc 294 par_ic[0] = -1.;
295 par_ic[1] = -1.;
296 par_ic[2] = -1.;
d3f347ff 297 // G10 layer (radiator layer)
298 par_ic[3] = sethick / 2;
cfce8870 299 gMC->Gsvolu("UT0I", "TRD1", idtmed[1313-1], par_ic, nparic);
d3f347ff 300 // CO2 layer (radiator)
301 par_ic[3] = rathick / 2;
cfce8870 302 gMC->Gsvolu("UT1I", "TRD1", idtmed[1312-1], par_ic, nparic);
d3f347ff 303 // PE layer (radiator)
304 par_ic[3] = pethick / 2;
cfce8870 305 gMC->Gsvolu("UT2I", "TRD1", idtmed[1303-1], par_ic, nparic);
d3f347ff 306 // Mylar layer (entrance window + HV cathode)
307 par_ic[3] = mythick / 2;
cfce8870 308 gMC->Gsvolu("UT3I", "TRD1", idtmed[1308-1], par_ic, nparic);
d3f347ff 309 // Xe/Isobutane layer (gasvolume)
310 par_ic[3] = xethick / 2;
cfce8870 311 gMC->Gsvolu("UT4I", "TRD1", idtmed[1309-1], par_ic, nparic);
d3f347ff 312 // Cu layer (pad plane)
313 par_ic[3] = cuthick / 2;
cfce8870 314 gMC->Gsvolu("UT5I", "TRD1", idtmed[1305-1], par_ic, nparic);
d3f347ff 315 // G10 layer (support structure)
316 par_ic[3] = suthick / 2;
cfce8870 317 gMC->Gsvolu("UT6I", "TRD1", idtmed[1313-1], par_ic, nparic);
d3f347ff 318 // Cu layer (FEE + signal lines)
319 par_ic[3] = fethick / 2;
cfce8870 320 gMC->Gsvolu("UT7I", "TRD1", idtmed[1305-1], par_ic, nparic);
d3f347ff 321 // PE layer (cooling devices)
322 par_ic[3] = cothick / 2;
cfce8870 323 gMC->Gsvolu("UT8I", "TRD1", idtmed[1303-1], par_ic, nparic);
d3f347ff 324 // Water layer (cooling)
325 par_ic[3] = wathick / 2;
cfce8870 326 gMC->Gsvolu("UT9I", "TRD1", idtmed[1314-1], par_ic, nparic);
d3f347ff 327
328 //////////////////////////////////////////////////////////////////////////
fe4da5cc 329 // Positioning of Volumes
d3f347ff 330 //////////////////////////////////////////////////////////////////////////
331
332 // The rotation matrices
333 AliMatrix(idmat[0], 90., 180., 90., 90., 0., 0.);
334 AliMatrix(idmat[1], 90., 90., 180., 0., 90., 0.);
335 AliMatrix(idmat[2], 90., 180., 90., 270., 0., 0.);
336
337 // Position of the layers in a TRD module
fe4da5cc 338 f = TMath::Tan(theoc * kDegrad);
cfce8870 339 gMC->Gspos("UT9O", 1, "UTMO", 0., f*wazpos, wazpos, 0, "ONLY");
340 gMC->Gspos("UT8O", 1, "UTMO", 0., f*cozpos, cozpos, 0, "ONLY");
341 gMC->Gspos("UT7O", 1, "UTMO", 0., f*fezpos, fezpos, 0, "ONLY");
342 gMC->Gspos("UT6O", 1, "UTMO", 0., f*suzpos, suzpos, 0, "ONLY");
343 gMC->Gspos("UT5O", 1, "UTMO", 0., f*cuzpos, cuzpos, 0, "ONLY");
344 gMC->Gspos("UT4O", 1, "UTMO", 0., f*xezpos, xezpos, 0, "ONLY");
345 gMC->Gspos("UT3O", 1, "UTMO", 0., f*myzpos, myzpos, 0, "ONLY");
346 gMC->Gspos("UT1O", 1, "UTMO", 0., f*razpos, razpos, 0, "ONLY");
347 gMC->Gspos("UT0O", 1, "UTMO", 0., f*sezpos, sezpos, 0, "ONLY");
348 gMC->Gspos("UT2O", 1, "UT1O", 0., f*pezpos, pezpos, 0, "ONLY");
349
350 gMC->Gspos("UT9N", 1, "UTMN", 0., 0., wazpos, 0, "ONLY");
351 gMC->Gspos("UT8N", 1, "UTMN", 0., 0., cozpos, 0, "ONLY");
352 gMC->Gspos("UT7N", 1, "UTMN", 0., 0., fezpos, 0, "ONLY");
353 gMC->Gspos("UT6N", 1, "UTMN", 0., 0., suzpos, 0, "ONLY");
354 gMC->Gspos("UT5N", 1, "UTMN", 0., 0., cuzpos, 0, "ONLY");
355 gMC->Gspos("UT4N", 1, "UTMN", 0., 0., xezpos, 0, "ONLY");
356 gMC->Gspos("UT3N", 1, "UTMN", 0., 0., myzpos, 0, "ONLY");
357 gMC->Gspos("UT1N", 1, "UTMN", 0., 0., razpos, 0, "ONLY");
358 gMC->Gspos("UT0N", 1, "UTMN", 0., 0., sezpos, 0, "ONLY");
359 gMC->Gspos("UT2N", 1, "UT1N", 0., 0., pezpos, 0, "ONLY");
360
361 gMC->Gspos("UT9I", 1, "UTMI", 0., 0., wazpos, 0, "ONLY");
362 gMC->Gspos("UT8I", 1, "UTMI", 0., 0., cozpos, 0, "ONLY");
363 gMC->Gspos("UT7I", 1, "UTMI", 0., 0., fezpos, 0, "ONLY");
364 gMC->Gspos("UT6I", 1, "UTMI", 0., 0., suzpos, 0, "ONLY");
365 gMC->Gspos("UT5I", 1, "UTMI", 0., 0., cuzpos, 0, "ONLY");
366 gMC->Gspos("UT4I", 1, "UTMI", 0., 0., xezpos, 0, "ONLY");
367 gMC->Gspos("UT3I", 1, "UTMI", 0., 0., myzpos, 0, "ONLY");
368 gMC->Gspos("UT1I", 1, "UTMI", 0., 0., razpos, 0, "ONLY");
369 gMC->Gspos("UT0I", 1, "UTMI", 0., 0., sezpos, 0, "ONLY");
370 gMC->Gspos("UT2I", 1, "UT1I", 0., 0., pezpos, 0, "ONLY");
d3f347ff 371
372 // Position of the inner part of the chambers
fe4da5cc 373 xpos = 0.;
d3f347ff 374 ypos = 0.;
fe4da5cc 375 zpos = 0.;
cfce8870 376 gMC->Gspos("UTII", 1, "UTCI", xpos, ypos, zpos, 0, "ONLY");
377 gMC->Gspos("UTIN", 1, "UTCN", xpos, ypos, zpos, 0, "ONLY");
378 gMC->Gspos("UTIO", 1, "UTCO", xpos, ypos, zpos, 0, "ONLY");
d3f347ff 379
380 // Position of the chambers in the support frame
fe4da5cc 381 xpos = 0.;
d3f347ff 382 ypos = ((zmax1 + zmax2) / 2 + zlenn + zleni / 2) / 2;
fe4da5cc 383 zpos = 0.;
cfce8870 384 gMC->Gspos("UTCO", 1, "UTRI", xpos, ypos, zpos, idmat[2], "ONLY");
385 gMC->Gspos("UTCO", 2, "UTRI", xpos,-ypos, zpos, 0 , "ONLY");
d3f347ff 386 xpos = 0.;
387 ypos = (zlenn + zleni) / 2;
388 zpos = 0.;
cfce8870 389 gMC->Gspos("UTCN", 1, "UTRI", xpos, ypos, zpos, 0 , "ONLY");
390 gMC->Gspos("UTCN", 2, "UTRI", xpos,-ypos, zpos, 0 , "ONLY");
d3f347ff 391 xpos = 0.;
392 ypos = 0.;
393 zpos = 0.;
cfce8870 394 gMC->Gspos("UTCI", 1, "UTRI", xpos, ypos, zpos, 0 , "ONLY");
d3f347ff 395
396 // Position of the inner part of the detector frame
397 xpos = (rmax + rmin) / 2;
398 ypos = 0.;
399 zpos = 0.;
cfce8870 400 gMC->Gspos("UTRI", 1, "UTRS", xpos, ypos, zpos, idmat[1], "ONLY");
d3f347ff 401
402 // Position of the two arms of the detector
fe4da5cc 403 xpos = 0.;
404 ypos = 0.;
405 zpos = 0.;
cfce8870 406 gMC->Gspos("UTRD", 1, "TRD ", xpos, ypos, zpos, 0, "ONLY");
407 gMC->Gspos("UTRD", 2, "TRD ", xpos, ypos, zpos, idmat[0], "ONLY");
d3f347ff 408
409 // Position of TRD mother volume in ALICE experiment
410 xpos = 0.;
fe4da5cc 411 ypos = 0.;
d3f347ff 412 zpos = 0.;
cfce8870 413 gMC->Gspos("TRD ", 1, "ALIC", xpos, ypos, zpos, 0, "ONLY");
d3f347ff 414
fe4da5cc 415}
416
417//_____________________________________________________________________________
05e51f55 418void AliTRDv1::DrawModule()
fe4da5cc 419{
420 //
421 // Draw a shaded view of the Transition Radiation Detector version 1
422 //
423
fe4da5cc 424 // Set everything unseen
cfce8870 425 gMC->Gsatt("*", "seen", -1);
fe4da5cc 426 //
427 // Set ALIC mother transparent
cfce8870 428 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 429 //
430 // Set the volumes visible
cfce8870 431 gMC->Gsatt("TRD" ,"SEEN",0);
432 gMC->Gsatt("UTRD","SEEN",0);
433 gMC->Gsatt("UTRS","SEEN",0);
434 gMC->Gsatt("UTRI","SEEN",0);
435 gMC->Gsatt("UTCO","SEEN",0);
436 gMC->Gsatt("UTIO","SEEN",0);
437 gMC->Gsatt("UTMO","SEEN",0);
438 gMC->Gsatt("UTCN","SEEN",0);
439 gMC->Gsatt("UTIN","SEEN",0);
440 gMC->Gsatt("UTMN","SEEN",0);
441 gMC->Gsatt("UTCI","SEEN",0);
442 gMC->Gsatt("UTII","SEEN",0);
443 gMC->Gsatt("UTMI","SEEN",0);
444 gMC->Gsatt("UT1O","SEEN",1);
445 gMC->Gsatt("UT4O","SEEN",1);
446 gMC->Gsatt("UT1N","SEEN",1);
447 gMC->Gsatt("UT4N","SEEN",1);
448 gMC->Gsatt("UT1I","SEEN",1);
449 gMC->Gsatt("UT4I","SEEN",1);
fe4da5cc 450 //
cfce8870 451 gMC->Gdopt("hide", "on");
452 gMC->Gdopt("shad", "on");
453 gMC->Gsatt("*", "fill", 7);
454 gMC->SetClipBox(".");
455 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
456 gMC->DefaultRange();
457 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
458 gMC->Gdhead(1111, "Transition Radiation Detector Version 1");
459 gMC->Gdman(18, 4, "MAN");
fe4da5cc 460}
461
462//_____________________________________________________________________________
463void AliTRDv1::CreateMaterials()
464{
465 //
466 // Create materials for the Transition Radiation Detector version 1
467 //
d3f347ff 468 AliTRD::CreateMaterials();
fe4da5cc 469}
470
471//_____________________________________________________________________________
472void AliTRDv1::Init()
473{
474 //
475 // Initialise the Transition Radiation Detector after the geometry is built
476 //
477 AliTRD::Init();
d3f347ff 478 // Retrieve the numeric identifier of the sensitive volumes (gas volume)
cfce8870 479 fIdSens1 = gMC->VolId("UT4I");
480 fIdSens2 = gMC->VolId("UT4N");
481 fIdSens3 = gMC->VolId("UT4O");
fe4da5cc 482}
483
484//_____________________________________________________________________________
485void AliTRDv1::StepManager()
486{
487 //
d3f347ff 488 // Procedure called at every step in the TRD
fe4da5cc 489 //
d3f347ff 490
fe4da5cc 491 Int_t vol[3];
d3f347ff 492 Int_t icopy1, icopy2;
493 Int_t idSens, icSens;
0a6d8768 494 TLorentzVector pos;
fe4da5cc 495
496 Float_t hits[4];
497
498 TClonesArray &lhits = *fHits;
499
fe4da5cc 500 // Use only charged tracks and count them only once per volume
0a6d8768 501 if (gMC->TrackCharge() && gMC->IsTrackExiting()) {
fe4da5cc 502
503 // Check on sensitive volume
0a6d8768 504 idSens = gMC->CurrentVolID(icSens);
fe4da5cc 505
d3f347ff 506 // Check on sensitive volume
0a6d8768 507 idSens = gMC->CurrentVolID(icSens);
d3f347ff 508 if ((idSens == fIdSens1) ||
509 (idSens == fIdSens2) ||
510 (idSens == fIdSens3)) {
fe4da5cc 511
512 // The sector number
0a6d8768 513 gMC->CurrentVolOffID(5,icopy1);
514 gMC->CurrentVolOffID(6,icopy2);
d3f347ff 515 if (icopy2 == 1)
516 vol[0] = icopy1;
517 else
518 vol[0] = 6 - icopy1 + 5;
fe4da5cc 519
d3f347ff 520 // The chamber number
521 // 1: outer left
522 // 2: neighbouring left
523 // 3: inner
524 // 4: neighbouring right
525 // 5: outer right
0a6d8768 526 gMC->CurrentVolOffID(3,icopy1);
d3f347ff 527 if (idSens == fIdSens3)
528 vol[1] = 4 * icopy1 - 3;
529 else if (idSens == fIdSens2)
530 vol[1] = 2 * icopy1;
531 else
532 vol[1] = 3;
fe4da5cc 533
534 // The plane number
0a6d8768 535 gMC->CurrentVolOffID(1,icopy1);
fe4da5cc 536 vol[2] = icopy1;
d3f347ff 537
538 if (fSensSelect) {
539 Int_t addthishit = 1;
540 if ((fSensPlane) && (vol[2] != fSensPlane )) addthishit = 0;
541 if ((fSensChamber) && (vol[1] != fSensChamber)) addthishit = 0;
542 if ((fSensSector) && (vol[0] != fSensSector )) addthishit = 0;
543 if (addthishit) {
0a6d8768 544 gMC->TrackPosition(pos);
545 hits[0] = pos[0];
546 hits[1] = pos[1];
547 hits[2] = pos[2];
d3f347ff 548 hits[3] = 0;
549 new(lhits[fNhits++]) AliTRDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
550 }
551 }
552 else {
0a6d8768 553 gMC->TrackPosition(pos);
554 hits[0] = pos[0];
555 hits[1] = pos[1];
556 hits[2] = pos[2];
d3f347ff 557 hits[3] = 0;
558 new(lhits[fNhits++]) AliTRDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
559 }
560
561 }
562
fe4da5cc 563 }
d3f347ff 564
fe4da5cc 565}