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