Introduced PDG code everywhere and use of TParticlePDG.
[u/mrichter/AliRoot.git] / ITS / AliITS.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Inner Traking System //
4// This class contains the base procedures for the Inner Tracking System //
5// //
6//Begin_Html
7/*
1439f98e 8<img src="picts/AliITSClass.gif">
fe4da5cc 9</pre>
10<br clear=left>
11<font size=+2 color=red>
12<p>The responsible person for this module is
13<a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
14</font>
15<pre>
16*/
17//End_Html
18// //
19///////////////////////////////////////////////////////////////////////////////
20
21#include <TMath.h>
22#include <TRandom.h>
23#include <TVector.h>
24#include <TGeometry.h>
25#include <TNode.h>
26#include <TTUBE.h>
27#include "GParticle.h"
28#include "AliITS.h"
29#include "AliRun.h"
30
31#include "TGeant3.h"
32
33ClassImp(AliITS)
34
35//_____________________________________________________________________________
36AliITS::AliITS() : AliDetector()
37{
38 //
39 // Default initialiser for ITS
40 //
41 fIshunt = 0;
42 fEuclidOut = 0;
43}
44
45//_____________________________________________________________________________
46AliITS::AliITS(const char *name, const char *title)
47 : AliDetector(name,title)
48{
49 //
50 // Default initialiser for ITS
51 //
52
53 fHits = new TClonesArray("AliITShit", 1560);
54 fDigits = new TClonesArray("AliITSdigit",1000);
55
56 fIshunt = 0;
57 fEuclidOut = 0;
58
59 fIdSens1 = fIdSens2 = fIdSens3 = fIdSens4 = fIdSens5 = fIdSens6 = 0;
60
61 SetMarkerColor(kRed);
62}
63
64//_____________________________________________________________________________
65AliITS::~AliITS()
66{
67 //
68 // Default distructor for ITS
69 //
70 delete fHits;
71 delete fDigits;
72}
73
74//_____________________________________________________________________________
75void AliITS::AddDigit(Int_t *tracks, Int_t *digits)
76{
77 //
78 // Add an ITS Digit
79 //
80 TClonesArray &ldigits = *fDigits;
81 new(ldigits[fNdigits++]) AliITSdigit(tracks,digits);
82}
83
84//_____________________________________________________________________________
85void AliITS::AddHit(Int_t track, Int_t *vol, Float_t *hits)
86{
87 //
88 // Add an ITS hit
89 //
90 TClonesArray &lhits = *fHits;
91 new(lhits[fNhits++]) AliITShit(fIshunt,track,vol,hits);
92}
93
94//_____________________________________________________________________________
95void AliITS::BuildGeometry()
96{
97 //
98 // Build ITS TNODE geometry for event display
99 //
100 TNode *Node, *Top;
101 const int kColorITS=kYellow;
102 //
103 Top=gAlice->GetGeometry()->GetNode("alice");
104
105 new TTUBE("S_layer1","Layer1 of ITS","void",3.9,3.9+0.05475,12.25);
106 Top->cd();
107 Node = new TNode("Layer1","Layer1","S_layer1",0,0,0,"");
108 Node->SetLineColor(kColorITS);
109 fNodes->Add(Node);
110
111 new TTUBE("S_layer2","Layer2 of ITS","void",7.6,7.6+0.05475,16.3);
112 Top->cd();
113 Node = new TNode("Layer2","Layer2","S_layer2",0,0,0,"");
114 Node->SetLineColor(kColorITS);
115 fNodes->Add(Node);
116
117 new TTUBE("S_layer3","Layer3 of ITS","void",14,14+0.05288,21.1);
118 Top->cd();
119 Node = new TNode("Layer3","Layer3","S_layer3",0,0,0,"");
120 Node->SetLineColor(kColorITS);
121 fNodes->Add(Node);
122
123 new TTUBE("S_layer4","Layer4 of ITS","void",24,24+0.05288,29.6);
124 Top->cd();
125 Node = new TNode("Layer4","Layer4","S_layer4",0,0,0,"");
126 Node->SetLineColor(kColorITS);
127 fNodes->Add(Node);
128
129 new TTUBE("S_layer5","Layer5 of ITS","void",40,40+0.05382,45.1);
130 Top->cd();
131 Node = new TNode("Layer5","Layer5","S_layer5",0,0,0,"");
132 Node->SetLineColor(kColorITS);
133 fNodes->Add(Node);
134
135 new TTUBE("S_layer6","Layer6 of ITS","void",45,45+0.05382,50.4);
136 Top->cd();
137 Node = new TNode("Layer6","Layer6","S_layer6",0,0,0,"");
138 Node->SetLineColor(kColorITS);
139 fNodes->Add(Node);
140}
141
142//_____________________________________________________________________________
143void AliITS::CreateMaterials()
144{
145 //
146 // Create ITS materials
147 //
148
149 Float_t awat[2] = { 1.00794,15.9994 };
150 Float_t zwat[2] = { 1.,8. };
151 Float_t wwat[2] = { 2.,1. };
152 Float_t denswat = 1.;
153 Float_t afre[2] = { 12.011,18.9984032 };
154 Float_t zfre[2] = { 6.,9. };
155 Float_t wfre[2] = { 5.,12. };
156 Float_t densfre = 1.5;
157 // 94.4% Al2O3 , 2.8% SiO2 , 2.3% MnO , 0.5% Cr2O3
158 Float_t acer[5] = { 26.981539,15.9994,28.0855,54.93805,51.9961 };
159 Float_t zcer[5] = { 13.,8.,14.,25., 24. };
160 Float_t wcer[5] = { .49976,1.01233,.01307, .01782,.00342 };
161 Float_t denscer = 3.6;
162 // 60% SiO2 , 40% G10FR4
163 Float_t apcb[3] = { 28.0855,15.9994,17.749 };
164 Float_t zpcb[3] = { 14.,8.,8.875 };
165 Float_t wpcb[3] = { .28,.32,.4 };
166 Float_t denspcb = 1.8;
167 Float_t apoly[2] = { 12.01,1. };
168 Float_t zpoly[2] = { 6.,1. };
169 Float_t wpoly[2] = { .33,.67 };
170 Float_t zserv[4] = { 1.,6.,26.,29. };
171 Float_t aserv[4] = { 1.,12.,55.8,63.5 };
172 Float_t wserv[4] = { .014,.086,.42,.48 };
173
174 Int_t ISXFLD = gAlice->Field()->Integ();
175 Float_t SXMGMX = gAlice->Field()->Max();
176
177
178 // --- Define the various materials for GEANT ---
179
180 // 200-224 --> Silicon Pixel Detectors (detectors, chips, buses, cooling,..)
181
182 AliMaterial(0, "SPD Si$", 28.0855, 14., 2.33, 9.36, 999);
183 AliMaterial(1, "SPD Si chip$", 28.0855, 14., 2.33, 9.36, 999);
184 AliMaterial(2, "SPD Si bus$", 28.0855, 14., 2.33, 9.36, 999);
185 AliMaterial(3, "SPD C$", 12.011, 6., 2.265,18.8, 999);
186 // v. dens
187 AliMaterial(4, "SPD Air$", 14.61, 7.3, .001205, 30423., 999);
188 AliMaterial(5, "SPD Vacuum$", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
189 AliMaterial(6, "SPD Al$", 26.981539, 13., 2.6989, 8.9, 999);
190 AliMixture( 7, "SPD Water $", awat, zwat, denswat, -2, wwat);
191 AliMixture( 8, "SPD Freon$", afre, zfre, densfre, -2, wfre);
192 // **
193 AliMedium(200, "SPD Si$", 0, 1, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
194 AliMedium(201, "SPD Si chip$", 1, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
195 AliMedium(202, "SPD Si bus$", 2, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
196 AliMedium(203, "SPD C$", 3, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
197 AliMedium(204, "SPD Air$", 4, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
198 AliMedium(205, "SPD Vacuum$", 5, 0, ISXFLD, SXMGMX, 10., 1., .1, .1, 10.);
199 AliMedium(206, "SPD Al$", 6, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
200 AliMedium(207, "SPD Water $", 7, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
201 AliMedium(208, "SPD Freon$", 8, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
202
203 // 225-249 --> Silicon Drift Detectors (detectors, chips, buses, cooling,..)
204
205 AliMaterial(25, "SDD Si$", 28.0855, 14., 2.33, 9.36, 999);
206 AliMaterial(26, "SDD Si chip$", 28.0855, 14., 2.33, 9.36, 999);
207 AliMaterial(27, "SDD Si bus$", 28.0855, 14., 2.33, 9.36, 999);
208 AliMaterial(28, "SDD C$", 12.011, 6., 2.265,18.8, 999);
209 // v. dens
210 AliMaterial(29, "SDD Air$", 14.61, 7.3, .001205, 30423., 999);
211 AliMaterial(30, "SDD Vacuum$", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
212 AliMaterial(31, "SDD Al$", 26.981539, 13., 2.6989, 8.9, 999);
213 // After a call with ratios by number (negative number of elements),
214 // the ratio array is changed to the ratio by weight, so all successive
215 // calls with the same array must specify the number of elements as
216 // positive
217 AliMixture(32, "SDD Water $", awat, zwat, denswat, 2, wwat);
218 // After a call with ratios by number (negative number of elements),
219 // the ratio array is changed to the ratio by weight, so all successive
220 // calls with the same array must specify the number of elements as
221 // positive
222 AliMixture( 33, "SDD Freon$", afre, zfre, densfre, 2, wfre);
223 AliMixture( 34, "SDD PCB$", apcb, zpcb, denspcb, 3, wpcb);
224 AliMaterial(35, "SDD Copper$", 63.546, 29., 8.96, 1.43, 999);
225 AliMixture( 36, "SDD Ceramics$", acer, zcer, denscer, -5, wcer);
226 AliMaterial(37, "SDD Kapton$", 12.011, 6., 1.3, 31.27, 999);
227 // **
228 // check A and Z
229 AliMedium(225, "SDD Si$", 25, 1, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
230 AliMedium(226, "SDD Si chip$", 26, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
231 AliMedium(227, "SDD Si bus$", 27, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
232 AliMedium(228, "SDD C$", 28, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
233 AliMedium(229, "SDD Air$", 29, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
234 AliMedium(230, "SDD Vacuum$", 30, 0, ISXFLD, SXMGMX, 10., 1., .1, .1, 10.);
235 AliMedium(231, "SDD Al$", 31, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
236 AliMedium(232, "SDD Water $", 32, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
237 AliMedium(233, "SDD Freon$", 33, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
238 AliMedium(234, "SDD PCB$", 34, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
239 AliMedium(235, "SDD Copper$", 35, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
240 AliMedium(236, "SDD Ceramics$",36, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
241 AliMedium(237, "SDD Kapton$", 37, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
242
243 // 250-274 --> Silicon Strip Detectors (detectors, chips, buses, cooling,..)
244
245 AliMaterial(50, "SSD Si$", 28.0855, 14., 2.33, 9.36, 999.);
246 AliMaterial(51, "SSD Si chip$", 28.0855, 14., 2.33, 9.36, 999.);
247 AliMaterial(52, "SSD Si bus$", 28.0855, 14., 2.33, 9.36, 999.);
248 AliMaterial(53, "SSD C$", 12.011, 6., 2.265,18.8, 999.);
249 // v. dens
250 AliMaterial(54, "SSD Air$", 14.61, 7.3, .001205, 30423., 999);
251 AliMaterial(55, "SSD Vacuum$", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
252 AliMaterial(56, "SSD Al$", 26.981539, 13., 2.6989, 8.9, 999);
253 // After a call with ratios by number (negative number of elements),
254 // the ratio array is changed to the ratio by weight, so all successive
255 // calls with the same array must specify the number of elements as
256 // positive
257 AliMixture(57, "SSD Water $", awat, zwat, denswat, 2, wwat);
258 // After a call with ratios by number (negative number of elements),
259 // the ratio array is changed to the ratio by weight, so all successive
260 // calls with the same array must specify the number of elements as
261 // positive
262 AliMixture(58, "SSD Freon$", afre, zfre, densfre, 2, wfre);
263 AliMixture(59, "SSD PCB$", apcb, zpcb, denspcb, 3, wpcb);
264 AliMaterial(60, "SSD Copper$", 63.546, 29., 8.96, 1.43, 999.);
265 // After a call with ratios by number (negative number of elements),
266 // the ratio array is changed to the ratio by weight, so all successive
267 // calls with the same array must specify the number of elements as
268 // positive
269 AliMixture( 61, "SSD Ceramics$", acer, zcer, denscer, 5, wcer);
270 AliMaterial(62, "SSD Kapton$", 12.011, 6., 1.3, 31.27, 999.);
271 // check A and Z
272 AliMaterial(63, "SDD G10FR4$", 17.749, 8.875, 1.8, 21.822, 999.);
273 // **
274 AliMedium(250, "SSD Si$", 50, 1, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
275 AliMedium(251, "SSD Si chip$", 51, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
276 AliMedium(252, "SSD Si bus$", 52, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
277 AliMedium(253, "SSD C$", 53, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
278 AliMedium(254, "SSD Air$", 54, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
279 AliMedium(255, "SSD Vacuum$", 55, 0, ISXFLD, SXMGMX, 10., 1., .1, .1, 10.);
280 AliMedium(256, "SSD Al$", 56, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
281 AliMedium(257, "SSD Water $", 57, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
282 AliMedium(258, "SSD Freon$", 58, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
283 AliMedium(259, "SSD PCB$", 59, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
284 AliMedium(260, "SSD Copper$", 60, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
285 AliMedium(261, "SSD Ceramics$",61, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
286 AliMedium(262, "SSD Kapton$", 62, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
287 AliMedium(263, "SSD G10FR4$", 63, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
288
289 // 275-299 --> General (end-caps, frames, cooling, cables, etc.)
290
291 AliMaterial(75, "GEN C$", 12.011, 6., 2.265, 18.8, 999.);
292 // verify density
293 AliMaterial(76, "GEN Air$", 14.61, 7.3, .001205, 30423., 999);
294 AliMaterial(77, "GEN Vacuum$", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
295 AliMixture( 78, "GEN POLYETHYL$", apoly, zpoly, .95, -2, wpoly);
296 AliMixture( 79, "GEN SERVICES$", aserv, zserv, 4.68, 4, wserv);
297 AliMaterial(80, "GEN Copper$", 63.546, 29., 8.96, 1.43, 999.);
298 // After a call with ratios by number (negative number of elements),
299 // the ratio array is changed to the ratio by weight, so all successive
300 // calls with the same array must specify the number of elements as
301 // positive
302 AliMixture(81, "GEN Water $", awat, zwat, denswat, 2, wwat);
303 // **
304 AliMedium(275, "GEN C$", 75, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
305 AliMedium(276, "GEN Air$", 76, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
306 AliMedium(277, "GEN Vacuum$", 77, 0, ISXFLD, SXMGMX, 10., .1, .1, .1, 10.);
307 AliMedium(278, "GEN POLYETHYL$", 78, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
308 AliMedium(279, "GEN SERVICES$", 79, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
309 AliMedium(280, "GEN Copper$", 80, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
310 AliMedium(281, "GEN Water $", 81, 0, ISXFLD, SXMGMX, 10., .01, .1, .003, .003);
311}
312
313//_____________________________________________________________________________
314Int_t AliITS::DistancetoPrimitive(Int_t , Int_t )
315{
316 //
317 // Distance from mouse to ITS on the screen. Dummy routine
318 //
319 return 9999;
320}
321
322//_____________________________________________________________________________
323void AliITS::Init()
324{
325 //
326 // Initialise ITS after it has been built
327 //
328 Int_t i;
329 AliMC* pMC = AliMC::GetMC();
330 //
331 printf("\n");
332 for(i=0;i<35;i++) printf("*");
333 printf(" ITS_INIT ");
334 for(i=0;i<35;i++) printf("*");
335 printf("\n");
336 //
337 //
338 fIdSens1=pMC->VolId("ITS1");
339 fIdSens2=pMC->VolId("ITS2");
340 fIdSens3=pMC->VolId("ITS3");
341 fIdSens4=pMC->VolId("ITS4");
342 fIdSens5=pMC->VolId("ITS5");
343 fIdSens6=pMC->VolId("ITS6");
344 //
345 for(i=0;i<80;i++) printf("*");
346 printf("\n");
347}
348
349//_____________________________________________________________________________
350void AliITS::MakeBranch(Option_t* option)
351{
352 //
353 // Create Tree branches for the ITS.
354 //
355 Int_t buffersize = 4000;
356 char branchname[10];
357 sprintf(branchname,"%s",GetName());
358
359 AliDetector::MakeBranch(option);
360
361 char *D = strstr(option,"D");
362
363 if (fDigits && gAlice->TreeD() && D) {
364 gAlice->TreeD()->Branch(branchname,&fDigits, buffersize);
365 printf("Making Branch %s for digits\n",branchname);
366 }
367}
368
369//_____________________________________________________________________________
370void AliITS::SetEUCLID(Bool_t euclid)
371{
372 //
373 // set euclid output flag
374 //
375 fEuclidOut=euclid;
376}
377
378ClassImp(AliITShit)
379
380//_____________________________________________________________________________
381AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
382 AliHit(shunt, track)
383{
384 //
385 // Create ITS hit
386 //
387 fLayer = vol[0]; // Layer number
388 fLadder = vol[2]; // Ladder number
389 fDet = vol[1]; // Detector number
390 fX = hits[0];
391 fY = hits[1];
392 fZ = hits[2];
393 fPx = hits[3];
394 fPy = hits[4];
395 fPz = hits[5];
396 fDestep = hits[6];
397}
398
399ClassImp(AliITSdigit)
400
401//_____________________________________________________________________________
402AliITSdigit::AliITSdigit(Int_t *tracks, Int_t *digits):
403 AliDigit(tracks)
404{
405 //
406 // Create ITS digit
407 //
408 fEvent = digits[0];
409 fLayer = digits[1];
410 fDet = digits[2];
411 fNoverl = digits[3];
412}