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