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