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