]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/AliITSvUpgrade.cxx
restore threshold getters after parameter dynamics update (fw v. >= A012)
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSvUpgrade.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: AliITSvUpgrade.cxx */
18
19
20 //========================================================================
21 //
22 //        Geometry for the Upgrade of the Inner Tracking System
23 //
24 // Mario Sitta (sitta@to.infn.it)
25 //
26 //========================================================================
27
28
29
30 // $Log: AliITSvUpgrade.cxx,v $
31
32 #include <TClonesArray.h>
33 #include <TGeoGlobalMagField.h>
34 #include <TGeoManager.h>
35 #include <TGeoMatrix.h>
36 #include <TGeoPhysicalNode.h>
37 #include <TGeoVolume.h>
38 #include <TGeoXtru.h>
39 #include <TLorentzVector.h>
40 #include <TString.h>
41 #include <TVirtualMC.h>
42
43 #include "AliITSUpg.h"
44 #include "AliITSDetTypeSim.h"
45 #include "AliITShit.h"
46 #include "AliLog.h"
47 #include "AliMC.h"
48 #include "AliMagF.h"
49 #include "AliRun.h"
50 #include "AliTrackReference.h"
51 #include "AliITSInitGeometryUpg.h"
52 #include "AliITSv11Geometry.h"
53 #include "AliITSv11GeometryUpgrade.h"
54 #include "AliITSvUpgrade.h"
55 #include "AliGeomManager.h"
56
57 ClassImp(AliITSvUpgrade)
58
59 //______________________________________________________________________
60 AliITSvUpgrade::AliITSvUpgrade():
61   fMajorVersion(IsVersion()),
62   fMinorVersion(-1),
63   fNumberOfLayers(0),
64   fLayTurbo(0),
65   fLayRadii(0),
66   fLayZLength(0),
67   fLaddPerLay(0),
68   fModPerLadd(0),
69   fLadThick(0),
70   fLadWidth(0),
71   fLadTilt(0),
72   fDetThick(0),
73   fInitGeom((AliITSVersion_t)fMajorVersion,fMinorVersion),
74   fUpGeom(0)
75  {
76     //    Standard default constructor
77     // Inputs:
78     //   none.
79     // Outputs:
80     //   none.
81     // Return:
82     //   none.
83 }
84
85 //______________________________________________________________________
86 AliITSvUpgrade::AliITSvUpgrade(const char *title):
87   AliITSUpg("ITS", title),
88   fMajorVersion(IsVersion()),
89   fMinorVersion(-1),
90   fNumberOfLayers(0),
91   fLayTurbo(0),
92   fLayRadii(0),
93   fLayZLength(0),
94   fLaddPerLay(0),
95   fModPerLadd(0),
96   fLadThick(0),
97   fLadWidth(0),
98   fLadTilt(0),
99   fDetThick(0),
100   fInitGeom((AliITSVersion_t)fMajorVersion,fMinorVersion),
101   fUpGeom(0)
102 {
103     //    Standard constructor for the Upgrade geometry.
104     // Inputs:
105     //   const char * title  Arbitrary title
106     // Outputs:
107     //   none.
108     // Return:
109     //   none.
110
111   fIdN = 6;
112   fIdName = new TString[fIdN];
113
114   fIdName[0] = "ITS1";
115   fIdName[1] = "ITS2";
116   fIdName[2] = "ITS3";
117   fIdName[3] = "ITS4";
118   fIdName[4] = "ITS5";
119   fIdName[5] = "ITS6";
120
121   fIdSens    = new Int_t[fIdN];
122   for(Int_t i=0; i<fIdN; i++) fIdSens[i] = 0;
123
124   fLayTurbo   = new Bool_t[fIdN];
125   fLayRadii   = new Double_t[fIdN];
126   fLayZLength = new Double_t[fIdN];
127   fLaddPerLay = new Int_t[fIdN];
128   fModPerLadd = new Int_t[fIdN];
129   fLadThick   = new Double_t[fIdN];
130   fLadWidth   = new Double_t[fIdN];
131   fLadTilt    = new Double_t[fIdN];
132   fDetThick   = new Double_t[fIdN];
133
134   fUpGeom = new AliITSv11GeometryUpgrade*[fIdN];
135
136   if (fNumberOfLayers > 0)  // if not, we'll Fatal-ize in CreateGeometry
137     for (Int_t j=0; j<fNumberOfLayers; j++) {
138       fLayRadii[j] = 0.;
139       fLayZLength[j] = 0.;
140       fLaddPerLay[j] = 0;
141       fModPerLadd[j] = 0;
142       fLadWidth[j] = 0.;
143       fDetThick[j] = 0.;
144       fUpGeom[j] = 0;
145     }
146     
147 }
148
149 //______________________________________________________________________
150 AliITSvUpgrade::AliITSvUpgrade(const char *name, const char *title,
151                                const Int_t nlay):
152   AliITSUpg("ITS", title),
153   fMajorVersion(IsVersion()),
154   fMinorVersion(1),
155   fNumberOfLayers(nlay),
156   fLayTurbo(0),
157   fLayRadii(0),
158   fLayZLength(0),
159   fLaddPerLay(0),
160   fModPerLadd(0),
161   fLadThick(0),
162   fLadWidth(0),
163   fLadTilt(0),
164   fDetThick(0),
165   fInitGeom((AliITSVersion_t)fMajorVersion,fMinorVersion),
166   fUpGeom(0)
167 {
168     //    Standard constructor for the Upgrade geometry.
169     // Inputs:
170     //   const char * name   Ignored, set to "ITS"
171     //   const char * title  Arbitrary title
172     //   const Int_t nlay    Number of layers
173     // Outputs:
174     //   none.
175     // Return:
176     //   none.
177   
178   fIdN = nlay;
179   fIdName = new TString[fIdN];
180
181   for (Int_t j=0; j<fIdN; j++)
182     fIdName[j].Form("ITSupgSensor%d",j); // See AliITSv11GeometryUpgrade
183
184   (void) name; // removes warning message
185
186   fIdSens    = new Int_t[fIdN];
187   for(Int_t i=0; i<fIdN; i++) fIdSens[i] = 0;
188
189   fLayTurbo   = new Bool_t[fIdN];
190   fLayRadii   = new Double_t[fIdN];
191   fLayZLength = new Double_t[fIdN];
192   fLaddPerLay = new Int_t[fIdN];
193   fModPerLadd = new Int_t[fIdN];
194   fLadThick   = new Double_t[fIdN];
195   fLadWidth   = new Double_t[fIdN];
196   fLadTilt    = new Double_t[fIdN];
197   fDetThick   = new Double_t[fIdN];
198
199   fUpGeom = new AliITSv11GeometryUpgrade*[fIdN];
200   
201   if (fNumberOfLayers > 0)  // if not, we'll Fatal-ize in CreateGeometry
202     for (Int_t j=0; j<fNumberOfLayers; j++) {
203       fLayRadii[j] = 0.;
204       fLayZLength[j] = 0.;
205       fLaddPerLay[j] = 0;
206       fModPerLadd[j] = 0;
207       fLadWidth[j] = 0.;
208       fDetThick[j] = 0.;
209       fUpGeom[j] = 0;
210     }
211     
212 }
213
214 //______________________________________________________________________
215 AliITSvUpgrade::~AliITSvUpgrade() {
216     //    Standard destructor
217     // Inputs:
218     //   none.
219     // Outputs:
220     //   none.
221     // Return:
222     //   none.
223   delete [] fLayTurbo;
224   delete [] fLayRadii;
225   delete [] fLayZLength;
226   delete [] fLaddPerLay;
227   delete [] fModPerLadd;
228   delete [] fLadThick;
229   delete [] fLadWidth;
230   delete [] fLadTilt;
231   delete [] fDetThick;
232   delete [] fUpGeom;
233
234 }
235
236 //______________________________________________________________________
237 void AliITSvUpgrade::SetT2Lmatrix(Int_t uid, Double_t yShift, 
238                                   Bool_t yFlip, Bool_t yRot180) const {
239
240   //
241   // Creates the TGeo Local to Tracking transformation matrix
242   // and sends it to the corresponding TGeoPNEntry 
243   //
244   // This function is used in AddAlignableVolumes()
245
246   TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(uid);
247   TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
248
249   Double_t *gtrans = globMatrix->GetTranslation(), rotMatrix[9];
250   memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t));
251   Double_t al = TMath::ATan2(rotMatrix[1],rotMatrix[0]);
252   if (yRot180) {
253     al = TMath::ATan2(rotMatrix[1],-rotMatrix[0]);
254   }
255   Double_t xShift = gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al);
256   Double_t zShift = -gtrans[2];
257
258   TGeoHMatrix *matLtoT = new TGeoHMatrix;
259   matLtoT->SetDx( xShift ); // translation
260   matLtoT->SetDy( yShift );
261   matLtoT->SetDz( zShift );
262   rotMatrix[0]= 0;  rotMatrix[1]= 1;  rotMatrix[2]= 0; // + rotation
263   rotMatrix[3]= 1;  rotMatrix[4]= 0;  rotMatrix[5]= 0;
264   rotMatrix[6]= 0;  rotMatrix[7]= 0;  rotMatrix[8]=-1;
265   if (yFlip) rotMatrix[3] = -1;  // flipping in y  (for SPD1)
266   if (yFlip) rotMatrix[1] = -1;  // flipping in y  (for SPD1)
267
268   if (yRot180) { // rotation of pi around the axis perpendicular to the wafer
269     if (yFlip) matLtoT->SetDx( -xShift ); // flipping in y  (for SPD1)
270     matLtoT->SetDy( -yShift );
271     matLtoT->SetDz( -zShift );
272     rotMatrix[8]=1;
273     rotMatrix[3] = -1;
274     if (yFlip) rotMatrix[3] = 1;  // flipping in y  (for SPD1)
275   }
276
277   TGeoRotation rot;
278   rot.SetMatrix(rotMatrix);
279   matLtoT->MultiplyLeft(&rot);
280   TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
281   delete matLtoT;
282   alignableEntry->SetMatrix(matTtoL);
283 }
284
285 //______________________________________________________________________
286 void AliITSvUpgrade::AddAlignableVolumes() const{
287   // Creates entries for alignable volumes associating the symbolic volume
288   // name with the corresponding volume path.
289   // 
290   // Records in the alignable entries the transformation matrices converting
291   // TGeo local coordinates (in the RS of alignable volumes) to the tracking
292   // system
293   // For this, this function has to run before the misalignment because we
294   // are using the ideal positions in the AliITSgeom object.
295   // Inputs:
296   //   none.
297   // Outputs:
298   //   none.
299   // Return:
300   //   none.
301
302   AliInfo("Add ITS alignable volumes");
303
304   if (!gGeoManager) {
305     AliFatal("TGeoManager doesn't exist !");
306     return;
307   }
308   // To be done - dummy for the time being
309 }
310
311 //______________________________________________________________________
312 void AliITSvUpgrade::CreateGeometry() {
313
314   // Create the geometry and insert it in the mother volume ITSV
315
316
317   TGeoManager *geoManager = gGeoManager;
318
319   TGeoVolume *vALIC = geoManager->GetVolume("ALIC");
320
321   new TGeoVolumeAssembly("ITSV");
322   TGeoVolume *vITSV = geoManager->GetVolume("ITSV");
323   vALIC->AddNode(vITSV, 2, 0);  // Copy number is 2 to cheat AliGeoManager::CheckSymNamesLUT
324
325   //
326   const Char_t *cvsDate="$Date: 2011-03-11 18:17:13 +0100 (Fri, 11 Mar 2011) $";
327   const Char_t *cvsRevision="$Revision: 48336 $";
328   const Int_t kLength=100;
329   Char_t vstrng[kLength];
330   if(fInitGeom.WriteVersionString(vstrng,kLength,(AliITSVersion_t)IsVersion(),
331                              fMinorVersion,cvsDate,cvsRevision)) {
332     vITSV->SetTitle(vstrng);
333   }
334
335   // Check that we have all needed parameters
336   if (fNumberOfLayers <= 0)
337     AliFatal(Form("Wrong number of layers (%d)",fNumberOfLayers));
338
339   for (Int_t j=0; j<fNumberOfLayers; j++) {
340     if (fLayRadii[j] <= 0)
341       AliFatal(Form("Wrong layer radius for layer %d (%f)",j,fLayRadii[j]));
342     if (fLayZLength[j] <= 0)
343       AliFatal(Form("Wrong layer length for layer %d (%f)",j,fLayZLength[j]));
344     if (fLaddPerLay[j] <= 0)
345       AliFatal(Form("Wrong number of ladders for layer %d (%d)",j,
346                     fLaddPerLay[j]));
347     if (fModPerLadd[j] <= 0)
348       AliFatal(Form("Wrong number of modules for layer %d (%d)",j,
349                     fModPerLadd[j]));
350     if (fLadThick[j] < 0)
351       AliFatal(Form("Wrong ladder thickness for layer %d (%f)",j,
352                     fLadThick[j]));
353     if (fLayTurbo[j] && fLadWidth[j] <= 0)
354       AliFatal(Form("Wrong ladder width for layer %d (%f)",j,
355                     fLadWidth[j]));
356     if (fDetThick[j] < 0)
357       AliFatal(Form("Wrong module thickness for layer %d (%f)",j,
358                     fDetThick[j]));
359
360     if (j > 0) {
361       if (fLayRadii[j] <= fLayRadii[j-1])
362         AliError(Form("Layer %d radius (%f) is smaller than layer %d radius (%f)",
363                       j,fLayRadii[j],j-1,fLayRadii[j-1]));
364       if (fLayZLength[j] <= fLayZLength[j-1])
365         AliWarning(Form("Layer %d length (%f) is smaller than layer %d length (%f)",
366                       j,fLayZLength[j],j-1,fLayZLength[j-1]));
367     } // if (j > 0)
368
369     if (fLadThick[j] == 0)
370       AliInfo(Form("Ladder thickness for layer %d not set, using default",j));
371
372     if (fDetThick[j] == 0)
373       AliInfo(Form("Module thickness for layer %d not set, using default",j));
374
375   } // for (Int_t j=0; j<fNumberOfLayers; j++)
376
377   // Now create the actual geometry
378   for (Int_t j=0; j<fNumberOfLayers; j++) {
379     if (fLayTurbo[j]) {
380       fUpGeom[j] = new AliITSv11GeometryUpgrade(j,kTRUE,kFALSE);
381       fUpGeom[j]->SetLadderWidth(fLadWidth[j]);
382       fUpGeom[j]->SetLadderTilt(fLadTilt[j]);
383     }
384     else
385       fUpGeom[j] = new AliITSv11GeometryUpgrade(j,kFALSE);
386     fUpGeom[j]->SetRadius(fLayRadii[j]);
387     fUpGeom[j]->SetZLength(fLayZLength[j]);
388     fUpGeom[j]->SetNLadders(fLaddPerLay[j]);
389     fUpGeom[j]->SetNModules(fModPerLadd[j]);
390     if (fLadThick[j] != 0) fUpGeom[j]->SetLadderThick(fLadThick[j]);
391     if (fDetThick[j] != 0) fUpGeom[j]->SetSensorThick(fDetThick[j]);
392     fUpGeom[j]->CreateLayer(vITSV);
393   }
394
395 }
396
397 //______________________________________________________________________
398 void AliITSvUpgrade::CreateMaterials(){
399     // Create ITS materials
400     //     This function defines the default materials used in the Geant
401     // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
402     // AliITSv11Hybrid.
403     // In general it is automatically replaced by
404     // the CreateMaterials routine defined in AliITSv?. Should the function
405     // CreateMaterials not exist for the geometry version you are using this
406     // one is used. See the definition found in AliITSv5 or the other routine
407     // for a complete definition.
408     // Inputs:
409     //   none.
410     // Outputs:
411     //   none.
412     // Return:
413     //   none.
414
415     Int_t   ifield = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
416     Float_t fieldm = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
417
418     Float_t tmaxfd = 0.1; // 1.0; // Degree
419     Float_t stemax = 1.0; // cm
420     Float_t deemax = 0.1; // 30.0; // Fraction of particle's energy 0<deemax<=1
421     Float_t epsil  = 1.0E-4; // 1.0; // cm
422     Float_t stmin  = 0.0; // cm "Default value used"
423
424     Float_t tmaxfdSi = 0.1; // .10000E+01; // Degree
425     Float_t stemaxSi = 0.0075; //  .10000E+01; // cm
426     Float_t deemaxSi = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
427     Float_t epsilSi  = 1.0E-4;// .10000E+01;
428     Float_t stminSi  = 0.0; // cm "Default value used"
429
430     Float_t tmaxfdAir = 0.1; // .10000E+01; // Degree
431     Float_t stemaxAir = .10000E+01; // cm
432     Float_t deemaxAir = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
433     Float_t epsilAir  = 1.0E-4;// .10000E+01;
434     Float_t stminAir  = 0.0; // cm "Default value used"
435
436     Float_t tmaxfdServ = 1.0; // 10.0; // Degree
437     Float_t stemaxServ = 1.0; // 0.01; // cm
438     Float_t deemaxServ = 0.5; // 0.1; // Fraction of particle's energy 0<deemax<=1
439     Float_t epsilServ  = 1.0E-3; // 0.003; // cm
440     Float_t stminServ  = 0.0; //0.003; // cm "Default value used"
441
442     // Freon PerFluorobuthane C4F10 see 
443     // http://st-support-cooling-electronics.web.cern.ch/
444     //        st-support-cooling-electronics/default.htm
445     Float_t afre[2]  = { 12.011,18.9984032 };
446     Float_t zfre[2]  = { 6., 9. };
447     Float_t wfre[2]  = { 4.,10. };
448     Float_t densfre  = 1.52;
449
450
451     //CM55J
452
453     Float_t aCM55J[4]={12.0107,14.0067,15.9994,1.00794};
454     Float_t zCM55J[4]={6.,7.,8.,1.};
455     Float_t wCM55J[4]={0.908508078,0.010387573,0.055957585,0.025146765};
456     Float_t dCM55J = 1.8;
457
458     //ALCM55J
459
460     Float_t aALCM55J[5]={12.0107,14.0067,15.9994,1.00794,26.981538};
461     Float_t zALCM55J[5]={6.,7.,8.,1.,13.};
462     Float_t wALCM55J[5]={0.817657902,0.0093488157,0.0503618265,0.0226320885,0.1};
463     Float_t dALCM55J = 1.9866;
464
465     //Si Chips
466
467     Float_t aSICHIP[6]={12.0107,14.0067,15.9994,1.00794,28.0855,107.8682};
468     Float_t zSICHIP[6]={6.,7.,8.,1.,14., 47.};
469     Float_t wSICHIP[6]={0.039730642,0.001396798,0.01169634,0.004367771,0.844665,0.09814344903};
470     Float_t dSICHIP = 2.36436;
471
472     //Inox
473     
474     Float_t aINOX[9]={12.0107,54.9380, 28.0855,30.9738,32.066,58.6928,51.9961,95.94,55.845};
475     Float_t zINOX[9]={6.,25.,14.,15.,16., 28.,24.,42.,26.};
476     Float_t wINOX[9]={0.0003,0.02,0.01,0.00045,0.0003,0.12,0.17,0.025,0.654};
477     Float_t dINOX = 8.03;
478
479     //AISI 304 L (from F.Tosello's web page - M.S. 18 Oct 10)
480     
481     Float_t a304L[8]={12.0107,54.9380, 28.0855,30.9738,32.066,58.6928,51.9961,55.845};
482     Float_t z304L[8]={6.,25.,14.,15.,16., 28.,24.,26.};
483     Float_t w304L[8]={0.0003,0.02,0.01,0.00045,0.003,0.0925,0.19,0.6865};
484     Float_t d304L = 8.03;
485
486     //SDD HV microcable
487
488     Float_t aHVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
489     Float_t zHVm[5]={6.,1.,7.,8.,13.};
490     Float_t wHVm[5]={0.520088819984,0.01983871336,0.0551367996,0.157399667056, 0.247536};
491     Float_t dHVm = 1.6087;
492
493     //SDD LV+signal cable
494
495     Float_t aLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
496     Float_t zLVm[5]={6.,1.,7.,8.,13.};
497     Float_t wLVm[5]={0.21722436468,0.0082859922,0.023028867,0.06574077612, 0.68572};
498     Float_t dLVm = 2.1035;
499
500     //SDD hybrid microcab
501
502     Float_t aHLVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
503     Float_t zHLVm[5]={6.,1.,7.,8.,13.};
504     Float_t wHLVm[5]={0.24281879711,0.00926228815,0.02574224025,0.07348667449, 0.64869};
505     Float_t dHLVm = 2.0502;
506
507     //SDD anode microcab
508
509     Float_t aALVm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
510     Float_t zALVm[5]={6.,1.,7.,8.,13.};
511     Float_t wALVm[5]={0.392653705471,0.0128595919215,0.041626868025,0.118832707289, 0.431909};
512     Float_t dALVm = 2.0502;
513
514     //X7R capacitors - updated from F.Tosello's web page - M.S. 18 Oct 10
515
516     Float_t aX7R[6]={137.327,47.867,15.9994,58.6928,63.5460,118.710};
517     Float_t zX7R[6]={56.,22.,8.,28.,29.,50.};
518     Float_t wX7R[6]={0.524732,0.176736,0.179282,0.079750,0.019750,0.019750};
519     Float_t dX7R = 6.07914;
520
521     //X7R weld, i.e. Sn 60% Pb 40% (from F.Tosello's web page - M.S. 15 Oct 10)
522
523     Float_t aX7Rweld[2]={118.71 , 207.20};
524     Float_t zX7Rweld[2]={ 50.   ,  82.  };
525     Float_t wX7Rweld[2]={  0.60 ,   0.40};
526     Float_t dX7Rweld   = 8.52358;
527
528     // AIR
529
530     Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
531     Float_t zAir[4]={6.,7.,8.,18.};
532     Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
533     Float_t dAir = 1.20479E-3;
534
535     // Water
536
537     Float_t aWater[2]={1.00794,15.9994};
538     Float_t zWater[2]={1.,8.};
539     Float_t wWater[2]={0.111894,0.888106};
540     Float_t dWater   = 1.0;
541
542     // CERAMICS
543   //     94.4% Al2O3 , 2.8% SiO2 , 2.3% MnO , 0.5% Cr2O3
544     Float_t acer[5]  = { 26.981539,15.9994,28.0855,54.93805,51.9961 };
545     Float_t zcer[5]  = {       13.,     8.,    14.,     25.,    24. };
546     Float_t wcer[5]  = {.4443408,.5213375,.0130872,.0178135,.003421};
547     Float_t denscer  = 3.6;
548
549     //G10FR4
550
551     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};
552     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};
553     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};
554     Float_t densG10FR4= 1.8;
555     
556      //--- EPOXY  --- C18 H19 O3
557       Float_t aEpoxy[3] = {15.9994, 1.00794, 12.0107} ; 
558       Float_t zEpoxy[3] = {     8.,      1.,      6.} ; 
559       Float_t wEpoxy[3] = {     3.,     19.,     18.} ; 
560       Float_t dEpoxy = 1.8 ;
561
562       // rohacell: C9 H13 N1 O2
563     Float_t arohac[4] = {12.01,  1.01, 14.010, 16.};
564     Float_t zrohac[4] = { 6.,    1.,    7.,     8.};
565     Float_t wrohac[4] = { 14.,   10.,    2.,     6.};
566     Float_t drohac    = 0.052;
567
568     // If he/she means stainless steel (inox) + Aluminium and Zeff=15.3383 then
569 //
570 // %Al=81.6164 %inox=100-%Al
571
572     Float_t aInAl[5] = {27., 55.847,51.9961,58.6934,28.0855 };
573     Float_t zInAl[5] = {13., 26.,24.,28.,14. };
574     Float_t wInAl[5] = {.816164, .131443,.0330906,.0183836,.000919182};
575     Float_t dInAl    = 3.075;
576
577     // Aluminum alloy with 12% Copper - 21 Oct 10
578
579     Float_t aAlCu12[2] = {26.9815, 63.546};
580     Float_t zAlCu12[2] = {13.    , 29.   };
581     Float_t wAlCu12[2] = { 0.88  ,  0.12 };
582     Float_t dAlCu12    = 2.96;
583
584     // Kapton
585
586     Float_t aKapton[4]={1.00794,12.0107, 14.010,15.9994};
587     Float_t zKapton[4]={1.,6.,7.,8.};
588     Float_t wKapton[4]={0.026362,0.69113,0.07327,0.209235};
589     Float_t dKapton   = 1.42;
590     
591     // Kapton + Cu (for Pixel Bus)
592
593     Float_t aKaptonCu[5]={1.00794, 12.0107, 14.010, 15.9994, 63.5460};
594     Float_t zKaptonCu[5]={1., 6., 7., 8., 29.};
595     Float_t wKaptonCuBus[5];
596     
597     // Kapton + Cu (for Pixel MCM)
598
599     Float_t wKaptonCuMCM[5];
600     
601     // Kapton + Cu (mix of two above)
602
603     Float_t wKaptonCuMix[5];
604
605     //SDD ruby sph.
606     Float_t aAlOxide[2]  = { 26.981539,15.9994};
607     Float_t zAlOxide[2]  = {       13.,     8.};
608     Float_t wAlOxide[2]  = {0.4707, 0.5293};
609     Float_t dAlOxide     = 3.97;
610
611     // Silica for optical fibers: Si O2
612     Float_t aoptfib[2] = { 28.0855, 15.9994};
613     Float_t zoptfib[2] = { 14.,      8.    };
614     Float_t woptfib[2] = {  1.,      2.    };
615     Float_t doptfib    = 2.55;
616
617     // Tetrafluorethylene-Perfluorpropylene (FEP) - 08 Mar 10
618     Float_t aFEP[2] = { 12.0107, 18.9984};
619     Float_t zFEP[2] = {  6.    ,  9.    };
620     Float_t wFEP[2] = {  1.    ,  2.    };
621     Float_t dFEP    = 2.15;
622
623     // PVC (C2H3Cl)n - 08 Jul 10
624     Float_t aPVC[3] = { 12.0107, 1.00794, 35.4527};
625     Float_t zPVC[3] = {  6.    , 1.     , 35.   };
626     Float_t wPVC[3] = {  2.    , 3.     ,  1.   };
627     Float_t dPVC    = 1.3;
628
629     // PBT (Polybutylene terephthalate = C12-H12-O4) - 01 Sep 10
630     Float_t aPBT[3] = { 12.0107, 1.00794, 15.9994};
631     Float_t zPBT[3] = {  6.    , 1.     ,  8.   };
632     Float_t wPBT[3] = { 12.    ,12.     ,  4.   };
633     Float_t dPBT    = 1.31;
634
635     // POLYAX (POLYAX = C37-H24-O6-N2) - 03 Sep 10
636     Float_t aPOLYAX[4] = { 12.0107, 1.00794, 15.9994, 14.00674};
637     Float_t zPOLYAX[4] = {  6.    , 1.     ,  8.    ,  7.     };
638     Float_t wPOLYAX[4] = { 37.    ,24.     ,  6.    ,  2.     };
639     Float_t dPOLYAX    = 1.27;
640
641     // PPS (PPS = C6-H4-S) - 05 Sep 10
642     Float_t aPPS[3] = { 12.0107, 1.00794, 32.066};
643     Float_t zPPS[3] = {  6.    , 1.     , 16.   };
644     Float_t wPPS[3] = {  6.    , 4.     ,  1.   };
645     Float_t dPPS    = 1.35;
646
647     // Megolon (Polyolefin = (C-H2)n) - 20 Oct 10
648     Float_t aMegolon[2] = { 12.0107, 1.00794};
649     Float_t zMegolon[2] = {  6.    , 1.     };
650     Float_t wMegolon[2] = {  1.    , 2.     };
651     Float_t dMegolon    = 1.51; // Mean of various types
652
653     // Standard glass (from glassproperties.com/glasses - M.S. 21 Oct 10)
654     Float_t aStdGlass[7] = {15.9994  ,28.0855  ,22.98977 ,40.078   ,
655                             24.305   ,26.981539,39.0983  };
656     Float_t zStdGlass[7] = { 8.      ,14.      ,11.      ,20.      ,
657                             12.      ,13.      ,19.      };
658     Float_t wStdGlass[7] = { 0.468377, 0.348239, 0.096441, 0.071469,
659                              0.006030, 0.005293, 0.004151};
660     Float_t dStdGlass    = 2.53;
661
662     // Glass Fiber (from F.Tosello's web page - M.S. 15 Oct 10)
663     Float_t aGlass[11] = {15.9994  ,28.0855  ,40.078   ,26.981539,10.811   ,
664                 24.305   ,39.0983  ,22.98977 ,18.9984  ,47.867   ,55.845};
665     Float_t zGlass[11] = { 8.      ,14.      ,20       ,13       , 5       ,
666                 12.      ,19       ,11       , 9       ,22       ,26    };
667     Float_t wGlass[11] = { 0.473610, 0.252415, 0.135791, 0.068803, 0.023293,
668                  0.015076, 0.008301, 0.007419, 0.007000, 0.004795, 0.003497};
669     Float_t dGlass = 2.61;
670
671     // Ryton R-4 04 (from F.Tosello's web page - M.S. 15 Oct 10)
672     Float_t aRyton[14] = {15.9994  ,28.0855  ,40.078   ,26.981539,10.811   ,
673                           24.305   ,39.0983  ,22.98977 ,18.9984  ,47.867   ,
674                           55.845   ,12.0107  , 1.00794 ,32.066   };
675     Float_t zRyton[14] = { 8.      ,14.      ,20.      ,13.      , 5.      ,
676                           12.      ,19.      ,11.      , 9.      ,22.      ,
677                           26.      , 6.      , 1.      ,16.      };
678     Float_t wRyton[14] = { 0.189445, 0.100966, 0.054316, 0.027521, 0.009317,
679                            0.006030, 0.003320, 0.002968, 0.002800, 0.001918,
680                            0.001399, 0.399760, 0.022365, 0.177875};
681     Float_t dRyton = 1.65;
682
683     // Plexiglas (Poly(methyl methacrylate) (C5O2H8)n - M.S. 05 nov 10)
684     Float_t aPlexy[3] = { 12.0107, 15.9994,  1.00794};
685     Float_t zPlexy[3] = {  6.    , 8.     ,  1.   };
686     Float_t wPlexy[3] = {  5.    , 2.     ,  8.   };
687     Float_t dPlexy    = 1.18;
688
689     //SSD NiSn capacitor ends
690     Float_t aNiSn[2]  = { 56.6934,118.710};
691     Float_t zNiSn[2]  = {     28.,     50.};
692     Float_t wNiSn[2]  = {0.33, 0.67};
693     Float_t dNiSn     = wNiSn[0]*8.908 + wNiSn[1]*7.310;
694
695     AliMaterial(1,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
696     AliMedium(1,"SI$",1,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
697
698     AliMaterial(2,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
699     AliMedium(2,"SPD SI CHIP$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
700
701     AliMaterial(3,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
702     AliMedium(3,"SPD SI BUS$",3,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
703
704     AliMixture(4,"C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
705     AliMedium(4,"C (M55J)$",4,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
706
707     AliMixture(5,"AIR$",aAir,zAir,dAir,4,wAir);
708     AliMedium(5,"AIR$",5,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
709
710     AliMixture(6,"GEN AIR$",aAir,zAir,dAir,4,wAir);
711     AliMedium(6,"GEN AIR$",6,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
712
713     AliMixture(7,"SDD SI CHIP$",aSICHIP,zSICHIP,dSICHIP,6,wSICHIP);
714     AliMedium(7,"SDD SI CHIP$",7,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
715
716     AliMixture(9,"SDD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
717     AliMedium(9,"SDD C (M55J)$",9,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
718
719     AliMixture(10,"SDD AIR$",aAir,zAir,dAir,4,wAir);
720     AliMedium(10,"SDD AIR$",10,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
721
722     AliMaterial(11,"AL$",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
723     AliMedium(11,"AL$",11,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
724
725     AliMixture(12, "Water$",aWater,zWater,dWater,2,wWater);
726     AliMedium(12,"WATER$",12,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
727
728     AliMixture(13,"Freon$",afre,zfre,densfre,-2,wfre);
729     AliMedium(13,"Freon$",13,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
730
731     AliMaterial(14,"COPPER$",0.63546E+02,0.29000E+02,0.89600E+01,0.14300E+01,0.99900E+03);
732     AliMedium(14,"COPPER$",14,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
733     AliMixture(15,"CERAMICS$",acer,zcer,denscer,5,wcer);
734     AliMedium(15,"CERAMICS$",15,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
735
736     AliMixture(20,"SSD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
737     AliMedium(20,"SSD C (M55J)$",20,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
738
739     AliMixture(21,"SSD AIR$",aAir,zAir,dAir,4,wAir);
740     AliMedium(21,"SSD AIR$",21,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
741
742     AliMixture(25,"G10FR4$",aG10FR4,zG10FR4,densG10FR4,14,wG10FR4);
743     AliMedium(25,"G10FR4$",25,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
744
745      AliMixture(26,"GEN C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
746     AliMedium(26,"GEN C (M55J)$",26,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
747
748     AliMixture(27,"GEN Air$",aAir,zAir,dAir,4,wAir);
749     AliMedium(27,"GEN Air$",27,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
750
751     AliMixture(35,"PLEXYGLAS$",aPlexy,zPlexy,dPlexy,-3,wPlexy);
752     AliMedium(35,"PLEXYGLAS$",35,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
753
754     AliMixture(36,"STDGLASS$",aStdGlass,zStdGlass,dStdGlass,7,wStdGlass);
755     AliMedium(36,"STDGLASS$",36,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
756
757     AliMixture(37,"ALCU12$",aAlCu12,zAlCu12,dAlCu12,2,wAlCu12);
758     AliMedium(37,"ALCU12$",37,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
759
760     AliMixture(38,"MEGOLON$",aMegolon,zMegolon,dMegolon,-2,wMegolon);
761     AliMedium(38,"MEGOLON$",38,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
762
763     AliMixture(39,"RYTON$",aRyton,zRyton,dRyton,14,wRyton);
764     AliMedium(39,"RYTON$",39,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
765
766     AliMixture(40,"GLASS FIBER$",aGlass,zGlass,dGlass,11,wGlass);
767     AliMedium(40,"GLASS FIBER$",40,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
768
769     AliMixture(41,"AISI304L$",a304L,z304L,d304L,8,w304L);
770     AliMedium(41,"AISI304L$",41,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
771
772     AliMaterial(42,"NICKEL$",0.58693E+02,0.28000E+02,0.89080E+01,0.14200E+01,0.99900E+03);
773     AliMedium(42,"NICKEL$",42,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
774                
775     AliMixture(43,"SDD X7R weld$",aX7Rweld,zX7Rweld,dX7Rweld,2,wX7Rweld);
776     AliMedium(43,"SDD X7R weld$",43,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
777
778     AliMixture(44,"PPS$",aPPS,zPPS,dPPS,-3,wPPS);
779     AliMedium(44,"PPS$",44,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
780
781     AliMixture(45,"POLYAX$",aPOLYAX,zPOLYAX,dPOLYAX,-4,wPOLYAX);
782     AliMedium(45,"POLYAX$",45,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
783
784     AliMixture(46,"PBT$",aPBT,zPBT,dPBT,-3,wPBT);
785     AliMedium(46,"PBT$",46,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
786
787     AliMixture(47,"PVC$",aPVC,zPVC,dPVC,-3,wPVC);
788     AliMedium(47,"PVC$",47,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
789
790     Double_t cuFrac = 0.56;
791     Double_t kFrac  = 1.0 - cuFrac;
792     Double_t cuDens = 8.96;
793     Float_t dKaptonCuBus   = cuFrac * cuDens + kFrac * dKapton;
794     for (Int_t j=0; j<4; j++)
795       wKaptonCuBus[j] = wKapton[j]*kFrac;
796     wKaptonCuBus[4] = cuFrac;
797     AliMixture(48, "SPD-BUS CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuBus, 5, wKaptonCuBus);
798     AliMedium(48,"SPD-BUS CU KAPTON$",48,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
799     
800     cuFrac = 0.5;
801     kFrac  = 1.0 - cuFrac;
802     Float_t dKaptonCuMCM   = cuFrac * cuDens + kFrac * dKapton;
803     for (Int_t j=0; j<4; j++)
804       wKaptonCuMCM[j] = wKapton[j]*kFrac;
805     wKaptonCuMCM[4] = cuFrac;
806     AliMixture(49, "SPD-MCM CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuMCM, 5, wKaptonCuMCM);
807     AliMedium(49,"SPD-MCM CU KAPTON$",49,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
808     
809     cuFrac = (0.56 + 0.5) / 2.0;
810     kFrac  = 1.0 - cuFrac;
811     Float_t dKaptonCuMix   = cuFrac * cuDens + kFrac * dKapton;
812     for (Int_t j=0; j<4; j++)
813       wKaptonCuMix[j] = wKapton[j]*kFrac;
814     wKaptonCuMix[4] = cuFrac;
815     AliMixture(50, "SPD-MIX CU KAPTON", aKaptonCu, zKaptonCu, dKaptonCuMix, 5, wKaptonCuMix);
816     AliMedium(50,"SPD-MIX CU KAPTON$",50,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
817
818     AliMaterial(51,"SPD SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
819     AliMedium(51,"SPD SI$",51,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
820
821     AliMaterial(52,"SPD SI CHIP$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
822     AliMedium(52,"SPD SI CHIP$",52,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
823
824     AliMaterial(53,"SPD SI BUS$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
825     AliMedium(53,"SPD SI BUS$",53,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
826
827     AliMixture(54,"SPD C (M55J)$",aCM55J,zCM55J,dCM55J,4,wCM55J);
828     AliMedium(54,"SPD C (M55J)$",54,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
829
830     AliMixture(55,"SPD AIR$",aAir,zAir,dAir,4,wAir);
831     AliMedium(55,"SPD AIR$",55,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
832
833     AliMixture(56, "SPD KAPTON(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
834     AliMedium(56,"SPD KAPTON(POLYCH2)$",56,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
835
836     // Gaseous Freon has same chemical composition but air density at 1.7 atm
837     AliMixture(59,"GASEOUS FREON$",afre,zfre,1.7*dAir,-2,wfre);
838     AliMedium(59,"GASEOUS FREON$",59,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
839
840     AliMixture(61,"EPOXY$",aEpoxy,zEpoxy,dEpoxy,-3,wEpoxy);
841     AliMedium(61,"EPOXY$",61,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
842
843     AliMaterial(62,"SILICON$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
844     AliMedium(62,"SILICON$",62,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
845
846     AliMixture(63, "KAPTONH(POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
847     AliMedium(63,"KAPTONH(POLYCH2)$",63,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
848
849     AliMaterial(64,"ALUMINUM$",0.26982E+02,0.13000E+02,0.26989E+01,0.89000E+01,0.99900E+03);
850     AliMedium(64,"ALUMINUM$",64,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
851
852     AliMixture(65,"INOX$",aINOX,zINOX,dINOX,9,wINOX);
853     AliMedium(65,"INOX$",65,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
854
855     AliMixture(66,"NiSn$",aNiSn,zNiSn,dNiSn,2,wNiSn);
856     AliMedium(66,"NiSn$",66,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
857
858     AliMaterial(67,"Sn$", 118.710, 50., 7.310, 1.206, 999.);
859     AliMedium(67,"Sn$",67,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
860
861     AliMixture(68,"ROHACELL$",arohac,zrohac,drohac,-4,wrohac);
862     AliMedium(68,"ROHACELL$",68,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
863
864      AliMixture(69,"SDD C AL (M55J)$",aALCM55J,zALCM55J,dALCM55J,5,wALCM55J);
865     AliMedium(69,"SDD C AL (M55J)$",69,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
866   
867     AliMixture(70, "SDDKAPTON (POLYCH2)", aKapton, zKapton, dKapton, 4, wKapton);
868     AliMedium(70,"SDDKAPTON (POLYCH2)$",70,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
869
870      AliMaterial(71,"ITS SANDW A$",0.12011E+02,0.60000E+01,0.2115E+00,0.17479E+03,0.99900E+03);
871     AliMedium(71,"ITS SANDW A$",71,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
872
873     AliMaterial(72,"ITS SANDW B$",0.12011E+02,0.60000E+01,0.27000E+00,0.18956E+03,0.99900E+03);
874     AliMedium(72,"ITS SANDW B$",72,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
875
876     AliMaterial(73,"ITS SANDW C$",0.12011E+02,0.60000E+01,0.41000E+00,0.90868E+02,0.99900E+03);
877     AliMedium(73,"ITS SANDW C$",73,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
878
879     AliMaterial(74,"HEAT COND GLUE$",0.12011E+02,0.60000E+01,0.1930E+01,0.22100E+02,0.99900E+03);
880     AliMedium(74,"HEAT COND GLUE$",74,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
881
882     AliMaterial(75,"ELASTO SIL$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
883     AliMedium(75,"ELASTO SIL$",75,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
884
885     // SPD bus (data from Petra Riedler)
886     Float_t aSPDbus[5] = {1.00794,12.0107,14.01,15.9994,26.982 };
887     Float_t zSPDbus[5] = {1.,6.,7.,8.,13.};
888     Float_t wSPDbus[5] = {0.023523,0.318053,0.009776,0.078057,0.570591};
889     Float_t dSPDbus    = 2.128505;
890
891     //   AliMaterial(76,"SPDBUS(AL+KPT+EPOX)$",0.19509E+02,0.96502E+01,0.19060E+01,0.15413E+02,0.99900E+03);
892     AliMixture(76,"SPDBUS(AL+KPT+EPOX)$",aSPDbus,zSPDbus,dSPDbus,5,wSPDbus);
893     AliMedium(76,"SPDBUS(AL+KPT+EPOX)$",76,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
894                
895     AliMixture(77,"SDD X7R capacitors$",aX7R,zX7R,dX7R,6,wX7R);
896     AliMedium(77,"SDD X7R capacitors$",77,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
897
898     AliMixture(78,"SDD ruby sph. Al2O3$",aAlOxide,zAlOxide,dAlOxide,2,wAlOxide);
899     AliMedium(78,"SDD ruby sph. Al2O3$",78,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
900
901     AliMaterial(79,"SDD SI insensitive$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
902     AliMedium(79,"SDD SI insensitive$",79,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
903
904     AliMixture(80,"SDD HV microcable$",aHVm,zHVm,dHVm,5,wHVm);
905     AliMedium(80,"SDD HV microcable$",80,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
906
907     AliMixture(81,"SDD LV+signal cable$",aLVm,zLVm,dLVm,5,wLVm);
908     AliMedium(81,"SDD LV+signal cable$",81,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
909
910     AliMixture(82,"SDD hybrid microcab$",aHLVm, zHLVm,dHLVm,5,wHLVm);
911     AliMedium(82,"SDD hybrid microcab$",82,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
912
913     AliMixture(83,"SDD anode microcab$",aALVm,zALVm,dALVm,5,wALVm);
914     AliMedium(83,"SDD anode microcab$",83,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
915     Float_t aDSring[4]={12.0107,      1.00794,     14.0067,      15.9994};
916     Float_t zDSring[4]={ 6.,          1.,           7.,           8.};
917     Float_t wDSring[4]={ 0.854323888, 0.026408778,  0.023050265,  0.096217069};
918     Float_t dDSring = 0.2875;
919     AliMixture(84,"SDD/SSD rings$",aDSring,zDSring,dDSring,4,wDSring);
920     AliMedium(84,"SDD/SSD rings$",84,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
921
922     AliMixture(85,"inox/alum$",aInAl,zInAl,dInAl,5,wInAl);
923     AliMedium(85,"inox/alum$",85,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
924
925     // Special media
926
927     AliMaterial(90,"SPD shield$", 12.011, 6., 1.93 , 22.36, 999);
928     AliMedium(90,"SPD shield$",90,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
929
930     // SPD End Ladder (data from Petra Riedler)
931     Float_t aSPDel[5] = {1.00794,12.0107,14.01,15.9994,63.54 };
932     Float_t zSPDel[5] = {1.,6.,7.,8.,29.};
933     Float_t wSPDel[5] = {0.004092,0.107274,0.011438,0.032476,0.844719};
934     Float_t dSPDel    = 3.903403;
935
936     //   AliMaterial(91, "SPD End ladder$", 47.0447, 21.7963, 3.6374, 4.4711, 999); 
937     AliMixture(91,"SPD End ladder$",aSPDel,zSPDel,dSPDel,5,wSPDel);
938     AliMedium(91,"SPD End ladder$",91,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
939
940     AliMaterial(92, "SPD cone$",28.0855, 14., 2.33, 9.36, 999);    
941     AliMedium(92,"SPD cone$",92,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
942     /*  Material with fractional Z not actually used
943     AliMaterial(93, "SDD End ladder$", 69.9298, 29.8246, 0.3824, 36.5103, 999);
944     AliMedium(93,"SDD End ladder$",93,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
945     */
946     AliMaterial(94, "SDD cone$",63.546, 29., 1.15, 1.265, 999);
947     AliMedium(94,"SDD cone$",94,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
948     /* Material with fractional Z not actually used
949     AliMaterial(95, "SSD End ladder$", 32.0988, 15.4021, 0.68, 35.3238, 999); 
950     AliMedium(95,"SSD End ladder$",95,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
951     */
952     AliMaterial(96, "SSD cone$",63.546, 29., 1.15, 1.265, 999);
953     AliMedium(96,"SSD cone$",96,0,ifield,fieldm,tmaxfdServ,stemaxServ,deemaxServ,epsilServ,stminServ);
954
955     AliMixture(98,"SDD OPTICFIB$",aoptfib,zoptfib,doptfib,-2,woptfib);
956     AliMedium(98,"SDD OPTICFIB$",98,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
957
958     AliMixture(95,"SSD FEP$",aFEP,zFEP,dFEP,-2,wFEP);
959     AliMedium(95,"SSD FEP$",95,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
960
961     Float_t aA[13],zZ[13],wW[13],den;
962     // Mean material for low-voltage cables on SPD trays Side A
963     // (Copper + PolyEthylene (C2-H4)) (D.Elia for cable number and
964     // cross-section area, M.Sitta for elemental computation) - 26 Feb 10
965     wW[0] = 0.323024;//H
966     wW[2] = 0.515464;//Cu
967     wW[1] = 0.161512;//C
968     wW[3] = 0.000000;//O
969     wW[4] = 0.000000;//S
970     wW[5] = 0.000000;//F
971     wW[6] = 0.000000;//Sn
972     wW[7] = 0.000000;//Pb
973     wW[8] = 0.000000;//Cr
974     wW[9] = 0.000000;//Si
975     wW[10] = 0.000000;//Ni
976     wW[11] = 0.000000;//Ca
977
978     den = 5.078866;
979     AliMixture(60,"SPD_LOWCABLES$",aA,zZ,den,+3,wW);
980     AliMedium(60,"SPD_LOWCABLES$",60,0,ifield,fieldm,tmaxfd,stemax,
981               deemax,epsil,stmin);
982
983     // Mean material for high-voltage cables on SPD trays Side A & C
984     // (Copper + HD PolyEthylene (C2-H2)) (D.Elia for cable number and
985     // cross-section area, M.Sitta for elemental computation) - 10 Jun 10
986     wW[0] = 0.083766;//H
987     wW[2] = 0.417136;//Cu
988     wW[1] = 0.499098;//C
989     wW[3] = 0.000000;//O
990     wW[4] = 0.000000;//S
991     wW[5] = 0.000000;//F
992     wW[6] = 0.000000;//Sn
993     wW[7] = 0.000000;//Pb
994     wW[8] = 0.000000;//Cr
995     wW[9] = 0.000000;//Si
996     wW[10] = 0.000000;//Ni
997     wW[11] = 0.000000;//Ca
998
999     den = 1.514930;
1000     AliMixture(58,"SPD_HICABLES$",aA,zZ,den,+3,wW);
1001     AliMedium(58,"SPD_HICABLES$",58,0,ifield,fieldm,tmaxfd,stemax,
1002               deemax,epsil,stmin);
1003
1004     // PolyUrethane [C25-H42-N2-O6] - 07 Mar 10
1005     zZ[2] =  7.0; aA[2] =  14.0067; // Nitrogen - From Root TGeoElementTable
1006
1007     wW[0] = 0.090724;//H
1008     wW[2] = 0.060035;//N
1009     wW[1] = 0.643513;//C
1010     wW[3] = 0.205728;//O
1011     wW[4] = 0.000000;//S
1012     wW[5] = 0.000000;//F
1013     wW[6] = 0.000000;//Sn
1014     wW[7] = 0.000000;//Pb
1015     wW[8] = 0.000000;//Cr
1016     wW[9] = 0.000000;//Si
1017     wW[10] = 0.000000;//Ni
1018     wW[11] = 0.000000;//Ca
1019
1020     den = 1.158910;
1021     AliMixture(67,"POLYURETHANE$",aA,zZ,den,+4,wW);
1022     AliMedium(67,"POLYURETHANE$",67,0,ifield,fieldm,tmaxfd,stemax,
1023               deemax,epsil,stmin);
1024
1025     //  POM (Polyoxymethylene = (CH2O)n ) - 02 May 10
1026     zZ[2] =  8.0; aA[2] =  15.9994; // Oxigen
1027
1028     wW[0] = 0.067137;//H
1029     wW[1] = 0.400016;//C
1030     wW[2] = 0.532847;//O
1031     wW[3] = 0.000000;//O
1032     wW[4] = 0.000000;//S
1033     wW[5] = 0.000000;//F
1034     wW[6] = 0.000000;//Sn
1035     wW[7] = 0.000000;//Pb
1036     wW[8] = 0.000000;//Cr
1037     wW[9] = 0.000000;//Si
1038     wW[10] = 0.000000;//Ni
1039     wW[11] = 0.000000;//Ca
1040
1041     den = 1.4200;
1042     AliMixture(57,"POLYOXYMETHYLENE$",aA,zZ,den,+3,wW);
1043     AliMedium(57,"POLYOXYMETHYLENE$",57,0,ifield,fieldm,tmaxfd,stemax,
1044               deemax,epsil,stmin);
1045
1046
1047     // Anticorodal (Aliminum alloy) - 08 nov 10
1048     // A,Z from Root TGeoElementTable, W from Web sites
1049     zZ[0] = 13.0; aA[0] =  26.9815; // Aluminium
1050     zZ[1] = 29.0; aA[1] =  63.546 ; // Copper
1051     zZ[2] = 26.0; aA[2] =  55.845 ; // Iron
1052     zZ[3] = 25.0; aA[3] =  54.938 ; // Manganese
1053     zZ[4] = 12.0; aA[4] =  24.305 ; // Magnesium
1054     zZ[5] = 14.0; aA[5] =  28.0855; // Silicon
1055     zZ[6] = 30.0; aA[6] =  65.39  ; // Zinc
1056     zZ[7] = 24.0; aA[7] =  51.9961; // Chromium
1057     zZ[8] = 22.0; aA[8] =  47.867 ; // Titanium
1058
1059     wW[1] = 0.001000;//Cu
1060     wW[2] = 0.005000;//Fe
1061     wW[3] = 0.007000;//Mn - mean value
1062     wW[4] = 0.009000;//Mg - mean value
1063     wW[5] = 0.001000;//Si - mean value
1064     wW[6] = 0.002000;//Zn
1065     wW[7] = 0.002500;//Cr
1066     wW[8] = 0.001000;//Ti
1067
1068     Double_t totFrac = 0;
1069     for (Int_t j=1; j<9; j++)
1070       totFrac += wW[j];
1071     wW[0] = 1. - totFrac;//Al - the remainder
1072
1073     den = 2.69;
1074     AliMixture(93,"ANTICORODAL$",aA,zZ,den,+9,wW);
1075     AliMedium(93,"ANTICORODAL$",93,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1076
1077     // Hokotol (another Aluminium alloy) - 08 nov 10
1078     // A,Z from Root TGeoElementTable, W from Web sites
1079     zZ[0] = 13.0; aA[0] =  26.9815; // Aluminium
1080     zZ[1] = 29.0; aA[1] =  63.546 ; // Copper
1081     zZ[2] = 26.0; aA[2] =  55.845 ; // Iron
1082     zZ[3] = 25.0; aA[3] =  54.938 ; // Manganese
1083     zZ[4] = 12.0; aA[4] =  24.305 ; // Magnesium
1084     zZ[5] = 14.0; aA[5] =  28.0855; // Silicon
1085     zZ[6] = 30.0; aA[6] =  65.39  ; // Zinc
1086     zZ[7] = 24.0; aA[7] =  51.9961; // Chromium
1087     zZ[8] = 22.0; aA[8] =  47.867 ; // Titanium
1088     zZ[9] = 40.0; aA[9] =  91.224 ; // Zirconium
1089
1090     wW[1] = 0.020500;//Cu - mean value
1091     wW[2] = 0.000300;//Fe
1092     wW[3] = 0.022000;//Mn - mean value
1093     wW[4] = 0.001000;//Mg - mean value
1094     wW[5] = 0.002000;//Si - mean value
1095     wW[6] = 0.066500;//Zn
1096     wW[7] = 0.005000;//Cr
1097     wW[8] = 0.000600;//Ti
1098     wW[9] = 0.001650;//Zr - mean value
1099
1100     totFrac = 0;
1101     for (Int_t j=1; j<10; j++)
1102       totFrac += wW[j];
1103     wW[0] = 1. - totFrac;//Al - the remainder
1104
1105     den = 2.69;
1106     AliMixture(34,"HOKOTOL$",aA,zZ,den,+10,wW);
1107     AliMedium(34,"HOKOTOL$",34,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1108
1109     // Ergal (7075) (yet another Aluminium alloy) - 09 nov 10
1110     // A,Z from Root TGeoElementTable, W from Web sites
1111     zZ[0] = 13.0; aA[0] =  26.9815; // Aluminium
1112     zZ[1] = 29.0; aA[1] =  63.546 ; // Copper
1113     zZ[2] = 26.0; aA[2] =  55.845 ; // Iron
1114     zZ[3] = 25.0; aA[3] =  54.938 ; // Manganese
1115     zZ[4] = 12.0; aA[4] =  24.305 ; // Magnesium
1116     zZ[5] = 14.0; aA[5] =  28.0855; // Silicon
1117     zZ[6] = 30.0; aA[6] =  65.39  ; // Zinc
1118     zZ[7] = 24.0; aA[7] =  51.9961; // Chromium
1119     zZ[8] = 22.0; aA[8] =  47.867 ; // Titanium
1120
1121     wW[1] = 0.016000;//Cu - mean value
1122     wW[2] = 0.005000;//Fe
1123     wW[3] = 0.003000;//Mn
1124     wW[4] = 0.025000;//Mg - mean value
1125     wW[5] = 0.004000;//Si
1126     wW[6] = 0.056000;//Zn - mean value
1127     wW[7] = 0.002300;//Cr - mean value
1128     wW[8] = 0.002000;//Ti
1129
1130     totFrac = 0;
1131     for (Int_t j=1; j<9; j++)
1132       totFrac += wW[j];
1133     wW[0] = 1. - totFrac;//Al - the remainder
1134
1135     den = 2.69;
1136     AliMixture(33,"ERGAL$",aA,zZ,den,+9,wW);
1137     AliMedium(33,"ERGAL$",33,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
1138     
1139 }
1140
1141 //______________________________________________________________________
1142 void AliITSvUpgrade::DefineLayer(const Int_t nlay, const Double_t r,
1143                                  const Double_t zlen, const Int_t nladd,
1144                                  const Int_t nmod, const Double_t lthick,
1145                                  const Double_t dthick){
1146     //     Sets the layer parameters
1147     // Inputs:
1148     //          nlay    layer number
1149     //          r       layer radius
1150     //          zlen    layer length
1151     //          nladd   number of ladders
1152     //          nmod    number of modules per ladder
1153     //          lthick  ladder thickness (if omitted, defaults to 0)
1154     //          dthick  detector thickness (if omitted, defaults to 0)
1155     // Outputs:
1156     //   none.
1157     // Return:
1158     //   none.
1159
1160     if (nlay >= fNumberOfLayers || nlay < 0) {
1161       AliError(Form("Wrong layer number (%d)",nlay));
1162       return;
1163     }
1164
1165     fLayTurbo[nlay] = kFALSE;
1166     fLayRadii[nlay] = r;
1167     fLayZLength[nlay] = zlen;
1168     fLaddPerLay[nlay] = nladd;
1169     fModPerLadd[nlay] = nmod;
1170     fLadThick[nlay] = lthick;
1171     fDetThick[nlay] = dthick;
1172 }
1173
1174 //______________________________________________________________________
1175 void AliITSvUpgrade::DefineLayerTurbo(const Int_t nlay, const Double_t r,
1176                                       const Double_t zlen, const Int_t nladd,
1177                                       const Int_t nmod, const Double_t width,
1178                                       const Double_t tilt,
1179                                       const Double_t lthick,
1180                                       const Double_t dthick){
1181     //     Sets the layer parameters for a "turbo" layer
1182     //     (i.e. a layer whose ladders overlap in phi)
1183     // Inputs:
1184     //          nlay    layer number
1185     //          r       layer radius
1186     //          zlen    layer length
1187     //          nladd   number of ladders
1188     //          nmod    number of modules per ladder
1189     //          width   layer width
1190     //          tilt    layer tilt angle (degrees)
1191     //          lthick  ladder thickness (if omitted, defaults to 0)
1192     //          dthick  detector thickness (if omitted, defaults to 0)
1193     // Outputs:
1194     //   none.
1195     // Return:
1196     //   none.
1197
1198     if (nlay >= fNumberOfLayers || nlay < 0) {
1199       AliError(Form("Wrong layer number (%d)",nlay));
1200       return;
1201     }
1202
1203     fLayTurbo[nlay] = kTRUE;
1204     fLayRadii[nlay] = r;
1205     fLayZLength[nlay] = zlen;
1206     fLaddPerLay[nlay] = nladd;
1207     fModPerLadd[nlay] = nmod;
1208     fLadThick[nlay] = lthick;
1209     fLadWidth[nlay] = width;
1210     fLadTilt[nlay] = tilt;
1211     fDetThick[nlay] = dthick;
1212 }
1213
1214 //______________________________________________________________________
1215 void AliITSvUpgrade::GetLayerParameters(const Int_t nlay,
1216                                         Double_t &r, Double_t &zlen,
1217                                         Int_t &nladd, Int_t &nmod,
1218                                         Double_t &width, Double_t &tilt,
1219                                         Double_t &lthick, Double_t &dthick){
1220     //     Gets the layer parameters
1221     // Inputs:
1222     //          nlay    layer number
1223     // Outputs:
1224     //          r       layer radius
1225     //          zlen    layer length
1226     //          nladd   number of ladders
1227     //          nmod    number of modules per ladder
1228     //          width   ladder width
1229     //          tilt    ladder tilt angle
1230     //          lthick  ladder thickness
1231     //          dthick  detector thickness
1232     // Return:
1233     //   none.
1234
1235     if (nlay >= fNumberOfLayers || nlay < 0) {
1236       AliError(Form("Wrong layer number (%d)",nlay));
1237       return;
1238     }
1239
1240     r = fLayRadii[nlay];
1241     zlen = fLayZLength[nlay];
1242     nladd = fLaddPerLay[nlay];
1243     nmod = fModPerLadd[nlay];
1244     width = fLadWidth[nlay];
1245     tilt = fLadTilt[nlay];
1246     lthick = fLadThick[nlay];
1247     dthick = fDetThick[nlay];
1248 }
1249
1250 //______________________________________________________________________
1251 void AliITSvUpgrade::Init(){
1252     //     Initialise the ITS after it has been created.
1253     // Inputs:
1254     //   none.
1255     // Outputs:
1256     //   none.
1257     // Return:
1258     //   none.
1259
1260     AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
1261                  fMinorVersion));
1262     UpdateInternalGeometry();
1263     AliITSUpg::Init();
1264
1265 }
1266
1267 //______________________________________________________________________
1268 Bool_t AliITSvUpgrade::IsLayerTurbo(const Int_t nlay){
1269     //     Returns true if the layer is a "turbo" layer
1270     // Inputs:
1271     //          nlay    layer number
1272     // Outputs:
1273     //   none.
1274     // Return:
1275     //          kTRUE if the layer is a turbo layer
1276
1277     if ( nlay < 0 || nlay > fNumberOfLayers ) {
1278       AliError(Form("Wrong layer number %d",nlay));
1279       return kFALSE;
1280     } else
1281       return fUpGeom[nlay]->IsTurbo();
1282
1283 }
1284
1285 //______________________________________________________________________
1286 void AliITSvUpgrade::SetDefaults(){
1287     // sets the default segmentation, response, digit and raw cluster classes
1288     // Inputs:
1289     //   none.
1290     // Outputs:
1291     //   none.
1292     // Return:
1293     //   none.
1294
1295     if(!fDetTypeSim){
1296         Warning("SetDefaults","Error fDetTypeSim not defined");
1297         return;
1298     }
1299
1300     fDetTypeSim->SetDefaults();
1301
1302     return;
1303 }
1304
1305 //______________________________________________________________________
1306 void AliITSvUpgrade::StepManager(){
1307     //    Called for every step in the ITS, then calles the AliITShit class
1308     // creator with the information to be recoreded about that hit.
1309     //     The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
1310     // printing of information to a file which can be used to create a .det
1311     // file read in by the routine CreateGeometry(). If set to 0 or any other
1312     // value except 1, the default behavior, then no such file is created nor
1313     // it the extra variables and the like used in the printing allocated.
1314     // Inputs:
1315     //   none.
1316     // Outputs:
1317     //   none.
1318     // Return:
1319     //   none.
1320
1321     if(!(this->IsActive())) return;
1322     if(!(gMC->TrackCharge())) return;
1323
1324     Int_t copy, lay = 0;
1325     Int_t id = gMC->CurrentVolID(copy);
1326
1327     Bool_t notSens = kFALSE;
1328     while ((lay<fIdN)  && (notSens = id != fIdSens[lay])) ++lay;
1329     if (notSens) return;
1330
1331     if(gMC->IsTrackExiting()) {
1332         AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
1333     } // if Outer ITS mother Volume
1334
1335     static TLorentzVector position, momentum; // Saves on calls to construtors
1336     static AliITShit hit;// Saves on calls to constructors
1337
1338     TClonesArray &lhits = *(Hits());
1339     Int_t   cpn0, cpn1, mod, status = 0;
1340     //
1341     // Track status
1342     if(gMC->IsTrackInside())      status +=  1;
1343     if(gMC->IsTrackEntering())    status +=  2;
1344     if(gMC->IsTrackExiting())     status +=  4;
1345     if(gMC->IsTrackOut())         status +=  8;
1346     if(gMC->IsTrackDisappeared()) status += 16;
1347     if(gMC->IsTrackStop())        status += 32;
1348     if(gMC->IsTrackAlive())       status += 64;
1349
1350     //
1351     // retrieve the indices with the volume path
1352     //
1353     if (lay < 0 || lay > fIdN) {
1354       AliError(Form("Invalid value: lay=%d. Not an ITS sensitive volume",lay));
1355       return; // not an ITS sensitive volume.
1356     } else {
1357       copy = 1;
1358       gMC->CurrentVolOffID(1,cpn1);
1359       gMC->CurrentVolOffID(2,cpn0);
1360     } //
1361
1362     fInitGeom.DecodeDetector(mod,lay,cpn0,cpn1,copy);
1363     // We should not need to pass by the switch !
1364     // This is time consuming...
1365     // therefore DecodeDetectorv11Upgrade(...) shouldn't be private !
1366     // and we should be able to use instead :
1367     //fInitGeom.DecodeDetectorv11Upgrade(mod,lay+1,cpn0,cpn1,copy);
1368
1369     //
1370     // Fill hit structure.
1371     //
1372     hit.SetModule(mod);
1373     hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
1374     gMC->TrackPosition(position);
1375     gMC->TrackMomentum(momentum);
1376     hit.SetPosition(position);
1377     hit.SetTime(gMC->TrackTime());
1378     hit.SetMomentum(momentum);
1379     hit.SetStatus(status);
1380     hit.SetEdep(gMC->Edep());
1381     hit.SetShunt(GetIshunt());
1382     if(gMC->IsTrackEntering()){
1383         hit.SetStartPosition(position);
1384         hit.SetStartTime(gMC->TrackTime());
1385         hit.SetStartStatus(status);
1386         return; // don't save entering hit.
1387     } // end if IsEntering
1388     // Fill hit structure with this new hit.
1389     //Info("StepManager","Calling Copy Constructor");
1390     new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
1391     // Save old position... for next hit.
1392     hit.SetStartPosition(position);
1393     hit.SetStartTime(gMC->TrackTime());
1394     hit.SetStartStatus(status);
1395
1396     return;
1397 }
1398