]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSv5.cxx
Look for Euclid files in Euclid subdirectory
[u/mrichter/AliRoot.git] / ITS / AliITSv5.cxx
... / ...
CommitLineData
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="picts/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
29ClassImp(AliITSv5)
30
31//_____________________________________________________________________________
32AliITSv5::AliITSv5() : AliITS()
33{
34 //
35 // Default constructor for the ITS
36 //
37}
38
39//_____________________________________________________________________________
40AliITSv5::AliITSv5(const char *name, const char *title)
41 : AliITS(name, title)
42{
43 //
44 // Standard constructor for the ITS
45 //
46 fEuclidMaterial="$(ALICE_ROOT)/Euclid/ITSgeometry_60.tme";
47 fEuclidGeometry="$(ALICE_ROOT)/Euclid/ITSgeometry_60.euc";
48}
49
50
51//_____________________________________________________________________________
52void AliITSv5::CreateMaterials()
53{
54 //
55 // Read materials for the ITS
56 //
57 FILE *file = fopen(fEuclidMaterial.Data(),"r");
58 if(file) {
59 fclose(file);
60 gAlice->ReadEuclidMedia(fEuclidMaterial.Data(),this);
61 } else {
62 Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",fEuclidMaterial.Data());
63 exit(1);
64 }
65}
66
67//_____________________________________________________________________________
68void AliITSv5::CreateGeometry()
69{
70 //
71 // Read geometry for the ITS
72 //
73
74 char topvol[5];
75 char *filtmp;
76//
77 filtmp=gSystem->ExpandPathName(fEuclidGeometry.Data());
78 FILE *file = fopen(filtmp,"r");
79 delete [] filtmp;
80 if(file) {
81 fclose(file);
82 gAlice->ReadEuclid(fEuclidGeometry.Data(),this,topvol);
83 } else {
84 Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",fEuclidGeometry.Data());
85 exit(1);
86 }
87 //
88 // --- Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
89 // invisible
90 //
91 gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
92 //
93 // --- Outputs the geometry tree in the EUCLID/CAD format
94
95 if (fEuclidOut) {
96 gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
97 }
98}
99
100//_____________________________________________________________________________
101void AliITSv5::Init()
102{
103 //
104 // Initialise the ITS after it has been created
105 //
106 AliITS::Init();
107}
108
109//_____________________________________________________________________________
110void AliITSv5::StepManager()
111{
112 //
113 // Called for every step in the ITS
114 //
115 Int_t copy, id;
116 Int_t copy1,copy2;
117 Float_t hits[7];
118 Int_t vol[3];
119 TLorentzVector position, momentum;
120 TClonesArray &lhits = *fHits;
121 //
122 if(gMC->TrackCharge() && gMC->Edep()) {
123 //
124 // Only entering charged tracks
125 if((id=gMC->CurrentVolID(copy))==fIdSens1) {
126 vol[0]=1;
127 id=gMC->CurrentVolOffID(0,copy); //detector copy in the ladder = 1<->4 (ITS1)
128 vol[1]=copy;
129 gMC->CurrentVolOffID(1,copy1); //ladder copy in the module = 1<->2 (I186)
130 gMC->CurrentVolOffID(2,copy2); //module copy in the layer = 1<->10 (I132)
131 vol[2]=copy1+(copy2-1)*2; //# of ladders in one module = 2
132 } else if(id==fIdSens2) {
133 vol[0]=2;
134 id=gMC->CurrentVolOffID(0,copy); //detector copy in the ladder = 1<->4 (ITS2)
135 vol[1]=copy;
136 gMC->CurrentVolOffID(1,copy1); //ladder copy in the module = 1<->4 (I131)
137 gMC->CurrentVolOffID(2,copy2); //module copy in the layer = 1<->10 (I132)
138 vol[2]=copy1+(copy2-1)*4; //# of ladders in one module = 4
139 } else if(id==fIdSens3) {
140 vol[0]=3;
141 id=gMC->CurrentVolOffID(1,copy); //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
142 vol[1]=copy;
143 id=gMC->CurrentVolOffID(2,copy); //ladder copy in the layer = 1<->12 (I316)
144 vol[2]=copy;
145 } else if(id==fIdSens4) {
146 vol[0]=4;
147 id=gMC->CurrentVolOffID(1,copy); //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
148 vol[1]=copy;
149 id=gMC->CurrentVolOffID(2,copy); //ladder copy in the layer = 1<->22 (I417)
150 vol[2]=copy;
151 } else if(id==fIdSens5) {
152 vol[0]=5;
153 id=gMC->CurrentVolOffID(1,copy); //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
154 vol[1]=copy;
155 id=gMC->CurrentVolOffID(2,copy); //ladder copy in the layer = 1<->34 (I565)
156 vol[2]=copy;
157 } else if(id==fIdSens6) {
158 vol[0]=6;
159 id=gMC->CurrentVolOffID(1,copy); //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
160 vol[1]=copy;
161 id=gMC->CurrentVolOffID(2,copy); //ladder copy in the layer = 1<->38 (I569)
162 vol[2]=copy;
163 } else return;
164 gMC->TrackPosition(position);
165 gMC->TrackMomentum(momentum);
166 hits[0]=position[0];
167 hits[1]=position[1];
168 hits[2]=position[2];
169 hits[3]=momentum[0];
170 hits[4]=momentum[1];
171 hits[5]=momentum[2];
172 hits[6]=gMC->Edep();
173 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
174 }
175}