]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliTRD.cxx
8c65d29d8d77e517248c5891275d76beb0598d52
[u/mrichter/AliRoot.git] / 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="gif/AliTRDClass.gif">
11 */
12 //End_Html
13 //                                                                           //
14 //                                                                           //
15 ///////////////////////////////////////////////////////////////////////////////
16
17 #include <TMath.h>
18 #include <TRandom.h>
19 #include <TVector.h>
20 #include <TGeometry.h>
21 #include <TNode.h>
22 #include <TObjectTable.h>
23 #include <TBRIK.h>
24 #include <TPGON.h> 
25
26 #include "GParticle.h"
27 #include "AliTRD.h"
28 #include "AliRun.h"
29 #include <iostream.h>
30 #include <fstream.h>
31
32 #include "TGeant3.h"
33  
34 ClassImp(AliTRD)
35  
36 //_____________________________________________________________________________
37 AliTRD::AliTRD()
38 {
39   //
40   // Default constructor
41   //
42   fIshunt   = 0;
43 }
44  
45 //_____________________________________________________________________________
46 AliTRD::AliTRD(const char *name, const char *title)
47        : AliDetector(name,title)
48 {
49   //
50   // Standard constructor for the TRD
51   //
52
53   //
54   // Allocate the hit array
55  
56   fHits   = new TClonesArray("AliTRDhit",  405);
57   
58   fIshunt = 0;
59   
60   SetMarkerColor(kWhite);   
61 }
62  
63 //_____________________________________________________________________________
64 void AliTRD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
65 {
66   //
67   // Add a hit for the TRD
68   //
69   TClonesArray &lhits = *fHits;
70   new(lhits[fNhits++]) AliTRDhit(fIshunt,track,vol,hits);
71 }
72
73 //_____________________________________________________________________________
74 void AliTRD::BuildGeometry()
75 {
76   //
77   // Create the ROOT TNode geometry for the TRD
78   //
79   TNode *Node, *Top;
80   TPGON *pgon;
81   const Int_t kColorTRD = 46;
82   //
83   // Find the top node alice
84   Top=gAlice->GetGeometry()->GetNode("alice");
85   //
86   pgon = new TPGON("S_TRD","TRD","void",0,360,18,2);
87   pgon->DefineSection(0,-351.2,285.335,355.686);
88   pgon->DefineSection(1, 351.2,285.335,355.686);
89   Top->cd();
90   Node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
91   Node->SetLineColor(kColorTRD);
92   fNodes->Add(Node);
93 }
94  
95 //_____________________________________________________________________________
96 void AliTRD::CreateMaterials()
97 {
98   //
99   // Create the materials for the TRD
100   // Origin Y.Foka
101   //
102
103   AliMC* pMC = AliMC::GetMC();
104   
105   Int_t   ISXFLD = gAlice->Field()->Integ();
106   Float_t SXMGMX = gAlice->Field()->Max();
107   
108   // --- For polyethilene (CH2) 
109   Float_t ape[2] = { 12.,1. };
110   Float_t zpe[2] = { 6.,1. };
111   Float_t wpe[2] = { .33,.67 };
112   Float_t dpe    = .95;
113   // --- For mylar (C5H4O2) 
114   Float_t amy[3] = { 12.,1.,16. };
115   Float_t zmy[3] = { 6.,1.,8. };
116   Float_t wmy[3] = { 5.,4.,2. };
117   Float_t dmy    = 1.39;
118   // --- For CO2 
119   Float_t aco[2] = { 12.,16. };
120   Float_t zco[2] = { 6.,8. };
121   Float_t wco[2] = { 1.,2. };
122   Float_t dco    = .001977;
123   // --- For Xe/CO2-gas-mixture 
124   // --- Xe-content of the gas-mixture (90% / 10%) 
125   Float_t fxe    = .9;
126   Float_t dxe    = .005858;
127   
128   // --- General tracking parameter
129   Float_t tmaxfd = -10.;
130   Float_t stemax = -1e10;
131   Float_t deemax = -.1;
132   Float_t epsil  = 1e-4;
133   Float_t stmin  = -.001;
134   
135   Float_t absl, radl, d, buf[1];
136   Float_t agm[2], dgm, zgm[2], wgm[2];
137   Int_t nbuf;
138   
139   //     Define Materials 
140   
141   // ***********************************************************************
142   AliMaterial(1, "Al $", 26.98, 13., 2.7, 8.9, 37.2);
143   AliMaterial(2, "Air$", 14.61, 7.3, .001205, 30420., 67500);
144   AliMaterial(4, "Xe $", 131.29, 54., dxe, 1447.59, 0);
145   AliMaterial(5, "Cu $", 63.54, 29., 8.96, 1.43, 14.8);
146   AliMaterial(6, "C  $", 12.01, 6., 2.265, 18.8, 74.4);
147   // --- Mixtures 
148   AliMixture(3, "Polyethilene$", ape, zpe, dpe, -2, wpe);
149   AliMixture(7, "Mylar$",        amy, zmy, dmy, -3, wmy);
150   AliMixture(8, "CO2$",          aco, zco, dco, -2, wco);
151   char namate[21];
152   // --- Get properties of Xe 
153   pMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
154   // --- Get properties of CO2 
155   pMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
156   // --- Create gas mixture 
157   wgm[0] = fxe;
158   wgm[1] = 1. - fxe;
159   dgm    = wgm[0] * dxe + wgm[1] * dco;
160   AliMixture(9, "Gas mixture$", agm, zgm, dgm, 2, wgm);
161   // ***********************************************************************
162   
163   //     Tracking Media Parameters 
164   
165   // ***********************************************************************
166   // --- Al Frame 
167   AliMedium(1301, "Al Frame$", 1, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
168   // --- Air 
169   AliMedium(1302, "Air$",      2, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
170   // --- Polyethilene 
171   AliMedium(1303, "Radiator$", 3, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
172   // --- Xe 
173   AliMedium(1304, "Xe$",       4, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
174   // --- Cu pads 
175   AliMedium(1305, "Padplane$", 5, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
176   // --- Fee + cables 
177   AliMedium(1306, "Readout$",  1, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
178   // --- C frame 
179   AliMedium(1307, "C Frame$",  6, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
180   // --- Mylar foils 
181   AliMedium(1308, "Mylar$",    7, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
182   // --- Gas-mixture 
183   AliMedium(1309, "Gas-mix$",  9, 1, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
184   // --- Nomex-honeycomb (use carbon for the time being) 
185   AliMedium(1310, "Nomex$",    6, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
186   // --- Kapton foils (use Mylar for the time being) 
187   AliMedium(1311, "Kapton$",   7, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
188   // --- Gas-filling of the radiator 
189   AliMedium(1312, "CO2$",      8, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
190 }
191
192 //_____________________________________________________________________________
193 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
194 {
195   //
196   // Distance between the mouse and the TRD detector on the screen
197   // Dummy routine
198   //
199    return 9999;
200 }
201  
202 //_____________________________________________________________________________
203 void AliTRD::Init()
204 {
205   //
206   // Initialise the TRD detector after the geometry has been created
207   //
208   Int_t i;
209   //
210   printf("\n");
211   for(i=0;i<35;i++) printf("*");
212   printf(" TRD_INIT ");
213   for(i=0;i<35;i++) printf("*");
214   printf("\n");
215   //
216   // Here the TRD initialisation code (if any!)
217   for(i=0;i<80;i++) printf("*");
218   printf("\n");
219 }
220
221 ClassImp(AliTRDhit)
222  
223 //_____________________________________________________________________________
224 AliTRDhit::AliTRDhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
225   AliHit(shunt, track)
226 {
227   //
228   // Create a TRD hit
229   //
230
231   //
232   // Store volume hierarchy
233   fSector  = vol[0]; 
234   fChamber = vol[1];
235   fPlane   = vol[2];
236   //
237   // Store position and charge
238   fX       = hits[0];
239   fY       = hits[1];
240   fZ       = hits[2];
241   fQ       = hits[3];
242 }