]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFv2.cxx
Adding new TOF
[u/mrichter/AliRoot.git] / TOF / AliTOFv2.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3fe3a833 3// Time Of Flight: design of P.Fonte //
fe4da5cc 4// This class contains the functions for version 2 of the Time Of Flight //
5// detector. //
6// //
7//Begin_Html
8/*
3fe3a833 9<img src="picts/AliTOFv2Class.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 //
3fe3a833 42 // Create geometry for Time Of Flight version 0
fe4da5cc 43 //
44 //Begin_Html
45 /*
3fe3a833 46 <img src="picts/AliTOFv2.gif">
fe4da5cc 47 */
48 //End_Html
49 //
fe4da5cc 50 //
3fe3a833 51 // Create common geometry
fe4da5cc 52 //
53 AliTOF::CreateGeometry();
54}
55
56//_____________________________________________________________________________
57void AliTOFv2::TOFpc(Float_t xm, Float_t ym, Float_t zm0,
58 Float_t zm1, Float_t zm2)
59{
60 //
61 // Definition of the Time Of Fligh Resistive Plate Chambers
3fe3a833 62 // xm, ym, zm - sizes of TOF modules (large)
63
fe4da5cc 64 Int_t inum;
3fe3a833 65 Float_t xcor, ycor, zcor, ycoor;
fe4da5cc 66 Float_t zazor, dx, dy, dz, xp, yp, zp, ywidth;
67 Int_t ink;
68 Float_t par[10];
69 Int_t inz, nxp, npx, npz;
70 Float_t xsz, ysz, zsz;
71 Int_t nzp0, nzp1, nzp2;
72
ad51aeb0 73 Int_t *idtmed = fIdtmed->GetArray()-499;
fe4da5cc 74
3fe3a833 75 // X size of small RPC plate G10
fe4da5cc 76 xsz = 60.;
3fe3a833 77 // Y size (thickness) of large && small RPC plate G10
78 ysz = .26;
79 // Z size of small RPC plate G10
fe4da5cc 80 zsz = 50.;
3fe3a833 81 // Width of CO2 box with RPC
fe4da5cc 82 ywidth = 4.;
83 // Frame width along X,Y and Z axis of RPC chambers
84 dx = 0.;
3fe3a833 85 dy = .3; //this is 1mm(ceramic) + 1mm(Al) + 1mm(polyethelene)
fe4da5cc 86 dz = 0.;
87 // gap in RPC chamber
88 zazor = .03;
3fe3a833 89 // Sizes of RPC chamber
90 xp = 3.06; //small pixel
91//xp = 3.9; //large pixel
92 yp = zazor + dy * 2; //=0.83cm total thickness of RPC
93 zp = 3.06; //small pixel
94//zp = 4.1; //large pixel
95 // Large not sensitive volumes with CO2
fe4da5cc 96 par[0] = xm / 2.;
97 par[1] = ywidth / 2.;
98 par[2] = zm0 / 2.;
3fe3a833 99 gMC->Gsvolu("FBT1", "BOX ", idtmed[506], par, 3); // CO2
cfce8870 100 gMC->Gspos("FBT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
fe4da5cc 101 par[2] = zm1 / 2.;
3fe3a833 102 gMC->Gsvolu("FBT2", "BOX ", idtmed[506], par, 3); // CO2
cfce8870 103 gMC->Gspos("FBT2", 1, "FTO2", 0., 0., 0., 0, "ONLY");
fe4da5cc 104 par[2] = zm2 / 2.;
3fe3a833 105 gMC->Gsvolu("FBT3", "BOX ", idtmed[506], par, 3); // CO2
cfce8870 106 gMC->Gspos("FBT3", 2, "FTO3", 0., 0., 0., 0, "ONLY");
3fe3a833 107 // Large electronic plate (G10) after
108 par[0] = xm / 2.;
fe4da5cc 109 par[1] = ysz / 2.;
110 par[2] = zm0 / 2.;
3fe3a833 111 ycoor = yp + par[1];
112 gMC->Gsvolu("FPE1", "BOX ", idtmed[504], par, 3); // G10
cfce8870 113 gMC->Gspos("FPE1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY");
fe4da5cc 114 par[2] = zm1 / 2.;
3fe3a833 115 gMC->Gsvolu("FPE2", "BOX ", idtmed[504], par, 3); // G10
cfce8870 116 gMC->Gspos("FPE2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY");
fe4da5cc 117 par[2] = zm2 / 2.;
3fe3a833 118 gMC->Gsvolu("FPE3", "BOX ", idtmed[504], par, 3); // G10
cfce8870 119 gMC->Gspos("FPE3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY");
3fe3a833 120 // Electronics (5cm thick) after
121 //first - Cu (0.02574cm thick - 1.8% X0)
122 par[0] = xm / 2.;
123 par[1] = 0.02574 / 2.;
124 par[2] = zm0 / 2.;
125 ycoor = yp + ysz + 5/2 - par[1];
126 gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
127 gMC->Gspos("FEC1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY");
128 par[2] = zm1 / 2.;
129 gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
130 gMC->Gspos("FEC2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY");
131 par[2] = zm2 / 2.;
132 gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
133 gMC->Gspos("FEC3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY");
134 //second - G10 (0.2328cm thick - 1.2% X0)
135 par[0] = xm / 2.;
136 par[1] = 0.2328 / 2.;
137 par[2] = zm0 / 2.;
138 ycoor = yp + ysz + 5/2 + par[1];
139 gMC->Gsvolu("FEG1", "BOX ", idtmed[504], par, 3); // G10
140 gMC->Gspos("FEG1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY");
141 par[2] = zm1 / 2.;
142 gMC->Gsvolu("FEG2", "BOX ", idtmed[504], par, 3); // G10
143 gMC->Gspos("FEG2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY");
144 par[2] = zm2 / 2.;
145 gMC->Gsvolu("FEG3", "BOX ", idtmed[504], par, 3); // G10
146 gMC->Gspos("FEG3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY");
147 // Al support (5mm thick) after
148 par[0] = xm / 2.;
149 par[1] = 0.5 / 2.;
fe4da5cc 150 par[2] = zm0 / 2.;
3fe3a833 151 ycoor = yp + ysz + par[1];
152 gMC->Gsvolu("FSP1", "BOX ", idtmed[508], par, 3); // Al
153 gMC->Gspos("FSP1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY");
fe4da5cc 154 par[2] = zm1 / 2.;
3fe3a833 155 gMC->Gsvolu("FSP2", "BOX ", idtmed[508], par, 3); // Al
156 gMC->Gspos("FSP2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY");
fe4da5cc 157 par[2] = zm2 / 2.;
3fe3a833 158 gMC->Gsvolu("FSP3", "BOX ", idtmed[508], par, 3); // Al
159 gMC->Gspos("FSP3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY");
160 // Mylar layer in front 0.5mm thick at 5mm from detector
161 par[0] = xm / 2.;
162 par[1] = 0.05 / 2;
163 par[2] = zm0 / 2.;
164 ycoor = -yp - 0.5 - par[1];
165 gMC->Gsvolu("FMY1", "BOX ", idtmed[511], par, 3); // G10
166 gMC->Gspos("FMY1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY");
167 par[2] = zm1 / 2.;
168 gMC->Gsvolu("FMY2", "BOX ", idtmed[511], par, 3); // G10
169 gMC->Gspos("FMY2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY");
170 par[2] = zm2 / 2.;
171 gMC->Gsvolu("FMY3", "BOX ", idtmed[511], par, 3); // G10
172 gMC->Gspos("FMY3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY");
173 // insensitive volumes - large box for RPCs
174 par[1] = yp; // two times thicker than RPC
175 par[2] = zm0 / 2.;
176 gMC->Gsvolu("FLT1", "BOX ", idtmed[512], par, 3); //Freon not senc.
177 gMC->Gspos("FLT1", 0, "FBT1", 0., 0., 0., 0, "ONLY");
178 par[2] = zm1 / 2.;
179 gMC->Gsvolu("FLT2", "BOX ", idtmed[512], par, 3); //Freon not senc.
180 gMC->Gspos("FLT2", 0, "FBT2", 0., 0., 0., 0, "ONLY");
181 par[2] = zm2 / 2.;
182 gMC->Gsvolu("FLT3", "BOX ", idtmed[512], par, 3); //Freon not senc.
183 gMC->Gspos("FLT3", 0, "FBT3", 0., 0., 0., 0, "ONLY");
184 // RPC box (small plate) number along X axis
fe4da5cc 185 nxp = Int_t (xm / xsz);
3fe3a833 186 // RPC box (small plate) number along Z axis
fe4da5cc 187 nzp0 = Int_t (zm0 / zsz);
188 nzp1 = Int_t (zm1 / zsz);
189 nzp2 = Int_t (zm2 / zsz);
3fe3a833 190 // (small) box (plate) for RPC size with insencitive Freon
fe4da5cc 191 par[0] = xm * .5 / nxp;
3fe3a833 192 par[1] = yp; // two times thicker than RPC
fe4da5cc 193 par[2] = zm0 * .5 / nzp0;
3fe3a833 194 gMC->Gsvolu("FLK0", "BOX ", idtmed[512], par, 3); //Freon not sencitive
195 // Position of (small) RPC boxes
fe4da5cc 196 inum = 0;
197 for (ink = 1; ink <= nxp; ++ink) {
3fe3a833 198 xcor = xm * .5 * ((ink * 2 - 1) / (Float_t) nxp - 1.);
fe4da5cc 199 for (inz = 1; inz <= nzp0; ++inz) {
200 zcor = zm0 * .5 * ((inz * 2 - 1) / (Float_t) nzp0 - 1.);
201 ++inum;
3fe3a833 202 gMC->Gspos("FLK0", inum, "FLT1", xcor, 0., zcor, 0, "ONLY");
fe4da5cc 203 }
204 for (inz = 1; inz <= nzp1; ++inz) {
205 zcor = zm1 * .5 * ((inz * 2 - 1) / (Float_t) nzp1 - 1.);
206 ++inum;
3fe3a833 207 gMC->Gspos("FLK0", inum, "FLT2", xcor, 0., zcor, 0, "ONLY");
fe4da5cc 208 }
209 for (inz = 1; inz <= nzp2; ++inz) {
210 zcor = zm2 * .5 * ((inz * 2 - 1) / (Float_t) nzp2 - 1.);
211 ++inum;
3fe3a833 212 gMC->Gspos("FLK0", inum, "FLT3", xcor, 0., zcor, 0, "ONLY");
fe4da5cc 213 }
214 }
3fe3a833 215 // Polyethilene boxes for RPC cell
216 npx = 19; //number of small pixels along X
217 npz = 16; //number of small pixels along Z
218 // npx = 15; //large pixel
219 // npz = 12; //large pixel
fe4da5cc 220 par[0] = xsz * .5 / npx;
3fe3a833 221 par[1] = yp/2;
fe4da5cc 222 par[2] = zsz * .5 / npz;
3fe3a833 223 gMC->Gsvolu("FPP0", "BOX ", idtmed[503], par, 3); // Polyethilene
fe4da5cc 224 inum = 0;
225 for (ink = 1; ink <= npx; ++ink) {
226 xcor = xsz * .5 * ((ink * 2 - 1) / (Float_t) npx - 1.);
3fe3a833 227 if (ink%2 != 0) ycor=yp/2; else ycor=-yp/2;
fe4da5cc 228 for (inz = 1; inz <= npz; ++inz) {
229 zcor = zsz * .5 * ((inz * 2 - 1) / (Float_t) npz - 1.);
230 ++inum;
3fe3a833 231 gMC->Gspos("FPP0", inum, "FLK0", xcor, ycor, zcor, 0, "ONLY");
232 ycor=-ycor;
fe4da5cc 233 }
234 }
3fe3a833 235 //Al RPC geometry
236 par[0] = xp / 2.;
237 par[1] = yp / 2. - 0.1; //minus 1mm of poliethelene
238 par[2] = zp / 2.;
239 gMC->Gsvolu("FPA0", "BOX ", idtmed[508], par, 3);// Al
240 gMC->Gspos("FPA0", inum, "FPP0", 0., 0., 0., 0, "ONLY");
241 //Ceramic RPC geometry
fe4da5cc 242 par[0] = xp / 2.;
3fe3a833 243 par[1] = par[1] - 0.1; //minus 1mm of Al
fe4da5cc 244 par[2] = zp / 2.;
3fe3a833 245 gMC->Gsvolu("FPC0", "BOX ", idtmed[507], par, 3);// Ceramic
246 gMC->Gspos("FPC0", inum, "FPA0", 0., 0., 0., 0, "ONLY");
247 // Freon gas sencitive volume
fe4da5cc 248 par[0] = xp / 2. - dx;
249 par[1] = yp / 2. - dy;
250 par[2] = zp / 2. - dz;
3fe3a833 251 gMC->Gsvolu("FPG0", "BOX ", idtmed[513], par, 3);// Freon
252 gMC->Gspos("FPG0", 0, "FPC0", 0., 0., 0., 0, "ONLY");
fe4da5cc 253}
254
255//_____________________________________________________________________________
8f72dc0c 256void AliTOFv2::DrawModule()
fe4da5cc 257{
258 //
259 // Draw a shaded view of the Time Of Flight version 2
260 //
fe4da5cc 261 // Set everything unseen
cfce8870 262 gMC->Gsatt("*", "seen", -1);
fe4da5cc 263 //
264 // Set ALIC mother transparent
cfce8870 265 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 266 //
267 // Set the volumes visible
cfce8870 268 gMC->Gsatt("ALIC","SEEN",0);
269 gMC->Gsatt("FBAR","SEEN",0);
270 gMC->Gsatt("FTO1","SEEN",0);
271 gMC->Gsatt("FTO2","SEEN",0);
272 gMC->Gsatt("FTO3","SEEN",0);
273 gMC->Gsatt("FBT1","SEEN",0);
274 gMC->Gsatt("FBT2","SEEN",0);
275 gMC->Gsatt("FBT3","SEEN",0);
276 gMC->Gsatt("FLT1","SEEN",0);
277 gMC->Gsatt("FLT2","SEEN",0);
278 gMC->Gsatt("FLT3","SEEN",0);
3fe3a833 279 gMC->Gsatt("FLK0","SEEN",1);
fe4da5cc 280 //
cfce8870 281 gMC->Gdopt("hide", "on");
282 gMC->Gdopt("shad", "on");
283 gMC->Gsatt("*", "fill", 7);
284 gMC->SetClipBox(".");
285 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
286 gMC->DefaultRange();
287 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
288 gMC->Gdhead(1111, "Time Of Flight");
289 gMC->Gdman(18, 4, "MAN");
290 gMC->Gdopt("hide","off");
fe4da5cc 291}
292
293//_____________________________________________________________________________
294void AliTOFv2::CreateMaterials()
295{
296 //
297 // Define materials for the Time Of Flight
298 //
299 AliTOF::CreateMaterials();
300}
301
302//_____________________________________________________________________________
303void AliTOFv2::Init()
304{
305 //
306 // Initialise the detector after the geometry has been defined
307 //
fe4da5cc 308 AliTOF::Init();
cfce8870 309 fIdFTO2=gMC->VolId("FTO2");
310 fIdFTO3=gMC->VolId("FTO3");
311 fIdFLT1=gMC->VolId("FLT1");
312 fIdFLT2=gMC->VolId("FLT2");
313 fIdFLT3=gMC->VolId("FLT3");
fe4da5cc 314}
315
316//_____________________________________________________________________________
317void AliTOFv2::StepManager()
318{
319 //
320 // Procedure called at each step in the Time Of Flight
321 //
3fe3a833 322 TLorentzVector mom, pos;
fe4da5cc 323 Float_t hits[8];
324 Int_t vol[3];
0a6d8768 325 Int_t copy, id, i;
ad51aeb0 326 Int_t *idtmed = fIdtmed->GetArray()-499;
3fe3a833 327 if(gMC->GetMedium()==idtmed[514-1] &&
0a6d8768 328 gMC->IsTrackEntering() && gMC->TrackCharge()
329 && gMC->CurrentVolID(copy)==fIdSens) {
fe4da5cc 330 TClonesArray &lhits = *fHits;
331 //
332 // Record only charged tracks at entrance
0a6d8768 333 gMC->CurrentVolOffID(1,copy);
fe4da5cc 334 vol[2]=copy;
0a6d8768 335 gMC->CurrentVolOffID(3,copy);
fe4da5cc 336 vol[1]=copy;
0a6d8768 337 id=gMC->CurrentVolOffID(6,copy);
fe4da5cc 338 vol[0]=copy;
339 if(id==fIdFTO3) {
340 vol[0]+=22;
0a6d8768 341 id=gMC->CurrentVolOffID(4,copy);
3fe3a833 342 if(id==fIdFLT3) vol[1]+=4;
fe4da5cc 343 } else if (id==fIdFTO2) {
344 vol[0]+=20;
0a6d8768 345 id=gMC->CurrentVolOffID(4,copy);
fe4da5cc 346 if(id==fIdFLT2) vol[1]+=8;
347 } else {
0a6d8768 348 id=gMC->CurrentVolOffID(4,copy);
fe4da5cc 349 if(id==fIdFLT1) vol[1]+=14;
350 }
0a6d8768 351 gMC->TrackPosition(pos);
352 gMC->TrackMomentum(mom);
3fe3a833 353 //
0a6d8768 354 Double_t ptot=mom.Rho();
355 Double_t norm=1/ptot;
356 for(i=0;i<3;++i) {
357 hits[i]=pos[i];
358 hits[i+3]=mom[i]*norm;
359 }
360 hits[6]=ptot;
361 hits[7]=pos[3];
fe4da5cc 362 new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
363 }
364}