]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRD.cxx
Do not export picts twice.
[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/*
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>
fe4da5cc 22#include <TBRIK.h>
23#include <TPGON.h>
24
fe4da5cc 25#include "AliTRD.h"
26#include "AliRun.h"
fe4da5cc 27
d3f347ff 28#include "AliMC.h"
29#include "AliConst.h"
fe4da5cc 30
31ClassImp(AliTRD)
32
33//_____________________________________________________________________________
34AliTRD::AliTRD()
35{
36 //
37 // Default constructor
38 //
d3f347ff 39 fIshunt = 0;
40 fGasMix = 0;
41 fSensSelect = 0;
42 fSensPlane = 0;
43 fSensChamber = 0;
44 fSensSector = 0;
fe4da5cc 45}
46
47//_____________________________________________________________________________
48AliTRD::AliTRD(const char *name, const char *title)
49 : AliDetector(name,title)
50{
51 //
52 // Standard constructor for the TRD
53 //
54
55 //
56 // Allocate the hit array
57
58 fHits = new TClonesArray("AliTRDhit", 405);
59
d3f347ff 60 fIshunt = 0;
61 fGasMix = 0;
62 fSensSelect = 0;
63 fSensPlane = 0;
64 fSensChamber = 0;
65 fSensSector = 0;
fe4da5cc 66
67 SetMarkerColor(kWhite);
68}
69
70//_____________________________________________________________________________
71void AliTRD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
72{
73 //
74 // Add a hit for the TRD
75 //
76 TClonesArray &lhits = *fHits;
77 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,vol,hits);
78}
79
80//_____________________________________________________________________________
81void AliTRD::BuildGeometry()
82{
83 //
84 // Create the ROOT TNode geometry for the TRD
85 //
86 TNode *Node, *Top;
87 TPGON *pgon;
88 const Int_t kColorTRD = 46;
d3f347ff 89
fe4da5cc 90 // Find the top node alice
91 Top=gAlice->GetGeometry()->GetNode("alice");
d3f347ff 92
93 pgon = new TPGON("S_TRD","TRD","void",0,360,nsect,4);
94 Float_t ff = TMath::Cos(kDegrad * 180 / nsect);
95 Float_t rrmin = rmin / ff;
96 Float_t rrmax = rmax / ff;
97 pgon->DefineSection(0,-zmax1,rrmax,rrmax);
98 pgon->DefineSection(1,-zmax2,rrmin,rrmax);
99 pgon->DefineSection(2, zmax2,rrmin,rrmax);
100 pgon->DefineSection(3, zmax1,rrmax,rrmax);
fe4da5cc 101 Top->cd();
102 Node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
103 Node->SetLineColor(kColorTRD);
104 fNodes->Add(Node);
d3f347ff 105
fe4da5cc 106}
107
108//_____________________________________________________________________________
109void AliTRD::CreateMaterials()
110{
d3f347ff 111
fe4da5cc 112 //
113 // Create the materials for the TRD
114 // Origin Y.Foka
115 //
116
117 AliMC* pMC = AliMC::GetMC();
118
119 Int_t ISXFLD = gAlice->Field()->Integ();
120 Float_t SXMGMX = gAlice->Field()->Max();
121
d3f347ff 122 // For polyethilene (CH2)
123 Float_t ape[2] = { 12., 1. };
124 Float_t zpe[2] = { 6., 1. };
125 Float_t wpe[2] = { 1., 2. };
126 Float_t dpe = 0.95;
127
128 // For mylar (C5H4O2)
129 Float_t amy[3] = { 12., 1., 16. };
130 Float_t zmy[3] = { 6., 1., 8. };
131 Float_t wmy[3] = { 5., 4., 2. };
fe4da5cc 132 Float_t dmy = 1.39;
d3f347ff 133
134 // For CO2
135 Float_t aco[2] = { 12., 16. };
136 Float_t zco[2] = { 6., 8. };
137 Float_t wco[2] = { 1., 2. };
138 Float_t dco = 0.001977;
139
140 // For water
141 Float_t awa[2] = { 1., 16. };
142 Float_t zwa[2] = { 1., 8. };
143 Float_t wwa[2] = { 2., 1. };
144 Float_t dwa = 1.0;
145
146 // For isobutane (C4H10)
147 Float_t ais[2] = { 12., 1. };
148 Float_t zis[2] = { 6., 1. };
149 Float_t wis[2] = { 4., 10. };
150 Float_t dis = 0.00267;
151
152 // For Xe/CO2-gas-mixture
153 // Xe-content of the Xe/CO2-mixture (90% / 10%)
154 Float_t fxc = .90;
155 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
156 Float_t fxi = .97;
fe4da5cc 157 Float_t dxe = .005858;
158
d3f347ff 159 // General tracking parameter
fe4da5cc 160 Float_t tmaxfd = -10.;
161 Float_t stemax = -1e10;
d3f347ff 162 Float_t deemax = -0.1;
163 Float_t epsil = 1e-4;
164 Float_t stmin = -0.001;
fe4da5cc 165
166 Float_t absl, radl, d, buf[1];
167 Float_t agm[2], dgm, zgm[2], wgm[2];
d3f347ff 168 Int_t nbuf;
fe4da5cc 169
d3f347ff 170 //////////////////////////////////////////////////////////////////////////
fe4da5cc 171 // Define Materials
d3f347ff 172 //////////////////////////////////////////////////////////////////////////
173
174 AliMaterial( 1, "Al $", 26.98, 13.0, 2.7 , 8.9 , 37.2);
175 AliMaterial( 2, "Air$", 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
176 AliMaterial( 4, "Xe $", 131.29, 54.0, dxe , 1447.59, 0.0);
177 AliMaterial( 5, "Cu $", 63.54, 29.0, 8.96 , 1.43, 14.8);
178 AliMaterial( 6, "C $", 12.01, 6.0, 2.265 , 18.8 , 74.4);
179 AliMaterial(12, "G10$", 20.00, 10.0, 1.7 , 19.4 , 999.0);
180
181 // Mixtures
182 AliMixture(3, "Polyethilene$", ape, zpe, dpe, -2, wpe);
183 AliMixture(7, "Mylar$", amy, zmy, dmy, -3, wmy);
184 AliMixture(8, "CO2$", aco, zco, dco, -2, wco);
185 AliMixture(9, "Isobutane$", ais, zis, dis, -2, wis);
186 AliMixture(13, "Water$" , awa, zwa, dwa, -2, wwa);
187
188 // Gas mixtures
fe4da5cc 189 char namate[21];
d3f347ff 190 // Xe/CO2-mixture
191 // Get properties of Xe
fe4da5cc 192 pMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
d3f347ff 193 // Get properties of CO2
fe4da5cc 194 pMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
d3f347ff 195 // Create gas mixture
196 wgm[0] = fxc;
197 wgm[1] = 1. - fxc;
fe4da5cc 198 dgm = wgm[0] * dxe + wgm[1] * dco;
d3f347ff 199 AliMixture(10, "Gas mixture 1$", agm, zgm, dgm, 2, wgm);
200 // Xe/Isobutane-mixture
201 // Get properties of Xe
202 pMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
203 // Get properties of Isobutane
204 pMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
205 // Create gas mixture
206 wgm[0] = fxi;
207 wgm[1] = 1. - fxi;
208 dgm = wgm[0] * dxe + wgm[1] * dis;
209 AliMixture(11, "Gas mixture 2$", agm, zgm, dgm, 2, wgm);
210
211 //////////////////////////////////////////////////////////////////////////
fe4da5cc 212 // Tracking Media Parameters
d3f347ff 213 //////////////////////////////////////////////////////////////////////////
214
215 // Al Frame
216 AliMedium(1301, "Al Frame$", 1, 0, ISXFLD, SXMGMX
217 , tmaxfd, stemax, deemax, epsil, stmin);
218 // Air
219 AliMedium(1302, "Air$", 2, 0, ISXFLD, SXMGMX
220 , tmaxfd, stemax, deemax, epsil, stmin);
221 // Polyethilene
222 AliMedium(1303, "Radiator$", 3, 0, ISXFLD, SXMGMX
223 , tmaxfd, stemax, deemax, epsil, stmin);
224 // Xe
225 AliMedium(1304, "Xe$", 4, 1, ISXFLD, SXMGMX
226 , tmaxfd, stemax, deemax, epsil, stmin);
227 // Cu pads
228 AliMedium(1305, "Padplane$", 5, 1, ISXFLD, SXMGMX
229 , tmaxfd, stemax, deemax, epsil, stmin);
230 // Fee + cables
231 AliMedium(1306, "Readout$", 1, 0, ISXFLD, SXMGMX
232 , tmaxfd, stemax, deemax, epsil, stmin);
233 // C frame
234 AliMedium(1307, "C Frame$", 6, 0, ISXFLD, SXMGMX
235 , tmaxfd, stemax, deemax, epsil, stmin);
236 // Mylar foils
237 AliMedium(1308, "Mylar$", 7, 0, ISXFLD, SXMGMX
238 , tmaxfd, stemax, deemax, epsil, stmin);
239 if (fGasMix == 1) {
240 // Gas-mixture (Xe/CO2)
241 AliMedium(1309, "Gas-mix$", 10, 1, ISXFLD, SXMGMX
242 , tmaxfd, stemax, deemax, epsil, stmin);
243 }
244 else {
245 // Gas-mixture (Xe/Isobutane)
246 AliMedium(1309, "Gas-mix$", 11, 1, ISXFLD, SXMGMX
247 , tmaxfd, stemax, deemax, epsil, stmin);
248 }
249 // Nomex-honeycomb (use carbon for the time being)
250 AliMedium(1310, "Nomex$", 6, 0, ISXFLD, SXMGMX
251 , tmaxfd, stemax, deemax, epsil, stmin);
252 // Kapton foils (use Mylar for the time being)
253 AliMedium(1311, "Kapton$", 7, 0, ISXFLD, SXMGMX
254 , tmaxfd, stemax, deemax, epsil, stmin);
255 // Gas-filling of the radiator
256 AliMedium(1312, "CO2$", 8, 0, ISXFLD, SXMGMX
257 , tmaxfd, stemax, deemax, epsil, stmin);
258 // G10-plates
259 AliMedium(1313, "G10-plates$",12, 0, ISXFLD, SXMGMX
260 , tmaxfd, stemax, deemax, epsil, stmin);
261 // Cooling water
262 AliMedium(1314, "Water$", 13, 0, ISXFLD, SXMGMX
263 , tmaxfd, stemax, deemax, epsil, stmin);
264
fe4da5cc 265}
266
267//_____________________________________________________________________________
268Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
269{
270 //
271 // Distance between the mouse and the TRD detector on the screen
272 // Dummy routine
273 //
274 return 9999;
275}
276
277//_____________________________________________________________________________
278void AliTRD::Init()
279{
280 //
281 // Initialise the TRD detector after the geometry has been created
282 //
283 Int_t i;
284 //
285 printf("\n");
286 for(i=0;i<35;i++) printf("*");
287 printf(" TRD_INIT ");
288 for(i=0;i<35;i++) printf("*");
289 printf("\n");
d3f347ff 290
fe4da5cc 291 // Here the TRD initialisation code (if any!)
d3f347ff 292 if (fGasMix == 1)
293 printf(" Gas Mixture: 90%% Xe + 10%% CO2\n");
294 else
295 printf(" Gas Mixture: 97%% Xe + 3%% Isobutane\n");
296 if (fSensPlane)
297 printf(" Only plane %d is sensitive\n",fSensPlane);
298 if (fSensChamber)
299 printf(" Only chamber %d is sensitive\n",fSensChamber);
300 if (fSensSector)
301 printf(" Only sector %d is sensitive\n",fSensSector);
302
fe4da5cc 303 for(i=0;i<80;i++) printf("*");
304 printf("\n");
305}
306
d3f347ff 307//_____________________________________________________________________________
308void AliTRD::SetGasMix(Int_t imix = 0)
309{
310
311 if ((imix < 0) || (imix > 1)) {
312 printf("Wrong input value: %d\n",imix);
313 printf("Use standard setting\n");
314 fGasMix = 0;
315 return;
316 }
317
318 fGasMix = imix;
319
320}
321
322//_____________________________________________________________________________
323void AliTRD::SetSensPlane(Int_t iplane = 0)
324{
325
326 if ((iplane < 0) || (iplane > 6)) {
327 printf("Wrong input value: %d\n",iplane);
328 printf("Use standard setting\n");
329 fSensPlane = 0;
330 fSensSelect = 0;
331 return;
332 }
333
334 fSensSelect = 1;
335 fSensPlane = iplane;
336
337}
338
339//_____________________________________________________________________________
340void AliTRD::SetSensChamber(Int_t ichamber = 0)
341{
342
343 if ((ichamber < 0) || (ichamber > 5)) {
344 printf("Wrong input value: %d\n",ichamber);
345 printf("Use standard setting\n");
346 fSensChamber = 0;
347 fSensSelect = 0;
348 return;
349 }
350
351 fSensSelect = 1;
352 fSensChamber = ichamber;
353
354}
355
356//_____________________________________________________________________________
357void AliTRD::SetSensSector(Int_t isector = 0)
358{
359
360 if ((isector < 0) || (isector > 18)) {
361 printf("Wrong input value: %d\n",isector);
362 printf("Use standard setting\n");
363 fSensSector = 0;
364 fSensSelect = 0;
365 return;
366 }
367
368 fSensSelect = 1;
369 fSensSector = isector;
370
371}
372
fe4da5cc 373ClassImp(AliTRDhit)
374
375//_____________________________________________________________________________
376AliTRDhit::AliTRDhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
377 AliHit(shunt, track)
378{
379 //
380 // Create a TRD hit
381 //
382
383 //
384 // Store volume hierarchy
385 fSector = vol[0];
386 fChamber = vol[1];
387 fPlane = vol[2];
388 //
389 // Store position and charge
390 fX = hits[0];
391 fY = hits[1];
392 fZ = hits[2];
393 fQ = hits[3];
394}