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