]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSvSPD02.cxx
Adding protection on time of flight (E. Fragiacomo)
[u/mrichter/AliRoot.git] / ITS / AliITSvSPD02.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 /* $Id$ */
17
18 #include <TClonesArray.h>
19 #include <TGeoGlobalMagField.h>
20 #include <TGeoManager.h>
21 #include <TGeoMatrix.h>
22 #include <TLorentzVector.h>
23 #include <TVirtualMC.h>
24
25 #include "AliRun.h"
26 #include "AliMagF.h"
27 #include "AliTrackReference.h"
28
29 #include "AliITShit.h"
30 #include "AliITS.h"
31 #include "AliITSvSPD02.h"
32 #include "AliITSgeom.h"
33 #include "AliITSgeomSPD.h"
34 #include "AliITSDetTypeSim.h"
35 #include "AliITSCalibrationSPD.h"
36 #include "AliITSsegmentationSPD.h"
37 #include "AliITSsimulationSPD.h"
38 #include "AliMC.h"
39
40
41 ///////////////////////////////////////////////////////////////////////
42 // Step manager and 
43 // geometry class
44 // for the ITS 
45 // SPD test beam
46 // geometry of summer 2002
47 // 
48 ///////////////////////////////////////////////////////////////////////
49 ClassImp(AliITSvSPD02)
50
51 //______________________________________________________________________
52 AliITSvSPD02::AliITSvSPD02():
53 AliITS(),
54 fMajorVersion((Int_t)kvSPD02),
55 fMinorVersion(2),
56 fGeomNumber(2002),
57 fDet1(300.0),
58 fDet2(300.0),
59 fChip1(300.0),
60 fChip2(300.0),
61 fIDMother(0),
62 fIgm(kvSPD02){
63     ////////////////////////////////////////////////////////////////////////
64     // Standard default constructor for the ITS SPD test beam 2002 version 1.
65     // Inputs:
66     //    none.
67     // Outputs:
68     //    none.
69     // Return:
70     //    A default created class.
71     ////////////////////////////////////////////////////////////////////////
72 }
73 //______________________________________________________________________
74 AliITSvSPD02::AliITSvSPD02(const char *title,Int_t gn) : AliITS("ITS", title),
75 fMajorVersion(1),
76 fMinorVersion(2),
77 fGeomNumber(2002),
78 fDet1(300.0),
79 fDet2(300.0),
80 fChip1(300.0),
81 fChip2(300.0),
82 fIDMother(0),
83 fIgm(kvSPD02){
84     ////////////////////////////////////////////////////////////////////////
85     //    Standard constructor for the ITS SPD testbeam 2002 version 1.
86     // Inputs:
87     //    const char *title    title for this ITS geometry.
88     //    Int_t      gn        Geometry version number (year) default 2002.
89     // Outputs:
90     //    none.
91     // Return:
92     //    A standard created class.
93     ////////////////////////////////////////////////////////////////////////
94     Int_t i;
95
96     fGeomNumber = gn;
97     fIdN = 2;
98     fIdName = new TString[fIdN];
99     fIdName[0] = "IMBS";
100     fIdName[1] = "ITST";
101     fIdSens    = new Int_t[fIdN];
102     for(i=0;i<fIdN;i++) fIdSens[i] = 0;
103     SetThicknessDet1();
104     SetThicknessDet2();
105     SetThicknessChip1();
106     SetThicknessChip2();                         
107
108 }
109 //______________________________________________________________________
110 AliITSvSPD02::~AliITSvSPD02() {
111     ////////////////////////////////////////////////////////////////////////
112     //    Standard destructor for the ITS SPD test beam 2002 version 1.
113     // Inputs:
114     //    none.
115     // Outputs:
116     //    none.
117     // Return:
118     //    none.
119     ////////////////////////////////////////////////////////////////////////
120 }
121 //______________________________________________________________________
122 void AliITSvSPD02::CreateGeometry(){
123     ////////////////////////////////////////////////////////////////////////
124     //  This routine defines and Creates the geometry for version 1 of the ITS.
125     //    ALIC    ALICE Mother Volume
126     //     |- ITSV     ITS Mother Volume
127     //         |- IDET       Detector under Test
128     //         |   |- ITS0       SPD Si Chip
129     //         |   |  |- ITST      SPD Sensitivve Volume
130     //         |   |- IPC0 *5    Readout chip
131     //         |- ITEL *4    SPD Telescope
132     //             |- IMB0       SPD Si Chip
133     //             |   |- IMBS     SPD Sensitive volume
134     //             |- ICMB       Chip MiniBus.
135     // Inputs:
136     //    none.
137     // Outputs:
138     //    none.
139     // Return:
140     //    none.
141     ////////////////////////////////////////////////////////////////////////
142
143     switch (fGeomNumber){
144     case 2002:
145         CreateGeometry2002();
146         break;
147     default:
148         CreateGeometry2002();
149         break;
150     } // end switch
151 }
152 //______________________________________________________________________
153 void AliITSvSPD02::CreateGeometry2002(){
154     ////////////////////////////////////////////////////////////////////////
155     //  This routine defines and Creates the geometry for version 1 of the ITS.
156     //    ALIC    ALICE Mother Volume
157     //     |- ITSV     ITS Mother Volume
158     //         |- IDET       Detector under Test
159     //         |   |- ITS0       SPD Si Chip
160     //         |   |  |- ITST      SPD Sensitivve Volume
161     //         |   |- IPC0 *5    Readout chip
162     //         |- ITEL *4    SPD Telescope
163     //             |- IMB0       SPD Si Chip
164     //             |   |- IMBS     SPD Sensitive volume
165     //             |- ICMB       Chip MiniBus.
166     //
167     //      ITEL ITEL IDET ITEL ITEL
168     // Z->  -38  -36   02  36.5 38.5
169     //       |    |     |    |    |
170     // cpn1  1    2     1    3    4
171     // Inputs:
172     //    none.
173     // Outputs:
174     //    none.
175     // Return:
176     //    none.
177     ////////////////////////////////////////////////////////////////////////
178     Float_t data[49];
179     // Define media off-set
180     Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
181     Int_t idrotm[4]; // Array of rotation matrix indexes
182     Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
183     Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
184     Float_t yposition= 0.0;
185     // These constant character strings are set by cvs during commit
186     // do not change them unless you know what you are doing!
187     const Char_t *cvsDate="$Date$";
188     const Char_t *cvsRevision="$Revision$";
189
190     if(gMC==0) return;
191     // Define Rotation-reflextion Matrixes needed
192     // 0 is the unit matrix
193     AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
194     /*
195     data[0] = 10.0;
196     data[1] = 50.0;
197     data[2] = 100.0;
198     gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
199     gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
200     */
201     TGeoVolumeAssembly *itsV = gGeoManager->MakeVolumeAssembly("ITSV");
202     const Int_t length=100;
203     Char_t vstrng[length];
204     if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
205                                fMinorVersion,cvsDate,cvsRevision))
206         itsV->SetTitle(vstrng);
207     else Error("CreateGeometry","Error writing/setting version string");
208     TGeoVolume *alic = gGeoManager->GetVolume("ALIC");
209     if(alic==0) {
210         Error("CreateGeometry","alic=0");
211         return;
212     } // end if
213     // See idrotm[199] for angle definitions.
214     alic->AddNode(itsV,1,0);
215
216     //cout << "idtmed[0]=" << idtmed[0]<<endl;
217     //cout << "idtmed[1]=" << idtmed[1]<<endl;
218     Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
219     // SPD part of telescope (MiniBuS)
220     data[0] = detMiniBusX = 0.705;
221     data[1] = detMiniBusY = 0.5*ddettelescope;
222     data[2] = detMiniBusZ = 3.536;
223     gMC->Gsvolu("IMB0", "BOX ", idtmed[1], data, 3);   // contains detector
224     data[0] = 0.64;
225     data[1] = 0.5*ddettelescope;
226     data[2] = 3.48;
227     gMC->Gsvolu("IMBS","BOX ",idtmed[1],data,3); // sensitive detecor volulme
228     gMC->Gspos("IMBS",1,"IMB0",0.0,0.0,0.0,0,"ONLY"); // place IMBS inside
229     // IMB0 with no translation and unit rotation matrix.
230     Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
231     data[0] = chipMiniBusX = 0.793;
232     data[1] = chipMiniBusY = 0.5*dchipMiniBus;
233     data[2] = chipMiniBusZ = 0.68;
234     gMC->Gsvolu("ICMB","BOX ",idtmed[1],data, 3);   // chip Minibus
235     data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
236     data[1] = detMiniBusY+chipMiniBusY;
237     data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
238     gMC->Gsvolu("ITEL","BOX ",idtmed[0],data,3);
239     gMC->Gspos("IMB0",1,"ITEL",0.0,data[1]-detMiniBusY,0.0,0,"ONLY");
240     gMC->Gspos("ICMB",1,"ITEL",0.0,-data[1]+chipMiniBusY,0.0,0,"ONLY");
241
242     // SPD under test
243     Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
244     data[0] = spdX = 0.705;
245     data[1] = spdY = 0.5*ddettest;
246     data[2] = spdZ = 3.536;
247     gMC->Gsvolu("ITS0", "BOX ", idtmed[1], data, 3);   // contains detector
248     data[0] = 0.64;
249     data[1] = 0.5*ddettest;
250     data[2] = 3.48;
251     gMC->Gsvolu("ITST","BOX ",idtmed[1],data,3);// sensitive detecor volume
252     gMC->Gspos("ITST",1,"ITS0",0.0,0.0,0.0,0,"ONLY"); // place ITST inside
253     // ITS0 with no translation and unit rotation matrix.
254     data[0] = spdchipX = 0.793;
255     data[1] = spdchipY = 0.5*dchiptest;
256     data[2] = spdchipZ = 0.68;
257     gMC->Gsvolu("IPC0", "BOX ", idtmed[1],data,3);   // chip under test
258     data[0] = TMath::Max(spdchipX,spdX);
259     data[1] = spdY+spdchipY;
260     data[2] = TMath::Max(spdchipZ,spdZ);
261     gMC->Gsvolu("IDET","BOX ",idtmed[0],data,3);
262     gMC->Gspos("ITS0",1,"IDET",0.0,data[1]-spdY,0.0,0,"ONLY");
263     for(Int_t i=-2;i<3;i++) gMC->Gspos("IPC0",i+3,"IDET",0.0,-data[1]+spdchipY,
264               i*2.*spdchipZ+i*0.25*(spdZ-5.*spdchipZ),0,"ONLY");
265
266     // Positions detectors, Beam Axis Z, X to the right, Y up to the sky.
267     Float_t p00X,p00Y,p00Z,p01X,p01Y,p01Z,p10X,p10Y,p10Z,p11X,p11Y,p11Z;
268     p00X = 0.0;
269     p00Y = 0.0;
270     p00Z = -38.0;
271     gMC->Gspos("ITEL",1,"ITSV",p00X,p00Y,p00Z,idrotm[0],"ONLY");
272     p01X = 0.0;
273     p01Y = 0.0;
274     p01Z = p00Z+2.0;
275     gMC->Gspos("ITEL",2,"ITSV",p01X,p01Y,p01Z,idrotm[0],"ONLY");
276     Float_t pdetX,pdetY,pdetZ;
277     pdetX = 0.0;
278     pdetY = 0.0+yposition;
279     pdetZ = p01Z+38.0;
280     gMC->Gspos("IDET",1,"ITSV",pdetX,pdetY,pdetZ,idrotm[0],"ONLY");
281     p10X = 0.0;
282     p10Y = 0.0;
283     p10Z = pdetZ + 34.5;
284     gMC->Gspos("ITEL",3,"ITSV",p10X,p10Y,p10Z,idrotm[0],"ONLY");
285     p11X = 0.0;
286     p11Y = 0.0;
287     p11Z = p10Z+2.0;
288     gMC->Gspos("ITEL",4,"ITSV",p11X,p11Y,p11Z,idrotm[0],"ONLY");
289 }
290 //______________________________________________________________________
291 void AliITSvSPD02::CreateMaterials(){
292     ////////////////////////////////////////////////////////////////////////
293     //
294     // Create ITS SPD test beam materials
295     //     This function defines the default materials used in the Geant
296     // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
297     // AliITSvSPD02.
298     // In general it is automatically replaced by
299     // the CreateMaterials routine defined in AliITSv?. Should the function
300     // CreateMaterials not exist for the geometry version you are using this
301     // one is used. See the definition found in AliITSv5 or the other routine
302     // for a complete definition.
303     //
304     // Inputs:
305     //    none.
306     // Outputs:
307     //    none.
308     // Return:
309     //    none.
310     /////////////////////////////////////////////////////////////////////////
311
312     switch (fGeomNumber){
313     case 2002:
314         CreateMaterials2002();
315         break;
316     default:
317         CreateMaterials2002();
318         break;
319     } // end switch
320 }
321 //______________________________________________________________________
322 void AliITSvSPD02::CreateMaterials2002(){
323     ////////////////////////////////////////////////////////////////////////
324     //
325     // Create ITS SPD test beam materials
326     //     This function defines the default materials used in the Geant
327     // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
328     // AliITSvSPD02.
329     // In general it is automatically replaced by
330     // the CreateMaterials routine defined in AliITSv?. Should the function
331     // CreateMaterials not exist for the geometry version you are using this
332     // one is used. See the definition found in AliITSv5 or the other routine
333     // for a complete definition.
334     //
335     // Inputs:
336     //    none.
337     // Outputs:
338     //    none.
339     // Return:
340     //    none.
341     /////////////////////////////////////////////////////////////////////////
342     Float_t tmaxfdSi = 0.1; // Degree
343     Float_t stemaxSi = 0.0075; // cm
344     Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
345     Float_t epsilSi  = 1.0E-4;//
346     Float_t stminSi  = 0.0; // cm "Default value used"
347
348     Float_t tmaxfdAir = 0.1; // Degree
349     Float_t stemaxAir = .10000E+01; // cm
350     Float_t deemaxAir = 0.1; // Fraction of particle's energy 0<deemax<=1
351     Float_t epsilAir  = 1.0E-4;//
352     Float_t stminAir  = 0.0; // cm "Default value used"
353     Int_t   ifield = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
354     Float_t fieldm = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
355
356     AliMaterial(1,"AIR$",0.14610E+02,0.73000E+01,0.12050E-02,
357                 0.30423E+05,0.99900E+03);
358     AliMedium(1,"AIR$",1,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,
359               epsilAir,stminAir);
360
361     AliMaterial(2,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,
362                 0.93600E+01,0.99900E+03);
363     AliMedium(2,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
364               epsilSi,stminSi);
365 }
366 //______________________________________________________________________
367 void AliITSvSPD02::Init(){
368     //     Initialise the ITS after it has been created.
369     // Inputs:
370     //   none.
371     // Outputs:
372     //   none.
373     // Return:
374     //   none.
375
376     AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
377                  fMinorVersion));
378     //
379     UpdateInternalGeometry();
380     AliITS::Init();
381
382     //
383     fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
384
385 }
386 /*
387 //______________________________________________________________________
388 void AliITSvSPD02::SetDefaults(){
389     // sets the default segmentation, response, digit and raw cluster classes
390     // Inputs:
391     //    none.
392     // Outputs:
393     //    none.
394     // Return:
395     //    none.
396     const Float_t kconv = 1.0e+04; // convert cm to microns
397
398     Info("SetDefaults","Setting up only SPD detector");
399
400     if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
401     fDetTypeSim->SetITSgeom(GetITSgeom());
402     AliITSgeomSPD  *s0;
403     Int_t i;
404     Float_t bx[256],bz[280];
405     fDetTypeSim->ResetCalibrationArray();
406     fDetTypeSim->ResetSegmentation();
407  
408     //SPD
409     // Get shape info. Do it this way for now.
410     s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD);
411     AliITSCalibration *resp0=new AliITSCalibrationSPD();
412     resp0->SetTemperature();
413     resp0->SetDistanceOverVoltage();
414     SetCalibrationModel(0,resp0); 
415         
416     AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD();
417     seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
418                      s0->GetDz()*2.*kconv, // for now.
419                      s0->GetDy()*2.*kconv); // x,z,y full width in microns.
420     seg0->SetNPads(256,160);// Number of Bins in x and z
421     for(i=000;i<256;i++) bx[i] =  50.0; // in x all are 50 microns.
422     for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
423     for(i=160;i<280;i++) bz[i] =   0.0; // Outside of detector.
424     bz[ 31] = bz[ 32] = 625.0; // first chip boundry
425     bz[ 63] = bz[ 64] = 625.0; // first chip boundry
426     bz[ 95] = bz[ 96] = 625.0; // first chip boundry
427     bz[127] = bz[128] = 625.0; // first chip boundry
428     bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
429     seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
430     SetSegmentationModel(kSPD,seg0);
431     // set digit and raw cluster classes to be used
432     const char *kData0=(fDetTypeSim->GetCalibrationModel(0))->DataType();
433     if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit");
434     else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
435 //    SetSimulationModel(kSPD,new AliITSsimulationSPDdubna(seg0,resp0));
436 //    iDetType->ReconstructionModel(new AliITSClusterFinderSPD());
437    
438
439 //    SetResponseModel(kSDD,new AliITSCalibrationSDD());
440 //    SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
441 //    DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
442
443 //    SetResponseModel(kSSD,new AliITSCalibrationSSD());
444 //    SetSegmentationModel(kSSD,new AliITSsegmentationSSD());
445 //    DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
446
447     if(fgkNTYPES>3){
448         Warning("SetDefaults",
449                 "Only the four basic detector types are initialised!");
450     }// end if
451     return;
452 }
453 //______________________________________________________________________
454 void AliITSvSPD02::SetDefaultSimulation(){
455     // sets the default simulation.
456     // Inputs:
457     //      none.
458     // Outputs:
459     //      none.
460     // Return:
461     //      none.
462
463   if(GetITSgeom()==0){
464     Warning("SetDefaultSimulation","ITS geometry is null!");
465     return;
466   }
467
468   if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
469   AliITSsimulation *sim;
470   //AliITSsegmentation *seg;
471   //AliITSCalibration *res;
472   if(fDetTypeSim){
473     sim = fDetTypeSim->GetSimulationModel(kSPD);
474     if (!sim) {
475       //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
476       //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD());
477       sim = new AliITSsimulationSPD(fDetTypeSim);
478       SetSimulationModel(kSPD,sim);
479     }else{ // simulation exists, make sure it is set up properly.
480       sim->SetCalibrationModel(GetITSgeom()->GetStartSPD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD()));
481       sim->SetSegmentationModel(kSPD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
482       sim->Init();
483     } // end if
484   } // end if iDetType
485
486 //      if(fDetTypeSim){
487 //        sim = fDetTypeSim->GetSimulationModel(kSDD);
488 //        if (!sim) {
489 //            seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
490 //            res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
491 //            sim = new AliITSsimulationSDD(seg,res);
492 //           SetSimulationModel(kSDD,sim);
493 //        }else{ // simulation exists, make sure it is set up properly.
494 //        sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()));
495 //        sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
496 //        sim->Init();
497 //        } //end if
498 //    } // end if iDetType
499 //    if(fDetTypeSim){
500 //        sim = fDetTypeSim->GetSimulationModel(kSSD);
501 //        if (!sim) {
502 //            seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
503 //            res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
504 //            sim = new AliITSsimulationSSD(seg,res);
505 //            SetSimulationModel(kSSD,sim);
506 //        }else{ // simulation exists, make sure it is set up properly.
507 //        sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()));
508 //        sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
509 //        sim->Init();
510 //        } // end if
511 //    } //
512 }
513 */
514 //______________________________________________________________________
515 void AliITSvSPD02::DrawModule() const {
516     ////////////////////////////////////////////////////////////////////////
517     //     Draw a shaded view of the ITS SPD test beam version 1.
518     // Inputs:
519     //    none.
520     // Outputs:
521     //    none.
522     // Return:
523     //    none.
524     ////////////////////////////////////////////////////////////////////////
525     // Set everything unseen
526     gMC->Gsatt("*", "seen", -1);
527     // Set ALIC mother visible
528     gMC->Gsatt("ALIC","SEEN",0);
529     // Set ALIC ITS visible
530     gMC->Gsatt("ITSV","SEEN",0);
531     // Set ALIC Telescopes visible
532     gMC->Gsatt("ITEL","SEEN",0);
533     // Set ALIC detetcor visible
534     gMC->Gsatt("IDET","SEEN",0);
535     // Set Detector chip mother visible and drawn
536     gMC->Gsatt("IPC0","SEEN",1);
537     // Set Detector mother visible and drawn
538     gMC->Gsatt("ITS0","SEEN",1);
539     // Set minibus chip mother visible and drawn
540     gMC->Gsatt("ICMB","SEEN",1);
541     // Set minibus mother visible and drawn
542     gMC->Gsatt("IMB0","SEEN",1);
543 }
544 //______________________________________________________________________
545 void AliITSvSPD02::StepManager(){
546     ////////////////////////////////////////////////////////////////////////
547     //    Called for every step in the ITS SPD test beam, then calles the 
548     // AliITShit class  creator with the information to be recoreded about
549     //  that hit.
550     //     The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
551     // printing of information to a file which can be used to create a .det
552     // file read in by the routine CreateGeometry(). If set to 0 or any other
553     // value except 1, the default behavior, then no such file is created nor
554     // it the extra variables and the like used in the printing allocated.
555     // Inputs:
556     //    none.
557     // Outputs:
558     //    none.
559     // Return:
560     //    none.
561     ////////////////////////////////////////////////////////////////////////
562
563     if(!(this->IsActive())){
564         return;
565     } // end if !Active volume.
566     if(!(gMC->TrackCharge())) return;
567
568     Int_t cpy0=0,cpy1=0,id,mod,ncpys,status;
569     TLorentzVector position, momentum;
570     static AliITShit hit;// Saves on calls to construtors
571     //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
572     TClonesArray &lhits = *(Hits());
573     //
574     // Track status
575     // Track status
576     status = 0;
577     if(gMC->IsTrackInside())      status +=  1;
578     if(gMC->IsTrackEntering())    status +=  2;
579     if(gMC->IsTrackExiting())     status +=  4;
580     if(gMC->IsTrackOut())         status +=  8;
581     if(gMC->IsTrackDisappeared()) status += 16;
582     if(gMC->IsTrackStop())        status += 32;
583     if(gMC->IsTrackAlive())       status += 64;
584     //
585     // Fill hit structure.
586     id = gMC->CurrentVolID(cpy0);
587     if(id==fIdSens[0]){  // Volume name "IMBS". Det=1, ladder=1
588         ncpys = 4;
589     } else if(id == fIdSens[1]){ // Volume name "ITST"
590         ncpys = 1;
591     } else return; // end if
592     id = gMC->CurrentVolOffID(2,cpy1);
593     fIgm.DecodeDetector(mod,ncpys,cpy0,cpy1,0);
594     //
595     // Fill hit structure.
596     //
597     hit.SetModule(mod);
598     hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
599     gMC->TrackPosition(position);
600     gMC->TrackMomentum(momentum);
601     hit.SetPosition(position);
602     hit.SetTime(gMC->TrackTime());
603     hit.SetMomentum(momentum);
604     hit.SetStatus(status);
605     hit.SetEdep(gMC->Edep());
606     hit.SetShunt(GetIshunt());
607     if(gMC->IsTrackEntering()){
608         hit.SetStartPosition(position);
609         hit.SetStartTime(gMC->TrackTime());
610         hit.SetStartStatus(status);
611         return; // don't save entering hit.
612     } // end if IsEntering
613     // Fill hit structure with this new hit.
614     //Info("StepManager","Calling Copy Constructor");
615     new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
616     // Save old position... for next hit.
617     hit.SetStartPosition(position);
618     hit.SetStartTime(gMC->TrackTime());
619     hit.SetStartStatus(status);
620     return;
621 }
622