]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFv2.cxx
Some rationalisation of the documentation. In particular pictures are all now in...
[u/mrichter/AliRoot.git] / TOF / AliTOFv2.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Time Of Flight //
4// This class contains the functions for version 2 of the Time Of Flight //
5// detector. //
6// //
7//Begin_Html
8/*
1439f98e 9<img src="picts/AliTOFv3Class.gif">
fe4da5cc 10*/
11//End_Html
12// //
13///////////////////////////////////////////////////////////////////////////////
14
15#include "AliTOFv2.h"
fe4da5cc 16#include "AliRun.h"
fe4da5cc 17#include "AliConst.h"
18
19ClassImp(AliTOFv2)
20
21//_____________________________________________________________________________
151e057e 22AliTOFv2::AliTOFv2()
fe4da5cc 23{
24 //
25 // Default constructor
26 //
27}
28
29//_____________________________________________________________________________
30AliTOFv2::AliTOFv2(const char *name, const char *title)
31 : AliTOF(name,title)
32{
33 //
34 // Standard constructor
35 //
36}
37
38//_____________________________________________________________________________
39void AliTOFv2::CreateGeometry()
40{
41 //
42 // Create geometry for Time Of Flight version 2
43 //
44 //Begin_Html
45 /*
1439f98e 46 <img src="picts/AliTOFv3.gif">
fe4da5cc 47 */
48 //End_Html
49 //
50
51 //
52 // Create common geometry between version 2 and 3
53 //
54 AliTOF::CreateGeometry();
55}
56
57//_____________________________________________________________________________
58void AliTOFv2::TOFpc(Float_t xm, Float_t ym, Float_t zm0,
59 Float_t zm1, Float_t zm2)
60{
61 //
62 // Definition of the Time Of Fligh Resistive Plate Chambers
63 //
64
65 AliMC* pMC = AliMC::GetMC();
66
67 Int_t inum;
68 Float_t xcor, zcor, ytop, ycoor;
69 Float_t zazor, dx, dy, dz, xp, yp, zp, ywidth;
70 Int_t ink;
71 Float_t par[10];
72 Int_t inz, nxp, npx, npz;
73 Float_t xsz, ysz, zsz;
74 Int_t nzp0, nzp1, nzp2;
75
76 Int_t *idtmed = gAlice->Idtmed();
77
78 // X size of PPC plate
79 xsz = 60.;
80 // Y size of PPC plate
81 ysz = .2;
82 // Z size of PPC plate
83 zsz = 50.;
84 // Width of DME box
85 ywidth = 4.;
86 // Frame width along X,Y and Z axis of RPC chambers
87 dx = 0.;
88 dy = .2;
89 // + 0.1cm (Zagreev)
90 dz = 0.;
91 // gap in RPC chamber
92 zazor = .03;
93 // X size of RPC chamber
94 // XP=3.06 ! + 0.06cm (Zagreev)
95 xp = 3.9;
96 // Y size of RPC chamber
97 yp = zazor + dy * 2;
98 // YP=0.32
99 // Z size of RPC chamber
100 // ZP=3.06 ! + 0.06cm (Zagreev)
101 // (Zagreev)
102 zp = 4.1;
103 // No sensitive volumes with DME
104 par[0] = xm / 2.;
105 par[1] = ywidth / 2.;
106 par[2] = zm0 / 2.;
107 ycoor = ym / 3. - ywidth / 2.;
108 pMC->Gsvolu("FBT1", "BOX ", idtmed[505], par, 3);
109 pMC->Gspos("FBT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
110 par[2] = zm1 / 2.;
111 pMC->Gsvolu("FBT2", "BOX ", idtmed[505], par, 3);
112 pMC->Gspos("FBT2", 1, "FTO2", 0., 0., 0., 0, "ONLY");
113 par[2] = zm2 / 2.;
114 pMC->Gsvolu("FBT3", "BOX ", idtmed[505], par, 3);
115 pMC->Gspos("FBT3", 2, "FTO3", 0., 0., 0., 0, "ONLY");
116 // Electronic plate
117 par[1] = ysz / 2.;
118 par[2] = zm0 / 2.;
119 ycoor = ywidth / 2. - ysz / 2.;
120 pMC->Gsvolu("FPE1", "BOX ", idtmed[504], par, 3);
121 pMC->Gspos("FPE1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY");
122 pMC->Gspos("FPE1", 1, "FBT1", 0., -ycoor, 0., 0, "ONLY");
123 par[2] = zm1 / 2.;
124 pMC->Gsvolu("FPE2", "BOX ", idtmed[504], par, 3);
125 pMC->Gspos("FPE2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY");
126 pMC->Gspos("FPE2", 1, "FBT2", 0., -ycoor, 0., 0, "ONLY");
127 par[2] = zm2 / 2.;
128 pMC->Gsvolu("FPE3", "BOX ", idtmed[504], par, 3);
129 pMC->Gspos("FPE3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY");
130 pMC->Gspos("FPE3", 1, "FBT3", 0., -ycoor, 0., 0, "ONLY");
131 // Electronic insensitive volumes
132 par[1] = yp / 2.;
133 par[2] = zm0 / 2.;
134 ytop = ywidth / 2. - (ysz * 2 + yp) / 2.;
135 pMC->Gsvolu("FLT1", "BOX ", idtmed[505], par, 3);
136 pMC->Gspos("FLT1", 0, "FBT1", 0., -ytop, 0., 0, "ONLY");
137 par[2] = zm1 / 2.;
138 pMC->Gsvolu("FLT2", "BOX ", idtmed[505], par, 3);
139 pMC->Gspos("FLT2", 0, "FBT2", 0., -ytop, 0., 0, "ONLY");
140 par[2] = zm2 / 2.;
141 pMC->Gsvolu("FLT3", "BOX ", idtmed[505], par, 3);
142 pMC->Gspos("FLT3", 0, "FBT3", 0., -ytop, 0., 0, "ONLY");
143 // PPC-plate number along X axis
144 nxp = Int_t (xm / xsz);
145 // PPC-plate number along Z axis
146 nzp0 = Int_t (zm0 / zsz);
147 nzp1 = Int_t (zm1 / zsz);
148 nzp2 = Int_t (zm2 / zsz);
149 // Position of PPC-plates
150 par[0] = xm * .5 / nxp;
151 par[2] = zm0 * .5 / nzp0;
152 pMC->Gsvolu("FLK1", "BOX ", idtmed[505], par, 3);
153 inum = 0;
154 for (ink = 1; ink <= nxp; ++ink) {
155 xcor = xm * .5 * ((ink * 2 - 1) / (Float_t) nxp -
156 1.);
157 for (inz = 1; inz <= nzp0; ++inz) {
158 zcor = zm0 * .5 * ((inz * 2 - 1) / (Float_t) nzp0 - 1.);
159 ++inum;
160 pMC->Gspos("FLK1", inum, "FLT1", xcor, 0., zcor, 0, "ONLY");
161 }
162 for (inz = 1; inz <= nzp1; ++inz) {
163 zcor = zm1 * .5 * ((inz * 2 - 1) / (Float_t) nzp1 - 1.);
164 ++inum;
165 pMC->Gspos("FLK1", inum, "FLT2", xcor, 0., zcor, 0, "ONLY");
166 }
167 for (inz = 1; inz <= nzp2; ++inz) {
168 zcor = zm2 * .5 * ((inz * 2 - 1) / (Float_t) nzp2 - 1.);
169 ++inum;
170 pMC->Gspos("FLK1", inum, "FLT3", xcor, 0., zcor, 0, "ONLY");
171 }
172 }
173 // RPC position on RPC-plate
174 npx = 15;
175 // Zagreev
176 npz = 12;
177 // Zagreev
178 par[0] = xsz * .5 / npx;
179 par[2] = zsz * .5 / npz;
180 pMC->Gsvolu("FLL1", "BOX ", idtmed[505], par, 3);
181 inum = 0;
182 for (ink = 1; ink <= npx; ++ink) {
183 xcor = xsz * .5 * ((ink * 2 - 1) / (Float_t) npx - 1.);
184 for (inz = 1; inz <= npz; ++inz) {
185 zcor = zsz * .5 * ((inz * 2 - 1) / (Float_t) npz - 1.);
186 ++inum;
187 pMC->Gspos("FLL1", inum, "FLK1", xcor, 0., zcor, 0, "ONLY");
188 }
189 }
190 // RPC geometry
191 par[0] = xp / 2.;
192 par[1] = yp / 2.;
193 par[2] = zp / 2.;
194 pMC->Gsvolu("FPG1", "BOX ", idtmed[507], par, 3);
195 pMC->Gspos("FPG1", inum, "FLL1", 0., 0., 0., 0, "ONLY");
196 par[0] = xp / 2. - dx;
197 par[1] = yp / 2. - dy;
198 par[2] = zp / 2. - dz;
199 pMC->Gsvolu("FPG2", "BOX ", idtmed[509], par, 3);
200 pMC->Gspos("FPG2", 0, "FPG1", 0., 0., 0., 0, "ONLY");
201}
202
203//_____________________________________________________________________________
8f72dc0c 204void AliTOFv2::DrawModule()
fe4da5cc 205{
206 //
207 // Draw a shaded view of the Time Of Flight version 2
208 //
209
210 AliMC* pMC = AliMC::GetMC();
211
212 // Set everything unseen
213 pMC->Gsatt("*", "seen", -1);
214 //
215 // Set ALIC mother transparent
216 pMC->Gsatt("ALIC","SEEN",0);
217 //
218 // Set the volumes visible
219 pMC->Gsatt("ALIC","SEEN",0);
220 pMC->Gsatt("FBAR","SEEN",0);
221 pMC->Gsatt("FTO1","SEEN",0);
222 pMC->Gsatt("FTO2","SEEN",0);
223 pMC->Gsatt("FTO3","SEEN",0);
224 pMC->Gsatt("FBT1","SEEN",0);
225 pMC->Gsatt("FBT2","SEEN",0);
226 pMC->Gsatt("FBT3","SEEN",0);
227 pMC->Gsatt("FLT1","SEEN",0);
228 pMC->Gsatt("FLT2","SEEN",0);
229 pMC->Gsatt("FLT3","SEEN",0);
230 pMC->Gsatt("FLK1","SEEN",1);
231 //
232 pMC->Gdopt("hide", "on");
233 pMC->Gdopt("shad", "on");
234 pMC->Gsatt("*", "fill", 7);
235 pMC->SetClipBox(".");
236 pMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
237 pMC->DefaultRange();
238 pMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
239 pMC->Gdhead(1111, "Time Of Flight");
240 pMC->Gdman(18, 4, "MAN");
241 pMC->Gdopt("hide","off");
242}
243
244//_____________________________________________________________________________
245void AliTOFv2::CreateMaterials()
246{
247 //
248 // Define materials for the Time Of Flight
249 //
250 AliTOF::CreateMaterials();
251}
252
253//_____________________________________________________________________________
254void AliTOFv2::Init()
255{
256 //
257 // Initialise the detector after the geometry has been defined
258 //
259
260 AliMC* pMC = AliMC::GetMC();
261
262 AliTOF::Init();
263 fIdFTO2=pMC->VolId("FTO2");
264 fIdFTO3=pMC->VolId("FTO3");
265 fIdFLT1=pMC->VolId("FLT1");
266 fIdFLT2=pMC->VolId("FLT2");
267 fIdFLT3=pMC->VolId("FLT3");
268}
269
270//_____________________________________________________________________________
271void AliTOFv2::StepManager()
272{
273 //
274 // Procedure called at each step in the Time Of Flight
275 //
276 Float_t hits[8];
277 Int_t vol[3];
278 Int_t copy, id;
279 AliMC *pMC= AliMC::GetMC();
280 Int_t *idtmed = gAlice->Idtmed();
281 if(pMC->GetMedium()==idtmed[510-1] &&
282 pMC->TrackEntering() && pMC->TrackCharge()
283 && pMC->CurrentVol(0,copy)==fIdSens) {
284 TClonesArray &lhits = *fHits;
285 //
286 // Record only charged tracks at entrance
287 pMC->CurrentVolOff(1,0,copy);
288 vol[2]=copy;
289 pMC->CurrentVolOff(3,0,copy);
290 vol[1]=copy;
291 id=pMC->CurrentVolOff(6,0,copy);
292 vol[0]=copy;
293 if(id==fIdFTO3) {
294 vol[0]+=22;
295 id=pMC->CurrentVolOff(4,0,copy);
296 if(id==fIdFLT3) vol[1]+=6;
297 } else if (id==fIdFTO2) {
298 vol[0]+=20;
299 id=pMC->CurrentVolOff(4,0,copy);
300 if(id==fIdFLT2) vol[1]+=8;
301 } else {
302 id=pMC->CurrentVolOff(4,0,copy);
303 if(id==fIdFLT1) vol[1]+=14;
304 }
305 pMC->TrackPosition(hits);
306 pMC->TrackMomentum(&hits[3]);
307 hits[7]=pMC->TrackTime();
308 new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
309 }
310}