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