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