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>
19 #include <TGeoManager.h>
21 #include <TLorentzVector.h>
22 #include <TClonesArray.h>
24 #include <TGeoMatrix.h>
25 #include <TVirtualMC.h>
29 #include "AliTrackReference.h"
31 #include "AliITShit.h"
33 #include "AliITSvSPD02.h"
34 #include "AliITSgeom.h"
35 #include "AliITSgeomSPD.h"
36 #include "AliITSDetTypeSim.h"
37 #include "AliITSCalibrationSPD.h"
38 #include "AliITSsegmentationSPD.h"
39 #include "AliITSsimulationSPD.h"
43 ///////////////////////////////////////////////////////////////////////
48 // geometry of summer 2002
50 ///////////////////////////////////////////////////////////////////////
51 ClassImp(AliITSvSPD02)
53 //______________________________________________________________________
54 AliITSvSPD02::AliITSvSPD02():
58 fMajorVersion((Int_t)kvSPD02),
70 ////////////////////////////////////////////////////////////////////////
71 // Standard default constructor for the ITS SPD test beam 2002 version 1.
77 // A default created class.
78 ////////////////////////////////////////////////////////////////////////
81 for(i=0;i<60;i++) fRead[i] = '\0';
82 for(i=0;i<60;i++) fWrite[i] = '\0';
83 for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
85 //______________________________________________________________________
86 AliITSvSPD02::AliITSvSPD02(const char *title,Int_t gn) : AliITS("ITS", title),
101 ////////////////////////////////////////////////////////////////////////
102 // Standard constructor for the ITS SPD testbeam 2002 version 1.
104 // const char *title title for this ITS geometry.
105 // Int_t gn Geometry version number (year) default 2002.
109 // A standard created class.
110 ////////////////////////////////////////////////////////////////////////
115 fIdName = new TString[fIdN];
118 fIdSens = new Int_t[fIdN];
119 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
125 fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vSPD022.euc";
126 strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vSPD022.det",60);
127 strncpy(fRead,fEuclidGeomDet,60);
128 strncpy(fWrite,fEuclidGeomDet,60);
130 //______________________________________________________________________
131 AliITSvSPD02::~AliITSvSPD02() {
132 ////////////////////////////////////////////////////////////////////////
133 // Standard destructor for the ITS SPD test beam 2002 version 1.
140 ////////////////////////////////////////////////////////////////////////
142 //______________________________________________________________________
143 void AliITSvSPD02::BuildGeometry(){
144 ////////////////////////////////////////////////////////////////////////
145 // Geometry builder for the ITS SPD test beam 2002 version 1.
146 // ALIC ALICE Mother Volume
147 // |- ITSV ITS Mother Volume
148 // |- IDET Detector under Test
149 // | |- ITS0 SPD Si Chip
150 // | | |- ITST SPD Sensitivve Volume
151 // | |- IPC0 *5 Readout chip
152 // |- ITEL *4 SPD Telescope
153 // |- IMB0 SPD Si Chip
154 // | |- IMBS SPD Sensitive volume
155 // |- ICMB Chip MiniBus.
162 ////////////////////////////////////////////////////////////////////////
163 // Get the top alice volume.
165 switch (fGeomNumber){
174 //______________________________________________________________________
175 void AliITSvSPD02::BuildGeometry2002(){
176 ////////////////////////////////////////////////////////////////////////
177 // Geometry builder for the ITS SPD test beam 2002 version 1.
178 // ALIC ALICE Mother Volume
179 // |- ITSV ITS Mother Volume
180 // |- IDET Detector under Test
181 // | |- ITS0 SPD Si Chip
182 // | | |- ITST SPD Sensitivve Volume
183 // | |- IPC0 *5 Readout chip
184 // |- ITEL *4 SPD Telescope
185 // |- IMB0 SPD Si Chip
186 // | |- IMBS SPD Sensitive volume
187 // |- ICMB Chip MiniBus.
194 ////////////////////////////////////////////////////////////////////////
195 // Get the top alice volume.
196 TNode *aALIC = gAlice->GetGeometry()->GetNode("alice");
199 // Define ITS Mother Volume
201 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
202 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
203 //Float_t yposition= 0.0;
204 TRotMatrix *r0 = new TRotMatrix("ITSidrotm0","ITSidrotm0",
205 90.0,0,0.0,0,90.0,270.0);
209 TBRIK *iITSVshape = new TBRIK("ITSVshape",
210 "ITS Logical Mother Volume","Air",
211 data[0],data[1],data[2]);
212 TNode *iITSV = new TNode("ITSV","ITS Mother Volume",iITSVshape,
214 iITSV->cd(); // set ourselve into ITSV subvolume of aALIC
216 // SPD part of telescope (MiniBuS)
218 data[1] = 0.5*ddettelescope;
220 TBRIK *iIMB0shape = new TBRIK("IMB0shape","SPD wafer","Si",
221 data[0],data[1],data[2]);
222 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
223 data[0] = detMiniBusX = 0.64;
224 data[1] = detMiniBusY = 0.5*ddettelescope;
225 data[2] = detMiniBusZ = 3.48;
226 TBRIK *iIMBSshape = new TBRIK("IMBSshape","SPD Sensitive volume","Si",
227 data[0],data[1],data[2]);
228 Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
229 data[0] = chipMiniBusX = 0.793;
230 data[1] = chipMiniBusY = 0.5*dchipMiniBus;
231 data[2] = chipMiniBusZ = 0.68;
232 TBRIK *iICMBshape = new TBRIK("ICMBshape","chip Minibus","Si",
233 data[0],data[1],data[2]);
234 data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
235 data[1] = detMiniBusY+chipMiniBusY;
236 data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
237 TBRIK *iITELshape = new TBRIK("ITELshape","ITELshape","Air",
238 data[0],data[1],data[2]);
241 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
245 TBRIK *iITS0shape = new TBRIK("ITS0shape","SPD wafer","Si",
246 data[0],data[1],data[2]); // contains detector
247 data[0] = spdX = 0.64;
248 data[1] = spdY = ddettest;
249 data[2] = spdZ = 3.48;
250 TBRIK *iITSTshape = new TBRIK("ITSTshape","SPD sensitive volume","Si",
251 data[0],data[1],data[2]);
252 // ITS0 with no translation and unit rotation matrix.
253 data[0] = spdchipX = 0.793;
254 data[1] = spdchipY = dchiptest;
255 data[2] = spdchipZ = 0.68;
256 TBRIK *iIPC0shape = new TBRIK("IPC0shape","Readout Chips","Si",
257 data[0],data[1],data[2]); // chip under test
258 data[0] = TMath::Max(spdchipX,spdX);
259 data[1] = spdY+spdchipY;
260 data[2] = TMath::Max(spdchipZ,spdZ);
261 TBRIK *iIDETshape = new TBRIK("IDETshape","Detector Under Test","Air",
262 data[0],data[1],data[2]);
263 // Place volumes in geometry
265 char name[20],title[50];
266 Double_t px=0.0,py=0.0,pz[4]={-38.0,0.0,0.0,0.0};
268 pz[2] = pz[1]+38.0+spdY+spdchipY+34.5;
270 TNode *iITEL[4],*iICMB[4],*iIMB0[4],*iIMBS[4];
271 TNode *iIDET = new TNode("IDET","Detector Under Test",iIDETshape,
272 0.0,0.0,pz[1]+38.0,r0,0);
274 TNode *iITS0 = new TNode("ITS0","SPD Chip",iITS0shape,
275 0.0,iIDETshape->GetDy()-spdY,0.0,0,0);
277 for(i=0;i<5;i++) { //place readout chips on the back of SPD chip under test
278 sprintf(name,"IPC0%d",i);
279 sprintf(title,"Readout chip #%d",i+1);
281 iIPC0[i] = new TNode(name,title,iIPC0shape,
282 0.0,spdchipY-iIDETshape->GetDy(),
283 j*2.0*spdchipZ+j*0.25*(spdZ-5.*spdchipZ),0,0);
286 TNode *iITST = new TNode("ITST","SPD sensitive volume",iITSTshape,
290 sprintf(name,"ITEL%d",i);
291 sprintf(title,"Test beam telescope element #%d",i+1);
292 iITEL[i] = new TNode(name,title,iITELshape,px,py,pz[i],r0,0);
294 iICMB[i] = new TNode("ICMB","Chip MiniBus",iICMBshape,
295 0.0,-iITELshape->GetDy()+detMiniBusY,0.0,0,0);
296 iIMB0[i] = new TNode("IMB0","Chip MiniBus",iIMB0shape,
297 0.0, iITELshape->GetDy()-detMiniBusY,0.0,0,0);
299 iIMBS[i] = new TNode("IMBS","IMBS",iIMBSshape,0.0,0.0,0.0,0,0);
300 // place IMBS inside IMB0 with no translation and unit rotation matrix.
303 iITST->SetLineColor(kYellow);
306 iIMBS[i]->SetLineColor(kGreen);
307 fNodes->Add(iIMBS[i]);
310 //______________________________________________________________________
311 void AliITSvSPD02::CreateGeometry(){
312 ////////////////////////////////////////////////////////////////////////
313 // This routine defines and Creates the geometry for version 1 of the ITS.
314 // ALIC ALICE Mother Volume
315 // |- ITSV ITS Mother Volume
316 // |- IDET Detector under Test
317 // | |- ITS0 SPD Si Chip
318 // | | |- ITST SPD Sensitivve Volume
319 // | |- IPC0 *5 Readout chip
320 // |- ITEL *4 SPD Telescope
321 // |- IMB0 SPD Si Chip
322 // | |- IMBS SPD Sensitive volume
323 // |- ICMB Chip MiniBus.
330 ////////////////////////////////////////////////////////////////////////
332 switch (fGeomNumber){
334 CreateGeometry2002();
337 CreateGeometry2002();
341 //______________________________________________________________________
342 void AliITSvSPD02::CreateGeometry2002(){
343 ////////////////////////////////////////////////////////////////////////
344 // This routine defines and Creates the geometry for version 1 of the ITS.
345 // ALIC ALICE Mother Volume
346 // |- ITSV ITS Mother Volume
347 // |- IDET Detector under Test
348 // | |- ITS0 SPD Si Chip
349 // | | |- ITST SPD Sensitivve Volume
350 // | |- IPC0 *5 Readout chip
351 // |- ITEL *4 SPD Telescope
352 // |- IMB0 SPD Si Chip
353 // | |- IMBS SPD Sensitive volume
354 // |- ICMB Chip MiniBus.
356 // ITEL ITEL IDET ITEL ITEL
357 // Z-> -38 -36 02 36.5 38.5
366 ////////////////////////////////////////////////////////////////////////
368 // Define media off-set
369 Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
370 Int_t idrotm[4]; // Array of rotation matrix indexes
371 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
372 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
373 Float_t yposition= 0.0;
374 // These constant character strings are set by cvs during commit
375 // do not change them unless you know what you are doing!
376 const Char_t *cvsDate="$Date$";
377 const Char_t *cvsRevision="$Revision$";
380 // Define Rotation-reflextion Matrixes needed
381 // 0 is the unit matrix
382 AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
387 gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
388 gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
390 TGeoVolumeAssembly *itsV = gGeoManager->MakeVolumeAssembly("ITSV");
391 const Int_t length=100;
392 Char_t vstrng[length];
393 if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
394 fMinorVersion,cvsDate,cvsRevision))
395 itsV->SetTitle(vstrng);
396 else Error("CreateGeometry","Error writing/setting version string");
397 TGeoVolume *alic = gGeoManager->GetVolume("ALIC");
399 Error("CreateGeometry","alic=0");
402 // See idrotm[199] for angle definitions.
403 alic->AddNode(itsV,1,0);
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 CreateMaterials 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 CreateMaterials 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::Init(){
557 // Initialise the ITS after it has been created.
565 AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
568 UpdateInternalGeometry();
570 if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
573 fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
577 //______________________________________________________________________
578 void AliITSvSPD02::SetDefaults(){
579 // sets the default segmentation, response, digit and raw cluster classes
586 const Float_t kconv = 1.0e+04; // convert cm to microns
588 Info("SetDefaults","Setting up only SPD detector");
590 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
591 fDetTypeSim->SetITSgeom(GetITSgeom());
594 Float_t bx[256],bz[280];
595 fDetTypeSim->ResetCalibrationArray();
596 fDetTypeSim->ResetSegmentation();
599 // Get shape info. Do it this way for now.
600 s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD);
601 AliITSCalibration *resp0=new AliITSCalibrationSPD();
602 resp0->SetTemperature();
603 resp0->SetDistanceOverVoltage();
604 SetCalibrationModel(0,resp0);
606 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD();
607 seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
608 s0->GetDz()*2.*kconv, // for now.
609 s0->GetDy()*2.*kconv); // x,z,y full width in microns.
610 seg0->SetNPads(256,160);// Number of Bins in x and z
611 for(i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns.
612 for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
613 for(i=160;i<280;i++) bz[i] = 0.0; // Outside of detector.
614 bz[ 31] = bz[ 32] = 625.0; // first chip boundry
615 bz[ 63] = bz[ 64] = 625.0; // first chip boundry
616 bz[ 95] = bz[ 96] = 625.0; // first chip boundry
617 bz[127] = bz[128] = 625.0; // first chip boundry
618 bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
619 seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
620 SetSegmentationModel(kSPD,seg0);
621 // set digit and raw cluster classes to be used
622 const char *kData0=(fDetTypeSim->GetCalibrationModel(0))->DataType();
623 if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit");
624 else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
625 // SetSimulationModel(kSPD,new AliITSsimulationSPDdubna(seg0,resp0));
626 // iDetType->ReconstructionModel(new AliITSClusterFinderSPD());
629 // SetResponseModel(kSDD,new AliITSCalibrationSDD());
630 // SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
631 // DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
633 // SetResponseModel(kSSD,new AliITSCalibrationSSD());
634 // SetSegmentationModel(kSSD,new AliITSsegmentationSSD());
635 // DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
638 Warning("SetDefaults",
639 "Only the four basic detector types are initialised!");
643 //______________________________________________________________________
644 void AliITSvSPD02::SetDefaultSimulation(){
645 // sets the default simulation.
654 Warning("SetDefaultSimulation","ITS geometry is null!");
658 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
659 AliITSsimulation *sim;
660 //AliITSsegmentation *seg;
661 //AliITSCalibration *res;
663 sim = fDetTypeSim->GetSimulationModel(kSPD);
665 //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
666 //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD());
667 sim = new AliITSsimulationSPD(fDetTypeSim);
668 SetSimulationModel(kSPD,sim);
669 }else{ // simulation exists, make sure it is set up properly.
670 sim->SetCalibrationModel(GetITSgeom()->GetStartSPD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD()));
671 sim->SetSegmentationModel(kSPD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
677 // sim = fDetTypeSim->GetSimulationModel(kSDD);
679 // seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
680 // res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
681 // sim = new AliITSsimulationSDD(seg,res);
682 // SetSimulationModel(kSDD,sim);
683 // }else{ // simulation exists, make sure it is set up properly.
684 // sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()));
685 // sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
688 // } // end if iDetType
690 // sim = fDetTypeSim->GetSimulationModel(kSSD);
692 // seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
693 // res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
694 // sim = new AliITSsimulationSSD(seg,res);
695 // SetSimulationModel(kSSD,sim);
696 // }else{ // simulation exists, make sure it is set up properly.
697 // sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()));
698 // sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
704 //______________________________________________________________________
705 void AliITSvSPD02::DrawModule() const {
706 ////////////////////////////////////////////////////////////////////////
707 // Draw a shaded view of the ITS SPD test beam version 1.
714 ////////////////////////////////////////////////////////////////////////
715 // Set everything unseen
716 gMC->Gsatt("*", "seen", -1);
717 // Set ALIC mother visible
718 gMC->Gsatt("ALIC","SEEN",0);
719 // Set ALIC ITS visible
720 gMC->Gsatt("ITSV","SEEN",0);
721 // Set ALIC Telescopes visible
722 gMC->Gsatt("ITEL","SEEN",0);
723 // Set ALIC detetcor visible
724 gMC->Gsatt("IDET","SEEN",0);
725 // Set Detector chip mother visible and drawn
726 gMC->Gsatt("IPC0","SEEN",1);
727 // Set Detector mother visible and drawn
728 gMC->Gsatt("ITS0","SEEN",1);
729 // Set minibus chip mother visible and drawn
730 gMC->Gsatt("ICMB","SEEN",1);
731 // Set minibus mother visible and drawn
732 gMC->Gsatt("IMB0","SEEN",1);
734 //______________________________________________________________________
735 void AliITSvSPD02::StepManager(){
736 ////////////////////////////////////////////////////////////////////////
737 // Called for every step in the ITS SPD test beam, then calles the
738 // AliITShit class creator with the information to be recoreded about
740 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
741 // printing of information to a file which can be used to create a .det
742 // file read in by the routine CreateGeometry(). If set to 0 or any other
743 // value except 1, the default behavior, then no such file is created nor
744 // it the extra variables and the like used in the printing allocated.
751 ////////////////////////////////////////////////////////////////////////
753 if(!(this->IsActive())){
755 } // end if !Active volume.
756 if(!(gMC->TrackCharge())) return;
758 Int_t cpy0=0,cpy1=0,id,mod,ncpys,status;
759 TLorentzVector position, momentum;
760 static AliITShit hit;// Saves on calls to construtors
761 //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
762 TClonesArray &lhits = *(Hits());
767 if(gMC->IsTrackInside()) status += 1;
768 if(gMC->IsTrackEntering()) status += 2;
769 if(gMC->IsTrackExiting()) status += 4;
770 if(gMC->IsTrackOut()) status += 8;
771 if(gMC->IsTrackDisappeared()) status += 16;
772 if(gMC->IsTrackStop()) status += 32;
773 if(gMC->IsTrackAlive()) status += 64;
775 // Fill hit structure.
776 id = gMC->CurrentVolID(cpy0);
777 if(id==fIdSens[0]){ // Volume name "IMBS". Det=1, ladder=1
779 } else if(id == fIdSens[1]){ // Volume name "ITST"
781 } else return; // end if
782 id = gMC->CurrentVolOffID(2,cpy1);
783 fIgm.DecodeDetector(mod,ncpys,cpy0,cpy1,0);
785 // Fill hit structure.
788 hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
789 gMC->TrackPosition(position);
790 gMC->TrackMomentum(momentum);
791 hit.SetPosition(position);
792 hit.SetTime(gMC->TrackTime());
793 hit.SetMomentum(momentum);
794 hit.SetStatus(status);
795 hit.SetEdep(gMC->Edep());
796 hit.SetShunt(GetIshunt());
797 if(gMC->IsTrackEntering()){
798 hit.SetStartPosition(position);
799 hit.SetStartTime(gMC->TrackTime());
800 hit.SetStartStatus(status);
801 return; // don't save entering hit.
802 } // end if IsEntering
803 // Fill hit structure with this new hit.
804 //Info("StepManager","Calling Copy Constructor");
805 new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
806 // Save old position... for next hit.
807 hit.SetStartPosition(position);
808 hit.SetStartTime(gMC->TrackTime());
809 hit.SetStartStatus(status);