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