]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSv11.cxx
Bug fix
[u/mrichter/AliRoot.git] / ITS / AliITSv11.cxx
CommitLineData
2b680d9b 1/**************************************************************************
effd7456 2 * Copyright(c) 2007-2008, ALICE Experiment at CERN, All rights reserved. *
2b680d9b 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
effd7456 16
b7943f00 17//************************************************************************
effd7456 18//
b7943f00 19// Inner Traking System geometry v11
20//
21// Based on ROOT geometrical modeler
b7943f00 22//
23// B. Nilsen, L. Gaudichet
24//************************************************************************
25
26
541f7ba6 27#include <TClonesArray.h>
2b680d9b 28#include <TLorentzVector.h>
b7943f00 29
30#include "AliITS.h"
531d6cdc 31#include "AliITSDetTypeSim.h"
7a82301d 32#include <TVirtualMC.h>
33
b7943f00 34#include "AliITSgeom.h"
b7943f00 35#include "AliITShit.h"
531d6cdc 36
37#include "AliITSCalibrationSDD.h"
531d6cdc 38
2b680d9b 39#include "AliITSsegmentationSDD.h"
b7943f00 40#include "AliITSsegmentationSPD.h"
41#include "AliITSsegmentationSSD.h"
b7943f00 42#include "AliMagF.h"
43#include "AliRun.h"
44#include "AliTrackReference.h"
45#include "AliMC.h"
46
47#include <TGeoManager.h>
48#include <TGeoVolume.h>
49#include <TGeoPcon.h>
108bd0fe 50#include "AliITSv11.h"
54c9a3d9 51#include "AliITSv11GeometrySPD.h"
db486a6e 52#include "AliITSv11GeometrySDD.h"
54c9a3d9 53#include "AliITSv11GeometrySSD.h"
54#include "AliITSv11GeometrySupport.h"
171f3f35 55
2b680d9b 56
541f7ba6 57
b7943f00 58ClassImp(AliITSv11)
59
fa4639a3 60
61
33ddec7d 62//______________________________________________________________________
012f0f4c 63AliITSv11::AliITSv11() :
64AliITS(),
65fGeomDetOut(kFALSE),
66fGeomDetIn(kFALSE),
67fByThick(kTRUE),
68fMajorVersion(IsVersion()),
69fMinorVersion(0),
70fEuclidGeomDet(),
71fRead(),
72fWrite(),
54c9a3d9 73fSPDgeom(),
012f0f4c 74fSDDgeom(0),
54c9a3d9 75fSSDgeom(),
76fSupgeom(),
012f0f4c 77fIgm(kv11)
33ddec7d 78{
b7943f00 79 // Standard default constructor for the ITS version 11.
f7315efc 80
531d6cdc 81 fIdN = 0;
82 fIdName = 0;
83 fIdSens = 0;
531d6cdc 84 Int_t i;
85 for(i=0;i<60;i++) fRead[i] = '\0';
86 for(i=0;i<60;i++) fWrite[i] = '\0';
87 for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
88 strncpy(fRead,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det",60);
2b680d9b 89}
b7943f00 90
fa4639a3 91
92//______________________________________________________________________
012f0f4c 93AliITSv11::AliITSv11(const char *name, const char *title):
94AliITS("ITS", title),
95fGeomDetOut(kFALSE),
96fGeomDetIn(kFALSE),
97fByThick(kTRUE),
98fMajorVersion(IsVersion()),
99fMinorVersion(0),
100fEuclidGeomDet(),
101fRead(),
102fWrite(),
54c9a3d9 103fSPDgeom(),
012f0f4c 104fSDDgeom(0),
54c9a3d9 105fSSDgeom(),
106fSupgeom(),
012f0f4c 107fIgm(kv11)
33ddec7d 108{
fa4639a3 109 // Standard constructor for the ITS version 11.
110
531d6cdc 111 fSDDgeom = new AliITSv11GeometrySDD(0);
fa4639a3 112
113 Int_t i;
531d6cdc 114 fIdN = 6;
115 fIdName = new TString[fIdN];
116 fIdName[0] = name; // removes warning message
117 fIdName[0] = "ITS1";
118 fIdName[1] = "ITS2";
108bd0fe 119 fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
120 fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
531d6cdc 121 fIdName[4] = "ITS5";
122 fIdName[5] = "ITS6";
fa4639a3 123 fIdSens = new Int_t[fIdN];
531d6cdc 124 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
33ddec7d 125 // not needed, fByThick set to kTRUE in in the member initialization lis
531d6cdc 126
33ddec7d 127
531d6cdc 128 fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.euc";
129 strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det",60);
130 strncpy(fRead,fEuclidGeomDet,60);
131 strncpy(fWrite,fEuclidGeomDet,60);
132 strncpy(fRead,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det",60);
fa4639a3 133}
2b680d9b 134//______________________________________________________________________
db486a6e 135AliITSv11::AliITSv11(Int_t debugITS,Int_t debugSPD,Int_t debugSDD,
b7943f00 136 Int_t debugSSD,Int_t debugSUP) :
012f0f4c 137AliITS("ITS","ITS geometry v11"),
138fGeomDetOut(kFALSE),
139fGeomDetIn(kFALSE),
140fByThick(kTRUE),
141fMajorVersion(IsVersion()),
142fMinorVersion(0),
143fEuclidGeomDet(),
144fRead(),
145fWrite(),
54c9a3d9 146fSPDgeom(),
012f0f4c 147fSDDgeom(0),
54c9a3d9 148fSSDgeom(),
149fSupgeom(),
012f0f4c 150fIgm(kv11)
151{
b7943f00 152 // Standard default constructor for the ITS version 11.
b7943f00 153
b7943f00 154
531d6cdc 155 // fSPDgeom = new AliITSv11GeometrySPD(debugSPD);
156 fSDDgeom = new AliITSv11GeometrySDD(debugSDD);
157 fSDDgeom->SetDebug(debugSDD);
158 // fSupgeom = new AliITSv11GeometrySupport(debugSUP);
159
160 Int_t i;
161 fIdN = 6;
162 fIdName = new TString[fIdN];
54c9a3d9 163 fIdName[0] = fSPDgeom->GetSenstiveVolumeName1();
164 fIdName[1] = fSPDgeom->GetSenstiveVolumeName2();
108bd0fe 165 fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
166 fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
54c9a3d9 167 fIdName[4] = fSSDgeom->GetSenstiveVolumeName5();
168 fIdName[5] = fSSDgeom->GetSenstiveVolumeName6();
531d6cdc 169 fIdSens = new Int_t[fIdN];
170 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
171 fEuclidOut = kFALSE; // Don't write Euclide file
531d6cdc 172
b7943f00 173 fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.euc";
174 strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det",60);
175 strncpy(fRead,fEuclidGeomDet,60);
176 strncpy(fWrite,fEuclidGeomDet,60);
177 strncpy(fRead,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det",60);
178
fa4639a3 179 debugITS = (debugSPD && debugSSD && debugSUP && debugSDD); //remove temp. warnings
162acd47 180}
dfefbaec 181//______________________________________________________________________
b7943f00 182AliITSv11::~AliITSv11() {
183 delete fSDDgeom;
184}
b7943f00 185//______________________________________________________________________
186void AliITSv11::BuildGeometry(){
187
2b680d9b 188}
189//______________________________________________________________________
aa9bc63b 190void AliITSv11::CreateGeometry(){
012f0f4c 191 //
192 // Create ROOT geometry
193 //
194 // These constant character strings are set by cvs during commit
195 // do not change them unless you know what you are doing!
196 const Char_t *cvsDate="$Date$";
197 const Char_t *cvsRevision="$Revision$";
198
199 TGeoManager *geoManager = gGeoManager;
200 TGeoVolume *vALIC = geoManager->GetTopVolume();
201
202 TGeoPcon *sITS = new TGeoPcon("ITS Top Volume",0.0,360.0,2);
203
204 // DefineSection(section number, Z, Rmin, Rmax).
205 const Double_t kcm = 1.0;
206 sITS->DefineSection(0,-300.0*kcm,0.01*kcm,50.0*kcm);
207 sITS->DefineSection(1,+300.0*kcm,0.01*kcm,50.0*kcm);
208
209 TGeoMedium *air = gGeoManager->GetMedium("ITS_AIR$");
210 TGeoVolume *vITS = new TGeoVolume("ITSV",sITS,air);
211 vITS->SetVisibility(kFALSE);
212 const Int_t length=100;
213 Char_t vstrng[length];
214 if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
215 fMinorVersion,cvsDate,cvsRevision))
216 vITS->SetTitle(vstrng);
217 //printf("Title set to %s\n",vstrng);
218 vALIC->AddNode(vITS,1,0);
b7943f00 219
220// fSPDgeom->CenteralSPD(vITS);
fa4639a3 221
b7943f00 222 fSDDgeom->Layer3(vITS);
223 fSDDgeom->Layer4(vITS);
fa4639a3 224
b7943f00 225// fSupgeom->SPDCone(vITS);
226// fSupgeom->SPDThermalSheald(vITS);
227// fSupgeom->SDDCone(vITS);
228// fSupgeom->SSDCone(vITS);
229// fSupgeom->ServicesCableSupport(vITS);
230
541f7ba6 231}
232//______________________________________________________________________
233void AliITSv11::CreateMaterials(){
54c9a3d9 234 // Create Standard ITS Materials
235 // Inputs:
236 // none.
237 // Outputs:
238 // none.
239 // Return:
240 // none.
531d6cdc 241
531d6cdc 242
54c9a3d9 243 //
244 fSPDgeom->AliITSv11Geometry::CreateDefaultMaterials();
245 // Detector specific material definistions
246 fSPDgeom->CreateMaterials();
247 fSDDgeom->CreateMaterials();
248 fSSDgeom->CreateMaterials();
249 fSupgeom->CreateMaterials();
dfefbaec 250}
012f0f4c 251/*
dfefbaec 252//______________________________________________________________________
253void AliITSv11::InitAliITSgeom(){
b7943f00 254 //
255 // Fill fITSgeom with the 3 sub-detector geometries
256 //
257
108bd0fe 258 if (gGeoManager) gGeoManager->Export("geometry.root");
259
531d6cdc 260 const Int_t knlayers = 6;
261 const Int_t kndeep = 3;
108bd0fe 262 const AliITSDetector kidet[knlayers]={kSPD,kSPD,kSDD,kSDD,kSSD,kSSD};
263 const TString knames[knlayers] = {
264 "AliITSv11:spd missing", // lay=1
265 "AliITSv11:spd missing", // lay=2
531d6cdc 266 "/ALIC_1/ITSV_1/ITSsddLayer3_1/ITSsddLadd_%d/ITSsddSensor_%d/ITSsddWafer_%d", // lay=3
267 "/ALIC_1/ITSV_1/ITSsddLayer4_1/ITSsddLadd_%d/ITSsddSensor_%d/ITSsddWafer_%d", // lay=4
108bd0fe 268 "AliITSv11:ssd missing", // lay=5
269 "AliITSv11:ssd missing" // lay=6
270 };
271
272 const Int_t kitsGeomTreeCopys[knlayers][kndeep]= {{10, 2, 4},// lay=1
273 {10, 4, 4}, // lay=2
274 {14, 6, 1}, // lay=3
275 {22, 8, 1}, // lay=4
276 {34,22, 1}, // lay=5
277 {38,25, 1}};// lay=6
531d6cdc 278 Int_t nlad[knlayers],ndet[knlayers];
279 Int_t mod,lay,lad=0,det=0,i,j,k,cp0,cp1,cp2;
280 TString path,shapeName;
281 TGeoHMatrix materix;
282 Double_t trans[3]={3*0.0},rot[10]={9*0.0,1.0};
283 TArrayD shapePar;
284 TArrayF shapeParF;
108bd0fe 285 Bool_t shapeDefined[3]={kFALSE,kFALSE,kFALSE};
531d6cdc 286
287 AliDebug(1,"Reading Geometry transformation directly from Modler.");
288 mod = 0;
289 for(i=0;i<knlayers;i++){
290 k = 1;
108bd0fe 291 for(j=0;j<kndeep;j++) if(kitsGeomTreeCopys[i][j]!=0)
292 k *= TMath::Abs(kitsGeomTreeCopys[i][j]);
531d6cdc 293 mod += k;
294 } // end for i
295
531d6cdc 296 SetITSgeom(0);
297 nlad[0]=20;nlad[1]=40;nlad[2]=14;nlad[3]=22;nlad[4]=34;nlad[5]=38;
298 ndet[0]= 4;ndet[1]= 4;ndet[2]= 6;ndet[3]= 8;ndet[4]=22;ndet[5]=25;
299 AliITSgeom* geom = new AliITSgeom(0,6,nlad,ndet,mod);
300 SetITSgeom(geom);
301 mod = 0;
302 for(lay=1;lay<=knlayers;lay++){
108bd0fe 303
304 for(cp0=0; cp0<kitsGeomTreeCopys[lay-1][0]; cp0++){
305 for(cp1=0; cp1<kitsGeomTreeCopys[lay-1][1]; cp1++){
306 for(cp2=1; cp2<=kitsGeomTreeCopys[lay-1][2]; cp2++){
307
308 path.Form(knames[lay-1].Data(),
531d6cdc 309 cp0,cp1,cp2);
310 switch (lay){
311 case 1:{
312 det = cp2;
313 lad = cp1+2*(cp0-1);
314 }break;
315 case 2:{
316 det = cp2;
317 lad = cp1+4*(cp0-1);
318 } break;
319 case 3: case 4: case 5: case 6:{
320 det = cp1;
321 lad = cp0;
322 } break;
323 } // end switch
324 //AliInfo(Form("path=%s lay=%d lad=%d det=%d",
325 // path.Data(),lay,lad,det));
326 gMC->GetTransformation(path.Data(),materix);
327 gMC->GetShape(path.Data(),shapeName,shapePar);
328 shapeParF.Set(shapePar.GetSize());
329 for(i=0;i<shapePar.GetSize();i++) shapeParF[i]=shapePar[i];
108bd0fe 330 geom->CreateMatrix(mod,lay,lad,det,kidet[lay-1],trans,rot);
531d6cdc 331 geom->SetTrans(mod,materix.GetTranslation());
332 geom->SetRotMatrix(mod,materix.GetRotationMatrix());
108bd0fe 333 geom->GetGeomMatrix(mod)->SetPath(path.Data());
531d6cdc 334 switch (lay){
108bd0fe 335 case 1: case 2:
336 if(!shapeDefined[kSPD]){
531d6cdc 337 geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(
338 shapeParF.GetSize(),shapeParF.GetArray()));
108bd0fe 339 shapeDefined[kSPD] = kTRUE;
531d6cdc 340 }break;
108bd0fe 341 case 3: case 4:
342 if(!shapeDefined[kSDD]){
531d6cdc 343 geom->ReSetShape(kSDD,new AliITSgeomSDD256(
344 shapeParF.GetSize(),shapeParF.GetArray()));
108bd0fe 345 shapeDefined[kSDD] = kTRUE;
531d6cdc 346 }break;
108bd0fe 347 case 5: case 6:
348 if(!shapeDefined[kSSD]){
531d6cdc 349 geom->ReSetShape(kSSD,new AliITSgeomSSD75and275(
350 shapeParF.GetSize(),shapeParF.GetArray()));
108bd0fe 351 shapeDefined[kSSD] = kTRUE;
531d6cdc 352 }break;
353 default:{
354 }break;
355 } // end switch
356 mod++;
357 } /// end for cp2
358 } // end for cp1
359 } // end for cp0
360 } // end for lay
531d6cdc 361
362// fSDDgeom->ExportSensorGeometry(GetITSgeom(), +3, 0); //SDD
dfefbaec 363}
012f0f4c 364*/
dfefbaec 365//______________________________________________________________________
366void AliITSv11::Init(){
b7943f00 367 //
368 // Initialise the ITS after it has been created.
369 //
370
531d6cdc 371 //AliInfo(Form("Minor version %d",fMinorVersion));
372 //
012f0f4c 373 UpdateInternalGeometry();
374 AliITS::Init();
375 if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
376
377 //
378/*
b7943f00 379 if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
380 if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
531d6cdc 381 if(GetITSgeom()!=0) SetITSgeom(0x0);
382 AliITSgeom* geom = new AliITSgeom();
383 SetITSgeom(geom);
384 if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
b7943f00 385 else this->InitAliITSgeom();
531d6cdc 386 if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
b7943f00 387 AliITS::Init();
012f0f4c 388*/ //
dfefbaec 389}
b7943f00 390
108bd0fe 391
dfefbaec 392//______________________________________________________________________
393void AliITSv11::SetDefaults(){
b7943f00 394 //
108bd0fe 395 // Set response and segmentation models for SPD, SDD and SSD
b7943f00 396 //
397
108bd0fe 398// if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
399// fDetTypeSim->SetITSgeom(GetITSgeom());
400 if(!fDetTypeSim) {
401 Warning("SetDefaults","Error fDetTypeSim not defined");
402 return;
403 }
531d6cdc 404
531d6cdc 405 fDetTypeSim->ResetCalibrationArray();
406 fDetTypeSim->ResetSegmentation();
407 fDetTypeSim->SetDefaults();
408
531d6cdc 409 if(fgkNTYPES>3){
410 Warning("SetDefaults",
411 "Only the four basic detector types are initialised!");
412 }// end if
413
414
415 return;
416}
b7943f00 417
418
108bd0fe 419
420
421
dfefbaec 422//______________________________________________________________________
b7943f00 423void AliITSv11::DrawModule() const{
424
dfefbaec 425}
b7943f00 426
108bd0fe 427// //______________________________________________________________________
428// void AliITSv11::StepManager(){
429// //
430// // Called for every step in the ITS, then calles the AliITShit class
431// // creator with the information to be recoreded about that hit.
432// //
433// Int_t copy, id;
434// TLorentzVector position, momentum;
435// static TLorentzVector position0;
436// static Int_t stat0=0;
437
438// if(!(this->IsActive())){
439// return;
440// } // end if !Active volume.
441
442// if(!(gMC->TrackCharge())) return;
443
444// id=gMC->CurrentVolID(copy);
445
446// Bool_t sensvol = kFALSE;
447// for(Int_t kk=0;kk<6;kk++)if(id == fIdSens[kk])sensvol=kTRUE;
448// if(sensvol && (gMC->IsTrackExiting())){
449// copy = fTrackReferences->GetEntriesFast();
450// TClonesArray &lTR = *fTrackReferences;
451// // Fill TrackReference structure with this new TrackReference.
452// new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
453// } // if Outer ITS mother Volume
454
455
456// Int_t copy1,copy2;
457// Int_t vol[5];
458// TClonesArray &lhits = *fHits;
459// //
460// // Track status
461// vol[3] = 0;
462// vol[4] = 0;
463// if(gMC->IsTrackInside()) vol[3] += 1;
464// if(gMC->IsTrackEntering()) vol[3] += 2;
465// if(gMC->IsTrackExiting()) vol[3] += 4;
466// if(gMC->IsTrackOut()) vol[3] += 8;
467// if(gMC->IsTrackDisappeared()) vol[3] += 16;
468// if(gMC->IsTrackStop()) vol[3] += 32;
469// if(gMC->IsTrackAlive()) vol[3] += 64;
470// //
471// // Fill hit structure.
472// if(!(gMC->TrackCharge())) return;
473// //
474// // Only entering charged tracks
475// if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
476// vol[0] = 1;
477// id = gMC->CurrentVolOffID(2,copy);
478// //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
479// vol[1] = copy;
480// gMC->CurrentVolOffID(3,copy1);
481// //ladder copy in the module = 1<->2 (I10A < I12A)
482// gMC->CurrentVolOffID(4,copy2);
483// //module copy in the layer = 1<->10 (I12A < IT12)
484// vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
485// } else if(id == fIdSens[1]){
486// vol[0] = 2;
487// id = gMC->CurrentVolOffID(2,copy);
488// //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
489// vol[1] = copy;
490// gMC->CurrentVolOffID(3,copy1);
491// //ladder copy in the module = 1<->4 (I20A < I12A)
492// gMC->CurrentVolOffID(4,copy2);
493// //module copy in the layer = 1<->10 (I12A < IT12)
494// vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
495// } else if(id == fIdSens[2]){
496// vol[0] = 3;
497// id = gMC->CurrentVolOffID(1,copy);
498// //detector copy in the ladder = 1<->6 (ITS3 < I302 < I004)
499// vol[1] = copy;
500// id = gMC->CurrentVolOffID(2,copy);
501// //ladder copy in the layer = 1<->14 (I004 < IT34)
502// vol[2] = copy;
503// } else if(id == fIdSens[3]){
504// vol[0] = 4;
505// id = gMC->CurrentVolOffID(1,copy);
506// //detector copy in the ladder = 1<->8 (ITS4 < I402 < I005)
507// vol[1] = copy;
508// id = gMC->CurrentVolOffID(2,copy);
509// //ladder copy in the layer = 1<->22 (I005 < IT34))
510// vol[2] = copy;
511// }else if(id == fIdSens[4]){
512// vol[0] = 5;
513// id = gMC->CurrentVolOffID(1,copy);
514// //detector copy in the ladder = 1<->22 (ITS5 < I562 < I565)
515// vol[1] = copy;
516// id = gMC->CurrentVolOffID(2,copy);
517// //ladder copy in the layer = 1<->34 (I565 < IT56)
518// vol[2] = copy;
519// }else if(id == fIdSens[5]){
520// vol[0] = 6;
521// id = gMC->CurrentVolOffID(1,copy);
522// //detector copy in the ladder = 1<->25 (ITS6 < I566 < I569)
523// vol[1] = copy;
524// id = gMC->CurrentVolOffID(2,copy);
525// //ladder copy in the layer = 1<->38 (I569 < IT56)
526// vol[2] = copy;
527// } else {
528// return; // not an ITS volume?
529// } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
530// //
531// gMC->TrackPosition(position);
532// gMC->TrackMomentum(momentum);
533// vol[4] = stat0;
534// if(gMC->IsTrackEntering()){
535// position0 = position;
536// stat0 = vol[3];
537// return;
538// } // end if IsEntering
539// // Fill hit structure with this new hit.
540
541// new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
542// gMC->Edep(),gMC->TrackTime(),position,
543// position0,momentum);
544
545// position0 = position;
546// stat0 = vol[3];
547
548// return;
549// }
550
551
dfefbaec 552//______________________________________________________________________
553void AliITSv11::StepManager(){
b7943f00 554 //
555 // Called for every step in the ITS, then calles the AliITShit class
556 // creator with the information to be recoreded about that hit.
557 //
531d6cdc 558 Int_t copy, id;
559 TLorentzVector position, momentum;
560 static TLorentzVector position0;
561 static Int_t stat0=0;
562
563 if(!(this->IsActive())){
564 return;
565 } // end if !Active volume.
566
567 if(!(gMC->TrackCharge())) return;
568
569 id=gMC->CurrentVolID(copy);
570
571 Bool_t sensvol = kFALSE;
572 for(Int_t kk=0;kk<6;kk++)if(id == fIdSens[kk])sensvol=kTRUE;
573 if(sensvol && (gMC->IsTrackExiting())){
e6add757 574 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
531d6cdc 575 } // if Outer ITS mother Volume
576
577
578 Int_t copy1,copy2;
579 Int_t vol[5];
580 TClonesArray &lhits = *fHits;
581 //
582 // Track status
583 vol[3] = 0;
584 vol[4] = 0;
585 if(gMC->IsTrackInside()) vol[3] += 1;
586 if(gMC->IsTrackEntering()) vol[3] += 2;
587 if(gMC->IsTrackExiting()) vol[3] += 4;
588 if(gMC->IsTrackOut()) vol[3] += 8;
589 if(gMC->IsTrackDisappeared()) vol[3] += 16;
590 if(gMC->IsTrackStop()) vol[3] += 32;
591 if(gMC->IsTrackAlive()) vol[3] += 64;
592 //
593 // Fill hit structure.
594 if(!(gMC->TrackCharge())) return;
108bd0fe 595
531d6cdc 596 // Only entering charged tracks
597 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
598 vol[0] = 1;
599 id = gMC->CurrentVolOffID(2,copy);
600 //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
601 vol[1] = copy;
602 gMC->CurrentVolOffID(3,copy1);
603 //ladder copy in the module = 1<->2 (I10A < I12A)
604 gMC->CurrentVolOffID(4,copy2);
605 //module copy in the layer = 1<->10 (I12A < IT12)
606 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
108bd0fe 607
531d6cdc 608 } else if(id == fIdSens[1]){
609 vol[0] = 2;
610 id = gMC->CurrentVolOffID(2,copy);
611 //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
612 vol[1] = copy;
613 gMC->CurrentVolOffID(3,copy1);
614 //ladder copy in the module = 1<->4 (I20A < I12A)
615 gMC->CurrentVolOffID(4,copy2);
616 //module copy in the layer = 1<->10 (I12A < IT12)
617 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
108bd0fe 618
531d6cdc 619 } else if(id == fIdSens[2]){
620 vol[0] = 3;
621 id = gMC->CurrentVolOffID(1,copy);
622 //detector copy in the ladder = 1<->6 (ITS3 < I302 < I004)
623 vol[1] = copy;
624 id = gMC->CurrentVolOffID(2,copy);
625 //ladder copy in the layer = 1<->14 (I004 < IT34)
626 vol[2] = copy;
108bd0fe 627
531d6cdc 628 } else if(id == fIdSens[3]){
629 vol[0] = 4;
630 id = gMC->CurrentVolOffID(1,copy);
631 //detector copy in the ladder = 1<->8 (ITS4 < I402 < I005)
632 vol[1] = copy;
633 id = gMC->CurrentVolOffID(2,copy);
634 //ladder copy in the layer = 1<->22 (I005 < IT34))
635 vol[2] = copy;
108bd0fe 636
531d6cdc 637 }else if(id == fIdSens[4]){
638 vol[0] = 5;
639 id = gMC->CurrentVolOffID(1,copy);
640 //detector copy in the ladder = 1<->22 (ITS5 < I562 < I565)
641 vol[1] = copy;
642 id = gMC->CurrentVolOffID(2,copy);
643 //ladder copy in the layer = 1<->34 (I565 < IT56)
644 vol[2] = copy;
108bd0fe 645
531d6cdc 646 }else if(id == fIdSens[5]){
647 vol[0] = 6;
648 id = gMC->CurrentVolOffID(1,copy);
649 //detector copy in the ladder = 1<->25 (ITS6 < I566 < I569)
650 vol[1] = copy;
651 id = gMC->CurrentVolOffID(2,copy);
652 //ladder copy in the layer = 1<->38 (I569 < IT56)
653 vol[2] = copy;
654 } else {
655 return; // not an ITS volume?
656 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
657 //
658 gMC->TrackPosition(position);
659 gMC->TrackMomentum(momentum);
660 vol[4] = stat0;
661 if(gMC->IsTrackEntering()){
662 position0 = position;
663 stat0 = vol[3];
664 return;
665 } // end if IsEntering
666 // Fill hit structure with this new hit.
b7943f00 667
531d6cdc 668 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
669 gMC->Edep(),gMC->TrackTime(),position,
670 position0,momentum);
b7943f00 671
b7943f00 672 position0 = position;
673 stat0 = vol[3];
531d6cdc 674
b7943f00 675 return;
531d6cdc 676}
108bd0fe 677