Record correctly also the last step in Lego plot
[u/mrichter/AliRoot.git] / TRD / AliTRD.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Transition Radiation Detector //
4// This class contains the basic functions for the Transition Radiation //
5// detector. Functions specific to one particular geometry are //
6// contained in the derived classes //
7// //
8//Begin_Html
9/*
1439f98e 10<img src="picts/AliTRDClass.gif">
fe4da5cc 11*/
12//End_Html
13// //
14// //
15///////////////////////////////////////////////////////////////////////////////
16
fa1fa361 17#include <stdlib.h>
18
fe4da5cc 19#include <TMath.h>
fe4da5cc 20#include <TNode.h>
fe4da5cc 21#include <TPGON.h>
22
fe4da5cc 23#include "AliTRD.h"
24#include "AliRun.h"
fe4da5cc 25
d3f347ff 26#include "AliConst.h"
fe4da5cc 27
28ClassImp(AliTRD)
29
30//_____________________________________________________________________________
31AliTRD::AliTRD()
32{
33 //
34 // Default constructor
35 //
82bbf98a 36
d3f347ff 37 fIshunt = 0;
38 fGasMix = 0;
82bbf98a 39
40 // The chamber dimensions
41 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
42 fClengthI[iplan] = 0.;
43 fClengthM[iplan] = 0.;
44 fClengthO[iplan] = 0.;
45 }
46
fe4da5cc 47}
48
49//_____________________________________________________________________________
50AliTRD::AliTRD(const char *name, const char *title)
51 : AliDetector(name,title)
52{
53 //
54 // Standard constructor for the TRD
55 //
56
82bbf98a 57
58 // Check that FRAME is there otherwise we have no place where to put the TRD
59 AliModule* FRAME = gAlice->GetModule("FRAME");
60 if (!FRAME) {
61 Error("AliTRD","TRD needs FRAME to be present\n");
62 exit(1);
63 }
64
fe4da5cc 65 // Allocate the hit array
fe4da5cc 66 fHits = new TClonesArray("AliTRDhit", 405);
67
82bbf98a 68 fIshunt = 0;
69 fGasMix = 0;
70
71 // The chamber dimensions
72 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
73 fClengthI[iplan] = 0.;
74 fClengthM[iplan] = 0.;
75 fClengthO[iplan] = 0.;
76 fCwidth[iplan] = 0.;
77 }
fe4da5cc 78
79 SetMarkerColor(kWhite);
82bbf98a 80
fe4da5cc 81}
82
83//_____________________________________________________________________________
84void AliTRD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
85{
86 //
87 // Add a hit for the TRD
88 //
82bbf98a 89
fe4da5cc 90 TClonesArray &lhits = *fHits;
91 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,vol,hits);
82bbf98a 92
fe4da5cc 93}
94
95//_____________________________________________________________________________
96void AliTRD::BuildGeometry()
97{
98 //
99 // Create the ROOT TNode geometry for the TRD
100 //
82bbf98a 101
fe4da5cc 102 TNode *Node, *Top;
103 TPGON *pgon;
104 const Int_t kColorTRD = 46;
d3f347ff 105
fe4da5cc 106 // Find the top node alice
82bbf98a 107 Top = gAlice->GetGeometry()->GetNode("alice");
d3f347ff 108
82bbf98a 109 pgon = new TPGON("S_TRD","TRD","void",0,360,kNsect,4);
110 Float_t ff = TMath::Cos(kDegrad * 180 / kNsect);
111 Float_t rrmin = kRmin / ff;
112 Float_t rrmax = kRmax / ff;
113 pgon->DefineSection(0,-kZmax1,rrmax,rrmax);
114 pgon->DefineSection(1,-kZmax2,rrmin,rrmax);
115 pgon->DefineSection(2, kZmax2,rrmin,rrmax);
116 pgon->DefineSection(3, kZmax1,rrmax,rrmax);
fe4da5cc 117 Top->cd();
118 Node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
119 Node->SetLineColor(kColorTRD);
120 fNodes->Add(Node);
d3f347ff 121
fe4da5cc 122}
123
124//_____________________________________________________________________________
82bbf98a 125void AliTRD::CreateGeometry()
fe4da5cc 126{
82bbf98a 127 //
128 // Creates the volumes for the TRD chambers
129 //
130 // Author: Christoph Blume (C.Blume@gsi.de) 20/07/99
131 //
132 // The volumes:
133 // TRD (Air) --- The TRD mother volume for one sector.
134 // To be placed into the spaceframe.
135 //
136 // UAFI(/M/O) (Al) --- The aluminum frame of the inner(/middle/outer) chambers (readout)
137 // UCFI(/M/O) (C) --- The carbon frame of the inner(/middle/outer) chambers
138 // (driftchamber + radiator)
139 // UAII(/M/O) (Air) --- The inner part of the readout of the inner(/middle/outer) chambers
140 // UFII(/M/O) (Air) --- The inner part of the chamner and radiator of the
141 // inner(/middle/outer) chambers
142 //
143 // The material layers in one chamber:
144 // UL01 (G10) --- The gas seal of the radiator
145 // UL02 (CO2) --- The gas in the radiator
146 // UL03 (PE) --- The foil stack
147 // UL04 (Mylar) --- Entrance window to the driftvolume and HV-cathode
148 // UL05 (Xe) --- The driftvolume
149 // UL06 (Xe) --- The amplification region
150 //
151 // UL07 (Cu) --- The pad plane
152 // UL08 (G10) --- The Nomex honeycomb support structure
153 // UL09 (Cu) --- FEE and signal lines
154 // UL10 (PE) --- The cooling devices
155 // UL11 (Water) --- The cooling water
156
157 // Check that FRAME is there otherwise we have no place where to put the TRD
158 AliModule* FRAME = gAlice->GetModule("FRAME");
159 if (!FRAME) return;
160
161 const Int_t npar_trd = 4;
162 const Int_t npar_cha = 3;
163
164 Float_t par_dum[3];
165 Float_t par_trd[npar_trd];
166 Float_t par_cha[npar_cha];
fa1fa361 167 Int_t iplan;
82bbf98a 168
169 Float_t xpos, ypos, zpos;
170
171 Int_t *idtmed = fIdtmed->GetArray()-1299;
172
173 // The length of the inner chambers
fa1fa361 174 for (iplan = 0; iplan < kNplan; iplan++) fClengthI[iplan] = 110.0;
82bbf98a 175 // The length of the middle chambers
176 fClengthM[0] = 123.5;
177 fClengthM[1] = 131.0;
178 fClengthM[2] = 138.5;
179 fClengthM[3] = 146.0;
180 fClengthM[4] = 153.0;
181 fClengthM[5] = 160.5;
182 // The length of the outer chambers
183 fClengthO[0] = 123.5;
184 fClengthO[1] = 131.0;
185 fClengthO[2] = 134.5;
186 fClengthO[3] = 142.0;
187 fClengthO[4] = 142.0;
188 fClengthO[5] = 134.5;
189
190 // The width of the chambers
191 fCwidth[0] = 99.6;
192 fCwidth[1] = 104.1;
193 fCwidth[2] = 108.5;
194 fCwidth[3] = 112.9;
195 fCwidth[4] = 117.4;
196 fCwidth[5] = 121.8;
197
198 // The TRD mother volume for one sector (Air) (dimensions identical to BTR1-3)
199 par_trd[0] = kSwidth1/2.;
200 par_trd[1] = kSwidth2/2.;
201 par_trd[2] = kSlength/2.;
202 par_trd[3] = kSheight/2.;
203 gMC->Gsvolu("TRD ","TRD1",idtmed[1302-1],par_trd,npar_trd);
204
205 // The aluminum frames - readout + electronics (Al)
206 // The inner chambers
207 gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],par_dum,0);
208 // The middle chambers
209 gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],par_dum,0);
210 // The outer chambers
211 gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],par_dum,0);
212
213 // The inner part of the aluminum frames (Air)
214 // The inner chambers
215 gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],par_dum,0);
216 // The middle chambers
217 gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],par_dum,0);
218 // The outer chambers
219 gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],par_dum,0);
220
221 // The carbon frames - radiator + driftchamber (C)
222 // The inner chambers
223 gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],par_dum,0);
224 // The middle chambers
225 gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],par_dum,0);
226 // The outer chambers
227 gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],par_dum,0);
228
229 // The inner part of the carbon frames (Air)
230 // The inner chambers
231 gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],par_dum,0);
232 // The middle chambers
233 gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],par_dum,0);
234 // The outer chambers
235 gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],par_dum,0);
236
237 // The material layers inside the chambers
238 par_cha[0] = -1.;
239 par_cha[1] = -1.;
240 // G10 layer (radiator seal)
241 par_cha[2] = kSeThick/2;
242 gMC->Gsvolu("UL01","BOX ",idtmed[1313-1],par_cha,npar_cha);
243 // CO2 layer (radiator)
244 par_cha[2] = kRaThick/2;
245 gMC->Gsvolu("UL02","BOX ",idtmed[1312-1],par_cha,npar_cha);
246 // PE layer (radiator)
247 par_cha[2] = kPeThick/2;
248 gMC->Gsvolu("UL03","BOX ",idtmed[1303-1],par_cha,npar_cha);
249 // Mylar layer (entrance window + HV cathode)
250 par_cha[2] = kMyThick/2;
251 gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],par_cha,npar_cha);
252 // Xe/Isobutane layer (drift volume, sensitive)
253 par_cha[2] = kDrThick/2.;
254 gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],par_cha,npar_cha);
255 // Xe/Isobutane layer (amplification volume, not sensitive)
256 par_cha[2] = kAmThick/2.;
257 gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],par_cha,npar_cha);
258
259 // Cu layer (pad plane)
260 par_cha[2] = kCuThick/2;
261 gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],par_cha,npar_cha);
262 // G10 layer (support structure)
263 par_cha[2] = kSuThick/2;
264 gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],par_cha,npar_cha);
265 // Cu layer (FEE + signal lines)
266 par_cha[2] = kFeThick/2;
267 gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],par_cha,npar_cha);
268 // PE layer (cooling devices)
269 par_cha[2] = kCoThick/2;
270 gMC->Gsvolu("UL10","BOX ",idtmed[1303-1],par_cha,npar_cha);
271 // Water layer (cooling)
272 par_cha[2] = kWaThick/2;
273 gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],par_cha,npar_cha);
274
275 // Position the layers in the chambers
276 xpos = 0;
277 ypos = 0;
278
279 // G10 layer (radiator seal)
280 zpos = kSeZpos;
281 gMC->Gspos("UL01",1,"UCII",xpos,ypos,zpos,0,"ONLY");
282 gMC->Gspos("UL01",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
283 gMC->Gspos("UL01",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
284 // CO2 layer (radiator)
285 zpos = kRaZpos;
286 gMC->Gspos("UL02",1,"UCII",xpos,ypos,zpos,0,"ONLY");
287 gMC->Gspos("UL02",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
288 gMC->Gspos("UL02",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
289 // PE layer (radiator)
290 zpos = 0;
291 gMC->Gspos("UL03",1,"UL02",xpos,ypos,zpos,0,"ONLY");
292 // Mylar layer (entrance window + HV cathode)
293 zpos = kMyZpos;
294 gMC->Gspos("UL04",1,"UCII",xpos,ypos,zpos,0,"ONLY");
295 gMC->Gspos("UL04",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
296 gMC->Gspos("UL04",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
297 // Xe/Isobutane layer (drift volume)
298 zpos = kDrZpos;
299 gMC->Gspos("UL05",1,"UCII",xpos,ypos,zpos,0,"ONLY");
300 gMC->Gspos("UL05",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
301 gMC->Gspos("UL05",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
302 // Xe/Isobutane layer (amplification volume)
303 zpos = kAmZpos;
304 gMC->Gspos("UL06",1,"UCII",xpos,ypos,zpos,0,"ONLY");
305 gMC->Gspos("UL06",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
306 gMC->Gspos("UL06",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
307
308 // Cu layer (pad plane)
309 zpos = kCuZpos;
310 gMC->Gspos("UL07",1,"UAII",xpos,ypos,zpos,0,"ONLY");
311 gMC->Gspos("UL07",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
312 gMC->Gspos("UL07",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
313 // G10 layer (support structure)
314 zpos = kSuZpos;
315 gMC->Gspos("UL08",1,"UAII",xpos,ypos,zpos,0,"ONLY");
316 gMC->Gspos("UL08",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
317 gMC->Gspos("UL08",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
318 // Cu layer (FEE + signal lines)
319 zpos = kFeZpos;
320 gMC->Gspos("UL09",1,"UAII",xpos,ypos,zpos,0,"ONLY");
321 gMC->Gspos("UL09",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
322 gMC->Gspos("UL09",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
323 // PE layer (cooling devices)
324 zpos = kCoZpos;
325 gMC->Gspos("UL10",1,"UAII",xpos,ypos,zpos,0,"ONLY");
326 gMC->Gspos("UL10",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
327 gMC->Gspos("UL10",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
328 // Water layer (cooling)
329 zpos = kWaZpos;
330 gMC->Gspos("UL11",1,"UAII",xpos,ypos,zpos,0,"ONLY");
331 gMC->Gspos("UL11",1,"UAIM",xpos,ypos,zpos,0,"ONLY");
332 gMC->Gspos("UL11",1,"UAIO",xpos,ypos,zpos,0,"ONLY");
333
334 // Position the chambers in the TRD mother volume
fa1fa361 335 for (iplan = 1; iplan <= kNplan; iplan++) {
82bbf98a 336
337 // The inner chambers ---------------------------------------------------------------
338
339 // the aluminum frame
340 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2.;
341 par_cha[0] = fCwidth[iplan-1]/2.;
342 par_cha[1] = fClengthI[iplan-1]/2.;
343 par_cha[2] = kCaframe/2.;
344 xpos = 0.;
345 ypos = 0.;
346 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
347 gMC->Gsposp("UAFI",iplan ,"TRD ",xpos,ypos,zpos,0,"MANY",par_cha,npar_cha);
348
349 // the inner part of the aluminum frame
350 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2. - kCathick;
351 par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
352 par_cha[1] = fClengthI[iplan-1]/2. - kCathick;
353 par_cha[2] = kCaframe/2.;
354 xpos = 0.;
355 ypos = 0.;
356 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
357 gMC->Gsposp("UAII",iplan ,"TRD ",xpos,ypos,zpos,0,"ONLY",par_cha,npar_cha);
358
359 // the carbon frame
360 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2.;
361 par_cha[0] = fCwidth[iplan-1]/2.;
362 par_cha[1] = fClengthI[iplan-1]/2.;
363 par_cha[2] = kCcframe/2.;
364 xpos = 0.;
365 ypos = 0.;
366 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
367 gMC->Gsposp("UCFI",iplan ,"TRD ",xpos,ypos,zpos,0,"MANY",par_cha,npar_cha);
368
369 // the inner part of the carbon frame
370 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2. - kCcthick;
371 par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
372 par_cha[1] = fClengthI[iplan-1]/2. - kCcthick;
373 par_cha[2] = kCcframe/2.;
374 xpos = 0.;
375 ypos = 0.;
376 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
377 gMC->Gsposp("UCII",iplan ,"TRD ",xpos,ypos,zpos,0,"ONLY",par_cha,npar_cha);
378
379 // The middle chambers --------------------------------------------------------------
380
381 // the aluminum frame
382 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2.;
383 par_cha[0] = fCwidth[iplan-1]/2.;
384 par_cha[1] = fClengthM[iplan-1]/2.;
385 par_cha[2] = kCaframe/2.;
386 xpos = 0.;
387 ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1]/2.;
388 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
389 gMC->Gsposp("UAFM",iplan ,"TRD ",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
390 gMC->Gsposp("UAFM",iplan+kNplan,"TRD ",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
391
392 // the inner part of the aluminum frame
393 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2. - kCathick;
394 par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
395 par_cha[1] = fClengthM[iplan-1]/2. - kCathick;
396 par_cha[2] = kCaframe/2.;
397 xpos = 0.;
398 ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1]/2.;
399 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
400 gMC->Gsposp("UAIM",iplan ,"TRD ",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
401 gMC->Gsposp("UAIM",iplan+kNplan,"TRD ",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
402
403 // the carbon frame
404 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2.;
405 par_cha[0] = fCwidth[iplan-1]/2.;
406 par_cha[1] = fClengthM[iplan-1]/2.;
407 par_cha[2] = kCcframe/2.;
408 xpos = 0.;
409 ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1]/2.;
410 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
411 gMC->Gsposp("UCFM",iplan, "TRD ",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
412 gMC->Gsposp("UCFM",iplan+kNplan,"TRD ",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
413
414 // the inner part of the carbon frame
415 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2. - kCcthick;
416 par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
417 par_cha[1] = fClengthM[iplan-1]/2. - kCcthick;
418 par_cha[2] = kCcframe/2.;
419 xpos = 0.;
420 ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1]/2.;
421 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
422 gMC->Gsposp("UCIM",iplan ,"TRD ",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
423 gMC->Gsposp("UCIM",iplan+kNplan,"TRD ",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
424
425 // The outer chambers ---------------------------------------------------------------
426
427 // the aluminum frame
428 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2.;
429 par_cha[0] = fCwidth[iplan-1]/2.;
430 par_cha[1] = fClengthO[iplan-1]/2.;
431 par_cha[2] = kCaframe/2.;
432 xpos = 0.;
433 ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1] + fClengthO[iplan-1]/2.;
434 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
435 gMC->Gsposp("UAFO",iplan ,"TRD ",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
436 gMC->Gsposp("UAFO",iplan+kNplan,"TRD ",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
437
438 // the inner part of the aluminum frame
439 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2. - kCathick;
440 par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
441 par_cha[1] = fClengthO[iplan-1]/2. - kCathick;
442 par_cha[2] = kCaframe/2.;
443 xpos = 0.;
444 ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1] + fClengthO[iplan-1]/2.;
445 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
446 gMC->Gsposp("UAIO",iplan ,"TRD ",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
447 gMC->Gsposp("UAIO",iplan+kNplan,"TRD ",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
448
449 // the carbon frame
450 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2.;
451 par_cha[0] = fCwidth[iplan-1]/2.;
452 par_cha[1] = fClengthO[iplan-1]/2.;
453 par_cha[2] = kCcframe/2.;
454 xpos = 0.;
455 ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1] + fClengthO[iplan-1]/2.;
456 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
457 gMC->Gsposp("UCFO",iplan, "TRD ",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
458 gMC->Gsposp("UCFO",iplan+kNplan,"TRD ",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
459
460 // the inner part of the carbon frame
461 //par_cha[0] = kSwidth1/2. + (iplan-1) * kCwidcha/2. - kCcthick;
462 par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
463 par_cha[1] = fClengthO[iplan-1]/2. - kCcthick;
464 par_cha[2] = kCcframe/2.;
465 xpos = 0.;
466 ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1] + fClengthO[iplan-1]/2.;
467 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
468 gMC->Gsposp("UCIO",iplan ,"TRD ",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
469 gMC->Gsposp("UCIO",iplan+kNplan,"TRD ",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
470
471 }
d3f347ff 472
82bbf98a 473}
474
475//_____________________________________________________________________________
476void AliTRD::CreateMaterials()
477{
fe4da5cc 478 //
479 // Create the materials for the TRD
480 // Origin Y.Foka
481 //
482
fe4da5cc 483 Int_t ISXFLD = gAlice->Field()->Integ();
484 Float_t SXMGMX = gAlice->Field()->Max();
485
d3f347ff 486 // For polyethilene (CH2)
487 Float_t ape[2] = { 12., 1. };
488 Float_t zpe[2] = { 6., 1. };
489 Float_t wpe[2] = { 1., 2. };
490 Float_t dpe = 0.95;
491
492 // For mylar (C5H4O2)
493 Float_t amy[3] = { 12., 1., 16. };
494 Float_t zmy[3] = { 6., 1., 8. };
495 Float_t wmy[3] = { 5., 4., 2. };
fe4da5cc 496 Float_t dmy = 1.39;
d3f347ff 497
498 // For CO2
499 Float_t aco[2] = { 12., 16. };
500 Float_t zco[2] = { 6., 8. };
501 Float_t wco[2] = { 1., 2. };
502 Float_t dco = 0.001977;
503
504 // For water
505 Float_t awa[2] = { 1., 16. };
506 Float_t zwa[2] = { 1., 8. };
507 Float_t wwa[2] = { 2., 1. };
508 Float_t dwa = 1.0;
509
510 // For isobutane (C4H10)
511 Float_t ais[2] = { 12., 1. };
512 Float_t zis[2] = { 6., 1. };
513 Float_t wis[2] = { 4., 10. };
514 Float_t dis = 0.00267;
515
516 // For Xe/CO2-gas-mixture
517 // Xe-content of the Xe/CO2-mixture (90% / 10%)
518 Float_t fxc = .90;
519 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
520 Float_t fxi = .97;
fe4da5cc 521 Float_t dxe = .005858;
522
d3f347ff 523 // General tracking parameter
fe4da5cc 524 Float_t tmaxfd = -10.;
525 Float_t stemax = -1e10;
d3f347ff 526 Float_t deemax = -0.1;
527 Float_t epsil = 1e-4;
528 Float_t stmin = -0.001;
fe4da5cc 529
530 Float_t absl, radl, d, buf[1];
531 Float_t agm[2], dgm, zgm[2], wgm[2];
d3f347ff 532 Int_t nbuf;
fe4da5cc 533
d3f347ff 534 //////////////////////////////////////////////////////////////////////////
fe4da5cc 535 // Define Materials
d3f347ff 536 //////////////////////////////////////////////////////////////////////////
537
538 AliMaterial( 1, "Al $", 26.98, 13.0, 2.7 , 8.9 , 37.2);
539 AliMaterial( 2, "Air$", 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
540 AliMaterial( 4, "Xe $", 131.29, 54.0, dxe , 1447.59, 0.0);
541 AliMaterial( 5, "Cu $", 63.54, 29.0, 8.96 , 1.43, 14.8);
542 AliMaterial( 6, "C $", 12.01, 6.0, 2.265 , 18.8 , 74.4);
543 AliMaterial(12, "G10$", 20.00, 10.0, 1.7 , 19.4 , 999.0);
544
545 // Mixtures
546 AliMixture(3, "Polyethilene$", ape, zpe, dpe, -2, wpe);
547 AliMixture(7, "Mylar$", amy, zmy, dmy, -3, wmy);
548 AliMixture(8, "CO2$", aco, zco, dco, -2, wco);
549 AliMixture(9, "Isobutane$", ais, zis, dis, -2, wis);
82bbf98a 550 AliMixture(13,"Water$", awa, zwa, dwa, -2, wwa);
d3f347ff 551
552 // Gas mixtures
82bbf98a 553 Char_t namate[21];
d3f347ff 554 // Xe/CO2-mixture
555 // Get properties of Xe
cfce8870 556 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
d3f347ff 557 // Get properties of CO2
cfce8870 558 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
d3f347ff 559 // Create gas mixture
560 wgm[0] = fxc;
561 wgm[1] = 1. - fxc;
fe4da5cc 562 dgm = wgm[0] * dxe + wgm[1] * dco;
d3f347ff 563 AliMixture(10, "Gas mixture 1$", agm, zgm, dgm, 2, wgm);
564 // Xe/Isobutane-mixture
565 // Get properties of Xe
cfce8870 566 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
d3f347ff 567 // Get properties of Isobutane
cfce8870 568 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
d3f347ff 569 // Create gas mixture
570 wgm[0] = fxi;
571 wgm[1] = 1. - fxi;
572 dgm = wgm[0] * dxe + wgm[1] * dis;
573 AliMixture(11, "Gas mixture 2$", agm, zgm, dgm, 2, wgm);
574
575 //////////////////////////////////////////////////////////////////////////
fe4da5cc 576 // Tracking Media Parameters
d3f347ff 577 //////////////////////////////////////////////////////////////////////////
578
579 // Al Frame
ad51aeb0 580 AliMedium(1, "Al Frame$", 1, 0, ISXFLD, SXMGMX
d3f347ff 581 , tmaxfd, stemax, deemax, epsil, stmin);
582 // Air
ad51aeb0 583 AliMedium(2, "Air$", 2, 0, ISXFLD, SXMGMX
d3f347ff 584 , tmaxfd, stemax, deemax, epsil, stmin);
585 // Polyethilene
ad51aeb0 586 AliMedium(3, "Radiator$", 3, 0, ISXFLD, SXMGMX
d3f347ff 587 , tmaxfd, stemax, deemax, epsil, stmin);
588 // Xe
ad51aeb0 589 AliMedium(4, "Xe$", 4, 1, ISXFLD, SXMGMX
d3f347ff 590 , tmaxfd, stemax, deemax, epsil, stmin);
591 // Cu pads
ad51aeb0 592 AliMedium(5, "Padplane$", 5, 1, ISXFLD, SXMGMX
d3f347ff 593 , tmaxfd, stemax, deemax, epsil, stmin);
594 // Fee + cables
ad51aeb0 595 AliMedium(6, "Readout$", 1, 0, ISXFLD, SXMGMX
d3f347ff 596 , tmaxfd, stemax, deemax, epsil, stmin);
597 // C frame
ad51aeb0 598 AliMedium(7, "C Frame$", 6, 0, ISXFLD, SXMGMX
d3f347ff 599 , tmaxfd, stemax, deemax, epsil, stmin);
600 // Mylar foils
ad51aeb0 601 AliMedium(8, "Mylar$", 7, 0, ISXFLD, SXMGMX
d3f347ff 602 , tmaxfd, stemax, deemax, epsil, stmin);
603 if (fGasMix == 1) {
604 // Gas-mixture (Xe/CO2)
ad51aeb0 605 AliMedium(9, "Gas-mix$", 10, 1, ISXFLD, SXMGMX
d3f347ff 606 , tmaxfd, stemax, deemax, epsil, stmin);
607 }
608 else {
609 // Gas-mixture (Xe/Isobutane)
ad51aeb0 610 AliMedium(9, "Gas-mix$", 11, 1, ISXFLD, SXMGMX
d3f347ff 611 , tmaxfd, stemax, deemax, epsil, stmin);
612 }
613 // Nomex-honeycomb (use carbon for the time being)
ad51aeb0 614 AliMedium(10, "Nomex$", 6, 0, ISXFLD, SXMGMX
d3f347ff 615 , tmaxfd, stemax, deemax, epsil, stmin);
616 // Kapton foils (use Mylar for the time being)
ad51aeb0 617 AliMedium(11, "Kapton$", 7, 0, ISXFLD, SXMGMX
d3f347ff 618 , tmaxfd, stemax, deemax, epsil, stmin);
619 // Gas-filling of the radiator
ad51aeb0 620 AliMedium(12, "CO2$", 8, 0, ISXFLD, SXMGMX
d3f347ff 621 , tmaxfd, stemax, deemax, epsil, stmin);
622 // G10-plates
ad51aeb0 623 AliMedium(13, "G10-plates$",12, 0, ISXFLD, SXMGMX
d3f347ff 624 , tmaxfd, stemax, deemax, epsil, stmin);
625 // Cooling water
ad51aeb0 626 AliMedium(14, "Water$", 13, 0, ISXFLD, SXMGMX
d3f347ff 627 , tmaxfd, stemax, deemax, epsil, stmin);
628
fe4da5cc 629}
630
82bbf98a 631//_____________________________________________________________________________
632void AliTRD::DrawModule()
633{
634 //
635 // Draw a shaded view of the Transition Radiation Detector version 0
636 //
637
638 // Set everything unseen
639 gMC->Gsatt("*" ,"SEEN",-1);
640
641 // Set ALIC mother transparent
642 gMC->Gsatt("ALIC","SEEN", 0);
643
644 // Set the volumes visible
645 gMC->Gsatt("B032","SEEN", 0);
646 gMC->Gsatt("B028","SEEN", 0);
647 gMC->Gsatt("B029","SEEN", 0);
648 gMC->Gsatt("B030","SEEN", 0);
649 gMC->Gsatt("BTR1","SEEN", 0);
650 gMC->Gsatt("BTR2","SEEN", 0);
651 gMC->Gsatt("BTR3","SEEN", 0);
652 gMC->Gsatt("TRD" ,"SEEN", 0);
653 gMC->Gsatt("UCII","SEEN", 0);
654 gMC->Gsatt("UCIM","SEEN", 0);
655 gMC->Gsatt("UCIO","SEEN", 0);
656 gMC->Gsatt("UL02","SEEN", 1);
657 gMC->Gsatt("UL05","SEEN", 1);
658 gMC->Gsatt("UL06","SEEN", 1);
659
660 gMC->Gdopt("hide", "on");
661 gMC->Gdopt("shad", "on");
662 gMC->Gsatt("*", "fill", 7);
663 gMC->SetClipBox(".");
664 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
665 gMC->DefaultRange();
666 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
667 gMC->Gdhead(1111, "Transition Radiation Detector");
668 gMC->Gdman(18, 4, "MAN");
669
670}
671
fe4da5cc 672//_____________________________________________________________________________
673Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
674{
675 //
676 // Distance between the mouse and the TRD detector on the screen
677 // Dummy routine
82bbf98a 678
679 return 9999;
680
fe4da5cc 681}
682
683//_____________________________________________________________________________
684void AliTRD::Init()
685{
686 //
687 // Initialise the TRD detector after the geometry has been created
688 //
82bbf98a 689
fe4da5cc 690 Int_t i;
82bbf98a 691
fe4da5cc 692 printf("\n");
693 for(i=0;i<35;i++) printf("*");
694 printf(" TRD_INIT ");
695 for(i=0;i<35;i++) printf("*");
696 printf("\n");
d3f347ff 697
fe4da5cc 698 // Here the TRD initialisation code (if any!)
d3f347ff 699 if (fGasMix == 1)
700 printf(" Gas Mixture: 90%% Xe + 10%% CO2\n");
701 else
702 printf(" Gas Mixture: 97%% Xe + 3%% Isobutane\n");
82bbf98a 703
fe4da5cc 704}
705
d3f347ff 706//_____________________________________________________________________________
b060c36f 707void AliTRD::SetGasMix(Int_t imix)
d3f347ff 708{
82bbf98a 709 //
710 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
711 //
712
d3f347ff 713 if ((imix < 0) || (imix > 1)) {
714 printf("Wrong input value: %d\n",imix);
715 printf("Use standard setting\n");
716 fGasMix = 0;
717 return;
718 }
719
720 fGasMix = imix;
721
722}
723
fe4da5cc 724ClassImp(AliTRDhit)
725
726//_____________________________________________________________________________
727AliTRDhit::AliTRDhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
728 AliHit(shunt, track)
729{
730 //
731 // Create a TRD hit
732 //
733
fe4da5cc 734 // Store volume hierarchy
735 fSector = vol[0];
736 fChamber = vol[1];
737 fPlane = vol[2];
82bbf98a 738
fe4da5cc 739 // Store position and charge
740 fX = hits[0];
741 fY = hits[1];
742 fZ = hits[2];
743 fQ = hits[3];
82bbf98a 744
fe4da5cc 745}