]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSv5.cxx
const enum changed to enum.
[u/mrichter/AliRoot.git] / ITS / AliITSv5.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Inner Traking System version 5 //
4// This class contains the base procedures for the Inner Tracking System //
5// //
6//Begin_Html
7/*
8<img src="gif/AliITSv5Class.gif">
9</pre>
10<br clear=left>
11<font size=+2 color=red>
12<p>The responsible person for this module is
13<a href="mailto:roberto.barbera@ct.infn.it">Roberto Barbera</a>.
14</font>
15<pre>
16*/
17//End_Html
18// //
19///////////////////////////////////////////////////////////////////////////////
20
21#include <stdio.h>
22
23#include <TMath.h>
24#include "AliITSv5.h"
25#include "AliRun.h"
26#include "stdlib.h"
27#include "TSystem.h"
28#include "TGeant3.h"
29
30ClassImp(AliITSv5)
31
32//_____________________________________________________________________________
33AliITSv5::AliITSv5() : AliITS()
34{
35 //
36 // Default constructor for the ITS
37 //
38}
39
40//_____________________________________________________________________________
41AliITSv5::AliITSv5(const char *name, const char *title)
42 : AliITS(name, title)
43{
44 //
45 // Standard constructor for the ITS
46 //
47 fEuclidMaterial="$(ALICE_ROOT)/ITSgeometry_60.tme";
48 fEuclidGeometry="$(ALICE_ROOT)/ITSgeometry_60.euc";
49}
50
51
52//_____________________________________________________________________________
53void AliITSv5::CreateMaterials()
54{
55 //
56 // Read materials for the ITS
57 //
58 FILE *file = fopen(fEuclidMaterial.Data(),"r");
59 if(file) {
60 fclose(file);
61 gAlice->ReadEuclidMedia(fEuclidMaterial.Data(),2);
62 } else {
63 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",fEuclidMaterial.Data());
64 exit(1);
65 }
66}
67
68//_____________________________________________________________________________
69void AliITSv5::CreateGeometry()
70{
71 //
72 // Read geometry for the ITS
73 //
74
75 AliMC* pMC = AliMC::GetMC();
76
77 char topvol[5];
78 char *filtmp;
79//
80 filtmp=gSystem->ExpandPathName(fEuclidGeometry.Data());
81 FILE *file = fopen(filtmp,"r");
82 delete [] filtmp;
83 if(file) {
84 fclose(file);
85 gAlice->ReadEuclid(fEuclidGeometry.Data(),2,topvol);
86 } else {
87 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",fEuclidGeometry.Data());
88 exit(1);
89 }
90 //
91 // --- Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
92 // invisible
93 //
94 pMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
95 //
96 // --- Outputs the geometry tree in the EUCLID/CAD format
97
98 if (fEuclidOut) {
99 pMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
100 }
101}
102
103//_____________________________________________________________________________
104void AliITSv5::Init()
105{
106 //
107 // Initialise the ITS after it has been created
108 //
109 AliITS::Init();
110}
111
112//_____________________________________________________________________________
113void AliITSv5::StepManager()
114{
115 //
116 // Called for every step in the ITS
117 //
118 Int_t copy, id;
119 Int_t copy1,copy2;
120 Float_t hits[7];
121 Int_t vol[3];
122 Float_t position[3];
123 Float_t momentum[4];
124 TClonesArray &lhits = *fHits;
125 AliMC* pMC = AliMC::GetMC();
126 //
127 if(pMC->TrackCharge() && pMC->Edep()) {
128 //
129 // Only entering charged tracks
130 if((id=pMC->CurrentVol(0,copy))==fIdSens1) {
131 vol[0]=1;
132 id=pMC->CurrentVolOff(0,0,copy); //detector copy in the ladder = 1<->4 (ITS1)
133 vol[1]=copy;
134 pMC->CurrentVolOff(1,0,copy1); //ladder copy in the module = 1<->2 (I186)
135 pMC->CurrentVolOff(2,0,copy2); //module copy in the layer = 1<->10 (I132)
136 vol[2]=copy1+(copy2-1)*2; //# of ladders in one module = 2
137 } else if(id==fIdSens2) {
138 vol[0]=2;
139 id=pMC->CurrentVolOff(0,0,copy); //detector copy in the ladder = 1<->4 (ITS2)
140 vol[1]=copy;
141 pMC->CurrentVolOff(1,0,copy1); //ladder copy in the module = 1<->4 (I131)
142 pMC->CurrentVolOff(2,0,copy2); //module copy in the layer = 1<->10 (I132)
143 vol[2]=copy1+(copy2-1)*4; //# of ladders in one module = 4
144 } else if(id==fIdSens3) {
145 vol[0]=3;
146 id=pMC->CurrentVolOff(1,0,copy); //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
147 vol[1]=copy;
148 id=pMC->CurrentVolOff(2,0,copy); //ladder copy in the layer = 1<->12 (I316)
149 vol[2]=copy;
150 } else if(id==fIdSens4) {
151 vol[0]=4;
152 id=pMC->CurrentVolOff(1,0,copy); //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
153 vol[1]=copy;
154 id=pMC->CurrentVolOff(2,0,copy); //ladder copy in the layer = 1<->22 (I417)
155 vol[2]=copy;
156 } else if(id==fIdSens5) {
157 vol[0]=5;
158 id=pMC->CurrentVolOff(1,0,copy); //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
159 vol[1]=copy;
160 id=pMC->CurrentVolOff(2,0,copy); //ladder copy in the layer = 1<->34 (I565)
161 vol[2]=copy;
162 } else if(id==fIdSens6) {
163 vol[0]=6;
164 id=pMC->CurrentVolOff(1,0,copy); //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
165 vol[1]=copy;
166 id=pMC->CurrentVolOff(2,0,copy); //ladder copy in the layer = 1<->38 (I569)
167 vol[2]=copy;
168 } else return;
169 pMC->TrackPosition(position);
170 pMC->TrackMomentum(momentum);
171 hits[0]=position[0];
172 hits[1]=position[1];
173 hits[2]=position[2];
174 hits[3]=momentum[0]*momentum[3];
175 hits[4]=momentum[1]*momentum[3];
176 hits[5]=momentum[2]*momentum[3];
177 hits[6]=pMC->Edep();
178 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
179 }
180}