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