Introduction of the Copyright and cvs Log
[u/mrichter/AliRoot.git] / TOF / AliTOFv1.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17$Log$
18*/
19
fe4da5cc 20///////////////////////////////////////////////////////////////////////////////
21// //
3fe3a833 22// Time Of Flight: design of C.Williams //
fe4da5cc 23// This class contains the functions for version 1 of the Time Of Flight //
24// detector. //
25// //
26//Begin_Html
27/*
1439f98e 28<img src="picts/AliTOFv1Class.gif">
fe4da5cc 29*/
30//End_Html
31// //
32///////////////////////////////////////////////////////////////////////////////
33
34#include "AliTOFv1.h"
35#include "AliRun.h"
fe4da5cc 36#include "AliConst.h"
37
38ClassImp(AliTOFv1)
39
40//_____________________________________________________________________________
151e057e 41AliTOFv1::AliTOFv1()
fe4da5cc 42{
43 //
44 // Default constructor
45 //
46}
47
48//_____________________________________________________________________________
49AliTOFv1::AliTOFv1(const char *name, const char *title)
50 : AliTOF(name,title)
51{
52 //
3fe3a833 53 // Standard constructor
fe4da5cc 54 //
55}
56
57//_____________________________________________________________________________
58void AliTOFv1::CreateGeometry()
59{
60 //
3fe3a833 61 // Create geometry for Time Of Flight version 0
62 //
fe4da5cc 63 //Begin_Html
64 /*
1439f98e 65 <img src="picts/AliTOFv1.gif">
fe4da5cc 66 */
67 //End_Html
68 //
fe4da5cc 69 //
3fe3a833 70 // Create common geometry
fe4da5cc 71 //
3fe3a833 72 AliTOF::CreateGeometry();
73}
74
75//_____________________________________________________________________________
76void AliTOFv1::TOFpc(Float_t xm, Float_t ym, Float_t zm0,
77 Float_t zm1, Float_t zm2)
78{
fe4da5cc 79 //
3fe3a833 80 // Definition of the Time Of Fligh Resistive Plate Chambers
81 // xm, ym, zm - sizes of TOF modules (large)
82
83 Float_t ycoor;
84 Float_t zazor, xp, yp, zp;
85 Float_t par[10];
86
87 Int_t *idtmed = fIdtmed->GetArray()-499;
88
89 // gap in RPC chamber
90 zazor = .03;
91 // Sizes of RPC chamber
92 xp = 3.0; //small pixel
93//xp = 3.9; //large pixel
94 yp = 12.3*0.05; // 5% X0 of glass
95 zp = 3.0; //small pixel
96//zp = 4.1; //large pixel
97 // Large not sensitive volumes with CO2
98 par[0] = xm/2;
99 par[1] = ym/2;
100 par[2] = zm0/2;
101 gMC->Gsvolu("FBT1", "BOX ", idtmed[506], par, 3); // CO2
102 gMC->Gspos("FBT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
103 gMC->Gsdvn("FDT1", "FBT1", 2, 3); // 2 large modules along Z
104 par[2] = zm1 / 2;
105 gMC->Gsvolu("FBT2", "BOX ", idtmed[506], par, 3); // CO2
106 gMC->Gspos("FBT2", 1, "FTO2", 0., 0., 0., 0, "ONLY");
107 gMC->Gsdvn("FDT2", "FBT2", 2, 3); // 2 (PHOS) modules along Z
108 par[2] = zm2 / 2;
109 gMC->Gsvolu("FBT3", "BOX ", idtmed[506], par, 3); // CO2
110 gMC->Gspos("FBT3", 2, "FTO3", 0., 0., 0., 0, "ONLY");
111 gMC->Gsdvn("FDT3", "FBT3", 1, 3); // 1 (RICH) module along Z
fe4da5cc 112 //
3fe3a833 113 // subtraction of dead boundaries in X=2 cm and Z=7/2 cm
114 par[0] = par[0]-2.;
115 Int_t nz0, nz1, nz2, nx; //- numbers of pixels
116 nx = Int_t (par[0]*2/xp);
117 cout <<"************************* TOF geometry **************************"<<endl;
118 cout<< "nx = "<< nx << " x size = "<< par[0]*2/nx << endl;
119 par[1] = -1;
120 par[2] = (zm0 / 2.)/2.; //this is half size of module after division by 2
121 par[2]=par[2]-7/2.;
122 nz0 = Int_t (par[2]*2/zp);
123cout<< "nz0 = "<< nz0 << " z0 size = "<< par[2]*2/nz0 << endl;
124 gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
125 gMC->Gspos("FLT1", 0, "FDT1", 0., 0., 0., 0, "ONLY");
126 par[2] = (zm1 / 2.)/2.; //this is half size of module after division by 2
127 par[2]=par[2]-7/2.;
128 nz1 = Int_t (par[2]*2/zp);
129cout<< "nz1 = "<< nz1 << " z1 size = "<< par[2]*2/nz1 << endl;
130 gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
131 gMC->Gspos("FLT2", 0, "FDT2", 0., 0., 0., 0, "ONLY");
132 par[2] = (zm2 / 2.); //this is half size of module after division by 1
133 par[2]=par[2]-7/2.;
134 nz2 = Int_t (par[2]*2/zp);
135cout<< "nz2 = "<< nz2 << " z2 size = "<< par[2]*2/nz2 << endl;
136 gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
137 gMC->Gspos("FLT3", 0, "FDT3", 0., 0., 0., 0, "ONLY");
fe4da5cc 138 //
3fe3a833 139////////// Layers before detector ////////////////////
140// Mylar layer in front 0.5mm thick at the beginning
141 par[0] = -1;
142 par[1] = 0.05 / 2;
143 par[2] = -1;
144 ycoor = -ym/2 + par[1];
145 gMC->Gsvolu("FMY1", "BOX ", idtmed[511], par, 3); // Mylar
146 gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
147 gMC->Gsvolu("FMY2", "BOX ", idtmed[511], par, 3); // Mylar
148 gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
149 gMC->Gsvolu("FMY3", "BOX ", idtmed[511], par, 3); // Mylar
150 gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
151// Honeycomb layer (1cm of special!!! polyethilene)
152 ycoor = ycoor + par[1];
153 par[0] = -1;
154 par[1] = 1. / 2;
155 par[2] = -1;
156 ycoor = ycoor + par[1];
157 gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
158 gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
159 gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
160 gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
161 gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
162 gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
fe4da5cc 163 //
3fe3a833 164///////////////// Detector itself //////////////////////
165 par[0] = -1;
166 par[1] = yp/2; // 5 %X0 thick of glass
167 par[2] = -1;
168 ycoor = -ym/2 + 2;
169 gMC->Gsvolu("FLD1", "BOX ", idtmed[514], par, 3); // Glass
170 gMC->Gspos("FLD1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
171 gMC->Gsvolu("FLD2", "BOX ", idtmed[514], par, 3); // Glass
172 gMC->Gspos("FLD2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
173 gMC->Gsvolu("FLD3", "BOX ", idtmed[514], par, 3); // Glass
174 gMC->Gspos("FLD3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
fe4da5cc 175 //
3fe3a833 176 gMC->Gsdvn("FLZ1", "FLD1", nz0, 3); //pixel size xp=zp=3
177 gMC->Gsdvn("FLZ2", "FLD2", nz1, 3);
178 gMC->Gsdvn("FLZ3", "FLD3", nz2, 3);
179 gMC->Gsdvn("FLX1", "FLZ1", nx, 1);
180 gMC->Gsdvn("FLX2", "FLZ2", nx, 1);
181 gMC->Gsdvn("FLX3", "FLZ3", nx, 1);
182 // RPC pixel itself
183 par[0] = -1;//xp/2;
184 par[1] = -1;//yp/2; // 5 %X0 thick of glass
185 par[2] = -1;//zp/2;
186 gMC->Gsvolu("FPA0", "BOX ", idtmed[514], par, 3);// Glass
187 gMC->Gspos("FPA0", 1, "FLX1", 0., 0., 0., 0, "ONLY");
188 gMC->Gspos("FPA0", 2, "FLX2", 0., 0., 0., 0, "ONLY");
189 gMC->Gspos("FPA0", 3, "FLX3", 0., 0., 0., 0, "ONLY");
190 // Freon gas sencitive volume
191 par[0] = -1;
192 par[1] = zazor/2;
193 par[2] = -1;
194 gMC->Gsvolu("FPG0", "BOX ", idtmed[513], par, 3);// Freon
195 gMC->Gspos("FPG0", 0, "FPA0", 0., 0., 0., 0, "ONLY");
fe4da5cc 196 //
3fe3a833 197////////// Layers after detector ////////////////////
198 // Honeycomb layer after (3cm)
199 par[0] = -1;
200 par[1] = 1.2 / 2.;
201 par[2] = -1;
202 ycoor = -ym/2 + 6. - par[1];
203 gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
204 gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
205 gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
206 gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
207 gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
208 gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
209 // Electronics (Cu) after
210 par[0] = -1;
211 par[1] = 1.43*0.05 / 2.; // 5% of X0
212 par[2] = -1;
213 ycoor = -ym/2 + 6.+par[1];
214 gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
215 gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
216 gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
217 gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
218 gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
219 gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
220 // Cooling water after
221 ycoor = ycoor+par[1];
222 par[0] = -1;
223 par[1] = 36.1*0.02 / 2.; // 2% of X0
224 par[2] = -1;
225 ycoor = ycoor+par[1];
226 gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
227 gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
228 gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
229 gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
230 gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
231 gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
232 //back plate honycomb (2cm)
233 par[0] = -1;
234 par[1] = 2 / 2.;
235 par[2] = -1;
236 ycoor = ym/2 - par[1];
237 gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
238 gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
239 gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
240 gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
241 gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
242 gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
fe4da5cc 243}
3fe3a833 244
fe4da5cc 245//_____________________________________________________________________________
8f72dc0c 246void AliTOFv1::DrawModule()
fe4da5cc 247{
248 //
249 // Draw a shaded view of the Time Of Flight version 1
250 //
fe4da5cc 251 // Set everything unseen
cfce8870 252 gMC->Gsatt("*", "seen", -1);
fe4da5cc 253 //
254 // Set ALIC mother transparent
cfce8870 255 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 256 //
257 // Set the volumes visible
3fe3a833 258 gMC->Gsatt("ALIC","SEEN",0);
259 gMC->Gsatt("FBAR","SEEN",1);
260 gMC->Gsatt("FTO1","SEEN",1);
261 gMC->Gsatt("FTO2","SEEN",1);
262 gMC->Gsatt("FTO3","SEEN",1);
263 gMC->Gsatt("FBT1","SEEN",1);
264 gMC->Gsatt("FBT2","SEEN",1);
265 gMC->Gsatt("FBT3","SEEN",1);
266 gMC->Gsatt("FDT1","SEEN",1);
267 gMC->Gsatt("FDT2","SEEN",1);
268 gMC->Gsatt("FDT3","SEEN",1);
269 gMC->Gsatt("FLT1","SEEN",1);
270 gMC->Gsatt("FLT2","SEEN",1);
271 gMC->Gsatt("FLT3","SEEN",1);
272 gMC->Gsatt("FPL1","SEEN",1);
273 gMC->Gsatt("FPL2","SEEN",1);
274 gMC->Gsatt("FPL3","SEEN",1);
275 gMC->Gsatt("FLD1","SEEN",1);
276 gMC->Gsatt("FLD2","SEEN",1);
277 gMC->Gsatt("FLD3","SEEN",1);
278 gMC->Gsatt("FLZ1","SEEN",1);
279 gMC->Gsatt("FLZ2","SEEN",1);
280 gMC->Gsatt("FLZ3","SEEN",1);
281 gMC->Gsatt("FLX1","SEEN",1);
282 gMC->Gsatt("FLX2","SEEN",1);
283 gMC->Gsatt("FLX3","SEEN",1);
284 gMC->Gsatt("FPA0","SEEN",1);
cfce8870 285 //
286 gMC->Gdopt("hide", "on");
287 gMC->Gdopt("shad", "on");
288 gMC->Gsatt("*", "fill", 7);
289 gMC->SetClipBox(".");
290 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
291 gMC->DefaultRange();
292 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
293 gMC->Gdhead(1111, "Time Of Flight");
294 gMC->Gdman(18, 4, "MAN");
295 gMC->Gdopt("hide","off");
fe4da5cc 296}
297
3fe3a833 298//_____________________________________________________________________________
fe4da5cc 299void AliTOFv1::CreateMaterials()
300{
301 //
3fe3a833 302 // Define materials for the Time Of Flight
fe4da5cc 303 //
304 AliTOF::CreateMaterials();
305}
306
3fe3a833 307//_____________________________________________________________________________
fe4da5cc 308void AliTOFv1::Init()
309{
310 //
3fe3a833 311 // Initialise the detector after the geometry has been defined
312 //
fe4da5cc 313 AliTOF::Init();
3fe3a833 314 fIdFTO2=gMC->VolId("FTO2");
315 fIdFTO3=gMC->VolId("FTO3");
316 fIdFLT1=gMC->VolId("FLT1");
317 fIdFLT2=gMC->VolId("FLT2");
318 fIdFLT3=gMC->VolId("FLT3");
fe4da5cc 319}
320
3fe3a833 321//_____________________________________________________________________________
fe4da5cc 322void AliTOFv1::StepManager()
323{
3fe3a833 324 //
325 // Procedure called at each step in the Time Of Flight
326 //
0a6d8768 327 TLorentzVector mom, pos;
fe4da5cc 328 Float_t hits[8];
329 Int_t vol[3];
0a6d8768 330 Int_t copy, id, i;
ad51aeb0 331 Int_t *idtmed = fIdtmed->GetArray()-499;
3fe3a833 332 if(gMC->GetMedium()==idtmed[514-1] &&
0a6d8768 333 gMC->IsTrackEntering() && gMC->TrackCharge()
3fe3a833 334 && gMC->CurrentVolID(copy)==fIdSens) {
fe4da5cc 335 TClonesArray &lhits = *fHits;
3fe3a833 336 //
337 // Record only charged tracks at entrance
338 gMC->CurrentVolOffID(1,copy);
fe4da5cc 339 vol[2]=copy;
3fe3a833 340 gMC->CurrentVolOffID(3,copy);
341 vol[1]=copy;
342 id=gMC->CurrentVolOffID(8,copy);
343 vol[0]=copy;
344 if(id==fIdFTO3) {
345 vol[0]+=22;
346 id=gMC->CurrentVolOffID(5,copy);
347 if(id==fIdFLT3) vol[1]+=6;
348 } else if (id==fIdFTO2) {
349 vol[0]+=20;
350 id=gMC->CurrentVolOffID(5,copy);
351 if(id==fIdFLT2) vol[1]+=8;
352 } else {
353 id=gMC->CurrentVolOffID(5,copy);
354 if(id==fIdFLT1) vol[1]+=14;
355 }
0a6d8768 356 gMC->TrackPosition(pos);
357 gMC->TrackMomentum(mom);
358 //
359 Double_t ptot=mom.Rho();
360 Double_t norm=1/ptot;
361 for(i=0;i<3;++i) {
362 hits[i]=pos[i];
363 hits[i+3]=mom[i]*norm;
364 }
365 hits[6]=ptot;
366 hits[7]=pos[3];
fe4da5cc 367 new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
368 }
369}
3fe3a833 370
371
372
373
374
375
376
377
378
379