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