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