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