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