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