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