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