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