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