]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TOF/AliTOFv3.cxx
AliGenHijingEventHeader.h made available in include
[u/mrichter/AliRoot.git] / TOF / AliTOFv3.cxx
... / ...
CommitLineData
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.21 2001/08/28 08:45:59 vicinanz
19TTask and TFolder structures implemented
20
21Revision 1.20 2001/05/16 14:57:24 alibrary
22New files for folders and Stack
23
24Revision 1.19 2001/05/04 10:09:48 vicinanz
25Major upgrades to the strip structure
26
27Revision 1.18 2000/12/04 08:48:20 alibrary
28Fixing problems in the HEAD
29
30Revision 1.17 2000/10/02 21:28:17 fca
31Removal of useless dependecies via forward declarations
32
33Revision 1.16 2000/05/10 16:52:18 vicinanz
34New TOF version with holes for PHOS/RICH
35
36Revision 1.14.2.1 2000/05/10 09:37:16 vicinanz
37New version with Holes for PHOS/RICH
38
39Revision 1.14 1999/11/05 22:39:06 fca
40New hits structure
41
42Revision 1.13 1999/11/02 11:26:39 fca
43added stdlib.h for exit
44
45Revision 1.12 1999/11/01 20:41:57 fca
46Added protections against using the wrong version of FRAME
47
48Revision 1.11 1999/10/22 08:04:14 fca
49Correct improper use of negative parameters
50
51Revision 1.10 1999/10/16 19:30:06 fca
52Corrected Rotation Matrix and CVS log
53
54Revision 1.9 1999/10/15 15:35:20 fca
55New version for frame1099 with and without holes
56
57Revision 1.8 1999/09/29 09:24:33 fca
58Introduction of the Copyright and cvs Log
59
60*/
61
62///////////////////////////////////////////////////////////////////////////////
63// //
64// Time Of Flight: design of C.Williams //
65// //
66// This class contains the functions for version 3 of the Time Of Flight //
67// detector. //
68//
69// VERSION WITH 5 MODULES AND TILTED STRIPS
70// HITS DEFINED FOR THIS VERSION
71// HOLES FOR RICH DETECTOR
72//
73// Authors:
74//
75// Alessio Seganti
76// Domenico Vicinanza
77//
78// University of Salerno - Italy
79//
80// Fabrizio Pierella
81// University of Bologna - Italy
82//
83//
84//Begin_Html
85/*
86<img src="picts/AliTOFv3Class.gif">
87*/
88//End_Html
89// //
90///////////////////////////////////////////////////////////////////////////////
91
92#include <iostream.h>
93#include <stdlib.h>
94
95#include "AliTOFv3.h"
96#include "TBRIK.h"
97#include "TGeometry.h"
98#include "TNode.h"
99#include <TLorentzVector.h>
100#include "TObject.h"
101#include "AliRun.h"
102#include "AliMC.h"
103#include "AliConst.h"
104
105
106ClassImp(AliTOFv3)
107
108//_____________________________________________________________________________
109AliTOFv3::AliTOFv3()
110{
111 //
112 // Default constructor
113 //
114}
115
116//_____________________________________________________________________________
117AliTOFv3::AliTOFv3(const char *name, const char *title)
118 : AliTOF(name,title)
119{
120 //
121 // Standard constructor
122 //
123 //
124 // Check that FRAME is there otherwise we have no place where to
125 // put TOF
126 AliModule* frame=gAlice->GetModule("FRAME");
127 if(!frame) {
128 Error("Ctor","TOF needs FRAME to be present\n");
129 exit(1);
130 } else
131 if(frame->IsVersion()!=1) {
132 Error("Ctor","FRAME version 1 needed with this version of TOF\n");
133 exit(1);
134 }
135
136}
137
138//____________________________________________________________________________
139AliTOFv3::~AliTOFv3()
140{
141 // destructor
142
143 if ( fHits) {
144 fHits->Delete() ;
145 delete fHits ;
146 fHits = 0 ;
147 }
148
149 if ( fSDigits) {
150 fSDigits->Delete() ;
151 delete fSDigits ;
152 fSDigits = 0 ;
153 }
154
155 if ( fDigits) {
156 fDigits->Delete() ;
157 delete fDigits ;
158 fDigits = 0 ;
159 }
160
161}
162
163//_____________________________________________________________________________
164void AliTOFv3::BuildGeometry()
165{
166 //
167 // Build TOF ROOT geometry for the ALICE event display
168 //
169 TNode *node, *top;
170 const int kColorTOF = 27;
171
172 // Find top TNODE
173 top = gAlice->GetGeometry()->GetNode("alice");
174
175 // Position the different copies
176 const Float_t krTof =(fRmax+fRmin)/2;
177 const Float_t khTof = fRmax-fRmin;
178 const Int_t kNTof = fNTof;
179 const Float_t kPi = TMath::Pi();
180 const Float_t kangle = 2*kPi/kNTof;
181 Float_t ang;
182
183 // Define TOF basic volume
184
185 char nodeName0[7], nodeName1[7], nodeName2[7];
186 char nodeName3[7], nodeName4[7], rotMatNum[7];
187
188 new TBRIK("S_TOF_C","TOF box","void",
189 120*0.5,khTof*0.5,fZlenC*0.5);
190 new TBRIK("S_TOF_B","TOF box","void",
191 120*0.5,khTof*0.5,fZlenB*0.5);
192 new TBRIK("S_TOF_A","TOF box","void",
193 120*0.5,khTof*0.5,fZlenA*0.5);
194
195 for (Int_t nodeNum=1;nodeNum<19;nodeNum++){
196
197 if (nodeNum<10) {
198 sprintf(rotMatNum,"rot50%i",nodeNum);
199 sprintf(nodeName0,"FTO00%i",nodeNum);
200 sprintf(nodeName1,"FTO10%i",nodeNum);
201 sprintf(nodeName2,"FTO20%i",nodeNum);
202 sprintf(nodeName3,"FTO30%i",nodeNum);
203 sprintf(nodeName4,"FTO40%i",nodeNum);
204 }
205 if (nodeNum>9) {
206 sprintf(rotMatNum,"rot5%i",nodeNum);
207 sprintf(nodeName0,"FTO0%i",nodeNum);
208 sprintf(nodeName1,"FTO1%i",nodeNum);
209 sprintf(nodeName2,"FTO2%i",nodeNum);
210 sprintf(nodeName3,"FTO3%i",nodeNum);
211 sprintf(nodeName4,"FTO4%i",nodeNum);
212 }
213
214 new TRotMatrix(rotMatNum,rotMatNum,90,-20*nodeNum,90,90-20*nodeNum,0,0);
215 ang = (4.5-nodeNum) * kangle;
216
217 top->cd();
218 node = new TNode(nodeName0,nodeName0,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),299.15,rotMatNum);
219 node->SetLineColor(kColorTOF);
220 fNodes->Add(node);
221
222 top->cd();
223 node = new TNode(nodeName1,nodeName1,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-299.15,rotMatNum);
224 node->SetLineColor(kColorTOF);
225 fNodes->Add(node);
226if (nodeNum !=1 && nodeNum!=2 && nodeNum !=18)
227 {
228 top->cd();
229 node = new TNode(nodeName2,nodeName2,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),146.45,rotMatNum);
230 node->SetLineColor(kColorTOF);
231 fNodes->Add(node);
232
233 top->cd();
234 node = new TNode(nodeName3,nodeName3,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-146.45,rotMatNum);
235 node->SetLineColor(kColorTOF);
236 fNodes->Add(node);
237 } // Holes for RICH detector
238
239if (nodeNum !=1 && nodeNum !=2 && nodeNum !=18)
240 {
241 top->cd();
242 node = new TNode(nodeName4,nodeName4,"S_TOF_A",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),0.,rotMatNum);
243 node->SetLineColor(kColorTOF);
244 fNodes->Add(node);
245 } // Holes for RICH detector, central part
246 }
247}
248
249
250
251//_____________________________________________________________________________
252void AliTOFv3::CreateGeometry()
253{
254 //
255 // Create geometry for Time Of Flight version 0
256 //
257 //Begin_Html
258 /*
259 <img src="picts/AliTOFv3.gif">
260 */
261 //End_Html
262 //
263 // Creates common geometry
264 //
265 AliTOF::CreateGeometry();
266}
267
268//_____________________________________________________________________________
269void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
270 Float_t zlenB, Float_t zlenA, Float_t ztof0)
271{
272 //
273 // Definition of the Time Of Fligh Resistive Plate Chambers
274 // xFLT, yFLT, zFLT - sizes of TOF modules (large)
275
276 Float_t ycoor, zcoor;
277 Float_t par[3];
278 Int_t *idtmed = fIdtmed->GetArray()-499;
279 Int_t idrotm[100];
280 Int_t nrot = 0;
281 Float_t hTof = fRmax-fRmin;
282
283 Float_t radius = fRmin+2.;//cm
284
285 par[0] = xtof * 0.5;
286 par[1] = ytof * 0.5;
287 par[2] = zlenC * 0.5;
288 gMC->Gsvolu("FTOC", "BOX ", idtmed[506], par, 3);
289 par[2] = zlenB * 0.5;
290 gMC->Gsvolu("FTOB", "BOX ", idtmed[506], par, 3);
291 par[2] = zlenA * 0.5;
292 gMC->Gsvolu("FTOA", "BOX ", idtmed[506], par, 3);
293
294
295// Positioning of modules
296
297 Float_t zcor1 = ztof0 - zlenC*0.5;
298 Float_t zcor2 = ztof0 - zlenC - zlenB*0.5;
299 Float_t zcor3 = 0.;
300
301 AliMatrix(idrotm[0], 90., 0., 0., 0., 90,-90.);
302 AliMatrix(idrotm[1], 90.,180., 0., 0., 90, 90.);
303 gMC->Gspos("FTOC", 1, "BTO1", 0, zcor1, 0, idrotm[0], "ONLY");
304 gMC->Gspos("FTOC", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
305 gMC->Gspos("FTOC", 1, "BTO2", 0, zcor1, 0, idrotm[0], "ONLY");
306 gMC->Gspos("FTOC", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
307 gMC->Gspos("FTOC", 1, "BTO3", 0, zcor1, 0, idrotm[0], "ONLY");
308 gMC->Gspos("FTOC", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
309
310 gMC->Gspos("FTOB", 1, "BTO1", 0, zcor2, 0, idrotm[0], "ONLY");
311 gMC->Gspos("FTOB", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
312 gMC->Gspos("FTOB", 1, "BTO2", 0, zcor2, 0, idrotm[0], "ONLY");
313 gMC->Gspos("FTOB", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
314
315 gMC->Gspos("FTOA", 0, "BTO1", 0, zcor3, 0, idrotm[0], "ONLY");
316 gMC->Gspos("FTOA", 0, "BTO2", 0, zcor3, 0, idrotm[0], "ONLY");
317
318 Float_t db = 0.5;//cm
319 Float_t xFLT, xFST, yFLT, zFLTA, zFLTB, zFLTC;
320
321 xFLT = fStripLn;
322 yFLT = ytof;
323 zFLTA = zlenA;
324 zFLTB = zlenB;
325 zFLTC = zlenC;
326
327 xFST = xFLT-fDeadBndX*2;//cm
328
329// Sizes of MRPC pads
330
331 Float_t yPad = 0.505;//cm
332
333// Large not sensitive volumes with Insensitive Freon
334 par[0] = xFLT*0.5;
335 par[1] = yFLT*0.5;
336
337 if (fDebug) cout << ClassName() <<
338 cout <<": ************************* TOF geometry **************************"<<endl;
339
340 par[2] = (zFLTA *0.5);
341 gMC->Gsvolu("FLTA", "BOX ", idtmed[512], par, 3); // Insensitive Freon
342 gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY");
343
344 par[2] = (zFLTB * 0.5);
345 gMC->Gsvolu("FLTB", "BOX ", idtmed[512], par, 3); // Insensitive Freon
346 gMC->Gspos ("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY");
347
348 par[2] = (zFLTC * 0.5);
349 gMC->Gsvolu("FLTC", "BOX ", idtmed[512], par, 3); // Insensitive Freon
350 gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY");
351
352////////// Layers of Aluminum before and after detector //////////
353////////// Aluminum Box for Modules (2.0 mm thickness) /////////
354////////// lateral walls not simulated
355 par[0] = xFLT*0.5;
356 par[1] = 0.1;//cm
357 ycoor = -yFLT/2 + par[1];
358 par[2] = (zFLTA *0.5);
359 gMC->Gsvolu("FALA", "BOX ", idtmed[508], par, 3); // Alluminium
360 gMC->Gspos ("FALA", 1, "FLTA", 0., ycoor, 0., 0, "ONLY");
361 gMC->Gspos ("FALA", 2, "FLTA", 0.,-ycoor, 0., 0, "ONLY");
362 par[2] = (zFLTB *0.5);
363 gMC->Gsvolu("FALB", "BOX ", idtmed[508], par, 3); // Alluminium
364 gMC->Gspos ("FALB", 1, "FLTB", 0., ycoor, 0., 0, "ONLY");
365 gMC->Gspos ("FALB", 2, "FLTB", 0.,-ycoor, 0., 0, "ONLY");
366 par[2] = (zFLTC *0.5);
367 gMC->Gsvolu("FALC", "BOX ", idtmed[508], par, 3); // Alluminium
368 gMC->Gspos ("FALC", 1, "FLTC", 0., ycoor, 0., 0, "ONLY");
369 gMC->Gspos ("FALC", 2, "FLTC", 0.,-ycoor, 0., 0, "ONLY");
370
371///////////////// Detector itself //////////////////////
372
373 const Float_t kdeadBound = fDeadBndZ; //cm non-sensitive between the pad edge
374 //and the boundary of the strip
375 const Int_t knx = fNpadX; // number of pads along x
376 const Int_t knz = fNpadZ; // number of pads along z
377 const Float_t kspace = fSpace; //cm distance from the front plate of the box
378
379 Float_t zSenStrip = fZpad*fNpadZ;//cm
380 Float_t stripWidth = zSenStrip + 2*kdeadBound;
381
382 par[0] = xFLT*0.5;
383 par[1] = yPad*0.5;
384 par[2] = stripWidth*0.5;
385
386// new description for strip volume -double stack strip-
387// -- all constants are expressed in cm
388// heigth of different layers
389 const Float_t khhony = 1. ; // heigth of HONY Layer
390 const Float_t khpcby = 0.15 ; // heigth of PCB Layer
391 const Float_t khmyly = 0.035 ; // heigth of MYLAR Layer
392 const Float_t khgraphy = 0.02 ; // heigth of GRAPHITE Layer
393 const Float_t khglasseiy = 0.17; // 0.6 Ext. Glass + 1.1 i.e. (Int. Glass/2) (mm)
394 const Float_t khsensmy = 0.11 ; // heigth of Sensitive Freon Mixture
395 const Float_t kwsensmz = 2*3.5 ; // cm
396 const Float_t klsensmx = 48*2.5; // cm
397 const Float_t kwpadz = 3.5; // cm z dimension of the FPAD volume
398 const Float_t klpadx = 2.5; // cm x dimension of the FPAD volume
399
400 // heigth of the FSTR Volume (the strip volume)
401 const Float_t khstripy = 2*khhony+3*khpcby+4*(khmyly+khgraphy+khglasseiy)+2*khsensmy;
402 // width of the FSTR Volume (the strip volume)
403 const Float_t kwstripz = 10.;
404 // length of the FSTR Volume (the strip volume)
405 const Float_t klstripx = 122.;
406
407 Float_t parfp[3]={klstripx*0.5,khstripy*0.5,kwstripz*0.5};
408// coordinates of the strip center in the strip reference frame; used for positioning
409// internal strip volumes
410 Float_t posfp[3]={0.,0.,0.};
411
412
413 // FSTR volume definition and filling this volume with non sensitive Gas Mixture
414 gMC->Gsvolu("FSTR","BOX",idtmed[512],parfp,3);
415 //-- HONY Layer definition
416// parfp[0] = -1;
417 parfp[1] = khhony*0.5;
418// parfp[2] = -1;
419 gMC->Gsvolu("FHON","BOX",idtmed[503],parfp,3);
420 // positioning 2 HONY Layers on FSTR volume
421
422 posfp[1]=-khstripy*0.5+parfp[1];
423 gMC->Gspos("FHON",1,"FSTR",0., posfp[1],0.,0,"ONLY");
424 gMC->Gspos("FHON",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
425
426 //-- PCB Layer definition
427 parfp[1] = khpcby*0.5;
428 gMC->Gsvolu("FPCB","BOX",idtmed[504],parfp,3);
429 // positioning 2 PCB Layers on FSTR volume
430 posfp[1]=-khstripy*0.5+khhony+parfp[1];
431 gMC->Gspos("FPCB",1,"FSTR",0., posfp[1],0.,0,"ONLY");
432 gMC->Gspos("FPCB",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
433 // positioning the central PCB layer
434 gMC->Gspos("FPCB",3,"FSTR",0.,0.,0.,0,"ONLY");
435
436
437
438 //-- MYLAR Layer definition
439 parfp[1] = khmyly*0.5;
440 gMC->Gsvolu("FMYL","BOX",idtmed[511],parfp,3);
441 // positioning 2 MYLAR Layers on FSTR volume
442 posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1];
443 gMC->Gspos("FMYL",1,"FSTR",0., posfp[1],0.,0,"ONLY");
444 gMC->Gspos("FMYL",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
445 // adding further 2 MYLAR Layers on FSTR volume
446 posfp[1] = khpcby*0.5+parfp[1];
447 gMC->Gspos("FMYL",3,"FSTR",0., posfp[1],0.,0,"ONLY");
448 gMC->Gspos("FMYL",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
449
450
451 //-- Graphite Layer definition
452 parfp[1] = khgraphy*0.5;
453 gMC->Gsvolu("FGRP","BOX",idtmed[502],parfp,3);
454 // positioning 2 Graphite Layers on FSTR volume
455 posfp[1] = -khstripy*0.5+khhony+khpcby+khmyly+parfp[1];
456 gMC->Gspos("FGRP",1,"FSTR",0., posfp[1],0.,0,"ONLY");
457 gMC->Gspos("FGRP",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
458 // adding further 2 Graphite Layers on FSTR volume
459 posfp[1] = khpcby*0.5+khmyly+parfp[1];
460 gMC->Gspos("FGRP",3,"FSTR",0., posfp[1],0.,0,"ONLY");
461 gMC->Gspos("FGRP",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
462
463
464 //-- Glass (EXT. +Semi INT.) Layer definition
465 parfp[1] = khglasseiy*0.5;
466 gMC->Gsvolu("FGLA","BOX",idtmed[514],parfp,3);
467 // positioning 2 Glass Layers on FSTR volume
468 posfp[1] = -khstripy*0.5+khhony+khpcby+khmyly+khgraphy+parfp[1];
469 gMC->Gspos("FGLA",1,"FSTR",0., posfp[1],0.,0,"ONLY");
470 gMC->Gspos("FGLA",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
471 // adding further 2 Glass Layers on FSTR volume
472 posfp[1] = khpcby*0.5+khmyly+khgraphy+parfp[1];
473 gMC->Gspos("FGLA",3,"FSTR",0., posfp[1],0.,0,"ONLY");
474 gMC->Gspos("FGLA",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
475
476
477 //-- Sensitive Mixture Layer definition
478 parfp[0] = klsensmx*0.5;
479 parfp[1] = khsensmy*0.5;
480 parfp[2] = kwsensmz*0.5;
481 gMC->Gsvolu("FSEN","BOX",idtmed[513],parfp,3);
482 gMC->Gsvolu("FNSE","BOX",idtmed[512],parfp,3);
483 // positioning 2 gas Layers on FSTR volume
484 // the upper is insensitive freon
485 // while the remaining is sensitive
486 posfp[1] = khpcby*0.5+khmyly+khgraphy+khglasseiy+parfp[1];
487 gMC->Gspos("FNSE",0,"FSTR", 0., posfp[1],0.,0,"ONLY");
488 gMC->Gspos("FSEN",0,"FSTR", 0.,-posfp[1],0.,0,"ONLY");
489
490 // dividing FSEN along z in knz=2 and along x in knx=48
491 gMC->Gsdvn("FSEZ","FSEN",knz,3);
492 gMC->Gsdvn("FSEX","FSEZ",knx,1);
493
494 // FPAD volume definition
495 parfp[0] = klpadx*0.5;
496 parfp[1] = khsensmy*0.5;
497 parfp[2] = kwpadz*0.5;
498 gMC->Gsvolu("FPAD","BOX",idtmed[513],parfp,3);
499 // positioning the FPAD volumes on previous divisions
500 gMC->Gspos("FPAD",0,"FSEX",0.,0.,0.,0,"ONLY");
501
502//// Positioning the Strips (FSTR) in the FLT volumes /////
503
504 // Plate A (Central)
505
506 Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
507
508 Float_t gap = fGapA; //cm distance between the strip axis
509 Float_t zpos = 0;
510 Float_t ang = 0;
511 Int_t i=1,j=1;
512 nrot = 0;
513 zcoor = 0;
514 ycoor = -14.5 + kspace ; //2 cm over front plate
515
516 AliMatrix (idrotm[0], 90., 0.,90.,90.,0., 90.);
517 gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
518 if(fDebug) {
519 printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);
520 printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos);
521 }
522 zcoor -= zSenStrip;
523 j++;
524 Int_t upDown = -1; // upDown=-1 -> Upper strip
525 // upDown=+1 -> Lower strip
526 do{
527 ang = atan(zcoor/radius);
528 ang *= kRaddeg;
529 AliMatrix (idrotm[nrot], 90., 0.,90.-ang,90.,-ang, 90.);
530 AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
531 ang /= kRaddeg;
532 ycoor = -14.5+ kspace; //2 cm over front plate
533 ycoor += (1-(upDown+1)/2)*gap;
534 gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY");
535 gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
536 if(fDebug) {
537 printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);
538 printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos);
539 }
540 j += 2;
541 upDown*= -1; // Alternate strips
542 zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
543 upDown*gap*TMath::Tan(ang)-
544 (zSenStrip/2)/TMath::Cos(ang);
545 } while (zcoor-(stripWidth/2)*TMath::Cos(ang)>-t+zFLTC+zFLTB+db*2);
546
547 zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)+
548 upDown*gap*TMath::Tan(ang)+
549 (zSenStrip/2)/TMath::Cos(ang);
550
551 gap = fGapB;
552 zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
553 upDown*gap*TMath::Tan(ang)-
554 (zSenStrip/2)/TMath::Cos(ang);
555
556 ang = atan(zcoor/radius);
557 ang *= kRaddeg;
558 AliMatrix (idrotm[nrot], 90., 0.,90.-ang,90.,-ang, 90.);
559 AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
560 ang /= kRaddeg;
561
562 ycoor = -14.5+ kspace; //2 cm over front plate
563 ycoor += (1-(upDown+1)/2)*gap;
564 gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY");
565 gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
566 if(fDebug) {
567 printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,i);
568 printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos);
569 }
570 ycoor = -hTof/2.+ kspace;//2 cm over front plate
571
572 // Plate B
573
574 nrot = 0;
575 i=1;
576 upDown = 1;
577 Float_t deadRegion = 1.0;//cm
578
579 zpos = zcoor - (zSenStrip/2)/TMath::Cos(ang)-
580 upDown*gap*TMath::Tan(ang)-
581 (zSenStrip/2)/TMath::Cos(ang)-
582 deadRegion/TMath::Cos(ang);
583
584 ang = atan(zpos/radius);
585 ang *= kRaddeg;
586 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
587 ang /= kRaddeg;
588 ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
589 ycoor += (1-(upDown+1)/2)*gap;
590 zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
591 gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
592 if(fDebug) {
593 printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
594 printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos);
595 }
596 i++;
597 upDown*=-1;
598
599 do {
600 zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)-
601 upDown*gap*TMath::Tan(ang)-
602 (zSenStrip/2)/TMath::Cos(ang);
603 ang = atan(zpos/radius);
604 ang *= kRaddeg;
605 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
606 ang /= kRaddeg;
607 ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
608 ycoor += (1-(upDown+1)/2)*gap;
609 zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
610 gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
611 if(fDebug) {
612 printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
613 printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos);
614 }
615 upDown*=-1;
616 i++;
617 } while (TMath::Abs(ang*kRaddeg)<22.5);
618 //till we reach a tilting angle of 22.5 degrees
619
620 ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
621 zpos = zpos - zSenStrip/TMath::Cos(ang);
622
623 do {
624 ang = atan(zpos/radius);
625 ang *= kRaddeg;
626 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
627 ang /= kRaddeg;
628 zcoor = zpos+(zFLTB/2+zFLTA/2+db);
629 gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
630 zpos = zpos - zSenStrip/TMath::Cos(ang);
631 if(fDebug) {
632 printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
633 printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos);
634 }
635 i++;
636
637 } while (zpos-stripWidth*0.5/TMath::Cos(ang)>-t+zFLTC+db);
638
639 // Plate C
640
641 zpos = zpos + zSenStrip/TMath::Cos(ang);
642
643 zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+
644 gap*TMath::Tan(ang)-
645 (zSenStrip/2)/TMath::Cos(ang);
646
647 nrot = 0;
648 i=0;
649 ycoor= -hTof*0.5+kspace+gap;
650
651 do {
652 i++;
653 ang = atan(zpos/radius);
654 ang *= kRaddeg;
655 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
656 ang /= kRaddeg;
657 zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
658 gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
659 if(fDebug) {
660 printf("%s: %f, St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i);
661 printf("y = %f, z = %f, zpos = %f \n",ycoor,zcoor,zpos);
662 }
663 zpos = zpos - zSenStrip/TMath::Cos(ang);
664 } while (zpos-stripWidth*TMath::Cos(ang)*0.5>-t);
665
666
667////////// Layers after strips /////////////////
668// honeycomb (Polyethilene) Layer after (1.2cm)
669
670 Float_t overSpace = fOverSpc;//cm
671
672 par[0] = xFLT*0.5;
673 par[1] = 0.6;
674 par[2] = (zFLTA *0.5);
675 ycoor = -yFLT/2 + overSpace + par[1];
676 gMC->Gsvolu("FPEA", "BOX ", idtmed[503], par, 3); // Hony
677 gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
678 par[2] = (zFLTB *0.5);
679 gMC->Gsvolu("FPEB", "BOX ", idtmed[503], par, 3); // Hony
680 gMC->Gspos ("FPEB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
681 par[2] = (zFLTC *0.5);
682 gMC->Gsvolu("FPEC", "BOX ", idtmed[503], par, 3); // Hony
683 gMC->Gspos ("FPEC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
684
685// Electronics (Cu) after
686 ycoor += par[1];
687 par[0] = xFLT*0.5;
688 par[1] = 1.43*0.05*0.5; // 5% of X0
689 par[2] = (zFLTA *0.5);
690 ycoor += par[1];
691 gMC->Gsvolu("FECA", "BOX ", idtmed[501], par, 3); // Cu
692 gMC->Gspos ("FECA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
693 par[2] = (zFLTB *0.5);
694 gMC->Gsvolu("FECB", "BOX ", idtmed[501], par, 3); // Cu
695 gMC->Gspos ("FECB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
696 par[2] = (zFLTC *0.5);
697 gMC->Gsvolu("FECC", "BOX ", idtmed[501], par, 3); // Cu
698 gMC->Gspos ("FECC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
699
700// cooling WAter after
701 ycoor += par[1];
702 par[0] = xFLT*0.5;
703 par[1] = 36.1*0.02*0.5; // 2% of X0
704 par[2] = (zFLTA *0.5);
705 ycoor += par[1];
706 gMC->Gsvolu("FWAA", "BOX ", idtmed[515], par, 3); // Water
707 gMC->Gspos ("FWAA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
708 par[2] = (zFLTB *0.5);
709 gMC->Gsvolu("FWAB", "BOX ", idtmed[515], par, 3); // Water
710 gMC->Gspos ("FWAB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
711 par[2] = (zFLTC *0.5);
712 gMC->Gsvolu("FWAC", "BOX ", idtmed[515], par, 3); // Water
713 gMC->Gspos ("FWAC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
714
715// frame of Air
716 ycoor += par[1];
717 par[0] = xFLT*0.5;
718 par[1] = (yFLT/2-ycoor-0.2)*0.5; // Aluminum layer considered (0.2 cm)
719 par[2] = (zFLTA *0.5);
720 ycoor += par[1];
721 gMC->Gsvolu("FAIA", "BOX ", idtmed[500], par, 3); // Air
722 gMC->Gspos ("FAIA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
723 par[2] = (zFLTB *0.5);
724 gMC->Gsvolu("FAIB", "BOX ", idtmed[500], par, 3); // Air
725 gMC->Gspos ("FAIB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
726 par[2] = (zFLTC *0.5);
727 gMC->Gsvolu("FAIC", "BOX ", idtmed[500], par, 3); // Air
728 gMC->Gspos ("FAIC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
729/* fp
730//Back Plate honycomb (2cm)
731 par[0] = -1;
732 par[1] = 2 *0.5;
733 par[2] = -1;
734 ycoor = yFLT/2 - par[1];
735 gMC->Gsvolu("FBPA", "BOX ", idtmed[503], par, 3); // Hony
736 gMC->Gspos ("FBPA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
737 gMC->Gsvolu("FBPB", "BOX ", idtmed[503], par, 3); // Hony
738 gMC->Gspos ("FBPB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
739 gMC->Gsvolu("FBPC", "BOX ", idtmed[503], par, 3); // Hony
740 gMC->Gspos ("FBPC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
741fp */
742}
743
744//_____________________________________________________________________________
745void AliTOFv3::DrawModule() const
746{
747 //
748 // Draw a shaded view of the Time Of Flight version 1
749 //
750 // Set everything unseen
751 gMC->Gsatt("*", "seen", -1);
752 //
753 // Set ALIC mother transparent
754 gMC->Gsatt("ALIC","SEEN",0);
755 //
756 // Set the volumes visible
757 gMC->Gsatt("ALIC","SEEN",0);
758
759 gMC->Gsatt("FTOA","SEEN",1);
760 gMC->Gsatt("FTOB","SEEN",1);
761 gMC->Gsatt("FTOC","SEEN",1);
762 gMC->Gsatt("FLTA","SEEN",1);
763 gMC->Gsatt("FLTB","SEEN",1);
764 gMC->Gsatt("FLTC","SEEN",1);
765 gMC->Gsatt("FPLA","SEEN",1);
766 gMC->Gsatt("FPLB","SEEN",1);
767 gMC->Gsatt("FPLC","SEEN",1);
768 gMC->Gsatt("FSTR","SEEN",1);
769 gMC->Gsatt("FPEA","SEEN",1);
770 gMC->Gsatt("FPEB","SEEN",1);
771 gMC->Gsatt("FPEC","SEEN",1);
772
773 gMC->Gsatt("FLZ1","SEEN",0);
774 gMC->Gsatt("FLZ2","SEEN",0);
775 gMC->Gsatt("FLZ3","SEEN",0);
776 gMC->Gsatt("FLX1","SEEN",0);
777 gMC->Gsatt("FLX2","SEEN",0);
778 gMC->Gsatt("FLX3","SEEN",0);
779 gMC->Gsatt("FPAD","SEEN",0);
780
781 gMC->Gdopt("hide", "on");
782 gMC->Gdopt("shad", "on");
783 gMC->Gsatt("*", "fill", 7);
784 gMC->SetClipBox(".");
785 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
786 gMC->DefaultRange();
787 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
788 gMC->Gdhead(1111, "Time Of Flight");
789 gMC->Gdman(18, 4, "MAN");
790 gMC->Gdopt("hide","off");
791}
792
793//_____________________________________________________________________________
794void AliTOFv3::CreateMaterials()
795{
796 //
797 // Define materials for the Time Of Flight
798 //
799 AliTOF::CreateMaterials();
800}
801
802//_____________________________________________________________________________
803void AliTOFv3::Init()
804{
805 //
806 // Initialise the detector after the geometry has been defined
807 //
808 if(fDebug) {
809 printf("%s: **************************************"
810 " TOF "
811 "**************************************\n",ClassName());
812 printf("\n%s Version 3 of TOF initialing, "
813 "TOF with holes for RICH detector\n",ClassName());
814 }
815
816 AliTOF::Init();
817
818 fIdFTOA = gMC->VolId("FTOA");
819 fIdFTOB = gMC->VolId("FTOB");
820 fIdFTOC = gMC->VolId("FTOC");
821 fIdFLTA = gMC->VolId("FLTA");
822 fIdFLTB = gMC->VolId("FLTB");
823 fIdFLTC = gMC->VolId("FLTC");
824
825 if(fDebug) {
826 printf("%s: **************************************"
827 " TOF "
828 "**************************************\n",ClassName());
829 }
830}
831
832//_____________________________________________________________________________
833void AliTOFv3::StepManager()
834{
835 //
836 // Procedure called at each step in the Time Of Flight
837 //
838 TLorentzVector mom, pos;
839 Float_t xm[3],pm[3],xpad[3],ppad[3];
840 Float_t hits[13],phi,phid,z;
841 Int_t vol[5];
842 Int_t sector, plate, padx, padz, strip;
843 Int_t copy, padzid, padxid, stripid, i;
844 Int_t *idtmed = fIdtmed->GetArray()-499;
845 Float_t incidenceAngle;
846
847 if(gMC->GetMedium()==idtmed[513] &&
848 gMC->IsTrackEntering() && gMC->TrackCharge()
849 && gMC->CurrentVolID(copy)==fIdSens)
850 {
851 // getting information about hit volumes
852
853 padzid=gMC->CurrentVolOffID(2,copy);
854 padz=copy;
855
856 padxid=gMC->CurrentVolOffID(1,copy);
857 padx=copy;
858
859 stripid=gMC->CurrentVolOffID(4,copy);
860 strip=copy;
861
862 gMC->TrackPosition(pos);
863 gMC->TrackMomentum(mom);
864
865// Double_t NormPos=1./pos.Rho();
866 Double_t normMom=1./mom.Rho();
867
868// getting the cohordinates in pad ref system
869 xm[0] = (Float_t)pos.X();
870 xm[1] = (Float_t)pos.Y();
871 xm[2] = (Float_t)pos.Z();
872
873 pm[0] = (Float_t)mom.X()*normMom;
874 pm[1] = (Float_t)mom.Y()*normMom;
875 pm[2] = (Float_t)mom.Z()*normMom;
876
877 gMC->Gmtod(xm,xpad,1);
878 gMC->Gmtod(pm,ppad,2);
879
880 incidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
881
882 z = pos[2];
883
884 plate = 0;
885 if (TMath::Abs(z) <= fZlenA*0.5) plate = 3;
886 if (z < (fZlenA*0.5+fZlenB) &&
887 z > fZlenA*0.5) plate = 4;
888 if (z >-(fZlenA*0.5+fZlenB) &&
889 z < -fZlenA*0.5) plate = 2;
890 if (z > (fZlenA*0.5+fZlenB)) plate = 5;
891 if (z <-(fZlenA*0.5+fZlenB)) plate = 1;
892
893 phi = pos.Phi();
894 phid = phi*kRaddeg+180.;
895 sector = Int_t (phid/20.);
896 sector++;
897
898 for(i=0;i<3;++i) {
899 hits[i] = pos[i];
900 hits[i+3] = pm[i];
901 }
902
903 hits[6] = mom.Rho();
904 hits[7] = pos[3];
905 hits[8] = xpad[0];
906 hits[9] = xpad[1];
907 hits[10]= xpad[2];
908 hits[11]= incidenceAngle;
909 hits[12]= gMC->Edep();
910
911 vol[0]= sector;
912 vol[1]= plate;
913 vol[2]= strip;
914 vol[3]= padx;
915 vol[4]= padz;
916
917 AddHit(gAlice->CurrentTrack(),vol, hits);
918 }
919}