]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSvSSD03.cxx
Changes to obey modified coding convention RC6 (R. Shaoyan)
[u/mrichter/AliRoot.git] / ITS / AliITSvSSD03.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 // Enrico Fragiacomo - 15/03/2004
17 // Geometry for the June 2003 SSD beam test
18
19 #include <TClonesArray.h>
20 #include <TGeoGlobalMagField.h>
21 #include <TGeoManager.h>
22 #include <TGeoMatrix.h>
23 #include <TLorentzVector.h>
24 #include <TVirtualMC.h>
25
26 #include "AliRun.h"
27 #include "AliMagF.h"
28 #include "AliTrackReference.h"
29 #include "AliITShit.h"
30 #include "AliITS.h"
31 #include "AliITSvSSD03.h"
32 #include "AliITSgeom.h"
33 #include "AliITSgeomSSD.h"
34 #include "AliITSDetTypeSim.h"
35 #include "AliITSCalibrationSSD.h"
36 #include "AliITSsegmentationSSD.h"
37 #include "AliITSsimulationSSD.h"
38 #include "AliMC.h"
39
40
41 ///////////////////////////////////////////////////////////////////////
42 // Step manager and 
43 // geometry class
44 // for the ITS 
45 // SSD test beam
46 // geometry of June 2003
47 // 
48 ///////////////////////////////////////////////////////////////////////
49 ClassImp(AliITSvSSD03)
50
51 //______________________________________________________________________
52 AliITSvSSD03::AliITSvSSD03():
53 AliITS(),                  // Base Class
54 fMajorVersion(IsVersion()),// Major version number == IsVersion
55 fMinorVersion(-1),         // Minor version number 
56 fGeomNumber(2003),         // Geometry version number (year)
57 fIDMother(0),              //! ITS Mother Volume id.
58 fIgm(kvSSD03){             //! AliITSInitGeometry object {
59     ////////////////////////////////////////////////////////////////////////
60     // Standard default constructor for the ITS SSD test beam 2003 version 1.
61     // Inputs:
62     //    none.
63     // Outputs:
64     //    none.
65     // Return:
66     //    A default created class.
67     ////////////////////////////////////////////////////////////////////////
68
69     fIdN          = 0;
70     fIdName       = 0;
71     fIdSens       = 0;
72 }
73 //______________________________________________________________________
74 AliITSvSSD03::AliITSvSSD03(const char *title,Int_t gn) :
75 AliITS("ITS",title),       // Base Class
76 fMajorVersion(IsVersion()),// Major version number == IsVersion
77 fMinorVersion(2),         // Minor version number 
78 fGeomNumber(gn),         // Geometry version number (year)
79 fIDMother(0),              //! ITS Mother Volume id.
80 fIgm(kvSSD03){             //! AliITSInitGeometry object {
81     ////////////////////////////////////////////////////////////////////////
82     //    Standard constructor for the ITS SSD testbeam 2003 version 1.
83     // Inputs:
84     //    const char *title    title for this ITS geometry.
85     //    Int_t      gn        Geometry version number (year) default 2003.
86     // Outputs:
87     //    none.
88     // Return:
89     //    A standard created class.
90     ////////////////////////////////////////////////////////////////////////
91     Int_t i;
92
93
94     fIdN = 1; 
95     fIdName = new TString[fIdN];
96     fIdName[0] = "ITST";
97     fIdSens    = new Int_t[fIdN];
98     for(i=0;i<fIdN;i++) fIdSens[i] = 0;                  
99
100 }
101 //______________________________________________________________________
102 AliITSvSSD03::~AliITSvSSD03() {
103     ////////////////////////////////////////////////////////////////////////
104     //    Standard destructor for the ITS SSD test beam 2003 version 1.
105     // Inputs:
106     //    none.
107     // Outputs:
108     //    none.
109     // Return:
110     //    none.
111     ////////////////////////////////////////////////////////////////////////
112 }
113
114 //______________________________________________________________________
115 void AliITSvSSD03::CreateGeometry(){
116     ////////////////////////////////////////////////////////////////////////
117     //   Geometry builder for the ITS SSD test beam 2003 version 1.
118     //    ALIC    ALICE Mother Volume
119     //     |- ITSV     ITS Mother Volume
120     //         |- IDET       Detector under Test
121     // Inputs:
122     //    none.
123     // Outputs:
124     //    none.
125     // Return:
126     //    none.
127     ////////////////////////////////////////////////////////////////////////
128
129     switch (fGeomNumber){
130     case 2003:
131         CreateGeometry2003();
132         break;
133     default:
134         CreateGeometry2003();
135         break;
136     } // end switch
137 }
138 //______________________________________________________________________
139 void AliITSvSSD03::CreateGeometry2003(){
140     ////////////////////////////////////////////////////////////////////////
141     //
142     //    ALIC    ALICE Mother Volume
143     //     |- ITSV     Beamtest Mother Volume
144     //         |
145     //         |- ITSA       Aluminum cover for scintillator
146     //         |    |-ITSS    first Trieste trigger plastic scintillator 
147     //         |- ITSA       Aluminum cover for scintillator
148     //         |    |-ITSS    second Trieste's trigger plastic scintillator
149     //         |
150     //         |- IGAR       Black box around ITST       
151     //         |    |-IAIR    Air inside the black box
152     //         |        |-ITST    Detector under Test 
153     //         |
154     //         |- IFRA       Aluminum cover for scintillator
155     //         |    |-IFRS    French plastic scintillator 
156     //         |
157     //         |- ITSA       Aluminum cover for scintillator
158     //         |    |-ITSS    third Trieste's plastic scintillator
159     //
160     //      ITSA ITSA IGAR IFRA ITSA
161     // Z->  -282 -280   0   16   270
162     //        |    |    |    |    |
163     // cpn0   1    2    1    1    3
164     //
165     // Inputs:
166     //    none.
167     // Outputs:
168     //    none.
169     // Return:
170     //    none.
171     ////////////////////////////////////////////////////////////////////////
172     Float_t data[49];
173     // Define media off-set
174     Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
175     Int_t idrotm[4]; // Array of rotation matrix indexes
176     // These constant character strings are set by cvs during commit
177     // do not change them unless you know what you are doing!
178     const Char_t *cvsDate="$Date$";
179     const Char_t *cvsRevision="$Revision$";
180     //Float_t yposition= 0.0;
181   
182   if(gMC==0) return;
183   // Define Rotation-reflextion Matrixes needed
184   // 0 is the unit matrix
185
186   /*
187   // Beamtest mother volume (air) positioned in ALIC mother volume
188   data[0] = 500.0;
189   data[1] = 500.0;
190   data[2] = 1000.0;
191   gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
192   gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
193   */
194     TGeoVolumeAssembly *itsV = gGeoManager->MakeVolumeAssembly("ITSV");
195     const Int_t length=100;
196     Char_t vstrng[length];
197     if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
198                                fMinorVersion,cvsDate,cvsRevision))
199         itsV->SetTitle(vstrng);
200     else Error("CreateGeometry","Error writing/setting version string");
201     //printf("Title set to %s\n",vstrng);
202     TGeoVolume *alic = gGeoManager->GetVolume("ALIC");
203     if(alic==0) {
204         Error("CreateGeometry","alic=0");
205         return;
206     } // end if
207     // See idrotm[199] for angle definitions.
208     alic->AddNode(itsV,1,0);
209   
210   // Trieste's plastic scintillators for the trigger (2 at beam enter)
211   // ...define them (aluminum cover + scintillator inside)
212   // aluminum cover
213   data[0] = 30.01; // size+2x50 microns Kapton
214   data[1] = 1.01;
215   data[2] = 20.01;
216   //gMC->Gsvolu("ITSA","BOX ",idtmed[3],data,3);// 
217   gMC->Gsvolu("ITSA","BOX ",idtmed[4],data,3);// 
218   data[0] = 30.0;
219   data[1] = 1.0;
220   data[2] = 20.0;
221   // plastic scintillator
222   gMC->Gsvolu("ITSS","BOX ",idtmed[2],data,3);
223   gMC->Gspos("ITSS",1,"ITSA",0.0,0.0,0.0,0,"ONLY"); 
224   // ... and place them inside ITSV
225   AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
226   // first scintillator 
227   gMC->Gspos("ITSA",1,"ITSV",0.0,0.0,-282.0,idrotm[0],"ONLY"); 
228   // second scintillator 
229   gMC->Gspos("ITSA",2,"ITSV",0.0,0.0,-280.0,idrotm[0],"ONLY"); 
230
231   // black kapton box with the SSD sensor inside (width 50 microns)
232   data[0] = 20.0;
233   data[1] = 20.0;
234   data[2] = 20.0;
235   gMC->Gsvolu("IGAR","BOX ",idtmed[4],data,3); //
236   // air in the black kapton box 
237   data[0] = 19.99;
238   data[1] = 19.99;
239   data[2] = 19.99;
240   gMC->Gsvolu("IAIR","BOX ",idtmed[0],data,3); //
241   // SSD sensor 
242   Float_t ddettest=300.0E-4;
243   data[0] = 3.5;
244   data[1] = 0.5*ddettest;
245   data[2] = 2.0;
246   gMC->Gsvolu("ITST","BOX ",idtmed[1],data,3);// sensitive detector volume
247   // place ITST inside IAIR (no rotation: it will be rotated with IGAR)
248   gMC->Gspos("ITST",1,"IAIR",0.0,0.0,0.0,0,"ONLY"); 
249   // place IAIR inside IGAR
250   gMC->Gspos("IAIR",1,"IGAR",0.0,0.0,0.0,0,"ONLY"); 
251   // place IGAR inside ITSV
252   AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
253   gMC->Gspos("IGAR",1,"ITSV",0.0,0.0,0.0,idrotm[0],"ONLY"); 
254   //gMC->Gspos("IGAR",1,"ITSV",0.0,0.0,0.0,0,"ONLY"); 
255  
256   // The so called French detector 
257   // ...define it (Kapton cover + scintillator inside)
258   // Kapton cover
259   data[0] = 2.01; // size+2x50 microns Kapton width
260   data[1] = 1.01;
261   data[2] = 1.01;
262   gMC->Gsvolu("IFRA","BOX ",idtmed[4],data,3);// 
263   data[0] = 2.0;
264   data[1] = 1.0;
265   data[2] = 1.0;
266   // plastic scintillator
267   gMC->Gsvolu("IFRS","BOX ",idtmed[2],data,3);
268   gMC->Gspos("IFRS",1,"IFRA",0.0,0.0,0.0,0,"ONLY"); 
269   // ... and place it inside ITSV
270   AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0); 
271   gMC->Gspos("IFRA",1,"ITSV",0.0,0.0,16.0,idrotm[0],"ONLY"); 
272
273   // An other Trieste's plastic scintillator for the trigger 
274   // ...just place an other copy inside ITSV
275   AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
276   gMC->Gspos("ITSA",3,"ITSV",0.0,0.0,270.0,idrotm[0],"ONLY"); 
277  
278 }
279
280 //______________________________________________________________________
281 void AliITSvSSD03::CreateMaterials(){
282     ////////////////////////////////////////////////////////////////////////
283     //
284     // Create ITS SSD test beam materials
285     //     This function defines the default materials used in the Geant
286     // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
287     // AliITSvSSD03.
288     // In general it is automatically replaced by
289     // the CreateMaterials routine defined in AliITSv?. Should the function
290     // CreateMaterials not exist for the geometry version you are using this
291     // one is used. See the definition found in AliITSv5 or the other routine
292     // for a complete definition.
293     //
294     // Inputs:
295     //    none.
296     // Outputs:
297     //    none.
298     // Return:
299     //    none.
300     /////////////////////////////////////////////////////////////////////////
301
302     switch (fGeomNumber){
303     case 2003:
304         CreateMaterials2003();
305         break;
306     default:
307         CreateMaterials2003();
308         break;
309     } // end switch
310 }
311 //______________________________________________________________________
312 void AliITSvSSD03::CreateMaterials2003(){
313     ////////////////////////////////////////////////////////////////////////
314     //
315     // Create ITS SSD test beam materials
316     //     This function defines the default materials used in the Geant
317     // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
318     // AliITSvSSD03.
319     // In general it is automatically replaced by
320     // the CreateMaterials routine defined in AliITSv?. Should the function
321     // CreateMaterials not exist for the geometry version you are using this
322     // one is used. See the definition found in AliITSv5 or the other routine
323     // for a complete definition.
324     //
325     // Inputs:
326     //    none.
327     // Outputs:
328     //    none.
329     // Return:
330     //    none.
331     /////////////////////////////////////////////////////////////////////////
332
333     Int_t   ifield = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
334     Float_t fieldm = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();   
335
336     // Scintillator CH
337     Float_t ascin[2]={1.01,12.01};
338     Float_t zscin[2]={1,6};
339     Float_t wscin[2]={1,1};
340     Float_t denscin=1.03;
341     AliMixture( 3, "Scintillator$",ascin,zscin,denscin,-2,wscin);
342     AliMedium(3, "Scintillator$", 3, 1, ifield, fieldm, 0.1, .01, 
343               0.1, .0001, 0.0);
344     
345     // Aluminum
346     Float_t tmaxfdAl = 0.1; // Degree
347     Float_t stemaxAl = 0.01; // cm
348     Float_t deemaxAl = 0.1; // Fraction of particle's energy 0<deemax<=1
349     Float_t epsilAl  = 1.0E-4;//
350     Float_t stminAl  = 0.0; // cm "Default value used"
351     AliMaterial(4,  "Al$", 26.98, 13., 2.7, 8.9, 37.2);
352     AliMedium(4,  "Al$",  4, 0, ifield, fieldm, tmaxfdAl, stemaxAl, 
353               deemaxAl, epsilAl, stminAl);
354
355     // Air
356     Float_t tmaxfdAir = 0.1; // Degree
357     Float_t stemaxAir = .10000E+01; // cm
358     Float_t deemaxAir = 0.1; // Fraction of particle's energy 0<deemax<=1
359     Float_t epsilAir  = 1.0E-4;//
360     Float_t stminAir  = 0.0; // cm "Default value used"
361     AliMaterial(1,"AIR$",0.14610E+03,0.73000E+01,0.12050E-03,
362                 0.30423E+05,0.99900E+03);
363     AliMedium(1,"AIR$",1,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,
364               epsilAir,stminAir);
365     
366     // Silicon
367     Float_t tmaxfdSi = 0.1; // Degree
368     //Float_t stemaxSi = 0.0075; // cm
369     //Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
370     //Float_t stminSi  = 0.0; // cm "Default value used"
371     //Float_t tmaxfdSi = 10; // Degree
372     Float_t stemaxSi = 0.01; // cm
373     Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
374     Float_t epsilSi  = 1.0E-4;//
375     //Float_t epsilSi  = 0.003;//
376     Float_t stminSi  = 0.003; // cm "Default value used"
377     AliMaterial(2,"SSD SI$",0.28086E+02,0.14000E+02,0.23300E+01,
378                 0.93600E+01,0.99900E+03);
379     AliMedium(2,"SSD SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
380               epsilSi,stminSi);
381
382     // Kapton
383     AliMaterial(5, "Kapton$", 12.011, 6., 1.3, 31.27, 999.);
384     AliMedium(5, "Kapton$",    5, 0,ifield,fieldm, 10., .01, .1, .003, .003);
385 }/*
386 //______________________________________________________________________
387 void AliITSvSSD03::InitAliITSgeom(){
388   // sturture.
389   // Inputs:
390   //    none.
391   // Outputs:
392   //    none.
393   // Return:
394   //    none.
395     const Int_t knlayers=1;
396     const TString kname="ALIC_1/ITSV_1/IGAR_1/IAIR_1/ITST_1";
397     const Int_t knlad[knlayers]={knlayers*1},kndet[knlayers]={knlayers*1};
398     Int_t npar;
399     Float_t par[20];
400     Double_t trans[3]={3*0.0},rot[10]={10*0.0};
401     TGeoHMatrix materix;
402
403     AliITSgeom* geom = new AliITSgeom(0,knlayers,knlad,kndet,1);
404     SetITSgeom(geom);
405     npar=3;par[0]=3.5;par[1]=0.5*300.0E-4;par[2]=2.0;
406     geom->ReSetShape(kSSD,new AliITSgeomSSD275and75(npar,par));
407     gMC->GetTransformation(kname.Data(),materix);
408     geom->CreateMatrix(0,1,1,1,kSSD,trans,rot);
409     geom->SetTrans(0,materix.GetTranslation());
410     geom->SetRotMatrix(0,materix.GetRotationMatrix());
411     geom->GetGeomMatrix(0)->SetPath(kname.Data());
412     return;
413 }*/
414 //______________________________________________________________________
415 void AliITSvSSD03::Init(){
416     ////////////////////////////////////////////////////////////////////////
417     //     Initialise the ITS after it has been created.
418     // Inputs:
419     //    none.
420     // Outputs:
421     //    none.
422     // Return:
423     //    none.
424     ////////////////////////////////////////////////////////////////////////
425
426
427     Info("Init","**********AliITSvSSD03 %d _Init *************",fMinorVersion);
428
429     AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
430                  fMinorVersion));
431     //
432     UpdateInternalGeometry();
433     AliITS::Init();
434
435     fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
436
437 }/*
438 //______________________________________________________________________
439 void AliITSvSSD03::SetDefaults(){
440     // sets the default segmentation, rerponse, digit and raw cluster classes
441     // Inputs:
442     //    none.
443     // Outputs:
444     //    none.
445     // Return:
446     //    none.
447     const Float_t kconv = 1.0e+04; // convert cm to microns
448
449     Info("SetDefaults","Setting up only SSD detector");
450
451     if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
452     fDetTypeSim->SetITSgeom(GetITSgeom());
453     AliITSgeomSSD  *s0;
454     fDetTypeSim->ResetCalibrationArray();
455     fDetTypeSim->ResetSegmentation();
456  
457     //SSD
458
459     // Get shape info. Do it this way for now.
460     s0 = (AliITSgeomSSD*) GetITSgeom()->GetShape(kSSD);
461     AliITSCalibration *resp0=new AliITSCalibrationSSD("simulated");
462     SetCalibrationModel(GetITSgeom()->GetStartSSD(),resp0);     
463
464     AliITSsegmentationSSD *seg0=new AliITSsegmentationSSD();
465     seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSSD
466                      s0->GetDz()*2.*kconv, // for now.
467                      s0->GetDy()*2.*kconv); // x,z,y full width in microns.
468     //seg0->SetNPads(256,160);// Number of Bins in x and z
469
470     SetSegmentationModel(kSSD,seg0);
471
472     // set digit and raw cluster classes to be used
473     const char *kData0=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSSD()))->DataType();
474     if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigit");
475     else fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigitSSD");
476 //    SetSimulationModel(kSSD,new AliITSsimulationSSD(seg0,resp0));
477 //    iDetType->ReconstructionModel(new AliITSClusterFinderSSD());
478
479
480     //SetResponseModel(kSPD,new AliITSCalibrationSPD());
481     //SetSegmentationModel(kSPD,new AliITSsegmentationSPD());
482     //fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
483
484     //SetResponseModel(kSDD,new AliITSCalibrationSDD());
485     //SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
486     //fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigitSDD");
487
488
489
490     if(fgkNTYPES>3){
491         Warning("SetDefaults",
492                 "Only the four basic detector types are initialised!");
493     }// end if
494     return;
495 }
496 //______________________________________________________________________
497 void AliITSvSSD03::SetDefaultSimulation(){
498     // sets the default simulation.
499     // Inputs:
500     //      none.
501     // Outputs:
502     //      none.
503     // Return:
504     //      none.
505
506   if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
507
508   AliITSsimulation *sim;
509   //  AliITSsegmentation *seg;
510   // AliITSCalibration *res;
511
512   //SPD
513   //if(fDetTypeSim){
514     //sim = fDetTypeSim->GetSimulationModel(kSPD);
515     //if (!sim) {
516       //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
517       //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(nspd);
518       //sim = new AliITSsimulationSPDdubna(seg,res,1);
519       //SetSimulationModel(kSPD,sim);
520     //}else{ // simulation exists, make sure it is set up properly.
521       //sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
522       //sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(nspd));
523       //((AliITSsimulation*)sim)->Init();
524       //        if(sim->GetResponseModel()==0) sim->SetResponseModel(
525       //            (AliITSCalibration*)iDetType->GetResponseModel());
526       //        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
527       //            (AliITSsegmentation*)iDetType->GetSegmentationModel());
528     //} // end if
529   //} // end if !fDetTypeSim
530
531   //SDD
532   //if(fDetTypeSim){
533     //sim = fDetTypeSim->GetSimulationModel(kSDD);
534     //if (!sim) {
535       //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
536       //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(nsdd);
537       //sim = new AliITSsimulationSDD(seg,res);
538       //SetSimulationModel(kSDD,sim);
539     //}else{ // simulation exists, make sure it is set up properly.
540       //sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
541       //sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(nsdd));
542
543       //((AliITSsimulation*)sim)->Init();
544       //        if(sim->GetResponseModel()==0) sim->SetResponseModel(
545       //            (AliITSCalibration*)iDetType->GetResponseModel());
546       //        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
547       //            (AliITSsegmentation*)iDetType->GetSegmentationModel());
548     //} //end if
549   //} // end if !iDetType
550   //SSD
551   if(fDetTypeSim){
552     sim = fDetTypeSim->GetSimulationModel(kSSD);
553     if (!sim) {
554       //  seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
555       // res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
556       sim = new AliITSsimulationSSD(fDetTypeSim);
557       SetSimulationModel(kSSD,sim);
558     }else{ // simulation exists, make sure it is set up properly.
559       sim->SetSegmentationModel(kSSD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
560       sim->SetCalibrationModel(GetITSgeom()->GetStartSSD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSSD()));
561       ((AliITSsimulation*)sim)->Init();
562       //        if(sim->GetResponseModel()==0) sim->SetResponseModel(
563       //            (AliITSCalibration*)iDetType->GetResponseModel());
564       //        if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
565       //            (AliITSsegmentation*)iDetType->GetSegmentationModel());
566     } // end if
567   } // end if !iDetType
568 }
569 */
570 //______________________________________________________________________
571 void AliITSvSSD03::DrawModule() const {
572     ////////////////////////////////////////////////////////////////////////
573     //     Draw a shaded view of the ITS SSD test beam version 1.
574     // Inputs:
575     //    none.
576     // Outputs:
577     //    none.
578     // Return:
579     //    none.
580     ////////////////////////////////////////////////////////////////////////
581
582     gMC->Gsatt("*", "seen", -1);
583     gMC->Gsatt("ALIC","SEEN",0);
584     gMC->Gsatt("ITSV","SEEN",0);
585     gMC->Gsatt("ITSA","SEEN",1);
586     gMC->Gsatt("ITSS","SEEN",1);
587     gMC->Gsatt("IGAR","SEEN",1);
588     gMC->Gsatt("IAIR","SEEN",0);
589     gMC->Gsatt("ITST","SEEN",1);
590     gMC->Gsatt("IFRA","SEEN",1);
591     gMC->Gsatt("IFRS","SEEN",1);
592 }
593 //______________________________________________________________________
594 void AliITSvSSD03::StepManager(){
595     ////////////////////////////////////////////////////////////////////////
596     //    Called for every step in the ITS SSD, then calles the 
597     // AliITShit class  creator with the information to be recoreded about
598     //  that hit.
599     //     The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
600     // printing of information to a file which can be used to create a .det
601     // file read in by the routine CreateGeometry(). If set to 0 or any other
602     // value except 1, the default behavior, then no such file is created nor
603     // it the extra variables and the like used in the printing allocated.
604     // Inputs:
605     //    none.
606     // Outputs:
607     //    none.
608     // Return:
609     //    none.
610     ////////////////////////////////////////////////////////////////////////
611     if(!(this->IsActive())){
612         return;
613     } // end if !Active volume.
614     if(!(gMC->TrackCharge())) return;
615
616     Int_t cpy0,mod,id,status;
617     TLorentzVector position, momentum;
618     static AliITShit hit;// Saves on calls to construtors
619     //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
620     TClonesArray &lhits = *(Hits());
621     //
622     // Track status
623     // Track status
624     status = 0;
625     if(gMC->IsTrackInside())      status +=  1;
626     if(gMC->IsTrackEntering())    status +=  2;
627     if(gMC->IsTrackExiting())     status +=  4;
628     if(gMC->IsTrackOut())         status +=  8;
629     if(gMC->IsTrackDisappeared()) status += 16;
630     if(gMC->IsTrackStop())        status += 32;
631     if(gMC->IsTrackAlive())       status += 64;
632     //
633     // Fill hit structure.
634     id = gMC->CurrentVolID(cpy0);
635     if(id==fIdSens[0]){  // Volume name "ITST"
636         mod=2; // Det, ladder
637     } else return; // end if
638     //
639     //
640     // Fill hit structure.
641     //
642     hit.SetModule(mod);
643     hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
644     gMC->TrackPosition(position);
645     gMC->TrackMomentum(momentum);
646     hit.SetPosition(position);
647     hit.SetTime(gMC->TrackTime());
648     hit.SetMomentum(momentum);
649     hit.SetStatus(status);
650     hit.SetEdep(gMC->Edep());
651     hit.SetShunt(GetIshunt());
652     if(gMC->IsTrackEntering()){
653         hit.SetStartPosition(position);
654         hit.SetStartTime(gMC->TrackTime());
655         hit.SetStartStatus(status);
656         return; // don't save entering hit.
657     } // end if IsEntering
658     // Fill hit structure with this new hit.
659     //Info("StepManager","Calling Copy Constructor");
660     new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
661     // Save old position... for next hit.
662     hit.SetStartPosition(position);
663     hit.SetStartTime(gMC->TrackTime());
664     hit.SetStartStatus(status);
665     return;
666 }
667