]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSvSDD03.cxx
No effective C++ option for compilation of C files
[u/mrichter/AliRoot.git] / ITS / AliITSvSDD03.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17  $Id$ 
18 */
19 /////////////////////////////////////////////////////////////////
20 //  Class for the SDD beam test August2004                     //
21 //                                                             //
22 //                                                             //
23 /////////////////////////////////////////////////////////////////
24
25 #include <TGeometry.h>
26 #include <TNode.h>
27 #include <TBRIK.h>
28 #include <TLorentzVector.h>
29 #include <TVirtualMC.h>
30 #include <TGeoMatrix.h>
31
32 #include "AliMC.h"
33 #include "AliRun.h"
34 #include "AliMagF.h"
35 #include "AliTrackReference.h"
36 #include "AliITShit.h"
37 #include "AliITS.h"
38 #include "AliITSvSDD03.h"
39 #include "AliITSgeom.h"
40 #include "AliITSgeomSDD.h"
41 #include "AliITSgeomSSD.h"
42 #include "AliITSDetTypeSim.h"
43 #include "AliITSCalibrationSPD.h"
44 #include "AliITSCalibrationSDD.h"
45 #include "AliITSCalibrationSSD.h"
46 #include "AliITSsegmentationSPD.h"
47 #include "AliITSsegmentationSDD.h"
48 #include "AliITSsegmentationSSD.h"
49 #include "AliITSsimulationSPD.h"
50 #include "AliITSsimulationSDD.h"
51 #include "AliITSsimulationSSD.h"
52
53
54 ClassImp(AliITSvSDD03)
55
56 //______________________________________________________________________
57 AliITSvSDD03::AliITSvSDD03() :
58 AliITS(),
59 fGeomDetOut(kFALSE),
60 fGeomDetIn(kFALSE),
61 fMajorVersion(1),
62 fMinorVersion(2),
63 fEuclidGeomDet(),
64 fRead(),
65 fWrite(),
66 fDet1(300.0),
67 fDet2(300.0),
68 fChip1(300.0),
69 fChip2(300.0),
70 fIDMother(0),
71 fYear(2003){
72     ////////////////////////////////////////////////////////////////////////
73     // Standard default constructor for the ITS SDD test beam 2002 version 1.
74     // Inputs:
75     //    none.
76     // Outputs:
77     //    none.
78     // Return:
79     //    A default created class.
80     ////////////////////////////////////////////////////////////////////////
81     Int_t i;
82
83     fIdN          = 0;
84     fIdName       = 0;
85     fIdSens       = 0;
86     fEuclidOut    = kFALSE; // Don't write Euclide file
87     for(i=0;i<60;i++) fRead[i] = '\0';
88     for(i=0;i<60;i++) fWrite[i] = '\0';
89     for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
90     fTarg=kNoTarg;
91     fTargThick=0;
92 }
93 //______________________________________________________________________
94 AliITSvSDD03::AliITSvSDD03(const char *title,Int_t year):
95 AliITS("ITS", title),
96 fGeomDetOut(kFALSE),
97 fGeomDetIn(kFALSE),
98 fMajorVersion(1),
99 fMinorVersion(2),
100 fEuclidGeomDet(),
101 fRead(),
102 fWrite(),
103 fDet1(300.0),
104 fDet2(300.0),
105 fChip1(300.0),
106 fChip2(300.0),
107 fIDMother(0),
108 fYear(2003){
109     ////////////////////////////////////////////////////////////////////////
110     //    Standard constructor for the ITS SDD testbeam 2002 version 1.
111     // Inputs:
112     //    const char *title    title for this ITS geometry.
113     // Outputs:
114     //    none.
115     // Return:
116     //    A standard created class.
117     ////////////////////////////////////////////////////////////////////////
118     Int_t i;
119
120     fIdN = 3;
121     fIdName = new TString[fIdN];
122     fIdName[0] = "IMBS";
123     fIdName[1] = "ITST";
124     fIdName[2] = "ISNT";
125     fIdSens    = new Int_t[fIdN];
126     for(i=0;i<fIdN;i++) fIdSens[i] = 0;
127     fEuclidOut    = kFALSE; // Don't write Euclide file
128     fYear         = year;
129     fTarg=kNoTarg;
130     fTargThick=0;    
131     SetThicknessDet1();
132     SetThicknessDet2();
133     SetThicknessChip1();
134     SetThicknessChip2();                         
135
136     fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vSDD032.euc";
137     strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vSDD032.det",60);
138     strncpy(fRead,fEuclidGeomDet,60);
139     strncpy(fWrite,fEuclidGeomDet,60);
140 }
141 //______________________________________________________________________
142 AliITSvSDD03::~AliITSvSDD03() {
143     ////////////////////////////////////////////////////////////////////////
144     //    Standard destructor for the ITS SDD test beam 2002 version 1.
145     // Inputs:
146     //    none.
147     // Outputs:
148     //    none.
149     // Return:
150     //    none.
151     ////////////////////////////////////////////////////////////////////////
152 }
153 //______________________________________________________________________
154 void AliITSvSDD03::BuildGeometry(){
155     ////////////////////////////////////////////////////////////////////////
156     //    Geometry builder for the ITS SDD test beam 2002 version 1.
157     //    ALIC    ALICE Mother Volume
158     //     |- ITSV     ITS Mother Volume
159     //         |- IDET       Detector under Test
160     //         |   |- ITS0       SDD Si Chip
161     //         |   |  |- ITST      SDD Sensitivve Volume
162     //         |   |- IPC0 *5    Readout chip
163     //         |- ITEL *4    SDD Telescope
164     //             |- IMB0       SDD Si Chip
165     //             |   |- IMBS     SDD Sensitive volume
166     //             |- ICMB       Chip MiniBus.
167     // Inputs:
168     //    none.
169     // Outputs:
170     //    none.
171     // Return:
172     //    none.
173     ////////////////////////////////////////////////////////////////////////
174     // Get the top alice volume.
175     TNode *nALIC = gAlice->GetGeometry()->GetNode("alice");
176     nALIC->cd();
177
178     // Define ITS Mother Volume
179     Float_t data[3];
180     Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
181     //Float_t yposition= 0.0;
182     TRotMatrix *r0 = new TRotMatrix("ITSidrotm0","ITSidrotm0",
183                                     90.0,0,0.0,0,90.0,270.0);
184     data[0] = 10.0;
185     data[1] = 10.0;
186     data[2] = 100.0;
187     TBRIK *sITSVshape =new TBRIK("ITSVshape","ITS Logical Mother Volume","Air",
188                                  data[0],data[1],data[2]);
189     TNode *sITSV = new TNode("ITSV","ITS Mother Volume",sITSVshape,
190                             0.0,0.0,0.0,0,0);
191     sITSV->cd(); // set ourselve into ITSV subvolume of ALIC
192
193     // SSD part of telescope (MiniBuS)
194     data[0] = 1.06;
195     data[1] = 0.5*ddettelescope;
196     data[2] = 1.1;
197     TBRIK *sIMB0shape = new TBRIK("IMB0shape","SDD wafer","Si",
198                                  data[0],data[1],data[2]);
199     Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
200     data[0] = detMiniBusX = 0.5*384*50.0E-4;
201     data[1] = detMiniBusY = 0.5*ddettelescope;
202     data[2] = detMiniBusZ = 1.0;
203     TBRIK *sIMBSshape = new TBRIK("IMBSshape","SDD Sensitive volume","Si",
204                                  data[0],data[1],data[2]);
205
206     data[0] = 1.36;
207     data[1] = 0.47;
208     data[2] = 1.36;
209     TBRIK *sITELshape = new TBRIK("ITELshape","ITELshape","Air",
210                                  data[0],data[1],data[2]);
211
212
213     // SDD under test
214     Float_t spdX,spdY,spdZ;
215     data[0] = 3.62500;
216     data[1] = 0.5*ddettest;
217     data[2] = 4.37940;
218     TBRIK *sITS0shape = new TBRIK("ITS0shape","SDD wafer","Si",
219                                  data[0],data[1],data[2]); // contains detector
220     data[0] = spdX = 3.50860;
221     data[1] = spdY = 0.5*ddettest;
222     data[2] = spdZ = 3.76320;
223     TBRIK *sITSTshape = new TBRIK("ITSTshape","SDD sensitive volume","Si",
224                                  data[0],data[1],data[2]);
225
226     data[0] = 4.2;
227     data[1] = 0.52;
228     data[2] = 5.2;
229     TBRIK *sIDETshape = new TBRIK("IDETshape","Detector Under Test","Air",
230                                  data[0],data[1],data[2]);
231
232
233     // Place volumes in geometry
234     char name[20],title[50];
235
236     //place SDD under test
237     Double_t px=0.0,py=0.0;
238     Double_t pz[2]={0.0,5.2};
239     TNode *nIDET[2],*nITS0[2],*nITST[2];
240     for(Int_t i=0;i<2;i++){
241         sITSV->cd();
242         sprintf(name,"IDET%d",i);
243         sprintf(title,"SDD #%d under test",i+1);
244         nIDET[i] = new TNode(name,title,sIDETshape,px,py,pz[i],r0,0);
245         nIDET[i]->cd();
246         nITS0[i] = new TNode("ITS0","SDD wafer",sITS0shape,0.0,0.0,0.0,0,0);
247         nITS0[i]->cd();
248         nITST[i] = new TNode("ITST","SDD sensitive volume",sITSTshape,
249                             0.0,0.0,0.0,0,0);
250         nITST[i]->SetLineColor(kYellow);
251         fNodes->Add(nITST[i]);
252     } // end for i
253
254     //place SSD telescope planes
255     Double_t qx=0.0,qy=0.0;
256     Double_t qz[10]={-58.4,-57.4,-50.4,-49.4,60.1,61.1,68.4,69.4,87.7,88.7};
257     TNode *nITEL[10],*nIMB0[10],*nIMBS[10];
258     for(Int_t i=0;i<10;i++){
259         sITSV->cd();
260         sprintf(name,"ITEL%d",i);
261         sprintf(title,"Test beam telescope element #%d",i+1);
262         nITEL[i] = new TNode(name,title,sITELshape,qx,qy,qz[i],r0,0);
263         nITEL[i]->cd();
264         nIMB0[i] = new TNode("IMB0","Chip MiniBus",sIMB0shape,
265                             0.0, 0.0,0.0,0,0);
266         nIMB0[i]->cd();
267         nIMBS[i] = new TNode("IMBS","IMBS",sIMBSshape,0.0,0.0,0.0,0,0);
268         nIMBS[i]->SetLineColor(kGreen);
269         fNodes->Add(nIMBS[i]);
270     } // end for i
271     nALIC->cd();
272     sITSV->Draw();
273 }
274 //______________________________________________________________________
275 Int_t AliITSvSDD03::DecodeDetector(Int_t id,Int_t cpy,Int_t &lay,
276                                    Int_t &det,Int_t &lad) const{
277     // Given the Geant id and copy volume number, returns the layer, ladder,
278     // and detector number, allong with the module number of the detector
279     // involved. Returns -1 and lay=0, lad=0, and det=0 if not a sensitive 
280     // volume.
281     // Inputs:
282     //    Int_t id    Geometry volume id number
283     //    Int_t cpy   Geometry copy number
284     // Outputs:
285     //    Int_t lay   ITS layer number
286     //    Int_t lad   ITS ladder number
287     //    Int_t det   ITS detector number
288     // Return:
289     //    Int_t module number.
290     Int_t mod;
291
292     lay = 0; lad = 0; det = 0; mod = -1;
293     if(id==fIdSens[0]){ // Volume name is IMBS (ITEL)
294         lad = 1; det = 1;
295         lay = cpy;
296         if(cpy>4) lay+=2;
297         mod = lay-1;
298         return mod;
299     }// end if
300     if(id==fIdSens[1]){ // Volume name is ITST (IDet)
301         lad = 1; det = 1;lay = cpy+4; 
302         mod = lay-1;
303         return mod;
304     }// end if
305     return mod;
306 }
307 //______________________________________________________________________
308 void AliITSvSDD03::CreateGeometry(){
309     ////////////////////////////////////////////////////////////////////////
310     //  This routine defines and Creates the geometry for version 1 of the ITS.
311     //    ALIC    ALICE Mother Volume
312     //     |- ITSV     ITS Mother Volume
313     //         |- IDET       Detector under Test (boxcontaining SDD)
314     //         |   |-IDAI        Air inside box
315     //         |       |- ITS0       SDD Si Chip
316     //         |          |- ITST      SDD Sensitivve Volume
317     //         |- ITEL *10   SSD Telescope (plastic box containting SSD's)
318     //         |   |- ITAI       Air inside box
319     //         |       |- IMB0       SDD Si Chip
320     //         |           |- IMBS     SDD Sensitive volume
321     //         |-ISNT*4    Sintilator triggers
322     // Inputs:
323     //    none.
324     // Outputs:
325     //    none.
326     // Return:
327     //    none.
328     ////////////////////////////////////////////////////////////////////////
329     Float_t data[49];
330     // Define media off-set
331     Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
332     Int_t idrotm[4]; // Array of rotation matrix indexes
333     //Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
334     //Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
335     //Float_t yposition= 0.0;
336     const Float_t kmm=0.1,kcm=1.0,kmicm=kmm/1000.;
337     // Define Rotation-reflextion Matrixes needed
338     // 0 is the unit matrix
339     AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0); // SDD and SSD X
340     AliMatrix(idrotm[1], 90.0,90.0, 0.0,180.0, 90.0,270.0); // SSD Y
341     AliMatrix(idrotm[2],90.0,90.0,90.0,180.0,0.0,0.0);  //Rotate about Z 90 degree
342
343     data[0] = 150.0*kmm;
344     data[1] = 150.0*kmm;
345     data[2] = 1100.0*kmm;
346     gMC->Gsvolu("ITSV","BOX ",idtmed[0],data,3);
347     gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
348
349
350     // Crossed sintilator triggers (2 in front 2 in back)
351     data[0] = 10.0*kcm;
352     data[1] = 2.0*kcm;
353     data[2] = 2.0*kmm;
354     gMC->Gsvolu("ISNT","BOX ",idtmed[2],data,3);
355     gMC->Gspos("ISNT",1,"ITSV",0.0,0.0,-950.0*kmm,0,"ONLY");
356     gMC->Gspos("ISNT",2,"ITSV",0.0,0.0,-950.0*kmm-data[2],idrotm[2],"ONLY");
357     gMC->Gspos("ISNT",3,"ITSV",0.0,0.0,950.0*kmm+data[2],0,"ONLY");
358     gMC->Gspos("ISNT",4,"ITSV",0.0,0.0,950.0*kmm,idrotm[2],"ONLY");
359
360
361 ////Create Volumes
362
363     // SSD part of telescope (MiniBuS)
364     Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
365     data[0] = detMiniBusX = 10600.0*kmicm;
366     data[1] = detMiniBusY = 0.150*kmm;
367     data[2] = detMiniBusZ = 1.1*kcm;
368     gMC->Gsvolu("IMB0", "BOX ", idtmed[1], data, 3);   // contains detector
369     data[0] = 0.5*384*50*kmicm;
370     data[1] = 0.1499*kmm;
371     data[2] = 1.0*kcm;
372     gMC->Gsvolu("IMBS","BOX ",idtmed[1],data,3); // sensitive detector volume
373     gMC->Gspos("IMBS",1,"IMB0",0.0,0.0,0.0,0,"ONLY"); // place IMBS inside
374     // Box containing SSD's
375     data[0] = 11600.0*kmicm;
376     data[1] = 0.450*kcm;
377     data[2] = 1.16*kcm;
378     gMC->Gsvolu("ITAI","BOX ",idtmed[0],data,3);
379     // Plastic box size = insize + thickness.
380     data[0] = data[0] + 2.0*kmm;
381     data[1] = data[1] + 200.0*kmicm;
382     data[2] = data[2] + 2.0*kmm;
383     gMC->Gsvolu("ITEL","BOX ",idtmed[3],data,3);
384     gMC->Gspos("ITAI",1,"ITEL",0.0,0.0,0.0,0,"ONLY");
385     gMC->Gspos("IMB0",1,"ITAI",0.0,0.0,0.0,0,"ONLY");
386
387     // SDD under test
388     Float_t sddX,sddY,sddZ;
389     data[0] = sddX = 3.62500*kcm;
390     data[1] = sddY = 0.1500*kmm;
391     data[2] = sddZ = 4.37940*kcm;
392     gMC->Gsvolu("ITS0", "BOX ", idtmed[1], data, 3);   // contains detector
393     data[0] = 3.50860*kcm;
394     data[1] = 0.1499*kmm;
395     data[2] = 3.76320*kcm;
396     gMC->Gsvolu("ITST","BOX ",idtmed[1],data,3);// sensitive detecor volume
397     gMC->Gspos("ITST",1,"ITS0",0.0,0.0,0.0,0,"ONLY"); // place ITST inside
398     // Box containing SDD under test
399     data[0] = 4.0*kcm;
400     data[1] = 0.5*kcm;
401     data[2] = 5.0*kcm;
402     gMC->Gsvolu("IDAI","BOX ",idtmed[0],data,3);
403     data[0] = data[0] + 2.0*kmm;
404     data[1] = data[1] + 200.0*kmicm;
405     data[2] = data[2] + 2.0*kmm;
406     gMC->Gsvolu("IDET","BOX ",idtmed[3],data,3);
407     gMC->Gspos("IDAI",1,"IDET",0.0,0.0,0.0,0,"ONLY");
408     gMC->Gspos("ITS0",1,"IDAI",0.0,0.0,0.0,0,"ONLY");
409
410
411 //// Position detectors, Beam Axis Z, X to the right, Y up to the sky.
412     // Upsteram planes of the telescope    
413     Float_t p00X,p00Y,p00Z,p01X,p01Y,p01Z,p10X,p10Y,p10Z,p11X,p11Y,p11Z;
414     p00X = 0.0*kcm;
415     p00Y = 0.0*kcm;
416     p00Z = -584*kmm;
417     gMC->Gspos("ITEL",1,"ITSV",p00X,p00Y,p00Z,idrotm[0],"ONLY");//SSD X
418     p01X = 0.0*kcm;
419     p01Y = 0.0*kcm;
420     p01Z = -574*kmm;
421     gMC->Gspos("ITEL",2,"ITSV",p01X,p01Y,p01Z,idrotm[1],"ONLY");//SSD Y
422     p01X = 0.0*kcm;
423     p01Y = 0.0*kcm;
424     p01Z = -504*kmm;
425     gMC->Gspos("ITEL",3,"ITSV",p01X,p01Y,p01Z,idrotm[0],"ONLY");//SSD X
426     p01X = 0.0*kcm;
427     p01Y = 0.0*kcm;
428     p01Z = -494*kmm;
429     gMC->Gspos("ITEL",4,"ITSV",p01X,p01Y,p01Z,idrotm[1],"ONLY");//SSD Y
430
431     // Downstream planes of the telescope
432     p10X = 0.0*kcm;
433     p10Y = 0.0*kcm;
434     p10Z = +601.0*kmm; 
435     gMC->Gspos("ITEL",5,"ITSV",p10X,p10Y,p10Z,idrotm[0],"ONLY");//SSD X
436     p11X = 0.0*kcm;
437     p11Y = 0.0*kcm;
438     p11Z = +610.0*kmm; //611.0
439     gMC->Gspos("ITEL",6,"ITSV",p11X,p11Y,p11Z,idrotm[1],"ONLY");//SSD Y
440     p11X = 0.0*kcm;
441     p11Y = 0.0*kcm;
442     p11Z = +684.0*kmm;
443     gMC->Gspos("ITEL",7,"ITSV",p11X,p11Y,p11Z,idrotm[0],"ONLY");//SSD X
444     p11X = 0.0*kcm;
445     p11Y = 0.0*kcm;
446     p11Z = +694.0*kmm;
447     gMC->Gspos("ITEL",8,"ITSV",p11X,p11Y,p11Z,idrotm[1],"ONLY");//SSD Y
448     p11X = 0.0*kcm;
449     p11Y = 0.0*kcm;
450     p11Z = +877.0*kmm;
451     gMC->Gspos("ITEL",9,"ITSV",p11X,p11Y,p11Z,idrotm[0],"ONLY");//SSD X
452     p11X = 0.0*kcm;
453     p11Y = 0.0*kcm;
454     p11Z = +887.0*kmm;
455     gMC->Gspos("ITEL",10,"ITSV",p11X,p11Y,p11Z,idrotm[1],"ONLY");//SSD Y
456
457     // SDDs 
458     Float_t pdet1X,pdet1Y,pdet1Z;
459     Float_t pdet2X,pdet2Y,pdet2Z;
460     pdet1X = 0.0*kcm;
461     pdet1Y = 0.0*kcm;
462     pdet1Z = 0.0*kcm;
463     gMC->Gspos("IDET",1,"ITSV",pdet1X,pdet1Y,pdet1Z,idrotm[0],"ONLY");// Detector1
464     pdet2X = 0.0*kcm;
465     pdet2Y = 0.0*kcm;
466     pdet2Z = 52*kmm; //52
467     gMC->Gspos("IDET",2,"ITSV",pdet2X,pdet2Y,pdet2Z,idrotm[0],"ONLY");// Detector2
468
469 // Target definition and placement
470     if(fTarg){
471       data[0] = 30*kmm;
472       data[1] = fTargThick*kmm;  // Target thickness
473       data[2] = 30*kmm;
474       gMC->Gsvolu("ITGT","BOX ",idtmed[fTarg],data,3);
475
476       Float_t a,z,dens,radl,absl;
477       Float_t* ubuf=0; Int_t nbuf;
478       char* ssss="";
479       gMC->Gfmate(idtmed[fTarg],ssss,a,z,dens,radl,absl,ubuf,nbuf);
480
481       Info("CreateGeometry","Target A=%f,  Z=%f,  dens=%f",a,z,dens);
482       Info("Creategeometry","Target thickness=%f mm",fTargThick);
483
484       Float_t ptgtX,ptgtY,ptgtZ;
485       ptgtX = 0.0*kcm;
486       ptgtY = 0.0*kcm;
487       ptgtZ = -50*kmm;
488       gMC->Gspos("ITGT",1,"ITSV",ptgtX,ptgtY,ptgtZ,idrotm[0],"ONLY");// Target
489     }else{
490       Info("CreateGeometry","No target defined");
491     }
492 }
493 //______________________________________________________________________
494 void AliITSvSDD03::CreateMaterials(){
495     ////////////////////////////////////////////////////////////////////////
496     //
497     // Create ITS SDD test beam materials
498     //     This function defines the default materials used in the Geant
499     // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
500     // AliITSvSDD03.
501     // In general it is automatically replaced by
502     // the CreateMaterials routine defined in AliITSv?. Should the function
503     // CreateMaterials not exist for the geometry version you are using this
504     // one is used. See the definition found in AliITSv5 or the other routine
505     // for a complete definition.
506     //
507     // Inputs:
508     //    none.
509     // Outputs:
510     //    none.
511     // Return:
512     //    none.
513     /////////////////////////////////////////////////////////////////////////
514     Float_t tmaxfdSi = 0.1; // Degree
515     Float_t stemaxSi = 0.0075; // cm //0.0075
516     Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
517     Float_t epsilSi  = 1.0E-4;//
518     Float_t stminSi  = 0.0; // cm "Default value used"
519
520     Float_t tmaxfdAir = 0.1; // Degree
521     Float_t stemaxAir = .10000E+01; // 1 cm  //cm
522     Float_t deemaxAir = 0.1; // Fraction of particle's energy 0<deemax<=1
523     Float_t epsilAir  = 1.0E-4;//
524     Float_t stminAir  = 0.0; // cm "Default value used"
525     Int_t   ifield = gAlice->Field()->Integ();
526     Float_t fieldm = gAlice->Field()->Max();
527     //
528
529     // AIR
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     // Lucite/Plexiglass
535     Float_t aLuc[3] = {1.,12.,16.};
536     Float_t zLuc[3] = {1.,6.,8.};
537     Float_t wLuc[3] = {8.,5.,2.};
538     Float_t dLuc = 1.19;
539     // stainless steel
540     Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
541     Float_t zsteel[4] = { 26.,24.,28.,14. };
542     Float_t wsteel[4] = { .715,.18,.1,.005 };
543     Float_t dsteel = 7.88;
544
545     AliMixture(1, "AIR$",aAir,zAir,dAir,4,wAir);
546     AliMaterial(2,"SI$",28.086,14.0,2.3300,9.3600,999.00);
547     AliMixture(3,"Sintilator$",aLuc,zLuc,dLuc,-3,wLuc);
548     AliMixture(4,"PlasticBox$",aLuc,zLuc,dLuc,-3,wLuc);
549     AliMaterial(5, "IRON$", 55.85, 26., 7.87, 1.76, 999.00);
550     AliMaterial(6, "LEAD$", 207.19, 82., 11.35, .56, 999.00);
551     AliMixture(7, "STAINLESS STEEL$", asteel, zsteel,dsteel, 4, wsteel);
552     AliMaterial(9, "C$", 12.011, 6., 2.265, 18.8, 999.00);
553     AliMaterial(10, "Al$", 26.98, 13., 2.70, 8.9, 999.00);
554     AliMaterial(11, "Be$", 9.012, 4., 1.848, 35.3, 999.00);
555     AliMaterial(12, "Ti$", 47.88, 22., 4.54, 3.56, 999.00);
556     AliMaterial(13, "Sn$", 118.69, 50., 7.31, 1.21, 999.00); 
557     AliMaterial(14, "Cu$", 63.55, 29., 8.96, 1.43, 999.00);
558     AliMaterial(15, "Ge$", 72.59, 32., 5.323, 2.30, 999.00);
559     AliMaterial(20, "W$", 183.85, 74., 19.3, 0.35, 999.00);
560  
561     AliMedium(1,"AIR$",1,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,
562               epsilAir,stminAir);
563     AliMedium(2,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
564               epsilSi,stminSi);
565     AliMedium(3,"Scintillator$",3,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
566               epsilSi,stminSi);
567     AliMedium(4,"PlasticBox$",4,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
568               epsilSi,stminSi);
569     AliMedium(5,"IRON$",5,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
570               epsilSi,stminSi);
571     AliMedium(6,"LEAD$",6,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
572               epsilSi,stminSi);
573     AliMedium(7,"StainlessSteel$",7,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
574               epsilSi,stminSi);
575
576     AliMedium(9,"C$",9,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
577     AliMedium(10,"Al$",10,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
578     AliMedium(11,"Be$",11,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
579     AliMedium(12,"Ti$",12,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
580     AliMedium(13,"Sn$",13,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
581     AliMedium(14,"Cu$",14,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
582     AliMedium(15,"Ge$",15,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
583     AliMedium(20,"W$",20,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
584     //dummy materials to avoid warning during simulation (galice.cuts)
585
586    AliMedium(21,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
587               epsilSi,stminSi);
588    AliMedium(25,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
589               epsilSi,stminSi);
590    AliMedium(26,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
591               epsilSi,stminSi);
592    AliMedium(27,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
593               epsilSi,stminSi);
594    AliMedium(51,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
595               epsilSi,stminSi);
596    AliMedium(52,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
597               epsilSi,stminSi);
598    AliMedium(53,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
599               epsilSi,stminSi);
600    AliMedium(54,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
601               epsilSi,stminSi);
602    AliMedium(55,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
603               epsilSi,stminSi);
604    AliMedium(56,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
605               epsilSi,stminSi);
606    AliMedium(61,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
607               epsilSi,stminSi);
608    AliMedium(62,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
609               epsilSi,stminSi);
610    AliMedium(63,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
611               epsilSi,stminSi);
612    AliMedium(64,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
613               epsilSi,stminSi);
614    AliMedium(65,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
615               epsilSi,stminSi);
616    AliMedium(68,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
617               epsilSi,stminSi);
618    AliMedium(69,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
619               epsilSi,stminSi);
620    AliMedium(70,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
621               epsilSi,stminSi);
622    AliMedium(71,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
623               epsilSi,stminSi);
624    AliMedium(72,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
625               epsilSi,stminSi);
626    AliMedium(73,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
627               epsilSi,stminSi);
628    AliMedium(74,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
629               epsilSi,stminSi);
630    AliMedium(75,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
631               epsilSi,stminSi);
632    AliMedium(76,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
633               epsilSi,stminSi);
634    AliMedium(77,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
635               epsilSi,stminSi);
636    AliMedium(78,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
637               epsilSi,stminSi);
638    AliMedium(79,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
639               epsilSi,stminSi);
640    AliMedium(80,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
641               epsilSi,stminSi);
642    AliMedium(81,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
643               epsilSi,stminSi);
644    AliMedium(82,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
645               epsilSi,stminSi);
646    AliMedium(83,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
647               epsilSi,stminSi);
648    AliMedium(84,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
649               epsilSi,stminSi);
650    AliMedium(85,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
651               epsilSi,stminSi);
652    AliMedium(90,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
653               epsilSi,stminSi);
654    AliMedium(91,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
655               epsilSi,stminSi);
656    AliMedium(92,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
657               epsilSi,stminSi);
658    AliMedium(93,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
659               epsilSi,stminSi);
660    AliMedium(94,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
661               epsilSi,stminSi);
662    AliMedium(95,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
663               epsilSi,stminSi);
664    AliMedium(96,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
665               epsilSi,stminSi);
666
667 }            
668 //______________________________________________________________________
669 void AliITSvSDD03::InitAliITSgeom(){
670     //     Based on the geometry tree defined in Geant 3.21, this
671     // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
672     // sturture.
673     // Inputs:
674     //    none.
675     // Outputs:
676     //    none.
677     // Return:
678     //    none.
679     const Int_t knlayers=12;
680     //   const Int_t kndeep=6;
681     const Int_t kltypess=2;
682     const AliITSDetector kidet[knlayers]={kSSD,kSDD};
683     const TString knames[kltypess]={
684         "/ALIC_1/ITSV_1/ITEL_%d/ITAI_1/IMB0_1/IMBS_1",
685         "/ALIC_1/ITSV_1/IDET_%d/IDAI_1/ITS0_1/ITST_1"};
686     const Int_t kitsGeomTreeCopys[kltypess]={10,2};
687     const Int_t knp=384;
688     const Float_t kpitch=50.E-4;/*cm*/
689     Float_t box[3]={0.5*kpitch*(Float_t)knp,150.E-4,1.0},p[knp+1],n[knp+1];
690     Int_t nlad[knlayers]={knlayers*1};
691     Int_t ndet[knlayers]={knlayers*1};
692     Int_t mod=knlayers,lay=0,lad=0,det=0,i,j,cp0;
693     TString path,shapeName;
694     TGeoHMatrix matrix;
695     Double_t trans[3]={3*0.0},rot[10]={10*0.0};
696     TArrayD shapePar;
697     TArrayF shapeParF;
698     Bool_t isShapeDefined[kltypess]={kltypess*kFALSE};
699     AliITSgeom *geom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
700     if(GetITSgeom()!=0) SetITSgeom(0x0);// delet existing if there.
701     SetITSgeom(geom);
702
703     p[0]=-box[0];
704     n[0]=box[0];
705     // Fill in anode and cathode strip locations (lower edge)
706     for(i=1;i<knp;i++){
707         p[i] =p[i-1]+kpitch;
708         n[i] =n[i-1]-kpitch;
709     } // end for i
710     p[knp]=box[0];
711     n[knp]=-box[0];
712     for(i=0;i<kltypess;i++)for(cp0=1;cp0<=kitsGeomTreeCopys[i];cp0++){
713         mod = DecodeDetector(fIdSens[i],cp0,lay,lad,det);
714         path.Form(knames[i].Data(),cp0);
715         gMC->GetTransformation(path.Data(),matrix);
716         gMC->GetShape(path.Data(),shapeName,shapePar);
717         shapeParF.Set(shapePar.GetSize());
718         for(j=0;j<shapePar.GetSize();j++)shapeParF[j]=shapePar[j];
719         geom->CreateMatrix(mod,lay,lad,det,kidet[i],trans,rot);
720         geom->SetTrans(mod,matrix.GetTranslation());
721         geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
722         geom->GetGeomMatrix(mod)->SetPath(path.Data());
723         switch (kidet[i]){
724         case kSDD: if(!(GetITSgeom()->IsShapeDefined((Int_t)kSDD))){
725             geom->ReSetShape(kSDD,new AliITSgeomSDD256(shapeParF.GetSize(),
726                                                        shapeParF.GetArray()));
727             isShapeDefined[i]=kTRUE;
728         } break;
729         case kSSD:if(!(GetITSgeom()->IsShapeDefined((Int_t)kSSD))){
730             geom->ReSetShape(kSSD,new AliITSgeomSSD(box,0.0,0.0,
731                                                     knp+1,p,knp+1,n));
732             isShapeDefined[i]=kTRUE;
733         } break;
734         default:{} break;
735         } // end switch
736     } // end for i,cp0
737     return;
738 }
739 //______________________________________________________________________
740 void AliITSvSDD03::Init(){
741     ////////////////////////////////////////////////////////////////////////
742     //     Initialise the ITS after it has been created.
743     // Inputs:
744     //    none.
745     // Outputs:
746     //    none.
747     // Return:
748     //    none.
749     ////////////////////////////////////////////////////////////////////////
750
751
752     Info("Init","**********AliITSvSDD03 %d _Init *************",fMinorVersion);
753
754     if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
755     if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
756     if(GetITSgeom()!=0) SetITSgeom(0x0);
757     AliITSgeom* geom = new AliITSgeom();
758     SetITSgeom(geom);
759     if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
760     if(!fGeomDetIn) this->InitAliITSgeom();
761     if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
762     AliITS::Init();
763     fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
764
765 }
766 //______________________________________________________________________
767 void AliITSvSDD03::SetDefaults(){
768     // sets the default segmentation, response, digit and raw cluster classes
769     // Inputs:
770     //    none.
771     // Outputs:
772     //    none.
773     // Return:
774     //    none.
775
776   //    const Float_t kconv = 1.0e+04; // convert cm to microns
777
778     if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
779     fDetTypeSim->SetITSgeom(GetITSgeom());
780     fDetTypeSim->ResetCalibrationArray();
781     fDetTypeSim->ResetSegmentation();
782  
783     AliITSgeomSDD *s1;
784     AliITSgeomSSD *s2;
785     SetCalibrationModel(GetITSgeom()->GetStartSPD(),new AliITSCalibrationSPD());
786     SetSegmentationModel(kSPD,(AliITSsegmentationSPD*)
787                          (GetITSgeom()->GetShape(kSPD)));
788     fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
789
790     // SDD
791     s1 = (AliITSgeomSDD*) GetITSgeom()->GetShape(kSDD);// Get shape info. Do it this way for now.
792     AliITSCalibrationSDD *resp1=new AliITSCalibrationSDD("simulated");
793     SetCalibrationModel(GetITSgeom()->GetStartSDD(),resp1);
794
795     AliITSsegmentationSDD *seg1 = (AliITSsegmentationSDD*)
796                          (GetITSgeom()->GetShape(kSDD));
797     seg1->SetDriftSpeed(resp1->GetDriftSpeed());
798     seg1->SetNPads(256,256);// Use AliITSgeomSDD for now
799     SetSegmentationModel(kSDD,seg1);
800     const char *kData1=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSDD()))->DataType();
801     const char *kopt=resp1->GetZeroSuppOption();
802     if((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ){
803         fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigit");
804     } else fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigitSDD");
805
806     // SSD  Layer 5
807
808     s2 = (AliITSgeomSSD*) GetITSgeom()->GetShape(kSSD);// Get shape info. Do it this way for now.
809    
810     AliITSCalibration *resp2= new AliITSCalibrationSSD("simulated");
811     SetCalibrationModel(GetITSgeom()->GetStartSSD(),resp2);
812
813     AliITSsegmentationSSD *seg2 = (AliITSsegmentationSSD*)
814                          (GetITSgeom()->GetShape(kSSD));
815     seg2->SetPadSize(50.,0.); // strip x pitch in microns
816     seg2->SetNPads(384,0); // number of strips on each side.
817     seg2->SetLayer(5);
818     seg2->SetAngles(0.,0.); // strip angles rad P and N side.
819     seg2->SetAnglesLay5(0.,0.); // strip angles rad P and N side.
820     seg2->SetAnglesLay6(0.,0.); // strip angles rad P and N side.
821
822     SetSegmentationModel(kSSD,seg2); 
823     const char *kData2=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSSD()))->DataType();
824     if(strstr(kData2,"real") ) fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigit");
825     else fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigitSSD");
826
827     if(fgkNTYPES>3){
828         Warning("SetDefaults",
829                 "Only the four basic detector types are initialised!");
830     }// end if
831     return;
832 }
833 //______________________________________________________________________
834 void AliITSvSDD03::SetDefaultSimulation(){
835     // sets the default simulation.
836     // Inputs:
837     //      none.
838     // Outputs:
839     //      none.
840     // Return:
841     //      none.
842
843   if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
844   AliITSsimulation *sim;
845   //AliITSsegmentation *seg;
846   //AliITSCalibration *res;
847   //SPD
848   if(fDetTypeSim){
849     sim = fDetTypeSim->GetSimulationModel(kSPD);
850     if (!sim) {
851       //seg =(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
852       //if(seg==0) seg = new AliITSsegmentationSPD();
853       //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD());
854       //if(res==0) res = new AliITSCalibrationSPD();
855       sim = new AliITSsimulationSPD(fDetTypeSim);
856       SetSimulationModel(kSPD,sim);
857     }else{ // simulation exists, make sure it is set up properly.
858       sim->SetSegmentationModel(kSPD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
859       sim->SetCalibrationModel(GetITSgeom()->GetStartSPD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD()));
860       sim->Init();
861     } // end if
862   } // end if iDetType
863   //SDD
864   if(fDetTypeSim){
865     sim = fDetTypeSim->GetSimulationModel(kSDD);
866     if (!sim) {
867       //      seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
868       //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
869       sim = new AliITSsimulationSDD(fDetTypeSim);
870       SetSimulationModel(kSDD,sim);
871     }else{ // simulation exists, make sure it is set up properly.
872       sim->SetSegmentationModel(kSDD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
873       sim->SetCalibrationModel(GetITSgeom()->GetStartSDD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSDD()));
874       
875       sim->Init();
876     } //end if
877   } // end if iDetType
878   //SSD
879   if(fDetTypeSim){
880     sim = fDetTypeSim->GetSimulationModel(kSSD);
881     if (!sim) {
882       //      seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
883       // res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
884       sim = new AliITSsimulationSSD(fDetTypeSim);
885       SetSimulationModel(kSSD,sim);
886     }else{ // simulation exists, make sure it is set up properly.
887       sim->SetSegmentationModel(kSSD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
888       sim->SetCalibrationModel(GetITSgeom()->GetStartSSD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSSD()));
889       sim->Init();
890     } // end if
891   } // end if iDetType
892 }
893 //______________________________________________________________________
894 void AliITSvSDD03::DrawModule() const{
895     ////////////////////////////////////////////////////////////////////////
896     //     Draw a shaded view of the ITS SDD test beam version 1.
897     // Inputs:
898     //    none.
899     // Outputs:
900     //    none.
901     // Return:
902     //    none.
903     ////////////////////////////////////////////////////////////////////////
904     // Set everything unseen
905     gMC->Gsatt("*", "seen", -1);
906     // Set ALIC mother visible
907     gMC->Gsatt("ALIC","SEEN",0);
908     // Set ALIC ITS visible
909     gMC->Gsatt("ITSV","SEEN",1);
910     // Set ALIC Telescopes visible
911     gMC->Gsatt("ITEL","SEEN",1);
912     gMC->Gsatt("ITEL","colo",2);
913     // Set ALIC detetcor visible
914     gMC->Gsatt("IDET","SEEN",1);
915     gMC->Gsatt("IDET","colo",4);
916     // Set ALIC Scintillator visible
917     gMC->Gsatt("ISNT","SEEN",1);
918     gMC->Gsatt("ISNT","colo",3);
919     // Set Detector mother visible and drawn
920 //    gMC->Gsatt("ITS0","SEEN",1);
921     // Set minibus mother visible and drawn
922 //    gMC->Gsatt("IMB0","SEEN",1);
923
924     // Draw
925     gMC->Gdraw("alic", 60, 30, 180, 10,10, .12, .12);
926 }
927 //______________________________________________________________________
928 void AliITSvSDD03::StepManager(){
929     ////////////////////////////////////////////////////////////////////////
930     //    Called for every step in the ITS SDD test beam, then calles the 
931     // AliITShit class  creator with the information to be recoreded about
932     //  that hit.
933     //     The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
934     // printing of information to a file which can be used to create a .det
935     // file read in by the routine CreateGeometry(). If set to 0 or any other
936     // value except 1, the default behavior, then no such file is created nor
937     // it the extra variables and the like used in the printing allocated.
938     // Inputs:
939     //    none.
940     // Outputs:
941     //    none.
942     // Return:
943     //    none.
944     ////////////////////////////////////////////////////////////////////////
945     Int_t  copy, id;
946     static TLorentzVector position0;
947     static Int_t stat0=0;
948     if((id=gMC->CurrentVolID(copy) == fIDMother)&&
949        (gMC->IsTrackEntering()||gMC->IsTrackExiting())){
950         copy = fTrackReferences->GetEntriesFast();
951         TClonesArray &lTR = *fTrackReferences;
952         // Fill TrackReference structure with this new TrackReference.
953         new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->
954                                          GetCurrentTrackNumber());
955     } // if Outer ITS mother Volume
956     //if(!(this->IsActive())) return;
957     if(!(gMC->TrackCharge())) return;
958     Int_t   vol[5],copy3;
959     TLorentzVector position, momentum;
960     TClonesArray &lhits = *fHits;
961     //
962     // Fill hit structure.
963     gMC->TrackPosition(position);
964     gMC->TrackMomentum(momentum);
965     id   = gMC->CurrentVolID(copy);
966     if(id==fIdSens[0] || id==fIdSens[1]){ // Volumes "ITST" or "IMBS"
967         copy = gMC->CurrentVolOffID(3,copy3);
968         copy = DecodeDetector(id,copy3,vol[0],vol[1],vol[2]);
969         //    cout << "0: mod,lay,lad,det="<<copy<<","<<vol[0]<<","<<vol[1]
970         //     <<","<<vol[2]<<" name="<<gMC->CurrentVolName()
971         //     <<","<<fIdSens[0]<<","<<fIdSens[1]<<","<<id<<" z="
972         //     <<position.Z()<<endl;
973     }else if(id==fIdSens[2]){ // "ISNT" Sintilator
974         //cout << "1: id,copy="<<id<<","<<copy
975         //     <<" name="<<gMC->CurrentVolName()<<" z="
976         //     <<position.Z()<<endl;
977         return; // Do nothing for now.
978     }else{
979         //cout << "2: id,copy="<<id<<","<<copy
980         //     <<" name="<<gMC->CurrentVolName()<<" z="
981         //     <<position.Z()<<endl;
982         return;
983     } // end if
984     //
985     // Track status
986     vol[3] = 0;
987     vol[4] = 0;
988     if(gMC->IsTrackInside())      vol[3] +=  1;
989     if(gMC->IsTrackEntering())    vol[3] +=  2;
990     if(gMC->IsTrackExiting())     vol[3] +=  4;
991     if(gMC->IsTrackOut())         vol[3] +=  8;
992     if(gMC->IsTrackDisappeared()) vol[3] += 16;
993     if(gMC->IsTrackStop())        vol[3] += 32;
994     if(gMC->IsTrackAlive())       vol[3] += 64;
995     //
996     vol[4] = stat0;
997     if(gMC->IsTrackEntering()){
998         position0 = position;
999         stat0 = vol[3];
1000         return;
1001     }else{
1002         new(lhits[fNhits++]) AliITShit(fIshunt,
1003                                    gAlice->GetMCApp()->GetCurrentTrackNumber(),
1004                                        vol,gMC->Edep(),gMC->TrackTime(),
1005                                        position,position0,momentum);
1006     }// end if gMC->IsTrackEntering()
1007     position0 = position;
1008     stat0 = vol[3];
1009
1010     return;
1011 }
1012