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