]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/AliITSUv0.cxx
Implementing the wrapper volumes (Mario)
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUv0.cxx
CommitLineData
7302d0f8 1/**************************************************************************
2 * Copyright(c) 2007-2009, 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: AliITSUv0.cxx */
18
19
20//========================================================================
21//
22// Geometry for the Upgrade of the Inner Tracking System
23//
24// Mario Sitta (sitta@to.infn.it)
25// Chinorat Kobdaj (kobdaj@g.sut.ac.th)
26//
27//========================================================================
28
29
30
31// $Log: AliITSUv0.cxx,v $
32
33#include <TClonesArray.h>
34#include <TGeoGlobalMagField.h>
35#include <TGeoManager.h>
36#include <TGeoMatrix.h>
37#include <TGeoPhysicalNode.h>
38#include <TGeoVolume.h>
5e0a1821 39#include <TGeoTube.h>
7302d0f8 40#include <TGeoXtru.h>
41#include <TLorentzVector.h>
42#include <TString.h>
43#include <TVirtualMC.h>
44
45#include "AliITSU.h"
46#include "AliITSUHit.h"
47#include "AliLog.h"
48#include "AliMC.h"
49#include "AliMagF.h"
50#include "AliRun.h"
51#include "AliTrackReference.h"
52#include "AliITSv11Geometry.h"
53#include "AliITSUv0Layer.h"
54#include "AliITSUv0.h"
55#include "AliITSUGeomTGeo.h"
56#include "AliGeomManager.h"
57using namespace TMath;
58
59
60ClassImp(AliITSUv0)
61
62//______________________________________________________________________
63AliITSUv0::AliITSUv0()
64: fLayTurbo(0)
65 ,fLayPhi0(0)
66 ,fLayRadii(0)
67 ,fLayZLength(0)
68 ,fLaddPerLay(0)
69 ,fModPerLadd(0)
70 ,fLadThick(0)
71 ,fLadWidth(0)
72 ,fLadTilt(0)
73 ,fDetThick(0)
74 ,fDetTypeID(0)
75 ,fBuildLevel(0)
76 ,fUpGeom(0)
77 ,fStaveModel(kModel0)
78{
79 // Standard default constructor
80 // Inputs:
81 // none.
82 // Outputs:
83 // none.
84 // Return:
85 // none.
86}
87
88//______________________________________________________________________
89AliITSUv0::AliITSUv0(const char *title,const Int_t nlay)
90 :AliITSU(title,nlay)
91 ,fLayTurbo(0)
92 ,fLayPhi0(0)
93 ,fLayRadii(0)
94 ,fLayZLength(0)
95 ,fLaddPerLay(0)
96 ,fModPerLadd(0)
97 ,fLadThick(0)
98 ,fLadWidth(0)
99 ,fLadTilt(0)
100 ,fDetThick(0)
101 ,fDetTypeID(0)
102 ,fBuildLevel(0)
103 ,fUpGeom(0)
104 ,fStaveModel(kModel0)
105{
106 // Standard constructor for the Upgrade geometry.
107 // Inputs:
108 // const char * name Ignored, set to "ITS"
109 // const char * title Arbitrary title
110 // const Int_t nlay Number of layers
111 //
112 fLayerName = new TString[fNLayers];
113 //
114 for (Int_t j=0; j<fNLayers; j++)
115 fLayerName[j].Form("%s%d",AliITSUGeomTGeo::GetITSSensorPattern(),j); // See AliITSUv0Layer
116 //
117 fLayTurbo = new Bool_t[fNLayers];
118 fLayPhi0 = new Double_t[fNLayers];
119 fLayRadii = new Double_t[fNLayers];
120 fLayZLength = new Double_t[fNLayers];
121 fLaddPerLay = new Int_t[fNLayers];
122 fModPerLadd = new Int_t[fNLayers];
123 fLadThick = new Double_t[fNLayers];
124 fLadWidth = new Double_t[fNLayers];
125 fLadTilt = new Double_t[fNLayers];
126 fDetThick = new Double_t[fNLayers];
127 fDetTypeID = new UInt_t[fNLayers];
128 fBuildLevel = new Int_t[fNLayers];
129
130
131 fUpGeom = new AliITSUv0Layer*[fNLayers];
132
133 if (fNLayers > 0) { // if not, we'll Fatal-ize in CreateGeometry
134 for (Int_t j=0; j<fNLayers; j++) {
135 fLayPhi0[j] = 0;
136 fLayRadii[j] = 0.;
137 fLayZLength[j] = 0.;
138 fLaddPerLay[j] = 0;
139 fModPerLadd[j] = 0;
140 fLadWidth[j] = 0.;
141 fDetThick[j] = 0.;
142 fDetTypeID[j] = 0;
143 fBuildLevel[j] = 0;
144 fUpGeom[j] = 0;
145 }
146 }
147}
148
149//______________________________________________________________________
150AliITSUv0::~AliITSUv0() {
151 // Standard destructor
152 // Inputs:
153 // none.
154 // Outputs:
155 // none.
156 // Return:
157 // none.
158 delete [] fLayTurbo;
159 delete [] fLayPhi0;
160 delete [] fLayRadii;
161 delete [] fLayZLength;
162 delete [] fLaddPerLay;
163 delete [] fModPerLadd;
164 delete [] fLadThick;
165 delete [] fLadWidth;
166 delete [] fLadTilt;
167 delete [] fDetThick;
168 delete [] fDetTypeID;
169 delete [] fBuildLevel;
170 delete [] fUpGeom;
171
172}
173
174//______________________________________________________________________
175void AliITSUv0::AddAlignableVolumes() const{
176 // Creates entries for alignable volumes associating the symbolic volume
177 // name with the corresponding volume path.
178 //
179 // Records in the alignable entries the transformation matrices converting
180 // TGeo local coordinates (in the RS of alignable volumes) to the tracking
181 // system
182 // For this, this function has to run before the misalignment because we
183 // are using the ideal positions in the AliITSgeom object.
184 // Inputs:
185 // none.
186 // Outputs:
187 // none.
188 // Return:
189 // none.
190
191 AliInfo("Add ITS alignable volumes");
192
193 if (!gGeoManager) { AliFatal("TGeoManager doesn't exist !"); return; }
194 TString pth;
195 //
196 pth = Form("ALIC_1/%s_2",AliITSUGeomTGeo::GetITSVolPattern());
197 // RS: to be checked with MS
198 if( !gGeoManager->SetAlignableEntry(AliITSUGeomTGeo::ComposeSymNameITS(),pth.Data()) )
199 AliFatal(Form("Unable to set alignable entry ! %s :: %s","ITS",pth.Data()));
200 //
201 int modNum = 0;
202 //
203 for (int lr=0; lr<fNLayers; lr++) {
204 //
205 pth = Form("ALIC_1/%s_2/%s%d_1",AliITSUGeomTGeo::GetITSVolPattern(),AliITSUGeomTGeo::GetITSLayerPattern(),lr);
206 //printf("SetAlignable: %s %s\n",snm.Data(),pth.Data());
207 gGeoManager->SetAlignableEntry(AliITSUGeomTGeo::ComposeSymNameLayer(lr),pth.Data());
208 //
209 for (int ld=0; ld<fLaddPerLay[lr]; ld++) {
210 //
211 TString pthL = Form("%s/%s%d_%d",pth.Data(),AliITSUGeomTGeo::GetITSLadderPattern(),lr,ld);
212 //printf("SetAlignable: %s %s\n",snmL.Data(),pthL.Data());
213 gGeoManager->SetAlignableEntry(AliITSUGeomTGeo::ComposeSymNameLadder(lr,ld),pthL.Data());
214 //
215 for (int md=0; md<fModPerLadd[lr]; md++) {
216 //
217 TString pthM = Form("%s/%s%d_%d",pthL.Data(),AliITSUGeomTGeo::GetITSModulePattern(),lr,md);
218 //
219 // RS: Attention, this is a hack: AliGeomManager cannot accomodate all ITSU modules w/o
220 // conflicts with TPC. For this reason we define the UID of the module to be simply its ID
221 // int modUID = AliGeomManager::LayerToVolUID(lr+1,modNum++); // here modNum would be module within the layer
222 int modUID = AliITSUGeomTGeo::ModuleVolUID( modNum++ );
223 //
224 gGeoManager->SetAlignableEntry(AliITSUGeomTGeo::ComposeSymNameModule(lr,ld,md),pthM.Data(),modUID);
225 //
226 }
227 }
228 }
229 //
230}
231
232//______________________________________________________________________
233void AliITSUv0::CreateGeometry() {
234
235 // Create the geometry and insert it in the mother volume ITSV
236 TGeoManager *geoManager = gGeoManager;
237
238 TGeoVolume *vALIC = geoManager->GetVolume("ALIC");
239
240 new TGeoVolumeAssembly(AliITSUGeomTGeo::GetITSVolPattern());
241 TGeoVolume *vITSV = geoManager->GetVolume(AliITSUGeomTGeo::GetITSVolPattern());
242 vALIC->AddNode(vITSV, 2, 0); // Copy number is 2 to cheat AliGeoManager::CheckSymNamesLUT
243
244 //
245 const Int_t kLength=100;
246 Char_t vstrng[kLength] = "xxxRS"; //?
247 vITSV->SetTitle(vstrng);
248 //
249 // Check that we have all needed parameters
250 if (fNLayers <= 0) AliFatal(Form("Wrong number of layers (%d)",fNLayers));
251 //
252 for (Int_t j=0; j<fNLayers; j++) {
253 if (fLayRadii[j] <= 0) AliFatal(Form("Wrong layer radius for layer %d (%f)",j,fLayRadii[j]));
254 if (fLayZLength[j] <= 0) AliFatal(Form("Wrong layer length for layer %d (%f)",j,fLayZLength[j]));
255 if (fLaddPerLay[j] <= 0) AliFatal(Form("Wrong number of ladders for layer %d (%d)",j,fLaddPerLay[j]));
256 if (fModPerLadd[j] <= 0) AliFatal(Form("Wrong number of modules for layer %d (%d)",j,fModPerLadd[j]));
257 if (fLadThick[j] < 0) AliFatal(Form("Wrong ladder thickness for layer %d (%f)",j,fLadThick[j]));
258 if (fLayTurbo[j] && fLadWidth[j] <= 0) AliFatal(Form("Wrong ladder width for layer %d (%f)",j,fLadWidth[j]));
259 if (fDetThick[j] < 0) AliFatal(Form("Wrong module thickness for layer %d (%f)",j,fDetThick[j]));
260 //
261 if (j > 0) {
262 if (fLayRadii[j]<=fLayRadii[j-1]) AliFatal(Form("Layer %d radius (%f) is smaller than layer %d radius (%f)",
263 j,fLayRadii[j],j-1,fLayRadii[j-1]));
264 } // if (j > 0)
265
266 if (fLadThick[j] == 0) AliInfo(Form("Ladder thickness for layer %d not set, using default",j));
267 if (fDetThick[j] == 0) AliInfo(Form("Module thickness for layer %d not set, using default",j));
268
269 } // for (Int_t j=0; j<fNLayers; j++)
270
5e0a1821 271 // Create the wrapper volumes
272 TGeoVolume *wrap123=0, *wrap45=0, *wrap67=0;
273 if (fNLayers <= 3) {
274 wrap123 = CreateWrapperVolume(fNLayers);
275 vITSV->AddNode(wrap123, 1, 0);
276 }
277 else if (fNLayers <= 5) {
278 wrap123 = CreateWrapperVolume(3);
279 wrap45 = CreateWrapperVolume(fNLayers);
280 vITSV->AddNode(wrap123, 1, 0);
281 vITSV->AddNode(wrap45 , 1, 0);
282 }
283 else {
284 wrap123 = CreateWrapperVolume(3);
285 wrap45 = CreateWrapperVolume(5);
286 wrap67 = CreateWrapperVolume(fNLayers);
287 vITSV->AddNode(wrap123, 1, 0);
288 vITSV->AddNode(wrap45 , 1, 0);
289 vITSV->AddNode(wrap67 , 1, 0);
290 }
291
7302d0f8 292 // Now create the actual geometry
293 for (Int_t j=0; j<fNLayers; j++) {
294 if (fLayTurbo[j]) {
295 fUpGeom[j] = new AliITSUv0Layer(j,kTRUE,kFALSE);
296 fUpGeom[j]->SetLadderWidth(fLadWidth[j]);
297 fUpGeom[j]->SetLadderTilt(fLadTilt[j]);
298 }
299 else fUpGeom[j] = new AliITSUv0Layer(j,kFALSE);
300 //
301 fUpGeom[j]->SetPhi0(fLayPhi0[j]);
302 fUpGeom[j]->SetRadius(fLayRadii[j]);
303 fUpGeom[j]->SetZLength(fLayZLength[j]);
304 fUpGeom[j]->SetNLadders(fLaddPerLay[j]);
305 fUpGeom[j]->SetNModules(fModPerLadd[j]);
306 fUpGeom[j]->SetDetType(fDetTypeID[j]);
307 fUpGeom[j]->SetBuildLevel(fBuildLevel[j]);
308 fUpGeom[j]->SetStaveModel(fStaveModel);
309 AliDebug(1,Form("fBuildLevel: %d\n",fBuildLevel[j]));
310 //
311 if (fLadThick[j] != 0) fUpGeom[j]->SetLadderThick(fLadThick[j]);
312 if (fDetThick[j] != 0) fUpGeom[j]->SetSensorThick(fDetThick[j]);
5e0a1821 313 if (j <= 2)
314 fUpGeom[j]->CreateLayer(wrap123);
315 if (j == 3 || j == 4)
316 fUpGeom[j]->CreateLayer(wrap45);
317 if (j > 4)
318 fUpGeom[j]->CreateLayer(wrap67);
7302d0f8 319 }
320 //
321}
322
323//______________________________________________________________________
324void AliITSUv0::CreateMaterials() {
325 // Create ITS materials
326 // This function defines the default materials used in the Geant
327 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
328 // AliITSv11Hybrid.
329 // In general it is automatically replaced by
330 // the CreateMaterials routine defined in AliITSv?. Should the function
331 // CreateMaterials not exist for the geometry version you are using this
332 // one is used. See the definition found in AliITSv5 or the other routine
333 // for a complete definition.
334 // Inputs:
335 // none.
336 // Outputs:
337 // none.
338 // Return:
339 // none.
340
341 Int_t ifield = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
342 Float_t fieldm = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
343
344 Float_t tmaxfd = 0.1; // 1.0; // Degree
345 Float_t stemax = 1.0; // cm
346 Float_t deemax = 0.1; // 30.0; // Fraction of particle's energy 0<deemax<=1
347 Float_t epsil = 1.0E-4; // 1.0; // cm
348 Float_t stmin = 0.0; // cm "Default value used"
349
350 Float_t tmaxfdSi = 0.1; // .10000E+01; // Degree
351 Float_t stemaxSi = 0.0075; // .10000E+01; // cm
352 Float_t deemaxSi = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
353 Float_t epsilSi = 1.0E-4;// .10000E+01;
354 Float_t stminSi = 0.0; // cm "Default value used"
355
356 Float_t tmaxfdAir = 0.1; // .10000E+01; // Degree
357 Float_t stemaxAir = .10000E+01; // cm
358 Float_t deemaxAir = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
359 Float_t epsilAir = 1.0E-4;// .10000E+01;
360 Float_t stminAir = 0.0; // cm "Default value used"
361
362 // AIR
363 Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
364 Float_t zAir[4]={6.,7.,8.,18.};
365 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
366 Float_t dAir = 1.20479E-3;
367
368 // Water
369 Float_t aWater[2]={1.00794,15.9994};
370 Float_t zWater[2]={1.,8.};
371 Float_t wWater[2]={0.111894,0.888106};
372 Float_t dWater = 1.0;
373
374
375 // Kapton
376 Float_t aKapton[4]={1.00794,12.0107, 14.010,15.9994};
377 Float_t zKapton[4]={1.,6.,7.,8.};
378 Float_t wKapton[4]={0.026362,0.69113,0.07327,0.209235};
379 Float_t dKapton = 1.42;
380
381 AliMixture(1,"AIR$",aAir,zAir,dAir,4,wAir);
382 AliMedium(1, "AIR$",1,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
383
384 AliMixture(2,"WATER$",aWater,zWater,dWater,2,wWater);
385 AliMedium(2, "WATER$",2,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
386
387 AliMaterial(3,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
388 AliMedium(3, "SI$",3,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
389
390 AliMaterial(4,"BERILLIUM$",9.01, 4., 1.848, 35.3, 36.7);// From AliPIPEv3
391 AliMedium(4, "BERILLIUM$",4,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
392
393 AliMaterial(5,"COPPER$",0.63546E+02,0.29000E+02,0.89600E+01,0.14300E+01,0.99900E+03);
394 AliMedium(5, "COPPER$",5,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
395
396
397 // needed for STAVE , Carbon, kapton, Epoxy, flexcable
398
399 //AliMaterial(6,"CARBON$",12.0107,6,2.210,999,999);
400 AliMaterial(6,"CARBON$",12.0107,6,2.210/1.3,999,999);
401 AliMedium(6, "CARBON$",6,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
402
403 AliMixture(7,"KAPTON(POLYCH2)$", aKapton, zKapton, dKapton, 4, wKapton);
404 AliMedium(7, "KAPTON(POLYCH2)$",7,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
405
406
407
408 // values below modified as compared to source AliITSv11 !
409
410 //AliMaterial(7,"GLUE$",0.12011E+02,0.60000E+01,0.1930E+01/2.015,999,999); // original
411 AliMaterial(7,"GLUE$",12.011,6,1.93/2.015,999,999); // conform with ATLAS, Corrado, Stefan
412 AliMedium(7, "GLUE$",7,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
413
414 // All types of carbon
415 // Unidirectional prepreg
416 AliMaterial(8,"K13D2U2k$",12.0107,6,1.643,999,999);
417 AliMedium(8, "K13D2U2k$",8,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
418 //Impregnated thread
419 AliMaterial(9,"M60J3K$",12.0107,6,2.21,999,999);
420 AliMedium(9, "M60J3K$",9,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
421 //Impregnated thread
422 AliMaterial(10,"M55J6K$",12.0107,6,1.63,999,999);
423 AliMedium(10, "M55J6K$",10,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
424 // Fabric(0/90)
425 AliMaterial(11,"T300$",12.0107,6,1.725,999,999);
426 AliMedium(11, "T300$",11,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
427 //AMEC Thermasol
428 AliMaterial(12,"FGS003$",12.0107,6,1.6,999,999);
429 AliMedium(12, "FGS003$",12,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
430 // Carbon fleece
431 AliMaterial(13,"CarbonFleece$",12.0107,6,0.4,999,999);
432 AliMedium(13, "CarbonFleece$",13,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
433
434 // Flex cable
435 Float_t aFCm[5]={12.0107,1.00794,14.0067,15.9994,26.981538};
436 Float_t zFCm[5]={6.,1.,7.,8.,13.};
437 Float_t wFCm[5]={0.520088819984,0.01983871336,0.0551367996,0.157399667056, 0.247536};
438 //Float_t dFCm = 1.6087; // original
439 //Float_t dFCm = 2.55; // conform with STAR
440 Float_t dFCm = 2.595; // conform with Corrado
441
442 AliMixture(14,"FLEXCABLE$",aFCm,zFCm,dFCm,5,wFCm);
443 AliMedium(14, "FLEXCABLE$",14,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
444
445}
446
447//______________________________________________________________________
448void AliITSUv0::DefineLayer(const Int_t nlay, const double phi0, const Double_t r,
449 const Double_t zlen, const Int_t nladd,
450 const Int_t nmod, const Double_t lthick,
451 const Double_t dthick, const UInt_t dettypeID)
452{
453 // Sets the layer parameters
454 // Inputs:
455 // nlay layer number
456 // phi0 layer phi0
457 // r layer radius
458 // zlen layer length
459 // nladd number of ladders
460 // nmod number of modules per ladder
461 // lthick ladder thickness (if omitted, defaults to 0)
462 // dthick detector thickness (if omitted, defaults to 0)
463 // Outputs:
464 // none.
465 // Return:
466 // none.
467
468 if (nlay >= fNLayers || nlay < 0) {
469 AliError(Form("Wrong layer number (%d)",nlay));
470 return;
471 }
472
473 fLayTurbo[nlay] = kFALSE;
474 fLayPhi0[nlay] = phi0;
475 fLayRadii[nlay] = r;
476 fLayZLength[nlay] = zlen;
477 fLaddPerLay[nlay] = nladd;
478 fModPerLadd[nlay] = nmod;
479 fLadThick[nlay] = lthick;
480 fDetThick[nlay] = dthick;
481 fDetTypeID[nlay] = dettypeID;
482
483}
484
485//______________________________________________________________________
486void AliITSUv0::DefineLayerTurbo(Int_t nlay, Double_t phi0, Double_t r, Double_t zlen, Int_t nladd,
487 Int_t nmod, Double_t width, Double_t tilt,
488 Double_t lthick,Double_t dthick,
489 UInt_t dettypeID, Int_t buildLevel)
490{
491 // Sets the layer parameters for a "turbo" layer
492 // (i.e. a layer whose ladders overlap in phi)
493 // Inputs:
494 // nlay layer number
495 // phi0 phi of 1st ladder
496 // r layer radius
497 // zlen layer length
498 // nladd number of ladders
499 // nmod number of modules per ladder
500 // width ladder width
501 // tilt layer tilt angle (degrees)
502 // lthick ladder thickness (if omitted, defaults to 0)
503 // dthick detector thickness (if omitted, defaults to 0)
504 // dettypeID ??
505 // buildLevel (if 0, all geometry is build, used for material budget studies)
506 // Outputs:
507 // none.
508 // Return:
509 // none.
510
511 if (nlay >= fNLayers || nlay < 0) {
512 AliError(Form("Wrong layer number (%d)",nlay));
513 return;
514 }
515
516 fLayTurbo[nlay] = kTRUE;
517 fLayPhi0[nlay] = phi0;
518 fLayRadii[nlay] = r;
519 fLayZLength[nlay] = zlen;
520 fLaddPerLay[nlay] = nladd;
521 fModPerLadd[nlay] = nmod;
522 fLadThick[nlay] = lthick;
523 fLadWidth[nlay] = width;
524 fLadTilt[nlay] = tilt;
525 fDetThick[nlay] = dthick;
526 fDetTypeID[nlay] = dettypeID;
527 fBuildLevel[nlay] = buildLevel;
528
529}
530
531//______________________________________________________________________
532void AliITSUv0::GetLayerParameters(Int_t nlay, Double_t &phi0,
533 Double_t &r, Double_t &zlen,
534 Int_t &nladd, Int_t &nmod,
535 Double_t &width, Double_t &tilt,
536 Double_t &lthick, Double_t &dthick,
537 UInt_t &dettype) const
538{
539 // Gets the layer parameters
540 // Inputs:
541 // nlay layer number
542 // Outputs:
543 // phi0 phi of 1st ladder
544 // r layer radius
545 // zlen layer length
546 // nladd number of ladders
547 // nmod number of modules per ladder
548 // width ladder width
549 // tilt ladder tilt angle
550 // lthick ladder thickness
551 // dthick detector thickness
552 // dettype detector type
553 // Return:
554 // none.
555
556 if (nlay >= fNLayers || nlay < 0) {
557 AliError(Form("Wrong layer number (%d)",nlay));
558 return;
559 }
560
561 phi0 = fLayPhi0[nlay];
562 r = fLayRadii[nlay];
563 zlen = fLayZLength[nlay];
564 nladd = fLaddPerLay[nlay];
565 nmod = fModPerLadd[nlay];
566 width = fLadWidth[nlay];
567 tilt = fLadTilt[nlay];
568 lthick = fLadThick[nlay];
569 dthick = fDetThick[nlay];
570 dettype= fDetTypeID[nlay];
571}
572
5e0a1821 573//______________________________________________________________________
574TGeoVolume* AliITSUv0::CreateWrapperVolume(const Int_t nLay)
575{
576 // Creates an air-filled wrapper cylindrical volume for ladders
577 // Inputs:
578 // nLay : the max layer number
579 // Outputs:
580 // the wrapper volume
581 // Return:
582 // none.
583
584 Double_t rMin=0., rMax=0., zLen=0.;
585
586 // 0.98 and 1.02 accounts for a 2% tollerance
587
588 if (nLay <= 3) {
589 rMin = fLayRadii[0];
590 if (fLayTurbo[0])
591 rMin *= fLadWidth[0]*TMath::Sin(fLadTilt[0]*TMath::DegToRad());
592 rMin *= 0.98;
593
594 rMax = fLayRadii[nLay-1];
595 rMax += 0.5; // gosh, we're hardcoding! let's say it's a temporary fix...
596 rMax *= 1.02;
597
598 zLen = 1.02*fLayZLength[nLay-1];
599 }
600
601 if (nLay == 4 || nLay == 5) {
602 rMin = fLayRadii[3];
603 if (fLayTurbo[3])
604 rMin *= fLadWidth[3]*TMath::Sin(fLadTilt[3]*TMath::DegToRad());
605 rMin *= 0.98;
606
607 rMax = fLayRadii[nLay-1];
608 rMax += 0.5; // gosh, we're hardcoding! let's say it's a temporary fix...
609 rMax *= 1.02;
610
611 zLen = 1.02*fLayZLength[nLay-1];
612 }
613
614 if (nLay > 5) {
615 rMin = fLayRadii[5];
616 if (fLayTurbo[5])
617 rMin -= fLadWidth[5]*TMath::Sin(fLadTilt[5]*TMath::DegToRad());
618 rMin *= 0.98;
619
620 rMax = fLayRadii[nLay-1];
621 rMax += 0.5; // gosh, we're hardcoding! let's say it's a temporary fix...
622 rMax *= 1.02;
623
624 zLen = 1.02*fLayZLength[nLay-1];
625 }
626
627 if (zLen == 0) return 0; // No valid nLay, so no volume can be created
628
629 // Now create the actual shape and volume
630 TGeoTube *tube = new TGeoTube(rMin, rMax, zLen);
631
632 TGeoMedium *medAir = gGeoManager->GetMedium("ITS_AIR$");
633
634 char volnam[15];
635 snprintf(volnam, 14, "LayerWrapper%d", nLay);
636
637 TGeoVolume *wrapper = new TGeoVolume(volnam, tube, medAir);
638
639 return wrapper;
640}
641
7302d0f8 642//______________________________________________________________________
643void AliITSUv0::Init()
644{
645 // Initialise the ITS after it has been created.
646 UpdateInternalGeometry();
647 AliITSU::Init();
648 //
649}
650
651//______________________________________________________________________
652Bool_t AliITSUv0::IsLayerTurbo(Int_t nlay)
653{
654 // Returns true if the layer is a "turbo" layer
655 if ( nlay < 0 || nlay > fNLayers ) {
656 AliError(Form("Wrong layer number %d",nlay));
657 return kFALSE;
658 }
659 else return fUpGeom[nlay]->IsTurbo();
660}
661
662//______________________________________________________________________
663void AliITSUv0::SetDefaults()
664{
665 // sets the default segmentation, response, digit and raw cluster classes
666}
667
668//______________________________________________________________________
669void AliITSUv0::StepManager()
670{
671 // Called for every step in the ITS, then calles the AliITSUHit class
672 // creator with the information to be recoreded about that hit.
673 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
674 // printing of information to a file which can be used to create a .det
675 // file read in by the routine CreateGeometry(). If set to 0 or any other
676 // value except 1, the default behavior, then no such file is created nor
677 // it the extra variables and the like used in the printing allocated.
678 // Inputs:
679 // none.
680 // Outputs:
681 // none.
682 // Return:
683 // none.
684 if(!(this->IsActive())) return;
685 if(!(gMC->TrackCharge())) return;
686 //
687 Int_t copy, lay = 0;
688 Int_t id = gMC->CurrentVolID(copy);
689
690 Bool_t notSens = kFALSE;
691 while ((lay<fNLayers) && (notSens = (id!=fIdSens[lay]))) ++lay;
692 //printf("R: %.1f | Lay: %d NotSens: %d\n",positionRS.Pt(), lay, notSens);
693
694 if (notSens) return;
695
696 if(gMC->IsTrackExiting()) {
697 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
698 } // if Outer ITS mother Volume
699
700 static TLorentzVector position, momentum; // Saves on calls to construtors
701 static AliITSUHit hit;// Saves on calls to constructors
702
703 TClonesArray &lhits = *(Hits());
704 Int_t cpn0, cpn1, mod, status = 0;
705 //
706 // Track status
707 if(gMC->IsTrackInside()) status += 1;
708 if(gMC->IsTrackEntering()) status += 2;
709 if(gMC->IsTrackExiting()) status += 4;
710 if(gMC->IsTrackOut()) status += 8;
711 if(gMC->IsTrackDisappeared()) status += 16;
712 if(gMC->IsTrackStop()) status += 32;
713 if(gMC->IsTrackAlive()) status += 64;
714
715 //
716 // retrieve the indices with the volume path
717 //
718 if (lay < 0 || lay >= fNLayers) {
719 AliError(Form("Invalid value: lay=%d. Not an ITS sensitive volume",lay));
720 return; // not an ITS sensitive volume.
721 } else {
722 copy = 1;
723 gMC->CurrentVolOffID(1,cpn1);
724 gMC->CurrentVolOffID(2,cpn0);
725 } //
726
727 mod = fGeomTGeo->GetModuleIndex(lay,cpn0,cpn1);
728 //RS2DEL fInitGeom.DecodeDetector(mod,lay+1,cpn0,cpn1,copy);
729 //
730 // Fill hit structure.
731 //
732 hit.SetModule(mod);
733 hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
734 gMC->TrackPosition(position);
735 gMC->TrackMomentum(momentum);
736 hit.SetPosition(position);
737 hit.SetTime(gMC->TrackTime());
738 hit.SetMomentum(momentum);
739 hit.SetStatus(status);
740 hit.SetEdep(gMC->Edep());
741 hit.SetShunt(GetIshunt());
742 if(gMC->IsTrackEntering()){
743 hit.SetStartPosition(position);
744 hit.SetStartTime(gMC->TrackTime());
745 hit.SetStartStatus(status);
746 return; // don't save entering hit.
747 } // end if IsEntering
748 // Fill hit structure with this new hit.
749 //Info("StepManager","Calling Copy Constructor");
750 new(lhits[fNhits++]) AliITSUHit(hit); // Use Copy Construtor.
751 // Save old position... for next hit.
752 hit.SetStartPosition(position);
753 hit.SetStartTime(gMC->TrackTime());
754 hit.SetStartStatus(status);
755
756 return;
757}
758
759//______________________________________________________________________
760void AliITSUv0::SetLayerDetTypeID(Int_t lr, UInt_t id)
761{
762 // set det type
763 if (!fDetTypeID || fNLayers<=lr) AliFatal(Form("Number of layers %d, %d is manipulated",fNLayers,lr));
764 fDetTypeID[lr] = id;
765}
766
767//______________________________________________________________________
768Int_t AliITSUv0::GetLayerDetTypeID(Int_t lr)
769{
770 // set det type
771 if (!fDetTypeID || fNLayers<=lr) AliFatal(Form("Number of layers %d, %d is manipulated",fNLayers,lr));
772 return fDetTypeID[lr];
773}