New version for frame1099 with and without holes
[u/mrichter/AliRoot.git] / TOF / AliTOFv4.cxx
CommitLineData
937fe4a4 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$
18Revision 1.9 1999/09/29 09:24:33 fca
19Introduction of the Copyright and cvs Log
20
21*/
22
23///////////////////////////////////////////////////////////////////////////////
24// //
25// Time Of Flight: design of C.Williams FCA //
26// This class contains the functions for version 1 of the Time Of Flight //
27// detector. //
28//
29// VERSION WITH 5 MODULES AND FLAT PLATES
30//
31// WITH HOLES FOR PHOS AND HMPID inside the
32// SPACE FRAME WITH HOLES
33//
34// Authors:
35//
36// Alessio Seganti
37// Domenico Vicinanza
38//
39// University of Salerno - Italy
40//
41//
42//Begin_Html
43/*
44<img src="picts/AliTOFv4Class.gif">
45*/
46//End_Html
47// //
48///////////////////////////////////////////////////////////////////////////////
49
50#include "AliTOFv4.h"
51#include "AliRun.h"
52#include "AliConst.h"
53
54ClassImp(AliTOFv4)
55
56//_____________________________________________________________________________
57AliTOFv4::AliTOFv4()
58{
59 //
60 // Default constructor
61 //
62}
63
64//_____________________________________________________________________________
65AliTOFv4::AliTOFv4(const char *name, const char *title)
66 : AliTOF(name,title)
67{
68 //
69 // Standard constructor
70 //
71}
72
73//_____________________________________________________________________________
74void AliTOFv4::CreateGeometry()
75{
76 //
77 // Create geometry for Time Of Flight version 0
78 //
79 //Begin_Html
80 /*
81 <img src="picts/AliTOFv4.gif">
82 */
83 //End_Html
84 //
85 // Creates common geometry
86 //
87 AliTOF::CreateGeometry();
88}
89
90//_____________________________________________________________________________
91void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlen1,
92 Float_t zlen2, Float_t zlen3, Float_t ztof0)
93{
94 //
95 // Definition of the Time Of Fligh Resistive Plate Chambers
96 // xFLT, yFLT, zFLT - sizes of TOF modules (large)
97
98 Int_t idrotm[100];
99 Float_t ycoor, zcoor;
100 Float_t par[10];
101 Float_t yFREON, xp, yp, zp;
102
103 Int_t *idtmed = fIdtmed->GetArray()-499;
104
105 par[0] = xtof / 2.;
106 par[1] = ytof / 2.;
107 par[2] = zlen1 / 2.;
108 gMC->Gsvolu("FTO1", "BOX ", idtmed[506], par, 3);
109 par[2] = zlen2 / 2.;
110 gMC->Gsvolu("FTO2", "BOX ", idtmed[506], par, 3);
111 par[2] = zlen3 / 2.;
112 gMC->Gsvolu("FTO3", "BOX ", idtmed[506], par, 3);
113
114
115// Positioning of modules
116
117 Float_t zcor1 = ztof0 - zlen1/2;
118 Float_t zcor2 = ztof0 - zlen1 - zlen2/2.;
119 Float_t zcor3 = 0.;
120
121 AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
122 AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
123 gMC->Gspos("FTO1", 1, "BTO1", 0, zcor1, 0, idrotm[0], "ONLY");
124 gMC->Gspos("FTO1", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
125 zcoor = (zlen1/2.);
126 gMC->Gspos("FTO1", 1, "BTO2", 0, zcoor, 0, idrotm[0], "ONLY");
127 zcoor = 0.;
128 gMC->Gspos("FTO1", 1, "BTO3", 0, zcoor, 0, idrotm[0], "ONLY");
129
130 gMC->Gspos("FTO2", 1, "BTO1", 0, zcor2, 0, idrotm[0], "ONLY");
131 gMC->Gspos("FTO2", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
132 zcoor = -zlen2/2.;
133 gMC->Gspos("FTO2", 0, "BTO2", 0, zcoor, 0, idrotm[0], "ONLY");
134
135 gMC->Gspos("FTO3", 0, "BTO1", 0, zcor3, 0, idrotm[0], "ONLY");
136
137// Subtraction the distance to TOF module boundaries
138
139 Float_t db = 7.;
140 Float_t xFLT, yFLT, zFLT1, zFLT2, zFLT3;
141
142 xFLT = xtof -(.5 +.5)*2;
143 yFLT = ytof;
144 zFLT1 = zlen1 - db;
145 zFLT2 = zlen2 - db;
146 zFLT3 = zlen3 - db;
147
148
149
150// freon gaps in MRPC chamber
151 yFREON = .11; //cm
152
153// Sizes of MRPC pads
154
155 xp = 3.0;
156 yp = 12.3*0.05; // 5% X0 of glass
157 zp = 3.0;
158
159// Subtraction of dead boundaries in X=2 cm and Z=7/2 cm
160
161cout <<"************************* TOF geometry **************************"<<endl;
162
163 Int_t nz1, nz2, nz3, nx; //- numbers of pixels
164 nx = Int_t (xFLT/xp);
165
166 printf("Number of pixel along x axis = %i",nx);
167
168 par[0] = xFLT/2;
169 par[1] = yFLT/2;
170 par[2] = (zFLT1 / 2.);
171 nz1 = Int_t (par[2]*2/zp);
172 gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
173 gMC->Gspos("FLT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
174 printf("Number of pixel along z axis (module 1) = %i",nz1);
175
176 par[2] = (zFLT2 / 2.);
177 nz2 = Int_t (par[2]*2/zp);
178 gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
179 gMC->Gspos("FLT2", 0, "FTO2", 0., 0., 0., 0, "ONLY");
180 printf("Number of pixel along z axis (module 2) = %i",nz2);
181
182 par[2] = (zFLT3 / 2.);
183 nz3 = Int_t (par[2]*2/zp);
184 gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
185 gMC->Gspos("FLT3", 0, "FTO3", 0., 0., 0., 0, "ONLY");
186 printf("Number of pixel along z axis (module 3) = %i",nz3);
187
188////////// Layers before detector ////////////////////
189
190// Alluminium layer in front 1.0 mm thick at the beginning
191 par[0] = -1;
192 par[1] = 0.1;
193 par[2] = -1;
194 ycoor = -yFLT/2 + par[1];
195 gMC->Gsvolu("FMY1", "BOX ", idtmed[508], par, 3); // Alluminium
196 gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
197 gMC->Gsvolu("FMY2", "BOX ", idtmed[508], par, 3); // Alluminium
198 gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
199 gMC->Gsvolu("FMY3", "BOX ", idtmed[508], par, 3); // Alluminium
200 gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
201
202// Honeycomb layer (1cm of special polyethilene)
203 ycoor = ycoor + par[1];
204 par[0] = -1;
205 par[1] = 0.5;
206 par[2] = -1;
207 ycoor = ycoor + par[1];
208 gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
209 gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
210 gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
211 gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
212 gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
213 gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
214
215///////////////// Detector itself //////////////////////
216
217 const Float_t SpaceBefore=2.; // Space Beetween detector & Front Panel
218
219 par[0] = -1;
220 par[1] = yp/2; // 5 %X0 thick of glass
221 par[2] = -1;
222 ycoor = -yFLT/2 + SpaceBefore;
223 gMC->Gsvolu("FLD1", "BOX ", idtmed[514], par, 3); // Glass
224 gMC->Gspos("FLD1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
225 gMC->Gsvolu("FLD2", "BOX ", idtmed[514], par, 3); // Glass
226 gMC->Gspos("FLD2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
227 gMC->Gsvolu("FLD3", "BOX ", idtmed[514], par, 3); // Glass
228 gMC->Gspos("FLD3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
229
230 gMC->Gsdvn("FLZ1", "FLD1", nz1, 3); //pixel size xp=zp=3
231 gMC->Gsdvn("FLZ2", "FLD2", nz2, 3);
232 gMC->Gsdvn("FLZ3", "FLD3", nz3, 3);
233 gMC->Gsdvn("FLX1", "FLZ1", nx, 1);
234 gMC->Gsdvn("FLX2", "FLZ2", nx, 1);
235 gMC->Gsdvn("FLX3", "FLZ3", nx, 1);
236
237// MRPC pixel itself
238 par[0] = -1;//xp/2;
239 par[1] = -1;//yp/2; // 5 %X0 thick of glass
240 par[2] = -1;//zp/2;
241 gMC->Gsvolu("FPA0", "BOX ", idtmed[514], par, 3);// Glass
242 gMC->Gspos("FPA0", 1, "FLX1", 0., 0., 0., 0, "ONLY");
243 gMC->Gspos("FPA0", 2, "FLX2", 0., 0., 0., 0, "ONLY");
244 gMC->Gspos("FPA0", 3, "FLX3", 0., 0., 0., 0, "ONLY");
245
246// Freon gas sencitive vol.ume
247 par[0] = -1;
248 par[1] = yFREON/2;
249 par[2] = -1;
250 gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);// Freon
251 gMC->Gspos("FPAD", 0, "FPA0", 0., 0., 0., 0, "ONLY");
252
253////////// Layers after detector ////////////////////
254
255 const Float_t SpaceAfter = 6.; //Space beetween detector & Back Panel
256
257// Honeycomb layer after (3cm)
258 par[0] = -1;
259 par[1] = 0.6;
260 par[2] = -1;
261 ycoor = -yFLT/2 + SpaceAfter - par[1];
262 gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
263 gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
264 gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
265 gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
266 gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
267 gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
268
269// Electronics (Cu) after
270 par[0] = -1;
271 par[1] = 1.43*0.05 / 2.; // 5% of X0
272 par[2] = -1;
273 ycoor = -yFLT/2 + SpaceAfter +par[1];
274 gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
275 gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
276 gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
277 gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
278 gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
279 gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
280
281// Cooling water after
282 ycoor = ycoor+par[1];
283 par[0] = -1;
284 par[1] = 36.1*0.02 / 2.; // 2% of X0
285 par[2] = -1;
286 ycoor = ycoor+par[1];
287 gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
288 gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
289 gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
290 gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
291 gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
292 gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
293
294//back plate honycomb (2cm)
295 par[0] = -1;
296 par[1] = 1.;
297 par[2] = -1;
298 ycoor = yFLT/2 - par[1];
299 gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
300 gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
301 gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
302 gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
303 gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
304 gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
305}
306
307//_____________________________________________________________________________
308void AliTOFv4::DrawModule()
309{
310 //
311 // Draw a shaded view of the Time Of Flight version 1
312 //
313 // Set everything unseen
314 gMC->Gsatt("*", "seen", -1);
315 //
316 // Set ALIC mother transparent
317 gMC->Gsatt("ALIC","SEEN",0);
318 //
319 // Set the volumes visible
320 gMC->Gsatt("ALIC","SEEN",0);
321 gMC->Gsatt("FBAR","SEEN",1);
322 gMC->Gsatt("FTO1","SEEN",1);
323 gMC->Gsatt("FTO2","SEEN",1);
324 gMC->Gsatt("FTO3","SEEN",1);
325 gMC->Gsatt("FBT1","SEEN",1);
326 gMC->Gsatt("FBT2","SEEN",1);
327 gMC->Gsatt("FBT3","SEEN",1);
328 gMC->Gsatt("FDT1","SEEN",1);
329 gMC->Gsatt("FDT2","SEEN",1);
330 gMC->Gsatt("FDT3","SEEN",1);
331 gMC->Gsatt("FLT1","SEEN",1);
332 gMC->Gsatt("FLT2","SEEN",1);
333 gMC->Gsatt("FLT3","SEEN",1);
334 gMC->Gsatt("FPL1","SEEN",1);
335 gMC->Gsatt("FPL2","SEEN",1);
336 gMC->Gsatt("FPL3","SEEN",1);
337 gMC->Gsatt("FLD1","SEEN",1);
338 gMC->Gsatt("FLD2","SEEN",1);
339 gMC->Gsatt("FLD3","SEEN",1);
340 gMC->Gsatt("FLZ1","SEEN",1);
341 gMC->Gsatt("FLZ2","SEEN",1);
342 gMC->Gsatt("FLZ3","SEEN",1);
343 gMC->Gsatt("FLX1","SEEN",1);
344 gMC->Gsatt("FLX2","SEEN",1);
345 gMC->Gsatt("FLX3","SEEN",1);
346 gMC->Gsatt("FPA0","SEEN",1);
347 //
348 gMC->Gdopt("hide", "on");
349 gMC->Gdopt("shad", "on");
350 gMC->Gsatt("*", "fill", 7);
351 gMC->SetClipBox(".");
352 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
353 gMC->DefaultRange();
354 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
355 gMC->Gdhead(1111, "Time Of Flight");
356 gMC->Gdman(18, 4, "MAN");
357 gMC->Gdopt("hide","off");
358}
359
360//_____________________________________________________________________________
361void AliTOFv4::CreateMaterials()
362{
363 //
364 // Define materials for the Time Of Flight
365 //
366 AliTOF::CreateMaterials();
367}
368
369//_____________________________________________________________________________
370void AliTOFv4::Init()
371{
372 //
373 // Initialise the detector after the geometry has been defined
374 //
375 AliTOF::Init();
376 fIdFTO2=gMC->VolId("FTO2");
377 fIdFTO3=gMC->VolId("FTO3");
378 fIdFLT1=gMC->VolId("FLT1");
379 fIdFLT2=gMC->VolId("FLT2");
380 fIdFLT3=gMC->VolId("FLT3");
381}
382
383//_____________________________________________________________________________
384void AliTOFv4::StepManager()
385{
386 //
387 // Procedure called at each step in the Time Of Flight
388 //
389 TLorentzVector mom, pos;
390 Float_t hits[8];
391 Int_t vol[3];
392 Int_t copy, id, i;
393 Int_t *idtmed = fIdtmed->GetArray()-499;
394 if(gMC->GetMedium()==idtmed[514-1] &&
395 gMC->IsTrackEntering() && gMC->TrackCharge()
396 && gMC->CurrentVolID(copy)==fIdSens) {
397 TClonesArray &lhits = *fHits;
398 //
399 // Record only charged tracks at entrance
400 gMC->CurrentVolOffID(1,copy);
401 vol[2]=copy;
402 gMC->CurrentVolOffID(3,copy);
403 vol[1]=copy;
404 id=gMC->CurrentVolOffID(8,copy);
405 vol[0]=copy;
406 if(id==fIdFTO3) {
407 vol[0]+=22;
408 id=gMC->CurrentVolOffID(5,copy);
409 if(id==fIdFLT3) vol[1]+=6;
410 } else if (id==fIdFTO2) {
411 vol[0]+=20;
412 id=gMC->CurrentVolOffID(5,copy);
413 if(id==fIdFLT2) vol[1]+=8;
414 } else {
415 id=gMC->CurrentVolOffID(5,copy);
416 if(id==fIdFLT1) vol[1]+=14;
417 }
418 gMC->TrackPosition(pos);
419 gMC->TrackMomentum(mom);
420 //
421 Double_t ptot=mom.Rho();
422 Double_t norm=1/ptot;
423 for(i=0;i<3;++i) {
424 hits[i]=pos[i];
425 hits[i+3]=mom[i]*norm;
426 }
427 hits[6]=ptot;
428 hits[7]=pos[3];
429 new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
430 }
431}
432