]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSvSPD02.cxx
Removing obsolete class AliITSGeant3Geometry - Test beam simulation classes back...
[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>
3be5c40b 23#include <TGeoMatrix.h>
24#include <TVirtualMC.h>
6078cf56 25
26#include "AliRun.h"
27#include "AliMagF.h"
6078cf56 28#include "AliTrackReference.h"
3be5c40b 29
6078cf56 30#include "AliITShit.h"
31#include "AliITS.h"
32#include "AliITSvSPD02.h"
33#include "AliITSgeom.h"
34#include "AliITSgeomSPD.h"
7d62fb64 35#include "AliITSDetTypeSim.h"
fcf95fc7 36#include "AliITSCalibrationSPD.h"
6078cf56 37#include "AliITSsegmentationSPD.h"
5bfe44ce 38#include "AliITSsimulationSPD.h"
5d12ce38 39#include "AliMC.h"
6078cf56 40
7d62fb64 41
78b50563 42///////////////////////////////////////////////////////////////////////
43// Step manager and
44// geometry class
45// for the ITS
46// SPD test beam
47// geometry of summer 2002
48//
49///////////////////////////////////////////////////////////////////////
6078cf56 50ClassImp(AliITSvSPD02)
51
52//______________________________________________________________________
aacedc3e 53AliITSvSPD02::AliITSvSPD02():
54AliITS(),
55fGeomDetOut(kFALSE),
56fGeomDetIn(kFALSE),
57fMajorVersion(1),
58fMinorVersion(2),
59fGeomNumber(2002),
60fEuclidGeomDet(),
61fRead(),
62fWrite(),
63fDet1(300.0),
64fDet2(300.0),
65fChip1(300.0),
66fChip2(300.0){
6078cf56 67 ////////////////////////////////////////////////////////////////////////
68 // Standard default constructor for the ITS SPD test beam 2002 version 1.
69 // Inputs:
70 // none.
71 // Outputs:
72 // none.
73 // Return:
74 // A default created class.
75 ////////////////////////////////////////////////////////////////////////
76 Int_t i;
77
6078cf56 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';
81}
82//______________________________________________________________________
aacedc3e 83AliITSvSPD02::AliITSvSPD02(const char *title,Int_t gn) : AliITS("ITS", title),
84fGeomDetOut(kFALSE),
85fGeomDetIn(kFALSE),
86fMajorVersion(1),
87fMinorVersion(2),
88fGeomNumber(2002),
89fEuclidGeomDet(),
90fRead(),
91fWrite(),
92fDet1(300.0),
93fDet2(300.0),
94fChip1(300.0),
95fChip2(300.0){
6078cf56 96 ////////////////////////////////////////////////////////////////////////
97 // Standard constructor for the ITS SPD testbeam 2002 version 1.
98 // Inputs:
99 // const char *title title for this ITS geometry.
a421d869 100 // Int_t gn Geometry version number (year) default 2002.
6078cf56 101 // Outputs:
102 // none.
103 // Return:
104 // A standard created class.
105 ////////////////////////////////////////////////////////////////////////
106 Int_t i;
107
a421d869 108 fGeomNumber = gn;
6078cf56 109 fIdN = 2;
110 fIdName = new TString[fIdN];
111 fIdName[0] = "IMBS";
112 fIdName[1] = "ITST";
113 fIdSens = new Int_t[fIdN];
114 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
6078cf56 115 SetThicknessDet1();
116 SetThicknessDet2();
117 SetThicknessChip1();
118 SetThicknessChip2();
119
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);
124}
125//______________________________________________________________________
ac74f489 126AliITSvSPD02::AliITSvSPD02(const AliITSvSPD02 &source) : AliITS(source){
6078cf56 127 ////////////////////////////////////////////////////////////////////////
128 // Copy Constructor for ITS SPD test beam 2002 version 1.
129 // This class is not to be copied. Function only dummy.
130 // Inputs:
131 // const AliITSvSPD02 &source The class to be copied
132 // Outputs:
133 // none.
134 // Return:
135 // A warning message.
136 ////////////////////////////////////////////////////////////////////////
137 if(&source == this) return;
138 Warning("Copy Constructor","Not allowed to copy AliITSvSPD02");
139 return;
140}
141//______________________________________________________________________
142AliITSvSPD02& AliITSvSPD02::operator=(const AliITSvSPD02 &source){
143 ////////////////////////////////////////////////////////////////////////
144 // Assignment operator for the ITS SPD test beam 2002 version 1.
145 // This class is not to be copied. Function only dummy.
146 // Inputs:
147 // const AliITSvSPD02 &source The class to be copied
148 // Outputs:
149 // none.
150 // Return:
151 // A Warning message
152 ////////////////////////////////////////////////////////////////////////
153 if(&source == this) return *this;
154 Warning("= operator","Not allowed to copy AliITSvSPD02");
155 return *this;
156}
157//______________________________________________________________________
158AliITSvSPD02::~AliITSvSPD02() {
159 ////////////////////////////////////////////////////////////////////////
160 // Standard destructor for the ITS SPD test beam 2002 version 1.
161 // Inputs:
162 // none.
163 // Outputs:
164 // none.
165 // Return:
166 // none.
167 ////////////////////////////////////////////////////////////////////////
168}
169//______________________________________________________________________
170void AliITSvSPD02::BuildGeometry(){
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.
183 // Inputs:
184 // none.
185 // Outputs:
186 // none.
187 // Return:
188 // none.
189 ////////////////////////////////////////////////////////////////////////
190 // Get the top alice volume.
a421d869 191
192 switch (fGeomNumber){
193 case 2002:
194 BuildGeometry2002();
195 break;
196 default:
197 BuildGeometry2002();
198 break;
199 } // end switch
200}
201//______________________________________________________________________
202void AliITSvSPD02::BuildGeometry2002(){
203 ////////////////////////////////////////////////////////////////////////
204 // Geometry builder for the ITS SPD test beam 2002 version 1.
205 // ALIC ALICE Mother Volume
206 // |- ITSV ITS Mother Volume
207 // |- IDET Detector under Test
208 // | |- ITS0 SPD Si Chip
209 // | | |- ITST SPD Sensitivve Volume
210 // | |- IPC0 *5 Readout chip
211 // |- ITEL *4 SPD Telescope
212 // |- IMB0 SPD Si Chip
213 // | |- IMBS SPD Sensitive volume
214 // |- ICMB Chip MiniBus.
215 // Inputs:
216 // none.
217 // Outputs:
218 // none.
219 // Return:
220 // none.
221 ////////////////////////////////////////////////////////////////////////
222 // Get the top alice volume.
78b50563 223 TNode *aALIC = gAlice->GetGeometry()->GetNode("alice");
224 aALIC->cd();
6078cf56 225
226 // Define ITS Mother Volume
227 Float_t data[3];
228 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
229 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
230 //Float_t yposition= 0.0;
231 TRotMatrix *r0 = new TRotMatrix("ITSidrotm0","ITSidrotm0",
aacedc3e 232 90.0,0,0.0,0,90.0,270.0);
6078cf56 233 data[0] = 10.0;
234 data[1] = 50.0;
235 data[2] = 100.0;
462482c0 236 TBRIK *iITSVshape = new TBRIK("ITSVshape",
237 "ITS Logical Mother Volume","Air",
238 data[0],data[1],data[2]);
78b50563 239 TNode *iITSV = new TNode("ITSV","ITS Mother Volume",iITSVshape,
aacedc3e 240 0.0,0.0,0.0,0,0);
78b50563 241 iITSV->cd(); // set ourselve into ITSV subvolume of aALIC
6078cf56 242
243 // SPD part of telescope (MiniBuS)
244 data[0] = 0.705;
245 data[1] = 0.5*ddettelescope;
246 data[2] = 3.536;
78b50563 247 TBRIK *iIMB0shape = new TBRIK("IMB0shape","SPD wafer","Si",
6078cf56 248 data[0],data[1],data[2]);
249 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
250 data[0] = detMiniBusX = 0.64;
251 data[1] = detMiniBusY = 0.5*ddettelescope;
252 data[2] = detMiniBusZ = 3.48;
78b50563 253 TBRIK *iIMBSshape = new TBRIK("IMBSshape","SPD Sensitive volume","Si",
6078cf56 254 data[0],data[1],data[2]);
255 Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
256 data[0] = chipMiniBusX = 0.793;
257 data[1] = chipMiniBusY = 0.5*dchipMiniBus;
258 data[2] = chipMiniBusZ = 0.68;
78b50563 259 TBRIK *iICMBshape = new TBRIK("ICMBshape","chip Minibus","Si",
6078cf56 260 data[0],data[1],data[2]);
261 data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
262 data[1] = detMiniBusY+chipMiniBusY;
263 data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
78b50563 264 TBRIK *iITELshape = new TBRIK("ITELshape","ITELshape","Air",
6078cf56 265 data[0],data[1],data[2]);
266
267 // SPD under test
268 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
269 data[0] = 0.705;
270 data[1] = ddettest;
271 data[2] = 3.536;
78b50563 272 TBRIK *iITS0shape = new TBRIK("ITS0shape","SPD wafer","Si",
6078cf56 273 data[0],data[1],data[2]); // contains detector
274 data[0] = spdX = 0.64;
275 data[1] = spdY = ddettest;
276 data[2] = spdZ = 3.48;
78b50563 277 TBRIK *iITSTshape = new TBRIK("ITSTshape","SPD sensitive volume","Si",
6078cf56 278 data[0],data[1],data[2]);
279 // ITS0 with no translation and unit rotation matrix.
280 data[0] = spdchipX = 0.793;
281 data[1] = spdchipY = dchiptest;
282 data[2] = spdchipZ = 0.68;
78b50563 283 TBRIK *iIPC0shape = new TBRIK("IPC0shape","Readout Chips","Si",
6078cf56 284 data[0],data[1],data[2]); // chip under test
285 data[0] = TMath::Max(spdchipX,spdX);
286 data[1] = spdY+spdchipY;
287 data[2] = TMath::Max(spdchipZ,spdZ);
78b50563 288 TBRIK *iIDETshape = new TBRIK("IDETshape","Detector Under Test","Air",
6078cf56 289 data[0],data[1],data[2]);
290 // Place volumes in geometry
291 Int_t i,j;
292 char name[20],title[50];
293 Double_t px=0.0,py=0.0,pz[4]={-38.0,0.0,0.0,0.0};
294 pz[1] = pz[0]+2.0;
295 pz[2] = pz[1]+38.0+spdY+spdchipY+34.5;
296 pz[3] = pz[2]+2.0;
78b50563 297 TNode *iITEL[4],*iICMB[4],*iIMB0[4],*iIMBS[4];
298 TNode *iIDET = new TNode("IDET","Detector Under Test",iIDETshape,
6078cf56 299 0.0,0.0,pz[1]+38.0,r0,0);
78b50563 300 iIDET->cd();
301 TNode *iITS0 = new TNode("ITS0","SPD Chip",iITS0shape,
302 0.0,iIDETshape->GetDy()-spdY,0.0,0,0);
303 TNode *iIPC0[5];
6078cf56 304 for(i=0;i<5;i++) { //place readout chips on the back of SPD chip under test
aacedc3e 305 sprintf(name,"IPC0%d",i);
306 sprintf(title,"Readout chip #%d",i+1);
307 j = i-2;
308 iIPC0[i] = new TNode(name,title,iIPC0shape,
309 0.0,spdchipY-iIDETshape->GetDy(),
310 j*2.0*spdchipZ+j*0.25*(spdZ-5.*spdchipZ),0,0);
6078cf56 311 } // end for i
78b50563 312 iITS0->cd();
313 TNode *iITST = new TNode("ITST","SPD sensitive volume",iITSTshape,
aacedc3e 314 0.0,0.0,0.0,0,0);
6078cf56 315 for(Int_t i=0;i<4;i++){
aacedc3e 316 iITSV->cd();
317 sprintf(name,"ITEL%d",i);
318 sprintf(title,"Test beam telescope element #%d",i+1);
319 iITEL[i] = new TNode(name,title,iITELshape,px,py,pz[i],r0,0);
320 iITEL[i]->cd();
321 iICMB[i] = new TNode("ICMB","Chip MiniBus",iICMBshape,
322 0.0,-iITELshape->GetDy()+detMiniBusY,0.0,0,0);
323 iIMB0[i] = new TNode("IMB0","Chip MiniBus",iIMB0shape,
324 0.0, iITELshape->GetDy()-detMiniBusY,0.0,0,0);
325 iIMB0[i]->cd();
326 iIMBS[i] = new TNode("IMBS","IMBS",iIMBSshape,0.0,0.0,0.0,0,0);
327 // place IMBS inside IMB0 with no translation and unit rotation matrix.
6078cf56 328 } // end for i
78b50563 329 aALIC->cd();
330 iITST->SetLineColor(kYellow);
331 fNodes->Add(iITST);
6078cf56 332 for(i=0;i<4;i++){
aacedc3e 333 iIMBS[i]->SetLineColor(kGreen);
334 fNodes->Add(iIMBS[i]);
6078cf56 335 } // end for i
336}
337//______________________________________________________________________
338void AliITSvSPD02::CreateGeometry(){
339 ////////////////////////////////////////////////////////////////////////
340 // This routine defines and Creates the geometry for version 1 of the ITS.
341 // ALIC ALICE Mother Volume
342 // |- ITSV ITS Mother Volume
343 // |- IDET Detector under Test
344 // | |- ITS0 SPD Si Chip
345 // | | |- ITST SPD Sensitivve Volume
346 // | |- IPC0 *5 Readout chip
347 // |- ITEL *4 SPD Telescope
348 // |- IMB0 SPD Si Chip
349 // | |- IMBS SPD Sensitive volume
350 // |- ICMB Chip MiniBus.
351 // Inputs:
352 // none.
353 // Outputs:
354 // none.
355 // Return:
356 // none.
357 ////////////////////////////////////////////////////////////////////////
a421d869 358
359 switch (fGeomNumber){
360 case 2002:
361 CreateGeometry2002();
362 break;
363 default:
364 CreateGeometry2002();
365 break;
366 } // end switch
367}
368//______________________________________________________________________
369void AliITSvSPD02::CreateGeometry2002(){
370 ////////////////////////////////////////////////////////////////////////
371 // This routine defines and Creates the geometry for version 1 of the ITS.
372 // ALIC ALICE Mother Volume
373 // |- ITSV ITS Mother Volume
374 // |- IDET Detector under Test
375 // | |- ITS0 SPD Si Chip
376 // | | |- ITST SPD Sensitivve Volume
377 // | |- IPC0 *5 Readout chip
378 // |- ITEL *4 SPD Telescope
379 // |- IMB0 SPD Si Chip
380 // | |- IMBS SPD Sensitive volume
381 // |- ICMB Chip MiniBus.
382 // Inputs:
383 // none.
384 // Outputs:
385 // none.
386 // Return:
387 // none.
388 ////////////////////////////////////////////////////////////////////////
6078cf56 389 Float_t data[49];
390 // Define media off-set
391 Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
392 Int_t idrotm[4]; // Array of rotation matrix indexes
393 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
394 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
395 Float_t yposition= 0.0;
396
462482c0 397 if(gMC==0) return;
6078cf56 398 // Define Rotation-reflextion Matrixes needed
399 // 0 is the unit matrix
400 AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
401 data[0] = 10.0;
402 data[1] = 50.0;
403 data[2] = 100.0;
404 gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
405 gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
406
407 //cout << "idtmed[0]=" << idtmed[0]<<endl;
408 //cout << "idtmed[1]=" << idtmed[1]<<endl;
409 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
410 // SPD part of telescope (MiniBuS)
411 data[0] = detMiniBusX = 0.705;
412 data[1] = detMiniBusY = 0.5*ddettelescope;
413 data[2] = detMiniBusZ = 3.536;
414 gMC->Gsvolu("IMB0", "BOX ", idtmed[1], data, 3); // contains detector
415 data[0] = 0.64;
416 data[1] = 0.5*ddettelescope;
417 data[2] = 3.48;
418 gMC->Gsvolu("IMBS","BOX ",idtmed[1],data,3); // sensitive detecor volulme
419 gMC->Gspos("IMBS",1,"IMB0",0.0,0.0,0.0,0,"ONLY"); // place IMBS inside
420 // IMB0 with no translation and unit rotation matrix.
421 Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
422 data[0] = chipMiniBusX = 0.793;
423 data[1] = chipMiniBusY = 0.5*dchipMiniBus;
424 data[2] = chipMiniBusZ = 0.68;
425 gMC->Gsvolu("ICMB","BOX ",idtmed[1],data, 3); // chip Minibus
426 data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
427 data[1] = detMiniBusY+chipMiniBusY;
428 data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
429 gMC->Gsvolu("ITEL","BOX ",idtmed[0],data,3);
430 gMC->Gspos("IMB0",1,"ITEL",0.0,data[1]-detMiniBusY,0.0,0,"ONLY");
431 gMC->Gspos("ICMB",1,"ITEL",0.0,-data[1]+chipMiniBusY,0.0,0,"ONLY");
432
433 // SPD under test
434 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
435 data[0] = spdX = 0.705;
436 data[1] = spdY = 0.5*ddettest;
437 data[2] = spdZ = 3.536;
438 gMC->Gsvolu("ITS0", "BOX ", idtmed[1], data, 3); // contains detector
439 data[0] = 0.64;
440 data[1] = 0.5*ddettest;
441 data[2] = 3.48;
442 gMC->Gsvolu("ITST","BOX ",idtmed[1],data,3);// sensitive detecor volume
443 gMC->Gspos("ITST",1,"ITS0",0.0,0.0,0.0,0,"ONLY"); // place ITST inside
444 // ITS0 with no translation and unit rotation matrix.
445 data[0] = spdchipX = 0.793;
446 data[1] = spdchipY = 0.5*dchiptest;
447 data[2] = spdchipZ = 0.68;
448 gMC->Gsvolu("IPC0", "BOX ", idtmed[1],data,3); // chip under test
449 data[0] = TMath::Max(spdchipX,spdX);
450 data[1] = spdY+spdchipY;
451 data[2] = TMath::Max(spdchipZ,spdZ);
452 gMC->Gsvolu("IDET","BOX ",idtmed[0],data,3);
453 gMC->Gspos("ITS0",1,"IDET",0.0,data[1]-spdY,0.0,0,"ONLY");
454 for(Int_t i=-2;i<3;i++) gMC->Gspos("IPC0",i+3,"IDET",0.0,-data[1]+spdchipY,
455 i*2.*spdchipZ+i*0.25*(spdZ-5.*spdchipZ),0,"ONLY");
456
457 // Positions detectors, Beam Axis Z, X to the right, Y up to the sky.
458 Float_t p00X,p00Y,p00Z,p01X,p01Y,p01Z,p10X,p10Y,p10Z,p11X,p11Y,p11Z;
459 p00X = 0.0;
460 p00Y = 0.0;
461 p00Z = -38.0;
462 gMC->Gspos("ITEL",1,"ITSV",p00X,p00Y,p00Z,idrotm[0],"ONLY");
463 p01X = 0.0;
464 p01Y = 0.0;
465 p01Z = p00Z+2.0;
466 gMC->Gspos("ITEL",2,"ITSV",p01X,p01Y,p01Z,idrotm[0],"ONLY");
467 Float_t pdetX,pdetY,pdetZ;
468 pdetX = 0.0;
469 pdetY = 0.0+yposition;
470 pdetZ = p01Z+38.0;
471 gMC->Gspos("IDET",1,"ITSV",pdetX,pdetY,pdetZ,idrotm[0],"ONLY");
472 p10X = 0.0;
473 p10Y = 0.0;
474 p10Z = pdetZ + 34.5;
475 gMC->Gspos("ITEL",3,"ITSV",p10X,p10Y,p10Z,idrotm[0],"ONLY");
476 p11X = 0.0;
477 p11Y = 0.0;
478 p11Z = p10Z+2.0;
479 gMC->Gspos("ITEL",4,"ITSV",p11X,p11Y,p11Z,idrotm[0],"ONLY");
480}
481//______________________________________________________________________
482void AliITSvSPD02::CreateMaterials(){
483 ////////////////////////////////////////////////////////////////////////
a421d869 484 //
485 // Create ITS SPD test beam materials
486 // This function defines the default materials used in the Geant
487 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
488 // AliITSvSPD02.
489 // In general it is automatically replaced by
023ae34b 490 // the CreateMaterials routine defined in AliITSv?. Should the function
a421d869 491 // CreateMaterials not exist for the geometry version you are using this
492 // one is used. See the definition found in AliITSv5 or the other routine
493 // for a complete definition.
494 //
495 // Inputs:
496 // none.
497 // Outputs:
498 // none.
499 // Return:
500 // none.
501 /////////////////////////////////////////////////////////////////////////
502
503 switch (fGeomNumber){
504 case 2002:
505 CreateMaterials2002();
506 break;
507 default:
508 CreateMaterials2002();
509 break;
510 } // end switch
511}
512//______________________________________________________________________
513void AliITSvSPD02::CreateMaterials2002(){
514 ////////////////////////////////////////////////////////////////////////
6078cf56 515 //
516 // Create ITS SPD test beam materials
517 // This function defines the default materials used in the Geant
518 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
519 // AliITSvSPD02.
520 // In general it is automatically replaced by
023ae34b 521 // the CreateMaterials routine defined in AliITSv?. Should the function
6078cf56 522 // CreateMaterials not exist for the geometry version you are using this
523 // one is used. See the definition found in AliITSv5 or the other routine
524 // for a complete definition.
525 //
526 // Inputs:
527 // none.
528 // Outputs:
529 // none.
530 // Return:
531 // none.
532 /////////////////////////////////////////////////////////////////////////
533 Float_t tmaxfdSi = 0.1; // Degree
534 Float_t stemaxSi = 0.0075; // cm
535 Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
536 Float_t epsilSi = 1.0E-4;//
537 Float_t stminSi = 0.0; // cm "Default value used"
538
539 Float_t tmaxfdAir = 0.1; // Degree
540 Float_t stemaxAir = .10000E+01; // cm
541 Float_t deemaxAir = 0.1; // Fraction of particle's energy 0<deemax<=1
542 Float_t epsilAir = 1.0E-4;//
543 Float_t stminAir = 0.0; // cm "Default value used"
544 Int_t ifield = gAlice->Field()->Integ();
545 Float_t fieldm = gAlice->Field()->Max();
546
547 AliMaterial(1,"AIR$",0.14610E+02,0.73000E+01,0.12050E-02,
aacedc3e 548 0.30423E+05,0.99900E+03);
6078cf56 549 AliMedium(1,"AIR$",1,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,
aacedc3e 550 epsilAir,stminAir);
6078cf56 551
552 AliMaterial(2,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,
aacedc3e 553 0.93600E+01,0.99900E+03);
6078cf56 554 AliMedium(2,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
aacedc3e 555 epsilSi,stminSi);
6078cf56 556}
557//______________________________________________________________________
3be5c40b 558Int_t AliITSvSPD02::DecodeDetector(Int_t id,Int_t cpy,Int_t &lay,Int_t &lad,
559 Int_t &det)const{
560 // Based on the geometry tree defined in Geant 3.21, this
561 // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
562 // sturture.
563 // Inputs:
564 // Int_t id Detector volume id
565 // Int_t cpy Detector copy number
566 // Outputs:
567 // Int_t lay layer number
568 // Int_t lad ladder number
569 // Int_t det detector number
570 // Return:
571 // The module number
572 Int_t mod;
573
574 lad = det = 1;
575 lay = cpy;
576 if(cpy>2 && id==fIdSens[0]) lay = cpy + 1;
577 if(id==fIdSens[1]) lay = 3;
578 mod = lay - 1;
579 return mod;
580}
581//______________________________________________________________________
6078cf56 582void AliITSvSPD02::InitAliITSgeom(){
583 // Based on the geometry tree defined in Geant 3.21, this
584 // routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
585 // sturture.
586 // Inputs:
587 // none.
588 // Outputs:
589 // none.
590 // Return:
591 // none.
3be5c40b 592 const Int_t kltypess=2;
593 const Int_t knlayers=5;
594 const TString knames[kltypess]=
595 {"ALIC_1/ITSV_1/ITEL_%d/IMB0_1/IMBS_1",//lay=1,2,4,5
596 "ALIC_1/ITSV_1/IDET_%d/ITS0_1/ITST_1"};// lay=3
597 const Int_t kitsGeomTreeCopys[2]={4,1};
598 const Int_t knlad[knlayers]={knlayers*1},kndet[knlayers]={knlayers*1};
599 TString path,shapeName;
600 TGeoHMatrix matrix;
601 TArrayD shapePar;
602 TArrayF shapeParF;
603 Double_t trans[3]={3*0.0},rot[10]={10*0.0};
604 Int_t npar=3,mod,i,j,lay,lad,det,cpy;
605 Float_t par[20];
606
607 par[0]=0.64;par[1]=0.5*300.0E-4;par[2]=3.48;
608 mod=5;
609 AliITSgeom* geom = new AliITSgeom(0,knlayers,knlad,kndet,mod);
7d62fb64 610 SetITSgeom(geom);
3be5c40b 611 for(i=0;i<kltypess;i++)for(cpy=1;cpy<=kitsGeomTreeCopys[i];cpy++){
612 path.Form(knames[i].Data(),cpy);
613 gMC->GetTransformation(path.Data(),matrix);
614 gMC->GetShape(path.Data(),shapeName,shapePar);
615 shapeParF.Set(shapePar.GetSize());
616 for(j=0;j<shapePar.GetSize();j++) shapeParF[j]=shapePar[j];
617 mod = DecodeDetector(fIdSens[i],cpy,lay,lad,det);
618 geom->CreateMatrix(mod,lay,lad,det,kSPD,trans,rot);
619 geom->SetTrans(mod,matrix.GetTranslation());
620 geom->SetRotMatrix(mod,matrix.GetRotationMatrix());
621 geom->GetGeomMatrix(mod)->SetPath(path.Data());
622 if(!(geom->IsShapeDefined((Int_t)kSPD)))
623 geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(npar,par));
624 } // end for i,cpy/
6078cf56 625 return;
626}
627//______________________________________________________________________
628void AliITSvSPD02::Init(){
629 ////////////////////////////////////////////////////////////////////////
630 // Initialise the ITS after it has been created.
631 // Inputs:
632 // none.
633 // Outputs:
634 // none.
635 // Return:
636 // none.
637 ////////////////////////////////////////////////////////////////////////
638 Int_t i;
639
640 cout << endl;
641 for(i=0;i<26;i++) cout << "*";
642 cout << " ITSvSPD02" << fMinorVersion << "_Init ";
643 for(i=0;i<25;i++) cout << "*";cout << endl;
aacedc3e 644
6078cf56 645 if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
646 if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
7d62fb64 647 if(GetITSgeom()!=0) SetITSgeom(0x0);
648 AliITSgeom* geom = new AliITSgeom();
649 SetITSgeom(geom);
650 if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
6078cf56 651 if(!fGeomDetIn) this->InitAliITSgeom();
7d62fb64 652 if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
6078cf56 653 AliITS::Init();
aacedc3e 654
6078cf56 655 for(i=0;i<72;i++) cout << "*";
656 cout << endl;
462482c0 657 if(gMC) fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
658 else fIDMother = 0;
6078cf56 659}
660//______________________________________________________________________
661void AliITSvSPD02::SetDefaults(){
662 // sets the default segmentation, response, digit and raw cluster classes
663 // Inputs:
664 // none.
665 // Outputs:
666 // none.
667 // Return:
668 // none.
669 const Float_t kconv = 1.0e+04; // convert cm to microns
670
671 Info("SetDefaults","Setting up only SPD detector");
672
7d62fb64 673 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
674 fDetTypeSim->SetITSgeom(GetITSgeom());
6078cf56 675 AliITSgeomSPD *s0;
676 Int_t i;
677 Float_t bx[256],bz[280];
fcf95fc7 678 fDetTypeSim->ResetCalibrationArray();
7d62fb64 679 fDetTypeSim->ResetSegmentation();
680
6078cf56 681 //SPD
88cb7938 682 // Get shape info. Do it this way for now.
7d62fb64 683 s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD);
fcf95fc7 684 AliITSCalibration *resp0=new AliITSCalibrationSPD();
3a7c3e6d 685 resp0->SetTemperature();
686 resp0->SetDistanceOverVoltage();
fcf95fc7 687 SetCalibrationModel(0,resp0);
3a7c3e6d 688
023ae34b 689 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD();
6078cf56 690 seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
691 s0->GetDz()*2.*kconv, // for now.
692 s0->GetDy()*2.*kconv); // x,z,y full width in microns.
693 seg0->SetNPads(256,160);// Number of Bins in x and z
694 for(i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns.
695 for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
696 for(i=160;i<280;i++) bz[i] = 0.0; // Outside of detector.
697 bz[ 31] = bz[ 32] = 625.0; // first chip boundry
698 bz[ 63] = bz[ 64] = 625.0; // first chip boundry
699 bz[ 95] = bz[ 96] = 625.0; // first chip boundry
700 bz[127] = bz[128] = 625.0; // first chip boundry
701 bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
702 seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
703 SetSegmentationModel(kSPD,seg0);
704 // set digit and raw cluster classes to be used
fcf95fc7 705 const char *kData0=(fDetTypeSim->GetCalibrationModel(0))->DataType();
7d62fb64 706 if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit");
707 else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
aacedc3e 708// SetSimulationModel(kSPD,new AliITSsimulationSPDdubna(seg0,resp0));
6078cf56 709// iDetType->ReconstructionModel(new AliITSClusterFinderSPD());
7d62fb64 710
c789ee28 711/*
fcf95fc7 712 SetResponseModel(kSDD,new AliITSCalibrationSDD());
48232831 713 SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
714 DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
715
fcf95fc7 716 SetResponseModel(kSSD,new AliITSCalibrationSSD());
48232831 717 SetSegmentationModel(kSSD,new AliITSsegmentationSSD());
718 DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
c789ee28 719*/
7d62fb64 720 if(fgkNTYPES>3){
6078cf56 721 Warning("SetDefaults",
722 "Only the four basic detector types are initialised!");
723 }// end if
724 return;
725}
726//______________________________________________________________________
12e7c97c 727void AliITSvSPD02::SetDefaultSimulation(){
728 // sets the default simulation.
729 // Inputs:
730 // none.
731 // Outputs:
732 // none.
733 // Return:
734 // none.
735
7d62fb64 736 if(GetITSgeom()==0){
737 Warning("SetDefaultSimulation","ITS geometry is null!");
738 return;
739 }
740
741 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
742 AliITSsimulation *sim;
8ba39da9 743 //AliITSsegmentation *seg;
fcf95fc7 744 //AliITSCalibration *res;
3a7c3e6d 745 if(fDetTypeSim){
746 sim = fDetTypeSim->GetSimulationModel(kSPD);
747 if (!sim) {
8ba39da9 748 //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
fcf95fc7 749 //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD());
5bfe44ce 750 sim = new AliITSsimulationSPD(fDetTypeSim);
3a7c3e6d 751 SetSimulationModel(kSPD,sim);
752 }else{ // simulation exists, make sure it is set up properly.
fcf95fc7 753 sim->SetCalibrationModel(GetITSgeom()->GetStartSPD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD()));
8ba39da9 754 sim->SetSegmentationModel(kSPD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
3a7c3e6d 755 sim->Init();
756 } // end if
757 } // end if iDetType
758
7d62fb64 759 /*
3a7c3e6d 760 if(fDetTypeSim){
7d62fb64 761 sim = fDetTypeSim->GetSimulationModel(kSDD);
aacedc3e 762 if (!sim) {
7d62fb64 763 seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
fcf95fc7 764 res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
aacedc3e 765 sim = new AliITSsimulationSDD(seg,res);
766 SetSimulationModel(kSDD,sim);
767 }else{ // simulation exists, make sure it is set up properly.
fcf95fc7 768 sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()));
7d62fb64 769 sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
770 sim->Init();
aacedc3e 771 } //end if
772 } // end if iDetType
7d62fb64 773 if(fDetTypeSim){
774 sim = fDetTypeSim->GetSimulationModel(kSSD);
aacedc3e 775 if (!sim) {
7d62fb64 776 seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
fcf95fc7 777 res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
aacedc3e 778 sim = new AliITSsimulationSSD(seg,res);
779 SetSimulationModel(kSSD,sim);
780 }else{ // simulation exists, make sure it is set up properly.
fcf95fc7 781 sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()));
7d62fb64 782 sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
783 sim->Init();
aacedc3e 784 } // end if
7d62fb64 785 } //
786 */
12e7c97c 787}
788//______________________________________________________________________
78b50563 789void AliITSvSPD02::DrawModule() const {
6078cf56 790 ////////////////////////////////////////////////////////////////////////
791 // Draw a shaded view of the ITS SPD test beam version 1.
792 // Inputs:
793 // none.
794 // Outputs:
795 // none.
796 // Return:
797 // none.
798 ////////////////////////////////////////////////////////////////////////
799 // Set everything unseen
800 gMC->Gsatt("*", "seen", -1);
801 // Set ALIC mother visible
802 gMC->Gsatt("ALIC","SEEN",0);
803 // Set ALIC ITS visible
804 gMC->Gsatt("ITSV","SEEN",0);
805 // Set ALIC Telescopes visible
806 gMC->Gsatt("ITEL","SEEN",0);
807 // Set ALIC detetcor visible
808 gMC->Gsatt("IDET","SEEN",0);
809 // Set Detector chip mother visible and drawn
810 gMC->Gsatt("IPC0","SEEN",1);
811 // Set Detector mother visible and drawn
812 gMC->Gsatt("ITS0","SEEN",1);
813 // Set minibus chip mother visible and drawn
814 gMC->Gsatt("ICMB","SEEN",1);
815 // Set minibus mother visible and drawn
816 gMC->Gsatt("IMB0","SEEN",1);
817}
818//______________________________________________________________________
819void AliITSvSPD02::StepManager(){
820 ////////////////////////////////////////////////////////////////////////
821 // Called for every step in the ITS SPD test beam, then calles the
822 // AliITShit class creator with the information to be recoreded about
823 // that hit.
824 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
825 // printing of information to a file which can be used to create a .det
826 // file read in by the routine CreateGeometry(). If set to 0 or any other
827 // value except 1, the default behavior, then no such file is created nor
828 // it the extra variables and the like used in the printing allocated.
829 // Inputs:
830 // none.
831 // Outputs:
832 // none.
833 // Return:
834 // none.
835 ////////////////////////////////////////////////////////////////////////
3be5c40b 836 Int_t copy=0, id;
6078cf56 837 TLorentzVector position, momentum;
838 static TLorentzVector position0;
839 static Int_t stat0=0;
840 if((id=gMC->CurrentVolID(copy) == fIDMother)&&
841 (gMC->IsTrackEntering()||gMC->IsTrackExiting())){
aacedc3e 842 copy = fTrackReferences->GetEntriesFast();
843 TClonesArray &lTR = *fTrackReferences;
844 // Fill TrackReference structure with this new TrackReference.
845 new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->
846 GetCurrentTrackNumber());
6078cf56 847 } // if Outer ITS mother Volume
848 if(!(this->IsActive())){
aacedc3e 849 return;
6078cf56 850 } // end if !Active volume.
851 Int_t vol[5];
852 TClonesArray &lhits = *fHits;
853 //
854 // Track status
855 vol[3] = 0;
856 vol[4] = 0;
857 if(gMC->IsTrackInside()) vol[3] += 1;
858 if(gMC->IsTrackEntering()) vol[3] += 2;
859 if(gMC->IsTrackExiting()) vol[3] += 4;
860 if(gMC->IsTrackOut()) vol[3] += 8;
861 if(gMC->IsTrackDisappeared()) vol[3] += 16;
862 if(gMC->IsTrackStop()) vol[3] += 32;
863 if(gMC->IsTrackAlive()) vol[3] += 64;
864 //
865 // Fill hit structure.
866 if(!(gMC->TrackCharge())) return;
867 id = gMC->CurrentVolID(copy);
48232831 868 if(id==fIdSens[0]){ // Volume name "IMBS"
aacedc3e 869 vol[2] = vol[1] = 1; // Det, ladder
870 id = gMC->CurrentVolOffID(2,copy);
871 //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
872 vol[0] = copy; // Lay
873 if(copy>2) vol[0]++;
48232831 874 } else if(id == fIdSens[1]){ // Volume name "ITST"
aacedc3e 875 vol[0] = 3; // layer
876 vol[1] = 1; // ladder
877 id = gMC->CurrentVolOffID(2,copy);
878 //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
879 vol[2] = 1; // detector
6078cf56 880 } else return; // end if
881 //
882 gMC->TrackPosition(position);
883 gMC->TrackMomentum(momentum);
884 vol[4] = stat0;
885 if(gMC->IsTrackEntering()){
aacedc3e 886 position0 = position;
887 stat0 = vol[3];
888 return;
6078cf56 889 } // end if IsEntering
890 // Fill hit structure with this new hit only for non-entrerance hits.
aacedc3e 891 else new(lhits[fNhits++]) AliITShit(fIshunt,
892 gAlice->GetMCApp()->GetCurrentTrackNumber(),
893 vol,gMC->Edep(),gMC->TrackTime(),
894 position,position0,momentum);
6078cf56 895 //
896 position0 = position;
897 stat0 = vol[3];
898
899 return;
900}
901