]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/UPGRADE/AliITSUv11.cxx
Use the MCchain flag in GetChainForTestMode
[u/mrichter/AliRoot.git] / ITS / UPGRADE / AliITSUv11.cxx
CommitLineData
451f5018 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: AliITSUv11.cxx */
18
19
20//========================================================================
21//
22// Geometry for the Upgrade of the Inner Tracking System
23//
24// Mario Sitta (sitta@to.infn.it)
25//
26//========================================================================
27
28
29
30// $Log: AliITSUv11.cxx,v $
31
32#include <TClonesArray.h>
33#include <TGeoGlobalMagField.h>
34#include <TGeoManager.h>
35#include <TGeoMatrix.h>
36#include <TGeoPhysicalNode.h>
37#include <TGeoVolume.h>
38#include <TGeoXtru.h>
39#include <TLorentzVector.h>
40#include <TString.h>
41#include <TVirtualMC.h>
42
43#include "AliITSU.h"
44#include "AliITSUHit.h"
45#include "AliLog.h"
46#include "AliMC.h"
47#include "AliMagF.h"
48#include "AliRun.h"
49#include "AliTrackReference.h"
50#include "AliITSv11Geometry.h"
51#include "AliITSUv11Layer.h"
52#include "AliITSv11GeomBeamPipe.h"
53#include "AliITSUv11.h"
54#include "AliITSUGeomTGeo.h"
55#include "AliGeomManager.h"
56
57const Double_t AliITSUv11::fgkBeamPipeHalfZLen = 400;
58
59
60ClassImp(AliITSUv11)
61
62//______________________________________________________________________
63AliITSUv11::AliITSUv11()
64: fLayTurbo(0)
65 ,fLayRadii(0)
66 ,fLayZLength(0)
67 ,fLaddPerLay(0)
68 ,fModPerLadd(0)
69 ,fLadThick(0)
70 ,fLadWidth(0)
71 ,fLadTilt(0)
72 ,fDetThick(0)
73 ,fDetTypeID(0)
74 ,fBeamPipe(0)
75 ,fBeamPipeRmin(0)
76 ,fBeamPipeRmax(0)
77 ,fBeamPipeZlen(0)
78 ,fUpGeom(0)
79 ,fBPGeom(0)
80{
81 // Standard default constructor
82 // Inputs:
83 // none.
84 // Outputs:
85 // none.
86 // Return:
87 // none.
88}
89
90//______________________________________________________________________
91AliITSUv11::AliITSUv11(const char *title,const Int_t nlay)
92 :AliITSU(title,nlay)
93 ,fLayTurbo(0)
94 ,fLayRadii(0)
95 ,fLayZLength(0)
96 ,fLaddPerLay(0)
97 ,fModPerLadd(0)
98 ,fLadThick(0)
99 ,fLadWidth(0)
100 ,fLadTilt(0)
101 ,fDetThick(0)
102 ,fDetTypeID(0)
103 ,fBeamPipe(0)
104 ,fBeamPipeRmin(0)
105 ,fBeamPipeRmax(0)
106 ,fBeamPipeZlen(0)
107 ,fUpGeom(0)
108 ,fBPGeom(0)
109{
110 // Standard constructor for the Upgrade geometry.
111 // Inputs:
112 // const char * name Ignored, set to "ITS"
113 // const char * title Arbitrary title
114 // const Int_t nlay Number of layers
115 //
116 fLayerName = new TString[fNLayers];
117 //
118 for (Int_t j=0; j<fNLayers; j++) fLayerName[j].Form("%s%d",AliITSUGeomTGeo::GetITSSensorPattern(),j+1); // See AliITSUv11Layer
119 //
120 fLayTurbo = new Bool_t[fNLayers];
121 fLayRadii = new Double_t[fNLayers];
122 fLayZLength = new Double_t[fNLayers];
123 fLaddPerLay = new Int_t[fNLayers];
124 fModPerLadd = new Int_t[fNLayers];
125 fLadThick = new Double_t[fNLayers];
126 fLadWidth = new Double_t[fNLayers];
127 fLadTilt = new Double_t[fNLayers];
128 fDetThick = new Double_t[fNLayers];
129 fDetTypeID = new UInt_t[fNLayers];
130
131 fUpGeom = new AliITSUv11Layer*[fNLayers];
132
133 if (fNLayers > 0) { // if not, we'll Fatal-ize in CreateGeometry
134 for (Int_t j=0; j<fNLayers; j++) {
135 fLayRadii[j] = 0.;
136 fLayZLength[j] = 0.;
137 fLaddPerLay[j] = 0;
138 fModPerLadd[j] = 0;
139 fLadWidth[j] = 0.;
140 fDetThick[j] = 0.;
141 fDetTypeID[j] = 0.;
142 fUpGeom[j] = 0;
143 }
144 }
145}
146
147//______________________________________________________________________
148AliITSUv11::~AliITSUv11() {
149 // Standard destructor
150 // Inputs:
151 // none.
152 // Outputs:
153 // none.
154 // Return:
155 // none.
156 delete [] fLayTurbo;
157 delete [] fLayRadii;
158 delete [] fLayZLength;
159 delete [] fLaddPerLay;
160 delete [] fModPerLadd;
161 delete [] fLadThick;
162 delete [] fLadWidth;
163 delete [] fLadTilt;
164 delete [] fDetThick;
165 delete [] fDetTypeID;
166 delete [] fUpGeom;
167
168}
169
170//______________________________________________________________________
171void AliITSUv11::SetT2Lmatrix(Int_t uid, Double_t yShift,
172 Bool_t yFlip, Bool_t yRot180) const {
173
174 //
175 // Creates the TGeo Local to Tracking transformation matrix
176 // and sends it to the corresponding TGeoPNEntry
177 //
178 // This function is used in AddAlignableVolumes()
179
180 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(uid);
181 TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
182
183 Double_t *gtrans = globMatrix->GetTranslation(), rotMatrix[9];
184 memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t));
185 Double_t al = TMath::ATan2(rotMatrix[1],rotMatrix[0]);
186 if (yRot180) {
187 al = TMath::ATan2(rotMatrix[1],-rotMatrix[0]);
188 }
189 Double_t xShift = gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al);
190 Double_t zShift = -gtrans[2];
191
192 TGeoHMatrix *matLtoT = new TGeoHMatrix;
193 matLtoT->SetDx( xShift ); // translation
194 matLtoT->SetDy( yShift );
195 matLtoT->SetDz( zShift );
196 rotMatrix[0]= 0; rotMatrix[1]= 1; rotMatrix[2]= 0; // + rotation
197 rotMatrix[3]= 1; rotMatrix[4]= 0; rotMatrix[5]= 0;
198 rotMatrix[6]= 0; rotMatrix[7]= 0; rotMatrix[8]=-1;
199 if (yFlip) rotMatrix[3] = -1; // flipping in y (for SPD1)
200 if (yFlip) rotMatrix[1] = -1; // flipping in y (for SPD1)
201
202 if (yRot180) { // rotation of pi around the axis perpendicular to the wafer
203 if (yFlip) matLtoT->SetDx( -xShift ); // flipping in y (for SPD1)
204 matLtoT->SetDy( -yShift );
205 matLtoT->SetDz( -zShift );
206 rotMatrix[8]=1;
207 rotMatrix[3] = -1;
208 if (yFlip) rotMatrix[3] = 1; // flipping in y (for SPD1)
209 }
210
211 TGeoRotation rot;
212 rot.SetMatrix(rotMatrix);
213 matLtoT->MultiplyLeft(&rot);
214 TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
215 delete matLtoT;
216 alignableEntry->SetMatrix(matTtoL);
217}
218
219//______________________________________________________________________
220void AliITSUv11::AddAlignableVolumes() const{
221 // Creates entries for alignable volumes associating the symbolic volume
222 // name with the corresponding volume path.
223 //
224 // Records in the alignable entries the transformation matrices converting
225 // TGeo local coordinates (in the RS of alignable volumes) to the tracking
226 // system
227 // For this, this function has to run before the misalignment because we
228 // are using the ideal positions in the AliITSgeom object.
229 // Inputs:
230 // none.
231 // Outputs:
232 // none.
233 // Return:
234 // none.
235
236 AliInfo("Add ITS alignable volumes");
237
238 if (!gGeoManager) { AliFatal("TGeoManager doesn't exist !"); return; }
239 TString pth,snm;
240 //
241 pth = Form("ALIC_1/%s_2",AliITSUGeomTGeo::GetITSVolPattern());
242 // RS: to be checked with MS
243 if( !gGeoManager->SetAlignableEntry("ITS",pth.Data()) )
244 AliFatal(Form("Unable to set alignable entry ! %s :: %s","ITS",pth.Data()));
245 //
246 for (int lr=0; lr<fNLayers; lr++) {
247 //
248 pth = Form("ALIC_1/%s_2/%s%d_1",AliITSUGeomTGeo::GetITSVolPattern(),AliITSUGeomTGeo::GetITSLayerPattern(),lr+1);
249 snm = Form("ITS/%s%d",AliITSUGeomTGeo::GetITSLayerPattern(),lr+1);
250 //printf("SetAlignable: %s %s\n",snm.Data(),pth.Data());
251 gGeoManager->SetAlignableEntry(snm.Data(),pth.Data());
252 int modNum = 0;
253 //
254 for (int ld=0; ld<fLaddPerLay[lr]; ld++) {
255 //
256 TString pthL = Form("%s/%s%d_%d",pth.Data(),AliITSUGeomTGeo::GetITSLadderPattern(),lr+1,ld+1);
257 TString snmL = Form("%s/%s%d",snm.Data(),AliITSUGeomTGeo::GetITSLadderPattern(),ld+1);
258 //printf("SetAlignable: %s %s\n",snmL.Data(),pthL.Data());
259 gGeoManager->SetAlignableEntry(snmL.Data(),pthL.Data());
260 //
261 for (int md=0; md<fModPerLadd[lr]; md++) {
262 //
263 TString pthM = Form("%s/%s%d_%d",pthL.Data(),AliITSUGeomTGeo::GetITSModulePattern(),lr+1,md+1);
264 TString snmM = Form("%s/%s%d",snmL.Data(),AliITSUGeomTGeo::GetITSModulePattern(),md+1);
265 //
266 int modUID = AliGeomManager::LayerToVolUID(lr+1,modNum++);
267 //
268 //printf("SetAlignable (UID=%d, ModNum=%d): %s %s\n",modUID,modNum-1,snmM.Data(),pthM.Data());
269 gGeoManager->SetAlignableEntry(snmM.Data(),pthM.Data(),modUID);
270 //
271 double yshift = -(fUpGeom[lr]->GetSensorThick()-fUpGeom[lr]->GetLadderThick())/2;
272 SetT2Lmatrix(modUID,yshift, kTRUE,kTRUE); // RS: do we need here special matrix, ask MS
273 //
274 }
275 }
276 }
277 //
278}
279
280//______________________________________________________________________
281void AliITSUv11::AddBeamPipe(const Double_t rmin, const Double_t rmax,
282 const Double_t halfzlen) {
283
284 // Define the parameters for the beam pipe
285 if (fBeamPipe)
286 AliWarning("Redefining beam pipe parameters");
287
288 if (rmin <= 0) {
289 AliError(Form("Beam pipe min radius (%f) wrong",rmin));
290 return;
291 } else
292 fBeamPipeRmin = rmin;
293
294 if (rmax <= 0) {
295 AliError(Form("Beam pipe max radius (%f) wrong",rmax));
296 return;
297 } else
298 fBeamPipeRmax = rmax;
299
300 if (halfzlen < 0) {
301 AliError(Form("Beam pipe half Zlength (%f) wrong",halfzlen));
302 return;
303 } else {
304 if (halfzlen == 0) // Use default value
305 fBeamPipeZlen = fgkBeamPipeHalfZLen;
306 else
307 fBeamPipeZlen = halfzlen;
308 }
309
310 fBeamPipe = kTRUE;
311}
312
313//______________________________________________________________________
314void AliITSUv11::CreateGeometry() {
315
316 // Create the geometry and insert it in the mother volume ITSV
317 TGeoManager *geoManager = gGeoManager;
318
319 TGeoVolume *vALIC = geoManager->GetVolume("ALIC");
320
321 new TGeoVolumeAssembly(AliITSUGeomTGeo::GetITSVolPattern());
322 TGeoVolume *vITSV = geoManager->GetVolume(AliITSUGeomTGeo::GetITSVolPattern());
323 vALIC->AddNode(vITSV, 2, 0); // Copy number is 2 to cheat AliGeoManager::CheckSymNamesLUT
324
325 //
326 const Int_t kLength=100;
327 Char_t vstrng[kLength] = "xxxRS"; //?
328 vITSV->SetTitle(vstrng);
329 //
330 // Check that we have all needed parameters
331 if (fNLayers <= 0) AliFatal(Form("Wrong number of layers (%d)",fNLayers));
332 //
333 for (Int_t j=0; j<fNLayers; j++) {
334 if (fLayRadii[j] <= 0) AliFatal(Form("Wrong layer radius for layer %d (%f)",j,fLayRadii[j]));
335 if (fLayZLength[j] <= 0) AliFatal(Form("Wrong layer length for layer %d (%f)",j,fLayZLength[j]));
336 if (fLaddPerLay[j] <= 0) AliFatal(Form("Wrong number of ladders for layer %d (%d)",j,fLaddPerLay[j]));
337 if (fModPerLadd[j] <= 0) AliFatal(Form("Wrong number of modules for layer %d (%d)",j,fModPerLadd[j]));
338 if (fLadThick[j] < 0) AliFatal(Form("Wrong ladder thickness for layer %d (%f)",j,fLadThick[j]));
339 if (fLayTurbo[j] && fLadWidth[j] <= 0) AliFatal(Form("Wrong ladder width for layer %d (%f)",j,fLadWidth[j]));
340 if (fDetThick[j] < 0) AliFatal(Form("Wrong module thickness for layer %d (%f)",j,fDetThick[j]));
341 //
342 if (j > 0) {
343 if (fLayRadii[j]<=fLayRadii[j-1]) AliFatal(Form("Layer %d radius (%f) is smaller than layer %d radius (%f)",
344 j,fLayRadii[j],j-1,fLayRadii[j-1]));
345 if (fLayZLength[j]<=fLayZLength[j-1]) AliFatal(Form("Layer %d length (%f) is smaller than layer %d length (%f)",
346 j,fLayZLength[j],j-1,fLayZLength[j-1]));
347 } // if (j > 0)
348
349 if (fLadThick[j] == 0) AliInfo(Form("Ladder thickness for layer %d not set, using default",j));
350 if (fDetThick[j] == 0) AliInfo(Form("Module thickness for layer %d not set, using default",j));
351
352 } // for (Int_t j=0; j<fNLayers; j++)
353
354 // Now create the actual geometry
355 for (Int_t j=0; j<fNLayers; j++) {
356 if (fLayTurbo[j]) {
357 fUpGeom[j] = new AliITSUv11Layer(j,kTRUE,kFALSE);
358 fUpGeom[j]->SetLadderWidth(fLadWidth[j]);
359 fUpGeom[j]->SetLadderTilt(fLadTilt[j]);
360 }
361 else fUpGeom[j] = new AliITSUv11Layer(j,kFALSE);
362 //
363 fUpGeom[j]->SetRadius(fLayRadii[j]);
364 fUpGeom[j]->SetZLength(fLayZLength[j]);
365 fUpGeom[j]->SetNLadders(fLaddPerLay[j]);
366 fUpGeom[j]->SetNModules(fModPerLadd[j]);
367 fUpGeom[j]->SetDetType(fDetTypeID[j]);
368 //
369 if (fLadThick[j] != 0) fUpGeom[j]->SetLadderThick(fLadThick[j]);
370 if (fDetThick[j] != 0) fUpGeom[j]->SetSensorThick(fDetThick[j]);
371 fUpGeom[j]->CreateLayer(vITSV);
372 }
373 //
374 // Finally add the beam pipe
375 if (fBeamPipe) {
376 fBPGeom = new AliITSv11GeomBeamPipe(fBeamPipeRmin, fBeamPipeRmax,fBeamPipeZlen, kFALSE);
377 fBPGeom->CreateBeamPipe(vALIC); // We put the BP in the ALIC volume
378 }
379}
380
381//______________________________________________________________________
382void AliITSUv11::CreateMaterials() {
383 // Create ITS materials
384 // This function defines the default materials used in the Geant
385 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
386 // AliITSv11Hybrid.
387 // In general it is automatically replaced by
388 // the CreateMaterials routine defined in AliITSv?. Should the function
389 // CreateMaterials not exist for the geometry version you are using this
390 // one is used. See the definition found in AliITSv5 or the other routine
391 // for a complete definition.
392 // Inputs:
393 // none.
394 // Outputs:
395 // none.
396 // Return:
397 // none.
398
399 Int_t ifield = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
400 Float_t fieldm = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
401
402 Float_t tmaxfd = 0.1; // 1.0; // Degree
403 Float_t stemax = 1.0; // cm
404 Float_t deemax = 0.1; // 30.0; // Fraction of particle's energy 0<deemax<=1
405 Float_t epsil = 1.0E-4; // 1.0; // cm
406 Float_t stmin = 0.0; // cm "Default value used"
407
408 Float_t tmaxfdSi = 0.1; // .10000E+01; // Degree
409 Float_t stemaxSi = 0.0075; // .10000E+01; // cm
410 Float_t deemaxSi = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
411 Float_t epsilSi = 1.0E-4;// .10000E+01;
412 Float_t stminSi = 0.0; // cm "Default value used"
413
414 Float_t tmaxfdAir = 0.1; // .10000E+01; // Degree
415 Float_t stemaxAir = .10000E+01; // cm
416 Float_t deemaxAir = 0.1; // 0.30000E-02; // Fraction of particle's energy 0<deemax<=1
417 Float_t epsilAir = 1.0E-4;// .10000E+01;
418 Float_t stminAir = 0.0; // cm "Default value used"
419
420 // AIR
421 Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
422 Float_t zAir[4]={6.,7.,8.,18.};
423 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
424 Float_t dAir = 1.20479E-3;
425
426
427 AliMaterial(1,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,0.93600E+01,0.99900E+03);
428 AliMedium(1,"SI$",1,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,epsilSi,stminSi);
429
430 AliMixture(5,"AIR$",aAir,zAir,dAir,4,wAir);
431 AliMedium(5,"AIR$",5,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,epsilAir,stminAir);
432
433 AliMaterial(8,"BERILLIUM$",9.01, 4., 1.848, 35.3, 36.7);// From AliPIPEv3
434 AliMedium(8,"BERILLIUM$",8,0,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin);
435
436}
437
438//______________________________________________________________________
439void AliITSUv11::DefineLayer(const Int_t nlay, const Double_t r,
440 const Double_t zlen, const Int_t nladd,
441 const Int_t nmod, const Double_t lthick,
442 const Double_t dthick, const UInt_t dettypeID)
443{
444 // Sets the layer parameters
445 // Inputs:
446 // nlay layer number
447 // r layer radius
448 // zlen layer length
449 // nladd number of ladders
450 // nmod number of modules per ladder
451 // lthick ladder thickness (if omitted, defaults to 0)
452 // dthick detector thickness (if omitted, defaults to 0)
453 // Outputs:
454 // none.
455 // Return:
456 // none.
457
458 if (nlay >= fNLayers || nlay < 0) {
459 AliError(Form("Wrong layer number (%d)",nlay));
460 return;
461 }
462
463 fLayTurbo[nlay] = kFALSE;
464 fLayRadii[nlay] = r;
465 fLayZLength[nlay] = zlen;
466 fLaddPerLay[nlay] = nladd;
467 fModPerLadd[nlay] = nmod;
468 fLadThick[nlay] = lthick;
469 fDetThick[nlay] = dthick;
470 fDetTypeID[nlay] = dettypeID;
471
472}
473
474//______________________________________________________________________
475void AliITSUv11::DefineLayerTurbo(const Int_t nlay, const Double_t r,
476 const Double_t zlen, const Int_t nladd,
477 const Int_t nmod, const Double_t width,
478 const Double_t tilt,
479 const Double_t lthick,
480 const Double_t dthick,
481 const UInt_t dettypeID)
482{
483 // Sets the layer parameters for a "turbo" layer
484 // (i.e. a layer whose ladders overlap in phi)
485 // Inputs:
486 // nlay layer number
487 // r layer radius
488 // zlen layer length
489 // nladd number of ladders
490 // nmod number of modules per ladder
491 // width layer width
492 // tilt layer tilt angle (degrees)
493 // lthick ladder thickness (if omitted, defaults to 0)
494 // dthick detector thickness (if omitted, defaults to 0)
495 // Outputs:
496 // none.
497 // Return:
498 // none.
499
500 if (nlay >= fNLayers || nlay < 0) {
501 AliError(Form("Wrong layer number (%d)",nlay));
502 return;
503 }
504
505 fLayTurbo[nlay] = kTRUE;
506 fLayRadii[nlay] = r;
507 fLayZLength[nlay] = zlen;
508 fLaddPerLay[nlay] = nladd;
509 fModPerLadd[nlay] = nmod;
510 fLadThick[nlay] = lthick;
511 fLadWidth[nlay] = width;
512 fLadTilt[nlay] = tilt;
513 fDetThick[nlay] = dthick;
514 fDetTypeID[nlay] = dettypeID;
515 //
516}
517
518//______________________________________________________________________
519void AliITSUv11::GetBeamPipeParameters(Double_t &rmin, Double_t &rmax,
520 Double_t &hzlen){
521 // Gets the beam pipe parameters
522 // Inputs:
523 // none.
524 // Outputs:
525 // rmin min radius
526 // rmax max radius
527 // hzlen half Z length
528 // Return:
529 // none.
530
531 rmin = fBeamPipeRmin;
532 rmax = fBeamPipeRmax;
533 hzlen = fBeamPipeZlen;
534
535}
536
537//______________________________________________________________________
538void AliITSUv11::GetLayerParameters(const Int_t nlay,
539 Double_t &r, Double_t &zlen,
540 Int_t &nladd, Int_t &nmod,
541 Double_t &width, Double_t &tilt,
542 Double_t &lthick, Double_t &dthick){
543 // Gets the layer parameters
544 // Inputs:
545 // nlay layer number
546 // Outputs:
547 // r layer radius
548 // zlen layer length
549 // nladd number of ladders
550 // nmod number of modules per ladder
551 // width ladder width
552 // tilt ladder tilt angle
553 // lthick ladder thickness
554 // dthick detector thickness
555 // Return:
556 // none.
557
558 if (nlay >= fNLayers || nlay < 0) {
559 AliError(Form("Wrong layer number (%d)",nlay));
560 return;
561 }
562
563 r = fLayRadii[nlay];
564 zlen = fLayZLength[nlay];
565 nladd = fLaddPerLay[nlay];
566 nmod = fModPerLadd[nlay];
567 width = fLadWidth[nlay];
568 tilt = fLadTilt[nlay];
569 lthick = fLadThick[nlay];
570 dthick = fDetThick[nlay];
571}
572
573//______________________________________________________________________
574void AliITSUv11::Init()
575{
576 // Initialise the ITS after it has been created.
577 UpdateInternalGeometry();
578 AliITSU::Init();
579
580}
581
582//______________________________________________________________________
583Bool_t AliITSUv11::IsLayerTurbo(const Int_t nlay)
584{
585 // Returns true if the layer is a "turbo" layer
586 if ( nlay < 0 || nlay > fNLayers ) {
587 AliError(Form("Wrong layer number %d",nlay));
588 return kFALSE;
589 }
590 else return fUpGeom[nlay]->IsTurbo();
591}
592
593//______________________________________________________________________
594void AliITSUv11::SetDefaults()
595{
596 // sets the default segmentation, response, digit and raw cluster classes
597}
598
599//______________________________________________________________________
600void AliITSUv11::StepManager()
601{
602 // Called for every step in the ITS, then calles the AliITSUHit class
603 // creator with the information to be recoreded about that hit.
604 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
605 // printing of information to a file which can be used to create a .det
606 // file read in by the routine CreateGeometry(). If set to 0 or any other
607 // value except 1, the default behavior, then no such file is created nor
608 // it the extra variables and the like used in the printing allocated.
609 // Inputs:
610 // none.
611 // Outputs:
612 // none.
613 // Return:
614 // none.
615 if(!(this->IsActive())) return;
616 if(!(gMC->TrackCharge())) return;
617 //
618 Int_t copy, lay = 0;
619 Int_t id = gMC->CurrentVolID(copy);
620
621 Bool_t notSens = kFALSE;
622 while ((lay<fNLayers) && (notSens = (id!=fIdSens[lay]))) ++lay;
623 //printf("R: %.1f | Lay: %d NotSens: %d\n",positionRS.Pt(), lay, notSens);
624
625 if (notSens) return;
626
627 if(gMC->IsTrackExiting()) {
628 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
629 } // if Outer ITS mother Volume
630
631 static TLorentzVector position, momentum; // Saves on calls to construtors
632 static AliITSUHit hit;// Saves on calls to constructors
633
634 TClonesArray &lhits = *(Hits());
635 Int_t cpn0, cpn1, mod, status = 0;
636 //
637 // Track status
638 if(gMC->IsTrackInside()) status += 1;
639 if(gMC->IsTrackEntering()) status += 2;
640 if(gMC->IsTrackExiting()) status += 4;
641 if(gMC->IsTrackOut()) status += 8;
642 if(gMC->IsTrackDisappeared()) status += 16;
643 if(gMC->IsTrackStop()) status += 32;
644 if(gMC->IsTrackAlive()) status += 64;
645
646 //
647 // retrieve the indices with the volume path
648 //
649 if (lay < 0 || lay >= fNLayers) {
650 AliError(Form("Invalid value: lay=%d. Not an ITS sensitive volume",lay));
651 return; // not an ITS sensitive volume.
652 } else {
653 copy = 1;
654 gMC->CurrentVolOffID(1,cpn1);
655 gMC->CurrentVolOffID(2,cpn0);
656 } //
657
658 mod = fGeomTGeo->GetModuleIndex(lay,cpn0,cpn1);
659 //RS2DEL fInitGeom.DecodeDetector(mod,lay+1,cpn0,cpn1,copy);
660 //
661 // Fill hit structure.
662 //
663 hit.SetModule(mod);
664 hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
665 gMC->TrackPosition(position);
666 gMC->TrackMomentum(momentum);
667 hit.SetPosition(position);
668 hit.SetTime(gMC->TrackTime());
669 hit.SetMomentum(momentum);
670 hit.SetStatus(status);
671 hit.SetEdep(gMC->Edep());
672 hit.SetShunt(GetIshunt());
673 if(gMC->IsTrackEntering()){
674 hit.SetStartPosition(position);
675 hit.SetStartTime(gMC->TrackTime());
676 hit.SetStartStatus(status);
677 return; // don't save entering hit.
678 } // end if IsEntering
679 // Fill hit structure with this new hit.
680 //Info("StepManager","Calling Copy Constructor");
681 new(lhits[fNhits++]) AliITSUHit(hit); // Use Copy Construtor.
682 // Save old position... for next hit.
683 hit.SetStartPosition(position);
684 hit.SetStartTime(gMC->TrackTime());
685 hit.SetStartStatus(status);
686
687 return;
688}
689
690//______________________________________________________________________
691void AliITSUv11::SetLayerDetTypeID(Int_t lr, UInt_t id)
692{
693 // set det type
694 if (!fDetTypeID || fNLayers<=lr) AliFatal(Form("Number of layers %d, %d is manipulated",fNLayers,lr));
695 fDetTypeID[lr] = id;
696}
697
698//______________________________________________________________________
699Int_t AliITSUv11::GetLayerDetTypeID(Int_t lr)
700{
701 // set det type
702 if (!fDetTypeID || fNLayers<=lr) AliFatal(Form("Number of layers %d, %d is manipulated",fNLayers,lr));
703 return fDetTypeID[lr];
704}