1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include <Riostream.h>
20 #include <TGeometry.h>
22 #include <TLorentzVector.h>
23 #include <TClonesArray.h>
28 #include "AliITSGeant3Geometry.h"
29 #include "AliTrackReference.h"
30 #include "AliITShit.h"
32 #include "AliITSvSPD02.h"
33 #include "AliITSgeom.h"
34 #include "AliITSgeomSPD.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"
48 ///////////////////////////////////////////////////////////////////////
53 // geometry of summer 2002
55 ///////////////////////////////////////////////////////////////////////
56 ClassImp(AliITSvSPD02)
58 //______________________________________________________________________
59 AliITSvSPD02::AliITSvSPD02() {
60 ////////////////////////////////////////////////////////////////////////
61 // Standard default constructor for the ITS SPD test beam 2002 version 1.
67 // A default created class.
68 ////////////////////////////////////////////////////////////////////////
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();
79 fGeomNumber = 2002; // 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';
84 //______________________________________________________________________
85 AliITSvSPD02::AliITSvSPD02(const char *title,Int_t gn) : AliITS("ITS", title){
86 ////////////////////////////////////////////////////////////////////////
87 // Standard constructor for the ITS SPD testbeam 2002 version 1.
89 // const char *title title for this ITS geometry.
90 // Int_t gn Geometry version number (year) default 2002.
94 // A standard created class.
95 ////////////////////////////////////////////////////////////////////////
100 fIdName = new TString[fIdN];
103 fIdSens = new Int_t[fIdN];
104 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
105 fMajorVersion = IsVersion();
107 fEuclidOut = kFALSE; // Don't write Euclide file
108 fGeomDetOut = kFALSE; // Don't write .det file
109 fGeomDetIn = kFALSE; // Don't Read .det file
115 fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vSPD022.euc";
116 strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vSPD022.det",60);
117 strncpy(fRead,fEuclidGeomDet,60);
118 strncpy(fWrite,fEuclidGeomDet,60);
120 //______________________________________________________________________
121 AliITSvSPD02::AliITSvSPD02(const AliITSvSPD02 &source) : AliITS(source){
122 ////////////////////////////////////////////////////////////////////////
123 // Copy Constructor for ITS SPD test beam 2002 version 1.
124 // This class is not to be copied. Function only dummy.
126 // const AliITSvSPD02 &source The class to be copied
130 // A warning message.
131 ////////////////////////////////////////////////////////////////////////
132 if(&source == this) return;
133 Warning("Copy Constructor","Not allowed to copy AliITSvSPD02");
136 //______________________________________________________________________
137 AliITSvSPD02& AliITSvSPD02::operator=(const AliITSvSPD02 &source){
138 ////////////////////////////////////////////////////////////////////////
139 // Assignment operator for the ITS SPD test beam 2002 version 1.
140 // This class is not to be copied. Function only dummy.
142 // const AliITSvSPD02 &source The class to be copied
147 ////////////////////////////////////////////////////////////////////////
148 if(&source == this) return *this;
149 Warning("= operator","Not allowed to copy AliITSvSPD02");
152 //______________________________________________________________________
153 AliITSvSPD02::~AliITSvSPD02() {
154 ////////////////////////////////////////////////////////////////////////
155 // Standard destructor for the ITS SPD test beam 2002 version 1.
162 ////////////////////////////////////////////////////////////////////////
164 //______________________________________________________________________
165 void AliITSvSPD02::BuildGeometry(){
166 ////////////////////////////////////////////////////////////////////////
167 // Geometry builder for the ITS SPD test beam 2002 version 1.
168 // ALIC ALICE Mother Volume
169 // |- ITSV ITS Mother Volume
170 // |- IDET Detector under Test
171 // | |- ITS0 SPD Si Chip
172 // | | |- ITST SPD Sensitivve Volume
173 // | |- IPC0 *5 Readout chip
174 // |- ITEL *4 SPD Telescope
175 // |- IMB0 SPD Si Chip
176 // | |- IMBS SPD Sensitive volume
177 // |- ICMB Chip MiniBus.
184 ////////////////////////////////////////////////////////////////////////
185 // Get the top alice volume.
187 switch (fGeomNumber){
196 //______________________________________________________________________
197 void AliITSvSPD02::BuildGeometry2002(){
198 ////////////////////////////////////////////////////////////////////////
199 // Geometry builder for the ITS SPD test beam 2002 version 1.
200 // ALIC ALICE Mother Volume
201 // |- ITSV ITS Mother Volume
202 // |- IDET Detector under Test
203 // | |- ITS0 SPD Si Chip
204 // | | |- ITST SPD Sensitivve Volume
205 // | |- IPC0 *5 Readout chip
206 // |- ITEL *4 SPD Telescope
207 // |- IMB0 SPD Si Chip
208 // | |- IMBS SPD Sensitive volume
209 // |- ICMB Chip MiniBus.
216 ////////////////////////////////////////////////////////////////////////
217 // Get the top alice volume.
218 TNode *aALIC = gAlice->GetGeometry()->GetNode("alice");
221 // Define ITS Mother Volume
223 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
224 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
225 //Float_t yposition= 0.0;
226 TRotMatrix *r0 = new TRotMatrix("ITSidrotm0","ITSidrotm0",
227 90.0,0,0.0,0,90.0,270.0);
231 TBRIK *iITSVshape = new TBRIK("ITSVshape",
232 "ITS Logical Mother Volume","Air",
233 data[0],data[1],data[2]);
234 TNode *iITSV = new TNode("ITSV","ITS Mother Volume",iITSVshape,
236 iITSV->cd(); // set ourselve into ITSV subvolume of aALIC
238 // SPD part of telescope (MiniBuS)
240 data[1] = 0.5*ddettelescope;
242 TBRIK *iIMB0shape = new TBRIK("IMB0shape","SPD wafer","Si",
243 data[0],data[1],data[2]);
244 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
245 data[0] = detMiniBusX = 0.64;
246 data[1] = detMiniBusY = 0.5*ddettelescope;
247 data[2] = detMiniBusZ = 3.48;
248 TBRIK *iIMBSshape = new TBRIK("IMBSshape","SPD Sensitive volume","Si",
249 data[0],data[1],data[2]);
250 Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
251 data[0] = chipMiniBusX = 0.793;
252 data[1] = chipMiniBusY = 0.5*dchipMiniBus;
253 data[2] = chipMiniBusZ = 0.68;
254 TBRIK *iICMBshape = new TBRIK("ICMBshape","chip Minibus","Si",
255 data[0],data[1],data[2]);
256 data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
257 data[1] = detMiniBusY+chipMiniBusY;
258 data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
259 TBRIK *iITELshape = new TBRIK("ITELshape","ITELshape","Air",
260 data[0],data[1],data[2]);
263 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
267 TBRIK *iITS0shape = new TBRIK("ITS0shape","SPD wafer","Si",
268 data[0],data[1],data[2]); // contains detector
269 data[0] = spdX = 0.64;
270 data[1] = spdY = ddettest;
271 data[2] = spdZ = 3.48;
272 TBRIK *iITSTshape = new TBRIK("ITSTshape","SPD sensitive volume","Si",
273 data[0],data[1],data[2]);
274 // ITS0 with no translation and unit rotation matrix.
275 data[0] = spdchipX = 0.793;
276 data[1] = spdchipY = dchiptest;
277 data[2] = spdchipZ = 0.68;
278 TBRIK *iIPC0shape = new TBRIK("IPC0shape","Readout Chips","Si",
279 data[0],data[1],data[2]); // chip under test
280 data[0] = TMath::Max(spdchipX,spdX);
281 data[1] = spdY+spdchipY;
282 data[2] = TMath::Max(spdchipZ,spdZ);
283 TBRIK *iIDETshape = new TBRIK("IDETshape","Detector Under Test","Air",
284 data[0],data[1],data[2]);
285 // Place volumes in geometry
287 char name[20],title[50];
288 Double_t px=0.0,py=0.0,pz[4]={-38.0,0.0,0.0,0.0};
290 pz[2] = pz[1]+38.0+spdY+spdchipY+34.5;
292 TNode *iITEL[4],*iICMB[4],*iIMB0[4],*iIMBS[4];
293 TNode *iIDET = new TNode("IDET","Detector Under Test",iIDETshape,
294 0.0,0.0,pz[1]+38.0,r0,0);
296 TNode *iITS0 = new TNode("ITS0","SPD Chip",iITS0shape,
297 0.0,iIDETshape->GetDy()-spdY,0.0,0,0);
299 for(i=0;i<5;i++) { //place readout chips on the back of SPD chip under test
300 sprintf(name,"IPC0%d",i);
301 sprintf(title,"Readout chip #%d",i+1);
303 iIPC0[i] = new TNode(name,title,iIPC0shape,
304 0.0,spdchipY-iIDETshape->GetDy(),
305 j*2.0*spdchipZ+j*0.25*(spdZ-5.*spdchipZ),0,0);
308 TNode *iITST = new TNode("ITST","SPD sensitive volume",iITSTshape,
310 for(Int_t i=0;i<4;i++){
312 sprintf(name,"ITEL%d",i);
313 sprintf(title,"Test beam telescope element #%d",i+1);
314 iITEL[i] = new TNode(name,title,iITELshape,px,py,pz[i],r0,0);
316 iICMB[i] = new TNode("ICMB","Chip MiniBus",iICMBshape,
317 0.0,-iITELshape->GetDy()+detMiniBusY,0.0,0,0);
318 iIMB0[i] = new TNode("IMB0","Chip MiniBus",iIMB0shape,
319 0.0, iITELshape->GetDy()-detMiniBusY,0.0,0,0);
321 iIMBS[i] = new TNode("IMBS","IMBS",iIMBSshape,0.0,0.0,0.0,0,0);
322 // place IMBS inside IMB0 with no translation and unit rotation matrix.
325 iITST->SetLineColor(kYellow);
328 iIMBS[i]->SetLineColor(kGreen);
329 fNodes->Add(iIMBS[i]);
332 //______________________________________________________________________
333 void AliITSvSPD02::CreateGeometry(){
334 ////////////////////////////////////////////////////////////////////////
335 // This routine defines and Creates the geometry for version 1 of the ITS.
336 // ALIC ALICE Mother Volume
337 // |- ITSV ITS Mother Volume
338 // |- IDET Detector under Test
339 // | |- ITS0 SPD Si Chip
340 // | | |- ITST SPD Sensitivve Volume
341 // | |- IPC0 *5 Readout chip
342 // |- ITEL *4 SPD Telescope
343 // |- IMB0 SPD Si Chip
344 // | |- IMBS SPD Sensitive volume
345 // |- ICMB Chip MiniBus.
352 ////////////////////////////////////////////////////////////////////////
354 switch (fGeomNumber){
356 CreateGeometry2002();
359 CreateGeometry2002();
363 //______________________________________________________________________
364 void AliITSvSPD02::CreateGeometry2002(){
365 ////////////////////////////////////////////////////////////////////////
366 // This routine defines and Creates the geometry for version 1 of the ITS.
367 // ALIC ALICE Mother Volume
368 // |- ITSV ITS Mother Volume
369 // |- IDET Detector under Test
370 // | |- ITS0 SPD Si Chip
371 // | | |- ITST SPD Sensitivve Volume
372 // | |- IPC0 *5 Readout chip
373 // |- ITEL *4 SPD Telescope
374 // |- IMB0 SPD Si Chip
375 // | |- IMBS SPD Sensitive volume
376 // |- ICMB Chip MiniBus.
383 ////////////////////////////////////////////////////////////////////////
385 // Define media off-set
386 Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
387 Int_t idrotm[4]; // Array of rotation matrix indexes
388 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
389 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
390 Float_t yposition= 0.0;
393 // Define Rotation-reflextion Matrixes needed
394 // 0 is the unit matrix
395 AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
399 gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
400 gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
402 //cout << "idtmed[0]=" << idtmed[0]<<endl;
403 //cout << "idtmed[1]=" << idtmed[1]<<endl;
404 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
405 // SPD part of telescope (MiniBuS)
406 data[0] = detMiniBusX = 0.705;
407 data[1] = detMiniBusY = 0.5*ddettelescope;
408 data[2] = detMiniBusZ = 3.536;
409 gMC->Gsvolu("IMB0", "BOX ", idtmed[1], data, 3); // contains detector
411 data[1] = 0.5*ddettelescope;
413 gMC->Gsvolu("IMBS","BOX ",idtmed[1],data,3); // sensitive detecor volulme
414 gMC->Gspos("IMBS",1,"IMB0",0.0,0.0,0.0,0,"ONLY"); // place IMBS inside
415 // IMB0 with no translation and unit rotation matrix.
416 Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
417 data[0] = chipMiniBusX = 0.793;
418 data[1] = chipMiniBusY = 0.5*dchipMiniBus;
419 data[2] = chipMiniBusZ = 0.68;
420 gMC->Gsvolu("ICMB","BOX ",idtmed[1],data, 3); // chip Minibus
421 data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
422 data[1] = detMiniBusY+chipMiniBusY;
423 data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
424 gMC->Gsvolu("ITEL","BOX ",idtmed[0],data,3);
425 gMC->Gspos("IMB0",1,"ITEL",0.0,data[1]-detMiniBusY,0.0,0,"ONLY");
426 gMC->Gspos("ICMB",1,"ITEL",0.0,-data[1]+chipMiniBusY,0.0,0,"ONLY");
429 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
430 data[0] = spdX = 0.705;
431 data[1] = spdY = 0.5*ddettest;
432 data[2] = spdZ = 3.536;
433 gMC->Gsvolu("ITS0", "BOX ", idtmed[1], data, 3); // contains detector
435 data[1] = 0.5*ddettest;
437 gMC->Gsvolu("ITST","BOX ",idtmed[1],data,3);// sensitive detecor volume
438 gMC->Gspos("ITST",1,"ITS0",0.0,0.0,0.0,0,"ONLY"); // place ITST inside
439 // ITS0 with no translation and unit rotation matrix.
440 data[0] = spdchipX = 0.793;
441 data[1] = spdchipY = 0.5*dchiptest;
442 data[2] = spdchipZ = 0.68;
443 gMC->Gsvolu("IPC0", "BOX ", idtmed[1],data,3); // chip under test
444 data[0] = TMath::Max(spdchipX,spdX);
445 data[1] = spdY+spdchipY;
446 data[2] = TMath::Max(spdchipZ,spdZ);
447 gMC->Gsvolu("IDET","BOX ",idtmed[0],data,3);
448 gMC->Gspos("ITS0",1,"IDET",0.0,data[1]-spdY,0.0,0,"ONLY");
449 for(Int_t i=-2;i<3;i++) gMC->Gspos("IPC0",i+3,"IDET",0.0,-data[1]+spdchipY,
450 i*2.*spdchipZ+i*0.25*(spdZ-5.*spdchipZ),0,"ONLY");
452 // Positions detectors, Beam Axis Z, X to the right, Y up to the sky.
453 Float_t p00X,p00Y,p00Z,p01X,p01Y,p01Z,p10X,p10Y,p10Z,p11X,p11Y,p11Z;
457 gMC->Gspos("ITEL",1,"ITSV",p00X,p00Y,p00Z,idrotm[0],"ONLY");
461 gMC->Gspos("ITEL",2,"ITSV",p01X,p01Y,p01Z,idrotm[0],"ONLY");
462 Float_t pdetX,pdetY,pdetZ;
464 pdetY = 0.0+yposition;
466 gMC->Gspos("IDET",1,"ITSV",pdetX,pdetY,pdetZ,idrotm[0],"ONLY");
470 gMC->Gspos("ITEL",3,"ITSV",p10X,p10Y,p10Z,idrotm[0],"ONLY");
474 gMC->Gspos("ITEL",4,"ITSV",p11X,p11Y,p11Z,idrotm[0],"ONLY");
476 //______________________________________________________________________
477 void AliITSvSPD02::CreateMaterials(){
478 ////////////////////////////////////////////////////////////////////////
480 // Create ITS SPD test beam materials
481 // This function defines the default materials used in the Geant
482 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
484 // In general it is automatically replaced by
485 // the CreatMaterials routine defined in AliITSv?. Should the function
486 // CreateMaterials not exist for the geometry version you are using this
487 // one is used. See the definition found in AliITSv5 or the other routine
488 // for a complete definition.
496 /////////////////////////////////////////////////////////////////////////
498 switch (fGeomNumber){
500 CreateMaterials2002();
503 CreateMaterials2002();
507 //______________________________________________________________________
508 void AliITSvSPD02::CreateMaterials2002(){
509 ////////////////////////////////////////////////////////////////////////
511 // Create ITS SPD test beam materials
512 // This function defines the default materials used in the Geant
513 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
515 // In general it is automatically replaced by
516 // the CreatMaterials routine defined in AliITSv?. Should the function
517 // CreateMaterials not exist for the geometry version you are using this
518 // one is used. See the definition found in AliITSv5 or the other routine
519 // for a complete definition.
527 /////////////////////////////////////////////////////////////////////////
528 Float_t tmaxfdSi = 0.1; // Degree
529 Float_t stemaxSi = 0.0075; // cm
530 Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
531 Float_t epsilSi = 1.0E-4;//
532 Float_t stminSi = 0.0; // cm "Default value used"
534 Float_t tmaxfdAir = 0.1; // Degree
535 Float_t stemaxAir = .10000E+01; // cm
536 Float_t deemaxAir = 0.1; // Fraction of particle's energy 0<deemax<=1
537 Float_t epsilAir = 1.0E-4;//
538 Float_t stminAir = 0.0; // cm "Default value used"
539 Int_t ifield = gAlice->Field()->Integ();
540 Float_t fieldm = gAlice->Field()->Max();
542 AliMaterial(1,"AIR$",0.14610E+02,0.73000E+01,0.12050E-02,
543 0.30423E+05,0.99900E+03);
544 AliMedium(1,"AIR$",1,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,
547 AliMaterial(2,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,
548 0.93600E+01,0.99900E+03);
549 AliMedium(2,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
552 //______________________________________________________________________
553 void AliITSvSPD02::InitAliITSgeom(){
554 // Based on the geometry tree defined in Geant 3.21, this
555 // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
563 const Int_t kltypess = 2;
564 const Int_t knlayers = 5;
565 const Int_t kndeep = 5;
566 Int_t itsGeomTreeNames[kltypess][kndeep],lnam[20],lnum[20];
567 Int_t nlad[knlayers],ndet[knlayers];
569 Float_t par[20],att[20];
570 Int_t npar,natt,idshape,imat,imed;
571 AliITSGeant3Geometry *ig=0;
572 Int_t mod=0,typ=0,lay=0,lad=0,det=0,cpy=0,i=0,j=0,k=0;
574 if(gMC==0) {// No Monti Carlo to init. Default set fITSgeom by hand
575 if(fITSgeom!=0) delete fITSgeom;
576 nlad[0]=1;nlad[1]=1;nlad[2]=1;nlad[3]=1;nlad[4]=1;
577 ndet[0]=1;ndet[1]=1;ndet[2]=1;ndet[3]=1;ndet[4]=1;
578 fITSgeom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
579 r[0] = 1.0; r[1] = 0.0; r[2] = 0.0;
580 r[3] = 0.0; r[4] = 0.0; r[5] = 1.0;
581 r[6] = 0.0; r[7] = -1.0; r[8] = 0.0; r[9] = 1.0; // not Unit.
582 Double_t tt[5][3]={{0.0,0.0,-37.9625}, // 0,0,P00Z+.5*chipMiniBusY
583 {0.0,0.0,-35.9625}, // 0,0,P00Z+2+.5*chipMiniBusY
584 {0.0,0.0, 2.0150}, // 0,0,P01Z+38+SPDchipY
585 {0.0,0.0, 36.5375}, //0,0,PdetZ+34.5+.5*chipMiniBusY
586 {0.0,0.0, 38.5375}};// 0,0,P00Z+2+.5*chipMiniBusY
587 for(mod=0;mod<5;mod++){
591 t[0] = tt[mod][0]; t[1] = tt[mod][1]; t[2] = tt[mod][2];
592 fITSgeom->CreatMatrix(mod,lay,lad,det,kSPD,t,r);
593 npar=3;par[0]=0.64;par[1]=0.5*300.0E-4;par[2]=3.48;
594 fITSgeom->ReSetShape(kSPD,new AliITSgeomSPD425Short(npar,par));
598 if(strcmp(gMC->GetName(),"TGeant3")) {
599 Error("InitAliITSgeom",
600 "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls");
603 cout << "Reading Geometry transformation directly from Geant 3." << endl;
604 ig = new AliITSGeant3Geometry();
605 Char_t names[kltypess][kndeep][4];
606 Int_t itsGeomTreeCopys[kltypess][kndeep];
607 const char *namesA[kltypess][kndeep] = {
608 {"ALIC","ITSV","ITEL","IMB0","IMBS"}, // lay=1
609 {"ALIC","ITSV","IDET","ITS0","ITST"}};// Test SPD
610 Int_t itsGeomTreeCopysA[kltypess][kndeep]= {{1,1,4,1,1},// lay=1
611 {1,1,1,1,1}};//lay=2 TestSPD
612 for(i=0;i<kltypess;i++)for(j=0;j<kndeep;j++){
613 for(k=0;k<4;k++) names[i][j][k] = namesA[i][j][k];
614 itsGeomTreeCopys[i][j] = itsGeomTreeCopysA[i][j];
616 // Sorry, but this is not very pritty code. It should be replaced
617 // at some point with a version that can search through the geometry
619 cout << "Reading Geometry informaton from Geant3 common blocks" << endl;
620 for(i=0;i<20;i++) lnam[i] = lnum[i] = 0;
621 for(i=0;i<kltypess;i++)for(j=0;j<kndeep;j++)
622 strncpy((char*) &itsGeomTreeNames[i][j],names[i][j],4);
623 // itsGeomTreeNames[i][j] = ig->StringToInt(names[i][j]);
625 if(fITSgeom!=0) delete fITSgeom;
626 nlad[0]=1;nlad[1]=1;nlad[2]=1;nlad[3]=1;nlad[4]=1;
627 ndet[0]=1;ndet[1]=1;ndet[2]=1;ndet[3]=1;ndet[4]=1;
628 fITSgeom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
629 for(typ=1;typ<=kltypess;typ++){
630 for(j=0;j<kndeep;j++) lnam[j] = itsGeomTreeNames[typ-1][j];
631 for(j=0;j<kndeep;j++) lnum[j] = itsGeomTreeCopys[typ-1][j];
634 for(cpy=1;cpy<=itsGeomTreeCopys[typ-1][2];cpy++){
637 if(cpy>2 && typ==1) lay = cpy +1;
640 ig->GetGeometry(kndeep,lnam,lnum,t,r,idshape,npar,natt,par,att,
642 fITSgeom->CreatMatrix(mod,lay,lad,det,kSPD,t,r);
643 if(!(fITSgeom->IsShapeDefined((Int_t)kSPD)))
644 fITSgeom->ReSetShape(kSPD,
645 new AliITSgeomSPD425Short(npar,par));
650 //______________________________________________________________________
651 void AliITSvSPD02::Init(){
652 ////////////////////////////////////////////////////////////////////////
653 // Initialise the ITS after it has been created.
660 ////////////////////////////////////////////////////////////////////////
664 for(i=0;i<26;i++) cout << "*";
665 cout << " ITSvSPD02" << fMinorVersion << "_Init ";
666 for(i=0;i<25;i++) cout << "*";cout << endl;
668 if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
669 if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
670 if(fITSgeom!=0) delete fITSgeom;
671 fITSgeom = new AliITSgeom();
672 if(fGeomDetIn) fITSgeom->ReadNewFile(fRead);
673 if(!fGeomDetIn) this->InitAliITSgeom();
674 if(fGeomDetOut) fITSgeom->WriteNewFile(fWrite);
677 for(i=0;i<72;i++) cout << "*";
679 if(gMC) fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
682 //______________________________________________________________________
683 void AliITSvSPD02::SetDefaults(){
684 // sets the default segmentation, response, digit and raw cluster classes
691 const Float_t kconv = 1.0e+04; // convert cm to microns
693 Info("SetDefaults","Setting up only SPD detector");
695 AliITSDetType *iDetType;
698 Float_t bx[256],bz[280];
701 iDetType=DetType(kSPD);
702 // Get shape info. Do it this way for now.
703 s0 = (AliITSgeomSPD*) fITSgeom->GetShape(kSPD);
704 AliITSresponse *resp0=new AliITSresponseSPD();
705 resp0->SetTemperature();
706 resp0->SetDistanceOverVoltage();
707 SetResponseModel(kSPD,resp0);
708 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(fITSgeom);
709 seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
710 s0->GetDz()*2.*kconv, // for now.
711 s0->GetDy()*2.*kconv); // x,z,y full width in microns.
712 seg0->SetNPads(256,160);// Number of Bins in x and z
713 for(i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns.
714 for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
715 for(i=160;i<280;i++) bz[i] = 0.0; // Outside of detector.
716 bz[ 31] = bz[ 32] = 625.0; // first chip boundry
717 bz[ 63] = bz[ 64] = 625.0; // first chip boundry
718 bz[ 95] = bz[ 96] = 625.0; // first chip boundry
719 bz[127] = bz[128] = 625.0; // first chip boundry
720 bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
721 seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
722 SetSegmentationModel(kSPD,seg0);
723 // set digit and raw cluster classes to be used
724 const char *kData0=(iDetType->GetResponseModel())->DataType();
725 if (strstr(kData0,"real")) iDetType->ClassNames("AliITSdigit",
726 "AliITSRawClusterSPD");
727 else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
728 // SetSimulationModel(kSPD,new AliITSsimulationSPD(seg0,resp0));
729 // iDetType->ReconstructionModel(new AliITSClusterFinderSPD());
731 SetResponseModel(kSDD,new AliITSresponseSDD());
732 SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
733 DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
735 SetResponseModel(kSSD,new AliITSresponseSSD());
736 SetSegmentationModel(kSSD,new AliITSsegmentationSSD());
737 DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
740 Warning("SetDefaults",
741 "Only the four basic detector types are initialised!");
745 //______________________________________________________________________
746 void AliITSvSPD02::SetDefaultSimulation(){
747 // sets the default simulation.
755 AliITSDetType *iDetType;
756 AliITSsimulation *sim;
757 iDetType=DetType(kSPD);
758 sim = iDetType->GetSimulationModel();
760 AliITSsegmentation *seg0=
761 (AliITSsegmentation*)iDetType->GetSegmentationModel();
762 AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel();
763 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
764 SetSimulationModel(kSPD,sim0);
765 }else{ // simulation exists, make sure it is set up properly.
766 ((AliITSsimulationSPD*)sim)->Init(
767 (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(),
768 (AliITSresponseSPD*) iDetType->GetResponseModel());
769 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
770 // (AliITSresponse*)iDetType->GetResponseModel());
771 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
772 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
774 iDetType=DetType(kSDD);
775 sim = iDetType->GetSimulationModel();
777 AliITSsegmentation *seg1=
778 (AliITSsegmentation*)iDetType->GetSegmentationModel();
779 AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
780 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
781 SetSimulationModel(kSDD,sim1);
782 }else{ // simulation exists, make sure it is set up properly.
783 ((AliITSsimulationSDD*)sim)->Init(
784 (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(),
785 (AliITSresponseSDD*) iDetType->GetResponseModel());
786 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
787 // (AliITSresponse*)iDetType->GetResponseModel());
788 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
789 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
791 iDetType=DetType(kSSD);
792 sim = iDetType->GetSimulationModel();
794 AliITSsegmentation *seg2=
795 (AliITSsegmentation*)iDetType->GetSegmentationModel();
796 AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel();
797 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
798 SetSimulationModel(kSDD,sim2);
799 }else{ // simulation exists, make sure it is set up properly.
800 ((AliITSsimulationSSD*)sim)->Init(
801 (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(),
802 (AliITSresponseSSD*) iDetType->GetResponseModel());
803 // if(sim->GetResponseModel()==0) sim->SetResponseModel(
804 // (AliITSresponse*)iDetType->GetResponseModel());
805 // if(sim->GetSegmentationModel()==0) sim->SetSegmentationModel(
806 // (AliITSsegmentation*)iDetType->GetSegmentationModel());
809 //______________________________________________________________________
810 void AliITSvSPD02::DrawModule() const {
811 ////////////////////////////////////////////////////////////////////////
812 // Draw a shaded view of the ITS SPD test beam version 1.
819 ////////////////////////////////////////////////////////////////////////
820 // Set everything unseen
821 gMC->Gsatt("*", "seen", -1);
822 // Set ALIC mother visible
823 gMC->Gsatt("ALIC","SEEN",0);
824 // Set ALIC ITS visible
825 gMC->Gsatt("ITSV","SEEN",0);
826 // Set ALIC Telescopes visible
827 gMC->Gsatt("ITEL","SEEN",0);
828 // Set ALIC detetcor visible
829 gMC->Gsatt("IDET","SEEN",0);
830 // Set Detector chip mother visible and drawn
831 gMC->Gsatt("IPC0","SEEN",1);
832 // Set Detector mother visible and drawn
833 gMC->Gsatt("ITS0","SEEN",1);
834 // Set minibus chip mother visible and drawn
835 gMC->Gsatt("ICMB","SEEN",1);
836 // Set minibus mother visible and drawn
837 gMC->Gsatt("IMB0","SEEN",1);
839 //______________________________________________________________________
840 void AliITSvSPD02::StepManager(){
841 ////////////////////////////////////////////////////////////////////////
842 // Called for every step in the ITS SPD test beam, then calles the
843 // AliITShit class creator with the information to be recoreded about
845 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
846 // printing of information to a file which can be used to create a .det
847 // file read in by the routine CreateGeometry(). If set to 0 or any other
848 // value except 1, the default behavior, then no such file is created nor
849 // it the extra variables and the like used in the printing allocated.
856 ////////////////////////////////////////////////////////////////////////
858 TLorentzVector position, momentum;
859 static TLorentzVector position0;
860 static Int_t stat0=0;
861 if((id=gMC->CurrentVolID(copy) == fIDMother)&&
862 (gMC->IsTrackEntering()||gMC->IsTrackExiting())){
863 copy = fTrackReferences->GetEntriesFast();
864 TClonesArray &lTR = *fTrackReferences;
865 // Fill TrackReference structure with this new TrackReference.
866 new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
867 } // if Outer ITS mother Volume
868 if(!(this->IsActive())){
870 } // end if !Active volume.
872 TClonesArray &lhits = *fHits;
877 if(gMC->IsTrackInside()) vol[3] += 1;
878 if(gMC->IsTrackEntering()) vol[3] += 2;
879 if(gMC->IsTrackExiting()) vol[3] += 4;
880 if(gMC->IsTrackOut()) vol[3] += 8;
881 if(gMC->IsTrackDisappeared()) vol[3] += 16;
882 if(gMC->IsTrackStop()) vol[3] += 32;
883 if(gMC->IsTrackAlive()) vol[3] += 64;
885 // Fill hit structure.
886 if(!(gMC->TrackCharge())) return;
887 id = gMC->CurrentVolID(copy);
888 if(id==fIdSens[0]){ // Volume name "IMBS"
889 vol[2] = vol[1] = 1; // Det, ladder
890 id = gMC->CurrentVolOffID(2,copy);
891 //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
892 vol[0] = copy; // Lay
894 } else if(id == fIdSens[1]){ // Volume name "ITST"
896 vol[1] = 1; // ladder
897 id = gMC->CurrentVolOffID(2,copy);
898 //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
899 vol[2] = 1; // detector
900 } else return; // end if
902 gMC->TrackPosition(position);
903 gMC->TrackMomentum(momentum);
905 if(gMC->IsTrackEntering()){
906 position0 = position;
909 } // end if IsEntering
910 // Fill hit structure with this new hit only for non-entrerance hits.
911 else new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
912 gMC->Edep(),gMC->TrackTime(),position,
915 position0 = position;