Event type and timestamp from the raw event header is now stored in the ESD (M.Ivanov)
[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
2ef7007f 19#include <TGeometry.h>
20#include <TNode.h>
21#include <TLorentzVector.h>
22#include <TClonesArray.h>
23#include <TBRIK.h>
24
25#include "AliRun.h"
26#include "AliMagF.h"
27#include "AliITSGeant3Geometry.h"
28#include "AliTrackReference.h"
29#include "AliITShit.h"
30#include "AliITS.h"
31#include "AliITSvSSD03.h"
32#include "AliITSgeom.h"
33#include "AliITSgeomSSD.h"
7d62fb64 34#include "AliITSDetTypeSim.h"
fcf95fc7 35#include "AliITSCalibrationSSD.h"
2ef7007f 36#include "AliITSsegmentationSSD.h"
2ef7007f 37#include "AliITSsimulationSSD.h"
38#include "AliMC.h"
39
7d62fb64 40
2ef7007f 41///////////////////////////////////////////////////////////////////////
42// Step manager and
43// geometry class
44// for the ITS
45// SSD test beam
46// geometry of June 2003
47//
48///////////////////////////////////////////////////////////////////////
49ClassImp(AliITSvSSD03)
50
51//______________________________________________________________________
52AliITSvSSD03::AliITSvSSD03() {
53 ////////////////////////////////////////////////////////////////////////
54 // Standard default constructor for the ITS SSD test beam 2003 version 1.
55 // Inputs:
56 // none.
57 // Outputs:
58 // none.
59 // Return:
60 // A default created class.
61 ////////////////////////////////////////////////////////////////////////
62 Int_t i;
63
64 fIdN = 0;
65 fIdName = 0;
66 fIdSens = 0;
67 fEuclidOut = kFALSE; // Don't write Euclide file
68 fGeomDetOut = kFALSE; // Don't write .det file
69 fGeomDetIn = kFALSE; // Don't Read .det file
70 fMajorVersion = IsVersion();
71 fMinorVersion = -1;
72 fGeomNumber = 2003; // default value
73 for(i=0;i<60;i++) fRead[i] = '\0';
74 for(i=0;i<60;i++) fWrite[i] = '\0';
75 for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
76}
77//______________________________________________________________________
78AliITSvSSD03::AliITSvSSD03(const char *title,Int_t gn) : AliITS("ITS", title){
79 ////////////////////////////////////////////////////////////////////////
80 // Standard constructor for the ITS SSD testbeam 2003 version 1.
81 // Inputs:
82 // const char *title title for this ITS geometry.
83 // Int_t gn Geometry version number (year) default 2003.
84 // Outputs:
85 // none.
86 // Return:
87 // A standard created class.
88 ////////////////////////////////////////////////////////////////////////
89 Int_t i;
90
91 fGeomNumber = gn;
92
93 fIdN = 1;
94 fIdName = new TString[fIdN];
95 fIdName[0] = "ITST";
96 fIdSens = new Int_t[fIdN];
97 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
98
99 fMajorVersion = IsVersion();
100 fMinorVersion = 2;
101 fEuclidOut = kFALSE; // Don't write Euclide file
102 fGeomDetOut = kFALSE; // Don't write .det file
103 fGeomDetIn = kFALSE; // Don't Read .det file
104
105 SetThicknessDet1();
106 SetThicknessDet2();
107 SetThicknessChip1();
108 SetThicknessChip2();
109
110 fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vSSD03.euc";
111 strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vSSD03.det",60);
112 strncpy(fRead,fEuclidGeomDet,60);
113 strncpy(fWrite,fEuclidGeomDet,60);
114}
115//______________________________________________________________________
116AliITSvSSD03::AliITSvSSD03(const AliITSvSSD03 &source) : AliITS(source){
117 ////////////////////////////////////////////////////////////////////////
118 // Copy Constructor for ITS SSD test beam 2003 version 1.
119 // This class is not to be copied. Function only dummy.
120 // Inputs:
121 // const AliITSvSSD03 &source The class to be copied
122 // Outputs:
123 // none.
124 // Return:
125 // A warning message.
126 ////////////////////////////////////////////////////////////////////////
127 if(&source == this) return;
128 Warning("Copy Constructor","Not allowed to copy AliITSvSSD03");
129 return;
130}
131//______________________________________________________________________
132AliITSvSSD03& AliITSvSSD03::operator=(const AliITSvSSD03 &source){
133 ////////////////////////////////////////////////////////////////////////
134 // Assignment operator for the ITS SSD test beam 2003 version 1.
135 // This class is not to be copied. Function only dummy.
136 // Inputs:
137 // const AliITSvSSD03 &source The class to be copied
138 // Outputs:
139 // none.
140 // Return:
141 // A Warning message
142 ////////////////////////////////////////////////////////////////////////
143 if(&source == this) return *this;
144 Warning("= operator","Not allowed to copy AliITSvSSD03");
145 return *this;
146}
147//______________________________________________________________________
148AliITSvSSD03::~AliITSvSSD03() {
149 ////////////////////////////////////////////////////////////////////////
150 // Standard destructor for the ITS SSD test beam 2003 version 1.
151 // Inputs:
152 // none.
153 // Outputs:
154 // none.
155 // Return:
156 // none.
157 ////////////////////////////////////////////////////////////////////////
158}
159//______________________________________________________________________
160void AliITSvSSD03::BuildGeometry(){
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 //
167 // Inputs:
168 // none.
169 // Outputs:
170 // none.
171 // Return:
172 // none.
173 ////////////////////////////////////////////////////////////////////////
174 // Get the top alice volume.
175
176 switch (fGeomNumber){
177 case 2003:
178 BuildGeometry2003();
179 break;
180 default:
181 BuildGeometry2003();
182 break;
183 } // end switch
184}
185//______________________________________________________________________
186void AliITSvSSD03::BuildGeometry2003(){
187 ////////////////////////////////////////////////////////////////////////
188 // Geometry builder for the ITS SSD test beam 2003 version 1.
189 // ALIC ALICE Mother Volume
190 // |- ITSV ITS Mother Volume
191 // |- ITST Detector under Test
192 // Inputs:
193 // none.
194 // Outputs:
195 // none.
196 // Return:
197 // none.
198 ////////////////////////////////////////////////////////////////////////
199
200 // Get the top alice volume.
201 TNode *aALIC = gAlice->GetGeometry()->GetNode("alice");
202 aALIC->cd();
203
204 // Define ITS Mother Volume
205 Float_t data[3];
206 Float_t ddettest=300.0E-4;
207 //Float_t yposition= 0.0;
208 TRotMatrix *r0 = new TRotMatrix("ITSidrotm0","ITSidrotm0",
209 90.0,0,0.0,0,90.0,270.0);
210
211 // Mother volume (beam along z)
212 data[0] = 10.0; // in centimeter
213 data[1] = 50.0;
214 data[2] = 100.0;
215 TBRIK *iITSVshape = new TBRIK("ITSVshape",
216 "ITS Logical Mother Volume","Air",
217 data[0],data[1],data[2]);
218 TNode *iITSV = new TNode("ITSV","ITS Mother Volume",iITSVshape,
219 0.0,0.0,0.0,0,0);
220 iITSV->cd(); // set ourselve into ITSV subvolume of aALIC
221
222 // SSD part of telescope (Note. strips in local xz plan)
223 data[0] = 3.5; // half-length of the SSD module
224 data[1] = 0.5*ddettest; // half-width of the SSD module
225 data[2] = 2.0; // half-heigth of the SSD module
226 TBRIK *iITSTshape = new TBRIK("ITSTshape","SSD sensitive volume","Si",
227 data[0],data[1],data[2]);
228 TNode *iITST = new TNode("ITST","SSD sensitive volume",iITSTshape,
229 0.0,0.0,0.0,r0,0);
230
231 aALIC->cd();
232 iITST->SetLineColor(kYellow);
233 fNodes->Add(iITST);
234}
235//______________________________________________________________________
236void AliITSvSSD03::CreateGeometry(){
237 ////////////////////////////////////////////////////////////////////////
238 // Geometry builder for the ITS SSD test beam 2003 version 1.
239 // ALIC ALICE Mother Volume
240 // |- ITSV ITS Mother Volume
241 // |- IDET Detector under Test
242 // Inputs:
243 // none.
244 // Outputs:
245 // none.
246 // Return:
247 // none.
248 ////////////////////////////////////////////////////////////////////////
249
250 switch (fGeomNumber){
251 case 2003:
252 CreateGeometry2003();
253 break;
254 default:
255 CreateGeometry2003();
256 break;
257 } // end switch
258}
259//______________________________________________________________________
260void AliITSvSSD03::CreateGeometry2003(){
261 ////////////////////////////////////////////////////////////////////////
262 //
263 // ALIC ALICE Mother Volume
264 // |- ITSV Beamtest Mother Volume
265 // |
266 // |- ITSA Aluminum cover for scintillator
267 // | |-ITSS first Trieste trigger plastic scintillator
268 // |- ITSA Aluminum cover for scintillator
269 // | |-ITSS second Trieste's trigger plastic scintillator
270 // |
271 // |- IGAR Black box around ITST
272 // | |-IAIR Air inside the black box
273 // | |-ITST Detector under Test
274 // |
275 // |- IFRA Aluminum cover for scintillator
276 // | |-IFRS French plastic scintillator
277 // |
278 // |- ITSA Aluminum cover for scintillator
279 // | |-ITSS third Trieste's plastic scintillator
280 // Inputs:
281 // none.
282 // Outputs:
283 // none.
284 // Return:
285 // none.
286 ////////////////////////////////////////////////////////////////////////
287
288 Float_t data[49];
289 // Define media off-set
290 Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
291 Int_t idrotm[4]; // Array of rotation matrix indexes
292 //Float_t yposition= 0.0;
293
294 if(gMC==0) return;
295 // Define Rotation-reflextion Matrixes needed
296 // 0 is the unit matrix
297
298 // Beamtest mother volume (air) positioned in ALIC mother volume
299 data[0] = 500.0;
300 data[1] = 500.0;
301 data[2] = 1000.0;
302 gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
303 gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
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//______________________________________________________________________
376void 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
023ae34b 384 // the CreateMaterials routine defined in AliITSv?. Should the function
2ef7007f 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//______________________________________________________________________
407void 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
023ae34b 415 // the CreateMaterials routine defined in AliITSv?. Should the function
2ef7007f 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//______________________________________________________________________
482void AliITSvSSD03::InitAliITSgeom(){
483 // Based on the geometry tree defined in Geant 3.21, this
484 // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
485 // sturture.
486 // Inputs:
487 // none.
488 // Outputs:
489 // none.
490 // Return:
491 // none.
492
493 //const Int_t kltypess = 2; // was 2 for SPD beamtest
494 const Int_t kltypess = 1;
495 //const Int_t knlayers = 5; // was 5 for the SPD telescope
496 const Int_t knlayers = 1; // for one SSD module
497 const Int_t kndeep = 5;
498
499 Int_t itsGeomTreeNames[kltypess][kndeep],lnam[20],lnum[20];
500
501 Int_t nlad[knlayers],ndet[knlayers];
502 Double_t t[3],r[10];
503 Float_t par[20],att[20];
504 Int_t npar,natt,idshape,imat,imed;
505 AliITSGeant3Geometry *ig=0;
506 Int_t mod=0,typ=0,lay=0,lad=0,det=0,cpy=0,i=0,j=0,k=0;
507
508 if(gMC==0) {// No MonteCarlo to init. Default set fITSgeom by hand
7d62fb64 509 if(GetITSgeom()!=0) SetITSgeom(0x0);
2ef7007f 510
511 //nlad[0]=1;nlad[1]=1;nlad[2]=1;nlad[3]=1;nlad[4]=1;
512 //ndet[0]=1;ndet[1]=1;ndet[2]=1;ndet[3]=1;ndet[4]=1;
513 nlad[0]=1;
514 ndet[0]=1;
515
7d62fb64 516 AliITSgeom* geom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
517 SetITSgeom(geom);
2ef7007f 518
519 r[0] = 1.0; r[1] = 0.0; r[2] = 0.0;
520 r[3] = 0.0; r[4] = 0.0; r[5] = 1.0;
521 r[6] = 0.0; r[7] = -1.0; r[8] = 0.0; r[9] = 1.0; // not Unit.
522
523 Double_t tt[1][3]={{0.0,0.0,0.0}};
524
525 // for(mod=0;mod<5;mod++){
526 for(mod=0;mod<1;mod++){
527 lay = 1;
528 lad = 1;
529 det = mod+1;
530 t[0] = tt[mod][0]; t[1] = tt[mod][1]; t[2] = tt[mod][2];
023ae34b 531 GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSSD,t,r);
2ef7007f 532
533 npar=3;par[0]=3.5;par[1]=0.5*300.0E-4;par[2]=2.0;
534
7d62fb64 535 GetITSgeom()->ReSetShape(kSSD,new AliITSgeomSSD275and75(npar,par));
2ef7007f 536 } // end for det
537 return;
538 } // end if gMC==0
539
540 if(strcmp(gMC->GetName(),"TGeant3")) {
541 Error("InitAliITSgeom",
542 "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls");
543 return;
544 } // end if
545
546 cout << "Reading Geometry transformation directly from Geant 3." << endl;
547 ig = new AliITSGeant3Geometry();
548 Char_t names[kltypess][kndeep][4];
549 Int_t itsGeomTreeCopys[kltypess][kndeep];
550 const char *namesA[kltypess][kndeep] =
551 {{"ALIC","ITSV","IGAR","IAIR","ITST"}}; // Test SSD
552 Int_t itsGeomTreeCopysA[kltypess][kndeep]= {{1,1,1,1,1}};// TestSSD
553 for(i=0;i<kltypess;i++)for(j=0;j<kndeep;j++){
554 for(k=0;k<4;k++) names[i][j][k] = namesA[i][j][k];
555 itsGeomTreeCopys[i][j] = itsGeomTreeCopysA[i][j];
556 } // end for i,j
557
558 cout << "Reading Geometry informaton from Geant3 common blocks" << endl;
559 for(i=0;i<20;i++) lnam[i] = lnum[i] = 0;
560 for(i=0;i<kltypess;i++)for(j=0;j<kndeep;j++)
561 strncpy((char*) &itsGeomTreeNames[i][j],names[i][j],4);
562 // itsGeomTreeNames[i][j] = ig->StringToInt(names[i][j]);
563 mod = 1; // was 5
7d62fb64 564 if(GetITSgeom()!=0) SetITSgeom(0x0);
2ef7007f 565
566 nlad[0]=1;
567 ndet[0]=1;
7d62fb64 568 AliITSgeom* geom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
569 SetITSgeom(geom);
2ef7007f 570 for(typ=1;typ<=kltypess;typ++){
571 for(j=0;j<kndeep;j++) lnam[j] = itsGeomTreeNames[typ-1][j];
572 for(j=0;j<kndeep;j++) lnum[j] = itsGeomTreeCopys[typ-1][j];
573 lad = 1;
574 det = 1;
575 for(cpy=1;cpy<=itsGeomTreeCopys[typ-1][2];cpy++){
576 lnum[2] = cpy;
577 lay = cpy;
578 if(cpy>2 && typ==1) lay = cpy +1;
579 if(typ==2) lay = 3;
580 mod = lay-1;
581 ig->GetGeometry(kndeep,lnam,lnum,t,r,idshape,npar,natt,par,att,
582 imat,imed);
023ae34b 583 GetITSgeom()->CreateMatrix(mod,lay,lad,det,kSSD,t,r);
2ef7007f 584 //cout<<mod<<" "<<lay<<" "<<lad<<" "<<det<<endl;
585 //cout<<npar<<" "<<par[0]<<" "<<par[1]<<" "<<par[2]<<endl;
7d62fb64 586 if(!(GetITSgeom()->IsShapeDefined((Int_t)kSSD)))
587 GetITSgeom()->ReSetShape(kSSD, new AliITSgeomSSD275and75(npar,par));
2ef7007f 588 } // end for cpy
589 } // end for typ
590 return;
591}
592//______________________________________________________________________
593void AliITSvSSD03::Init(){
594 ////////////////////////////////////////////////////////////////////////
595 // Initialise the ITS after it has been created.
596 // Inputs:
597 // none.
598 // Outputs:
599 // none.
600 // Return:
601 // none.
602 ////////////////////////////////////////////////////////////////////////
603 Int_t i;
604
605 cout << endl;
606 for(i=0;i<26;i++) cout << "*";
607 cout << " ITSvSSD03" << fMinorVersion << "_Init ";
608 for(i=0;i<25;i++) cout << "*";cout << endl;
609//
610 if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
611 if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
7d62fb64 612 if(GetITSgeom()!=0) SetITSgeom(0x0);
613 AliITSgeom* geom = new AliITSgeom();
614 SetITSgeom(geom);
615 if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
2ef7007f 616 if(!fGeomDetIn) this->InitAliITSgeom();
7d62fb64 617 if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
2ef7007f 618 AliITS::Init();
619//
620 for(i=0;i<72;i++) cout << "*";
621 cout << endl;
622 if(gMC) fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
623 else fIDMother = 0;
624}
625//______________________________________________________________________
626void AliITSvSSD03::SetDefaults(){
8ba39da9 627 // sets the default segmentation, rerponse, digit and raw cluster classes
2ef7007f 628 // Inputs:
629 // none.
630 // Outputs:
631 // none.
632 // Return:
633 // none.
634 const Float_t kconv = 1.0e+04; // convert cm to microns
635
636 Info("SetDefaults","Setting up only SSD detector");
637
7d62fb64 638 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
639 fDetTypeSim->SetITSgeom(GetITSgeom());
2ef7007f 640 AliITSgeomSSD *s0;
fcf95fc7 641 fDetTypeSim->ResetCalibrationArray();
7d62fb64 642 fDetTypeSim->ResetSegmentation();
643
2ef7007f 644 //SSD
2ef7007f 645
646 // Get shape info. Do it this way for now.
7d62fb64 647 s0 = (AliITSgeomSSD*) GetITSgeom()->GetShape(kSSD);
fcf95fc7 648 AliITSCalibration *resp0=new AliITSCalibrationSSD("simulated");
649 SetCalibrationModel(GetITSgeom()->GetStartSSD(),resp0);
7d62fb64 650
023ae34b 651 AliITSsegmentationSSD *seg0=new AliITSsegmentationSSD();
2ef7007f 652 seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSSD
653 s0->GetDz()*2.*kconv, // for now.
654 s0->GetDy()*2.*kconv); // x,z,y full width in microns.
655 //seg0->SetNPads(256,160);// Number of Bins in x and z
656
657 SetSegmentationModel(kSSD,seg0);
658
659 // set digit and raw cluster classes to be used
fcf95fc7 660 const char *kData0=(fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSSD()))->DataType();
7d62fb64 661 if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigit");
662 else fDetTypeSim->SetDigitClassName(kSSD,"AliITSdigitSSD");
2ef7007f 663// SetSimulationModel(kSSD,new AliITSsimulationSSD(seg0,resp0));
664// iDetType->ReconstructionModel(new AliITSClusterFinderSSD());
665
7d62fb64 666/*
fcf95fc7 667 SetResponseModel(kSPD,new AliITSCalibrationSPD());
2ef7007f 668 SetSegmentationModel(kSPD,new AliITSsegmentationSPD());
7d62fb64 669 fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
2ef7007f 670
fcf95fc7 671 SetResponseModel(kSDD,new AliITSCalibrationSDD());
2ef7007f 672 SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
7d62fb64 673 fDetTypeSim->SetDigitClassName(kSDD,"AliITSdigitSDD");
674*/
2ef7007f 675
676
7d62fb64 677 if(fgkNTYPES>3){
2ef7007f 678 Warning("SetDefaults",
679 "Only the four basic detector types are initialised!");
680 }// end if
681 return;
682}
683//______________________________________________________________________
684void AliITSvSSD03::SetDefaultSimulation(){
685 // sets the default simulation.
686 // Inputs:
687 // none.
688 // Outputs:
689 // none.
690 // Return:
691 // none.
692
7d62fb64 693 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
694
695 AliITSsimulation *sim;
8ba39da9 696 // AliITSsegmentation *seg;
fcf95fc7 697 // AliITSCalibration *res;
7d62fb64 698 /*
699 //SPD
700 if(fDetTypeSim){
701 sim = fDetTypeSim->GetSimulationModel(kSPD);
702 if (!sim) {
703 seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
fcf95fc7 704 res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(nspd);
7d62fb64 705 sim = new AliITSsimulationSPDdubna(seg,res,1);
706 SetSimulationModel(kSPD,sim);
707 }else{ // simulation exists, make sure it is set up properly.
708 sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
fcf95fc7 709 sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(nspd));
7d62fb64 710 ((AliITSsimulation*)sim)->Init();
711 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
fcf95fc7 712 // (AliITSCalibration*)iDetType->GetResponseModel());
7d62fb64 713 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
714 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
715 } // end if
716 } // end if !fDetTypeSim
717
718 //SDD
719 if(fDetTypeSim){
720 sim = fDetTypeSim->GetSimulationModel(kSDD);
721 if (!sim) {
722 seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
fcf95fc7 723 res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(nsdd);
7d62fb64 724 sim = new AliITSsimulationSDD(seg,res);
725 SetSimulationModel(kSDD,sim);
726 }else{ // simulation exists, make sure it is set up properly.
727 sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
fcf95fc7 728 sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(nsdd));
7d62fb64 729
730 ((AliITSsimulation*)sim)->Init();
731 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
fcf95fc7 732 // (AliITSCalibration*)iDetType->GetResponseModel());
7d62fb64 733 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
734 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
2ef7007f 735 } //end if
7d62fb64 736 } // end if !iDetType
737 */
738 //SSD
739 if(fDetTypeSim){
740 sim = fDetTypeSim->GetSimulationModel(kSSD);
741 if (!sim) {
8ba39da9 742 // seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
fcf95fc7 743 // res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
8ba39da9 744 sim = new AliITSsimulationSSD(fDetTypeSim);
7d62fb64 745 SetSimulationModel(kSSD,sim);
746 }else{ // simulation exists, make sure it is set up properly.
8ba39da9 747 sim->SetSegmentationModel(kSSD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
fcf95fc7 748 sim->SetCalibrationModel(GetITSgeom()->GetStartSSD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSSD()));
7d62fb64 749 ((AliITSsimulation*)sim)->Init();
750 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
fcf95fc7 751 // (AliITSCalibration*)iDetType->GetResponseModel());
7d62fb64 752 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
753 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
754 } // end if
755 } // end if !iDetType
2ef7007f 756}
757
758//______________________________________________________________________
759void AliITSvSSD03::DrawModule() const {
760 ////////////////////////////////////////////////////////////////////////
761 // Draw a shaded view of the ITS SSD test beam version 1.
762 // Inputs:
763 // none.
764 // Outputs:
765 // none.
766 // Return:
767 // none.
768 ////////////////////////////////////////////////////////////////////////
769
770 gMC->Gsatt("*", "seen", -1);
771 gMC->Gsatt("ALIC","SEEN",0);
772 gMC->Gsatt("ITSV","SEEN",0);
773 gMC->Gsatt("ITSA","SEEN",1);
774 gMC->Gsatt("ITSS","SEEN",1);
775 gMC->Gsatt("IGAR","SEEN",1);
776 gMC->Gsatt("IAIR","SEEN",0);
777 gMC->Gsatt("ITST","SEEN",1);
778 gMC->Gsatt("IFRA","SEEN",1);
779 gMC->Gsatt("IFRS","SEEN",1);
780}
781//______________________________________________________________________
782void AliITSvSSD03::StepManager(){
783 ////////////////////////////////////////////////////////////////////////
784 // Called for every step in the ITS SSD, then calles the
785 // AliITShit class creator with the information to be recoreded about
786 // that hit.
787 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
788 // printing of information to a file which can be used to create a .det
789 // file read in by the routine CreateGeometry(). If set to 0 or any other
790 // value except 1, the default behavior, then no such file is created nor
791 // it the extra variables and the like used in the printing allocated.
792 // Inputs:
793 // none.
794 // Outputs:
795 // none.
796 // Return:
797 // none.
798 ////////////////////////////////////////////////////////////////////////
799 Int_t copy, id;
800 TLorentzVector position, momentum;
801 static TLorentzVector position0;
802 static Int_t stat0=0;
803
804 if((id=gMC->CurrentVolID(copy) == fIDMother)&&
805 (gMC->IsTrackEntering()||gMC->IsTrackExiting())){
806 copy = fTrackReferences->GetEntriesFast();
807 TClonesArray &lTR = *fTrackReferences;
808 // Fill TrackReference structure with this new TrackReference.
809 new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
810 } // if Outer ITS mother Volume
811
812 if(!(this->IsActive())){
813 return;
814 } // end if !Active volume.
815
816
817 Int_t vol[5];
818 TClonesArray &lhits = *fHits;
819 //
820 // Track status
821 vol[3] = 0;
822 vol[4] = 0;
823 if(gMC->IsTrackInside()) vol[3] += 1;
824 if(gMC->IsTrackEntering()) vol[3] += 2;
825 if(gMC->IsTrackExiting()) vol[3] += 4;
826 if(gMC->IsTrackOut()) vol[3] += 8;
827 if(gMC->IsTrackDisappeared()) vol[3] += 16;
828 if(gMC->IsTrackStop()) vol[3] += 32;
829 if(gMC->IsTrackAlive()) vol[3] += 64;
830 //
831 // Fill hit structure.
832 if(!(gMC->TrackCharge())) return;
833 id = gMC->CurrentVolID(copy);
834 if(id==fIdSens[0]){ // Volume name "ITST"
835 vol[2] = vol[1] = vol[0] = 1; // Det, ladder
836 } else return; // end if
837 //
838 gMC->TrackPosition(position);
839 gMC->TrackMomentum(momentum);
840 vol[4] = stat0;
841 if(gMC->IsTrackEntering()){
842 position0 = position;
843 stat0 = vol[3];
844 return;
845 } // end if IsEntering
846
847 // Fill hit structure with this new hit only for non-entrerance hits.
848 else new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
849 gMC->Edep(),gMC->TrackTime(),position,
850 position0,momentum);
851 //cout<<gMC->Edep()<<endl;
852 //
853 position0 = position;
854 stat0 = vol[3];
855
856 return;
857}
858