Variable number of modules introduced
[u/mrichter/AliRoot.git] / TOF / AliTOFv0.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Time Of Flight //
4// This class contains the functions for version 0 of the Time Of Flight //
5// detector. //
6// //
7//Begin_Html
8/*
1439f98e 9<img src="picts/AliTOFv0Class.gif">
fe4da5cc 10*/
11//End_Html
12// //
13///////////////////////////////////////////////////////////////////////////////
14
15#include "AliTOFv0.h"
16#include "AliRun.h"
fe4da5cc 17#include "AliConst.h"
18
19ClassImp(AliTOFv0)
20
21//_____________________________________________________________________________
151e057e 22AliTOFv0::AliTOFv0()
fe4da5cc 23{
24 //
25 // Default constructor
26 //
27}
28
29//_____________________________________________________________________________
30AliTOFv0::AliTOFv0(const char *name, const char *title)
31 : AliTOF(name,title)
32{
33 //
34 // Standard constructor for version 0 of the Time Of Flight
35 //
36}
37
38//_____________________________________________________________________________
39void AliTOFv0::CreateGeometry()
40{
41 //
42 // Definition of Geometry
43 // Authors : Maxim Martemianov, Boris Zagreev (ITEP) 18/09/98
44 //Begin_Html
45 /*
1439f98e 46 <img src="picts/AliTOFv0.gif">
fe4da5cc 47 */
48 //End_Html
49 //
50
51 AliMC* pMC = AliMC::GetMC();
52
53 Float_t fil_rich;
54 Int_t lmax;
55 Float_t phos_phi, zcor2, zcor3, ztof0, ztof1, ztof2;
56 Float_t zl, phos_r;
57 Int_t idrotm[101];
58 Float_t phos_x;
59 Float_t rp1, rp2;
60 Float_t par[10], fil_min, fil_max, ysz, fil0;
61 //
ad51aeb0 62 Int_t *idtmed = fIdtmed->GetArray()-499;
fe4da5cc 63 //
64 // barrel size along Z axis
151e057e 65 // rp1 = 360.;
66 // rp2 = 372.;
67 rp1 = 370;
68 rp2 = rp1 + 12;
fe4da5cc 69 zl = 720.;
70 //
71 // TOF width along radius of barrel
72 //xtof = rp2 - rp1;
73 ztof0 = 350.;
74 ztof1 = 200.;
75 ztof2 = 150.;
76 //
77 // Plate width
78 ysz = .6;
79 // PHOS and RICH angles
80 phos_x = 214.6;
81 phos_r = 467.;
82 //phos_z = 260.;
83 //rich_z = 472.5;
84 fil_rich = 30.;
85 lmax = 19;
86 zcor2 = ztof0 - ztof1 / 2.;
87 zcor3 = ztof0 - ztof2 / 2.;
88 phos_phi = TMath::ATan(phos_x / (phos_r * 2.));
89 fil_min = (kPI - phos_phi * 4.) * kRaddeg - 180. / lmax;
90 fil_max = (phos_phi * 4. + kPI) * kRaddeg + 180. / lmax;
91 // barrel radius in ALIC
92 par[0] = rp1;
93 par[1] = rp2;
94 par[2] = zl / 2.;
95 pMC->Gsvolu("FBAR", "TUBE", idtmed[500], par, 3);
96 pMC->Gspos("FBAR", 1, "ALIC", 0., 0., 0., 0, "ONLY");
97 pMC->Gsatt("FBAR", "SEEN", 0);
98 // First Block
99 par[0] = (rp1+rp2-ysz)/2.;
100 par[1] = (rp1+rp2+ysz)/2.;
101 par[2] = ztof0;
102 par[3] = 90. - fil_min;
103 par[4] = 90. - fil_rich;
104 fil0 = 180. - (par[3] + par[4]);
105 pMC->Gsvolu("FBT1", "TUBS", idtmed[507], par, 5);
106 AliMatrix(idrotm[1], 90., fil0, 90., fil0 + 90., 0., 0.);
107 pMC->Gspos("FBT1", 0, "FBAR", 0., 0., 0., 0, "ONLY");
108 pMC->Gspos("FBT1", 1, "FBAR", 0., 0., 0., idrotm[1], "ONLY");
109 // --- Second block
110 par[2] = ztof1 / 2.;
111 par[3] = 90. - fil_max;
112 par[4] = 90. - fil_min;
113 pMC->Gsvolu("FBT2", "TUBS", idtmed[507], par, 5);
114 pMC->Gspos("FBT2", 0, "FBAR", 0., 0., zcor2, 0, "ONLY");
115 pMC->Gspos("FBT2", 1, "FBAR", 0., 0.,-zcor2, 0, "ONLY");
116 // --- Third block
117 par[2] = ztof2 / 2.;
118 par[3] = 90. - fil_rich;
119 par[4] = fil_rich + 90.;
120 pMC->Gsvolu("FBT3", "TUBS", idtmed[507], par, 5);
121 pMC->Gspos("FBT3", 0, "FBAR", 0., 0., zcor3, 0, "ONLY");
122 pMC->Gspos("FBT3", 1, "FBAR", 0., 0., -zcor3, 0, "ONLY");
123}
124
125//_____________________________________________________________________________
8f72dc0c 126void AliTOFv0::DrawModule()
fe4da5cc 127{
128 //
129 // Draw a shaded view of the common part of the TOF geometry
130 // for versions 2 and 3
131 //
132
133 AliMC* pMC = AliMC::GetMC();
134
135 // Set everything unseen
136 pMC->Gsatt("*", "seen", -1);
137 //
138 // Set ALIC mother transparent
139 pMC->Gsatt("ALIC","SEEN",0);
140 //
141 // Set the volumes visible
142 pMC->Gsatt("FBAR","SEEN",0);
143 pMC->Gsatt("FBT1","SEEN",1);
144 pMC->Gsatt("FBT2","SEEN",1);
145 pMC->Gsatt("FBT3","SEEN",1);
146 //
147 pMC->Gdopt("hide", "on");
148 pMC->Gdopt("shad", "on");
149 pMC->Gsatt("*", "fill", 7);
150 //
151 pMC->SetClipBox(".");
152 pMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
153 pMC->DefaultRange();
154 pMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
155 pMC->Gdhead(1111, "Time Of Flight");
156 pMC->Gdman(18, 4, "MAN");
157 pMC->Gdopt("hide","off");
158}
159
160//_____________________________________________________________________________
161void AliTOFv0::CreateMaterials()
162{
163 //
164 // Define materials for the Time Of Flight
165 //
166 AliTOF::CreateMaterials();
167}
168
169//_____________________________________________________________________________
170void AliTOFv0::Init()
171{
172 //
173 // Initialise detector after that it has been built
174 //
175
176 AliMC* pMC = AliMC::GetMC();
177
178 AliTOF::Init();
179 fIdFBT2=pMC->VolId("FBT2");
180 fIdFBT3=pMC->VolId("FBT3");
181}
182
183//_____________________________________________________________________________
184void AliTOFv0::StepManager()
185{
186 //
187 // Procedure called at each step in the Time Of Flight
188 Float_t hits[8];
189 Int_t vol[3];
190 Int_t copy, id;
191 //
192 // Get the pointer to the MonteCarlo
193 AliMC *pMC= AliMC::GetMC();
ad51aeb0 194 Int_t *idtmed = fIdtmed->GetArray()-499;
fe4da5cc 195 if(pMC->GetMedium()==idtmed[510-1] &&
196 pMC->TrackEntering() && pMC->TrackCharge()
197 && (id=pMC->CurrentVol(0,copy))==fIdSens) {
198 TClonesArray &lhits = *fHits;
199 //
200 // Record only charged tracks at entrance
201 vol[2]=copy;
202 vol[1]=pMC->CurrentVolOff(1,0,copy);
203 if(id==fIdFBT2) copy+=2; else
204 if(id==fIdFBT2) copy+=4;
205 vol[0]=1;
206 pMC->TrackPosition(hits);
207 pMC->TrackMomentum(&hits[3]);
208 hits[7]=pMC->TrackTime();
209 new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
210 }
211}
212
213