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