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