]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSv11.cxx
Runloader is updated when moving to next file (quick fix).
[u/mrichter/AliRoot.git] / ITS / AliITSv11.cxx
1 /**************************************************************************
2  * Copyright(c) 2007-2008, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16
17 //************************************************************************
18 //
19 //                 Inner Traking System geometry v11
20 //
21 //  Based on ROOT geometrical modeler
22 //
23 // B. Nilsen, L. Gaudichet
24 //************************************************************************
25
26
27 #include <TClonesArray.h>
28 #include <TLorentzVector.h>
29
30 #include "AliITS.h"
31 #include "AliITSDetTypeSim.h"
32 #include <TVirtualMC.h>
33
34 #include "AliITSgeom.h"
35 #include "AliITSgeomSDD.h"
36 #include "AliITSgeomSPD.h"
37 #include "AliITSgeomSSD.h"
38 #include "AliITShit.h"
39
40 #include "AliITSCalibrationSDD.h"
41
42 #include "AliITSsegmentationSDD.h"
43 #include "AliITSsegmentationSPD.h"
44 #include "AliITSsegmentationSSD.h"
45 #include "AliMagF.h"
46 #include "AliRun.h"
47 #include "AliTrackReference.h"
48 #include "AliMC.h"
49
50 #include <TGeoManager.h>
51 #include <TGeoVolume.h>
52 #include <TGeoPcon.h>
53 #include "AliITSv11.h"
54 //#include "AliITSv11GeometrySPD.h"
55 #include "AliITSv11GeometrySDD.h"
56 //#include "AliITSv11GeometrySupport.h"
57
58
59
60 ClassImp(AliITSv11)
61  
62
63
64 //______________________________________________________________________
65 AliITSv11::AliITSv11() : AliITS(),
66   fGeomDetOut(kFALSE),
67   fGeomDetIn(kFALSE),
68   fByThick(kTRUE),
69   fMajorVersion(11),
70   fMinorVersion(0),
71   fSDDgeom(0)
72 {
73   //    Standard default constructor for the ITS version 11.
74
75     fIdN          = 0;
76     fIdName       = 0;
77     fIdSens       = 0;
78     fEuclidOut    = kFALSE; // Don't write Euclide file
79     Int_t i;
80     for(i=0;i<60;i++) fRead[i] = '\0';
81     for(i=0;i<60;i++) fWrite[i] = '\0';
82     for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
83     strncpy(fRead,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det",60);
84 }
85
86
87 //______________________________________________________________________
88 AliITSv11::AliITSv11(const char *name, const char *title)
89   : AliITS("ITS", title),
90     fGeomDetOut(kFALSE),
91     fGeomDetIn(kFALSE),
92     fByThick(kTRUE),
93     fMajorVersion(11),
94     fMinorVersion(0),
95     fSDDgeom(0)
96 {
97   //    Standard constructor for the ITS version 11.
98
99   fSDDgeom = new AliITSv11GeometrySDD(0);
100
101   Int_t i;
102   fIdN = 6;
103   fIdName = new TString[fIdN];
104   fIdName[0] = name; // removes warning message
105   fIdName[0] = "ITS1";
106   fIdName[1] = "ITS2";
107   fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
108   fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
109   fIdName[4] = "ITS5";
110   fIdName[5] = "ITS6";
111   fIdSens    = new Int_t[fIdN];
112   for(i=0;i<fIdN;i++) fIdSens[i] = 0;
113   fEuclidOut    = kFALSE; // Don't write Euclide file
114   //SetDensityServicesByThickness();
115   // not needed, fByThick set to kTRUE in in the member initialization lis
116   
117
118   fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.euc";
119   strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det",60);
120   strncpy(fRead,fEuclidGeomDet,60);
121   strncpy(fWrite,fEuclidGeomDet,60);
122   strncpy(fRead,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det",60);
123 }
124
125
126 //______________________________________________________________________
127 AliITSv11::AliITSv11(Int_t debugITS,Int_t debugSPD,Int_t debugSDD,
128                    Int_t debugSSD,Int_t debugSUP) :
129   AliITS("ITS","ITS geometry v11"),
130     fGeomDetOut(kFALSE),
131     fGeomDetIn(kFALSE),
132     fByThick(kTRUE),
133     fMajorVersion(11),
134     fMinorVersion(0),
135     fSDDgeom(0)
136  {
137   // Standard default constructor for the ITS version 11.
138
139
140   //   fSPDgeom = new AliITSv11GeometrySPD(debugSPD);
141   fSDDgeom = new AliITSv11GeometrySDD(debugSDD);
142   fSDDgeom->SetDebug(debugSDD);
143   //   fSupgeom = new AliITSv11GeometrySupport(debugSUP);
144
145   Int_t i;
146   fIdN = 6;
147   fIdName = new TString[fIdN];
148   fIdName[0] = "ITS1";
149   fIdName[1] = "ITS2";
150   fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
151   fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
152   fIdName[4] = "ITS5";
153   fIdName[5] = "ITS6";
154   fIdSens    = new Int_t[fIdN];
155   for(i=0;i<fIdN;i++) fIdSens[i] = 0;
156   fEuclidOut    = kFALSE; // Don't write Euclide file
157   //SetDensityServicesByThickness();
158   
159   fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.euc";
160   strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det",60);
161   strncpy(fRead,fEuclidGeomDet,60);
162   strncpy(fWrite,fEuclidGeomDet,60);
163   strncpy(fRead,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det",60);
164
165   debugITS = (debugSPD && debugSSD && debugSUP && debugSDD); //remove temp. warnings
166 }
167
168
169 //______________________________________________________________________
170 AliITSv11::~AliITSv11() {
171   delete fSDDgeom;
172 }
173
174
175 //______________________________________________________________________
176 void AliITSv11::BuildGeometry(){
177
178 }
179
180
181 //______________________________________________________________________
182 void AliITSv11::CreateGeometry(){
183   //
184   // Create ROOT geometry
185   //
186
187   TGeoManager *geoManager = gGeoManager;
188   TGeoVolume *vALIC = geoManager->GetTopVolume();
189
190   TGeoPcon *sITS = new TGeoPcon("ITS Top Volume",0.0,360.0,2);
191
192   // DefineSection(section number, Z, Rmin, Rmax).
193   const Double_t kcm = 1.0;
194   sITS->DefineSection(0,-300.0*kcm,0.01*kcm,50.0*kcm);
195   sITS->DefineSection(1,+300.0*kcm,0.01*kcm,50.0*kcm);
196
197   TGeoMedium *air = gGeoManager->GetMedium("ITS_AIR$");
198   TGeoVolume *vITS = new TGeoVolume("ITSV",sITS,air);
199   vITS->SetVisibility(kFALSE);
200   vALIC->AddNode(vITS,1,0);
201
202 //   fSPDgeom->CenteralSPD(vITS);
203
204   fSDDgeom->Layer3(vITS);
205   fSDDgeom->Layer4(vITS);
206
207 //     fSupgeom->SPDCone(vITS);
208 //     fSupgeom->SPDThermalSheald(vITS);
209 //     fSupgeom->SDDCone(vITS);
210 //     fSupgeom->SSDCone(vITS);
211 //     fSupgeom->ServicesCableSupport(vITS);
212
213 }
214
215
216 //______________________________________________________________________
217 void AliITSv11::CreateMaterials(){
218   //
219   // Create ITS materials
220   // Defined media here should correspond to the one defined in galice.cuts
221   // File which is red in (AliMC*) fMCApp::Init() { ReadTransPar(); }
222   //
223
224 //     Int_t   ifield = gAlice->Field()->Integ();
225 //     Float_t fieldm = gAlice->Field()->Max();
226
227 //     Float_t tmaxfd = 0.1; // 1.0; // Degree
228 //     Float_t stemax = 1.0; // cm
229 //     Float_t deemax = 0.1; // 30.0; // Fraction of particle's energy 0<deemax<=1
230 //     Float_t epsil  = 1.0E-4; // 1.0; // cm
231 //     Float_t stmin  = 0.0; // cm "Default value used"
232
233 //     Float_t tmaxfdSi = 0.1; // .10000E+01; // Degree
234 //     Float_t stemaxSi = 0.0075; //  .10000E+01; // cm
235 //     Float_t deemaxSi = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
236 //     Float_t epsilSi  = 1.0E-4;// .10000E+01;
237 //     Float_t stminSi  = 0.0; // cm "Default value used"
238
239 //     Float_t tmaxfdAir = 0.1; // .10000E+01; // Degree
240 //     Float_t stemaxAir = .10000E+01; // cm
241 //     Float_t deemaxAir = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
242 //     Float_t epsilAir  = 1.0E-4;// .10000E+01;
243 //     Float_t stminAir  = 0.0; // cm "Default value used"
244
245 //     Float_t tmaxfdServ = 1.0; // 10.0; // Degree
246 //     Float_t stemaxServ = 1.0; // 0.01; // cm
247 //     Float_t deemaxServ = 0.5; // 0.1; // Fraction of particle's energy 0<deemax<=1
248 //     Float_t epsilServ  = 1.0E-3; // 0.003; // cm
249 //     Float_t stminServ  = 0.0; //0.003; // cm "Default value used"
250
251 //     // Freon PerFluorobuthane C4F10 see 
252 //     // http://st-support-cooling-electronics.web.cern.ch/
253 //     //        st-support-cooling-electronics/default.htm
254 //     Float_t afre[2]  = { 12.011,18.9984032 };
255 //     Float_t zfre[2]  = { 6., 9. };
256 //     Float_t wfre[2]  = { 4.,10. };
257 //     Float_t densfre  = 1.52;
258
259
260 //     //CM55J
261 //     Float_t aCM55J[4]={12.0107,14.0067,15.9994,1.00794};
262 //     Float_t zCM55J[4]={6.,7.,8.,1.};
263 //     Float_t wCM55J[4]={0.908508078,0.010387573,0.055957585,0.025146765};
264 //     Float_t dCM55J = 1.63;
265
266 //     //ALCM55J
267 //     Float_t aALCM55J[5]={12.0107,14.0067,15.9994,1.00794,26.981538};
268 //     Float_t zALCM55J[5]={6.,7.,8.,1.,13.};
269 //     Float_t wALCM55J[5]={0.817657902,0.0093488157,0.0503618265,0.0226320885,0.1};
270 //     Float_t dALCM55J = 1.9866;
271
272 //     //Si Chips
273 //     Float_t aSICHIP[6]={12.0107,14.0067,15.9994,1.00794,28.0855,107.8682};
274 //     Float_t zSICHIP[6]={6.,7.,8.,1.,14., 47.};
275 //     Float_t wSICHIP[6]={0.039730642,0.001396798,0.01169634,
276 //                      0.004367771,0.844665,0.09814344903};
277 //     Float_t dSICHIP = 2.36436;
278
279 //     //Inox
280 //     Float_t aINOX[9]={12.0107,54.9380, 28.0855,30.9738,32.066,
281 //                    58.6928,55.9961,95.94,55.845};
282 //     Float_t zINOX[9]={6.,25.,14.,15.,16., 28.,24.,42.,26.};
283 //     Float_t wINOX[9]={0.0003,0.02,0.01,0.00045,0.0003,0.12,0.17,0.025,0.654};
284 //     Float_t dINOX = 8.03;
285
286 //     //SDD HV microcable
287 //     Float_t aHVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
288 //     Float_t zHVm[5]={6.,1.,7.,8.,13.};
289 //     Float_t wHVm[5]={0.520088819984,0.01983871336,0.0551367996,0.157399667056, 0.247536};
290 //     Float_t dHVm = 1.6087;
291
292 //     //SDD LV+signal cable
293 //     Float_t aLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
294 //     Float_t zLVm[5]={6.,1.,7.,8.,13.};
295 //     Float_t wLVm[5]={0.21722436468,0.0082859922,0.023028867,0.06574077612, 0.68572};
296 //     Float_t dLVm = 2.1035;
297
298 //     //SDD hybrid microcab
299 //     Float_t aHLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
300 //     Float_t zHLVm[5]={6.,1.,7.,8.,13.};
301 //     Float_t wHLVm[5]={0.24281879711,0.00926228815,0.02574224025,0.07348667449, 0.64869};
302 //     Float_t dHLVm = 2.0502;
303
304 //     //SDD anode microcab
305 //     Float_t aALVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
306 //     Float_t zALVm[5]={6.,1.,7.,8.,13.};
307 //     Float_t wALVm[5]={0.392653705471,0.0128595919215,
308 //                    0.041626868025,0.118832707289, 0.431909};
309 //     Float_t dALVm = 2.0502;
310
311 //     //X7R capacitors
312 //     Float_t aX7R[7]={137.327,47.867,15.9994,58.6928,63.5460,118.710,207.2};
313 //     Float_t zX7R[7]={56.,22.,8.,28.,29.,50.,82.};
314 //     Float_t wX7R[7]={0.251639432,0.084755042,0.085975822,
315 //                   0.038244751,0.009471271,0.321736471,0.2081768};
316 //     Float_t dX7R = 7.14567;
317
318 //     // AIR
319 //     Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
320 //     Float_t zAir[4]={6.,7.,8.,18.};
321 //     Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
322 //     Float_t dAir = 1.20479E-3;
323
324 //     // Water
325 //     Float_t aWater[2]={1.00794,15.9994};
326 //     Float_t zWater[2]={1.,8.};
327 //     Float_t wWater[2]={0.111894,0.888106};
328 //     Float_t dWater   = 1.0;
329
330 //     // CERAMICS
331 //   //     94.4% Al2O3 , 2.8% SiO2 , 2.3% MnO , 0.5% Cr2O3
332 //     Float_t acer[5]  = { 26.981539,15.9994,28.0855,54.93805,51.9961 };
333 //     Float_t zcer[5]  = {       13.,     8.,    14.,     25.,    24. };
334 //     Float_t wcer[5]  = {.4443408,.5213375,.0130872,.0178135,.003421};
335 //     Float_t denscer  = 3.6;
336
337 //     //G10FR4
338 //     Float_t zG10FR4[14] = {14.00,    20.00,  13.00,  12.00,  5.00,
339 //                         22.00,       11.00,  19.00,  26.00,  9.00,
340 //                         8.00,        6.00,   7.00,   1.00};
341 //     Float_t aG10FR4[14] = {28.0855000,40.0780000,26.9815380,24.3050000,
342 //                         10.8110000,47.8670000,22.9897700,39.0983000,
343 //                         55.8450000,18.9984000,15.9994000,12.0107000,
344 //                         14.0067000,1.0079400};
345 //     Float_t wG10FR4[14] = {0.15144894,0.08147477,0.04128158,0.00904554,
346 //                         0.01397570,0.00287685,0.00445114,0.00498089,
347 //                         0.00209828,0.00420000,0.36043788,0.27529426,
348 //                         0.01415852,0.03427566};
349 //     Float_t densG10FR4= 1.8;
350     
351 //      //--- EPOXY  --- C18 H19 O3
352 //       Float_t aEpoxy[3] = {15.9994, 1.00794, 12.0107} ; 
353 //       Float_t zEpoxy[3] = {     8.,      1.,      6.} ; 
354 //       Float_t wEpoxy[3] = {     3.,     19.,     18.} ; 
355 //       Float_t dEpoxy = 1.8 ;
356
357 //       // rohacell: C9 H13 N1 O2
358 //     Float_t arohac[4] = {12.01,  1.01, 14.010, 16.};
359 //     Float_t zrohac[4] = { 6.,    1.,    7.,     8.};
360 //     Float_t wrohac[4] = { 9.,   13.,    1.,     2.};
361 //     Float_t drohac    = 0.05;
362
363 //     // If he/she means stainless steel (inox) + Aluminium and Zeff=15.3383 then
364 // //
365 // // %Al=81.6164 %inox=100-%Al
366
367 //     Float_t aInAl[5] = {27., 55.847,51.9961,58.6934,28.0855 };
368 //     Float_t zInAl[5] = {13., 26.,24.,28.,14. };
369 //     Float_t wInAl[5] = {.816164, .131443,.0330906,.0183836,.000919182};
370 //     Float_t dInAl    = 3.075;
371
372 //     // Kapton
373 //     Float_t aKapton[4]={1.00794,12.0107, 14.010,15.9994};
374 //     Float_t zKapton[4]={1.,6.,7.,8.};
375 //     Float_t wKapton[4]={0.026362,0.69113,0.07327,0.209235};
376 //     Float_t dKapton   = 1.42;
377
378 //     //SDD ruby sph.
379 //     Float_t aAlOxide[2]  = { 26.981539,15.9994};
380 //     Float_t zAlOxide[2]  = {       13.,     8.};
381 //     Float_t wAlOxide[2]  = {0.4707, 0.5293};
382 //     Float_t dAlOxide     = 3.97;
383
384 //     //---------
385 //     AliMaterial(1,"ITSsddSi",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
386 //     AliMedium(1,"ITSsddSi",1,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
387     
388 //     AliMixture(5,"ITSair",aAir,zAir,dAir,4,wAir);
389 //     AliMedium(5,"ITSair",5,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
390     
391 //     AliMixture(7,"ITSsddSiChip",aSICHIP,zSICHIP,dSICHIP,6,wSICHIP);
392 //     AliMedium(7,"ITSsddSiChip",7,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
393
394 //     AliMaterial(79,"SDD SI insensitive$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
395 //     AliMedium(79,"SDD SI insensitive$",79,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
396
397 //     AliMaterial(11,"ITSal",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
398 //     AliMedium(11,"ITSal",11,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
399
400 //     AliMixture(9,"ITSsddCarbonM55J",aCM55J,zCM55J,dCM55J,4,wCM55J);
401 //     AliMedium(9,"ITSsddCarbonM55J",9,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
402
403 //     AliMixture(10,"SDD AIR$",aAir,zAir,dAir,4,wAir);
404 //     AliMedium(10,"SDD AIR$",10,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
405
406 //     AliMixture(12, "WATER",aWater,zWater,dWater,2,wWater);
407 //     AliMedium(12,"WATER",12,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
408
409 //      AliMixture(69,"ITSsddCAlM55J",aALCM55J,zALCM55J,dALCM55J,5,wALCM55J);
410 //     AliMedium(69,"ITSsddCAlM55J",69,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
411   
412 //     AliMixture(70, "ITSsddKAPTON_POLYCH2", aKapton, zKapton, dKapton, 4, wKapton);
413 //     AliMedium(70,"ITSsddKAPTON_POLYCH2",70,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
414
415 //     AliMixture(77,"SDDX7Rcapacitors",aX7R,zX7R,dX7R,7,wX7R);
416 //     AliMedium(77,"SDDX7Rcapacitors",77,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
417
418 //     AliMixture(78,"SDD ruby sph. Al2O3$",aAlOxide,zAlOxide,dAlOxide,2,wAlOxide);
419 //     AliMedium(78,"SDD ruby sph. Al2O3$",78,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
420
421
422 //     AliMaterial(64,"ALUMINUM$",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
423 //     AliMedium(64,"ALUMINUM$",64,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
424
425 //     AliMaterial(14,"COPPER",0.63546E+02,0.29000E+02,0.89600E+01,0.14300E+01,0.99900E+03);
426 //     AliMedium(14,"COPPER",14,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
427
428 //     AliMaterial(2,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
429 //     AliMedium(2,"SPD SI CHIP$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
430
431 //     AliMaterial(3,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
432 //     AliMedium(3,"SPD SI BUS$",3,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
433
434 //     AliMixture(4,"C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
435 //     AliMedium(4,"C (M55J)$",4,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
436
437  
438 //     AliMixture(6,"GEN AIR$",aAir,zAir,dAir,4,wAir);
439 //     AliMedium(6,"GEN AIR$",6,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
440
441 //     AliMixture(13,"Freon$",afre,zfre,densfre,-2,wfre);
442 //     AliMedium(13,"Freon$",13,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
443
444
445 //     AliMixture(15,"CERAMICS$",acer,zcer,denscer,5,wcer);
446 //     AliMedium(15,"CERAMICS$",15,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
447
448 //     AliMixture(20,"SSD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
449 //     AliMedium(20,"SSD C (M55J)$",20,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
450
451 //     AliMixture(21,"SSD AIR$",aAir,zAir,dAir,4,wAir);
452 //     AliMedium(21,"SSD AIR$",21,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
453
454 //     AliMixture(25,"G10FR4$",aG10FR4,zG10FR4,densG10FR4,14,wG10FR4);
455 //     AliMedium(25,"G10FR4$",25,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
456
457 //      AliMixture(26,"GEN C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
458 //     AliMedium(26,"GEN C (M55J)$",26,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
459
460 //     AliMixture(27,"GEN Air$",aAir,zAir,dAir,4,wAir);
461 //     AliMedium(27,"GEN Air$",27,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
462
463 //     AliMaterial(51,"SPD SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
464 //     AliMedium(51,"SPD SI$",51,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
465
466 //     AliMaterial(52,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
467 //     AliMedium(52,"SPD SI CHIP$",52,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
468
469 //     AliMaterial(53,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
470 //     AliMedium(53,"SPD SI BUS$",53,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
471
472 //     AliMixture(54,"SPD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
473 //     AliMedium(54,"SPD C (M55J)$",54,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
474
475 //     AliMixture(55,"SPD AIR$",aAir,zAir,dAir,4,wAir);
476 //     AliMedium(55,"SPD AIR$",55,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
477
478 //     AliMixture(56, "SPD KAPTON(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
479 //     AliMedium(56,"SPD KAPTON(POLYCH2)$",56,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
480
481 //     AliMixture(61,"EPOXY$",aEpoxy,zEpoxy,dEpoxy,-3,wEpoxy);
482 //     AliMedium(61,"EPOXY$",61,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
483
484 //     AliMaterial(62,"SILICON$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
485 //     AliMedium(62,"SILICON$",62,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
486
487 //     AliMixture(63, "KAPTONH(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
488 //     AliMedium(63,"KAPTONH(POLYCH2)$",63,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
489
490
491 //     AliMixture(65,"INOX$",aINOX,zINOX,dINOX,9,wINOX);
492 //     AliMedium(65,"INOX$",65,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
493
494 //     AliMixture(68,"ROHACELL$",arohac,zrohac,drohac,-4,wrohac);
495 //     AliMedium(68,"ROHACELL$",68,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
496
497
498 //      AliMaterial(71,"ITS SANDW A$",0.12011E+02,0.60000E+01,0.2115E+00,0.17479E+03,0.99900E+03);
499 //     AliMedium(71,"ITS SANDW A$",71,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
500
501 //     AliMaterial(72,"ITS SANDW B$",0.12011E+02,0.60000E+01,0.27000E+00,0.18956E+03,0.99900E+03);
502 //     AliMedium(72,"ITS SANDW B$",72,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
503
504 //     AliMaterial(73,"ITS SANDW C$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
505 //     AliMedium(73,"ITS SANDW C$",73,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
506
507 //     AliMaterial(74,"HEAT COND GLUE$",0.12011E+02,0.60000E+01,0.1930E+01,0.22100E+02,0.99900E+03);
508 //     AliMedium(74,"HEAT COND GLUE$",74,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
509
510 //     AliMaterial(75,"ELASTO SIL$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
511 //     AliMedium(75,"ELASTO SIL$",75,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
512
513 //     AliMaterial(76,"SPDBUS(AL+KPT+EPOX)$",0.19509E+02,0.96502E+01,0.19060E+01,0.15413E+02,0.99900E+03);
514 //     AliMedium(76,"SPDBUS(AL+KPT+EPOX)$",76,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
515                
516
517 //     AliMixture(80,"SDD HV microcable$",aHVm,zHVm,dHVm,5,wHVm);
518 //     AliMedium(80,"SDD HV microcable$",80,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
519
520 //     AliMixture(81,"SDD LV+signal cable$",aLVm,zLVm,dLVm,5,wLVm);
521 //     AliMedium(81,"SDD LV+signal cable$",81,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
522
523 //     AliMixture(82,"SDD hybrid microcab$",aHLVm, zHLVm,dHLVm,5,wHLVm);
524 //     AliMedium(82,"SDD hybrid microcab$",82,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
525
526 //     AliMixture(83,"SDD anode microcab$",aALVm,zALVm,dALVm,5,wALVm);
527 //     AliMedium(83,"SDD anode microcab$",83,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
528
529 //     AliMaterial(84,"SDD/SSD rings$",0.123565E+02,0.64561E+01,0.18097E+01,0.229570E+02,0.99900E+03);
530 //     AliMedium(84,"SDD/SSD rings$",84,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
531
532 //     AliMixture(85,"inox/alum$",aInAl,zInAl,dInAl,5,wInAl);
533 //     AliMedium(85,"inox/alum$",85,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
534
535
536 //     // special media to take into account services in the SDD and SSD 
537 //     // cones for the FMD
538
539 //        Float_t aA[13],zZ[13],wW[13],den;
540 //     // From Pierluigi Barberis calculations of 2SPD+1SDD October 2 2002.
541 //     zZ[0] = 1.0; aA[0] = 1.00794; // Hydrogen
542 //     zZ[1] = 6.0; aA[1] = 12.011; // Carbon
543 //     zZ[2] = 7.0; aA[2] = 14.00674; // Nitrogen
544 //     zZ[3] = 8.0; aA[3] = 15.9994; // Oxigen
545 //     zZ[4] = 14.0; aA[4] = 28.0855; // Silicon
546 //     zZ[5] = 24.0; aA[5] = 51.9961; //Cromium
547 //     zZ[6] = 25.0; aA[6] = 54.938049; // Manganese
548 //     zZ[7] = 26.0; aA[7] = 55.845; // Iron
549 //     zZ[8] = 28.0; aA[8] = 58.6934; // Nickle
550 //     zZ[9] = 29.0; aA[9] = 63.546; // Copper
551 //     zZ[10] = 13.0; aA[10] = 26.981539; // Alulminum
552 //     zZ[11] = 47.0; aA[11] = 107.8682; // Silver
553 //     zZ[12] = 27.0; aA[12] = 58.9332; // Cobolt
554 //     wW[0] = 0.019965;
555 //     wW[1] = 0.340961;
556 //     wW[2] = 0.041225;
557 //     wW[3] = 0.200352;
558 //     wW[4] = 0.000386;
559 //     wW[5] = 0.001467;
560 //     wW[6] = 0.000155;
561 //     wW[7] = 0.005113;
562 //     wW[8] = 0.000993;
563 //     wW[9] = 0.381262;
564 //     wW[10] = 0.008121;
565 //     wW[11] = 0.000000;
566 //     wW[12] = 0.000000;
567 //     if(fByThick){// New values seeITS_MatBudget_4B.xls
568 //      den = 1.5253276; // g/cm^3  Cell O370
569 //     }else{
570 //      den = 2.58423412; // g/cm^3 Cell L370
571 //     } // end if fByThick
572 //     //den = 6161.7/(3671.58978);//g/cm^3 Volume does not exclude holes
573 //     AliMixture(86,"AIRFMDSDD$",aA,zZ,den,+11,wW);
574 //     AliMedium(86,"AIRFMDSDD$",86,0,ifield,fieldm,tmaxfdAir,stemaxAir,
575 //            deemaxAir,epsilAir,stminAir);
576
577
578 //     wW[0] = 0.019777;
579 //     wW[1] = 0.325901;
580 //     wW[2] = 0.031848;
581 //     wW[3] = 0.147668;
582 //     wW[4] = 0.030609;
583 //     wW[5] = 0.013993;
584 //     wW[6] = 0.001479;
585 //     wW[7] = 0.048792;
586 //     wW[8] = 0.009477;
587 //     wW[9] = 0.350697;
588 //     wW[10] = 0.014546;
589 //     wW[11] = 0.005213;
590 //     wW[12] = 0.000000;
591 //     if(fByThick){// New values seeITS_MatBudget_4B.xls
592 //      den = 1.2464275; // g/cm^3   Cell O403
593 //     }else{
594 //      den = 1.28134409; // g/cm^3  Cell L403
595 //     } // end if fByThick
596 //     //den = 7666.3/(9753.553259); // volume does not exclude holes
597 //     AliMixture(87,"AIRFMDSSD$",aA,zZ,den,+12,wW); 
598 //     AliMedium(87,"AIRFMDSSD$",87,0,ifield,fieldm,tmaxfdAir,stemaxAir,
599 //            deemaxAir,epsilAir,stminAir);
600
601 //     wW[0] = 0.016302;
602 //     wW[1] = 0.461870;
603 //     wW[2] = 0.033662;
604 //     wW[3] = 0.163595;
605 //     wW[4] = 0.000315;
606 //     wW[5] = 0.001197;
607 //     wW[6] = 0.000127;
608 //     wW[7] = 0.004175;
609 //     wW[8] = 0.000811;
610 //     wW[9] = 0.311315;
611 //     wW[10] = 0.006631;
612 //     wW[11] = 0.000000;
613 //     wW[12] = 0.000000;
614 //     if(fByThick){// New values seeITS_MatBudget_4B.xls
615 //      den = 1.9353276; // g/cm^3  Cell N370
616 //     }else{
617 //      den = 3.2788626; // g/cm^3 Cell F370
618 //     } // end if fByThick
619 //     //den = 7667.1/(3671.58978); // Volume does not excludeholes
620 //     AliMixture(88,"ITS SANDW CFMDSDD$",aA,zZ,den,+11,wW); 
621 //     AliMedium(88,"ITS SANDW CFMDSDD$",88,0,ifield,fieldm,tmaxfd,stemax,
622 //            deemax,epsil,stmin);
623
624 //     wW[0] = 0.014065;
625 //     wW[1] = 0.520598;
626 //     wW[2] = 0.022650;
627 //     wW[3] = 0.105018;
628 //     wW[4] = 0.021768;
629 //     wW[5] = 0.009952;
630 //     wW[6] = 0.001051;
631 //     wW[7] = 0.034700;
632 //     wW[8] = 0.006740;
633 //     wW[9] = 0.249406;
634 //     wW[10] = 0.010345;
635 //     wW[11] = 0.0003707;
636 //     wW[12] = 0.000000;
637 //     if(fByThick){// New values seeITS_MatBudget_4B.xls
638 //      den = 1.6564275; // g/cm^3  Cell N304
639 //     }else{
640 //      den = 1.7028296; // g/cm^3  Cell F304
641 //     } // end if fByThick
642 //     //den = 1166.5/(3671.58978); // Volume does not exclude holes
643 //     AliMixture(89,"ITS SANDW CFMDSSD$",aA,zZ,den,+12,wW); 
644 //     AliMedium(89,"ITS SANDW CFMDSSD$",89,0,ifield,fieldm,tmaxfd,stemax,
645 //            deemax,epsil,stmin);
646
647 //     wW[0] = 0.005970;
648 //     wW[1] = 0.304704;
649 //     wW[2] = 0.042510;
650 //     wW[3] = 0.121715;
651 //     wW[4] = 0.001118;
652 //     wW[5] = 0.030948;
653 //     wW[6] = 0.003270;
654 //     wW[7] = 0.107910;
655 //     wW[8] = 0.020960;
656 //     wW[9] = 0.360895;
657 //     wW[10] = 0.000000;
658 //     wW[11] = 0.000000;
659 //     wW[12] = 0.000000;
660 //     if(fByThick){// New values seeITS_MatBudget_4B.xls
661 //      den = 80.31136576; // g/cm^3 Cell H329
662 //     }else{
663 //      den = 87.13062; // g/cm^3  Cell G329
664 //     } // end if fByThick
665 //     //den = 1251.3/(0.05*2.0*TMath::Pi()*(7.75*7.75 - 3.7*3.7)); // g/cm^3
666 //     AliMixture(97,"SPD SERVICES$",aA,zZ,den,+10,wW); 
667 //     AliMedium(97,"SPD SERVICES$",97,0,ifield,fieldm,tmaxfd,stemax,
668 //            deemax,epsil,stmin);
669
670 //     // Special media
671
672 //     AliMaterial(90,"SPD shield$", 12.011, 6., 1.93/10. , 22.1*10., 999);
673 //     AliMedium(90,"SPD shield$",90,0,ifield,fieldm,tmaxfdServ,stemaxServ,
674 //            deemaxServ,epsilServ,stminServ);
675
676 //     AliMaterial(91, "SPD End ladder$", 47.0447, 21.7963, 3.6374, 4.4711, 999); 
677 //     AliMedium(91,"SPD End ladder$",91,0,ifield,fieldm,tmaxfdServ,stemaxServ,
678 //            deemaxServ,epsilServ,stminServ);
679
680 //     AliMaterial(92, "SPD cone$",28.0855, 14., 2.33, 9.36, 999);    
681 //     AliMedium(92,"SPD cone$",92,0,ifield,fieldm,tmaxfdServ,stemaxServ,
682 //            deemaxServ,epsilServ,stminServ);
683
684 // //     Material with fractional Z not actually used
685 // //     AliMaterial(93, "SDD End ladder$", 69.9298, 29.8246, 0.3824, 36.5103, 999);
686 // //     AliMedium(93,"SDD End ladder$",93,0,ifield,fieldm,tmaxfdServ,stemaxServ,
687 // //               deemaxServ,epsilServ,stminServ);
688
689 //     AliMaterial(94, "SDD cone$",63.546, 29., 1.15, 1.265, 999);
690 //     AliMedium(94,"SDD cone$",94,0,ifield,fieldm,tmaxfdServ,stemaxServ,
691 //            deemaxServ,epsilServ,stminServ);
692
693 // //     Material with fractional Z not actually used
694 // //     AliMaterial(95, "SSD End ladder$", 32.0988, 15.4021, 0.68, 35.3238, 999); 
695 // //     AliMedium(95,"SSD End ladder$",95,0,ifield,fieldm,tmaxfdServ,stemaxServ,
696 // //     deemaxServ,epsilServ,stminServ);
697
698 //     AliMaterial(96, "SSD cone$",63.546, 29., 1.15, 1.265, 999);
699 //     AliMedium(96,"SSD cone$",96,0,ifield,fieldm,tmaxfdServ,stemaxServ,
700 //            deemaxServ,epsilServ,stminServ);
701
702
703     Int_t   ifield = gAlice->Field()->Integ();
704     Float_t fieldm = gAlice->Field()->Max();
705
706     Float_t tmaxfd = 0.1; // 1.0; // Degree
707     Float_t stemax = 1.0; // cm
708     Float_t deemax = 0.1; // 30.0; // Fraction of particle's energy 0<deemax<=1
709     Float_t epsil  = 1.0E-4; // 1.0; // cm
710     Float_t stmin  = 0.0; // cm "Default value used"
711
712     Float_t tmaxfdSi = 0.1; // .10000E+01; // Degree
713     Float_t stemaxSi = 0.0075; //  .10000E+01; // cm
714     Float_t deemaxSi = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
715     Float_t epsilSi  = 1.0E-4;// .10000E+01;
716     Float_t stminSi  = 0.0; // cm "Default value used"
717
718     Float_t tmaxfdAir = 0.1; // .10000E+01; // Degree
719     Float_t stemaxAir = .10000E+01; // cm
720     Float_t deemaxAir = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
721     Float_t epsilAir  = 1.0E-4;// .10000E+01;
722     Float_t stminAir  = 0.0; // cm "Default value used"
723
724     Float_t tmaxfdServ = 1.0; // 10.0; // Degree
725     Float_t stemaxServ = 1.0; // 0.01; // cm
726     Float_t deemaxServ = 0.5; // 0.1; // Fraction of particle's energy 0<deemax<=1
727     Float_t epsilServ  = 1.0E-3; // 0.003; // cm
728     Float_t stminServ  = 0.0; //0.003; // cm "Default value used"
729
730     // Freon PerFluorobuthane C4F10 see 
731     // http://st-support-cooling-electronics.web.cern.ch/
732     //        st-support-cooling-electronics/default.htm
733     Float_t afre[2]  = { 12.011,18.9984032 };
734     Float_t zfre[2]  = { 6., 9. };
735     Float_t wfre[2]  = { 4.,10. };
736     Float_t densfre  = 1.52;
737
738
739     //CM55J
740
741     Float_t aCM55J[4]={12.0107,14.0067,15.9994,1.00794};
742     Float_t zCM55J[4]={6.,7.,8.,1.};
743     Float_t wCM55J[4]={0.908508078,0.010387573,0.055957585,0.025146765};
744     Float_t dCM55J = 1.63;
745
746     //ALCM55J
747
748     Float_t aALCM55J[5]={12.0107,14.0067,15.9994,1.00794,26.981538};
749     Float_t zALCM55J[5]={6.,7.,8.,1.,13.};
750     Float_t wALCM55J[5]={0.817657902,0.0093488157,0.0503618265,0.0226320885,0.1};
751     Float_t dALCM55J = 1.9866;
752
753     //Si Chips
754
755     Float_t aSICHIP[6]={12.0107,14.0067,15.9994,1.00794,28.0855,107.8682};
756     Float_t zSICHIP[6]={6.,7.,8.,1.,14., 47.};
757     Float_t wSICHIP[6]={0.039730642,0.001396798,0.01169634,0.004367771,0.844665,0.09814344903};
758     Float_t dSICHIP = 2.36436;
759
760     //Inox
761     
762     Float_t aINOX[9]={12.0107,54.9380, 28.0855,30.9738,32.066,58.6928,55.9961,95.94,55.845};
763     Float_t zINOX[9]={6.,25.,14.,15.,16., 28.,24.,42.,26.};
764     Float_t wINOX[9]={0.0003,0.02,0.01,0.00045,0.0003,0.12,0.17,0.025,0.654};
765     Float_t dINOX = 8.03;
766
767     //SDD HV microcable
768
769     Float_t aHVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
770     Float_t zHVm[5]={6.,1.,7.,8.,13.};
771     Float_t wHVm[5]={0.520088819984,0.01983871336,0.0551367996,0.157399667056, 0.247536};
772     Float_t dHVm = 1.6087;
773
774     //SDD LV+signal cable
775
776     Float_t aLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
777     Float_t zLVm[5]={6.,1.,7.,8.,13.};
778     Float_t wLVm[5]={0.21722436468,0.0082859922,0.023028867,0.06574077612, 0.68572};
779     Float_t dLVm = 2.1035;
780
781     //SDD hybrid microcab
782
783     Float_t aHLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
784     Float_t zHLVm[5]={6.,1.,7.,8.,13.};
785     Float_t wHLVm[5]={0.24281879711,0.00926228815,0.02574224025,0.07348667449, 0.64869};
786     Float_t dHLVm = 2.0502;
787
788     //SDD anode microcab
789
790     Float_t aALVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
791     Float_t zALVm[5]={6.,1.,7.,8.,13.};
792     Float_t wALVm[5]={0.392653705471,0.0128595919215,0.041626868025,0.118832707289, 0.431909};
793     Float_t dALVm = 2.0502;
794
795     //X7R capacitors
796
797     Float_t aX7R[7]={137.327,47.867,15.9994,58.6928,63.5460,118.710,207.2};
798     Float_t zX7R[7]={56.,22.,8.,28.,29.,50.,82.};
799     Float_t wX7R[7]={0.251639432,0.084755042,0.085975822,0.038244751,0.009471271,0.321736471,0.2081768};
800     Float_t dX7R = 7.14567;
801
802     // AIR
803
804     Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
805     Float_t zAir[4]={6.,7.,8.,18.};
806     Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
807     Float_t dAir = 1.20479E-3;
808
809     // Water
810
811     Float_t aWater[2]={1.00794,15.9994};
812     Float_t zWater[2]={1.,8.};
813     Float_t wWater[2]={0.111894,0.888106};
814     Float_t dWater   = 1.0;
815
816     // CERAMICS
817   //     94.4% Al2O3 , 2.8% SiO2 , 2.3% MnO , 0.5% Cr2O3
818     Float_t acer[5]  = { 26.981539,15.9994,28.0855,54.93805,51.9961 };
819     Float_t zcer[5]  = {       13.,     8.,    14.,     25.,    24. };
820     Float_t wcer[5]  = {.4443408,.5213375,.0130872,.0178135,.003421};
821     Float_t denscer  = 3.6;
822
823     //G10FR4
824
825     Float_t zG10FR4[14] = {14.00,       20.00,  13.00,  12.00,  5.00,   22.00,  11.00,  19.00,  26.00,  9.00,   8.00,   6.00,   7.00,   1.00};
826     Float_t aG10FR4[14] = {28.0855000,40.0780000,26.9815380,24.3050000,10.8110000,47.8670000,22.9897700,39.0983000,55.8450000,18.9984000,15.9994000,12.0107000,14.0067000,1.0079400};
827     Float_t wG10FR4[14] = {0.15144894,0.08147477,0.04128158,0.00904554,0.01397570,0.00287685,0.00445114,0.00498089,0.00209828,0.00420000,0.36043788,0.27529426,0.01415852,0.03427566};
828     Float_t densG10FR4= 1.8;
829     
830      //--- EPOXY  --- C18 H19 O3
831       Float_t aEpoxy[3] = {15.9994, 1.00794, 12.0107} ; 
832       Float_t zEpoxy[3] = {     8.,      1.,      6.} ; 
833       Float_t wEpoxy[3] = {     3.,     19.,     18.} ; 
834       Float_t dEpoxy = 1.8 ;
835
836       // rohacell: C9 H13 N1 O2
837     Float_t arohac[4] = {12.01,  1.01, 14.010, 16.};
838     Float_t zrohac[4] = { 6.,    1.,    7.,     8.};
839     Float_t wrohac[4] = { 9.,   13.,    1.,     2.};
840     Float_t drohac    = 0.05;
841
842     // If he/she means stainless steel (inox) + Aluminium and Zeff=15.3383 then
843 //
844 // %Al=81.6164 %inox=100-%Al
845
846     Float_t aInAl[5] = {27., 55.847,51.9961,58.6934,28.0855 };
847     Float_t zInAl[5] = {13., 26.,24.,28.,14. };
848     Float_t wInAl[5] = {.816164, .131443,.0330906,.0183836,.000919182};
849     Float_t dInAl    = 3.075;
850
851     // Kapton
852
853     Float_t aKapton[4]={1.00794,12.0107, 14.010,15.9994};
854     Float_t zKapton[4]={1.,6.,7.,8.};
855     Float_t wKapton[4]={0.026362,0.69113,0.07327,0.209235};
856     Float_t dKapton   = 1.42;
857
858     //SDD ruby sph.
859     Float_t aAlOxide[2]  = { 26.981539,15.9994};
860     Float_t zAlOxide[2]  = {       13.,     8.};
861     Float_t wAlOxide[2]  = {0.4707, 0.5293};
862     Float_t dAlOxide     = 3.97;
863
864
865     AliMaterial(1,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
866     AliMedium(1,"SI$",1,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
867
868     AliMaterial(2,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
869     AliMedium(2,"SPD SI CHIP$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
870
871     AliMaterial(3,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
872     AliMedium(3,"SPD SI BUS$",3,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
873
874     AliMixture(4,"C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
875     AliMedium(4,"C (M55J)$",4,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
876
877     AliMixture(5,"AIR$",aAir,zAir,dAir,4,wAir);
878     AliMedium(5,"AIR$",5,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
879
880     AliMixture(6,"GEN AIR$",aAir,zAir,dAir,4,wAir);
881     AliMedium(6,"GEN AIR$",6,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
882
883     AliMixture(7,"SDD SI CHIP$",aSICHIP,zSICHIP,dSICHIP,6,wSICHIP);
884     AliMedium(7,"SDD SI CHIP$",7,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
885
886     AliMixture(9,"SDD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
887     AliMedium(9,"SDD C (M55J)$",9,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
888
889     AliMixture(10,"SDD AIR$",aAir,zAir,dAir,4,wAir);
890     AliMedium(10,"SDD AIR$",10,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
891
892     AliMaterial(11,"AL$",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
893     AliMedium(11,"AL$",11,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
894
895     AliMixture(12, "Water$",aWater,zWater,dWater,2,wWater);
896     AliMedium(12,"WATER$",12,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
897
898     AliMixture(13,"Freon$",afre,zfre,densfre,-2,wfre);
899     AliMedium(13,"Freon$",13,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
900
901     AliMaterial(14,"COPPER$",0.63546E+02,0.29000E+02,0.89600E+01,0.14300E+01,0.99900E+03);
902     AliMedium(14,"COPPER$",14,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
903     AliMixture(15,"CERAMICS$",acer,zcer,denscer,5,wcer);
904     AliMedium(15,"CERAMICS$",15,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
905
906     AliMixture(20,"SSD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
907     AliMedium(20,"SSD C (M55J)$",20,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
908
909     AliMixture(21,"SSD AIR$",aAir,zAir,dAir,4,wAir);
910     AliMedium(21,"SSD AIR$",21,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
911
912     AliMixture(25,"G10FR4$",aG10FR4,zG10FR4,densG10FR4,14,wG10FR4);
913     AliMedium(25,"G10FR4$",25,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
914
915      AliMixture(26,"GEN C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
916     AliMedium(26,"GEN C (M55J)$",26,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
917
918     AliMixture(27,"GEN Air$",aAir,zAir,dAir,4,wAir);
919     AliMedium(27,"GEN Air$",27,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
920
921     AliMaterial(51,"SPD SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
922     AliMedium(51,"SPD SI$",51,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
923
924     AliMaterial(52,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
925     AliMedium(52,"SPD SI CHIP$",52,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
926
927     AliMaterial(53,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
928     AliMedium(53,"SPD SI BUS$",53,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
929
930     AliMixture(54,"SPD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
931     AliMedium(54,"SPD C (M55J)$",54,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
932
933     AliMixture(55,"SPD AIR$",aAir,zAir,dAir,4,wAir);
934     AliMedium(55,"SPD AIR$",55,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
935
936     AliMixture(56, "SPD KAPTON(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
937     AliMedium(56,"SPD KAPTON(POLYCH2)$",56,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
938
939     AliMixture(61,"EPOXY$",aEpoxy,zEpoxy,dEpoxy,-3,wEpoxy);
940     AliMedium(61,"EPOXY$",61,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
941
942     AliMaterial(62,"SILICON$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
943     AliMedium(62,"SILICON$",62,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
944
945     AliMixture(63, "KAPTONH(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
946     AliMedium(63,"KAPTONH(POLYCH2)$",63,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
947
948     AliMaterial(64,"ALUMINUM$",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
949     AliMedium(64,"ALUMINUM$",64,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
950
951     AliMixture(65,"INOX$",aINOX,zINOX,dINOX,9,wINOX);
952     AliMedium(65,"INOX$",65,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
953
954     AliMixture(68,"ROHACELL$",arohac,zrohac,drohac,-4,wrohac);
955     AliMedium(68,"ROHACELL$",68,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
956
957      AliMixture(69,"SDD C AL (M55J)$",aALCM55J,zALCM55J,dALCM55J,5,wALCM55J);
958     AliMedium(69,"SDD C AL (M55J)$",69,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
959   
960     AliMixture(70, "SDDKAPTON (POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
961     AliMedium(70,"SDDKAPTON (POLYCH2)$",70,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
962
963      AliMaterial(71,"ITS SANDW A$",0.12011E+02,0.60000E+01,0.2115E+00,0.17479E+03,0.99900E+03);
964     AliMedium(71,"ITS SANDW A$",71,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
965
966     AliMaterial(72,"ITS SANDW B$",0.12011E+02,0.60000E+01,0.27000E+00,0.18956E+03,0.99900E+03);
967     AliMedium(72,"ITS SANDW B$",72,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
968
969     AliMaterial(73,"ITS SANDW C$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
970     AliMedium(73,"ITS SANDW C$",73,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
971
972     AliMaterial(74,"HEAT COND GLUE$",0.12011E+02,0.60000E+01,0.1930E+01,0.22100E+02,0.99900E+03);
973     AliMedium(74,"HEAT COND GLUE$",74,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
974
975     AliMaterial(75,"ELASTO SIL$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
976     AliMedium(75,"ELASTO SIL$",75,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
977
978     // SPD bus (data from Petra Riedler)
979     Float_t aSPDbus[5] = {1.00794,12.0107,14.01,15.9994,26.982 };
980     Float_t zSPDbus[5] = {1.,6.,7.,8.,13.};
981     Float_t wSPDbus[5] = {0.023523,0.318053,0.009776,0.078057,0.570591};
982     Float_t dSPDbus    = 2.128505;
983
984     //   AliMaterial(76,"SPDBUS(AL+KPT+EPOX)$",0.19509E+02,0.96502E+01,0.19060E+01,0.15413E+02,0.99900E+03);
985     AliMixture(76,"SPDBUS(AL+KPT+EPOX)$",aSPDbus,zSPDbus,dSPDbus,5,wSPDbus);
986     AliMedium(76,"SPDBUS(AL+KPT+EPOX)$",76,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
987                
988     AliMixture(77,"SDD X7R capacitors$",aX7R,zX7R,dX7R,7,wX7R);
989     AliMedium(77,"SDD X7R capacitors$",77,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
990
991     AliMixture(78,"SDD ruby sph. Al2O3$",aAlOxide,zAlOxide,dAlOxide,2,wAlOxide);
992     AliMedium(78,"SDD ruby sph. Al2O3$",78,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
993
994     AliMaterial(79,"SDD SI insensitive$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
995     AliMedium(79,"SDD SI insensitive$",79,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
996
997     AliMixture(80,"SDD HV microcable$",aHVm,zHVm,dHVm,5,wHVm);
998     AliMedium(80,"SDD HV microcable$",80,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
999
1000     AliMixture(81,"SDD LV+signal cable$",aLVm,zLVm,dLVm,5,wLVm);
1001     AliMedium(81,"SDD LV+signal cable$",81,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1002
1003     AliMixture(82,"SDD hybrid microcab$",aHLVm, zHLVm,dHLVm,5,wHLVm);
1004     AliMedium(82,"SDD hybrid microcab$",82,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1005
1006     AliMixture(83,"SDD anode microcab$",aALVm,zALVm,dALVm,5,wALVm);
1007     AliMedium(83,"SDD anode microcab$",83,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1008     Float_t aDSring[4]={12.0107,      1.00794,     14.0067,      15.9994};
1009     Float_t zDSring[4]={ 6.,          1.,           7.,           8.};
1010     Float_t wDSring[4]={ 0.854323888, 0.026408778,  0.023050265,  0.096217069};
1011     Float_t dDSring = 0.2875;
1012     AliMixture(84,"SDD/SSD rings$",aDSring,zDSring,dDSring,4,wDSring);
1013     AliMedium(84,"SDD/SSD rings$",84,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1014
1015     AliMixture(85,"inox/alum$",aInAl,zInAl,dInAl,5,wInAl);
1016     AliMedium(85,"inox/alum$",85,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1017
1018     // special media to take into account services in the SDD and SSD 
1019     // cones for the FMD
1020     //Begin_Html
1021     /*
1022       <A HREF="http://www.Physics.ohio-state.edu/~nilsen/ITS/ITS_MatBudget_4B.xls">
1023       </pre>
1024       <br clear=left>
1025       <font size=+2 color=blue>
1026       <p> The Exel spread sheet from which these density number come from.
1027       </font></A>
1028     */
1029     //End_Html
1030
1031     //  AliMaterial(86,"AIRFMDSDD$",0.14610E+02,0.73000E+01,0.12050E-02,0.30423E+05,0.99900E+03);
1032     Float_t aA[13],zZ[13],wW[13],den;
1033     // From Pierluigi Barberis calculations of 2SPD+1SDD October 2 2002.
1034     zZ[0] = 1.0; aA[0] = 1.00794; // Hydrogen
1035     zZ[1] = 6.0; aA[1] = 12.011; // Carbon
1036     zZ[2] = 7.0; aA[2] = 14.00674; // Nitrogen
1037     zZ[3] = 8.0; aA[3] = 15.9994; // Oxigen
1038     zZ[4] = 14.0; aA[4] = 28.0855; // Silicon
1039     zZ[5] = 24.0; aA[5] = 51.9961; //Cromium
1040     zZ[6] = 25.0; aA[6] = 54.938049; // Manganese
1041     zZ[7] = 26.0; aA[7] = 55.845; // Iron
1042     zZ[8] = 28.0; aA[8] = 58.6934; // Nickle
1043     zZ[9] = 29.0; aA[9] = 63.546; // Copper
1044     zZ[10] = 13.0; aA[10] = 26.981539; // Alulminum
1045     zZ[11] = 47.0; aA[11] = 107.8682; // Silver
1046     zZ[12] = 27.0; aA[12] = 58.9332; // Cobolt
1047     wW[0] = 0.019965;
1048     wW[1] = 0.340961;
1049     wW[2] = 0.041225;
1050     wW[3] = 0.200352;
1051     wW[4] = 0.000386;
1052     wW[5] = 0.001467;
1053     wW[6] = 0.000155;
1054     wW[7] = 0.005113;
1055     wW[8] = 0.000993;
1056     wW[9] = 0.381262;
1057     wW[10] = 0.008121;
1058     wW[11] = 0.000000;
1059     wW[12] = 0.000000;
1060     if(fByThick){// New values seeITS_MatBudget_4B.xls
1061         den = 1.5253276; // g/cm^3  Cell O370
1062     }else{
1063         den = 2.58423412; // g/cm^3 Cell L370
1064     } // end if fByThick
1065     //den = 6161.7/(3671.58978);//g/cm^3 Volume does not exclude holes
1066     AliMixture(86,"AIRFMDSDD$",aA,zZ,den,+11,wW);
1067     AliMedium(86,"AIRFMDSDD$",86,0,ifield,fieldm,tmaxfdAir,stemaxAir,
1068               deemaxAir,epsilAir,stminAir);
1069
1070     //AliMaterial(87,"AIRFMDSSD$",0.14610E+02,0.73000E+01,0.12050E-02,0.30423E+05,0.99900E+03);
1071     // From Pierluigi Barberis calculations of SSD October 2 2002.
1072     wW[0] = 0.019777;
1073     wW[1] = 0.325901;
1074     wW[2] = 0.031848;
1075     wW[3] = 0.147668;
1076     wW[4] = 0.030609;
1077     wW[5] = 0.013993;
1078     wW[6] = 0.001479;
1079     wW[7] = 0.048792;
1080     wW[8] = 0.009477;
1081     wW[9] = 0.350697;
1082     wW[10] = 0.014546;
1083     wW[11] = 0.005213;
1084     wW[12] = 0.000000;
1085     if(fByThick){// New values seeITS_MatBudget_4B.xls
1086         den = 1.2464275; // g/cm^3   Cell O403
1087     }else{
1088         den = 1.28134409; // g/cm^3  Cell L403
1089     } // end if fByThick
1090     //den = 7666.3/(9753.553259); // volume does not exclude holes
1091     AliMixture(87,"AIRFMDSSD$",aA,zZ,den,+12,wW); 
1092     AliMedium(87,"AIRFMDSSD$",87,0,ifield,fieldm,tmaxfdAir,stemaxAir,
1093               deemaxAir,epsilAir,stminAir);
1094
1095     //AliMaterial(88,"ITS SANDW CFMDSDD$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
1096     // From Pierluigi Barberis calculations of 1SDD+Carbon fiber October 2 2002
1097     wW[0] = 0.016302;
1098     wW[1] = 0.461870;
1099     wW[2] = 0.033662;
1100     wW[3] = 0.163595;
1101     wW[4] = 0.000315;
1102     wW[5] = 0.001197;
1103     wW[6] = 0.000127;
1104     wW[7] = 0.004175;
1105     wW[8] = 0.000811;
1106     wW[9] = 0.311315;
1107     wW[10] = 0.006631;
1108     wW[11] = 0.000000;
1109     wW[12] = 0.000000;
1110     if(fByThick){// New values seeITS_MatBudget_4B.xls
1111         den = 1.9353276; // g/cm^3  Cell N370
1112     }else{
1113         den = 3.2788626; // g/cm^3 Cell F370
1114     } // end if fByThick
1115     //den = 7667.1/(3671.58978); // Volume does not excludeholes
1116     AliMixture(88,"ITS SANDW CFMDSDD$",aA,zZ,den,+11,wW); 
1117     AliMedium(88,"ITS SANDW CFMDSDD$",88,0,ifield,fieldm,tmaxfd,stemax,
1118               deemax,epsil,stmin);
1119
1120     //AliMaterial(89,"ITS SANDW CFMDSSD$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
1121     // From Pierluigi Barberis calculations of SSD+Carbon fiber October 2 2002.
1122     wW[0] = 0.014065;
1123     wW[1] = 0.520598;
1124     wW[2] = 0.022650;
1125     wW[3] = 0.105018;
1126     wW[4] = 0.021768;
1127     wW[5] = 0.009952;
1128     wW[6] = 0.001051;
1129     wW[7] = 0.034700;
1130     wW[8] = 0.006740;
1131     wW[9] = 0.249406;
1132     wW[10] = 0.010345;
1133     wW[11] = 0.0003707;
1134     wW[12] = 0.000000;
1135     if(fByThick){// New values seeITS_MatBudget_4B.xls
1136         den = 1.6564275; // g/cm^3  Cell N304
1137     }else{
1138         den = 1.7028296; // g/cm^3  Cell F304
1139     } // end if fByThick
1140     //den = 1166.5/(3671.58978); // Volume does not exclude holes
1141     AliMixture(89,"ITS SANDW CFMDSSD$",aA,zZ,den,+12,wW); 
1142     AliMedium(89,"ITS SANDW CFMDSSD$",89,0,ifield,fieldm,tmaxfd,stemax,
1143               deemax,epsil,stmin);
1144
1145     //AliMaterial(97,"SPD SERVICES$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
1146     // From Pierluigi Barberis calculations of 1SPD October 2 2002.
1147     wW[0] = 0.005970;
1148     wW[1] = 0.304704;
1149     wW[2] = 0.042510;
1150     wW[3] = 0.121715;
1151     wW[4] = 0.001118;
1152     wW[5] = 0.030948;
1153     wW[6] = 0.003270;
1154     wW[7] = 0.107910;
1155     wW[8] = 0.020960;
1156     wW[9] = 0.360895;
1157     wW[10] = 0.000000;
1158     wW[11] = 0.000000;
1159     wW[12] = 0.000000;
1160     if(fByThick){// New values seeITS_MatBudget_4B.xls
1161         den = 80.31136576; // g/cm^3 Cell H329
1162     }else{
1163         den = 87.13062; // g/cm^3  Cell G329
1164     } // end if fByThick
1165     //den = 1251.3/(0.05*2.0*TMath::Pi()*(7.75*7.75 - 3.7*3.7)); // g/cm^3
1166     AliMixture(97,"SPD SERVICES$",aA,zZ,den,+10,wW); 
1167     AliMedium(97,"SPD SERVICES$",97,0,ifield,fieldm,tmaxfd,stemax,
1168               deemax,epsil,stmin);
1169
1170
1171     // Special media
1172
1173     AliMaterial(90,"SPD shield$", 12.011, 6., 1.93/10. , 22.1*10., 999);
1174     AliMedium(90,"SPD shield$",90,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1175
1176     // SPD End Ladder (data from Petra Riedler)
1177     Float_t aSPDel[5] = {1.00794,12.0107,14.01,15.9994,63.54 };
1178     Float_t zSPDel[5] = {1.,6.,7.,8.,29.};
1179     Float_t wSPDel[5] = {0.004092,0.107274,0.011438,0.032476,0.844719};
1180     Float_t dSPDel    = 3.903403;
1181
1182     //   AliMaterial(91, "SPD End ladder$", 47.0447, 21.7963, 3.6374, 4.4711, 999); 
1183     AliMixture(91,"SPD End ladder$",aSPDel,zSPDel,dSPDel,5,wSPDel);
1184     AliMedium(91,"SPD End ladder$",91,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1185
1186     AliMaterial(92, "SPD cone$",28.0855, 14., 2.33, 9.36, 999);    
1187     AliMedium(92,"SPD cone$",92,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1188     /*  Material with fractional Z not actually used
1189     AliMaterial(93, "SDD End ladder$", 69.9298, 29.8246, 0.3824, 36.5103, 999);
1190     AliMedium(93,"SDD End ladder$",93,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1191     */
1192     AliMaterial(94, "SDD cone$",63.546, 29., 1.15, 1.265, 999);
1193     AliMedium(94,"SDD cone$",94,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1194     /* Material with fractional Z not actually used
1195     AliMaterial(95, "SSD End ladder$", 32.0988, 15.4021, 0.68, 35.3238, 999); 
1196     AliMedium(95,"SSD End ladder$",95,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1197     */
1198     AliMaterial(96, "SSD cone$",63.546, 29., 1.15, 1.265, 999);
1199     AliMedium(96,"SSD cone$",96,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1200 }
1201
1202 //______________________________________________________________________
1203 void AliITSv11::InitAliITSgeom(){
1204   //
1205   // Fill fITSgeom with the 3 sub-detector geometries
1206   //
1207
1208   if (gGeoManager) gGeoManager->Export("geometry.root");
1209
1210     const Int_t knlayers = 6;
1211     const Int_t kndeep = 3;
1212     const AliITSDetector kidet[knlayers]={kSPD,kSPD,kSDD,kSDD,kSSD,kSSD};
1213     const TString knames[knlayers] = {
1214       "AliITSv11:spd missing",  // lay=1
1215       "AliITSv11:spd missing",  // lay=2
1216       "/ALIC_1/ITSV_1/ITSsddLayer3_1/ITSsddLadd_%d/ITSsddSensor_%d/ITSsddWafer_%d", // lay=3
1217       "/ALIC_1/ITSV_1/ITSsddLayer4_1/ITSsddLadd_%d/ITSsddSensor_%d/ITSsddWafer_%d", // lay=4
1218       "AliITSv11:ssd missing",  // lay=5
1219       "AliITSv11:ssd missing"   // lay=6
1220     };
1221
1222     const Int_t kitsGeomTreeCopys[knlayers][kndeep]= {{10, 2, 4},// lay=1
1223                                                      {10, 4, 4}, // lay=2
1224                                                      {14, 6, 1}, // lay=3
1225                                                      {22, 8, 1}, // lay=4
1226                                                      {34,22, 1}, // lay=5
1227                                                      {38,25, 1}};// lay=6
1228     Int_t       nlad[knlayers],ndet[knlayers];
1229     Int_t       mod,lay,lad=0,det=0,i,j,k,cp0,cp1,cp2;
1230     TString path,shapeName;
1231     TGeoHMatrix materix;
1232     Double_t trans[3]={3*0.0},rot[10]={9*0.0,1.0};
1233     TArrayD shapePar;
1234     TArrayF shapeParF;
1235     Bool_t shapeDefined[3]={kFALSE,kFALSE,kFALSE};
1236
1237     AliDebug(1,"Reading Geometry transformation directly from Modler.");
1238     mod = 0;
1239     for(i=0;i<knlayers;i++){
1240         k = 1;
1241         for(j=0;j<kndeep;j++) if(kitsGeomTreeCopys[i][j]!=0)
1242             k *= TMath::Abs(kitsGeomTreeCopys[i][j]);
1243         mod += k;
1244     } // end for i
1245
1246     SetITSgeom(0);
1247     nlad[0]=20;nlad[1]=40;nlad[2]=14;nlad[3]=22;nlad[4]=34;nlad[5]=38;
1248     ndet[0]= 4;ndet[1]= 4;ndet[2]= 6;ndet[3]= 8;ndet[4]=22;ndet[5]=25;
1249     AliITSgeom* geom = new AliITSgeom(0,6,nlad,ndet,mod);
1250     SetITSgeom(geom);
1251     mod = 0;
1252     for(lay=1;lay<=knlayers;lay++){
1253
1254         for(cp0=0; cp0<kitsGeomTreeCopys[lay-1][0]; cp0++){
1255             for(cp1=0; cp1<kitsGeomTreeCopys[lay-1][1]; cp1++){
1256                 for(cp2=1; cp2<=kitsGeomTreeCopys[lay-1][2]; cp2++){
1257
1258                     path.Form(knames[lay-1].Data(),
1259                               cp0,cp1,cp2);
1260                     switch (lay){
1261                     case 1:{
1262                         det = cp2;
1263                         lad = cp1+2*(cp0-1);
1264                     }break;
1265                     case 2:{
1266                         det = cp2;
1267                         lad = cp1+4*(cp0-1);
1268                     } break;
1269                     case 3: case 4: case 5: case 6:{
1270                         det = cp1;
1271                         lad = cp0;
1272                     } break;
1273                     } // end switch
1274                          //AliInfo(Form("path=%s lay=%d lad=%d det=%d",
1275                          //             path.Data(),lay,lad,det));
1276                     gMC->GetTransformation(path.Data(),materix);
1277                     gMC->GetShape(path.Data(),shapeName,shapePar);
1278                     shapeParF.Set(shapePar.GetSize());
1279                     for(i=0;i<shapePar.GetSize();i++) shapeParF[i]=shapePar[i];
1280                     geom->CreateMatrix(mod,lay,lad,det,kidet[lay-1],trans,rot);
1281                     geom->SetTrans(mod,materix.GetTranslation());
1282                     geom->SetRotMatrix(mod,materix.GetRotationMatrix());
1283                     geom->GetGeomMatrix(mod)->SetPath(path.Data());
1284                     switch (lay){
1285                     case 1: case 2:
1286                         if(!shapeDefined[kSPD]){
1287                         geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(
1288                                 shapeParF.GetSize(),shapeParF.GetArray()));
1289                         shapeDefined[kSPD] = kTRUE;
1290                     }break;
1291                     case 3: case 4:
1292                         if(!shapeDefined[kSDD]){
1293                         geom->ReSetShape(kSDD,new AliITSgeomSDD256(
1294                                 shapeParF.GetSize(),shapeParF.GetArray()));
1295                         shapeDefined[kSDD] = kTRUE;
1296                     }break;
1297                     case 5: case 6:
1298                         if(!shapeDefined[kSSD]){
1299                         geom->ReSetShape(kSSD,new AliITSgeomSSD75and275(
1300                                 shapeParF.GetSize(),shapeParF.GetArray()));
1301                         shapeDefined[kSSD] = kTRUE;
1302                     }break;
1303                     default:{
1304                     }break;
1305                     } // end switch
1306                     mod++;
1307                 } /// end for cp2
1308             } // end for cp1
1309         } // end for cp0
1310     } // end for lay
1311
1312 //   fSDDgeom->ExportSensorGeometry(GetITSgeom(), +3, 0);  //SDD
1313 }
1314
1315 //______________________________________________________________________
1316 void AliITSv11::Init(){
1317   //
1318   //     Initialise the ITS after it has been created.
1319   //
1320
1321   //AliInfo(Form("Minor version %d",fMinorVersion));
1322     //
1323     if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
1324     if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
1325     if(GetITSgeom()!=0) SetITSgeom(0x0);
1326     AliITSgeom* geom = new AliITSgeom();
1327     SetITSgeom(geom);
1328     if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
1329     else this->InitAliITSgeom();
1330     if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
1331     AliITS::Init();
1332     //
1333 }
1334
1335 // //______________________________________________________________________
1336 // void AliITSv11::SetDefaults(){
1337 //   //
1338 //   // Set response ans segmentation models for SPD, SDD and SSD
1339 //   //
1340 //      const Float_t kconv = 1.0e+04; // convert cm to microns
1341 //     AliInfo("Called");    
1342
1343 //     if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
1344 //     fDetTypeSim->SetITSgeom(GetITSgeom());
1345   
1346 //     AliITSgeomSPD  *s0;
1347 //     AliITSgeomSDD  *s1;
1348 //     AliITSgeomSSD  *s2;
1349 //     Int_t i;
1350 //     Float_t bx[256],bz[280];
1351    
1352 //     fDetTypeSim->ResetCalibrationArray();
1353 //     fDetTypeSim->ResetSegmentation();
1354 //     fDetTypeSim->SetDefaults();
1355     
1356 //     //SPD
1357 //     s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD);// Get shape info. Do it this way for now.
1358 //     AliITSsegmentationSPD* seg0 = (AliITSsegmentationSPD*)fDetTypeSim->GetSegmentationModel(0);
1359 //     seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
1360 //                   s0->GetDz()*2.*kconv, // for now.
1361 //                   s0->GetDy()*2.*kconv); // x,z,y full width in microns.
1362 //     seg0->SetNPads(256,160);// Number of Bins in x and z
1363 //     for(i=000;i<256;i++) bx[i] =  50.0; // in x all are 50 microns.
1364 //     for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
1365 //     for(i=160;i<280;i++) bz[i] =   0.0; // Outside of detector.
1366 //     bz[ 31] = bz[ 32] = 625.0; // first chip boundry
1367 //     bz[ 63] = bz[ 64] = 625.0; // first chip boundry
1368 //     bz[ 95] = bz[ 96] = 625.0; // first chip boundry
1369 //     bz[127] = bz[128] = 625.0; // first chip boundry
1370 //     bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
1371 //     seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
1372 //     SetSegmentationModel(kSPD,seg0);
1373 //     // set digit and raw cluster classes to be used
1374 //     const char *kData0=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD()))->DataType();
1375 //     if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit");
1376 //     else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
1377
1378
1379
1380 //     // SDD
1381 //     s1 = (AliITSgeomSDD*) GetITSgeom()->GetShape(kSDD);// Get shape info. Do it this way for now.
1382 //     AliITSsegmentationSDD* seg1 = (AliITSsegmentationSDD*)fDetTypeSim->GetSegmentationModel(1);
1383 //     seg1->SetDetSize(s1->GetDx()*kconv, // base this on AliITSgeomSDD
1384 //                   s1->GetDz()*2.*kconv, // for now.
1385 //                   s1->GetDy()*2.*kconv); // x,z,y full width in microns.
1386 //     seg1->SetNPads(256,256);// Use AliITSgeomSDD for now
1387 //     SetSegmentationModel(kSDD,seg1);
1388 //     const char *kData1=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSDD()))->DataType();
1389 //     AliITSCalibrationSDD* rsp = (AliITSCalibrationSDD*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSDD());
1390 //     const char *kopt=rsp->GetZeroSuppOption();
1391 //     if((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ){
1392 //      fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigit");
1393 //     } else fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigitSDD");
1394
1395
1396 //     // SSD
1397 //     s2 = (AliITSgeomSSD*) GetITSgeom()->GetShape(kSSD);// Get shape info. Do it this way for now.
1398 //     AliITSsegmentationSSD* seg2 = (AliITSsegmentationSSD*)fDetTypeSim->GetSegmentationModel(2);
1399 //     seg2->SetDetSize(s2->GetDx()*2.*kconv, // base this on AliITSgeomSSD
1400 //                   s2->GetDz()*2.*kconv, // for now.
1401 //                   s2->GetDy()*2.*kconv); // x,z,y full width in microns.
1402 //     seg2->SetPadSize(95.,0.); // strip x pitch in microns
1403 //     seg2->SetNPads(768,0); // number of strips on each side.
1404 //     seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
1405 //     seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
1406 //     seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
1407 //     SetSegmentationModel(kSSD,seg2); 
1408 //         const char *kData2=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSSD()))->DataType();
1409 //     if(strstr(kData2,"real") ) fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigit");
1410 //     else fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigitSSD");
1411 //     if(fgkNTYPES>3){
1412 //      Warning("SetDefaults",
1413 //              "Only the four basic detector types are initialised!");
1414 //     }// end if
1415
1416     
1417 //     return;
1418 // }
1419
1420
1421 //______________________________________________________________________
1422 void AliITSv11::SetDefaults(){
1423   //
1424   // Set response and segmentation models for SPD, SDD and SSD
1425   //
1426      const Float_t kconv = 1.0e+04; // convert cm to microns
1427     AliInfo("Called");    
1428
1429 //     if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
1430 //     fDetTypeSim->SetITSgeom(GetITSgeom());
1431     if(!fDetTypeSim) {
1432       Warning("SetDefaults","Error fDetTypeSim not defined");
1433       return;
1434     }
1435   
1436     AliITSgeomSPD  *s0;
1437     AliITSgeomSDD  *s1;
1438     AliITSgeomSSD  *s2;
1439     Int_t i;
1440     Float_t bx[256],bz[280];
1441    
1442     fDetTypeSim->ResetCalibrationArray();
1443     fDetTypeSim->ResetSegmentation();
1444     fDetTypeSim->SetDefaults();
1445     
1446     //SPD
1447     s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD);// Get shape info. Do it this way for now.
1448     AliITSsegmentationSPD* seg0 = (AliITSsegmentationSPD*)fDetTypeSim->GetSegmentationModel(0);
1449     seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
1450                      s0->GetDz()*2.*kconv, // for now.
1451                      s0->GetDy()*2.*kconv); // x,z,y full width in microns.
1452     seg0->SetNPads(256,160);// Number of Bins in x and z
1453     for(i=000;i<256;i++) bx[i] =  50.0; // in x all are 50 microns.
1454     for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
1455     for(i=160;i<280;i++) bz[i] =   0.0; // Outside of detector.
1456     bz[ 31] = bz[ 32] = 625.0; // first chip boundry
1457     bz[ 63] = bz[ 64] = 625.0; // first chip boundry
1458     bz[ 95] = bz[ 96] = 625.0; // first chip boundry
1459     bz[127] = bz[128] = 625.0; // first chip boundry
1460     bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
1461     seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
1462     SetSegmentationModel(kSPD,seg0);
1463     // set digit and raw cluster classes to be used
1464     const char *kData0=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD()))->DataType();
1465     if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit");
1466     else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
1467
1468
1469
1470     // SDD
1471     s1 = (AliITSgeomSDD*) GetITSgeom()->GetShape(kSDD);// Get shape info. Do it this way for now.
1472     AliITSsegmentationSDD* seg1 = (AliITSsegmentationSDD*)fDetTypeSim->GetSegmentationModel(1);
1473     seg1->SetDetSize(s1->GetDx()*kconv, // base this on AliITSgeomSDD
1474                      s1->GetDz()*2.*kconv, // for now.
1475                      s1->GetDy()*2.*kconv); // x,z,y full width in microns.
1476     seg1->SetNPads(256,256);// Use AliITSgeomSDD for now
1477     SetSegmentationModel(kSDD,seg1);
1478     const char *kData1=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSDD()))->DataType();
1479     AliITSCalibrationSDD* rsp = (AliITSCalibrationSDD*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSDD());
1480     const char *kopt=rsp->GetZeroSuppOption();
1481     if((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ){
1482         fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigit");
1483     } else fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigitSDD");
1484
1485
1486     // SSD
1487     s2 = (AliITSgeomSSD*) GetITSgeom()->GetShape(kSSD);// Get shape info. Do it this way for now.
1488     AliITSsegmentationSSD* seg2 = (AliITSsegmentationSSD*)fDetTypeSim->GetSegmentationModel(2);
1489     seg2->SetDetSize(s2->GetDx()*2.*kconv, // base this on AliITSgeomSSD
1490                      s2->GetDz()*2.*kconv, // for now.
1491                      s2->GetDy()*2.*kconv); // x,z,y full width in microns.
1492     seg2->SetPadSize(95.,0.); // strip x pitch in microns
1493     seg2->SetNPads(768,0); // number of strips on each side.
1494     seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
1495     seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
1496     seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
1497     SetSegmentationModel(kSSD,seg2); 
1498         const char *kData2=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSSD()))->DataType();
1499     if(strstr(kData2,"real") ) fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigit");
1500     else fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigitSSD");
1501     if(fgkNTYPES>3){
1502         Warning("SetDefaults",
1503                 "Only the four basic detector types are initialised!");
1504     }// end if
1505
1506     
1507     return;
1508 }
1509
1510
1511
1512
1513
1514 //______________________________________________________________________
1515 void AliITSv11::DrawModule() const{
1516
1517 }
1518
1519 // //______________________________________________________________________
1520 // void AliITSv11::StepManager(){
1521 //   //
1522 //   //    Called for every step in the ITS, then calles the AliITShit class
1523 //   // creator with the information to be recoreded about that hit.
1524 //   //
1525 //     Int_t         copy, id;
1526 //     TLorentzVector position, momentum;
1527 //     static TLorentzVector position0;
1528 //     static Int_t stat0=0;
1529
1530 //     if(!(this->IsActive())){
1531 //      return;
1532 //     } // end if !Active volume.
1533
1534 //     if(!(gMC->TrackCharge())) return;
1535
1536 //     id=gMC->CurrentVolID(copy);
1537
1538 //     Bool_t sensvol = kFALSE;
1539 //     for(Int_t kk=0;kk<6;kk++)if(id == fIdSens[kk])sensvol=kTRUE;
1540 //     if(sensvol && (gMC->IsTrackExiting())){
1541 //      copy = fTrackReferences->GetEntriesFast();
1542 //      TClonesArray &lTR = *fTrackReferences;
1543 //      // Fill TrackReference structure with this new TrackReference.
1544 //      new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
1545 //     } // if Outer ITS mother Volume
1546
1547
1548 //     Int_t   copy1,copy2;  
1549 //     Int_t   vol[5];
1550 //     TClonesArray &lhits = *fHits;
1551 //     //
1552 //     // Track status
1553 //     vol[3] = 0;
1554 //     vol[4] = 0;
1555 //     if(gMC->IsTrackInside())      vol[3] +=  1;
1556 //     if(gMC->IsTrackEntering())    vol[3] +=  2;
1557 //     if(gMC->IsTrackExiting())     vol[3] +=  4;
1558 //     if(gMC->IsTrackOut())         vol[3] +=  8;
1559 //     if(gMC->IsTrackDisappeared()) vol[3] += 16;
1560 //     if(gMC->IsTrackStop())        vol[3] += 32;
1561 //     if(gMC->IsTrackAlive())       vol[3] += 64;
1562 //     //
1563 //     // Fill hit structure.
1564 //     if(!(gMC->TrackCharge())) return;
1565 //     //
1566 //     // Only entering charged tracks
1567 //     if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
1568 //      vol[0] = 1;
1569 //      id = gMC->CurrentVolOffID(2,copy);
1570 //      //detector copy in the ladder = 1<->4  (ITS1 < I101 < I103 < I10A)
1571 //      vol[1] = copy;
1572 //      gMC->CurrentVolOffID(3,copy1);
1573 //      //ladder copy in the module   = 1<->2  (I10A < I12A)
1574 //      gMC->CurrentVolOffID(4,copy2);
1575 //      //module copy in the layer    = 1<->10 (I12A < IT12)
1576 //      vol[2] = copy1+(copy2-1)*2;//# of ladders in one module  = 2
1577 //     } else if(id == fIdSens[1]){
1578 //      vol[0] = 2;
1579 //      id = gMC->CurrentVolOffID(2,copy);
1580 //      //detector copy in the ladder = 1<->4  (ITS2 < I1D1 < I1D3 < I20A)
1581 //      vol[1] = copy;
1582 //      gMC->CurrentVolOffID(3,copy1);
1583 //      //ladder copy in the module   = 1<->4  (I20A < I12A)
1584 //      gMC->CurrentVolOffID(4,copy2);
1585 //      //module copy in the layer    = 1<->10 (I12A < IT12)
1586 //      vol[2] = copy1+(copy2-1)*4;//# of ladders in one module  = 4
1587 //     } else if(id == fIdSens[2]){
1588 //      vol[0] = 3;
1589 //      id = gMC->CurrentVolOffID(1,copy);
1590 //      //detector copy in the ladder = 1<->6  (ITS3 < I302 < I004)
1591 //      vol[1] = copy;
1592 //      id = gMC->CurrentVolOffID(2,copy);
1593 //      //ladder copy in the layer    = 1<->14 (I004 < IT34)
1594 //      vol[2] = copy;
1595 //     } else if(id == fIdSens[3]){
1596 //      vol[0] = 4;
1597 //      id = gMC->CurrentVolOffID(1,copy);
1598 //      //detector copy in the ladder = 1<->8  (ITS4 < I402 < I005)
1599 //      vol[1] = copy;
1600 //      id = gMC->CurrentVolOffID(2,copy);
1601 //      //ladder copy in the layer    = 1<->22 (I005 < IT34))
1602 //      vol[2] = copy;
1603 //     }else if(id == fIdSens[4]){
1604 //      vol[0] = 5;
1605 //      id = gMC->CurrentVolOffID(1,copy);
1606 //      //detector copy in the ladder = 1<->22  (ITS5 < I562 < I565)
1607 //      vol[1] = copy;
1608 //      id = gMC->CurrentVolOffID(2,copy);
1609 //      //ladder copy in the layer    = 1<->34 (I565 < IT56)
1610 //      vol[2] = copy;
1611 //     }else if(id == fIdSens[5]){
1612 //      vol[0] = 6;
1613 //      id = gMC->CurrentVolOffID(1,copy);
1614 //      //detector copy in the ladder = 1<->25  (ITS6 < I566 < I569)
1615 //      vol[1] = copy;
1616 //      id = gMC->CurrentVolOffID(2,copy);
1617 //      //ladder copy in the layer = 1<->38 (I569 < IT56)
1618 //      vol[2] = copy;
1619 //     } else {
1620 //      return; // not an ITS volume?
1621 //     } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
1622 //     //
1623 //     gMC->TrackPosition(position);
1624 //     gMC->TrackMomentum(momentum);
1625 //     vol[4] = stat0;
1626 //     if(gMC->IsTrackEntering()){
1627 //      position0 = position;
1628 //      stat0 = vol[3];
1629 //      return;
1630 //     } // end if IsEntering
1631 //     // Fill hit structure with this new hit.
1632     
1633 //     new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
1634 //                                 gMC->Edep(),gMC->TrackTime(),position,
1635 //                                 position0,momentum);
1636
1637 //     position0 = position;
1638 //     stat0 = vol[3];
1639
1640 //     return;
1641 // }
1642
1643
1644 //______________________________________________________________________
1645 void AliITSv11::StepManager(){
1646   //
1647   //    Called for every step in the ITS, then calles the AliITShit class
1648   // creator with the information to be recoreded about that hit.
1649   //
1650     Int_t         copy, id;
1651     TLorentzVector position, momentum;
1652     static TLorentzVector position0;
1653     static Int_t stat0=0;
1654
1655     if(!(this->IsActive())){
1656         return;
1657     } // end if !Active volume.
1658
1659     if(!(gMC->TrackCharge())) return;
1660
1661     id=gMC->CurrentVolID(copy);
1662
1663     Bool_t sensvol = kFALSE;
1664     for(Int_t kk=0;kk<6;kk++)if(id == fIdSens[kk])sensvol=kTRUE;
1665     if(sensvol && (gMC->IsTrackExiting())){
1666         copy = fTrackReferences->GetEntriesFast();
1667         TClonesArray &lTR = *fTrackReferences;
1668         // Fill TrackReference structure with this new TrackReference.
1669         new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
1670     } // if Outer ITS mother Volume
1671
1672
1673     Int_t   copy1,copy2;  
1674     Int_t   vol[5];
1675     TClonesArray &lhits = *fHits;
1676     //
1677     // Track status
1678     vol[3] = 0;
1679     vol[4] = 0;
1680     if(gMC->IsTrackInside())      vol[3] +=  1;
1681     if(gMC->IsTrackEntering())    vol[3] +=  2;
1682     if(gMC->IsTrackExiting())     vol[3] +=  4;
1683     if(gMC->IsTrackOut())         vol[3] +=  8;
1684     if(gMC->IsTrackDisappeared()) vol[3] += 16;
1685     if(gMC->IsTrackStop())        vol[3] += 32;
1686     if(gMC->IsTrackAlive())       vol[3] += 64;
1687     //
1688     // Fill hit structure.
1689     if(!(gMC->TrackCharge())) return;
1690
1691     // Only entering charged tracks
1692     if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
1693         vol[0] = 1;
1694         id = gMC->CurrentVolOffID(2,copy);
1695         //detector copy in the ladder = 1<->4  (ITS1 < I101 < I103 < I10A)
1696         vol[1] = copy;
1697         gMC->CurrentVolOffID(3,copy1);
1698         //ladder copy in the module   = 1<->2  (I10A < I12A)
1699         gMC->CurrentVolOffID(4,copy2);
1700         //module copy in the layer    = 1<->10 (I12A < IT12)
1701         vol[2] = copy1+(copy2-1)*2;//# of ladders in one module  = 2
1702
1703     } else if(id == fIdSens[1]){
1704         vol[0] = 2;
1705         id = gMC->CurrentVolOffID(2,copy);
1706         //detector copy in the ladder = 1<->4  (ITS2 < I1D1 < I1D3 < I20A)
1707         vol[1] = copy;
1708         gMC->CurrentVolOffID(3,copy1);
1709         //ladder copy in the module   = 1<->4  (I20A < I12A)
1710         gMC->CurrentVolOffID(4,copy2);
1711         //module copy in the layer    = 1<->10 (I12A < IT12)
1712         vol[2] = copy1+(copy2-1)*4;//# of ladders in one module  = 4
1713
1714     } else if(id == fIdSens[2]){
1715         vol[0] = 3;
1716         id = gMC->CurrentVolOffID(1,copy);
1717         //detector copy in the ladder = 1<->6  (ITS3 < I302 < I004)
1718         vol[1] = copy;
1719         id = gMC->CurrentVolOffID(2,copy);
1720         //ladder copy in the layer    = 1<->14 (I004 < IT34)
1721         vol[2] = copy;
1722
1723     } else if(id == fIdSens[3]){
1724         vol[0] = 4;
1725         id = gMC->CurrentVolOffID(1,copy);
1726         //detector copy in the ladder = 1<->8  (ITS4 < I402 < I005)
1727         vol[1] = copy;
1728         id = gMC->CurrentVolOffID(2,copy);
1729         //ladder copy in the layer    = 1<->22 (I005 < IT34))
1730         vol[2] = copy;
1731
1732     }else if(id == fIdSens[4]){
1733         vol[0] = 5;
1734         id = gMC->CurrentVolOffID(1,copy);
1735         //detector copy in the ladder = 1<->22  (ITS5 < I562 < I565)
1736         vol[1] = copy;
1737         id = gMC->CurrentVolOffID(2,copy);
1738         //ladder copy in the layer    = 1<->34 (I565 < IT56)
1739         vol[2] = copy;
1740
1741     }else if(id == fIdSens[5]){
1742         vol[0] = 6;
1743         id = gMC->CurrentVolOffID(1,copy);
1744         //detector copy in the ladder = 1<->25  (ITS6 < I566 < I569)
1745         vol[1] = copy;
1746         id = gMC->CurrentVolOffID(2,copy);
1747         //ladder copy in the layer = 1<->38 (I569 < IT56)
1748         vol[2] = copy;
1749     } else {
1750         return; // not an ITS volume?
1751     } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
1752     //
1753     gMC->TrackPosition(position);
1754     gMC->TrackMomentum(momentum);
1755     vol[4] = stat0;
1756     if(gMC->IsTrackEntering()){
1757         position0 = position;
1758         stat0 = vol[3];
1759         return;
1760     } // end if IsEntering
1761     // Fill hit structure with this new hit.
1762     
1763     new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
1764                                    gMC->Edep(),gMC->TrackTime(),position,
1765                                    position0,momentum);
1766
1767     position0 = position;
1768     stat0 = vol[3];
1769
1770     return;
1771 }
1772