]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSvSPD02.cxx
Splitting of the ITS libraries (M.Masera & E.Crescio)
[u/mrichter/AliRoot.git] / ITS / AliITSvSPD02.cxx
CommitLineData
6078cf56 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
88cb7938 16/* $Id$ */
48232831 17
6078cf56 18#include <TGeometry.h>
19#include <TNode.h>
6078cf56 20#include <TLorentzVector.h>
6078cf56 21#include <TClonesArray.h>
22#include <TBRIK.h>
6078cf56 23
24#include "AliRun.h"
25#include "AliMagF.h"
6078cf56 26#include "AliITSGeant3Geometry.h"
27#include "AliTrackReference.h"
28#include "AliITShit.h"
29#include "AliITS.h"
30#include "AliITSvSPD02.h"
31#include "AliITSgeom.h"
32#include "AliITSgeomSPD.h"
7d62fb64 33#include "AliITSDetTypeSim.h"
6671ac44 34#include "AliITSresponseSPD.h"
6078cf56 35#include "AliITSsegmentationSPD.h"
aacedc3e 36#include "AliITSsimulationSPDdubna.h"
5d12ce38 37#include "AliMC.h"
6078cf56 38
7d62fb64 39
78b50563 40///////////////////////////////////////////////////////////////////////
41// Step manager and
42// geometry class
43// for the ITS
44// SPD test beam
45// geometry of summer 2002
46//
47///////////////////////////////////////////////////////////////////////
6078cf56 48ClassImp(AliITSvSPD02)
49
50//______________________________________________________________________
aacedc3e 51AliITSvSPD02::AliITSvSPD02():
52AliITS(),
53fGeomDetOut(kFALSE),
54fGeomDetIn(kFALSE),
55fMajorVersion(1),
56fMinorVersion(2),
57fGeomNumber(2002),
58fEuclidGeomDet(),
59fRead(),
60fWrite(),
61fDet1(300.0),
62fDet2(300.0),
63fChip1(300.0),
64fChip2(300.0){
6078cf56 65 ////////////////////////////////////////////////////////////////////////
66 // Standard default constructor for the ITS SPD test beam 2002 version 1.
67 // Inputs:
68 // none.
69 // Outputs:
70 // none.
71 // Return:
72 // A default created class.
73 ////////////////////////////////////////////////////////////////////////
74 Int_t i;
75
6078cf56 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';
79}
80//______________________________________________________________________
aacedc3e 81AliITSvSPD02::AliITSvSPD02(const char *title,Int_t gn) : AliITS("ITS", title),
82fGeomDetOut(kFALSE),
83fGeomDetIn(kFALSE),
84fMajorVersion(1),
85fMinorVersion(2),
86fGeomNumber(2002),
87fEuclidGeomDet(),
88fRead(),
89fWrite(),
90fDet1(300.0),
91fDet2(300.0),
92fChip1(300.0),
93fChip2(300.0){
6078cf56 94 ////////////////////////////////////////////////////////////////////////
95 // Standard constructor for the ITS SPD testbeam 2002 version 1.
96 // Inputs:
97 // const char *title title for this ITS geometry.
a421d869 98 // Int_t gn Geometry version number (year) default 2002.
6078cf56 99 // Outputs:
100 // none.
101 // Return:
102 // A standard created class.
103 ////////////////////////////////////////////////////////////////////////
104 Int_t i;
105
a421d869 106 fGeomNumber = gn;
6078cf56 107 fIdN = 2;
108 fIdName = new TString[fIdN];
109 fIdName[0] = "IMBS";
110 fIdName[1] = "ITST";
111 fIdSens = new Int_t[fIdN];
112 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
6078cf56 113 SetThicknessDet1();
114 SetThicknessDet2();
115 SetThicknessChip1();
116 SetThicknessChip2();
117
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);
122}
123//______________________________________________________________________
ac74f489 124AliITSvSPD02::AliITSvSPD02(const AliITSvSPD02 &source) : AliITS(source){
6078cf56 125 ////////////////////////////////////////////////////////////////////////
126 // Copy Constructor for ITS SPD test beam 2002 version 1.
127 // This class is not to be copied. Function only dummy.
128 // Inputs:
129 // const AliITSvSPD02 &source The class to be copied
130 // Outputs:
131 // none.
132 // Return:
133 // A warning message.
134 ////////////////////////////////////////////////////////////////////////
135 if(&source == this) return;
136 Warning("Copy Constructor","Not allowed to copy AliITSvSPD02");
137 return;
138}
139//______________________________________________________________________
140AliITSvSPD02& 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.
144 // Inputs:
145 // const AliITSvSPD02 &source The class to be copied
146 // Outputs:
147 // none.
148 // Return:
149 // A Warning message
150 ////////////////////////////////////////////////////////////////////////
151 if(&source == this) return *this;
152 Warning("= operator","Not allowed to copy AliITSvSPD02");
153 return *this;
154}
155//______________________________________________________________________
156AliITSvSPD02::~AliITSvSPD02() {
157 ////////////////////////////////////////////////////////////////////////
158 // Standard destructor for the ITS SPD test beam 2002 version 1.
159 // Inputs:
160 // none.
161 // Outputs:
162 // none.
163 // Return:
164 // none.
165 ////////////////////////////////////////////////////////////////////////
166}
167//______________________________________________________________________
168void 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.
181 // Inputs:
182 // none.
183 // Outputs:
184 // none.
185 // Return:
186 // none.
187 ////////////////////////////////////////////////////////////////////////
188 // Get the top alice volume.
a421d869 189
190 switch (fGeomNumber){
191 case 2002:
192 BuildGeometry2002();
193 break;
194 default:
195 BuildGeometry2002();
196 break;
197 } // end switch
198}
199//______________________________________________________________________
200void 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.
213 // Inputs:
214 // none.
215 // Outputs:
216 // none.
217 // Return:
218 // none.
219 ////////////////////////////////////////////////////////////////////////
220 // Get the top alice volume.
78b50563 221 TNode *aALIC = gAlice->GetGeometry()->GetNode("alice");
222 aALIC->cd();
6078cf56 223
224 // Define ITS Mother Volume
225 Float_t data[3];
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",
aacedc3e 230 90.0,0,0.0,0,90.0,270.0);
6078cf56 231 data[0] = 10.0;
232 data[1] = 50.0;
233 data[2] = 100.0;
462482c0 234 TBRIK *iITSVshape = new TBRIK("ITSVshape",
235 "ITS Logical Mother Volume","Air",
236 data[0],data[1],data[2]);
78b50563 237 TNode *iITSV = new TNode("ITSV","ITS Mother Volume",iITSVshape,
aacedc3e 238 0.0,0.0,0.0,0,0);
78b50563 239 iITSV->cd(); // set ourselve into ITSV subvolume of aALIC
6078cf56 240
241 // SPD part of telescope (MiniBuS)
242 data[0] = 0.705;
243 data[1] = 0.5*ddettelescope;
244 data[2] = 3.536;
78b50563 245 TBRIK *iIMB0shape = new TBRIK("IMB0shape","SPD wafer","Si",
6078cf56 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;
78b50563 251 TBRIK *iIMBSshape = new TBRIK("IMBSshape","SPD Sensitive volume","Si",
6078cf56 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;
78b50563 257 TBRIK *iICMBshape = new TBRIK("ICMBshape","chip Minibus","Si",
6078cf56 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);
78b50563 262 TBRIK *iITELshape = new TBRIK("ITELshape","ITELshape","Air",
6078cf56 263 data[0],data[1],data[2]);
264
265 // SPD under test
266 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
267 data[0] = 0.705;
268 data[1] = ddettest;
269 data[2] = 3.536;
78b50563 270 TBRIK *iITS0shape = new TBRIK("ITS0shape","SPD wafer","Si",
6078cf56 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;
78b50563 275 TBRIK *iITSTshape = new TBRIK("ITSTshape","SPD sensitive volume","Si",
6078cf56 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;
78b50563 281 TBRIK *iIPC0shape = new TBRIK("IPC0shape","Readout Chips","Si",
6078cf56 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);
78b50563 286 TBRIK *iIDETshape = new TBRIK("IDETshape","Detector Under Test","Air",
6078cf56 287 data[0],data[1],data[2]);
288 // Place volumes in geometry
289 Int_t i,j;
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};
292 pz[1] = pz[0]+2.0;
293 pz[2] = pz[1]+38.0+spdY+spdchipY+34.5;
294 pz[3] = pz[2]+2.0;
78b50563 295 TNode *iITEL[4],*iICMB[4],*iIMB0[4],*iIMBS[4];
296 TNode *iIDET = new TNode("IDET","Detector Under Test",iIDETshape,
6078cf56 297 0.0,0.0,pz[1]+38.0,r0,0);
78b50563 298 iIDET->cd();
299 TNode *iITS0 = new TNode("ITS0","SPD Chip",iITS0shape,
300 0.0,iIDETshape->GetDy()-spdY,0.0,0,0);
301 TNode *iIPC0[5];
6078cf56 302 for(i=0;i<5;i++) { //place readout chips on the back of SPD chip under test
aacedc3e 303 sprintf(name,"IPC0%d",i);
304 sprintf(title,"Readout chip #%d",i+1);
305 j = i-2;
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);
6078cf56 309 } // end for i
78b50563 310 iITS0->cd();
311 TNode *iITST = new TNode("ITST","SPD sensitive volume",iITSTshape,
aacedc3e 312 0.0,0.0,0.0,0,0);
6078cf56 313 for(Int_t i=0;i<4;i++){
aacedc3e 314 iITSV->cd();
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);
318 iITEL[i]->cd();
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);
323 iIMB0[i]->cd();
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.
6078cf56 326 } // end for i
78b50563 327 aALIC->cd();
328 iITST->SetLineColor(kYellow);
329 fNodes->Add(iITST);
6078cf56 330 for(i=0;i<4;i++){
aacedc3e 331 iIMBS[i]->SetLineColor(kGreen);
332 fNodes->Add(iIMBS[i]);
6078cf56 333 } // end for i
334}
335//______________________________________________________________________
336void 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.
349 // Inputs:
350 // none.
351 // Outputs:
352 // none.
353 // Return:
354 // none.
355 ////////////////////////////////////////////////////////////////////////
a421d869 356
357 switch (fGeomNumber){
358 case 2002:
359 CreateGeometry2002();
360 break;
361 default:
362 CreateGeometry2002();
363 break;
364 } // end switch
365}
366//______________________________________________________________________
367void 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.
380 // Inputs:
381 // none.
382 // Outputs:
383 // none.
384 // Return:
385 // none.
386 ////////////////////////////////////////////////////////////////////////
6078cf56 387 Float_t data[49];
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;
394
462482c0 395 if(gMC==0) return;
6078cf56 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);
399 data[0] = 10.0;
400 data[1] = 50.0;
401 data[2] = 100.0;
402 gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
403 gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
404
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
413 data[0] = 0.64;
414 data[1] = 0.5*ddettelescope;
415 data[2] = 3.48;
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");
430
431 // SPD under test
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
437 data[0] = 0.64;
438 data[1] = 0.5*ddettest;
439 data[2] = 3.48;
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");
454
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;
457 p00X = 0.0;
458 p00Y = 0.0;
459 p00Z = -38.0;
460 gMC->Gspos("ITEL",1,"ITSV",p00X,p00Y,p00Z,idrotm[0],"ONLY");
461 p01X = 0.0;
462 p01Y = 0.0;
463 p01Z = p00Z+2.0;
464 gMC->Gspos("ITEL",2,"ITSV",p01X,p01Y,p01Z,idrotm[0],"ONLY");
465 Float_t pdetX,pdetY,pdetZ;
466 pdetX = 0.0;
467 pdetY = 0.0+yposition;
468 pdetZ = p01Z+38.0;
469 gMC->Gspos("IDET",1,"ITSV",pdetX,pdetY,pdetZ,idrotm[0],"ONLY");
470 p10X = 0.0;
471 p10Y = 0.0;
472 p10Z = pdetZ + 34.5;
473 gMC->Gspos("ITEL",3,"ITSV",p10X,p10Y,p10Z,idrotm[0],"ONLY");
474 p11X = 0.0;
475 p11Y = 0.0;
476 p11Z = p10Z+2.0;
477 gMC->Gspos("ITEL",4,"ITSV",p11X,p11Y,p11Z,idrotm[0],"ONLY");
478}
479//______________________________________________________________________
480void AliITSvSPD02::CreateMaterials(){
481 ////////////////////////////////////////////////////////////////////////
a421d869 482 //
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,
486 // AliITSvSPD02.
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.
492 //
493 // Inputs:
494 // none.
495 // Outputs:
496 // none.
497 // Return:
498 // none.
499 /////////////////////////////////////////////////////////////////////////
500
501 switch (fGeomNumber){
502 case 2002:
503 CreateMaterials2002();
504 break;
505 default:
506 CreateMaterials2002();
507 break;
508 } // end switch
509}
510//______________________________________________________________________
511void AliITSvSPD02::CreateMaterials2002(){
512 ////////////////////////////////////////////////////////////////////////
6078cf56 513 //
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,
517 // AliITSvSPD02.
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.
523 //
524 // Inputs:
525 // none.
526 // Outputs:
527 // none.
528 // Return:
529 // none.
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"
536
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();
544
545 AliMaterial(1,"AIR$",0.14610E+02,0.73000E+01,0.12050E-02,
aacedc3e 546 0.30423E+05,0.99900E+03);
6078cf56 547 AliMedium(1,"AIR$",1,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,
aacedc3e 548 epsilAir,stminAir);
6078cf56 549
550 AliMaterial(2,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,
aacedc3e 551 0.93600E+01,0.99900E+03);
6078cf56 552 AliMedium(2,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
aacedc3e 553 epsilSi,stminSi);
6078cf56 554}
555//______________________________________________________________________
556void 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
559 // sturture.
560 // Inputs:
561 // none.
562 // Outputs:
563 // none.
564 // Return:
565 // none.
78b50563 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];
6078cf56 571 Double_t t[3],r[10];
572 Float_t par[20],att[20];
573 Int_t npar,natt,idshape,imat,imed;
462482c0 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;
576
577 if(gMC==0) {// No Monti Carlo to init. Default set fITSgeom by hand
7d62fb64 578 if(GetITSgeom()!=0) SetITSgeom(0x0);
462482c0 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;
7d62fb64 581 AliITSgeom* geom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
582 SetITSgeom(geom);
462482c0 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++){
592 lay = 1;
593 lad = 1;
594 det = mod+1;
595 t[0] = tt[mod][0]; t[1] = tt[mod][1]; t[2] = tt[mod][2];
7d62fb64 596 GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSPD,t,r);
462482c0 597 npar=3;par[0]=0.64;par[1]=0.5*300.0E-4;par[2]=3.48;
7d62fb64 598 GetITSgeom()->ReSetShape(kSPD,new AliITSgeomSPD425Short(npar,par));
462482c0 599 } // end for det
600 return;
601 } // end if gMC==0
602 if(strcmp(gMC->GetName(),"TGeant3")) {
aacedc3e 603 Error("InitAliITSgeom",
604 "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls");
605 return;
462482c0 606 } // end if
607 cout << "Reading Geometry transformation directly from Geant 3." << endl;
608 ig = new AliITSGeant3Geometry();
78b50563 609 Char_t names[kltypess][kndeep][4];
610 Int_t itsGeomTreeCopys[kltypess][kndeep];
8e8eae84 611 const char *namesA[kltypess][kndeep] = {
aacedc3e 612 {"ALIC","ITSV","ITEL","IMB0","IMBS"}, // lay=1
613 {"ALIC","ITSV","IDET","ITS0","ITST"}};// Test SPD
78b50563 614 Int_t itsGeomTreeCopysA[kltypess][kndeep]= {{1,1,4,1,1},// lay=1
aacedc3e 615 {1,1,1,1,1}};//lay=2 TestSPD
78b50563 616 for(i=0;i<kltypess;i++)for(j=0;j<kndeep;j++){
aacedc3e 617 for(k=0;k<4;k++) names[i][j][k] = namesA[i][j][k];
618 itsGeomTreeCopys[i][j] = itsGeomTreeCopysA[i][j];
6078cf56 619 } // end for 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
622 // tree its self.
623 cout << "Reading Geometry informaton from Geant3 common blocks" << endl;
624 for(i=0;i<20;i++) lnam[i] = lnum[i] = 0;
78b50563 625 for(i=0;i<kltypess;i++)for(j=0;j<kndeep;j++)
18f30131 626 strncpy((char*) &itsGeomTreeNames[i][j],names[i][j],4);
627 // itsGeomTreeNames[i][j] = ig->StringToInt(names[i][j]);
48232831 628 mod = 5;
7d62fb64 629 if(GetITSgeom()!=0) SetITSgeom(0x0);
48232831 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;
7d62fb64 632 AliITSgeom* geom = new AliITSgeom(0,knlayers,nlad,ndet,mod);
633 SetITSgeom(geom);
78b50563 634 for(typ=1;typ<=kltypess;typ++){
aacedc3e 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];
637 lad = 1;
638 det = 1;
639 for(cpy=1;cpy<=itsGeomTreeCopys[typ-1][2];cpy++){
640 lnum[2] = cpy;
641 lay = cpy;
642 if(cpy>2 && typ==1) lay = cpy +1;
643 if(typ==2) lay = 3;
644 mod = lay-1;
645 ig->GetGeometry(kndeep,lnam,lnum,t,r,idshape,npar,natt,par,att,
646 imat,imed);
7d62fb64 647 GetITSgeom()->CreatMatrix(mod,lay,lad,det,kSPD,t,r);
648 if(!(GetITSgeom()->IsShapeDefined((Int_t)kSPD)))
649 GetITSgeom()->ReSetShape(kSPD,
aacedc3e 650 new AliITSgeomSPD425Short(npar,par));
651 } // end for cpy
48232831 652 } // end for typ
6078cf56 653 return;
654}
655//______________________________________________________________________
656void AliITSvSPD02::Init(){
657 ////////////////////////////////////////////////////////////////////////
658 // Initialise the ITS after it has been created.
659 // Inputs:
660 // none.
661 // Outputs:
662 // none.
663 // Return:
664 // none.
665 ////////////////////////////////////////////////////////////////////////
666 Int_t i;
667
668 cout << endl;
669 for(i=0;i<26;i++) cout << "*";
670 cout << " ITSvSPD02" << fMinorVersion << "_Init ";
671 for(i=0;i<25;i++) cout << "*";cout << endl;
aacedc3e 672
6078cf56 673 if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
674 if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
7d62fb64 675 if(GetITSgeom()!=0) SetITSgeom(0x0);
676 AliITSgeom* geom = new AliITSgeom();
677 SetITSgeom(geom);
678 if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
6078cf56 679 if(!fGeomDetIn) this->InitAliITSgeom();
7d62fb64 680 if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
6078cf56 681 AliITS::Init();
aacedc3e 682
6078cf56 683 for(i=0;i<72;i++) cout << "*";
684 cout << endl;
462482c0 685 if(gMC) fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
686 else fIDMother = 0;
6078cf56 687}
688//______________________________________________________________________
689void AliITSvSPD02::SetDefaults(){
690 // sets the default segmentation, response, digit and raw cluster classes
691 // Inputs:
692 // none.
693 // Outputs:
694 // none.
695 // Return:
696 // none.
697 const Float_t kconv = 1.0e+04; // convert cm to microns
698
699 Info("SetDefaults","Setting up only SPD detector");
700
7d62fb64 701 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
702 fDetTypeSim->SetITSgeom(GetITSgeom());
6078cf56 703 AliITSgeomSPD *s0;
704 Int_t i;
705 Float_t bx[256],bz[280];
7d62fb64 706 fDetTypeSim->ResetResponse();
707 fDetTypeSim->ResetSegmentation();
708
6078cf56 709 //SPD
88cb7938 710 // Get shape info. Do it this way for now.
7d62fb64 711 s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD);
712 AliITSresponse *resp0=0;
713 for(Int_t nmod=0;nmod<GetITSgeom()->GetIndexMax();nmod++){
714 if(GetITSgeom()->GetModuleType(nmod)==kSPD){
715 resp0 = new AliITSresponseSPD();
716 resp0->SetTemperature();
717 resp0->SetDistanceOverVoltage();
718 SetResponseModel(nmod,resp0);
719 }
720 }
721 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD(GetITSgeom());
6078cf56 722 seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
723 s0->GetDz()*2.*kconv, // for now.
724 s0->GetDy()*2.*kconv); // x,z,y full width in microns.
725 seg0->SetNPads(256,160);// Number of Bins in x and z
726 for(i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns.
727 for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
728 for(i=160;i<280;i++) bz[i] = 0.0; // Outside of detector.
729 bz[ 31] = bz[ 32] = 625.0; // first chip boundry
730 bz[ 63] = bz[ 64] = 625.0; // first chip boundry
731 bz[ 95] = bz[ 96] = 625.0; // first chip boundry
732 bz[127] = bz[128] = 625.0; // first chip boundry
733 bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
734 seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
735 SetSegmentationModel(kSPD,seg0);
736 // set digit and raw cluster classes to be used
7d62fb64 737 const char *kData0=(fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD()))->DataType();
738 if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit");
739 else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
aacedc3e 740// SetSimulationModel(kSPD,new AliITSsimulationSPDdubna(seg0,resp0));
6078cf56 741// iDetType->ReconstructionModel(new AliITSClusterFinderSPD());
7d62fb64 742
c789ee28 743/*
48232831 744 SetResponseModel(kSDD,new AliITSresponseSDD());
745 SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
746 DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
747
748 SetResponseModel(kSSD,new AliITSresponseSSD());
749 SetSegmentationModel(kSSD,new AliITSsegmentationSSD());
750 DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
c789ee28 751*/
7d62fb64 752 if(fgkNTYPES>3){
6078cf56 753 Warning("SetDefaults",
754 "Only the four basic detector types are initialised!");
755 }// end if
756 return;
757}
758//______________________________________________________________________
12e7c97c 759void AliITSvSPD02::SetDefaultSimulation(){
760 // sets the default simulation.
761 // Inputs:
762 // none.
763 // Outputs:
764 // none.
765 // Return:
766 // none.
767
7d62fb64 768 if(GetITSgeom()==0){
769 Warning("SetDefaultSimulation","ITS geometry is null!");
770 return;
771 }
772
773 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
774 AliITSsimulation *sim;
775 AliITSsegmentation *seg;
776 AliITSresponse *res;
777 if(fDetTypeSim){
778 sim = fDetTypeSim->GetSimulationModel(kSPD);
aacedc3e 779 if (!sim) {
7d62fb64 780 seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
781 res = (AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD());
aacedc3e 782 sim = new AliITSsimulationSPDdubna(seg,res,0);
783 SetSimulationModel(kSPD,sim);
784 }else{ // simulation exists, make sure it is set up properly.
7d62fb64 785 sim->SetResponseModel((AliITSresponse*)fDetTypeSim->GetResponseModel(kSPD));
786 sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
787 sim->Init();
aacedc3e 788 } // end if
789 } // end if iDetType
7d62fb64 790
791 /*
792 if(fDetTypeSim){
793 sim = fDetTypeSim->GetSimulationModel(kSDD);
aacedc3e 794 if (!sim) {
7d62fb64 795 seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
796 res = (AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
aacedc3e 797 sim = new AliITSsimulationSDD(seg,res);
798 SetSimulationModel(kSDD,sim);
799 }else{ // simulation exists, make sure it is set up properly.
7d62fb64 800 sim->SetResponseModel((AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()));
801 sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
802 sim->Init();
aacedc3e 803 } //end if
804 } // end if iDetType
7d62fb64 805 if(fDetTypeSim){
806 sim = fDetTypeSim->GetSimulationModel(kSSD);
aacedc3e 807 if (!sim) {
7d62fb64 808 seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
809 res = (AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
aacedc3e 810 sim = new AliITSsimulationSSD(seg,res);
811 SetSimulationModel(kSSD,sim);
812 }else{ // simulation exists, make sure it is set up properly.
7d62fb64 813 sim->SetResponseModel((AliITSresponse*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()));
814 sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
815 sim->Init();
aacedc3e 816 } // end if
7d62fb64 817 } //
818 */
12e7c97c 819}
820//______________________________________________________________________
78b50563 821void AliITSvSPD02::DrawModule() const {
6078cf56 822 ////////////////////////////////////////////////////////////////////////
823 // Draw a shaded view of the ITS SPD test beam version 1.
824 // Inputs:
825 // none.
826 // Outputs:
827 // none.
828 // Return:
829 // none.
830 ////////////////////////////////////////////////////////////////////////
831 // Set everything unseen
832 gMC->Gsatt("*", "seen", -1);
833 // Set ALIC mother visible
834 gMC->Gsatt("ALIC","SEEN",0);
835 // Set ALIC ITS visible
836 gMC->Gsatt("ITSV","SEEN",0);
837 // Set ALIC Telescopes visible
838 gMC->Gsatt("ITEL","SEEN",0);
839 // Set ALIC detetcor visible
840 gMC->Gsatt("IDET","SEEN",0);
841 // Set Detector chip mother visible and drawn
842 gMC->Gsatt("IPC0","SEEN",1);
843 // Set Detector mother visible and drawn
844 gMC->Gsatt("ITS0","SEEN",1);
845 // Set minibus chip mother visible and drawn
846 gMC->Gsatt("ICMB","SEEN",1);
847 // Set minibus mother visible and drawn
848 gMC->Gsatt("IMB0","SEEN",1);
849}
850//______________________________________________________________________
851void AliITSvSPD02::StepManager(){
852 ////////////////////////////////////////////////////////////////////////
853 // Called for every step in the ITS SPD test beam, then calles the
854 // AliITShit class creator with the information to be recoreded about
855 // that hit.
856 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
857 // printing of information to a file which can be used to create a .det
858 // file read in by the routine CreateGeometry(). If set to 0 or any other
859 // value except 1, the default behavior, then no such file is created nor
860 // it the extra variables and the like used in the printing allocated.
861 // Inputs:
862 // none.
863 // Outputs:
864 // none.
865 // Return:
866 // none.
867 ////////////////////////////////////////////////////////////////////////
868 Int_t copy, id;
869 TLorentzVector position, momentum;
870 static TLorentzVector position0;
871 static Int_t stat0=0;
872 if((id=gMC->CurrentVolID(copy) == fIDMother)&&
873 (gMC->IsTrackEntering()||gMC->IsTrackExiting())){
aacedc3e 874 copy = fTrackReferences->GetEntriesFast();
875 TClonesArray &lTR = *fTrackReferences;
876 // Fill TrackReference structure with this new TrackReference.
877 new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->
878 GetCurrentTrackNumber());
6078cf56 879 } // if Outer ITS mother Volume
880 if(!(this->IsActive())){
aacedc3e 881 return;
6078cf56 882 } // end if !Active volume.
883 Int_t vol[5];
884 TClonesArray &lhits = *fHits;
885 //
886 // Track status
887 vol[3] = 0;
888 vol[4] = 0;
889 if(gMC->IsTrackInside()) vol[3] += 1;
890 if(gMC->IsTrackEntering()) vol[3] += 2;
891 if(gMC->IsTrackExiting()) vol[3] += 4;
892 if(gMC->IsTrackOut()) vol[3] += 8;
893 if(gMC->IsTrackDisappeared()) vol[3] += 16;
894 if(gMC->IsTrackStop()) vol[3] += 32;
895 if(gMC->IsTrackAlive()) vol[3] += 64;
896 //
897 // Fill hit structure.
898 if(!(gMC->TrackCharge())) return;
899 id = gMC->CurrentVolID(copy);
48232831 900 if(id==fIdSens[0]){ // Volume name "IMBS"
aacedc3e 901 vol[2] = vol[1] = 1; // Det, ladder
902 id = gMC->CurrentVolOffID(2,copy);
903 //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
904 vol[0] = copy; // Lay
905 if(copy>2) vol[0]++;
48232831 906 } else if(id == fIdSens[1]){ // Volume name "ITST"
aacedc3e 907 vol[0] = 3; // layer
908 vol[1] = 1; // ladder
909 id = gMC->CurrentVolOffID(2,copy);
910 //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
911 vol[2] = 1; // detector
6078cf56 912 } else return; // end if
913 //
914 gMC->TrackPosition(position);
915 gMC->TrackMomentum(momentum);
916 vol[4] = stat0;
917 if(gMC->IsTrackEntering()){
aacedc3e 918 position0 = position;
919 stat0 = vol[3];
920 return;
6078cf56 921 } // end if IsEntering
922 // Fill hit structure with this new hit only for non-entrerance hits.
aacedc3e 923 else new(lhits[fNhits++]) AliITShit(fIshunt,
924 gAlice->GetMCApp()->GetCurrentTrackNumber(),
925 vol,gMC->Edep(),gMC->TrackTime(),
926 position,position0,momentum);
6078cf56 927 //
928 position0 = position;
929 stat0 = vol[3];
930
931 return;
932}
933