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