575d053c11a53244797be50b2fc501ad34cde012
[u/mrichter/AliRoot.git] / ITS / AliITSv11.cxx
1 /**************************************************************************
2  * Copyright(c) 2007-2009, 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 /* $Id: */
18
19
20 //========================================================================
21 //
22 //            Geometry of the Inner Tracking System
23 //           ---------------------------------------
24 //  This geometry is fully described in TGeo geometry (v11)
25 // 
26 // Ludovic Gaudichet  (gaudichet@to.infn.it)
27 // Mario Sitta (sitta@to.infn.it)
28 //
29 //========================================================================
30
31 //========================================================================
32 //  !!!WARNING!!!
33 //  This version allows to change the density (!) of the materials
34 //  the ITS forward services are made of.
35 //  By default the density is unchanged (enhancement factor = 1)
36 //  To change it, put the enhancement factor in the AliITSv11 constructor
37 //  (i.e in Config.C) as the third parameter : for example, to enhance the
38 //  density by 10% use
39 //      AliITS *ITS  = new AliITSv11("ITS","ITS v11",1.1);
40 //
41 //========================================================================
42
43
44 // $Log$
45 // Revision 1.1  2011/06/10 14:48:24  masera
46 // First version from v11Hybrid to v11 (M. Sitta)
47 //
48
49
50 #include <TClonesArray.h>
51 #include <TGeoGlobalMagField.h>
52 #include <TGeoManager.h>
53 #include <TGeoMatrix.h>
54 #include <TGeoPhysicalNode.h>
55 #include <TGeoVolume.h>
56 #include <TGeoXtru.h>
57 #include <TLorentzVector.h>
58 #include <TString.h>
59 #include <TVirtualMC.h>
60
61 #include "AliITS.h"
62 #include "AliITSDetTypeSim.h"
63 #include "AliITShit.h"
64 #include "AliITSCalibrationSDD.h"
65 #include "AliITSsegmentationSDD.h"
66 #include "AliITSsegmentationSPD.h"
67 #include "AliITSsegmentationSSD.h"
68 #include "AliITSv11.h"
69 #include "AliLog.h"
70 #include "AliMC.h"
71 #include "AliMagF.h"
72 #include "AliRun.h"
73 #include "AliTrackReference.h"
74 #include "AliITSv11GeometrySPD.h"
75 #include "AliITSv11GeometrySDD.h"
76 #include "AliITSv11GeometrySSD.h"
77 #include "AliITSv11GeometrySupport.h"
78 #include "AliGeomManager.h"
79
80
81 ClassImp(AliITSv11)
82
83 //______________________________________________________________________
84 AliITSv11::AliITSv11():
85   fByThick(kTRUE),
86   fMajorVersion(IsVersion()),
87   fMinorVersion(-1),
88   fIDMother(0),
89   fRhoIncrMatBud(1),
90   fInitGeom((AliITSVersion_t)fMajorVersion,fMinorVersion),
91   fSPDgeom(0),
92   fSDDgeom(0),
93   fSSDgeom(0),
94   fSupgeom(0)
95  {
96     //    Standard default constructor
97     // Inputs:
98     //   none.
99     // Outputs:
100     //   none.
101     // Return:
102     //   none.
103 }
104
105 //______________________________________________________________________
106 AliITSv11::AliITSv11(const char *title) 
107   : AliITS("ITS", title),
108     fByThick(kTRUE),
109     fMajorVersion(IsVersion()),
110     fMinorVersion(1),
111     fIDMother(0),
112     fRhoIncrMatBud(1),
113     fInitGeom((AliITSVersion_t)fMajorVersion,fMinorVersion),
114     fSPDgeom(0),
115     fSDDgeom(0),
116     fSSDgeom(0),
117     fSupgeom(0)
118 {
119     //    Standard constructor for the v11 geometry.
120     // Inputs:
121     //   const char * title  Arbitrary title
122     // Outputs:
123     //   none.
124     // Return:
125     //   none.
126   Int_t i;
127   
128   fSPDgeom = new AliITSv11GeometrySPD();
129   fSDDgeom = new AliITSv11GeometrySDD(0);
130   fSSDgeom = new AliITSv11GeometrySSD();
131   fSupgeom = new AliITSv11GeometrySupport();
132
133   fIdN = 6;
134   fIdName = new TString[fIdN];
135
136   fIdName[0] = fSPDgeom->GetSenstiveVolumeName1();
137   fIdName[1] = fSPDgeom->GetSenstiveVolumeName2();
138
139   fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
140   fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
141   
142   fIdName[4] = fSSDgeom->GetSenstiveVolumeName5();
143   fIdName[5] = fSSDgeom->GetSenstiveVolumeName6();
144
145   fIdSens    = new Int_t[fIdN];
146   for(i=0;i<fIdN;i++) fIdSens[i] = 0;
147
148   SetDensityServicesByThickness();
149   
150 }
151
152 //______________________________________________________________________
153 AliITSv11::AliITSv11(const char *name, const char *title, const Float_t rho) 
154   : AliITS("ITS", title),
155     fByThick(kTRUE),
156     fMajorVersion(IsVersion()),
157     fMinorVersion(1),
158     fIDMother(0),
159     fRhoIncrMatBud(rho),
160     fInitGeom((AliITSVersion_t)fMajorVersion,fMinorVersion),
161     fSPDgeom(0),
162     fSDDgeom(0),
163     fSSDgeom(0),
164     fSupgeom(0)
165 {
166     //    Standard constructor for the v11 geometry.
167     // Inputs:
168     //   const char * name   Ignored, set to "ITS"
169     //   const char * title  Arbitrary title
170     // Outputs:
171     //   none.
172     // Return:
173     //   none.
174   Int_t i;
175
176   if (rho != 1.)
177     AliWarning(Form("Using non-standard forward material enhancement factor %f !",rho));
178   
179   fSPDgeom = new AliITSv11GeometrySPD();
180   fSDDgeom = new AliITSv11GeometrySDD(0);
181   fSSDgeom = new AliITSv11GeometrySSD();
182   fSupgeom = new AliITSv11GeometrySupport();
183
184   fIdN = 6;
185   fIdName = new TString[fIdN];
186
187   (void) name; // removes warning message
188
189   fIdName[0] = fSPDgeom->GetSenstiveVolumeName1();
190   fIdName[1] = fSPDgeom->GetSenstiveVolumeName2();
191
192   fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
193   fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
194
195   fIdName[4] = fSSDgeom->GetSenstiveVolumeName5();
196   fIdName[5] = fSSDgeom->GetSenstiveVolumeName6();
197
198   fIdSens    = new Int_t[fIdN];
199   for(i=0;i<fIdN;i++) fIdSens[i] = 0;
200
201   SetDensityServicesByThickness();
202   
203 }
204
205 //______________________________________________________________________
206 AliITSv11::~AliITSv11() {
207     //    Standard destructor
208     // Inputs:
209     //   none.
210     // Outputs:
211     //   none.
212     // Return:
213     //   none.
214   delete fSPDgeom;
215   delete fSDDgeom;
216   delete fSSDgeom;
217   delete fSupgeom;
218 }
219
220 //______________________________________________________________________
221 void AliITSv11::SetT2Lmatrix(Int_t uid, Double_t yShift, 
222                              Bool_t yFlip, Bool_t yRot180) const
223 {
224
225   //
226   // Creates the TGeo Local to Tracking transformation matrix
227   // and sends it to the corresponding TGeoPNEntry 
228   //
229   // This function is used in AddAlignableVolumes()
230
231   TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(uid);
232   TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
233
234   Double_t *gtrans = globMatrix->GetTranslation(), rotMatrix[9];
235   memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t));
236   Double_t al = TMath::ATan2(rotMatrix[1],rotMatrix[0]);
237   if (yRot180) {
238     al = TMath::ATan2(rotMatrix[1],-rotMatrix[0]);
239   }
240   Double_t xShift = gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al);
241   Double_t zShift = -gtrans[2];
242
243   TGeoHMatrix *matLtoT = new TGeoHMatrix;
244   matLtoT->SetDx( xShift ); // translation
245   matLtoT->SetDy( yShift );
246   matLtoT->SetDz( zShift );
247   rotMatrix[0]= 0;  rotMatrix[1]= 1;  rotMatrix[2]= 0; // + rotation
248   rotMatrix[3]= 1;  rotMatrix[4]= 0;  rotMatrix[5]= 0;
249   rotMatrix[6]= 0;  rotMatrix[7]= 0;  rotMatrix[8]=-1;
250   if (yFlip) rotMatrix[3] = -1;  // flipping in y  (for SPD1)
251   if (yFlip) rotMatrix[1] = -1;  // flipping in y  (for SPD1)
252
253   if (yRot180) { // rotation of pi around the axis perpendicular to the wafer
254     if (yFlip) matLtoT->SetDx( -xShift ); // flipping in y  (for SPD1)
255     matLtoT->SetDy( -yShift );
256     matLtoT->SetDz( -zShift );
257     rotMatrix[8]=1;
258     rotMatrix[3] = -1;
259     if (yFlip) rotMatrix[3] = 1;  // flipping in y  (for SPD1)
260   }
261
262   TGeoRotation rot;
263   rot.SetMatrix(rotMatrix);
264   matLtoT->MultiplyLeft(&rot);
265   TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
266   delete matLtoT;
267   alignableEntry->SetMatrix(matTtoL);
268 }
269
270 //______________________________________________________________________
271 void AliITSv11::AddAlignableVolumes() const
272 {
273   // Creates entries for alignable volumes associating the symbolic volume
274   // name with the corresponding volume path.
275   // 
276   // Records in the alignable entries the transformation matrices converting
277   // TGeo local coordinates (in the RS of alignable volumes) to the tracking
278   // system
279   // For this, this function has to run before the misalignment because we
280   // are using the ideal positions in the AliITSgeom object.
281   // Inputs:
282   //   none.
283   // Outputs:
284   //   none.
285   // Return:
286   //   none.
287
288   AliInfo("Add ITS alignable volumes");
289
290   if (!gGeoManager) {
291     AliFatal("TGeoManager doesn't exist !");
292     return;
293   }
294
295   AliGeomManager::ELayerID layerId;
296   Int_t modUID, modnum;
297
298   if( !gGeoManager->SetAlignableEntry("ITS","ALIC_1/ITSV_1") )
299     AliFatal(Form("Unable to set alignable entry ! %s :: %s",
300                   "ITS","ALIC_1/ITSV_1"));    
301
302   TString strSPD = "ITS/SPD";
303   TString strSDD = "ITS/SDD";
304   TString strSSD = "ITS/SSD";
305   TString strStave = "/Stave";
306   TString strHalfStave = "/HalfStave";
307   TString strLadder = "/Ladder";
308   TString strSector = "/Sector";
309   TString strSensor = "/Sensor";
310   TString strEntryName1;
311   TString strEntryName2;
312   TString strEntryName3;
313   TString strEntryName4;
314
315   TString str0;
316   TString str1;
317   TString str2;
318
319   TString ladder;
320
321   //===== SPD layers =====
322   
323   str0 = "ALIC_1/ITSV_1/ITSSPD_1/ITSSPDCarbonFiberSectorV_";
324   str1 = "/ITSSPDSensitiveVirtualvolumeM0_1/ITSSPDlay1-Stave_";
325
326   TString str1Bis = "/ITSSPDhalf-Stave";
327   TString str1Tierce = "_1";
328
329   str2 = "/ITSSPDlay1-Ladder_";
330   
331   TString sector;
332   TString stave;
333   TString halfStave;
334   TString module;
335
336   layerId = AliGeomManager::kSPD1;
337   modnum = 0;
338     
339   for(Int_t cSect = 0; cSect<10; cSect++) {
340
341     sector = str0;
342     sector += cSect+1; // this is one full sector
343     strEntryName1 = strSPD;
344     strEntryName1 += 0;
345     strEntryName1 += strSector;
346     strEntryName1 += cSect;
347     if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),sector.Data()))
348       AliFatal(Form("New lay 1: Unable to set alignable entry 1! %s::%s",
349                strEntryName1.Data(),sector.Data()));
350
351     for(Int_t cStave=0; cStave<2; cStave++) {
352         
353       stave = sector;
354       stave += str1;
355       stave += cStave+1;
356       strEntryName2 = strEntryName1;
357       strEntryName2 += strStave;
358       strEntryName2 += cStave;
359
360       for(Int_t cHS=0; cHS<2; cHS++) {
361
362         halfStave = stave;
363         halfStave += str1Bis;
364         halfStave += cHS;
365         halfStave += str1Tierce;
366         strEntryName3 = strEntryName2;
367         strEntryName3 += strHalfStave;
368         strEntryName3 += cHS;
369
370         if(!gGeoManager->SetAlignableEntry(strEntryName3.Data(),
371                                            halfStave.Data()))
372           AliFatal(Form("New lay 1: Unable to set alignable entry 3! %s::%s",
373                         strEntryName3.Data(),halfStave.Data()));    
374
375         for(Int_t cLad=0; cLad<2; cLad++) {
376           
377           modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
378           module = halfStave;
379           module += str2;
380           module += cLad+cHS*2+1;
381           strEntryName4 = strEntryName3;
382           strEntryName4 += strLadder;
383           strEntryName4 += cLad+cHS*2;
384           if(!gGeoManager->SetAlignableEntry(strEntryName4.Data(),module.Data(),modUID))
385             AliFatal(Form("New lay 1: Unable to set alignable entry 4! %s::%s",
386                           strEntryName4.Data(),module.Data()));
387
388           SetT2Lmatrix(modUID, 0.0081, kTRUE, kTRUE);
389           // 0.0081 is the shift between the centers of alignable 
390           // and sensitive volumes. It is directly extracted from 
391           // the new SPD geometry
392         } // end for cLad
393       } // end for cHS
394     } // end for cStave
395   } // end for cSect
396
397   layerId = AliGeomManager::kSPD2;
398   modnum = 0;
399   str1 = "/ITSSPDSensitiveVirtualvolumeM0_1/ITSSPDlay2-Stave_";
400   str2 = "/ITSSPDlay2-Ladder_";
401
402   for(Int_t cSect = 0; cSect<10; cSect++) {
403
404     sector = str0;
405     sector += cSect+1; // this is one full sector
406     strEntryName1 = strSPD;
407     strEntryName1 += 1;
408     strEntryName1 += strSector;
409     strEntryName1 += cSect;
410       
411     for(Int_t cStave=0; cStave<4; cStave++) {
412         
413       stave = sector;
414       stave += str1;
415       stave += cStave+1;
416       strEntryName2 = strEntryName1;
417       strEntryName2 += strStave;
418       strEntryName2 += cStave;
419
420       for(Int_t cHS=0; cHS<2; cHS++) {
421
422         halfStave = stave;
423         halfStave += str1Bis;
424         halfStave += cHS;
425         halfStave += str1Tierce;
426         strEntryName3 = strEntryName2;
427         strEntryName3 += strHalfStave;
428         strEntryName3 += cHS;
429
430         if(!gGeoManager->SetAlignableEntry(strEntryName3.Data(),
431                                            halfStave.Data()))
432           AliFatal(Form("New lay 2: Unable to set alignable entry 3! %s::%s",
433                         strEntryName3.Data(),halfStave.Data()));    
434
435         for(Int_t cLad=0; cLad<2; cLad++) {
436
437           modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
438           module = halfStave;
439           module += str2;
440           module += cLad+cHS*2 +1;
441           strEntryName4 = strEntryName3;
442           strEntryName4 += strLadder;
443           strEntryName4 += cLad+cHS*2;
444           if(!gGeoManager->SetAlignableEntry(strEntryName4.Data(),module.Data(),modUID))
445             AliFatal(Form("New lay 2: Unable to set alignable entry 4! %s::%s",
446                           strEntryName4.Data(),module.Data()));
447
448           SetT2Lmatrix(modUID, -0.0081, kFALSE);
449         } // end for cLad
450       } // end for cHS
451     } // end for cStave
452   } // cSect
453
454   //===== SDD layers =====
455
456   layerId = AliGeomManager::kSDD1;
457   modnum = 0;
458
459   str0 = "/ALIC_1/ITSV_1/ITSsddLayer3_1/ITSsddLadd_"; // SDD layer1
460   str1 = "/ITSsddSensor3_";
461
462   TString sensor;
463
464   for(Int_t c1 = 0; c1<14; c1++) {
465
466     ladder = str0;
467     ladder += c1; // the set of wafers from one ladder
468     strEntryName1 = strSDD;
469     strEntryName1 += 2;
470     strEntryName1 +=strLadder;
471     strEntryName1 += c1;
472     //printf("%s    ==    %s\n",strEntryName1.Data(),ladder.Data());
473     if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
474       AliFatal(Form("Unable to set alignable entry 1! %s :: %s",
475                     strEntryName1.Data(),ladder.Data()));
476
477     for(Int_t c2 =0; c2<6; c2++) {
478
479       modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
480       sensor = ladder;
481       sensor += str1;
482       sensor += c2;
483       strEntryName2 = strEntryName1;
484       strEntryName2 += strSensor;
485       strEntryName2 += c2;
486       //printf("%s    ==    %s\n",strEntryName2.Data(),wafer.Data());
487       if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),sensor.Data(),modUID))
488         AliFatal(Form("Unable to set alignable entry 2! %s :: %s",
489                       strEntryName2.Data(),sensor.Data()));
490
491       SetT2Lmatrix(modUID, 0, kFALSE, c2>=3);
492     }
493   }
494
495   layerId = AliGeomManager::kSDD2;
496   modnum = 0;
497   str0 = "/ALIC_1/ITSV_1/ITSsddLayer4_1/ITSsddLadd_"; // SDD layer2
498   str1 = "/ITSsddSensor4_";
499     
500   for(Int_t c1 = 0; c1<22; c1++) {
501
502     ladder = str0;
503     ladder += c1; // the set of wafers from one ladder
504     strEntryName1 = strSDD;
505     strEntryName1 += 3;
506     strEntryName1 += strLadder;
507     strEntryName1 += c1;
508     //printf("%s    ==    %s\n",strEntryName1.Data(),ladder.Data());
509     if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
510       AliFatal(Form("Unable to set alignable entry 1! %s :: %s",
511                     strEntryName1.Data(),ladder.Data()));
512
513     for(Int_t c2 =0; c2<8; c2++) {
514
515       modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
516       sensor = ladder;
517       sensor += str1;
518       sensor += c2;
519       strEntryName2 = strEntryName1;
520       strEntryName2 += strSensor;
521       strEntryName2 += c2;
522       //printf("%s    ==    %s\n",strEntryName2.Data(),wafer.Data());
523       if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),sensor.Data(),modUID))
524         AliFatal(Form("Unable to set alignable entry 2! %s :: %s",
525                       strEntryName2.Data(),sensor.Data()));
526
527       SetT2Lmatrix(modUID, 0, kFALSE, c2>=4);
528     }
529   }
530
531   //===== SSD layers =====
532
533   layerId = AliGeomManager::kSSD1;
534   modnum = 0;
535
536   str0 = "/ALIC_1/ITSV_1/ITSssdLayer5_1/ITSssdLay5Ladd_";//SSD layer1
537   str1 = "/ITSssdSensor5_";
538   str2 = "";
539
540   TString wafer;
541
542   for(Int_t c1 = 0; c1<34; c1++) {
543
544     ladder = str0;
545     ladder += c1; // the set of wafers from one ladder
546     strEntryName1 = strSSD;
547     strEntryName1 += 4;
548     strEntryName1 += strLadder;
549     strEntryName1 += c1;
550     //printf("%s    ==    %s\n",strEntryName1.Data(),ladder.Data());
551     if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
552       AliFatal(Form("Unable to set alignable entry 1! %s :: %s",
553                     strEntryName1.Data(),ladder.Data()));
554
555     for(Int_t c2 =0; c2<22; c2++) {
556
557       modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
558       wafer = ladder;
559       wafer += str1;
560       wafer += c2;
561       //wafer += str2;    // one wafer
562       strEntryName2 = strEntryName1;
563       strEntryName2 += strSensor;
564       strEntryName2 += c2;
565       //printf("%s    ==    %s\n",strEntryName2.Data(),wafer.Data());
566       if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),wafer.Data(),modUID))
567         AliFatal(Form("Unable to set alignable entry 2! %s :: %s",
568                       strEntryName2.Data(),wafer.Data()));
569
570       SetT2Lmatrix(modUID, 0, kFALSE, kFALSE);
571     }
572   }
573
574   layerId = AliGeomManager::kSSD2;
575   modnum = 0;
576   str0 = "/ALIC_1/ITSV_1/ITSssdLayer6_1/ITSssdLay6Ladd_"; // SSD layer2
577   str1 = "/ITSssdSensor6_";
578   str2 = "";
579   
580   for(Int_t c1 = 0; c1<38; c1++) {
581
582     ladder = str0;
583     ladder += c1; // the set of wafers from one ladder
584     strEntryName1 = strSSD;
585     strEntryName1 += 5;
586     strEntryName1 += strLadder;
587     strEntryName1 += c1;
588     //printf("%s    ==    %s\n",strEntryName1.Data(),ladder.Data());
589     if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
590       AliFatal(Form("Unable to set alignable entry 1! %s :: %s",
591                     strEntryName1.Data(),ladder.Data()));
592
593     for(Int_t c2 =0; c2<25; c2++) {
594
595       modUID = AliGeomManager::LayerToVolUID(layerId,modnum++);
596       wafer = ladder;
597       wafer += str1;
598       wafer += c2;
599       //wafer += str2;    // one wafer
600       strEntryName2 = strEntryName1;
601       strEntryName2 += strSensor;
602       strEntryName2 += c2;
603       //printf("%s    ==    %s\n",strEntryName2.Data(),wafer.Data());
604       if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),wafer.Data(),modUID))
605         AliFatal(Form("Unable to set alignable entry 2! %s :: %s",
606                       strEntryName2.Data(),wafer.Data()));
607
608       SetT2Lmatrix(modUID, 0, kFALSE, kFALSE);
609     }
610   }
611     
612 }
613
614 //______________________________________________________________________
615 void AliITSv11::CreateGeometry()
616 {
617   // Create the geometry and insert it in ALIC
618
619   TGeoManager *geoManager = gGeoManager;
620
621   TGeoVolume *vALIC = geoManager->GetVolume("ALIC");
622
623   // This part is really ugly, needs to be redone
624   new TGeoVolumeAssembly("ITSV");
625   new TGeoVolumeAssembly("ITSS");
626
627   TGeoVolume *vITSV = geoManager->GetVolume("ITSV");
628   TGeoVolume *vITSS = geoManager->GetVolume("ITSS");
629
630   vALIC->AddNode(vITSV, 1, 0);
631   vALIC->AddNode(vITSS, 1, 0);
632
633   //
634   const Char_t *cvsDate="$Date$";
635   const Char_t *cvsRevision="$Revision$";
636   const Int_t kLength=100;
637   Char_t vstrng[kLength];
638   if(fInitGeom.WriteVersionString(vstrng,kLength,(AliITSVersion_t)IsVersion(),
639                              fMinorVersion,cvsDate,cvsRevision)) {
640     vITSV->SetTitle(vstrng);
641     vITSS->SetTitle(vstrng);
642   }
643
644   fSPDgeom->SPDSector(vITSV);
645
646   fSDDgeom->Layer3(vITSV);
647   fSDDgeom->Layer4(vITSV);
648   fSDDgeom->ForwardLayer3(vITSV);
649   fSDDgeom->ForwardLayer4(vITSV);
650
651   fSSDgeom->Layer5(vITSV);
652   fSSDgeom->Layer6(vITSV);
653   fSSDgeom->LadderSupportLayer5(vITSV);
654   fSSDgeom->LadderSupportLayer6(vITSV);
655   fSSDgeom->EndCapSupportSystemLayer6(vITSV);
656   fSSDgeom->EndCapSupportSystemLayer5(vITSV);
657
658   fSupgeom->SPDCone(vITSV);
659   fSupgeom->SDDCone(vITSV);
660   fSupgeom->SSDCone(vITSV);
661
662   fSDDgeom->SDDCables(vITSV);
663   fSSDgeom->SSDCables(vITSV);
664   fSupgeom->ServicesCableSupport(vITSS);
665
666   fSupgeom->ITSTPCSupports(vITSS);
667
668 }
669
670 //______________________________________________________________________
671 void AliITSv11::CreateMaterials()
672 {
673     // Create ITS materials
674     //     This function defines the default materials used in the Geant
675     // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
676     // AliITSv11.
677     // In general it is automatically replaced by
678     // the CreateMaterials routine defined in AliITSv?. Should the function
679     // CreateMaterials not exist for the geometry version you are using this
680     // one is used. See the definition found in AliITSv5 or the other routine
681     // for a complete definition.
682     // Inputs:
683     //   none.
684     // Outputs:
685     //   none.
686     // Return:
687     //   none.
688
689     Int_t   ifield = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
690     Float_t fieldm = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
691
692     Float_t tmaxfd = 0.1; // 1.0; // Degree
693     Float_t stemax = 1.0; // cm
694     Float_t deemax = 0.1; // 30.0; // Fraction of particle's energy 0<deemax<=1
695     Float_t epsil  = 1.0E-4; // 1.0; // cm
696     Float_t stmin  = 0.0; // cm "Default value used"
697
698     Float_t tmaxfdSi = 0.1; // .10000E+01; // Degree
699     Float_t stemaxSi = 0.0075; //  .10000E+01; // cm
700     Float_t deemaxSi = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
701     Float_t epsilSi  = 1.0E-4;// .10000E+01;
702     Float_t stminSi  = 0.0; // cm "Default value used"
703
704     Float_t tmaxfdAir = 0.1; // .10000E+01; // Degree
705     Float_t stemaxAir = .10000E+01; // cm
706     Float_t deemaxAir = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
707     Float_t epsilAir  = 1.0E-4;// .10000E+01;
708     Float_t stminAir  = 0.0; // cm "Default value used"
709
710     Float_t tmaxfdServ = 1.0; // 10.0; // Degree
711     Float_t stemaxServ = 1.0; // 0.01; // cm
712     Float_t deemaxServ = 0.5; // 0.1; // Fraction of particle's energy 0<deemax<=1
713     Float_t epsilServ  = 1.0E-3; // 0.003; // cm
714     Float_t stminServ  = 0.0; //0.003; // cm "Default value used"
715
716     // Freon PerFluorobuthane C4F10 see 
717     // http://st-support-cooling-electronics.web.cern.ch/
718     //        st-support-cooling-electronics/default.htm
719     Float_t afre[2]  = { 12.011,18.9984032 };
720     Float_t zfre[2]  = { 6., 9. };
721     Float_t wfre[2]  = { 4.,10. };
722     Float_t densfre  = 1.52;
723
724
725     //CM55J
726
727     Float_t aCM55J[4]={12.0107,14.0067,15.9994,1.00794};
728     Float_t zCM55J[4]={6.,7.,8.,1.};
729     Float_t wCM55J[4]={0.908508078,0.010387573,0.055957585,0.025146765};
730     Float_t dCM55J = 1.8;
731
732     //ALCM55J
733
734     Float_t aALCM55J[5]={12.0107,14.0067,15.9994,1.00794,26.981538};
735     Float_t zALCM55J[5]={6.,7.,8.,1.,13.};
736     Float_t wALCM55J[5]={0.817657902,0.0093488157,0.0503618265,0.0226320885,0.1};
737     Float_t dALCM55J = 1.9866;
738
739     //Si Chips
740
741     Float_t aSICHIP[6]={12.0107,14.0067,15.9994,1.00794,28.0855,107.8682};
742     Float_t zSICHIP[6]={6.,7.,8.,1.,14., 47.};
743     Float_t wSICHIP[6]={0.039730642,0.001396798,0.01169634,0.004367771,0.844665,0.09814344903};
744     Float_t dSICHIP = 2.36436;
745
746     //Inox
747     
748     Float_t aINOX[9]={12.0107,54.9380, 28.0855,30.9738,32.066,58.6928,51.9961,95.94,55.845};
749     Float_t zINOX[9]={6.,25.,14.,15.,16., 28.,24.,42.,26.};
750     Float_t wINOX[9]={0.0003,0.02,0.01,0.00045,0.0003,0.12,0.17,0.025,0.654};
751     Float_t dINOX = 8.03;
752
753     //AISI 304 L (from F.Tosello's web page - M.S. 18 Oct 10)
754     
755     Float_t a304L[8]={12.0107,54.9380, 28.0855,30.9738,32.066,58.6928,51.9961,55.845};
756     Float_t z304L[8]={6.,25.,14.,15.,16., 28.,24.,26.};
757     Float_t w304L[8]={0.0003,0.02,0.01,0.00045,0.003,0.0925,0.19,0.6865};
758     Float_t d304L = 8.03;
759
760     //SDD HV microcable
761
762     Float_t aHVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
763     Float_t zHVm[5]={6.,1.,7.,8.,13.};
764     Float_t wHVm[5]={0.520088819984,0.01983871336,0.0551367996,0.157399667056, 0.247536};
765     Float_t dHVm = 1.6087;
766
767     //SDD LV+signal cable
768
769     Float_t aLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
770     Float_t zLVm[5]={6.,1.,7.,8.,13.};
771     Float_t wLVm[5]={0.21722436468,0.0082859922,0.023028867,0.06574077612, 0.68572};
772     Float_t dLVm = 2.1035;
773
774     //SDD hybrid microcab
775
776     Float_t aHLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
777     Float_t zHLVm[5]={6.,1.,7.,8.,13.};
778     Float_t wHLVm[5]={0.24281879711,0.00926228815,0.02574224025,0.07348667449, 0.64869};
779     Float_t dHLVm = 2.0502;
780
781     //SDD anode microcab
782
783     Float_t aALVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
784     Float_t zALVm[5]={6.,1.,7.,8.,13.};
785     Float_t wALVm[5]={0.392653705471,0.0128595919215,0.041626868025,0.118832707289, 0.431909};
786     Float_t dALVm = 2.0502;
787
788     //X7R capacitors - updated from F.Tosello's web page - M.S. 18 Oct 10
789
790     Float_t aX7R[6]={137.327,47.867,15.9994,58.6928,63.5460,118.710};
791     Float_t zX7R[6]={56.,22.,8.,28.,29.,50.};
792     Float_t wX7R[6]={0.524732,0.176736,0.179282,0.079750,0.019750,0.019750};
793     Float_t dX7R = 6.07914;
794
795     //X7R weld, i.e. Sn 60% Pb 40% (from F.Tosello's web page - M.S. 15 Oct 10)
796
797     Float_t aX7Rweld[2]={118.71 , 207.20};
798     Float_t zX7Rweld[2]={ 50.   ,  82.  };
799     Float_t wX7Rweld[2]={  0.60 ,   0.40};
800     Float_t dX7Rweld   = 8.52358;
801
802     // AIR
803
804     Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
805     Float_t zAir[4]={6.,7.,8.,18.};
806     Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
807     Float_t dAir = 1.20479E-3;
808
809     // Water
810
811     Float_t aWater[2]={1.00794,15.9994};
812     Float_t zWater[2]={1.,8.};
813     Float_t wWater[2]={0.111894,0.888106};
814     Float_t dWater   = 1.0;
815
816     // CERAMICS
817   //     94.4% Al2O3 , 2.8% SiO2 , 2.3% MnO , 0.5% Cr2O3
818     Float_t acer[5]  = { 26.981539,15.9994,28.0855,54.93805,51.9961 };
819     Float_t zcer[5]  = {       13.,     8.,    14.,     25.,    24. };
820     Float_t wcer[5]  = {.4443408,.5213375,.0130872,.0178135,.003421};
821     Float_t denscer  = 3.6;
822
823     //G10FR4
824
825     Float_t zG10FR4[14] = {14.00,       20.00,  13.00,  12.00,  5.00,   22.00,  11.00,  19.00,  26.00,  9.00,   8.00,   6.00,   7.00,   1.00};
826     Float_t aG10FR4[14] = {28.0855000,40.0780000,26.9815380,24.3050000,10.8110000,47.8670000,22.9897700,39.0983000,55.8450000,18.9984000,15.9994000,12.0107000,14.0067000,1.0079400};
827     Float_t wG10FR4[14] = {0.15144894,0.08147477,0.04128158,0.00904554,0.01397570,0.00287685,0.00445114,0.00498089,0.00209828,0.00420000,0.36043788,0.27529426,0.01415852,0.03427566};
828     Float_t densG10FR4= 1.8;
829     
830      //--- EPOXY  --- C18 H19 O3
831       Float_t aEpoxy[3] = {15.9994, 1.00794, 12.0107} ; 
832       Float_t zEpoxy[3] = {     8.,      1.,      6.} ; 
833       Float_t wEpoxy[3] = {     3.,     19.,     18.} ; 
834       Float_t dEpoxy = 1.8 ;
835
836       // rohacell: C9 H13 N1 O2
837     Float_t arohac[4] = {12.01,  1.01, 14.010, 16.};
838     Float_t zrohac[4] = { 6.,    1.,    7.,     8.};
839     Float_t wrohac[4] = { 14.,   10.,    2.,     6.};
840     Float_t drohac    = 0.052;
841
842     // If he/she means stainless steel (inox) + Aluminium and Zeff=15.3383 then
843 //
844 // %Al=81.6164 %inox=100-%Al
845
846     Float_t aInAl[5] = {27., 55.847,51.9961,58.6934,28.0855 };
847     Float_t zInAl[5] = {13., 26.,24.,28.,14. };
848     Float_t wInAl[5] = {.816164, .131443,.0330906,.0183836,.000919182};
849     Float_t dInAl    = 3.075;
850
851     // Aluminum alloy with 12% Copper - 21 Oct 10
852
853     Float_t aAlCu12[2] = {26.9815, 63.546};
854     Float_t zAlCu12[2] = {13.    , 29.   };
855     Float_t wAlCu12[2] = { 0.88  ,  0.12 };
856     Float_t dAlCu12    = 2.96;
857
858     // Kapton
859
860     Float_t aKapton[4]={1.00794,12.0107, 14.010,15.9994};
861     Float_t zKapton[4]={1.,6.,7.,8.};
862     Float_t wKapton[4]={0.026362,0.69113,0.07327,0.209235};
863     Float_t dKapton   = 1.42;
864     
865     // Kapton + Cu (for Pixel Bus)
866
867     Float_t aKaptonCu[5]={1.00794, 12.0107, 14.010, 15.9994, 63.5460};
868     Float_t zKaptonCu[5]={1., 6., 7., 8., 29.};
869     Float_t wKaptonCuBus[5];
870     
871     // Kapton + Cu (for Pixel MCM)
872
873     Float_t wKaptonCuMCM[5];
874     
875     // Kapton + Cu (mix of two above)
876
877     Float_t wKaptonCuMix[5];
878
879     //SDD ruby sph.
880     Float_t aAlOxide[2]  = { 26.981539,15.9994};
881     Float_t zAlOxide[2]  = {       13.,     8.};
882     Float_t wAlOxide[2]  = {0.4707, 0.5293};
883     Float_t dAlOxide     = 3.97;
884
885     // Silica for optical fibers: Si O2
886     Float_t aoptfib[2] = { 28.0855, 15.9994};
887     Float_t zoptfib[2] = { 14.,      8.    };
888     Float_t woptfib[2] = {  1.,      2.    };
889     Float_t doptfib    = 2.55;
890
891     // Tetrafluorethylene-Perfluorpropylene (FEP) - 08 Mar 10
892     Float_t aFEP[2] = { 12.0107, 18.9984};
893     Float_t zFEP[2] = {  6.    ,  9.    };
894     Float_t wFEP[2] = {  1.    ,  2.    };
895     Float_t dFEP    = 2.15;
896
897     // PVC (C2H3Cl)n - 08 Jul 10
898     Float_t aPVC[3] = { 12.0107, 1.00794, 35.4527};
899     Float_t zPVC[3] = {  6.    , 1.     , 35.   };
900     Float_t wPVC[3] = {  2.    , 3.     ,  1.   };
901     Float_t dPVC    = 1.3;
902
903     // PBT (Polybutylene terephthalate = C12-H12-O4) - 01 Sep 10
904     Float_t aPBT[3] = { 12.0107, 1.00794, 15.9994};
905     Float_t zPBT[3] = {  6.    , 1.     ,  8.   };
906     Float_t wPBT[3] = { 12.    ,12.     ,  4.   };
907     Float_t dPBT    = 1.31;
908
909     // POLYAX (POLYAX = C37-H24-O6-N2) - 03 Sep 10
910     Float_t aPOLYAX[4] = { 12.0107, 1.00794, 15.9994, 14.00674};
911     Float_t zPOLYAX[4] = {  6.    , 1.     ,  8.    ,  7.     };
912     Float_t wPOLYAX[4] = { 37.    ,24.     ,  6.    ,  2.     };
913     Float_t dPOLYAX    = 1.27;
914
915     // PPS (PPS = C6-H4-S) - 05 Sep 10
916     Float_t aPPS[3] = { 12.0107, 1.00794, 32.066};
917     Float_t zPPS[3] = {  6.    , 1.     , 16.   };
918     Float_t wPPS[3] = {  6.    , 4.     ,  1.   };
919     Float_t dPPS    = 1.35;
920
921     // Megolon (Polyolefin = (C-H2)n) - 20 Oct 10
922     Float_t aMegolon[2] = { 12.0107, 1.00794};
923     Float_t zMegolon[2] = {  6.    , 1.     };
924     Float_t wMegolon[2] = {  1.    , 2.     };
925     Float_t dMegolon    = 1.51; // Mean of various types
926
927     // Standard glass (from glassproperties.com/glasses - M.S. 21 Oct 10)
928     Float_t aStdGlass[7] = {15.9994  ,28.0855  ,22.98977 ,40.078   ,
929                             24.305   ,26.981539,39.0983  };
930     Float_t zStdGlass[7] = { 8.      ,14.      ,11.      ,20.      ,
931                             12.      ,13.      ,19.      };
932     Float_t wStdGlass[7] = { 0.468377, 0.348239, 0.096441, 0.071469,
933                              0.006030, 0.005293, 0.004151};
934     Float_t dStdGlass    = 2.53;
935
936     // Glass Fiber (from F.Tosello's web page - M.S. 15 Oct 10)
937     Float_t aGlass[11] = {15.9994  ,28.0855  ,40.078   ,26.981539,10.811   ,
938                 24.305   ,39.0983  ,22.98977 ,18.9984  ,47.867   ,55.845};
939     Float_t zGlass[11] = { 8.      ,14.      ,20       ,13       , 5       ,
940                 12.      ,19       ,11       , 9       ,22       ,26    };
941     Float_t wGlass[11] = { 0.473610, 0.252415, 0.135791, 0.068803, 0.023293,
942                  0.015076, 0.008301, 0.007419, 0.007000, 0.004795, 0.003497};
943     Float_t dGlass = 2.61;
944
945     // Ryton R-4 04 (from F.Tosello's web page - M.S. 15 Oct 10)
946     Float_t aRyton[14] = {15.9994  ,28.0855  ,40.078   ,26.981539,10.811   ,
947                           24.305   ,39.0983  ,22.98977 ,18.9984  ,47.867   ,
948                           55.845   ,12.0107  , 1.00794 ,32.066   };
949     Float_t zRyton[14] = { 8.      ,14.      ,20.      ,13.      , 5.      ,
950                           12.      ,19.      ,11.      , 9.      ,22.      ,
951                           26.      , 6.      , 1.      ,16.      };
952     Float_t wRyton[14] = { 0.189445, 0.100966, 0.054316, 0.027521, 0.009317,
953                            0.006030, 0.003320, 0.002968, 0.002800, 0.001918,
954                            0.001399, 0.399760, 0.022365, 0.177875};
955     Float_t dRyton = 1.65;
956
957     // Plexiglas (Poly(methyl methacrylate) (C5O2H8)n - M.S. 05 nov 10)
958     Float_t aPlexy[3] = { 12.0107, 15.9994,  1.00794};
959     Float_t zPlexy[3] = {  6.    , 8.     ,  1.   };
960     Float_t wPlexy[3] = {  5.    , 2.     ,  8.   };
961     Float_t dPlexy    = 1.18;
962
963     //SSD NiSn capacitor ends
964     Float_t aNiSn[2]  = { 56.6934,118.710};
965     Float_t zNiSn[2]  = {     28.,     50.};
966     Float_t wNiSn[2]  = {0.33, 0.67};
967     Float_t dNiSn     = wNiSn[0]*8.908 + wNiSn[1]*7.310;
968
969     AliMaterial(1,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
970     AliMedium(1,"SI$",1,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
971
972     AliMaterial(2,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
973     AliMedium(2,"SPD SI CHIP$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
974
975     AliMaterial(3,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
976     AliMedium(3,"SPD SI BUS$",3,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
977
978     AliMixture(4,"C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
979     AliMedium(4,"C (M55J)$",4,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
980
981     AliMixture(5,"AIR$",aAir,zAir,dAir,4,wAir);
982     AliMedium(5,"AIR$",5,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
983
984     AliMixture(6,"GEN AIR$",aAir,zAir,dAir,4,wAir);
985     AliMedium(6,"GEN AIR$",6,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
986
987     AliMixture(7,"SDD SI CHIP$",aSICHIP,zSICHIP,dSICHIP,6,wSICHIP);
988     AliMedium(7,"SDD SI CHIP$",7,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
989
990     AliMixture(9,"SDD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
991     AliMedium(9,"SDD C (M55J)$",9,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
992
993     AliMixture(10,"SDD AIR$",aAir,zAir,dAir,4,wAir);
994     AliMedium(10,"SDD AIR$",10,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
995
996     AliMaterial(11,"AL$",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
997     AliMedium(11,"AL$",11,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
998
999     AliMixture(12, "Water$",aWater,zWater,dWater,2,wWater);
1000     AliMedium(12,"WATER$",12,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1001
1002     AliMixture(24, "WaterServ$",aWater,zWater,dWater*fRhoIncrMatBud,2,wWater);
1003     AliMedium(24,"WATERSERV$",24,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1004
1005     AliMixture(13,"Freon$",afre,zfre,densfre*fRhoIncrMatBud,-2,wfre);
1006     AliMedium(13,"Freon$",13,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1007
1008     AliMaterial(14,"COPPER$",0.63546E+02,0.29000E+02,0.89600E+01,0.14300E+01,0.99900E+03);
1009     AliMedium(14,"COPPER$",14,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1010     AliMaterial(29,"CUSERV$",0.63546E+02,0.29000E+02,0.89600E+01*fRhoIncrMatBud,0.14300E+01,0.99900E+03);
1011     AliMedium(29,"CUSERV$",29,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1012     AliMixture(15,"CERAMICS$",acer,zcer,denscer,5,wcer);
1013     AliMedium(15,"CERAMICS$",15,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1014
1015     AliMixture(20,"SSD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
1016     AliMedium(20,"SSD C (M55J)$",20,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1017
1018     AliMixture(21,"SSD AIR$",aAir,zAir,dAir,4,wAir);
1019     AliMedium(21,"SSD AIR$",21,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
1020
1021     AliMixture(25,"G10FR4$",aG10FR4,zG10FR4,densG10FR4,14,wG10FR4);
1022     AliMedium(25,"G10FR4$",25,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1023
1024      AliMixture(26,"GEN C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
1025     AliMedium(26,"GEN C (M55J)$",26,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1026
1027     AliMixture(27,"GEN Air$",aAir,zAir,dAir,4,wAir);
1028     AliMedium(27,"GEN Air$",27,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
1029
1030     AliMixture(35,"PLEXYGLAS$",aPlexy,zPlexy,dPlexy,-3,wPlexy);
1031     AliMedium(35,"PLEXYGLAS$",35,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1032
1033     AliMixture(36,"STDGLASS$",aStdGlass,zStdGlass,dStdGlass,7,wStdGlass);
1034     AliMedium(36,"STDGLASS$",36,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1035
1036     AliMixture(37,"ALCU12$",aAlCu12,zAlCu12,dAlCu12,2,wAlCu12);
1037     AliMedium(37,"ALCU12$",37,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1038
1039     AliMixture(38,"MEGOLON$",aMegolon,zMegolon,dMegolon*fRhoIncrMatBud,-2,wMegolon);
1040     AliMedium(38,"MEGOLON$",38,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1041
1042     AliMixture(39,"RYTON$",aRyton,zRyton,dRyton,14,wRyton);
1043     AliMedium(39,"RYTON$",39,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1044
1045     AliMixture(40,"GLASS FIBER$",aGlass,zGlass,dGlass,11,wGlass);
1046     AliMedium(40,"GLASS FIBER$",40,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1047
1048     AliMixture(41,"AISI304L$",a304L,z304L,d304L,8,w304L);
1049     AliMedium(41,"AISI304L$",41,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1050
1051     AliMaterial(42,"NICKEL$",0.58693E+02,0.28000E+02,0.89080E+01,0.14200E+01,0.99900E+03);
1052     AliMedium(42,"NICKEL$",42,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1053                
1054     AliMixture(43,"SDD X7R weld$",aX7Rweld,zX7Rweld,dX7Rweld,2,wX7Rweld);
1055     AliMedium(43,"SDD X7R weld$",43,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1056
1057     AliMixture(44,"PPS$",aPPS,zPPS,dPPS*fRhoIncrMatBud,-3,wPPS);
1058     AliMedium(44,"PPS$",44,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1059
1060     AliMixture(45,"POLYAX$",aPOLYAX,zPOLYAX,dPOLYAX*fRhoIncrMatBud,-4,wPOLYAX);
1061     AliMedium(45,"POLYAX$",45,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1062
1063     AliMixture(46,"PBT$",aPBT,zPBT,dPBT*fRhoIncrMatBud,-3,wPBT);
1064     AliMedium(46,"PBT$",46,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1065
1066     AliMixture(47,"PVC$",aPVC,zPVC,dPVC,-3,wPVC);
1067     AliMedium(47,"PVC$",47,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1068
1069     Double_t cuFrac = 0.56;
1070     Double_t kFrac  = 1.0 - cuFrac;
1071     Double_t cuDens = 8.96;
1072     Float_t dKaptonCuBus   = cuFrac * cuDens + kFrac * dKapton;
1073     for (Int_t j=0; j<4; j++)
1074       wKaptonCuBus[j] = wKapton[j]*kFrac;
1075     wKaptonCuBus[4] = cuFrac;
1076     AliMixture(48, "SPD-BUS CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuBus, 5, wKaptonCuBus);
1077     AliMedium(48,"SPD-BUS CU KAPTON$",48,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1078     
1079     cuFrac = 0.5;
1080     kFrac  = 1.0 - cuFrac;
1081     Float_t dKaptonCuMCM   = cuFrac * cuDens + kFrac * dKapton;
1082     for (Int_t j=0; j<4; j++)
1083       wKaptonCuMCM[j] = wKapton[j]*kFrac;
1084     wKaptonCuMCM[4] = cuFrac;
1085     AliMixture(49, "SPD-MCM CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuMCM, 5, wKaptonCuMCM);
1086     AliMedium(49,"SPD-MCM CU KAPTON$",49,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1087     
1088     cuFrac = (0.56 + 0.5) / 2.0;
1089     kFrac  = 1.0 - cuFrac;
1090     Float_t dKaptonCuMix   = cuFrac * cuDens + kFrac * dKapton;
1091     for (Int_t j=0; j<4; j++)
1092       wKaptonCuMix[j] = wKapton[j]*kFrac;
1093     wKaptonCuMix[4] = cuFrac;
1094     AliMixture(50, "SPD-MIX CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuMix, 5, wKaptonCuMix);
1095     AliMedium(50,"SPD-MIX CU KAPTON$",50,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1096
1097     AliMaterial(51,"SPD SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1098     AliMedium(51,"SPD SI$",51,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1099
1100     AliMaterial(52,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1101     AliMedium(52,"SPD SI CHIP$",52,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1102
1103     AliMaterial(53,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1104     AliMedium(53,"SPD SI BUS$",53,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1105
1106     AliMixture(54,"SPD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
1107     AliMedium(54,"SPD C (M55J)$",54,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1108
1109     AliMixture(55,"SPD AIR$",aAir,zAir,dAir,4,wAir);
1110     AliMedium(55,"SPD AIR$",55,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
1111
1112     AliMixture(56, "SPD KAPTON(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
1113     AliMedium(56,"SPD KAPTON(POLYCH2)$",56,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1114
1115     // Gaseous Freon has same chemical composition but air density at 1.7 atm
1116     AliMixture(59,"GASEOUS FREON$",afre,zfre,1.7*dAir*fRhoIncrMatBud,-2,wfre);
1117     AliMedium(59,"GASEOUS FREON$",59,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1118
1119     AliMixture(61,"EPOXY$",aEpoxy,zEpoxy,dEpoxy,-3,wEpoxy);
1120     AliMedium(61,"EPOXY$",61,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1121
1122     AliMixture(22,"EPOXYSERV$",aEpoxy,zEpoxy,dEpoxy*fRhoIncrMatBud,-3,wEpoxy);
1123     AliMedium(22,"EPOXYSERV$",22,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1124
1125     AliMaterial(62,"SILICON$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1126     AliMedium(62,"SILICON$",62,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
1127
1128     AliMixture(63, "KAPTONH(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
1129     AliMedium(63,"KAPTONH(POLYCH2)$",63,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1130
1131     AliMaterial(64,"ALUMINUM$",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
1132     AliMedium(64,"ALUMINUM$",64,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1133
1134     AliMaterial(32,"ALSERV$",0.26982E+02,0.13000E+02,0.26989E+01*fRhoIncrMatBud,0.89000E+01,0.99900E+03);
1135     AliMedium(32,"ALSERV$",32,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1136
1137     AliMixture(65,"INOX$",aINOX,zINOX,dINOX,9,wINOX);
1138     AliMedium(65,"INOX$",65,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1139
1140     AliMixture(31,"INOXSERV$",aINOX,zINOX,dINOX*fRhoIncrMatBud,9,wINOX);
1141     AliMedium(31,"INOXSERV$",31,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1142
1143     AliMixture(66,"NiSn$",aNiSn,zNiSn,dNiSn,2,wNiSn);
1144     AliMedium(66,"NiSn$",66,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1145
1146     AliMaterial(67,"Sn$", 118.710, 50., 7.310, 1.206, 999.);
1147     AliMedium(67,"Sn$",67,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1148
1149     AliMixture(68,"ROHACELL$",arohac,zrohac,drohac,-4,wrohac);
1150     AliMedium(68,"ROHACELL$",68,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1151
1152      AliMixture(69,"SDD C AL (M55J)$",aALCM55J,zALCM55J,dALCM55J,5,wALCM55J);
1153     AliMedium(69,"SDD C AL (M55J)$",69,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1154   
1155     AliMixture(70, "SDDKAPTON (POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
1156     AliMedium(70,"SDDKAPTON (POLYCH2)$",70,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1157
1158     AliMixture(23, "SDDKAPTONSERV", aKapton, zKapton, dKapton*fRhoIncrMatBud, 4, wKapton);
1159     AliMedium(23,"SDDKAPTONSERV$",23,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1160
1161      AliMaterial(71,"ITS SANDW A$",0.12011E+02,0.60000E+01,0.2115E+00,0.17479E+03,0.99900E+03);
1162     AliMedium(71,"ITS SANDW A$",71,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1163
1164     AliMaterial(72,"ITS SANDW B$",0.12011E+02,0.60000E+01,0.27000E+00,0.18956E+03,0.99900E+03);
1165     AliMedium(72,"ITS SANDW B$",72,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1166
1167     AliMaterial(73,"ITS SANDW C$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
1168     AliMedium(73,"ITS SANDW C$",73,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1169
1170     AliMaterial(74,"HEAT COND GLUE$",0.12011E+02,0.60000E+01,0.1930E+01,0.22100E+02,0.99900E+03);
1171     AliMedium(74,"HEAT COND GLUE$",74,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1172
1173     AliMaterial(75,"ELASTO SIL$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1174     AliMedium(75,"ELASTO SIL$",75,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1175
1176     // SPD bus (data from Petra Riedler)
1177     Float_t aSPDbus[5] = {1.00794,12.0107,14.01,15.9994,26.982 };
1178     Float_t zSPDbus[5] = {1.,6.,7.,8.,13.};
1179     Float_t wSPDbus[5] = {0.023523,0.318053,0.009776,0.078057,0.570591};
1180     Float_t dSPDbus    = 2.128505;
1181
1182     //   AliMaterial(76,"SPDBUS(AL+KPT+EPOX)$",0.19509E+02,0.96502E+01,0.19060E+01,0.15413E+02,0.99900E+03);
1183     AliMixture(76,"SPDBUS(AL+KPT+EPOX)$",aSPDbus,zSPDbus,dSPDbus,5,wSPDbus);
1184     AliMedium(76,"SPDBUS(AL+KPT+EPOX)$",76,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1185                
1186     AliMixture(77,"SDD X7R capacitors$",aX7R,zX7R,dX7R,6,wX7R);
1187     AliMedium(77,"SDD X7R capacitors$",77,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1188
1189     AliMixture(78,"SDD ruby sph. Al2O3$",aAlOxide,zAlOxide,dAlOxide,2,wAlOxide);
1190     AliMedium(78,"SDD ruby sph. Al2O3$",78,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1191
1192     AliMaterial(79,"SDD SI insensitive$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
1193     AliMedium(79,"SDD SI insensitive$",79,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1194
1195     AliMixture(80,"SDD HV microcable$",aHVm,zHVm,dHVm,5,wHVm);
1196     AliMedium(80,"SDD HV microcable$",80,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1197
1198     AliMixture(81,"SDD LV+signal cable$",aLVm,zLVm,dLVm,5,wLVm);
1199     AliMedium(81,"SDD LV+signal cable$",81,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1200
1201     AliMixture(82,"SDD hybrid microcab$",aHLVm, zHLVm,dHLVm,5,wHLVm);
1202     AliMedium(82,"SDD hybrid microcab$",82,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1203
1204     AliMixture(83,"SDD anode microcab$",aALVm,zALVm,dALVm,5,wALVm);
1205     AliMedium(83,"SDD anode microcab$",83,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1206     Float_t aDSring[4]={12.0107,      1.00794,     14.0067,      15.9994};
1207     Float_t zDSring[4]={ 6.,          1.,           7.,           8.};
1208     Float_t wDSring[4]={ 0.854323888, 0.026408778,  0.023050265,  0.096217069};
1209     Float_t dDSring = 0.2875;
1210     AliMixture(84,"SDD/SSD rings$",aDSring,zDSring,dDSring,4,wDSring);
1211     AliMedium(84,"SDD/SSD rings$",84,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1212
1213     AliMixture(85,"inox/alum$",aInAl,zInAl,dInAl,5,wInAl);
1214     AliMedium(85,"inox/alum$",85,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1215
1216     // special media to take into account services in the SDD and SSD 
1217     // cones for the FMD
1218     //Begin_Html
1219     /*
1220       <A HREF="http://www.Physics.ohio-state.edu/~nilsen/ITS/ITS_MatBudget_4B.xls">
1221       </pre>
1222       <br clear=left>
1223       <font size=+2 color=blue>
1224       <p> The Exel spread sheet from which these density number come from.
1225       </font></A>
1226     */
1227     //End_Html
1228
1229     //  AliMaterial(86,"AIRFMDSDD$",0.14610E+02,0.73000E+01,0.12050E-02,0.30423E+05,0.99900E+03);
1230     Float_t aA[13],zZ[13],wW[13],den;
1231     // From Pierluigi Barberis calculations of 2SPD+1SDD October 2 2002.
1232     zZ[0] = 1.0; aA[0] = 1.00794; // Hydrogen
1233     zZ[1] = 6.0; aA[1] = 12.011; // Carbon
1234     zZ[2] = 7.0; aA[2] = 14.00674; // Nitrogen
1235     zZ[3] = 8.0; aA[3] = 15.9994; // Oxigen
1236     zZ[4] = 14.0; aA[4] = 28.0855; // Silicon
1237     zZ[5] = 24.0; aA[5] = 51.9961; //Cromium
1238     zZ[6] = 25.0; aA[6] = 54.938049; // Manganese
1239     zZ[7] = 26.0; aA[7] = 55.845; // Iron
1240     zZ[8] = 28.0; aA[8] = 58.6934; // Nickle
1241     zZ[9] = 29.0; aA[9] = 63.546; // Copper
1242     zZ[10] = 13.0; aA[10] = 26.981539; // Alulminum
1243     zZ[11] = 47.0; aA[11] = 107.8682; // Silver
1244     zZ[12] = 27.0; aA[12] = 58.9332; // Cobolt
1245     wW[0] = 0.019965;
1246     wW[1] = 0.340961;
1247     wW[2] = 0.041225;
1248     wW[3] = 0.200352;
1249     wW[4] = 0.000386;
1250     wW[5] = 0.001467;
1251     wW[6] = 0.000155;
1252     wW[7] = 0.005113;
1253     wW[8] = 0.000993;
1254     wW[9] = 0.381262;
1255     wW[10] = 0.008121;
1256     wW[11] = 0.000000;
1257     wW[12] = 0.000000;
1258     if(fByThick){// New values seeITS_MatBudget_4B.xls
1259         den = 1.5253276; // g/cm^3  Cell O370
1260     }else{
1261         den = 2.58423412; // g/cm^3 Cell L370
1262     } // end if fByThick
1263     //den = 6161.7/(3671.58978);//g/cm^3 Volume does not exclude holes
1264     AliMixture(86,"AIRFMDSDD$",aA,zZ,den,+11,wW);
1265     AliMedium(86,"AIRFMDSDD$",86,0,ifield,fieldm,tmaxfdAir,stemaxAir,
1266               deemaxAir,epsilAir,stminAir);
1267
1268     //AliMaterial(87,"AIRFMDSSD$",0.14610E+02,0.73000E+01,0.12050E-02,0.30423E+05,0.99900E+03);
1269     // From Pierluigi Barberis calculations of SSD October 2 2002.
1270     wW[0] = 0.019777;
1271     wW[1] = 0.325901;
1272     wW[2] = 0.031848;
1273     wW[3] = 0.147668;
1274     wW[4] = 0.030609;
1275     wW[5] = 0.013993;
1276     wW[6] = 0.001479;
1277     wW[7] = 0.048792;
1278     wW[8] = 0.009477;
1279     wW[9] = 0.350697;
1280     wW[10] = 0.014546;
1281     wW[11] = 0.005213;
1282     wW[12] = 0.000000;
1283     if(fByThick){// New values seeITS_MatBudget_4B.xls
1284         den = 1.2464275; // g/cm^3   Cell O403
1285     }else{
1286         den = 1.28134409; // g/cm^3  Cell L403
1287     } // end if fByThick
1288     //den = 7666.3/(9753.553259); // volume does not exclude holes
1289     AliMixture(87,"AIRFMDSSD$",aA,zZ,den,+12,wW); 
1290     AliMedium(87,"AIRFMDSSD$",87,0,ifield,fieldm,tmaxfdAir,stemaxAir,
1291               deemaxAir,epsilAir,stminAir);
1292
1293     //AliMaterial(88,"ITS SANDW CFMDSDD$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
1294     // From Pierluigi Barberis calculations of 1SDD+Carbon fiber October 2 2002
1295     wW[0] = 0.016302;
1296     wW[1] = 0.461870;
1297     wW[2] = 0.033662;
1298     wW[3] = 0.163595;
1299     wW[4] = 0.000315;
1300     wW[5] = 0.001197;
1301     wW[6] = 0.000127;
1302     wW[7] = 0.004175;
1303     wW[8] = 0.000811;
1304     wW[9] = 0.311315;
1305     wW[10] = 0.006631;
1306     wW[11] = 0.000000;
1307     wW[12] = 0.000000;
1308     if(fByThick){// New values seeITS_MatBudget_4B.xls
1309         den = 1.9353276; // g/cm^3  Cell N370
1310     }else{
1311         den = 3.2788626; // g/cm^3 Cell F370
1312     } // end if fByThick
1313     //den = 7667.1/(3671.58978); // Volume does not excludeholes
1314     AliMixture(88,"ITS SANDW CFMDSDD$",aA,zZ,den,+11,wW); 
1315     AliMedium(88,"ITS SANDW CFMDSDD$",88,0,ifield,fieldm,tmaxfd,stemax,
1316               deemax,epsil,stmin);
1317
1318     //AliMaterial(89,"ITS SANDW CFMDSSD$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
1319     // From Pierluigi Barberis calculations of SSD+Carbon fiber October 2 2002.
1320     wW[0] = 0.014065;
1321     wW[1] = 0.520598;
1322     wW[2] = 0.022650;
1323     wW[3] = 0.105018;
1324     wW[4] = 0.021768;
1325     wW[5] = 0.009952;
1326     wW[6] = 0.001051;
1327     wW[7] = 0.034700;
1328     wW[8] = 0.006740;
1329     wW[9] = 0.249406;
1330     wW[10] = 0.010345;
1331     wW[11] = 0.0003707;
1332     wW[12] = 0.000000;
1333     if(fByThick){// New values seeITS_MatBudget_4B.xls
1334         den = 1.6564275; // g/cm^3  Cell N304
1335     }else{
1336         den = 1.7028296; // g/cm^3  Cell F304
1337     } // end if fByThick
1338     //den = 1166.5/(3671.58978); // Volume does not exclude holes
1339     AliMixture(89,"ITS SANDW CFMDSSD$",aA,zZ,den,+12,wW); 
1340     AliMedium(89,"ITS SANDW CFMDSSD$",89,0,ifield,fieldm,tmaxfd,stemax,
1341               deemax,epsil,stmin);
1342
1343     //AliMaterial(97,"SPD SERVICES$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
1344     // From Pierluigi Barberis calculations of 1SPD October 2 2002.
1345     wW[0] = 0.005970;
1346     wW[1] = 0.304704;
1347     wW[2] = 0.042510;
1348     wW[3] = 0.121715;
1349     wW[4] = 0.001118;
1350     wW[5] = 0.030948;
1351     wW[6] = 0.003270;
1352     wW[7] = 0.107910;
1353     wW[8] = 0.020960;
1354     wW[9] = 0.360895;
1355     wW[10] = 0.000000;
1356     wW[11] = 0.000000;
1357     wW[12] = 0.000000;
1358     if(fByThick){// New values seeITS_MatBudget_4B.xls
1359         den = 80.31136576; // g/cm^3 Cell H329
1360     }else{
1361         den = 87.13062; // g/cm^3  Cell G329
1362     } // end if fByThick
1363     //den = 1251.3/(0.05*2.0*TMath::Pi()*(7.75*7.75 - 3.7*3.7)); // g/cm^3
1364     AliMixture(97,"SPD SERVICES$",aA,zZ,den,+10,wW); 
1365     AliMedium(97,"SPD SERVICES$",97,0,ifield,fieldm,tmaxfd,stemax,
1366               deemax,epsil,stmin);
1367
1368
1369     // Special media
1370
1371     AliMaterial(90,"SPD shield$", 12.011, 6., 1.93 , 22.36, 999);
1372     AliMedium(90,"SPD shield$",90,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1373
1374     // SPD End Ladder (data from Petra Riedler)
1375     Float_t aSPDel[5] = {1.00794,12.0107,14.01,15.9994,63.54 };
1376     Float_t zSPDel[5] = {1.,6.,7.,8.,29.};
1377     Float_t wSPDel[5] = {0.004092,0.107274,0.011438,0.032476,0.844719};
1378     Float_t dSPDel    = 3.903403;
1379
1380     //   AliMaterial(91, "SPD End ladder$", 47.0447, 21.7963, 3.6374, 4.4711, 999); 
1381     AliMixture(91,"SPD End ladder$",aSPDel,zSPDel,dSPDel,5,wSPDel);
1382     AliMedium(91,"SPD End ladder$",91,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1383
1384     AliMaterial(92, "SPD cone$",28.0855, 14., 2.33, 9.36, 999);    
1385     AliMedium(92,"SPD cone$",92,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1386     /*  Material with fractional Z not actually used
1387     AliMaterial(93, "SDD End ladder$", 69.9298, 29.8246, 0.3824, 36.5103, 999);
1388     AliMedium(93,"SDD End ladder$",93,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1389     */
1390     AliMaterial(94, "SDD cone$",63.546, 29., 1.15, 1.265, 999);
1391     AliMedium(94,"SDD cone$",94,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1392     /* Material with fractional Z not actually used
1393     AliMaterial(95, "SSD End ladder$", 32.0988, 15.4021, 0.68, 35.3238, 999); 
1394     AliMedium(95,"SSD End ladder$",95,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1395     */
1396     AliMaterial(96, "SSD cone$",63.546, 29., 1.15, 1.265, 999);
1397     AliMedium(96,"SSD cone$",96,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
1398
1399     AliMixture(98,"SDD OPTICFIB$",aoptfib,zoptfib,doptfib,-2,woptfib);
1400     AliMedium(98,"SDD OPTICFIB$",98,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1401
1402     AliMixture(30,"SDD OPTICFIBSERV$",aoptfib,zoptfib,doptfib*fRhoIncrMatBud,-2,woptfib);
1403     AliMedium(30,"SDD OPTICFIBSERV$",30,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1404
1405     AliMixture(95,"SSD FEP$",aFEP,zFEP,dFEP*fRhoIncrMatBud,-2,wFEP);
1406     AliMedium(95,"SSD FEP$",95,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1407
1408     // Mean material for low-voltage cables on SPD trays Side A
1409     // (Copper + PolyEthylene (C2-H4)) (D.Elia for cable number and
1410     // cross-section area, M.Sitta for elemental computation) - 26 Feb 10
1411     wW[0] = 0.323024;//H
1412     wW[2] = 0.515464;//Cu
1413     wW[1] = 0.161512;//C
1414     wW[3] = 0.000000;//O
1415     wW[4] = 0.000000;//S
1416     wW[5] = 0.000000;//F
1417     wW[6] = 0.000000;//Sn
1418     wW[7] = 0.000000;//Pb
1419     wW[8] = 0.000000;//Cr
1420     wW[9] = 0.000000;//Si
1421     wW[10] = 0.000000;//Ni
1422     wW[11] = 0.000000;//Ca
1423
1424     den = 5.078866;
1425     AliMixture(60,"SPD_LOWCABLES$",aA,zZ,den,+3,wW);
1426     AliMedium(60,"SPD_LOWCABLES$",60,0,ifield,fieldm,tmaxfd,stemax,
1427               deemax,epsil,stmin);
1428
1429     // Mean material for high-voltage cables on SPD trays Side A & C
1430     // (Copper + HD PolyEthylene (C2-H2)) (D.Elia for cable number and
1431     // cross-section area, M.Sitta for elemental computation) - 10 Jun 10
1432     wW[0] = 0.083766;//H
1433     wW[2] = 0.417136;//Cu
1434     wW[1] = 0.499098;//C
1435     wW[3] = 0.000000;//O
1436     wW[4] = 0.000000;//S
1437     wW[5] = 0.000000;//F
1438     wW[6] = 0.000000;//Sn
1439     wW[7] = 0.000000;//Pb
1440     wW[8] = 0.000000;//Cr
1441     wW[9] = 0.000000;//Si
1442     wW[10] = 0.000000;//Ni
1443     wW[11] = 0.000000;//Ca
1444
1445     den = 1.514930;
1446     AliMixture(58,"SPD_HICABLES$",aA,zZ,den,+3,wW);
1447     AliMedium(58,"SPD_HICABLES$",58,0,ifield,fieldm,tmaxfd,stemax,
1448               deemax,epsil,stmin);
1449
1450     // PolyUrethane [C25-H42-N2-O6] - 07 Mar 10
1451     zZ[2] =  7.0; aA[2] =  14.0067; // Nitrogen - From Root TGeoElementTable
1452
1453     wW[0] = 0.090724;//H
1454     wW[2] = 0.060035;//N
1455     wW[1] = 0.643513;//C
1456     wW[3] = 0.205728;//O
1457     wW[4] = 0.000000;//S
1458     wW[5] = 0.000000;//F
1459     wW[6] = 0.000000;//Sn
1460     wW[7] = 0.000000;//Pb
1461     wW[8] = 0.000000;//Cr
1462     wW[9] = 0.000000;//Si
1463     wW[10] = 0.000000;//Ni
1464     wW[11] = 0.000000;//Ca
1465
1466     den = 1.158910;
1467     AliMixture(67,"POLYURETHANE$",aA,zZ,den,+4,wW);
1468     AliMedium(67,"POLYURETHANE$",67,0,ifield,fieldm,tmaxfd,stemax,
1469               deemax,epsil,stmin);
1470
1471     den = 1.158910*fRhoIncrMatBud;
1472     AliMixture(28,"POLYURESERV$",aA,zZ,den,+4,wW);
1473     AliMedium(28,"POLYURESERV$",28,0,ifield,fieldm,tmaxfd,stemax,
1474               deemax,epsil,stmin);
1475
1476     //  POM (Polyoxymethylene = (CH2O)n ) - 02 May 10
1477     zZ[2] =  8.0; aA[2] =  15.9994; // Oxigen
1478
1479     wW[0] = 0.067137;//H
1480     wW[1] = 0.400016;//C
1481     wW[2] = 0.532847;//O
1482     wW[3] = 0.000000;//O
1483     wW[4] = 0.000000;//S
1484     wW[5] = 0.000000;//F
1485     wW[6] = 0.000000;//Sn
1486     wW[7] = 0.000000;//Pb
1487     wW[8] = 0.000000;//Cr
1488     wW[9] = 0.000000;//Si
1489     wW[10] = 0.000000;//Ni
1490     wW[11] = 0.000000;//Ca
1491
1492     den = 1.4200*fRhoIncrMatBud;
1493     AliMixture(57,"POLYOXYMETHYLENE$",aA,zZ,den,+3,wW);
1494     AliMedium(57,"POLYOXYMETHYLENE$",57,0,ifield,fieldm,tmaxfd,stemax,
1495               deemax,epsil,stmin);
1496
1497
1498     // Anticorodal (Aliminum alloy) - 08 nov 10
1499     // A,Z from Root TGeoElementTable, W from Web sites
1500     zZ[0] = 13.0; aA[0] =  26.9815; // Aluminium
1501     zZ[1] = 29.0; aA[1] =  63.546 ; // Copper
1502     zZ[2] = 26.0; aA[2] =  55.845 ; // Iron
1503     zZ[3] = 25.0; aA[3] =  54.938 ; // Manganese
1504     zZ[4] = 12.0; aA[4] =  24.305 ; // Magnesium
1505     zZ[5] = 14.0; aA[5] =  28.0855; // Silicon
1506     zZ[6] = 30.0; aA[6] =  65.39  ; // Zinc
1507     zZ[7] = 24.0; aA[7] =  51.9961; // Chromium
1508     zZ[8] = 22.0; aA[8] =  47.867 ; // Titanium
1509
1510     wW[1] = 0.001000;//Cu
1511     wW[2] = 0.005000;//Fe
1512     wW[3] = 0.007000;//Mn - mean value
1513     wW[4] = 0.009000;//Mg - mean value
1514     wW[5] = 0.001000;//Si - mean value
1515     wW[6] = 0.002000;//Zn
1516     wW[7] = 0.002500;//Cr
1517     wW[8] = 0.001000;//Ti
1518
1519     Double_t totFrac = 0;
1520     for (Int_t j=1; j<9; j++)
1521       totFrac += wW[j];
1522     wW[0] = 1. - totFrac;//Al - the remainder
1523
1524     den = 2.69*fRhoIncrMatBud;
1525     AliMixture(93,"ANTICORODAL$",aA,zZ,den,+9,wW);
1526     AliMedium(93,"ANTICORODAL$",93,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1527
1528     // Hokotol (another Aluminium alloy) - 08 nov 10
1529     // A,Z from Root TGeoElementTable, W from Web sites
1530     zZ[0] = 13.0; aA[0] =  26.9815; // Aluminium
1531     zZ[1] = 29.0; aA[1] =  63.546 ; // Copper
1532     zZ[2] = 26.0; aA[2] =  55.845 ; // Iron
1533     zZ[3] = 25.0; aA[3] =  54.938 ; // Manganese
1534     zZ[4] = 12.0; aA[4] =  24.305 ; // Magnesium
1535     zZ[5] = 14.0; aA[5] =  28.0855; // Silicon
1536     zZ[6] = 30.0; aA[6] =  65.39  ; // Zinc
1537     zZ[7] = 24.0; aA[7] =  51.9961; // Chromium
1538     zZ[8] = 22.0; aA[8] =  47.867 ; // Titanium
1539     zZ[9] = 40.0; aA[9] =  91.224 ; // Zirconium
1540
1541     wW[1] = 0.020500;//Cu - mean value
1542     wW[2] = 0.000300;//Fe
1543     wW[3] = 0.022000;//Mn - mean value
1544     wW[4] = 0.001000;//Mg - mean value
1545     wW[5] = 0.002000;//Si - mean value
1546     wW[6] = 0.066500;//Zn
1547     wW[7] = 0.005000;//Cr
1548     wW[8] = 0.000600;//Ti
1549     wW[9] = 0.001650;//Zr - mean value
1550
1551     totFrac = 0;
1552     for (Int_t j=1; j<10; j++)
1553       totFrac += wW[j];
1554     wW[0] = 1. - totFrac;//Al - the remainder
1555
1556     den = 2.69;
1557     AliMixture(34,"HOKOTOL$",aA,zZ,den,+10,wW);
1558     AliMedium(34,"HOKOTOL$",34,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1559     
1560     // Ergal (7075) (yet another Aluminium alloy) - 09 nov 10
1561     // A,Z from Root TGeoElementTable, W from Web sites
1562     zZ[0] = 13.0; aA[0] =  26.9815; // Aluminium
1563     zZ[1] = 29.0; aA[1] =  63.546 ; // Copper
1564     zZ[2] = 26.0; aA[2] =  55.845 ; // Iron
1565     zZ[3] = 25.0; aA[3] =  54.938 ; // Manganese
1566     zZ[4] = 12.0; aA[4] =  24.305 ; // Magnesium
1567     zZ[5] = 14.0; aA[5] =  28.0855; // Silicon
1568     zZ[6] = 30.0; aA[6] =  65.39  ; // Zinc
1569     zZ[7] = 24.0; aA[7] =  51.9961; // Chromium
1570     zZ[8] = 22.0; aA[8] =  47.867 ; // Titanium
1571
1572     wW[1] = 0.016000;//Cu - mean value
1573     wW[2] = 0.005000;//Fe
1574     wW[3] = 0.003000;//Mn
1575     wW[4] = 0.025000;//Mg - mean value
1576     wW[5] = 0.004000;//Si
1577     wW[6] = 0.056000;//Zn - mean value
1578     wW[7] = 0.002300;//Cr - mean value
1579     wW[8] = 0.002000;//Ti
1580
1581     totFrac = 0;
1582     for (Int_t j=1; j<9; j++)
1583       totFrac += wW[j];
1584     wW[0] = 1. - totFrac;//Al - the remainder
1585
1586     den = 2.69;
1587     AliMixture(33,"ERGAL$",aA,zZ,den,+9,wW);
1588     AliMedium(33,"ERGAL$",33,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1589
1590 }
1591
1592 //______________________________________________________________________
1593 void AliITSv11::Init()
1594 {
1595     //     Initialise the ITS after it has been created.
1596     // Inputs:
1597     //   none.
1598     // Outputs:
1599     //   none.
1600     // Return:
1601     //   none.
1602
1603     AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
1604                  fMinorVersion));
1605     UpdateInternalGeometry();
1606     AliITS::Init();
1607
1608     fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
1609 }
1610
1611 //______________________________________________________________________
1612 void AliITSv11::SetDefaults()
1613 {
1614     // sets the default segmentation, response, digit and raw cluster classes
1615     // Inputs:
1616     //   none.
1617     // Outputs:
1618     //   none.
1619     // Return:
1620     //   none.
1621
1622     if(!fDetTypeSim){
1623         Warning("SetDefaults","Error fDetTypeSim not defined");
1624         return;
1625     }
1626
1627     fDetTypeSim->SetDefaults();
1628     
1629
1630     if(fgkNTYPES>3){
1631         Warning("SetDefaults",
1632                 "Only the four basic detector types are initialised!");
1633     }// end if
1634     return;
1635 }
1636
1637 //______________________________________________________________________
1638 void AliITSv11::StepManager()
1639 {
1640     //    Called for every step in the ITS, then calles the AliITShit class
1641     // creator with the information to be recoreded about that hit.
1642     //     The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
1643     // printing of information to a file which can be used to create a .det
1644     // file read in by the routine CreateGeometry(). If set to 0 or any other
1645     // value except 1, the default behavior, then no such file is created nor
1646     // it the extra variables and the like used in the printing allocated.
1647     // Inputs:
1648     //   none.
1649     // Outputs:
1650     //   none.
1651     // Return:
1652     //   none.
1653
1654     if(!(this->IsActive())) return;
1655     if(!(gMC->TrackCharge())) return;
1656
1657     Int_t copy, lay = 0;
1658     Int_t id = gMC->CurrentVolID(copy);
1659
1660     Bool_t notSens = kFALSE;
1661     while ((lay<fIdN)  && (notSens = id != fIdSens[lay])) ++lay;
1662     if (notSens) return;
1663
1664     if(gMC->IsTrackExiting()) {
1665         AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
1666     } // if Outer ITS mother Volume
1667
1668     static TLorentzVector position, momentum; // Saves on calls to construtors
1669     static AliITShit hit;// Saves on calls to constructors
1670
1671     TClonesArray &lhits = *(Hits());
1672     Int_t   cpn0, cpn1, mod, status = 0;
1673     //
1674     // Track status
1675     if(gMC->IsTrackInside())      status +=  1;
1676     if(gMC->IsTrackEntering())    status +=  2;
1677     if(gMC->IsTrackExiting())     status +=  4;
1678     if(gMC->IsTrackOut())         status +=  8;
1679     if(gMC->IsTrackDisappeared()) status += 16;
1680     if(gMC->IsTrackStop())        status += 32;
1681     if(gMC->IsTrackAlive())       status += 64;
1682
1683     //
1684     // retrieve the indices with the volume path
1685     //
1686     switch (lay) {
1687     case 0:case 1: // SPD
1688       gMC->CurrentVolOffID(1,copy); // ladder
1689       gMC->CurrentVolOffID(3,cpn1); // stave
1690       gMC->CurrentVolOffID(5,cpn0); // sector
1691       break;
1692     case 2:case 3: // SDD
1693       copy = 1;
1694       gMC->CurrentVolOffID(2,cpn1);
1695       gMC->CurrentVolOffID(3,cpn0);
1696       break;
1697     case 4:case 5: // SSD
1698       copy = 1;
1699       gMC->CurrentVolOffID(1,cpn1);
1700       gMC->CurrentVolOffID(2,cpn0);
1701       break;
1702     default:
1703       AliError(Form("Invalid value: lay= %d . Not an ITS sensitive volume",lay));
1704       return; // not an ITS sensitive volume.
1705     } //
1706
1707     fInitGeom.DecodeDetector(mod,lay+1,cpn0,cpn1,copy);
1708     // We should not need to pass by the switch !
1709     // This is time consuming...
1710     // therefore DecodeDetectorv11(...) shouldn't be private !
1711     // and we should be able to use instead :
1712     //fInitGeom.DecodeDetectorv11(mod,lay+1,cpn0,cpn1,copy);
1713
1714     //
1715     // Fill hit structure.
1716     //
1717     hit.SetModule(mod);
1718     hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
1719     gMC->TrackPosition(position);
1720     gMC->TrackMomentum(momentum);
1721     hit.SetPosition(position);
1722     hit.SetTime(gMC->TrackTime());
1723     hit.SetMomentum(momentum);
1724     hit.SetStatus(status);
1725     hit.SetEdep(gMC->Edep());
1726     hit.SetShunt(GetIshunt());
1727     if(gMC->IsTrackEntering()){
1728         hit.SetStartPosition(position);
1729         hit.SetStartTime(gMC->TrackTime());
1730         hit.SetStartStatus(status);
1731         return; // don't save entering hit.
1732     } // end if IsEntering
1733     // Fill hit structure with this new hit.
1734     //Info("StepManager","Calling Copy Constructor");
1735     new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
1736     // Save old position... for next hit.
1737     hit.SetStartPosition(position);
1738     hit.SetStartTime(gMC->TrackTime());
1739     hit.SetStartStatus(status);
1740
1741     return;
1742 }