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>
23 #include <TGeoMatrix.h>
24 #include <TVirtualMC.h>
28 #include "AliTrackReference.h"
30 #include "AliITShit.h"
32 #include "AliITSvSPD02.h"
33 #include "AliITSgeom.h"
34 #include "AliITSgeomSPD.h"
35 #include "AliITSDetTypeSim.h"
36 #include "AliITSCalibrationSPD.h"
37 #include "AliITSsegmentationSPD.h"
38 #include "AliITSsimulationSPD.h"
42 ///////////////////////////////////////////////////////////////////////
47 // geometry of summer 2002
49 ///////////////////////////////////////////////////////////////////////
50 ClassImp(AliITSvSPD02)
52 //______________________________________________________________________
53 AliITSvSPD02::AliITSvSPD02():
67 ////////////////////////////////////////////////////////////////////////
68 // Standard default constructor for the ITS SPD test beam 2002 version 1.
74 // A default created class.
75 ////////////////////////////////////////////////////////////////////////
78 for(i=0;i<60;i++) fRead[i] = '\0';
79 for(i=0;i<60;i++) fWrite[i] = '\0';
80 for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
82 //______________________________________________________________________
83 AliITSvSPD02::AliITSvSPD02(const char *title,Int_t gn) : AliITS("ITS", title),
96 ////////////////////////////////////////////////////////////////////////
97 // Standard constructor for the ITS SPD testbeam 2002 version 1.
99 // const char *title title for this ITS geometry.
100 // Int_t gn Geometry version number (year) default 2002.
104 // A standard created class.
105 ////////////////////////////////////////////////////////////////////////
110 fIdName = new TString[fIdN];
113 fIdSens = new Int_t[fIdN];
114 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
120 fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vSPD022.euc";
121 strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vSPD022.det",60);
122 strncpy(fRead,fEuclidGeomDet,60);
123 strncpy(fWrite,fEuclidGeomDet,60);
125 //______________________________________________________________________
126 AliITSvSPD02::~AliITSvSPD02() {
127 ////////////////////////////////////////////////////////////////////////
128 // Standard destructor for the ITS SPD test beam 2002 version 1.
135 ////////////////////////////////////////////////////////////////////////
137 //______________________________________________________________________
138 void AliITSvSPD02::BuildGeometry(){
139 ////////////////////////////////////////////////////////////////////////
140 // Geometry builder for the ITS SPD test beam 2002 version 1.
141 // ALIC ALICE Mother Volume
142 // |- ITSV ITS Mother Volume
143 // |- IDET Detector under Test
144 // | |- ITS0 SPD Si Chip
145 // | | |- ITST SPD Sensitivve Volume
146 // | |- IPC0 *5 Readout chip
147 // |- ITEL *4 SPD Telescope
148 // |- IMB0 SPD Si Chip
149 // | |- IMBS SPD Sensitive volume
150 // |- ICMB Chip MiniBus.
157 ////////////////////////////////////////////////////////////////////////
158 // Get the top alice volume.
160 switch (fGeomNumber){
169 //______________________________________________________________________
170 void AliITSvSPD02::BuildGeometry2002(){
171 ////////////////////////////////////////////////////////////////////////
172 // Geometry builder for the ITS SPD test beam 2002 version 1.
173 // ALIC ALICE Mother Volume
174 // |- ITSV ITS Mother Volume
175 // |- IDET Detector under Test
176 // | |- ITS0 SPD Si Chip
177 // | | |- ITST SPD Sensitivve Volume
178 // | |- IPC0 *5 Readout chip
179 // |- ITEL *4 SPD Telescope
180 // |- IMB0 SPD Si Chip
181 // | |- IMBS SPD Sensitive volume
182 // |- ICMB Chip MiniBus.
189 ////////////////////////////////////////////////////////////////////////
190 // Get the top alice volume.
191 TNode *aALIC = gAlice->GetGeometry()->GetNode("alice");
194 // Define ITS Mother Volume
196 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
197 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
198 //Float_t yposition= 0.0;
199 TRotMatrix *r0 = new TRotMatrix("ITSidrotm0","ITSidrotm0",
200 90.0,0,0.0,0,90.0,270.0);
204 TBRIK *iITSVshape = new TBRIK("ITSVshape",
205 "ITS Logical Mother Volume","Air",
206 data[0],data[1],data[2]);
207 TNode *iITSV = new TNode("ITSV","ITS Mother Volume",iITSVshape,
209 iITSV->cd(); // set ourselve into ITSV subvolume of aALIC
211 // SPD part of telescope (MiniBuS)
213 data[1] = 0.5*ddettelescope;
215 TBRIK *iIMB0shape = new TBRIK("IMB0shape","SPD wafer","Si",
216 data[0],data[1],data[2]);
217 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
218 data[0] = detMiniBusX = 0.64;
219 data[1] = detMiniBusY = 0.5*ddettelescope;
220 data[2] = detMiniBusZ = 3.48;
221 TBRIK *iIMBSshape = new TBRIK("IMBSshape","SPD Sensitive volume","Si",
222 data[0],data[1],data[2]);
223 Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
224 data[0] = chipMiniBusX = 0.793;
225 data[1] = chipMiniBusY = 0.5*dchipMiniBus;
226 data[2] = chipMiniBusZ = 0.68;
227 TBRIK *iICMBshape = new TBRIK("ICMBshape","chip Minibus","Si",
228 data[0],data[1],data[2]);
229 data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
230 data[1] = detMiniBusY+chipMiniBusY;
231 data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
232 TBRIK *iITELshape = new TBRIK("ITELshape","ITELshape","Air",
233 data[0],data[1],data[2]);
236 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
240 TBRIK *iITS0shape = new TBRIK("ITS0shape","SPD wafer","Si",
241 data[0],data[1],data[2]); // contains detector
242 data[0] = spdX = 0.64;
243 data[1] = spdY = ddettest;
244 data[2] = spdZ = 3.48;
245 TBRIK *iITSTshape = new TBRIK("ITSTshape","SPD sensitive volume","Si",
246 data[0],data[1],data[2]);
247 // ITS0 with no translation and unit rotation matrix.
248 data[0] = spdchipX = 0.793;
249 data[1] = spdchipY = dchiptest;
250 data[2] = spdchipZ = 0.68;
251 TBRIK *iIPC0shape = new TBRIK("IPC0shape","Readout Chips","Si",
252 data[0],data[1],data[2]); // chip under test
253 data[0] = TMath::Max(spdchipX,spdX);
254 data[1] = spdY+spdchipY;
255 data[2] = TMath::Max(spdchipZ,spdZ);
256 TBRIK *iIDETshape = new TBRIK("IDETshape","Detector Under Test","Air",
257 data[0],data[1],data[2]);
258 // Place volumes in geometry
260 char name[20],title[50];
261 Double_t px=0.0,py=0.0,pz[4]={-38.0,0.0,0.0,0.0};
263 pz[2] = pz[1]+38.0+spdY+spdchipY+34.5;
265 TNode *iITEL[4],*iICMB[4],*iIMB0[4],*iIMBS[4];
266 TNode *iIDET = new TNode("IDET","Detector Under Test",iIDETshape,
267 0.0,0.0,pz[1]+38.0,r0,0);
269 TNode *iITS0 = new TNode("ITS0","SPD Chip",iITS0shape,
270 0.0,iIDETshape->GetDy()-spdY,0.0,0,0);
272 for(i=0;i<5;i++) { //place readout chips on the back of SPD chip under test
273 sprintf(name,"IPC0%d",i);
274 sprintf(title,"Readout chip #%d",i+1);
276 iIPC0[i] = new TNode(name,title,iIPC0shape,
277 0.0,spdchipY-iIDETshape->GetDy(),
278 j*2.0*spdchipZ+j*0.25*(spdZ-5.*spdchipZ),0,0);
281 TNode *iITST = new TNode("ITST","SPD sensitive volume",iITSTshape,
283 for(Int_t i=0;i<4;i++){
285 sprintf(name,"ITEL%d",i);
286 sprintf(title,"Test beam telescope element #%d",i+1);
287 iITEL[i] = new TNode(name,title,iITELshape,px,py,pz[i],r0,0);
289 iICMB[i] = new TNode("ICMB","Chip MiniBus",iICMBshape,
290 0.0,-iITELshape->GetDy()+detMiniBusY,0.0,0,0);
291 iIMB0[i] = new TNode("IMB0","Chip MiniBus",iIMB0shape,
292 0.0, iITELshape->GetDy()-detMiniBusY,0.0,0,0);
294 iIMBS[i] = new TNode("IMBS","IMBS",iIMBSshape,0.0,0.0,0.0,0,0);
295 // place IMBS inside IMB0 with no translation and unit rotation matrix.
298 iITST->SetLineColor(kYellow);
301 iIMBS[i]->SetLineColor(kGreen);
302 fNodes->Add(iIMBS[i]);
305 //______________________________________________________________________
306 void AliITSvSPD02::CreateGeometry(){
307 ////////////////////////////////////////////////////////////////////////
308 // This routine defines and Creates the geometry for version 1 of the ITS.
309 // ALIC ALICE Mother Volume
310 // |- ITSV ITS Mother Volume
311 // |- IDET Detector under Test
312 // | |- ITS0 SPD Si Chip
313 // | | |- ITST SPD Sensitivve Volume
314 // | |- IPC0 *5 Readout chip
315 // |- ITEL *4 SPD Telescope
316 // |- IMB0 SPD Si Chip
317 // | |- IMBS SPD Sensitive volume
318 // |- ICMB Chip MiniBus.
325 ////////////////////////////////////////////////////////////////////////
327 switch (fGeomNumber){
329 CreateGeometry2002();
332 CreateGeometry2002();
336 //______________________________________________________________________
337 void AliITSvSPD02::CreateGeometry2002(){
338 ////////////////////////////////////////////////////////////////////////
339 // This routine defines and Creates the geometry for version 1 of the ITS.
340 // ALIC ALICE Mother Volume
341 // |- ITSV ITS Mother Volume
342 // |- IDET Detector under Test
343 // | |- ITS0 SPD Si Chip
344 // | | |- ITST SPD Sensitivve Volume
345 // | |- IPC0 *5 Readout chip
346 // |- ITEL *4 SPD Telescope
347 // |- IMB0 SPD Si Chip
348 // | |- IMBS SPD Sensitive volume
349 // |- ICMB Chip MiniBus.
356 ////////////////////////////////////////////////////////////////////////
358 // Define media off-set
359 Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
360 Int_t idrotm[4]; // Array of rotation matrix indexes
361 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
362 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
363 Float_t yposition= 0.0;
366 // Define Rotation-reflextion Matrixes needed
367 // 0 is the unit matrix
368 AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
372 gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
373 gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
375 //cout << "idtmed[0]=" << idtmed[0]<<endl;
376 //cout << "idtmed[1]=" << idtmed[1]<<endl;
377 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
378 // SPD part of telescope (MiniBuS)
379 data[0] = detMiniBusX = 0.705;
380 data[1] = detMiniBusY = 0.5*ddettelescope;
381 data[2] = detMiniBusZ = 3.536;
382 gMC->Gsvolu("IMB0", "BOX ", idtmed[1], data, 3); // contains detector
384 data[1] = 0.5*ddettelescope;
386 gMC->Gsvolu("IMBS","BOX ",idtmed[1],data,3); // sensitive detecor volulme
387 gMC->Gspos("IMBS",1,"IMB0",0.0,0.0,0.0,0,"ONLY"); // place IMBS inside
388 // IMB0 with no translation and unit rotation matrix.
389 Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
390 data[0] = chipMiniBusX = 0.793;
391 data[1] = chipMiniBusY = 0.5*dchipMiniBus;
392 data[2] = chipMiniBusZ = 0.68;
393 gMC->Gsvolu("ICMB","BOX ",idtmed[1],data, 3); // chip Minibus
394 data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
395 data[1] = detMiniBusY+chipMiniBusY;
396 data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
397 gMC->Gsvolu("ITEL","BOX ",idtmed[0],data,3);
398 gMC->Gspos("IMB0",1,"ITEL",0.0,data[1]-detMiniBusY,0.0,0,"ONLY");
399 gMC->Gspos("ICMB",1,"ITEL",0.0,-data[1]+chipMiniBusY,0.0,0,"ONLY");
402 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
403 data[0] = spdX = 0.705;
404 data[1] = spdY = 0.5*ddettest;
405 data[2] = spdZ = 3.536;
406 gMC->Gsvolu("ITS0", "BOX ", idtmed[1], data, 3); // contains detector
408 data[1] = 0.5*ddettest;
410 gMC->Gsvolu("ITST","BOX ",idtmed[1],data,3);// sensitive detecor volume
411 gMC->Gspos("ITST",1,"ITS0",0.0,0.0,0.0,0,"ONLY"); // place ITST inside
412 // ITS0 with no translation and unit rotation matrix.
413 data[0] = spdchipX = 0.793;
414 data[1] = spdchipY = 0.5*dchiptest;
415 data[2] = spdchipZ = 0.68;
416 gMC->Gsvolu("IPC0", "BOX ", idtmed[1],data,3); // chip under test
417 data[0] = TMath::Max(spdchipX,spdX);
418 data[1] = spdY+spdchipY;
419 data[2] = TMath::Max(spdchipZ,spdZ);
420 gMC->Gsvolu("IDET","BOX ",idtmed[0],data,3);
421 gMC->Gspos("ITS0",1,"IDET",0.0,data[1]-spdY,0.0,0,"ONLY");
422 for(Int_t i=-2;i<3;i++) gMC->Gspos("IPC0",i+3,"IDET",0.0,-data[1]+spdchipY,
423 i*2.*spdchipZ+i*0.25*(spdZ-5.*spdchipZ),0,"ONLY");
425 // Positions detectors, Beam Axis Z, X to the right, Y up to the sky.
426 Float_t p00X,p00Y,p00Z,p01X,p01Y,p01Z,p10X,p10Y,p10Z,p11X,p11Y,p11Z;
430 gMC->Gspos("ITEL",1,"ITSV",p00X,p00Y,p00Z,idrotm[0],"ONLY");
434 gMC->Gspos("ITEL",2,"ITSV",p01X,p01Y,p01Z,idrotm[0],"ONLY");
435 Float_t pdetX,pdetY,pdetZ;
437 pdetY = 0.0+yposition;
439 gMC->Gspos("IDET",1,"ITSV",pdetX,pdetY,pdetZ,idrotm[0],"ONLY");
443 gMC->Gspos("ITEL",3,"ITSV",p10X,p10Y,p10Z,idrotm[0],"ONLY");
447 gMC->Gspos("ITEL",4,"ITSV",p11X,p11Y,p11Z,idrotm[0],"ONLY");
449 //______________________________________________________________________
450 void AliITSvSPD02::CreateMaterials(){
451 ////////////////////////////////////////////////////////////////////////
453 // Create ITS SPD test beam materials
454 // This function defines the default materials used in the Geant
455 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
457 // In general it is automatically replaced by
458 // the CreateMaterials routine defined in AliITSv?. Should the function
459 // CreateMaterials not exist for the geometry version you are using this
460 // one is used. See the definition found in AliITSv5 or the other routine
461 // for a complete definition.
469 /////////////////////////////////////////////////////////////////////////
471 switch (fGeomNumber){
473 CreateMaterials2002();
476 CreateMaterials2002();
480 //______________________________________________________________________
481 void AliITSvSPD02::CreateMaterials2002(){
482 ////////////////////////////////////////////////////////////////////////
484 // Create ITS SPD test beam materials
485 // This function defines the default materials used in the Geant
486 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
488 // In general it is automatically replaced by
489 // the CreateMaterials routine defined in AliITSv?. Should the function
490 // CreateMaterials not exist for the geometry version you are using this
491 // one is used. See the definition found in AliITSv5 or the other routine
492 // for a complete definition.
500 /////////////////////////////////////////////////////////////////////////
501 Float_t tmaxfdSi = 0.1; // Degree
502 Float_t stemaxSi = 0.0075; // cm
503 Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
504 Float_t epsilSi = 1.0E-4;//
505 Float_t stminSi = 0.0; // cm "Default value used"
507 Float_t tmaxfdAir = 0.1; // Degree
508 Float_t stemaxAir = .10000E+01; // cm
509 Float_t deemaxAir = 0.1; // Fraction of particle's energy 0<deemax<=1
510 Float_t epsilAir = 1.0E-4;//
511 Float_t stminAir = 0.0; // cm "Default value used"
512 Int_t ifield = gAlice->Field()->Integ();
513 Float_t fieldm = gAlice->Field()->Max();
515 AliMaterial(1,"AIR$",0.14610E+02,0.73000E+01,0.12050E-02,
516 0.30423E+05,0.99900E+03);
517 AliMedium(1,"AIR$",1,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,
520 AliMaterial(2,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,
521 0.93600E+01,0.99900E+03);
522 AliMedium(2,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
525 //______________________________________________________________________
526 Int_t AliITSvSPD02::DecodeDetector(Int_t id,Int_t cpy,Int_t &lay,Int_t &lad,
528 // Based on the geometry tree defined in Geant 3.21, this
529 // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
532 // Int_t id Detector volume id
533 // Int_t cpy Detector copy number
535 // Int_t lay layer number
536 // Int_t lad ladder number
537 // Int_t det detector number
544 if(cpy>2 && id==fIdSens[0]) lay = cpy + 1;
545 if(id==fIdSens[1]) lay = 3;
549 //______________________________________________________________________
550 void AliITSvSPD02::InitAliITSgeom(){
551 // Based on the geometry tree defined in Geant 3.21, this
552 // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
560 const Int_t kltypess=2;
561 const Int_t knlayers=5;
562 const TString knames[kltypess]=
563 {"ALIC_1/ITSV_1/ITEL_%d/IMB0_1/IMBS_1",//lay=1,2,4,5
564 "ALIC_1/ITSV_1/IDET_%d/ITS0_1/ITST_1"};// lay=3
565 const Int_t kitsGeomTreeCopys[2]={4,1};
566 const Int_t knlad[knlayers]={knlayers*1},kndet[knlayers]={knlayers*1};
567 TString path,shapeName;
571 Double_t trans[3]={3*0.0},rot[10]={10*0.0};
572 Int_t npar=3,mod,i,j,lay,lad,det,cpy;
575 par[0]=0.64;par[1]=0.5*300.0E-4;par[2]=3.48;
577 AliITSgeom* geom = new AliITSgeom(0,knlayers,knlad,kndet,mod);
579 for(i=0;i<kltypess;i++)for(cpy=1;cpy<=kitsGeomTreeCopys[i];cpy++){
580 path.Form(knames[i].Data(),cpy);
581 gMC->GetTransformation(path.Data(),matrix);
582 gMC->GetShape(path.Data(),shapeName,shapePar);
583 shapeParF.Set(shapePar.GetSize());
584 for(j=0;j<shapePar.GetSize();j++) shapeParF[j]=shapePar[j];
585 mod = DecodeDetector(fIdSens[i],cpy,lay,lad,det);
586 geom->CreateMatrix(mod,lay,lad,det,kSPD,trans,rot);
587 geom->SetTrans(mod,matrix.GetTranslation());
588 geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
589 geom->GetGeomMatrix(mod)->SetPath(path.Data());
590 if(!(geom->IsShapeDefined((Int_t)kSPD)))
591 geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(npar,par));
595 //______________________________________________________________________
596 void AliITSvSPD02::Init(){
597 ////////////////////////////////////////////////////////////////////////
598 // Initialise the ITS after it has been created.
605 ////////////////////////////////////////////////////////////////////////
609 for(i=0;i<26;i++) cout << "*";
610 cout << " ITSvSPD02" << fMinorVersion << "_Init ";
611 for(i=0;i<25;i++) cout << "*";cout << endl;
613 if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
614 if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
615 if(GetITSgeom()!=0) SetITSgeom(0x0);
616 AliITSgeom* geom = new AliITSgeom();
618 if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
619 if(!fGeomDetIn) this->InitAliITSgeom();
620 if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
623 for(i=0;i<72;i++) cout << "*";
625 if(gMC) fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
628 //______________________________________________________________________
629 void AliITSvSPD02::SetDefaults(){
630 // sets the default segmentation, response, digit and raw cluster classes
637 const Float_t kconv = 1.0e+04; // convert cm to microns
639 Info("SetDefaults","Setting up only SPD detector");
641 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
642 fDetTypeSim->SetITSgeom(GetITSgeom());
645 Float_t bx[256],bz[280];
646 fDetTypeSim->ResetCalibrationArray();
647 fDetTypeSim->ResetSegmentation();
650 // Get shape info. Do it this way for now.
651 s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD);
652 AliITSCalibration *resp0=new AliITSCalibrationSPD();
653 resp0->SetTemperature();
654 resp0->SetDistanceOverVoltage();
655 SetCalibrationModel(0,resp0);
657 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD();
658 seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
659 s0->GetDz()*2.*kconv, // for now.
660 s0->GetDy()*2.*kconv); // x,z,y full width in microns.
661 seg0->SetNPads(256,160);// Number of Bins in x and z
662 for(i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns.
663 for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
664 for(i=160;i<280;i++) bz[i] = 0.0; // Outside of detector.
665 bz[ 31] = bz[ 32] = 625.0; // first chip boundry
666 bz[ 63] = bz[ 64] = 625.0; // first chip boundry
667 bz[ 95] = bz[ 96] = 625.0; // first chip boundry
668 bz[127] = bz[128] = 625.0; // first chip boundry
669 bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
670 seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
671 SetSegmentationModel(kSPD,seg0);
672 // set digit and raw cluster classes to be used
673 const char *kData0=(fDetTypeSim->GetCalibrationModel(0))->DataType();
674 if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit");
675 else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
676 // SetSimulationModel(kSPD,new AliITSsimulationSPDdubna(seg0,resp0));
677 // iDetType->ReconstructionModel(new AliITSClusterFinderSPD());
680 SetResponseModel(kSDD,new AliITSCalibrationSDD());
681 SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
682 DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
684 SetResponseModel(kSSD,new AliITSCalibrationSSD());
685 SetSegmentationModel(kSSD,new AliITSsegmentationSSD());
686 DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
689 Warning("SetDefaults",
690 "Only the four basic detector types are initialised!");
694 //______________________________________________________________________
695 void AliITSvSPD02::SetDefaultSimulation(){
696 // sets the default simulation.
705 Warning("SetDefaultSimulation","ITS geometry is null!");
709 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
710 AliITSsimulation *sim;
711 //AliITSsegmentation *seg;
712 //AliITSCalibration *res;
714 sim = fDetTypeSim->GetSimulationModel(kSPD);
716 //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
717 //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD());
718 sim = new AliITSsimulationSPD(fDetTypeSim);
719 SetSimulationModel(kSPD,sim);
720 }else{ // simulation exists, make sure it is set up properly.
721 sim->SetCalibrationModel(GetITSgeom()->GetStartSPD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD()));
722 sim->SetSegmentationModel(kSPD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
729 sim = fDetTypeSim->GetSimulationModel(kSDD);
731 seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
732 res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
733 sim = new AliITSsimulationSDD(seg,res);
734 SetSimulationModel(kSDD,sim);
735 }else{ // simulation exists, make sure it is set up properly.
736 sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()));
737 sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
742 sim = fDetTypeSim->GetSimulationModel(kSSD);
744 seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
745 res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
746 sim = new AliITSsimulationSSD(seg,res);
747 SetSimulationModel(kSSD,sim);
748 }else{ // simulation exists, make sure it is set up properly.
749 sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()));
750 sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
756 //______________________________________________________________________
757 void AliITSvSPD02::DrawModule() const {
758 ////////////////////////////////////////////////////////////////////////
759 // Draw a shaded view of the ITS SPD test beam version 1.
766 ////////////////////////////////////////////////////////////////////////
767 // Set everything unseen
768 gMC->Gsatt("*", "seen", -1);
769 // Set ALIC mother visible
770 gMC->Gsatt("ALIC","SEEN",0);
771 // Set ALIC ITS visible
772 gMC->Gsatt("ITSV","SEEN",0);
773 // Set ALIC Telescopes visible
774 gMC->Gsatt("ITEL","SEEN",0);
775 // Set ALIC detetcor visible
776 gMC->Gsatt("IDET","SEEN",0);
777 // Set Detector chip mother visible and drawn
778 gMC->Gsatt("IPC0","SEEN",1);
779 // Set Detector mother visible and drawn
780 gMC->Gsatt("ITS0","SEEN",1);
781 // Set minibus chip mother visible and drawn
782 gMC->Gsatt("ICMB","SEEN",1);
783 // Set minibus mother visible and drawn
784 gMC->Gsatt("IMB0","SEEN",1);
786 //______________________________________________________________________
787 void AliITSvSPD02::StepManager(){
788 ////////////////////////////////////////////////////////////////////////
789 // Called for every step in the ITS SPD test beam, then calles the
790 // AliITShit class creator with the information to be recoreded about
792 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
793 // printing of information to a file which can be used to create a .det
794 // file read in by the routine CreateGeometry(). If set to 0 or any other
795 // value except 1, the default behavior, then no such file is created nor
796 // it the extra variables and the like used in the printing allocated.
803 ////////////////////////////////////////////////////////////////////////
805 TLorentzVector position, momentum;
806 static TLorentzVector position0;
807 static Int_t stat0=0;
808 if((id=gMC->CurrentVolID(copy) == fIDMother)&&
809 (gMC->IsTrackEntering()||gMC->IsTrackExiting())){
810 copy = fTrackReferences->GetEntriesFast();
811 TClonesArray &lTR = *fTrackReferences;
812 // Fill TrackReference structure with this new TrackReference.
813 new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->
814 GetCurrentTrackNumber());
815 } // if Outer ITS mother Volume
816 if(!(this->IsActive())){
818 } // end if !Active volume.
820 TClonesArray &lhits = *fHits;
825 if(gMC->IsTrackInside()) vol[3] += 1;
826 if(gMC->IsTrackEntering()) vol[3] += 2;
827 if(gMC->IsTrackExiting()) vol[3] += 4;
828 if(gMC->IsTrackOut()) vol[3] += 8;
829 if(gMC->IsTrackDisappeared()) vol[3] += 16;
830 if(gMC->IsTrackStop()) vol[3] += 32;
831 if(gMC->IsTrackAlive()) vol[3] += 64;
833 // Fill hit structure.
834 if(!(gMC->TrackCharge())) return;
835 id = gMC->CurrentVolID(copy);
836 if(id==fIdSens[0]){ // Volume name "IMBS"
837 vol[2] = vol[1] = 1; // Det, ladder
838 id = gMC->CurrentVolOffID(2,copy);
839 //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
840 vol[0] = copy; // Lay
842 } else if(id == fIdSens[1]){ // Volume name "ITST"
844 vol[1] = 1; // ladder
845 id = gMC->CurrentVolOffID(2,copy);
846 //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
847 vol[2] = 1; // detector
848 } else return; // end if
850 gMC->TrackPosition(position);
851 gMC->TrackMomentum(momentum);
853 if(gMC->IsTrackEntering()){
854 position0 = position;
857 } // end if IsEntering
858 // Fill hit structure with this new hit only for non-entrerance hits.
859 else new(lhits[fNhits++]) AliITShit(fIshunt,
860 gAlice->GetMCApp()->GetCurrentTrackNumber(),
861 vol,gMC->Edep(),gMC->TrackTime(),
862 position,position0,momentum);
864 position0 = position;