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 <TGeometry.h>
20 #include <TLorentzVector.h>
21 #include <TClonesArray.h>
26 #include "AliITSGeant3Geometry.h"
27 #include "AliTrackReference.h"
28 #include "AliITShit.h"
30 #include "AliITSvSPD02.h"
31 #include "AliITSgeom.h"
32 #include "AliITSgeomSPD.h"
33 #include "AliITSDetTypeSim.h"
34 #include "AliITSCalibrationSPD.h"
35 #include "AliITSsegmentationSPD.h"
36 #include "AliITSsimulationSPD.h"
40 ///////////////////////////////////////////////////////////////////////
45 // geometry of summer 2002
47 ///////////////////////////////////////////////////////////////////////
48 ClassImp(AliITSvSPD02)
50 //______________________________________________________________________
51 AliITSvSPD02::AliITSvSPD02():
65 ////////////////////////////////////////////////////////////////////////
66 // Standard default constructor for the ITS SPD test beam 2002 version 1.
72 // A default created class.
73 ////////////////////////////////////////////////////////////////////////
76 for(i=0;i<60;i++) fRead[i] = '\0';
77 for(i=0;i<60;i++) fWrite[i] = '\0';
78 for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
80 //______________________________________________________________________
81 AliITSvSPD02::AliITSvSPD02(const char *title,Int_t gn) : AliITS("ITS", title),
94 ////////////////////////////////////////////////////////////////////////
95 // Standard constructor for the ITS SPD testbeam 2002 version 1.
97 // const char *title title for this ITS geometry.
98 // Int_t gn Geometry version number (year) default 2002.
102 // A standard created class.
103 ////////////////////////////////////////////////////////////////////////
108 fIdName = new TString[fIdN];
111 fIdSens = new Int_t[fIdN];
112 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
118 fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vSPD022.euc";
119 strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vSPD022.det",60);
120 strncpy(fRead,fEuclidGeomDet,60);
121 strncpy(fWrite,fEuclidGeomDet,60);
123 //______________________________________________________________________
124 AliITSvSPD02::AliITSvSPD02(const AliITSvSPD02 &source) : AliITS(source){
125 ////////////////////////////////////////////////////////////////////////
126 // Copy Constructor for ITS SPD test beam 2002 version 1.
127 // This class is not to be copied. Function only dummy.
129 // const AliITSvSPD02 &source The class to be copied
133 // A warning message.
134 ////////////////////////////////////////////////////////////////////////
135 if(&source == this) return;
136 Warning("Copy Constructor","Not allowed to copy AliITSvSPD02");
139 //______________________________________________________________________
140 AliITSvSPD02& AliITSvSPD02::operator=(const AliITSvSPD02 &source){
141 ////////////////////////////////////////////////////////////////////////
142 // Assignment operator for the ITS SPD test beam 2002 version 1.
143 // This class is not to be copied. Function only dummy.
145 // const AliITSvSPD02 &source The class to be copied
150 ////////////////////////////////////////////////////////////////////////
151 if(&source == this) return *this;
152 Warning("= operator","Not allowed to copy AliITSvSPD02");
155 //______________________________________________________________________
156 AliITSvSPD02::~AliITSvSPD02() {
157 ////////////////////////////////////////////////////////////////////////
158 // Standard destructor for the ITS SPD test beam 2002 version 1.
165 ////////////////////////////////////////////////////////////////////////
167 //______________________________________________________________________
168 void AliITSvSPD02::BuildGeometry(){
169 ////////////////////////////////////////////////////////////////////////
170 // Geometry builder for the ITS SPD test beam 2002 version 1.
171 // ALIC ALICE Mother Volume
172 // |- ITSV ITS Mother Volume
173 // |- IDET Detector under Test
174 // | |- ITS0 SPD Si Chip
175 // | | |- ITST SPD Sensitivve Volume
176 // | |- IPC0 *5 Readout chip
177 // |- ITEL *4 SPD Telescope
178 // |- IMB0 SPD Si Chip
179 // | |- IMBS SPD Sensitive volume
180 // |- ICMB Chip MiniBus.
187 ////////////////////////////////////////////////////////////////////////
188 // Get the top alice volume.
190 switch (fGeomNumber){
199 //______________________________________________________________________
200 void AliITSvSPD02::BuildGeometry2002(){
201 ////////////////////////////////////////////////////////////////////////
202 // Geometry builder for the ITS SPD test beam 2002 version 1.
203 // ALIC ALICE Mother Volume
204 // |- ITSV ITS Mother Volume
205 // |- IDET Detector under Test
206 // | |- ITS0 SPD Si Chip
207 // | | |- ITST SPD Sensitivve Volume
208 // | |- IPC0 *5 Readout chip
209 // |- ITEL *4 SPD Telescope
210 // |- IMB0 SPD Si Chip
211 // | |- IMBS SPD Sensitive volume
212 // |- ICMB Chip MiniBus.
219 ////////////////////////////////////////////////////////////////////////
220 // Get the top alice volume.
221 TNode *aALIC = gAlice->GetGeometry()->GetNode("alice");
224 // Define ITS Mother Volume
226 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
227 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
228 //Float_t yposition= 0.0;
229 TRotMatrix *r0 = new TRotMatrix("ITSidrotm0","ITSidrotm0",
230 90.0,0,0.0,0,90.0,270.0);
234 TBRIK *iITSVshape = new TBRIK("ITSVshape",
235 "ITS Logical Mother Volume","Air",
236 data[0],data[1],data[2]);
237 TNode *iITSV = new TNode("ITSV","ITS Mother Volume",iITSVshape,
239 iITSV->cd(); // set ourselve into ITSV subvolume of aALIC
241 // SPD part of telescope (MiniBuS)
243 data[1] = 0.5*ddettelescope;
245 TBRIK *iIMB0shape = new TBRIK("IMB0shape","SPD wafer","Si",
246 data[0],data[1],data[2]);
247 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
248 data[0] = detMiniBusX = 0.64;
249 data[1] = detMiniBusY = 0.5*ddettelescope;
250 data[2] = detMiniBusZ = 3.48;
251 TBRIK *iIMBSshape = new TBRIK("IMBSshape","SPD Sensitive volume","Si",
252 data[0],data[1],data[2]);
253 Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
254 data[0] = chipMiniBusX = 0.793;
255 data[1] = chipMiniBusY = 0.5*dchipMiniBus;
256 data[2] = chipMiniBusZ = 0.68;
257 TBRIK *iICMBshape = new TBRIK("ICMBshape","chip Minibus","Si",
258 data[0],data[1],data[2]);
259 data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
260 data[1] = detMiniBusY+chipMiniBusY;
261 data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
262 TBRIK *iITELshape = new TBRIK("ITELshape","ITELshape","Air",
263 data[0],data[1],data[2]);
266 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
270 TBRIK *iITS0shape = new TBRIK("ITS0shape","SPD wafer","Si",
271 data[0],data[1],data[2]); // contains detector
272 data[0] = spdX = 0.64;
273 data[1] = spdY = ddettest;
274 data[2] = spdZ = 3.48;
275 TBRIK *iITSTshape = new TBRIK("ITSTshape","SPD sensitive volume","Si",
276 data[0],data[1],data[2]);
277 // ITS0 with no translation and unit rotation matrix.
278 data[0] = spdchipX = 0.793;
279 data[1] = spdchipY = dchiptest;
280 data[2] = spdchipZ = 0.68;
281 TBRIK *iIPC0shape = new TBRIK("IPC0shape","Readout Chips","Si",
282 data[0],data[1],data[2]); // chip under test
283 data[0] = TMath::Max(spdchipX,spdX);
284 data[1] = spdY+spdchipY;
285 data[2] = TMath::Max(spdchipZ,spdZ);
286 TBRIK *iIDETshape = new TBRIK("IDETshape","Detector Under Test","Air",
287 data[0],data[1],data[2]);
288 // Place volumes in geometry
290 char name[20],title[50];
291 Double_t px=0.0,py=0.0,pz[4]={-38.0,0.0,0.0,0.0};
293 pz[2] = pz[1]+38.0+spdY+spdchipY+34.5;
295 TNode *iITEL[4],*iICMB[4],*iIMB0[4],*iIMBS[4];
296 TNode *iIDET = new TNode("IDET","Detector Under Test",iIDETshape,
297 0.0,0.0,pz[1]+38.0,r0,0);
299 TNode *iITS0 = new TNode("ITS0","SPD Chip",iITS0shape,
300 0.0,iIDETshape->GetDy()-spdY,0.0,0,0);
302 for(i=0;i<5;i++) { //place readout chips on the back of SPD chip under test
303 sprintf(name,"IPC0%d",i);
304 sprintf(title,"Readout chip #%d",i+1);
306 iIPC0[i] = new TNode(name,title,iIPC0shape,
307 0.0,spdchipY-iIDETshape->GetDy(),
308 j*2.0*spdchipZ+j*0.25*(spdZ-5.*spdchipZ),0,0);
311 TNode *iITST = new TNode("ITST","SPD sensitive volume",iITSTshape,
313 for(Int_t i=0;i<4;i++){
315 sprintf(name,"ITEL%d",i);
316 sprintf(title,"Test beam telescope element #%d",i+1);
317 iITEL[i] = new TNode(name,title,iITELshape,px,py,pz[i],r0,0);
319 iICMB[i] = new TNode("ICMB","Chip MiniBus",iICMBshape,
320 0.0,-iITELshape->GetDy()+detMiniBusY,0.0,0,0);
321 iIMB0[i] = new TNode("IMB0","Chip MiniBus",iIMB0shape,
322 0.0, iITELshape->GetDy()-detMiniBusY,0.0,0,0);
324 iIMBS[i] = new TNode("IMBS","IMBS",iIMBSshape,0.0,0.0,0.0,0,0);
325 // place IMBS inside IMB0 with no translation and unit rotation matrix.
328 iITST->SetLineColor(kYellow);
331 iIMBS[i]->SetLineColor(kGreen);
332 fNodes->Add(iIMBS[i]);
335 //______________________________________________________________________
336 void AliITSvSPD02::CreateGeometry(){
337 ////////////////////////////////////////////////////////////////////////
338 // This routine defines and Creates the geometry for version 1 of the ITS.
339 // ALIC ALICE Mother Volume
340 // |- ITSV ITS Mother Volume
341 // |- IDET Detector under Test
342 // | |- ITS0 SPD Si Chip
343 // | | |- ITST SPD Sensitivve Volume
344 // | |- IPC0 *5 Readout chip
345 // |- ITEL *4 SPD Telescope
346 // |- IMB0 SPD Si Chip
347 // | |- IMBS SPD Sensitive volume
348 // |- ICMB Chip MiniBus.
355 ////////////////////////////////////////////////////////////////////////
357 switch (fGeomNumber){
359 CreateGeometry2002();
362 CreateGeometry2002();
366 //______________________________________________________________________
367 void AliITSvSPD02::CreateGeometry2002(){
368 ////////////////////////////////////////////////////////////////////////
369 // This routine defines and Creates the geometry for version 1 of the ITS.
370 // ALIC ALICE Mother Volume
371 // |- ITSV ITS Mother Volume
372 // |- IDET Detector under Test
373 // | |- ITS0 SPD Si Chip
374 // | | |- ITST SPD Sensitivve Volume
375 // | |- IPC0 *5 Readout chip
376 // |- ITEL *4 SPD Telescope
377 // |- IMB0 SPD Si Chip
378 // | |- IMBS SPD Sensitive volume
379 // |- ICMB Chip MiniBus.
386 ////////////////////////////////////////////////////////////////////////
388 // Define media off-set
389 Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
390 Int_t idrotm[4]; // Array of rotation matrix indexes
391 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
392 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
393 Float_t yposition= 0.0;
396 // Define Rotation-reflextion Matrixes needed
397 // 0 is the unit matrix
398 AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
402 gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
403 gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
405 //cout << "idtmed[0]=" << idtmed[0]<<endl;
406 //cout << "idtmed[1]=" << idtmed[1]<<endl;
407 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
408 // SPD part of telescope (MiniBuS)
409 data[0] = detMiniBusX = 0.705;
410 data[1] = detMiniBusY = 0.5*ddettelescope;
411 data[2] = detMiniBusZ = 3.536;
412 gMC->Gsvolu("IMB0", "BOX ", idtmed[1], data, 3); // contains detector
414 data[1] = 0.5*ddettelescope;
416 gMC->Gsvolu("IMBS","BOX ",idtmed[1],data,3); // sensitive detecor volulme
417 gMC->Gspos("IMBS",1,"IMB0",0.0,0.0,0.0,0,"ONLY"); // place IMBS inside
418 // IMB0 with no translation and unit rotation matrix.
419 Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
420 data[0] = chipMiniBusX = 0.793;
421 data[1] = chipMiniBusY = 0.5*dchipMiniBus;
422 data[2] = chipMiniBusZ = 0.68;
423 gMC->Gsvolu("ICMB","BOX ",idtmed[1],data, 3); // chip Minibus
424 data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
425 data[1] = detMiniBusY+chipMiniBusY;
426 data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
427 gMC->Gsvolu("ITEL","BOX ",idtmed[0],data,3);
428 gMC->Gspos("IMB0",1,"ITEL",0.0,data[1]-detMiniBusY,0.0,0,"ONLY");
429 gMC->Gspos("ICMB",1,"ITEL",0.0,-data[1]+chipMiniBusY,0.0,0,"ONLY");
432 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
433 data[0] = spdX = 0.705;
434 data[1] = spdY = 0.5*ddettest;
435 data[2] = spdZ = 3.536;
436 gMC->Gsvolu("ITS0", "BOX ", idtmed[1], data, 3); // contains detector
438 data[1] = 0.5*ddettest;
440 gMC->Gsvolu("ITST","BOX ",idtmed[1],data,3);// sensitive detecor volume
441 gMC->Gspos("ITST",1,"ITS0",0.0,0.0,0.0,0,"ONLY"); // place ITST inside
442 // ITS0 with no translation and unit rotation matrix.
443 data[0] = spdchipX = 0.793;
444 data[1] = spdchipY = 0.5*dchiptest;
445 data[2] = spdchipZ = 0.68;
446 gMC->Gsvolu("IPC0", "BOX ", idtmed[1],data,3); // chip under test
447 data[0] = TMath::Max(spdchipX,spdX);
448 data[1] = spdY+spdchipY;
449 data[2] = TMath::Max(spdchipZ,spdZ);
450 gMC->Gsvolu("IDET","BOX ",idtmed[0],data,3);
451 gMC->Gspos("ITS0",1,"IDET",0.0,data[1]-spdY,0.0,0,"ONLY");
452 for(Int_t i=-2;i<3;i++) gMC->Gspos("IPC0",i+3,"IDET",0.0,-data[1]+spdchipY,
453 i*2.*spdchipZ+i*0.25*(spdZ-5.*spdchipZ),0,"ONLY");
455 // Positions detectors, Beam Axis Z, X to the right, Y up to the sky.
456 Float_t p00X,p00Y,p00Z,p01X,p01Y,p01Z,p10X,p10Y,p10Z,p11X,p11Y,p11Z;
460 gMC->Gspos("ITEL",1,"ITSV",p00X,p00Y,p00Z,idrotm[0],"ONLY");
464 gMC->Gspos("ITEL",2,"ITSV",p01X,p01Y,p01Z,idrotm[0],"ONLY");
465 Float_t pdetX,pdetY,pdetZ;
467 pdetY = 0.0+yposition;
469 gMC->Gspos("IDET",1,"ITSV",pdetX,pdetY,pdetZ,idrotm[0],"ONLY");
473 gMC->Gspos("ITEL",3,"ITSV",p10X,p10Y,p10Z,idrotm[0],"ONLY");
477 gMC->Gspos("ITEL",4,"ITSV",p11X,p11Y,p11Z,idrotm[0],"ONLY");
479 //______________________________________________________________________
480 void AliITSvSPD02::CreateMaterials(){
481 ////////////////////////////////////////////////////////////////////////
483 // Create ITS SPD test beam materials
484 // This function defines the default materials used in the Geant
485 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
487 // In general it is automatically replaced by
488 // the CreatMaterials routine defined in AliITSv?. Should the function
489 // CreateMaterials not exist for the geometry version you are using this
490 // one is used. See the definition found in AliITSv5 or the other routine
491 // for a complete definition.
499 /////////////////////////////////////////////////////////////////////////
501 switch (fGeomNumber){
503 CreateMaterials2002();
506 CreateMaterials2002();
510 //______________________________________________________________________
511 void AliITSvSPD02::CreateMaterials2002(){
512 ////////////////////////////////////////////////////////////////////////
514 // Create ITS SPD test beam materials
515 // This function defines the default materials used in the Geant
516 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
518 // In general it is automatically replaced by
519 // the CreatMaterials routine defined in AliITSv?. Should the function
520 // CreateMaterials not exist for the geometry version you are using this
521 // one is used. See the definition found in AliITSv5 or the other routine
522 // for a complete definition.
530 /////////////////////////////////////////////////////////////////////////
531 Float_t tmaxfdSi = 0.1; // Degree
532 Float_t stemaxSi = 0.0075; // cm
533 Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
534 Float_t epsilSi = 1.0E-4;//
535 Float_t stminSi = 0.0; // cm "Default value used"
537 Float_t tmaxfdAir = 0.1; // Degree
538 Float_t stemaxAir = .10000E+01; // cm
539 Float_t deemaxAir = 0.1; // Fraction of particle's energy 0<deemax<=1
540 Float_t epsilAir = 1.0E-4;//
541 Float_t stminAir = 0.0; // cm "Default value used"
542 Int_t ifield = gAlice->Field()->Integ();
543 Float_t fieldm = gAlice->Field()->Max();
545 AliMaterial(1,"AIR$",0.14610E+02,0.73000E+01,0.12050E-02,
546 0.30423E+05,0.99900E+03);
547 AliMedium(1,"AIR$",1,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,
550 AliMaterial(2,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,
551 0.93600E+01,0.99900E+03);
552 AliMedium(2,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
555 //______________________________________________________________________
556 void AliITSvSPD02::InitAliITSgeom(){
557 // Based on the geometry tree defined in Geant 3.21, this
558 // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
566 const Int_t kltypess = 2;
567 const Int_t knlayers = 5;
568 const Int_t kndeep = 5;
569 Int_t itsGeomTreeNames[kltypess][kndeep],lnam[20],lnum[20];
570 Int_t nlad[knlayers],ndet[knlayers];
572 Float_t par[20],att[20];
573 Int_t npar,natt,idshape,imat,imed;
574 AliITSGeant3Geometry *ig=0;
575 Int_t mod=0,typ=0,lay=0,lad=0,det=0,cpy=0,i=0,j=0,k=0;
577 if(gMC==0) {// No Monti Carlo to init. Default set fITSgeom by hand
578 if(GetITSgeom()!=0) SetITSgeom(0x0);
579 nlad[0]=1;nlad[1]=1;nlad[2]=1;nlad[3]=1;nlad[4]=1;
580 ndet[0]=1;ndet[1]=1;ndet[2]=1;ndet[3]=1;ndet[4]=1;
581 AliITSgeom* geom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
583 r[0] = 1.0; r[1] = 0.0; r[2] = 0.0;
584 r[3] = 0.0; r[4] = 0.0; r[5] = 1.0;
585 r[6] = 0.0; r[7] = -1.0; r[8] = 0.0; r[9] = 1.0; // not Unit.
586 Double_t tt[5][3]={{0.0,0.0,-37.9625}, // 0,0,P00Z+.5*chipMiniBusY
587 {0.0,0.0,-35.9625}, // 0,0,P00Z+2+.5*chipMiniBusY
588 {0.0,0.0, 2.0150}, // 0,0,P01Z+38+SPDchipY
589 {0.0,0.0, 36.5375}, //0,0,PdetZ+34.5+.5*chipMiniBusY
590 {0.0,0.0, 38.5375}};// 0,0,P00Z+2+.5*chipMiniBusY
591 for(mod=0;mod<5;mod++){
595 t[0] = tt[mod][0]; t[1] = tt[mod][1]; t[2] = tt[mod][2];
596 GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSPD,t,r);
597 npar=3;par[0]=0.64;par[1]=0.5*300.0E-4;par[2]=3.48;
598 GetITSgeom()->ReSetShape(kSPD,new AliITSgeomSPD425Short(npar,par));
602 if(strcmp(gMC->GetName(),"TGeant3")) {
603 Error("InitAliITSgeom",
604 "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls");
607 cout << "Reading Geometry transformation directly from Geant 3." << endl;
608 ig = new AliITSGeant3Geometry();
609 Char_t names[kltypess][kndeep][4];
610 Int_t itsGeomTreeCopys[kltypess][kndeep];
611 const char *namesA[kltypess][kndeep] = {
612 {"ALIC","ITSV","ITEL","IMB0","IMBS"}, // lay=1
613 {"ALIC","ITSV","IDET","ITS0","ITST"}};// Test SPD
614 Int_t itsGeomTreeCopysA[kltypess][kndeep]= {{1,1,4,1,1},// lay=1
615 {1,1,1,1,1}};//lay=2 TestSPD
616 for(i=0;i<kltypess;i++)for(j=0;j<kndeep;j++){
617 for(k=0;k<4;k++) names[i][j][k] = namesA[i][j][k];
618 itsGeomTreeCopys[i][j] = itsGeomTreeCopysA[i][j];
620 // Sorry, but this is not very pritty code. It should be replaced
621 // at some point with a version that can search through the geometry
623 cout << "Reading Geometry informaton from Geant3 common blocks" << endl;
624 for(i=0;i<20;i++) lnam[i] = lnum[i] = 0;
625 for(i=0;i<kltypess;i++)for(j=0;j<kndeep;j++)
626 strncpy((char*) &itsGeomTreeNames[i][j],names[i][j],4);
627 // itsGeomTreeNames[i][j] = ig->StringToInt(names[i][j]);
629 if(GetITSgeom()!=0) SetITSgeom(0x0);
630 nlad[0]=1;nlad[1]=1;nlad[2]=1;nlad[3]=1;nlad[4]=1;
631 ndet[0]=1;ndet[1]=1;ndet[2]=1;ndet[3]=1;ndet[4]=1;
632 AliITSgeom* geom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
634 for(typ=1;typ<=kltypess;typ++){
635 for(j=0;j<kndeep;j++) lnam[j] = itsGeomTreeNames[typ-1][j];
636 for(j=0;j<kndeep;j++) lnum[j] = itsGeomTreeCopys[typ-1][j];
639 for(cpy=1;cpy<=itsGeomTreeCopys[typ-1][2];cpy++){
642 if(cpy>2 && typ==1) lay = cpy +1;
645 ig->GetGeometry(kndeep,lnam,lnum,t,r,idshape,npar,natt,par,att,
647 GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSPD,t,r);
648 if(!(GetITSgeom()->IsShapeDefined((Int_t)kSPD)))
649 GetITSgeom()->ReSetShape(kSPD,
650 new AliITSgeomSPD425Short(npar,par));
655 //______________________________________________________________________
656 void AliITSvSPD02::Init(){
657 ////////////////////////////////////////////////////////////////////////
658 // Initialise the ITS after it has been created.
665 ////////////////////////////////////////////////////////////////////////
669 for(i=0;i<26;i++) cout << "*";
670 cout << " ITSvSPD02" << fMinorVersion << "_Init ";
671 for(i=0;i<25;i++) cout << "*";cout << endl;
673 if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
674 if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
675 if(GetITSgeom()!=0) SetITSgeom(0x0);
676 AliITSgeom* geom = new AliITSgeom();
678 if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
679 if(!fGeomDetIn) this->InitAliITSgeom();
680 if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
683 for(i=0;i<72;i++) cout << "*";
685 if(gMC) fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
688 //______________________________________________________________________
689 void AliITSvSPD02::SetDefaults(){
690 // sets the default segmentation, response, digit and raw cluster classes
697 const Float_t kconv = 1.0e+04; // convert cm to microns
699 Info("SetDefaults","Setting up only SPD detector");
701 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
702 fDetTypeSim->SetITSgeom(GetITSgeom());
705 Float_t bx[256],bz[280];
706 fDetTypeSim->ResetCalibrationArray();
707 fDetTypeSim->ResetSegmentation();
710 // Get shape info. Do it this way for now.
711 s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD);
712 AliITSCalibration *resp0=new AliITSCalibrationSPD();
713 resp0->SetTemperature();
714 resp0->SetDistanceOverVoltage();
715 SetCalibrationModel(0,resp0);
717 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(GetITSgeom());
718 seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
719 s0->GetDz()*2.*kconv, // for now.
720 s0->GetDy()*2.*kconv); // x,z,y full width in microns.
721 seg0->SetNPads(256,160);// Number of Bins in x and z
722 for(i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns.
723 for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
724 for(i=160;i<280;i++) bz[i] = 0.0; // Outside of detector.
725 bz[ 31] = bz[ 32] = 625.0; // first chip boundry
726 bz[ 63] = bz[ 64] = 625.0; // first chip boundry
727 bz[ 95] = bz[ 96] = 625.0; // first chip boundry
728 bz[127] = bz[128] = 625.0; // first chip boundry
729 bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
730 seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
731 SetSegmentationModel(kSPD,seg0);
732 // set digit and raw cluster classes to be used
733 const char *kData0=(fDetTypeSim->GetCalibrationModel(0))->DataType();
734 if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit");
735 else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
736 // SetSimulationModel(kSPD,new AliITSsimulationSPDdubna(seg0,resp0));
737 // iDetType->ReconstructionModel(new AliITSClusterFinderSPD());
740 SetResponseModel(kSDD,new AliITSCalibrationSDD());
741 SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
742 DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
744 SetResponseModel(kSSD,new AliITSCalibrationSSD());
745 SetSegmentationModel(kSSD,new AliITSsegmentationSSD());
746 DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
749 Warning("SetDefaults",
750 "Only the four basic detector types are initialised!");
754 //______________________________________________________________________
755 void AliITSvSPD02::SetDefaultSimulation(){
756 // sets the default simulation.
765 Warning("SetDefaultSimulation","ITS geometry is null!");
769 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
770 AliITSsimulation *sim;
771 //AliITSsegmentation *seg;
772 //AliITSCalibration *res;
774 sim = fDetTypeSim->GetSimulationModel(kSPD);
776 //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
777 //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD());
778 sim = new AliITSsimulationSPD(fDetTypeSim);
779 SetSimulationModel(kSPD,sim);
780 }else{ // simulation exists, make sure it is set up properly.
781 sim->SetCalibrationModel(GetITSgeom()->GetStartSPD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD()));
782 sim->SetSegmentationModel(kSPD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
789 sim = fDetTypeSim->GetSimulationModel(kSDD);
791 seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
792 res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
793 sim = new AliITSsimulationSDD(seg,res);
794 SetSimulationModel(kSDD,sim);
795 }else{ // simulation exists, make sure it is set up properly.
796 sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()));
797 sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
802 sim = fDetTypeSim->GetSimulationModel(kSSD);
804 seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
805 res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
806 sim = new AliITSsimulationSSD(seg,res);
807 SetSimulationModel(kSSD,sim);
808 }else{ // simulation exists, make sure it is set up properly.
809 sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()));
810 sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
816 //______________________________________________________________________
817 void AliITSvSPD02::DrawModule() const {
818 ////////////////////////////////////////////////////////////////////////
819 // Draw a shaded view of the ITS SPD test beam version 1.
826 ////////////////////////////////////////////////////////////////////////
827 // Set everything unseen
828 gMC->Gsatt("*", "seen", -1);
829 // Set ALIC mother visible
830 gMC->Gsatt("ALIC","SEEN",0);
831 // Set ALIC ITS visible
832 gMC->Gsatt("ITSV","SEEN",0);
833 // Set ALIC Telescopes visible
834 gMC->Gsatt("ITEL","SEEN",0);
835 // Set ALIC detetcor visible
836 gMC->Gsatt("IDET","SEEN",0);
837 // Set Detector chip mother visible and drawn
838 gMC->Gsatt("IPC0","SEEN",1);
839 // Set Detector mother visible and drawn
840 gMC->Gsatt("ITS0","SEEN",1);
841 // Set minibus chip mother visible and drawn
842 gMC->Gsatt("ICMB","SEEN",1);
843 // Set minibus mother visible and drawn
844 gMC->Gsatt("IMB0","SEEN",1);
846 //______________________________________________________________________
847 void AliITSvSPD02::StepManager(){
848 ////////////////////////////////////////////////////////////////////////
849 // Called for every step in the ITS SPD test beam, then calles the
850 // AliITShit class creator with the information to be recoreded about
852 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
853 // printing of information to a file which can be used to create a .det
854 // file read in by the routine CreateGeometry(). If set to 0 or any other
855 // value except 1, the default behavior, then no such file is created nor
856 // it the extra variables and the like used in the printing allocated.
863 ////////////////////////////////////////////////////////////////////////
865 TLorentzVector position, momentum;
866 static TLorentzVector position0;
867 static Int_t stat0=0;
868 if((id=gMC->CurrentVolID(copy) == fIDMother)&&
869 (gMC->IsTrackEntering()||gMC->IsTrackExiting())){
870 copy = fTrackReferences->GetEntriesFast();
871 TClonesArray &lTR = *fTrackReferences;
872 // Fill TrackReference structure with this new TrackReference.
873 new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->
874 GetCurrentTrackNumber());
875 } // if Outer ITS mother Volume
876 if(!(this->IsActive())){
878 } // end if !Active volume.
880 TClonesArray &lhits = *fHits;
885 if(gMC->IsTrackInside()) vol[3] += 1;
886 if(gMC->IsTrackEntering()) vol[3] += 2;
887 if(gMC->IsTrackExiting()) vol[3] += 4;
888 if(gMC->IsTrackOut()) vol[3] += 8;
889 if(gMC->IsTrackDisappeared()) vol[3] += 16;
890 if(gMC->IsTrackStop()) vol[3] += 32;
891 if(gMC->IsTrackAlive()) vol[3] += 64;
893 // Fill hit structure.
894 if(!(gMC->TrackCharge())) return;
895 id = gMC->CurrentVolID(copy);
896 if(id==fIdSens[0]){ // Volume name "IMBS"
897 vol[2] = vol[1] = 1; // Det, ladder
898 id = gMC->CurrentVolOffID(2,copy);
899 //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
900 vol[0] = copy; // Lay
902 } else if(id == fIdSens[1]){ // Volume name "ITST"
904 vol[1] = 1; // ladder
905 id = gMC->CurrentVolOffID(2,copy);
906 //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
907 vol[2] = 1; // detector
908 } else return; // end if
910 gMC->TrackPosition(position);
911 gMC->TrackMomentum(momentum);
913 if(gMC->IsTrackEntering()){
914 position0 = position;
917 } // end if IsEntering
918 // Fill hit structure with this new hit only for non-entrerance hits.
919 else new(lhits[fNhits++]) AliITShit(fIshunt,
920 gAlice->GetMCApp()->GetCurrentTrackNumber(),
921 vol,gMC->Edep(),gMC->TrackTime(),
922 position,position0,momentum);
924 position0 = position;