This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / TRD / AliTRDv0.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Transition Radiation Detector version 0 -- coarse simulation //
4// //
5//Begin_Html
6/*
7<img src="gif/AliTRDv0Class.gif">
8*/
9//End_Html
10// //
11// //
12///////////////////////////////////////////////////////////////////////////////
13
14#include <TMath.h>
15#include <TRandom.h>
16#include <TVector.h>
17#include <TGeometry.h>
18#include <TNode.h>
19#include <TBRIK.h>
20#include <TPGON.h>
21
22#include "GParticle.h"
23#include "AliTRDv0.h"
24#include "AliRun.h"
25#include "AliMC.h"
26#include "AliConst.h"
27
28ClassImp(AliTRDv0)
29
30//_____________________________________________________________________________
31AliTRDv0::AliTRDv0(const char *name, const char *title)
32 :AliTRD(name, title)
33{
34 //
35 // Standard constructor for Transition Radiation Detector version 0
36 //
37 fIdSens1 = fIdSens2 = 0;
38}
39
40//_____________________________________________________________________________
41void AliTRDv0::CreateGeometry()
42{
43 //
44 // Create the GEANT geometry for the Transition Radiation Detector
45 // --- The coarse geometry of the TRD, that can be used for background
46 // studies. This version covers the full azimuth.
47 // -- Author : Nick van Eijndhoven (CERN) 24/09/90
48 //
49 //Begin_Html
50 /*
51 <img src="gif/AliTRDv0.gif">
52 */
53 //End_Html
54 //Begin_Html
55 /*
56 <img src="gif/AliTRDv0Tree.gif">
57 */
58 //End_Html
59
60 Float_t xpos, ypos, zpos, f;
61 Int_t idmat[2];
62 Float_t widma, theoc, widmi;
63 Float_t tanzr;
64 Float_t par_ic[4], par_oc[11], par_mo[10], par_fr[4];
65
66 Int_t *idtmed = gAlice->Idtmed();
67
68 // --- Name Conventions :
69 // TRD --> Mother TRD volume (Al)
70 // UTRS --> Sectors of the sub-detector (Al)
71 // UTFI(O) --> Inner part of the detector frame (Air)
72 // UTCI(O) --> Frames of the inner and outer chambers (C)
73 // UTII(O) --> Inner part of the chambers (Air)
74 // UTMI(O) --> Modules in the chambers (Air)
75 // UT1I(O) --> Radiator layer (CO2)
76 // UT2I(O) --> Polyethylene layer (PE)
77 // UT3I(O) --> Mylar layer (Mylar)
78 // UT4I(O) --> Xe/C02 layer (Xe/C02)
79 // UT5I(O) --> Cu layer (pads/sensitive) (Cu)
80 // UT6I(O) --> Kapton layer (Kapton)
81 // UT7I(O) --> NOMEX layer (C)
82 // UT8I(O) --> Readout layer (Al)
83
84 // --- Contains geometry information
85
86 // --- Number of sectors in the full detector
87 // --- Number of modules in each sector
88 // --- z-Coordinates of the TRD-frame
89 // --- r-Coordinates of the TRD-frame
90 // --- Thickness of the aluminium of the support frame
91 // --- Thickness of the interior of the support frame
92 // --- Thickness of the carbon chamber frame
93 // --- Thickness and z-position of the PE-layer in the radiator
94 // --- Thickness and z-position of the radiator
95 // --- Thickness and z-position of the mylar-layer
96 // --- Thickness and z-position of the Xe/C02-layer
97 // --- Thickness and z-position of the Cu-layer (Pads)
98 // --- Thickness and z-position of the kapton-layer
99 // --- Thickness and z-position of the NOMEX-layer
100 // Simple C-layer for the time being
101 // --- Thickness and z-position of the readout-layer
102 // --- Parameter for the arrays
103
104 AliMC* pMC = AliMC::GetMC();
105
106 //************************************************************************
107
108 // Definition of Volumes
109
110 //************************************************************************
111
112 //phisec = 360./nsect; //The phi-angle of the sectors
113 widmi = rmin*TMath::Sin(kPI/nsect);
114 widma = rmax*TMath::Sin(kPI/nsect);
115 // --- Definition of the Mother volume for the TRD (Al)
116 par_mo[0] = 0.;
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;
123 par_mo[7] = zmax1;
124 par_mo[8] = rmin;
125 par_mo[9] = rmax;
126 pMC->Gsvolu("TRD ", "PGON", idtmed[1300], par_mo, 10);
127 pMC->Gsdvn("UTRS", "TRD ", 18, 2);
128 // --- Definition of the inner part of the detector frame (Air)
129 par_fr[0] = widmi;
130 par_fr[1] = widma;
131 par_fr[2] = zmax1/4 - alfram2/2;
132 par_fr[3] = (rmax-rmin)/2;
133 pMC->Gsvolu("UTFI", "TRD1", idtmed[1301], par_fr, 4);
134 pMC->Gsvolu("UTFO", "TRD1", idtmed[1301], par_fr, 4);
135 // --- Calculate the shape-parameter for the outer chambers
136 tanzr = (zmax1-zmax2)/(rmax-rmin);
137 theoc = -kRaddeg*TMath::ATan(tanzr/2);
138 // --- The carbon frame of the outer chambers
139 par_oc[0] = (rmax-rmin)/2;
140 par_oc[1] = theoc;
141 par_oc[2] = 90.;
142 par_oc[3] = zmax2/2 -zmax1/4 -alfram2/2;
143 par_oc[4] = widmi - (inframe+alfram1)/2;
144 par_oc[5] = widmi - (inframe+alfram1)/2;
145 par_oc[6] = 0.;
146 par_oc[7] = zmax1/4 -alfram2/2;
147 par_oc[8] = widma - (inframe+alfram1)/2;
148 par_oc[9] = widma - (inframe+alfram1)/2;
149 par_oc[10] = 0.;
150 pMC->Gsvolu("UTCO", "TRAP", idtmed[1306], par_oc, 11);
151 // --- The inner part of the outer chambers (Air)
152 par_oc[3] -= ccframe;
153 par_oc[4] -= ccframe;
154 par_oc[5] -= ccframe;
155 par_oc[7] -= ccframe;
156 par_oc[8] -= ccframe;
157 par_oc[9] -= ccframe;
158 pMC->Gsvolu("UTIO", "TRAP", idtmed[1301], par_oc, 11);
159 // --- Definition of the six modules within each outer chamber
160 pMC->Gsdvn("UTMO", "UTIO", nmodul, 3);
161 // --- Definition of the layers of each outer chamber
162 par_oc[1] = theoc;
163 par_oc[2] = 90.;
164 par_oc[3] = -1.;
165 par_oc[4] = -1.;
166 par_oc[5] = -1.;
167 par_oc[6] = 0.;
168 par_oc[7] = -1.;
169 par_oc[8] = -1.;
170 par_oc[9] = -1.;
171 par_oc[10] = 0.;
172 // --- Radiator layer
173 par_oc[0] = rathick/2;
174 pMC->Gsvolu("UT1O", "TRAP", idtmed[1311], par_oc, 11);
175 // --- Polyethylene layer
176 par_oc[0] = pethick/2;
177 pMC->Gsvolu("UT2O", "TRAP", idtmed[1302], par_oc, 11);
178 // --- Mylar layer
179 par_oc[0] = mythick/2;
180 pMC->Gsvolu("UT3O", "TRAP", idtmed[1307], par_oc, 11);
181 // --- Xe/CO2 layer
182 par_oc[0] = xethick/2;
183 pMC->Gsvolu("UT4O", "TRAP", idtmed[1308], par_oc, 11);
184 // --- Cu layer
185 par_oc[0] = cuthick/2;
186 pMC->Gsvolu("UT5O", "TRAP", idtmed[1304], par_oc, 11);
187 // --- Kapton layer
188 par_oc[0] = kathick/2;
189 pMC->Gsvolu("UT6O", "TRAP", idtmed[1310], par_oc, 11);
190 // --- NOMEX layer
191 par_oc[0] = nothick/2;
192 pMC->Gsvolu("UT7O", "TRAP", idtmed[1309], par_oc, 11);
193 // --- Read out layer
194 par_oc[0] = rothick/2;
195 pMC->Gsvolu("UT8O", "TRAP", idtmed[1305], par_oc, 11);
196 // --- The carbon frame of the inner chambers
197 par_ic[0] = widmi - (inframe+alfram1)/2;
198 par_ic[1] = widma - (inframe+alfram1)/2;
199 par_ic[2] = zmax1/4 - alfram2/2;
200 par_ic[3] = (rmax-rmin)/2;
201 pMC->Gsvolu("UTCI", "TRD1", idtmed[1306], par_ic, 4);
202 // --- The inner part of the inner chambers (Air)
203 par_ic[0] -= ccframe;
204 par_ic[1] -= ccframe;
205 par_ic[2] -= ccframe;
206 pMC->Gsvolu("UTII", "TRD1", idtmed[1301], par_ic, 4);
207 // --- Definition of the six modules within each outer chamber
208 pMC->Gsdvn("UTMI", "UTII", nmodul, 3);
209 // --- Definition of the layers of each inner chamber
210 par_ic[0] = -1.;
211 par_ic[1] = -1.;
212 par_ic[2] = -1.;
213 // --- Radiator layer
214 par_ic[3] = rathick/2;
215 pMC->Gsvolu("UT1I", "TRD1", idtmed[1311], par_ic, 4);
216 // --- Polyethylene layer
217 par_ic[3] = pethick/2;
218 pMC->Gsvolu("UT2I", "TRD1", idtmed[1302], par_ic, 4);
219 // --- Mylar layer
220 par_ic[3] = mythick/2;
221 pMC->Gsvolu("UT3I", "TRD1", idtmed[1307], par_ic, 4);
222 // --- Xe/CO2 layer
223 par_ic[3] = xethick/2;
224 pMC->Gsvolu("UT4I", "TRD1", idtmed[1308], par_ic, 4);
225 // --- Cu layer
226 par_ic[3] = cuthick/2;
227 pMC->Gsvolu("UT5I", "TRD1", idtmed[1304], par_ic, 4);
228 // --- Kapton layer
229 par_ic[3] = kathick/2;
230 pMC->Gsvolu("UT6I", "TRD1", idtmed[1310], par_ic, 4);
231 // --- NOMEX layer
232 par_ic[3] = nothick/2;
233 pMC->Gsvolu("UT7I", "TRD1", idtmed[1309], par_ic, 4);
234 // --- Read out layer
235 par_ic[3] = rothick/2;
236 pMC->Gsvolu("UT8I", "TRD1", idtmed[1305], par_ic, 4);
237 //************************************************************************
238
239 // Positioning of Volumes
240
241 //************************************************************************
242 // --- The rotation matrices
243 AliMatrix(idmat[0], 90., 90., 180., 0., 90., 0.);
244 AliMatrix(idmat[1], 90., 90., 0., 0., 90., 0.);
245 // --- Position of the layers in a TRD module
246 f = TMath::Tan(theoc * kDegrad);
247 pMC->Gspos("UT8O", 1, "UTMO", 0., f*rozpos, rozpos, 0, "ONLY");
248 pMC->Gspos("UT7O", 1, "UTMO", 0., f*nozpos, nozpos, 0, "ONLY");
249 pMC->Gspos("UT6O", 1, "UTMO", 0., f*kazpos, kazpos, 0, "ONLY");
250 pMC->Gspos("UT5O", 1, "UTMO", 0., f*cuzpos, cuzpos, 0, "ONLY");
251 pMC->Gspos("UT4O", 1, "UTMO", 0., f*xezpos, xezpos, 0, "ONLY");
252 pMC->Gspos("UT3O", 1, "UTMO", 0., f*myzpos, myzpos, 0, "ONLY");
253 pMC->Gspos("UT1O", 1, "UTMO", 0., f*razpos, razpos, 0, "ONLY");
254 pMC->Gspos("UT2O", 1, "UT1O", 0., f*pezpos, pezpos, 0, "ONLY");
255 pMC->Gspos("UT8I", 1, "UTMI", 0., 0., rozpos, 0, "ONLY");
256 pMC->Gspos("UT7I", 1, "UTMI", 0., 0., nozpos, 0, "ONLY");
257 pMC->Gspos("UT6I", 1, "UTMI", 0., 0., kazpos, 0, "ONLY");
258 pMC->Gspos("UT5I", 1, "UTMI", 0., 0., cuzpos, 0, "ONLY");
259 pMC->Gspos("UT4I", 1, "UTMI", 0., 0., xezpos, 0, "ONLY");
260 pMC->Gspos("UT3I", 1, "UTMI", 0., 0., myzpos, 0, "ONLY");
261 pMC->Gspos("UT1I", 1, "UTMI", 0., 0., razpos, 0, "ONLY");
262 pMC->Gspos("UT2I", 1, "UT1I", 0., 0., pezpos, 0, "ONLY");
263 // --- Position of the inner part of the chambers
264 pMC->Gspos("UTII", 1, "UTCI", 0., 0., 0., 0, "ONLY");
265 pMC->Gspos("UTIO", 1, "UTCO", 0., 0., 0., 0, "ONLY");
266 // --- Position of the chambers in the support frame
267 xpos = 0.;
268 ypos = (zmax1-zmax2)/4;
269 zpos = 0.;
270 pMC->Gspos("UTCO", 1, "UTFO", xpos, ypos, zpos, 0, "ONLY");
271 xpos = 0.;
272 ypos = 0.;
273 zpos = 0.;
274 pMC->Gspos("UTCI", 1, "UTFI", xpos, ypos, zpos, 0, "ONLY");
275 // --- Position of the frame in the sectors of the mother volume
276 xpos = (rmax+rmin)/2;
277 ypos = 0.;
278 zpos = zmax1*3/4;
279 pMC->Gspos("UTFO", 1, "UTRS", xpos, ypos, zpos, idmat[0], "ONLY");
280 pMC->Gspos("UTFO", 2, "UTRS", xpos, ypos,-zpos, idmat[1], "ONLY");
281 xpos = (rmax+rmin)/2;
282 ypos = 0.;
283 zpos = zmax1/4;
284 pMC->Gspos("UTFI", 1, "UTRS", xpos, ypos, zpos, idmat[0], "ONLY");
285 pMC->Gspos("UTFI", 2, "UTRS", xpos, ypos,-zpos, idmat[1], "ONLY");
286 // --- Position of TRD mother volume in ALICE experiment
287 pMC->Gspos("TRD ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
288}
289
290//_____________________________________________________________________________
291void AliTRDv0::DrawDetector()
292{
293 //
294 // Draw a shaded view of the Transition Radiation Detector version 0
295 //
296
297 AliMC* pMC = AliMC::GetMC();
298
299 // Set everything unseen
300 pMC->Gsatt("*", "seen", -1);
301 //
302 // Set ALIC mother transparent
303 pMC->Gsatt("ALIC","SEEN",0);
304 //
305 // Set the volumes visible
306 pMC->Gsatt("TRD","SEEN",0);
307 pMC->Gsatt("UTRS","SEEN",0);
308 pMC->Gsatt("UTFI","SEEN",0);
309 pMC->Gsatt("UTFO","SEEN",0);
310 pMC->Gsatt("UTCO","SEEN",0);
311 pMC->Gsatt("UTIO","SEEN",0);
312 pMC->Gsatt("UTMO","SEEN",0);
313 pMC->Gsatt("UT1O","SEEN",1);
314 pMC->Gsatt("UT4O","SEEN",1);
315 pMC->Gsatt("UTCI","SEEN",0);
316 pMC->Gsatt("UTII","SEEN",0);
317 pMC->Gsatt("UTMI","SEEN",0);
318 pMC->Gsatt("UT1I","SEEN",1);
319 pMC->Gsatt("UT4I","SEEN",1);
320 //
321 pMC->Gdopt("hide", "on");
322 pMC->Gdopt("shad", "on");
323 pMC->Gsatt("*", "fill", 7);
324 pMC->SetClipBox(".");
325 pMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
326 pMC->DefaultRange();
327 pMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
328 pMC->Gdhead(1111, "Transition Radiation Detector Version 0");
329 pMC->Gdman(18, 4, "MAN");
330}
331
332//_____________________________________________________________________________
333void AliTRDv0::CreateMaterials()
334{
335 //
336 // Create materials for the Transition Radiation Detector
337 //
338 printf("TRD: Fast simulation with coarse geometry\n");
339 AliTRD::CreateMaterials();
340}
341
342//_____________________________________________________________________________
343void AliTRDv0::Init()
344{
345 //
346 // Initialise Transition Radiation Detector after geometry is built
347 //
348 AliTRD::Init();
349 AliMC* pMC = AliMC::GetMC();
350 //
351 // Retrieve the numeric identifier of the sensitive planes
352 fIdSens1 = pMC->VolId("UT5I");
353 fIdSens2 = pMC->VolId("UT5O");
354}
355
356//_____________________________________________________________________________
357void AliTRDv0::StepManager()
358{
359 //
360 // Procedure called at every step in the TRD
361 //
362
363 Int_t vol[3];
364 Int_t icopy, idSens, icSens;
365
366 Float_t hits[4];
367
368 TClonesArray &lhits = *fHits;
369
370 AliMC* pMC = AliMC::GetMC();
371
372 // Use only charged tracks and count them only once per volume
373 if(pMC->TrackCharge() && pMC->TrackEntering()) {
374
375 // Check on sensitive volume
376 idSens = pMC->CurrentVol(0,icSens);
377 if ((idSens == fIdSens1) || (idSens == fIdSens2)) {
378
379 // The sector number
380 pMC->CurrentVolOff(5,0,icopy);
381 vol[0] = icopy;
382
383 // The chamber number
384 pMC->CurrentVolOff(4,0,icopy);
385 if (idSens == fIdSens2)
386 vol[1] = (icopy - 1) * 3 + 1;
387 else
388 vol[1] = icopy + 1;
389
390 // The plane number
391 pMC->CurrentVolOff(1,0,icopy);
392 vol[2] = icopy;
393
394 pMC->TrackPosition(hits);
395 hits[3] = 0;
396
397 new(lhits[fNhits++]) AliTRDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
398 }
399 }
400}