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 **************************************************************************/
20 #include <Riostream.h>
24 #include <TGeometry.h>
30 //#include <TFile.h> // only required for Tracking function?
31 //#include <TCanvas.h>
32 //#include <TObjArray.h>
33 #include <TLorentzVector.h>
34 //#include <TObjString.h>
35 //#include <TClonesArray.h>
36 //#include <TSystem.h>
37 #include <TVirtualMC.h>
42 //#include "AliConst.h"
43 #include "AliITSGeant3Geometry.h"
44 #include "AliTrackReference.h"
45 #include "AliITShit.h"
47 #include "AliITSvSDD03.h"
48 #include "AliITSgeom.h"
49 #include "AliITSgeomSPD.h"
50 #include "AliITSgeomSDD.h"
51 #include "AliITSgeomSSD.h"
52 #include "AliITSDetType.h"
53 #include "AliITSresponseSPD.h"
54 #include "AliITSresponseSDD.h"
55 #include "AliITSresponseSSD.h"
56 #include "AliITSsegmentationSPD.h"
57 #include "AliITSsegmentationSDD.h"
58 #include "AliITSsegmentationSSD.h"
59 #include "AliITSsimulationSPD.h"
60 #include "AliITSsimulationSDD.h"
61 #include "AliITSsimulationSSD.h"
62 //#include "AliITSClusterFinderSPD.h"
63 //#include "AliITSClusterFinderSDD.h"
64 //#include "AliITSClusterFinderSSD.h"
66 ClassImp(AliITSvSDD03)
68 //______________________________________________________________________
69 AliITSvSDD03::AliITSvSDD03() :
84 ////////////////////////////////////////////////////////////////////////
85 // Standard default constructor for the ITS SDD test beam 2002 version 1.
91 // A default created class.
92 ////////////////////////////////////////////////////////////////////////
98 fEuclidOut = kFALSE; // Don't write Euclide file
99 fGeomDetOut = kFALSE; // Don't write .det file
100 fGeomDetIn = kFALSE; // Don't Read .det file
101 fMajorVersion = IsVersion();
103 for(i=0;i<60;i++) fRead[i] = '\0';
104 for(i=0;i<60;i++) fWrite[i] = '\0';
105 for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
107 //______________________________________________________________________
108 AliITSvSDD03::AliITSvSDD03(const char *title,Int_t year):
109 AliITS("ITS", title),
123 ////////////////////////////////////////////////////////////////////////
124 // Standard constructor for the ITS SDD testbeam 2002 version 1.
126 // const char *title title for this ITS geometry.
130 // A standard created class.
131 ////////////////////////////////////////////////////////////////////////
135 fIdName = new TString[fIdN];
139 fIdSens = new Int_t[fIdN];
140 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
141 fMajorVersion = IsVersion();
143 fEuclidOut = kFALSE; // Don't write Euclide file
144 fGeomDetOut = kFALSE; // Don't write .det file
145 fGeomDetIn = kFALSE; // Don't Read .det file
152 fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vSDD032.euc";
153 strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vSDD032.det",60);
154 strncpy(fRead,fEuclidGeomDet,60);
155 strncpy(fWrite,fEuclidGeomDet,60);
157 //______________________________________________________________________
158 AliITSvSDD03::AliITSvSDD03(const AliITSvSDD03 &source) :
173 ////////////////////////////////////////////////////////////////////////
174 // Copy Constructor for ITS SDD test beam 2002 version 1.
175 // This class is not to be copied. Function only dummy.
177 // const AliITSvSDD03 &source The class to be copied
181 // A warning message.
182 ////////////////////////////////////////////////////////////////////////
183 if(&source == this) return;
184 Warning("Copy Constructor","Not allowed to copy AliITSvSDD03");
187 //______________________________________________________________________
188 AliITSvSDD03& AliITSvSDD03::operator=(const AliITSvSDD03 &source){
189 ////////////////////////////////////////////////////////////////////////
190 // Assignment operator for the ITS SDD test beam 2002 version 1.
191 // This class is not to be copied. Function only dummy.
193 // const AliITSvSDD03 &source The class to be copied
198 ////////////////////////////////////////////////////////////////////////
199 if(&source == this) return *this;
200 Warning("= operator","Not allowed to copy AliITSvSDD03");
203 //______________________________________________________________________
204 AliITSvSDD03::~AliITSvSDD03() {
205 ////////////////////////////////////////////////////////////////////////
206 // Standard destructor for the ITS SDD test beam 2002 version 1.
213 ////////////////////////////////////////////////////////////////////////
215 //______________________________________________________________________
216 void AliITSvSDD03::BuildGeometry(){
217 ////////////////////////////////////////////////////////////////////////
218 // Geometry builder for the ITS SDD test beam 2002 version 1.
219 // ALIC ALICE Mother Volume
220 // |- ITSV ITS Mother Volume
221 // |- IDET Detector under Test
222 // | |- ITS0 SDD Si Chip
223 // | | |- ITST SDD Sensitivve Volume
224 // | |- IPC0 *5 Readout chip
225 // |- ITEL *4 SDD Telescope
226 // |- IMB0 SDD Si Chip
227 // | |- IMBS SDD Sensitive volume
228 // |- ICMB Chip MiniBus.
235 ////////////////////////////////////////////////////////////////////////
236 // Get the top alice volume.
237 TNode *nALIC = gAlice->GetGeometry()->GetNode("alice");
240 // Define ITS Mother Volume
242 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
243 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
244 //Float_t yposition= 0.0;
245 TRotMatrix *r0 = new TRotMatrix("ITSidrotm0","ITSidrotm0",
246 90.0,0,0.0,0,90.0,270.0);
250 TBRIK *sITSVshape =new TBRIK("ITSVshape","ITS Logical Mother Volume","Air",
251 data[0],data[1],data[2]);
252 TNode *sITSV = new TNode("ITSV","ITS Mother Volume",sITSVshape,
254 sITSV->cd(); // set ourselve into ITSV subvolume of ALIC
256 // SDD part of telescope (MiniBuS)
258 data[1] = 0.5*ddettelescope;
260 TBRIK *sIMB0shape = new TBRIK("IMB0shape","SDD wafer","Si",
261 data[0],data[1],data[2]);
262 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
263 data[0] = detMiniBusX = 0.64;
264 data[1] = detMiniBusY = 0.5*ddettelescope;
265 data[2] = detMiniBusZ = 3.48;
266 TBRIK *sIMBSshape = new TBRIK("IMBSshape","SDD Sensitive volume","Si",
267 data[0],data[1],data[2]);
268 Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
269 data[0] = chipMiniBusX = 0.793;
270 data[1] = chipMiniBusY = 0.5*dchipMiniBus;
271 data[2] = chipMiniBusZ = 0.68;
272 TBRIK *sICMBshape = new TBRIK("ICMBshape","chip Minibus","Si",
273 data[0],data[1],data[2]);
274 data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
275 data[1] = detMiniBusY+chipMiniBusY;
276 data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
277 TBRIK *sITELshape = new TBRIK("ITELshape","ITELshape","Air",
278 data[0],data[1],data[2]);
281 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
285 TBRIK *sITS0shape = new TBRIK("ITS0shape","SDD wafer","Si",
286 data[0],data[1],data[2]); // contains detector
287 data[0] = spdX = 0.64;
288 data[1] = spdY = ddettest;
289 data[2] = spdZ = 3.48;
290 TBRIK *sITSTshape = new TBRIK("ITSTshape","SDD sensitive volume","Si",
291 data[0],data[1],data[2]);
292 // ITS0 with no translation and unit rotation matrix.
293 data[0] = spdchipX = 0.793;
294 data[1] = spdchipY = dchiptest;
295 data[2] = spdchipZ = 0.68;
296 TBRIK *sIPC0shape = new TBRIK("IPC0shape","Readout Chips","Si",
297 data[0],data[1],data[2]); // chip under test
298 data[0] = TMath::Max(spdchipX,spdX);
299 data[1] = spdY+spdchipY;
300 data[2] = TMath::Max(spdchipZ,spdZ);
301 TBRIK *sIDETshape = new TBRIK("IDETshape","Detector Under Test","Air",
302 data[0],data[1],data[2]);
303 // Place volumes in geometry
305 char name[20],title[50];
306 Double_t px=0.0,py=0.0,pz[4]={-38.0,0.0,0.0,0.0};
308 pz[2] = pz[1]+38.0+spdY+spdchipY+34.5;
310 TNode *nITEL[4],*nICMB[4],*nIMB0[4],*nIMBS[4];
311 TNode *nIDET = new TNode("IDET","Detector Under Test",sIDETshape,
312 0.0,0.0,pz[1]+38.0,r0,0);
314 TNode *nITS0 = new TNode("ITS0","SDD Chip",sITS0shape,
315 0.0,sIDETshape->GetDy()-spdY,0.0,0,0);
317 for(i=0;i<5;i++) { //place readout chips on the back of SDD chip under test
318 sprintf(name,"IPC0%d",i);
319 sprintf(title,"Readout chip #%d",i+1);
321 nIPC0[i] = new TNode(name,title,sIPC0shape,
322 0.0,spdchipY-sIDETshape->GetDy(),
323 j*2.0*spdchipZ+j*0.25*(spdZ-5.*spdchipZ),0,0);
326 TNode *nITST = new TNode("ITST","SDD sensitive volume",sITSTshape,
328 for(Int_t i=0;i<4;i++){
330 sprintf(name,"ITEL%d",i);
331 sprintf(title,"Test beam telescope element #%d",i+1);
332 nITEL[i] = new TNode(name,title,sITELshape,px,py,pz[i],r0,0);
334 nICMB[i] = new TNode("ICMB","Chip MiniBus",sICMBshape,
335 0.0,-sITELshape->GetDy()+detMiniBusY,0.0,0,0);
336 nIMB0[i] = new TNode("IMB0","Chip MiniBus",sIMB0shape,
337 0.0, sITELshape->GetDy()-detMiniBusY,0.0,0,0);
339 nIMBS[i] = new TNode("IMBS","IMBS",sIMBSshape,0.0,0.0,0.0,0,0);
340 // place IMBS inside IMB0 with no translation and unit rotation matrix.
343 nITST->SetLineColor(kYellow);
346 nIMBS[i]->SetLineColor(kGreen);
347 fNodes->Add(nIMBS[i]);
350 //______________________________________________________________________
351 Int_t AliITSvSDD03::DecodeDetector(Int_t id,Int_t cpy,Int_t &lay,
352 Int_t &lad,Int_t &det) const{
353 // Given the Geant id and copy volume number, returns the layer, ladder,
354 // and detector number, allong with the module number of the detector
355 // involved. Returns -1 and lay=0, lad=0, and det=0 if not a sensitive
358 // Int_t id Geometry volume id number
359 // Int_t cpy Geometry copy number
361 // Int_t lay ITS layer number
362 // Int_t lad ITS ladder number
363 // Int_t det ITS detector number
365 // Int_t module number.
368 lay = 0; lad = 0; det = 0; mod = -1;
369 if(id==fIdSens[0]){ // Volume name is IMBS (ITEL)
376 if(id==fIdSens[1]){ // Volume name is ITST (IDet)
377 lad = 1; det = 1;lay = 5; mod = 4;
382 //______________________________________________________________________
383 void AliITSvSDD03::CreateGeometry(){
384 ////////////////////////////////////////////////////////////////////////
385 // This routine defines and Creates the geometry for version 1 of the ITS.
386 // ALIC ALICE Mother Volume
387 // |- ITSV ITS Mother Volume
388 // |- IDET Detector under Test (box containing SDD)
389 // | |-IDAI Air inside box
390 // | |- ITS0 SDD Si Chip
391 // | |- ITST SDD Sensitivve Volume
392 // |- ITEL *10 SSD Telescope (plastic box containting SSD's)
393 // | |- ITAI Air inside box
394 // | |- IMB0 SDD Si Chip
395 // | |- IMBS SDD Sensitive volume
396 // |-ISNT*4 Sintilator triggers
403 ////////////////////////////////////////////////////////////////////////
405 // Define media off-set
406 Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
407 Int_t idrotm[4]; // Array of rotation matrix indexes
408 //Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
409 //Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
410 //Float_t yposition= 0.0;
411 const Float_t kmm=0.1,kcm=1.0,kmicm=0.001;
413 // Define Rotation-reflextion Matrixes needed
414 // 0 is the unit matrix
415 AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0); // SDD and SSD X
416 AliMatrix(idrotm[1], 90.0,0.0, 0.0,0.0, 90.0,270.0); // SSD Y
420 gMC->Gsvolu("ITSV","BOX ",idtmed[0],data,3);
421 gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
423 //cout << "idtmed[0]=" << idtmed[0]<<endl;
424 //cout << "idtmed[1]=" << idtmed[1]<<endl;
425 // Crossed sintilator triggers (2 in front 2 in back)
426 AliMatrix(idrotm[2],90.0,0.0,90.0,90.0,90.0,0.0);//Rotate about Z 90 degree
430 gMC->Gsvolu("ISNT","BOX ",idtmed[2],data,3);
431 gMC->Gspos("ISNT",1,"ITSV",0.0,0.0,800.0*kmm+data[2],0,"ONLY");
432 gMC->Gspos("ISNT",2,"ITSV",0.0,0.0,800.0*kmm,idrotm[2],"ONLY");
433 gMC->Gspos("ISNT",3,"ITSV",0.0,0.0,-800.0*kmm,0,"ONLY");
434 gMC->Gspos("ISNT",4,"ITSV",0.0,0.0,-800.0*kmm-data[2],idrotm[2],"ONLY");
435 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
436 // SSD part of telescope (MiniBuS)
437 data[0] = detMiniBusX = 10600.0*kmicm;
438 data[1] = detMiniBusY = 0.0150*kcm;
439 data[2] = detMiniBusZ = 1.1*kcm;
440 gMC->Gsvolu("IMB0", "BOX ", idtmed[1], data, 3); // contains detector
441 data[0] = 0.5*384*50*kmicm;
442 data[1] = 0.1499*kcm;
444 gMC->Gsvolu("IMBS","BOX ",idtmed[1],data,3); // sensitive detecor volulme
445 gMC->Gspos("IMBS",1,"IMB0",0.0,0.0,0.0,0,"ONLY"); // place IMBS inside
446 // Box containing SSD's
450 gMC->Gsvolu("ITAI","BOX ",idtmed[0],data,3);
451 // Plastic box size = insize + thickness.
452 data[0] = data[0] + 2.0*kmm;
453 data[1] = data[1] + 200.0*kmicm;
454 data[2] = data[2] + 2.0*kmm;
455 gMC->Gsvolu("ITEL","BOX ",idtmed[3],data,3);
456 gMC->Gspos("ITAI",1,"ITEL",0.0,0.0,0.0,0,"ONLY");
457 gMC->Gspos("IMB0",1,"ITAI",0.0,0.0,0.0,0,"ONLY");
460 Float_t sddX,sddY,sddZ;
461 data[0] = sddX = 3.62500*kcm;
462 data[1] = sddY = 0.01500*kcm;
463 data[2] = sddZ = 4.37940*kcm;
464 gMC->Gsvolu("ITS0", "BOX ", idtmed[1], data, 3); // contains detector
465 data[0] = 3.50860*kcm;
466 data[1] = 0.01499*kcm;
467 data[2] = 3.76320*kcm;
468 gMC->Gsvolu("ITST","BOX ",idtmed[1],data,3);// sensitive detecor volume
469 gMC->Gspos("ITST",1,"ITS0",0.0,0.0,0.0,0,"ONLY"); // place ITST inside
470 // Box containing SDD under test
474 gMC->Gsvolu("IDAI","BOX ",idtmed[0],data,3);
475 data[0] = data[0] + 2.0*kmm;
476 data[1] = data[1] + 200.0*kmicm;
477 data[2] = data[2] + 2.0*kmm;
478 gMC->Gsvolu("IDET","BOX ",idtmed[3],data,3);
479 gMC->Gspos("IDAI",1,"IDET",0.0,0.0,0.0,0,"ONLY");
480 gMC->Gspos("ITS0",1,"IDAI",0.0,0.0,0.0,0,"ONLY");
482 // Positions detectors, Beam Axis Z, X to the right, Y up to the sky.
483 Float_t p00X,p00Y,p00Z,p01X,p01Y,p01Z,p10X,p10Y,p10Z,p11X,p11Y,p11Z;
487 gMC->Gspos("ITEL",1,"ITSV",p00X,p00Y,p00Z,idrotm[0],"ONLY");//SSD X
491 gMC->Gspos("ITEL",2,"ITSV",p01X,p01Y,p01Z,idrotm[1],"ONLY");//SSD Y
495 gMC->Gspos("ITEL",3,"ITSV",p01X,p01Y,p01Z,idrotm[0],"ONLY");//SSD X
499 Float_t pdetX,pdetY,pdetZ;
500 gMC->Gspos("ITEL",4,"ITSV",p01X,p01Y,p01Z,idrotm[1],"ONLY");//SSD Y
504 gMC->Gspos("IDET",1,"ITSV",pdetX,pdetY,pdetZ,idrotm[0],"ONLY");// Detecor
508 gMC->Gspos("ITEL",5,"ITSV",p10X,p10Y,p10Z,idrotm[0],"ONLY");//SSD X
512 gMC->Gspos("ITEL",6,"ITSV",p11X,p11Y,p11Z,idrotm[1],"ONLY");//SSD Y
516 gMC->Gspos("ITEL",7,"ITSV",p11X,p11Y,p11Z,idrotm[0],"ONLY");//SSD X
520 gMC->Gspos("ITEL",8,"ITSV",p11X,p11Y,p11Z,idrotm[1],"ONLY");//SSD Y
524 gMC->Gspos("ITEL",9,"ITSV",p11X,p11Y,p11Z,idrotm[0],"ONLY");//SSD X
528 gMC->Gspos("ITEL",10,"ITSV",p11X,p11Y,p11Z,idrotm[1],"ONLY");//SSD Y
530 //______________________________________________________________________
531 void AliITSvSDD03::CreateMaterials(){
532 ////////////////////////////////////////////////////////////////////////
534 // Create ITS SDD test beam materials
535 // This function defines the default materials used in the Geant
536 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
538 // In general it is automatically replaced by
539 // the CreatMaterials routine defined in AliITSv?. Should the function
540 // CreateMaterials not exist for the geometry version you are using this
541 // one is used. See the definition found in AliITSv5 or the other routine
542 // for a complete definition.
550 /////////////////////////////////////////////////////////////////////////
551 Float_t tmaxfdSi = 0.1; // Degree
552 Float_t stemaxSi = 0.0075; // cm
553 Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
554 Float_t epsilSi = 1.0E-4;//
555 Float_t stminSi = 0.0; // cm "Default value used"
557 Float_t tmaxfdAir = 0.1; // Degree
558 Float_t stemaxAir = .10000E+01; // cm
559 Float_t deemaxAir = 0.1; // Fraction of particle's energy 0<deemax<=1
560 Float_t epsilAir = 1.0E-4;//
561 Float_t stminAir = 0.0; // cm "Default value used"
562 Int_t ifield = gAlice->Field()->Integ();
563 Float_t fieldm = gAlice->Field()->Max();
565 const Float_t kgpcm3=1.0,kcm=1.0;
567 Float_t z[10],a[10],w[10];
569 z[0] = 7.0; a[0] = 14.00674; w[0] = 0.80;
570 z[1] = 8.0; a[1] = 15.99940; w[1] = 0.20;
571 AliMixture(1,"AIR$",a,z,0.12050E-02*kgpcm3,2,w);
572 AliMedium(1,"AIR$",1,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,
575 AliMaterial(2,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,
576 0.93600E+01*kcm,0.99900E+03);
577 AliMedium(2,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
579 // sintilator is Lucite
580 z[0] = 1.0; a[0] = 1.00; w[0] = 8.; // H8
581 z[1] = 6.0; a[1] = 12.00; w[1] = 5.; // C5
582 z[2] = 8.0; a[2] = 16.00; w[2] = 2.; // O2
583 AliMixture(3,"Sintilator$",a,z,1.190*kgpcm3,-3,w);
584 AliMedium(3,"Sintilator$",3,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
586 // assumed to be Lucite/Plexiglas
587 z[0] = 1.0; a[0] = 1.00; w[0] = 8.; // H8
588 z[1] = 6.0; a[1] = 12.00; w[1] = 5.; // C5
589 z[2] = 8.0; a[2] = 16.00; w[2] = 2.; // O2
590 AliMixture(4,"PlasticBox$",a,z,1.190*kgpcm3,-3,w);
591 AliMedium(4,"PlasticBox$",4,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
594 //______________________________________________________________________
595 void AliITSvSDD03::InitAliITSgeom(){
596 // Based on the geometry tree defined in Geant 3.21, this
597 // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
606 if(strcmp(gMC->GetName(),"TGeant3")) {
607 Error("InitAliITSgeom",
608 "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls");
611 cout << "Reading Geometry transformation directly from Geant 3." << endl;
613 const Float_t pitch=50.E-4;/*cm*/
614 Float_t box[3]={0.5*pitch*(Float_t)np,150.E-4,1.0},p[np],n[np];
615 const Int_t ltypess = 2;
616 const Int_t nlayers = 11;
617 const Int_t ndeep = 6;
618 Int_t itsGeomTreeNames[ltypess][ndeep],lnam[20],lnum[20];
619 Int_t nlad[nlayers],ndet[nlayers];
621 Float_t par[20],att[20];
622 Int_t npar,natt,idshape,imat,imed,id;
623 AliITSGeant3Geometry *ig = new AliITSGeant3Geometry();
624 Int_t mod,typ,lay,lad,det,cpy,i,j,k;
625 Char_t names[ltypess][ndeep][4];
626 Int_t itsGeomTreeCopys[ltypess][ndeep];
627 Char_t *namesA[ltypess][ndeep] = {
628 {"ALIC","ITSV","ITEL","ITAI","IMB0","IMBS"}, // lay=5
629 {"ALIC","ITSV","IDET","IDAI","ITS0","ITST"}};// Test SDD
630 Int_t itsGeomTreeCopysA[ltypess][ndeep]= {{1,1,10,1,1,1},// lay=5
631 {1,1,1,1,1,1}};//lay=3 TestSDD
632 for(i=0;i<ltypess;i++)for(j=0;j<ndeep;j++){
633 for(k=0;k<4;k++) names[i][j][k] = namesA[i][j][k];
634 itsGeomTreeCopys[i][j] = itsGeomTreeCopysA[i][j];
636 for(i=0;i<np;i++){// Fill in anode and cathode strip locations (lower edge)
637 p[i] = 0.5*pitch*(Float_t)np + pitch*(Float_t)i;
638 n[i] = pitch*(Float_t)np - p[i];
640 // Sorry, but this is not very pritty code. It should be replaced
641 // at some point with a version that can search through the geometry
643 cout << "Reading Geometry informaton from Geant3 common blocks" << endl;
644 for(i=0;i<20;i++) lnam[i] = lnum[i] = 0;
645 for(i=0;i<ltypess;i++)for(j=0;j<ndeep;j++)
646 strncpy((char*) &itsGeomTreeNames[i][j],names[i][j],4);
647 // itsGeomTreeNames[i][j] = ig->StringToInt(names[i][j]);
649 if(fITSgeom!=0) delete fITSgeom;
650 nlad[0]=1;nlad[1]=1;nlad[2]=1;nlad[3]=1;nlad[4]=1;nlad[5]=1;
651 nlad[6]=1;nlad[7]=1;nlad[8]=1;nlad[9]=1;nlad[10]=1;
652 ndet[0]=1;ndet[1]=1;ndet[2]=1;ndet[3]=1;ndet[4]=1;ndet[5]=1;
653 ndet[6]=1;ndet[7]=1;ndet[8]=1;ndet[9]=1;ndet[10]=1;
654 fITSgeom = new AliITSgeom(0,nlayers,nlad,ndet,mod);
655 fIdSens[0] = 0; fIdSens[1] = 1; // Properly reset in Init later.
656 for(typ=1;typ<=ltypess;typ++){
657 for(j=0;j<ndeep;j++) lnam[j] = itsGeomTreeNames[typ-1][j];
658 for(j=0;j<ndeep;j++) lnum[j] = itsGeomTreeCopys[typ-1][j];
659 if(typ == 1) id = fIdSens[0];
660 else id = fIdSens[1];
663 for(cpy=1;cpy<=itsGeomTreeCopys[typ-1][2];cpy++){
664 mod = DecodeDetector(id,cpy,lay,lad,det);
665 ig->GetGeometry(ndeep,lnam,lnum,t,r,idshape,npar,natt,par,att,
667 cout << "0: id,cpy="<<id<<","<<cpy<<" mod,lay,lad,det"<<mod
668 << ","<<lay<<","<<lad<<","<<det;
671 fITSgeom->CreatMatrix(mod,lay,lad,det,kSDD,t,r);
673 if(!(fITSgeom->IsShapeDefined((Int_t)kSDD))){
674 fITSgeom->ReSetShape(kSDD,new AliITSgeomSDD256(npar,par));
678 fITSgeom->CreatMatrix(mod,lay,lad,det,kSSD,t,r);
680 if(!(fITSgeom->IsShapeDefined((Int_t)kSSD))){
681 fITSgeom->ReSetShape(kSSD,new AliITSgeomSSD(box,0.0,0.0,
690 //______________________________________________________________________
691 void AliITSvSDD03::Init(){
692 ////////////////////////////////////////////////////////////////////////
693 // Initialise the ITS after it has been created.
700 ////////////////////////////////////////////////////////////////////////
704 for(i=0;i<26;i++) cout << "*";
705 cout << " AliITSvSDD03" << fMinorVersion << "_Init ";
706 for(i=0;i<25;i++) cout << "*";cout << endl;
708 if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
709 if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
710 if(fITSgeom!=0) delete fITSgeom;
711 fITSgeom = new AliITSgeom();
712 if(fGeomDetIn) fITSgeom->ReadNewFile(fRead);
713 if(!fGeomDetIn) this->InitAliITSgeom();
714 if(fGeomDetOut) fITSgeom->WriteNewFile(fWrite);
716 fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
718 for(i=0;i<72;i++) cout << "*";
721 //______________________________________________________________________
722 void AliITSvSDD03::SetDefaults(){
723 // sets the default segmentation, response, digit and raw cluster classes
730 const Float_t kconv = 1.0e+04; // convert cm to microns
732 Info("SetDefaults","Setting up only SDD detector");
734 AliITSDetType *iDetType;
737 iDetType=DetType(kSPD);
738 SetResponseModel(kSPD,new AliITSresponseSPD());
739 SetSegmentationModel(kSPD,new AliITSsegmentationSPD());
740 const char *kData0=(iDetType->GetResponseModel())->DataType();
741 if(strstr(kData0,"real") ) iDetType->ClassNames("AliITSdigit",
742 "AliITSRawClusterSPD");
743 else iDetType->ClassNames("AliITSdigitSPD","AliITSRawClusterSPD");
746 iDetType=DetType(kSDD);
747 s1 = (AliITSgeomSDD*) fITSgeom->GetShape(kSDD);// Get shape info. Do it this way for now.
748 AliITSresponseSDD *resp1=new AliITSresponseSDD("simulated");
749 SetResponseModel(kSDD,resp1);
750 AliITSsegmentationSDD *seg1=new AliITSsegmentationSDD(fITSgeom,resp1);
751 seg1->SetDetSize(s1->GetDx()*kconv, // base this on AliITSgeomSDD
752 s1->GetDz()*2.*kconv, // for now.
753 s1->GetDy()*2.*kconv); // x,z,y full width in microns.
754 seg1->SetNPads(256,256);// Use AliITSgeomSDD for now
755 SetSegmentationModel(kSDD,seg1);
756 const char *kData1=(iDetType->GetResponseModel())->DataType();
757 const char *kopt=iDetType->GetResponseModel()->ZeroSuppOption();
758 if((!strstr(kopt,"2D")) && (!strstr(kopt,"1D")) || strstr(kData1,"real") ){
759 iDetType->ClassNames("AliITSdigit","AliITSRawClusterSDD");
760 } else iDetType->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
763 iDetType=DetType(kSSD);
764 s2 = (AliITSgeomSSD*) fITSgeom->GetShape(kSSD);// Get shape info. Do it this way for now.
765 AliITSresponse *resp2=new AliITSresponseSSD("simulated");
766 SetResponseModel(kSSD,resp2);
767 AliITSsegmentationSSD *seg2=new AliITSsegmentationSSD(fITSgeom);
768 seg2->SetDetSize(s2->GetDx()*2.*kconv, // base this on AliITSgeomSSD
769 s2->GetDz()*2.*kconv, // for now.
770 s2->GetDy()*2.*kconv); // x,z,y full width in microns.
771 seg2->SetPadSize(95.,0.); // strip x pitch in microns
772 seg2->SetNPads(768,0); // number of strips on each side.
773 seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
774 seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
775 seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
776 SetSegmentationModel(kSSD,seg2);
777 const char *kData2=(iDetType->GetResponseModel())->DataType();
778 if(strstr(kData2,"real") ) iDetType->ClassNames("AliITSdigit",
779 "AliITSRawClusterSSD");
780 else iDetType->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
783 Warning("SetDefaults",
784 "Only the four basic detector types are initialised!");
788 //______________________________________________________________________
789 void AliITSvSDD03::SetDefaultSimulation(){
790 // sets the default simulation.
798 AliITSDetType *iDetType;
799 AliITSsimulation *sim;
800 iDetType = DetType(kSPD);
801 sim = iDetType->GetSimulationModel();
803 AliITSsegmentation *seg0=
804 (AliITSsegmentation*)iDetType->GetSegmentationModel();
805 if(seg0==0) seg0 = new AliITSsegmentationSPD();
806 AliITSresponse *res0 = (AliITSresponse*)iDetType->GetResponseModel();
807 if(res0==0) res0 = new AliITSresponseSPD();
808 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
809 SetSimulationModel(kSPD,sim0);
810 }else{ // simulation exists, make sure it is set up properly.
811 ((AliITSsimulationSPD*)sim)->Init(
812 (AliITSsegmentationSPD*) iDetType->GetSegmentationModel(),
813 (AliITSresponseSPD*) iDetType->GetResponseModel());
815 iDetType = DetType(kSDD);
816 sim = iDetType->GetSimulationModel();
818 AliITSsegmentation *seg1=
819 (AliITSsegmentation*)iDetType->GetSegmentationModel();
820 AliITSresponse *res1 = (AliITSresponse*)iDetType->GetResponseModel();
821 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
822 SetSimulationModel(kSDD,sim1);
823 }else{ // simulation exists, make sure it is set up properly.
824 ((AliITSsimulationSDD*)sim)->Init(
825 (AliITSsegmentationSDD*) iDetType->GetSegmentationModel(),
826 (AliITSresponseSDD*) iDetType->GetResponseModel());
828 iDetType = DetType(kSSD);
829 sim = iDetType->GetSimulationModel();
831 AliITSsegmentation *seg2=
832 (AliITSsegmentation*)iDetType->GetSegmentationModel();
833 AliITSresponse *res2 = (AliITSresponse*)iDetType->GetResponseModel();
834 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
835 SetSimulationModel(kSSD,sim2);
836 }else{ // simulation exists, make sure it is set up properly.
837 ((AliITSsimulationSSD*)sim)->Init(
838 (AliITSsegmentationSSD*) iDetType->GetSegmentationModel(),
839 (AliITSresponseSSD*) iDetType->GetResponseModel());
842 //______________________________________________________________________
843 void AliITSvSDD03::DrawModule() const{
844 ////////////////////////////////////////////////////////////////////////
845 // Draw a shaded view of the ITS SDD test beam version 1.
852 ////////////////////////////////////////////////////////////////////////
853 // Set everything unseen
854 gMC->Gsatt("*", "seen", -1);
855 // Set ALIC mother visible
856 gMC->Gsatt("ALIC","SEEN",0);
857 // Set ALIC ITS visible
858 gMC->Gsatt("ITSV","SEEN",0);
859 // Set ALIC Telescopes visible
860 gMC->Gsatt("ITEL","SEEN",0);
861 // Set ALIC detetcor visible
862 gMC->Gsatt("IDET","SEEN",0);
863 // Set Detector chip mother visible and drawn
864 gMC->Gsatt("IPC0","SEEN",1);
865 // Set Detector mother visible and drawn
866 gMC->Gsatt("ITS0","SEEN",1);
867 // Set minibus chip mother visible and drawn
868 gMC->Gsatt("ICMB","SEEN",1);
869 // Set minibus mother visible and drawn
870 gMC->Gsatt("IMB0","SEEN",1);
872 //______________________________________________________________________
873 void AliITSvSDD03::StepManager(){
874 ////////////////////////////////////////////////////////////////////////
875 // Called for every step in the ITS SDD test beam, then calles the
876 // AliITShit class creator with the information to be recoreded about
878 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
879 // printing of information to a file which can be used to create a .det
880 // file read in by the routine CreateGeometry(). If set to 0 or any other
881 // value except 1, the default behavior, then no such file is created nor
882 // it the extra variables and the like used in the printing allocated.
889 ////////////////////////////////////////////////////////////////////////
891 static TLorentzVector position0;
892 static Int_t stat0=0;
893 if((id=gMC->CurrentVolID(copy) == fIDMother)&&
894 (gMC->IsTrackEntering()||gMC->IsTrackExiting())){
895 copy = fTrackReferences->GetEntriesFast();
896 TClonesArray &lTR = *fTrackReferences;
897 // Fill TrackReference structure with this new TrackReference.
898 new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->
899 GetCurrentTrackNumber());
900 } // if Outer ITS mother Volume
901 //if(!(this->IsActive())) return;
902 if(!(gMC->TrackCharge())) return;
904 TLorentzVector position, momentum;
905 TClonesArray &lhits = *fHits;
907 // Fill hit structure.
908 gMC->TrackPosition(position);
909 gMC->TrackMomentum(momentum);
910 id = gMC->CurrentVolID(copy);
911 if(id==fIdSens[0] || id==fIdSens[1]){ // Volumes "ITST" or "IMBS"
912 copy = gMC->CurrentVolOffID(3,copy3);
913 copy = DecodeDetector(id,copy3,vol[0],vol[1],vol[2]);
914 //cout << "0: mod,lay,lad,det="<<copy<<","<<vol[0]<<","<<vol[1]
915 // <<","<<vol[2]<<" name="<<gMC->CurrentVolName()<<" z="
916 // <<position.Z()<<endl;
917 }else if(id==fIdSens[2]){ // "ISNT" Sintilator
918 //cout << "1: id,copy="<<id<<","<<copy
919 // <<" name="<<gMC->CurrentVolName()<<" z="
920 // <<position.Z()<<endl;
921 return; // Do nothing for now.
923 //cout << "2: id,copy="<<id<<","<<copy
924 // <<" name="<<gMC->CurrentVolName()<<" z="
925 // <<position.Z()<<endl;
932 if(gMC->IsTrackInside()) vol[3] += 1;
933 if(gMC->IsTrackEntering()) vol[3] += 2;
934 if(gMC->IsTrackExiting()) vol[3] += 4;
935 if(gMC->IsTrackOut()) vol[3] += 8;
936 if(gMC->IsTrackDisappeared()) vol[3] += 16;
937 if(gMC->IsTrackStop()) vol[3] += 32;
938 if(gMC->IsTrackAlive()) vol[3] += 64;
941 if(gMC->IsTrackEntering()){
942 position0 = position;
946 new(lhits[fNhits++]) AliITShit(fIshunt,
947 gAlice->GetMCApp()->GetCurrentTrackNumber(),
948 vol,gMC->Edep(),gMC->TrackTime(),
949 position,position0,momentum);
950 }// end if gMC->IsTrackEnetering()
951 position0 = position;