]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TOF/AliTOFv2.cxx
Bug fix (selection of RawReaderDate from Yuri was not correct)
[u/mrichter/AliRoot.git] / TOF / AliTOFv2.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/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// This class contains the functions for version 2 of the Time Of Flight //
21// detector. //
22// //
23// VERSION WITH 5 MODULES AND TILTED STRIPS //
24// //
25// HOLES FOR PHOS AND HMPID DETECTOR //
26// //
27// Authors: //
28// //
29// Alessio Seganti //
30// Domenico Vicinanza //
31// //
32// University of Salerno - Italy //
33// //
34// Fabrizio Pierella //
35// University of Bologna - Italy //
36// //
37// //
38//Begin_Html //
39/* //
40<img src="picts/AliTOFv2Class.gif"> //
41*/ //
42//End_Html //
43// //
44///////////////////////////////////////////////////////////////////////////////
45
46#include <Riostream.h>
47#include <stdlib.h>
48
49#include <TBRIK.h>
50#include <TGeometry.h>
51#include <TLorentzVector.h>
52#include <TNode.h>
53#include <TObject.h>
54#include <TVirtualMC.h>
55
56#include "AliConst.h"
57#include "AliMagF.h"
58#include "AliRun.h"
59#include "AliTOFv2.h"
60#include "AliTOFConstants.h" // AdC
61#include "AliMC.h"
62
63ClassImp(AliTOFv2)
64
65//_____________________________________________________________________________
66AliTOFv2::AliTOFv2()
67{
68 //
69 // Default constructor
70 //
71}
72
73//_____________________________________________________________________________
74AliTOFv2::AliTOFv2(const char *name, const char *title)
75 : AliTOF(name,title)
76{
77 //
78 // Standard constructor
79 //
80 //
81 // Check that FRAME is there otherwise we have no place where to
82 // put TOF
83 AliModule* frame=gAlice->GetModule("FRAME");
84 if(!frame) {
85 Error("Ctor","TOF needs FRAME to be present\n");
86 exit(1);
87 } else
88 if(frame->IsVersion()!=1) {
89 Error("Ctor","FRAME version 1 needed with this version of TOF\n");
90 exit(1);
91 }
92
93}
94
95//____________________________________________________________________________
96
97void AliTOFv2::BuildGeometry()
98{
99 //
100 // Build TOF ROOT geometry for the ALICE event display
101 //
102 TNode *node, *top;
103 const int kColorTOF = 27;
104
105 // Find top TNODE
106 top = gAlice->GetGeometry()->GetNode("alice");
107
108 // Position the different copies
109 const Float_t krTof =(fRmax+fRmin)/2;
110 const Float_t khTof = fRmax-fRmin;
111 const Int_t kNTof = fNTof;
112 const Float_t kPi = TMath::Pi();
113 const Float_t kangle = 2*kPi/kNTof;
114 Float_t ang;
115
116 // define offset for nodes
117 Float_t zOffsetC = fZtof - fZlenC*0.5;
118 Float_t zOffsetB = fZtof - fZlenC - fZlenB*0.5;
119 Float_t zOffsetA = 0.;
120 // Define TOF basic volume
121
122 char nodeName0[6], nodeName1[6], nodeName2[6];
123 char nodeName3[6], nodeName4[6], rotMatNum[6];
124
125 new TBRIK("S_TOF_C","TOF box","void",
126 fStripLn*0.5,khTof*0.5,fZlenC*0.5);
127 new TBRIK("S_TOF_B","TOF box","void",
128 fStripLn*0.5,khTof*0.5,fZlenB*0.5);
129 new TBRIK("S_TOF_A","TOF box","void",
130 fStripLn*0.5,khTof*0.5,fZlenA*0.5);
131
132 for (Int_t nodeNum=1;nodeNum<19;nodeNum++){
133
134 if (nodeNum<10) {
135 sprintf(rotMatNum,"rot50%i",nodeNum);
136 sprintf(nodeName0,"FTO00%i",nodeNum);
137 sprintf(nodeName1,"FTO10%i",nodeNum);
138 sprintf(nodeName2,"FTO20%i",nodeNum);
139 sprintf(nodeName3,"FTO30%i",nodeNum);
140 sprintf(nodeName4,"FTO40%i",nodeNum);
141 }
142 if (nodeNum>9) {
143 sprintf(rotMatNum,"rot5%i",nodeNum);
144 sprintf(nodeName0,"FTO0%i",nodeNum);
145 sprintf(nodeName1,"FTO1%i",nodeNum);
146 sprintf(nodeName2,"FTO2%i",nodeNum);
147 sprintf(nodeName3,"FTO3%i",nodeNum);
148 sprintf(nodeName4,"FTO4%i",nodeNum);
149 }
150
151 new TRotMatrix(rotMatNum,rotMatNum,90,-20*nodeNum,90,90-20*nodeNum,0,0);
152 ang = (4.5-nodeNum) * kangle;
153
154 top->cd();
155 node = new TNode(nodeName0,nodeName0,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetC,rotMatNum);
156 node->SetLineColor(kColorTOF);
157 fNodes->Add(node);
158
159 top->cd();
160 node = new TNode(nodeName1,nodeName1,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetC,rotMatNum);
161 node->SetLineColor(kColorTOF);
162 fNodes->Add(node);
163 if (nodeNum !=1 && nodeNum!=17 && nodeNum !=18)
164 {
165 top->cd();
166 node = new TNode(nodeName2,nodeName2,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetB,rotMatNum);
167 node->SetLineColor(kColorTOF);
168 fNodes->Add(node);
169
170 top->cd();
171 node = new TNode(nodeName3,nodeName3,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
172 node->SetLineColor(kColorTOF);
173 fNodes->Add(node);
174 } // Holes for HMPID detector
175
176 if ((nodeNum<7 || nodeNum>11) && nodeNum !=1 && nodeNum!=17 && nodeNum !=18)
177 {
178 top->cd();
179 node = new TNode(nodeName4,nodeName4,"S_TOF_A",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetA,rotMatNum);
180 node->SetLineColor(kColorTOF);
181 fNodes->Add(node);
182 } // Holes for PHOS detector (+ Holes for HMPID detector, central part)
183 } // end loop on nodeNum
184}
185
186
187//_____________________________________________________________________________
188void AliTOFv2::CreateGeometry()
189{
190 //
191 // Create geometry for Time Of Flight version 0
192 //
193 //Begin_Html
194 /*
195 <img src="picts/AliTOFv2.gif">
196 */
197 //End_Html
198 //
199 // Creates common geometry
200 //
201 AliTOF::CreateGeometry();
202}
203
204//_____________________________________________________________________________
205void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
206 Float_t zlenB, Float_t zlenA, Float_t ztof0)
207{
208 //
209 // Definition of the Time Of Fligh Resistive Plate Chambers
210 // xFLT, yFLT, zFLT - sizes of TOF modules (large)
211
212 Float_t ycoor, zcoor;
213 Float_t par[3];
214 Int_t *idtmed = fIdtmed->GetArray()-499;
215 Int_t idrotm[100];
216 Int_t nrot = 0;
217 Float_t hTof = fRmax-fRmin;
218
219 Float_t radius = fRmin+2.;//cm
220
221 par[0] = xtof * 0.5;
222 par[1] = ytof * 0.5;
223 par[2] = zlenC * 0.5;
224 gMC->Gsvolu("FTOC", "BOX ", idtmed[506], par, 3);
225 par[2] = zlenB * 0.5;
226 gMC->Gsvolu("FTOB", "BOX ", idtmed[506], par, 3);
227 par[2] = zlenA * 0.5;
228 gMC->Gsvolu("FTOA", "BOX ", idtmed[506], par, 3);
229
230
231 // Positioning of modules
232
233 Float_t zcor1 = ztof0 - zlenC*0.5;
234 Float_t zcor2 = ztof0 - zlenC - zlenB*0.5;
235 Float_t zcor3 = 0.;
236
237 AliMatrix(idrotm[0], 90., 0., 0., 0., 90,-90.);
238 AliMatrix(idrotm[1], 90.,180., 0., 0., 90, 90.);
239 gMC->Gspos("FTOC", 1, "BTO1", 0, zcor1, 0, idrotm[0], "ONLY");
240 gMC->Gspos("FTOC", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
241 gMC->Gspos("FTOC", 1, "BTO2", 0, zcor1, 0, idrotm[0], "ONLY");
242 gMC->Gspos("FTOC", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
243 gMC->Gspos("FTOC", 1, "BTO3", 0, zcor1, 0, idrotm[0], "ONLY");
244 gMC->Gspos("FTOC", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
245
246 gMC->Gspos("FTOB", 1, "BTO1", 0, zcor2, 0, idrotm[0], "ONLY");
247 gMC->Gspos("FTOB", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
248 gMC->Gspos("FTOB", 1, "BTO2", 0, zcor2, 0, idrotm[0], "ONLY");
249 gMC->Gspos("FTOB", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
250
251 gMC->Gspos("FTOA", 0, "BTO1", 0, zcor3, 0, idrotm[0], "ONLY");
252
253 Float_t db = 0.5;//cm
254 Float_t xFLT, xFST, yFLT, zFLTA, zFLTB, zFLTC;
255
256 xFLT = fStripLn;
257 yFLT = ytof;
258 zFLTA = zlenA;
259 zFLTB = zlenB;
260 zFLTC = zlenC;
261
262 xFST = xFLT-fDeadBndX*2;//cm
263
264// Sizes of MRPC pads
265
266 Float_t yPad = 0.505;//cm
267
268// Large not sensitive volumes with Insensitive Freon
269 par[0] = xFLT*0.5;
270 par[1] = yFLT*0.5;
271
272 if(fDebug)
273 cout <<ClassName()
274 <<": ************************* TOF geometry **************************"
275 <<endl;
276
277 par[2] = (zFLTA *0.5);
278 gMC->Gsvolu("FLTA", "BOX ", idtmed[512], par, 3); // Insensitive Freon
279 gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY");
280
281 par[2] = (zFLTB * 0.5);
282 gMC->Gsvolu("FLTB", "BOX ", idtmed[512], par, 3); // Insensitive Freon
283 gMC->Gspos ("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY");
284
285 par[2] = (zFLTC * 0.5);
286 gMC->Gsvolu("FLTC", "BOX ", idtmed[512], par, 3); // Insensitive Freon
287 gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY");
288
289 ///// Layers of Aluminum before and after detector /////
290 ///// Aluminum Box for Modules (1.8 mm thickness) /////
291 ///// lateral walls not simulated for the time being
292 //const Float_t khAlWall = 0.18;
293 // fp to be checked
294 const Float_t khAlWall = 0.11;
295 par[0] = xFLT*0.5;
296 par[1] = khAlWall/2.;//cm
297 ycoor = -yFLT/2 + par[1];
298 par[2] = (zFLTA *0.5);
299 gMC->Gsvolu("FALA", "BOX ", idtmed[508], par, 3); // Alluminium
300 gMC->Gspos ("FALA", 1, "FLTA", 0., ycoor, 0., 0, "ONLY");
301 gMC->Gspos ("FALA", 2, "FLTA", 0.,-ycoor, 0., 0, "ONLY");
302 par[2] = (zFLTB *0.5);
303 gMC->Gsvolu("FALB", "BOX ", idtmed[508], par, 3); // Alluminium
304 gMC->Gspos ("FALB", 1, "FLTB", 0., ycoor, 0., 0, "ONLY");
305 gMC->Gspos ("FALB", 2, "FLTB", 0.,-ycoor, 0., 0, "ONLY");
306 par[2] = (zFLTC *0.5);
307 gMC->Gsvolu("FALC", "BOX ", idtmed[508], par, 3); // Alluminium
308 gMC->Gspos ("FALC", 1, "FLTC", 0., ycoor, 0., 0, "ONLY");
309 gMC->Gspos ("FALC", 2, "FLTC", 0.,-ycoor, 0., 0, "ONLY");
310
311 ///////////////// Detector itself //////////////////////
312
313 const Float_t kdeadBound = fDeadBndZ; //cm non-sensitive between the pad edge
314 //and the boundary of the strip
315 const Int_t knx = fNpadX; // number of pads along x
316 const Int_t knz = fNpadZ; // number of pads along z
317 const Float_t kspace = fSpace; //cm distance from the front plate of the box
318
319 Float_t zSenStrip = fZpad*fNpadZ;//cm
320 Float_t stripWidth = zSenStrip + 2*kdeadBound;
321
322 par[0] = xFLT*0.5;
323 par[1] = yPad*0.5;
324 par[2] = stripWidth*0.5;
325
326 // new description for strip volume -double stack strip-
327 // -- all constants are expressed in cm
328 // heigth of different layers
329 const Float_t khhony = 0.8 ; // heigth of HONY Layer
330 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
331 const Float_t khmyly = 0.035 ; // heigth of MYLAR Layer
332 const Float_t khgraphy = 0.02 ; // heigth of GRAPHITE Layer
333 const Float_t khglasseiy = 0.135; // 0.6 Ext. Glass + 1.1 i.e. (Int. Glass/2) (mm)
334 const Float_t khsensmy = 0.11 ; // heigth of Sensitive Freon Mixture
335 const Float_t kwsensmz = 2*3.5 ; // cm
336 const Float_t klsensmx = 48*2.5; // cm
337 const Float_t kwpadz = 3.5; // cm z dimension of the FPAD volume
338 const Float_t klpadx = 2.5; // cm x dimension of the FPAD volume
339
340 // heigth of the FSTR Volume (the strip volume)
341 const Float_t khstripy = 2*khhony+3*khpcby+4*(khmyly+khgraphy+khglasseiy)+2*khsensmy;
342 // width of the FSTR Volume (the strip volume)
343 const Float_t kwstripz = 10.;
344 // length of the FSTR Volume (the strip volume)
345 const Float_t klstripx = 122.;
346
347 Float_t parfp[3]={klstripx*0.5,khstripy*0.5,kwstripz*0.5};
348 // coordinates of the strip center in the strip reference frame; used for positioning
349 // internal strip volumes
350 Float_t posfp[3]={0.,0.,0.};
351
352
353 // FSTR volume definition and filling this volume with non sensitive Gas Mixture
354 gMC->Gsvolu("FSTR","BOX",idtmed[512],parfp,3);
355 //-- HONY Layer definition
356 // parfp[0] = -1;
357 parfp[1] = khhony*0.5;
358 // parfp[2] = -1;
359 gMC->Gsvolu("FHON","BOX",idtmed[503],parfp,3);
360 // positioning 2 HONY Layers on FSTR volume
361
362 posfp[1]=-khstripy*0.5+parfp[1];
363 gMC->Gspos("FHON",1,"FSTR",0., posfp[1],0.,0,"ONLY");
364 gMC->Gspos("FHON",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
365
366 //-- PCB Layer definition
367 parfp[1] = khpcby*0.5;
368 gMC->Gsvolu("FPCB","BOX",idtmed[504],parfp,3);
369 // positioning 2 PCB Layers on FSTR volume
370 posfp[1]=-khstripy*0.5+khhony+parfp[1];
371 gMC->Gspos("FPCB",1,"FSTR",0., posfp[1],0.,0,"ONLY");
372 gMC->Gspos("FPCB",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
373 // positioning the central PCB layer
374 gMC->Gspos("FPCB",3,"FSTR",0.,0.,0.,0,"ONLY");
375
376
377
378 //-- MYLAR Layer definition
379 parfp[1] = khmyly*0.5;
380 gMC->Gsvolu("FMYL","BOX",idtmed[511],parfp,3);
381 // positioning 2 MYLAR Layers on FSTR volume
382 posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1];
383 gMC->Gspos("FMYL",1,"FSTR",0., posfp[1],0.,0,"ONLY");
384 gMC->Gspos("FMYL",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
385 // adding further 2 MYLAR Layers on FSTR volume
386 posfp[1] = khpcby*0.5+parfp[1];
387 gMC->Gspos("FMYL",3,"FSTR",0., posfp[1],0.,0,"ONLY");
388 gMC->Gspos("FMYL",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
389
390
391 //-- Graphite Layer definition
392 parfp[1] = khgraphy*0.5;
393 gMC->Gsvolu("FGRP","BOX",idtmed[502],parfp,3);
394 // positioning 2 Graphite Layers on FSTR volume
395 posfp[1] = -khstripy*0.5+khhony+khpcby+khmyly+parfp[1];
396 gMC->Gspos("FGRP",1,"FSTR",0., posfp[1],0.,0,"ONLY");
397 gMC->Gspos("FGRP",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
398 // adding further 2 Graphite Layers on FSTR volume
399 posfp[1] = khpcby*0.5+khmyly+parfp[1];
400 gMC->Gspos("FGRP",3,"FSTR",0., posfp[1],0.,0,"ONLY");
401 gMC->Gspos("FGRP",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
402
403
404 //-- Glass (EXT. +Semi INT.) Layer definition
405 parfp[1] = khglasseiy*0.5;
406 gMC->Gsvolu("FGLA","BOX",idtmed[514],parfp,3);
407 // positioning 2 Glass Layers on FSTR volume
408 posfp[1] = -khstripy*0.5+khhony+khpcby+khmyly+khgraphy+parfp[1];
409 gMC->Gspos("FGLA",1,"FSTR",0., posfp[1],0.,0,"ONLY");
410 gMC->Gspos("FGLA",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
411 // adding further 2 Glass Layers on FSTR volume
412 posfp[1] = khpcby*0.5+khmyly+khgraphy+parfp[1];
413 gMC->Gspos("FGLA",3,"FSTR",0., posfp[1],0.,0,"ONLY");
414 gMC->Gspos("FGLA",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
415
416
417 //-- Sensitive Mixture Layer definition
418 parfp[0] = klsensmx*0.5;
419 parfp[1] = khsensmy*0.5;
420 parfp[2] = kwsensmz*0.5;
421 gMC->Gsvolu("FSEN","BOX",idtmed[513],parfp,3);
422 gMC->Gsvolu("FNSE","BOX",idtmed[512],parfp,3);
423 // positioning 2 gas Layers on FSTR volume
424 // the upper is insensitive freon
425 // while the remaining is sensitive
426 posfp[1] = khpcby*0.5+khmyly+khgraphy+khglasseiy+parfp[1];
427 gMC->Gspos("FNSE",0,"FSTR", 0., posfp[1],0.,0,"ONLY");
428 gMC->Gspos("FSEN",0,"FSTR", 0.,-posfp[1],0.,0,"ONLY");
429
430 // dividing FSEN along z in knz=2 and along x in knx=48
431 gMC->Gsdvn("FSEZ","FSEN",knz,3);
432 gMC->Gsdvn("FSEX","FSEZ",knx,1);
433
434 // FPAD volume definition
435 parfp[0] = klpadx*0.5;
436 parfp[1] = khsensmy*0.5;
437 parfp[2] = kwpadz*0.5;
438 gMC->Gsvolu("FPAD","BOX",idtmed[513],parfp,3);
439 // positioning the FPAD volumes on previous divisions
440 gMC->Gspos("FPAD",0,"FSEX",0.,0.,0.,0,"ONLY");
441
442 //// Positioning the Strips (FSTR) in the FLT volumes /////
443
444 // Plate A (Central)
445
446 Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
447
448 Float_t gap = fGapA+0.5; //cm updated distance between the strip axis
449 Float_t zpos = 0;
450 Float_t ang = 0;
451 Int_t j=1; // AdC
452 nrot = 0;
453 zcoor = 0;
454 ycoor = -14.5 + kspace ; //2 cm over front plate
455
456 AliMatrix (idrotm[0], 90., 0.,90.,90.,0., 90.);
457
458 Int_t centerLoc= (Int_t)(fNStripA/2.) + 1; // AdC
459
460 //gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
461
462 if(fDebug) {
463 printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
464 printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
465 }
466
467 zcoor -= zSenStrip;
468 //j++; // AdC
469 Int_t upDown = -1; // upDown=-1 -> Upper strip
470 // upDown=+1 -> Lower strip
471 do{
472 ang = atan(zcoor/radius);
473 ang *= kRaddeg;
474 AliMatrix (idrotm[nrot], 90., 0.,90.-ang,90.,-ang, 90.);
475 AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
476 ang /= kRaddeg;
477 ycoor = -14.5+ kspace; //2 cm over front plate
478 ycoor += (1-(upDown+1)/2)*gap;
479 //gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY");
480 //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
481 gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY"); // AdC
482 gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
483
484 if(fDebug>=1) {
485 printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
486 printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
487 }
488
489 j++; //j += 2; // AdC
490 upDown*= -1; // Alternate strips
491 zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
492 upDown*gap*TMath::Tan(ang)-
493 (zSenStrip/2)/TMath::Cos(ang);
494 } while (zcoor-(stripWidth/2)*TMath::Cos(ang)>-t+zFLTC+zFLTB+db*2);
495
496 zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)+
497 upDown*gap*TMath::Tan(ang)+
498 (zSenStrip/2)/TMath::Cos(ang);
499
500 gap = fGapB;
501 zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
502 upDown*gap*TMath::Tan(ang)-
503 (zSenStrip/2)/TMath::Cos(ang);
504
505 ang = atan(zcoor/radius);
506 ang *= kRaddeg;
507 AliMatrix (idrotm[nrot], 90., 0.,90.-ang,90.,-ang, 90.);
508 AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
509 ang /= kRaddeg;
510
511 ycoor = -14.5+ kspace; //2 cm over front plate
512 ycoor += (1-(upDown+1)/2)*gap;
513 //gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY");
514 //gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
515 gMC->Gspos("FSTR",centerLoc-j,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY"); // AdC
516 gMC->Gspos("FSTR",centerLoc+j,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY"); // AdC
517 if(fDebug>=1) {
518 printf("%s: %f, St. %2i, Pl.3 ",ClassName(),ang*kRaddeg,j); // AdC
519 printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
520 }
521
522 ycoor = -hTof/2.+ kspace;//2 cm over front plate
523
524 // Plate B
525
526 nrot = 0;
527 Int_t i=1; // AdC
528 upDown = 1;
529 Float_t deadRegion = 1.0;//cm
530
531 zpos = zcoor - (zSenStrip/2)/TMath::Cos(ang)-
532 upDown*gap*TMath::Tan(ang)-
533 (zSenStrip/2)/TMath::Cos(ang)-
534 deadRegion/TMath::Cos(ang);
535
536 ang = atan(zpos/radius);
537 ang *= kRaddeg;
538 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
539 ang /= kRaddeg;
540 ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
541 ycoor += (1-(upDown+1)/2)*gap;
542 zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
543 gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
544
545 if(fDebug>=1) {
546 printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
547 printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
548 }
549
550 i++;
551 upDown*=-1;
552
553 do {
554 zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)-
555 upDown*gap*TMath::Tan(ang)-
556 (zSenStrip/2)/TMath::Cos(ang);
557 ang = atan(zpos/radius);
558 ang *= kRaddeg;
559 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
560 ang /= kRaddeg;
561 Float_t deltaSpaceinB=-0.5; // [cm] to avoid overlaps with the end of freon frame
562 Float_t deltaGapinB=0.5; // [cm] to avoid overlaps in between initial strips
563 ycoor = -hTof*0.5+ kspace+deltaSpaceinB ; //2 cm over front plate
564 ycoor += (1-(upDown+1)/2)*(gap+deltaGapinB);
565 zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
566 gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
567
568 if(fDebug>=1) {
569 printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
570 printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
571 }
572
573 upDown*=-1;
574 i++;
575 } while (TMath::Abs(ang*kRaddeg)<22.5);
576 //till we reach a tilting angle of 22.5 degrees
577
578 ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
579 zpos = zpos - zSenStrip/TMath::Cos(ang);
580 // this avoid overlaps in between outer strips in plate B
581 Float_t deltaMovingUp=0.8; // [cm]
582 Float_t deltaMovingDown=-0.5; // [cm]
583
584 do {
585 ang = atan(zpos/radius);
586 ang *= kRaddeg;
587 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
588 ang /= kRaddeg;
589 zcoor = zpos+(zFLTB/2+zFLTA/2+db);
590 gMC->Gspos("FSTR",i, "FLTB", 0., ycoor+deltaMovingDown+deltaMovingUp, zcoor,idrotm[nrot], "ONLY");
591 deltaMovingUp+=0.8; // update delta moving toward the end of the plate
592 zpos = zpos - zSenStrip/TMath::Cos(ang);
593 if(fDebug>=1) {
594 printf("%s: %f, St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
595 printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
596 }
597 i++;
598
599 } while (zpos-stripWidth*0.5/TMath::Cos(ang)>-t+zFLTC+db);
600
601 // Plate C
602
603 zpos = zpos + zSenStrip/TMath::Cos(ang);
604
605 zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)+
606 gap*TMath::Tan(ang)-
607 (zSenStrip/2)/TMath::Cos(ang);
608
609 nrot = 0;
610 i=0;
611 Float_t deltaGap=-2.5; // [cm] update distance from strip center and plate
612 ycoor= -hTof*0.5+kspace+gap+deltaGap;
613
614 do {
615 i++;
616 ang = atan(zpos/radius);
617 ang *= kRaddeg;
618 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
619 ang /= kRaddeg;
620 zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
621 gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
622
623 if(fDebug>=1) {
624 printf("%s: %f, St. %2i, Pl.5 ",ClassName(),ang*kRaddeg,i);
625 printf("%s: y = %f, z = %f, zpos = %f \n",ClassName(),ycoor,zcoor,zpos);
626 }
627
628 zpos = zpos - zSenStrip/TMath::Cos(ang);
629 } while (zpos-stripWidth*TMath::Cos(ang)*0.5>-t);
630
631
632 ////////// Layers after strips /////////////////
633 // Al Layer thickness (2.3mm) factor 0.7
634
635 Float_t overSpace = fOverSpc;//cm
636
637 par[0] = xFLT*0.5;
638 par[1] = 0.115*0.7; // factor 0.7
639 par[2] = (zFLTA *0.5);
640 ycoor = -yFLT/2 + overSpace + par[1];
641 gMC->Gsvolu("FPEA", "BOX ", idtmed[508], par, 3); // Al
642 gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
643 par[2] = (zFLTB *0.5);
644 gMC->Gsvolu("FPEB", "BOX ", idtmed[508], par, 3); // Al
645 gMC->Gspos ("FPEB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
646 par[2] = (zFLTC *0.5);
647 gMC->Gsvolu("FPEC", "BOX ", idtmed[508], par, 3); // Al
648 gMC->Gspos ("FPEC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
649
650
651 // plexiglass thickness: 1.5 mm ; factor 0.3
652 ycoor += par[1];
653 par[0] = xFLT*0.5;
654 par[1] = 0.075*0.3; // factor 0.3
655 par[2] = (zFLTA *0.5);
656 ycoor += par[1];
657 gMC->Gsvolu("FECA", "BOX ", idtmed[505], par, 3); // Plexigl.
658 gMC->Gspos ("FECA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
659 par[2] = (zFLTB *0.5);
660 gMC->Gsvolu("FECB", "BOX ", idtmed[505], par, 3); // Plexigl.
661 gMC->Gspos ("FECB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
662 par[2] = (zFLTC *0.5);
663 gMC->Gsvolu("FECC", "BOX ", idtmed[505], par, 3); // Plexigl.
664 gMC->Gspos ("FECC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
665
666 // frame of Air
667 ycoor += par[1];
668 par[0] = xFLT*0.5;
669 par[1] = (yFLT/2-ycoor-khAlWall)*0.5; // Aluminum layer considered (0.18 cm)
670 par[2] = (zFLTA *0.5);
671 ycoor += par[1];
672 gMC->Gsvolu("FAIA", "BOX ", idtmed[500], par, 3); // Air
673 gMC->Gspos ("FAIA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
674 par[2] = (zFLTB *0.5);
675 gMC->Gsvolu("FAIB", "BOX ", idtmed[500], par, 3); // Air
676 gMC->Gspos ("FAIB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
677 par[2] = (zFLTC *0.5);
678 gMC->Gsvolu("FAIC", "BOX ", idtmed[500], par, 3); // Air
679 gMC->Gspos ("FAIC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
680
681
682 // start with cards and cooling tubes
683 // finally, cards, cooling tubes and layer for thermal dispersion
684 // 3 volumes
685 // card volume definition
686
687 // see GEOM200 in GEANT manual
688 AliMatrix(idrotm[98], 90., 0., 90., 90., 0., 0.); // 0 deg
689
690 Float_t cardpar[3];
691 cardpar[0]= 61.;
692 cardpar[1]= 5.;
693 cardpar[2]= 0.1;
694 gMC->Gsvolu("FCAR", "BOX ", idtmed[504], cardpar, 3); // PCB Card
695 //alu plate volume definition
696 cardpar[1]= 3.5;
697 cardpar[2]= 0.05;
698 gMC->Gsvolu("FALP", "BOX ", idtmed[508], cardpar, 3); // Alu Plate
699
700
701 // central module positioning (FAIA)
702 Float_t cardpos[3], aplpos2, stepforcardA=6.625;
703 cardpos[0]= 0.;
704 cardpos[1]= -0.5;
705 cardpos[2]= -53.;
706 Float_t aplpos1 = -2.;
707 Int_t icard;
708 for (icard=0; icard<15; ++icard) {
709 cardpos[2]= cardpos[2]+stepforcardA;
710 aplpos2 = cardpos[2]+0.15;
711 gMC->Gspos("FCAR",icard,"FAIA",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
712 gMC->Gspos("FALP",icard,"FAIA",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
713
714 }
715
716
717 // intermediate module positioning (FAIB)
718 Float_t stepforcardB= 7.05;
719 cardpos[2]= -70.5;
720 for (icard=0; icard<19; ++icard) {
721 cardpos[2]= cardpos[2]+stepforcardB;
722 aplpos2 = cardpos[2]+0.15;
723 gMC->Gspos("FCAR",icard,"FAIB",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
724 gMC->Gspos("FALP",icard,"FAIB",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
725 }
726
727
728 // outer module positioning (FAIC)
729 Float_t stepforcardC= 8.45238;
730 cardpos[2]= -88.75;
731 for (icard=0; icard<20; ++icard) {
732 cardpos[2]= cardpos[2]+stepforcardC;
733 aplpos2 = cardpos[2]+0.15;
734 gMC->Gspos("FCAR",icard,"FAIC",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
735 gMC->Gspos("FALP",icard,"FAIC",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
736 }
737
738 // tube volume definition
739 Float_t tubepar[3];
740 tubepar[0]= 0.;
741 tubepar[1]= 0.4;
742 tubepar[2]= 61.;
743 gMC->Gsvolu("FTUB", "TUBE", idtmed[516], tubepar, 3); // cooling tubes (steel)
744 tubepar[0]= 0.;
745 tubepar[1]= 0.35;
746 tubepar[2]= 61.;
747 gMC->Gsvolu("FITU", "TUBE", idtmed[515], tubepar, 3); // cooling water
748 // positioning water tube into the steel one
749 gMC->Gspos("FITU",1,"FTUB",0.,0.,0.,0,"ONLY");
750
751
752 // rotation matrix
753 AliMatrix(idrotm[99], 180., 90., 90., 90., 90., 0.);
754 // central module positioning (FAIA)
755 Float_t tubepos[3], tdis=0.6;
756 tubepos[0]= 0.;
757 tubepos[1]= cardpos[1];
758 tubepos[2]= -53.+tdis;
759 // tub1pos = 5.;
760 Int_t itub;
761 for (itub=0; itub<15; ++itub) {
762 tubepos[2]= tubepos[2]+stepforcardA;
763 gMC->Gspos("FTUB",itub,"FAIA",tubepos[0],tubepos[1],tubepos[2],idrotm[99],
764 "ONLY");
765 }
766
767
768 // intermediate module positioning (FAIB)
769 tubepos[2]= -70.5+tdis;
770 for (itub=0; itub<19; ++itub) {
771 tubepos[2]= tubepos[2]+stepforcardB;
772 gMC->Gspos("FTUB",itub,"FAIB",tubepos[0],tubepos[1],tubepos[2],idrotm[99],
773 "ONLY");
774 }
775
776 // outer module positioning (FAIC)
777 tubepos[2]= -88.75+tdis;
778 for (itub=0; itub<20; ++itub) {
779 tubepos[2]= tubepos[2]+stepforcardC;
780 gMC->Gspos("FTUB",itub,"FAIC",tubepos[0],tubepos[1],tubepos[2],idrotm[99],
781 "ONLY");
782 }
783
784}
785
786//_____________________________________________________________________________
787void AliTOFv2::DrawModule() const
788{
789 //
790 // Draw a shaded view of the Time Of Flight version 2
791 //
792 // Set everything unseen
793 gMC->Gsatt("*", "seen", -1);
794 //
795 // Set ALIC mother transparent
796 gMC->Gsatt("ALIC","SEEN",0);
797 //
798 // Set the volumes visible
799 gMC->Gsatt("ALIC","SEEN",0);
800
801 gMC->Gsatt("FTOA","SEEN",1);
802 gMC->Gsatt("FTOB","SEEN",1);
803 gMC->Gsatt("FTOC","SEEN",1);
804 gMC->Gsatt("FLTA","SEEN",1);
805 gMC->Gsatt("FLTB","SEEN",1);
806 gMC->Gsatt("FLTC","SEEN",1);
807 gMC->Gsatt("FPLA","SEEN",1);
808 gMC->Gsatt("FPLB","SEEN",1);
809 gMC->Gsatt("FPLC","SEEN",1);
810 gMC->Gsatt("FSTR","SEEN",1);
811 gMC->Gsatt("FPEA","SEEN",1);
812 gMC->Gsatt("FPEB","SEEN",1);
813 gMC->Gsatt("FPEC","SEEN",1);
814
815 gMC->Gsatt("FLZ1","SEEN",0);
816 gMC->Gsatt("FLZ2","SEEN",0);
817 gMC->Gsatt("FLZ3","SEEN",0);
818 gMC->Gsatt("FLX1","SEEN",0);
819 gMC->Gsatt("FLX2","SEEN",0);
820 gMC->Gsatt("FLX3","SEEN",0);
821 gMC->Gsatt("FPAD","SEEN",0);
822
823 gMC->Gdopt("hide", "on");
824 gMC->Gdopt("shad", "on");
825 gMC->Gsatt("*", "fill", 7);
826 gMC->SetClipBox(".");
827 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
828 gMC->DefaultRange();
829 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
830 gMC->Gdhead(1111, "Time Of Flight");
831 gMC->Gdman(18, 4, "MAN");
832 gMC->Gdopt("hide","off");
833}
834//_____________________________________________________________________________
835void AliTOFv2::DrawDetectorModules()
836{
837//
838// Draw a shaded view of the TOF detector version 2
839//
840
841//Set ALIC mother transparent
842 gMC->Gsatt("ALIC","SEEN",0);
843
844//
845//Set volumes visible
846//
847//=====> Level 1
848 // Level 1 for TOF volumes
849 gMC->Gsatt("B077","seen",0);
850
851
852//==========> Level 2
853 // Level 2
854 gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
855 gMC->Gsatt("B071","seen",0);
856 gMC->Gsatt("B074","seen",0);
857 gMC->Gsatt("B075","seen",0);
858 gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
859
860
861 // Level 2 of B071
862 gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped -
863 gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped -
864 gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped -
865 gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped -
866 gMC->Gsatt("B056","seen",0); // B056 does not has sub-levels -
867 gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped -
868 gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped -
869 gMC->Gsatt("BTR1","seen",0); // BTR1 do not have sub-levels -
870 gMC->Gsatt("BTO1","seen",0);
871
872
873 // Level 2 of B074
874 gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
875 gMC->Gsatt("BTO2","seen",0);
876
877 // Level 2 of B075
878 gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
879 gMC->Gsatt("BTO3","seen",0);
880
881// ==================> Level 3
882 // Level 3 of B071 / Level 2 of BTO1
883 gMC->Gsatt("FTOC","seen",-2);
884 gMC->Gsatt("FTOB","seen",-2);
885 gMC->Gsatt("FTOA","seen",-2);
886
887 // Level 3 of B074 / Level 2 of BTO2
888 // -> cfr previous settings
889
890 // Level 3 of B075 / Level 2 of BTO3
891 // -> cfr previous settings
892
893 gMC->Gdopt("hide","on");
894 gMC->Gdopt("shad","on");
895 gMC->Gsatt("*", "fill", 5);
896 gMC->SetClipBox(".");
897 gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
898 gMC->DefaultRange();
899 gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
900 gMC->Gdhead(1111,"TOF detector V1");
901 gMC->Gdman(18, 4, "MAN");
902 gMC->Gdopt("hide","off");
903}
904
905//_____________________________________________________________________________
906void AliTOFv2::DrawDetectorStrips()
907{
908//
909// Draw a shaded view of the TOF strips for version 2
910//
911
912//Set ALIC mother transparent
913 gMC->Gsatt("ALIC","SEEN",0);
914
915//
916//Set volumes visible
917//=====> Level 1
918 // Level 1 for TOF volumes
919 gMC->Gsatt("B077","seen",0);
920
921//==========> Level 2
922 // Level 2
923 gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
924 gMC->Gsatt("B071","seen",0);
925 gMC->Gsatt("B074","seen",0);
926 gMC->Gsatt("B075","seen",0);
927 gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
928
929 // Level 2 of B071
930 gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped -
931 gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped -
932 gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped -
933 gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped -
934 gMC->Gsatt("B056","seen",0); // B056 does not has sub-levels -
935 gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped -
936 gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped -
937 gMC->Gsatt("BTR1","seen",0); // BTR1 do not have sub-levels -
938 gMC->Gsatt("BTO1","seen",0);
939
940// ==================> Level 3
941 // Level 3 of B071 / Level 2 of BTO1
942 gMC->Gsatt("FTOC","seen",0);
943 gMC->Gsatt("FTOB","seen",0);
944 gMC->Gsatt("FTOA","seen",0);
945
946 // Level 3 of B074 / Level 2 of BTO2
947 // -> cfr previous settings
948
949 // Level 3 of B075 / Level 2 of BTO3
950 // -> cfr previous settings
951
952
953// ==========================> Level 4
954 // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOC
955 gMC->Gsatt("FLTC","seen",0);
956 // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOB
957 gMC->Gsatt("FLTB","seen",0);
958 // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOA
959 gMC->Gsatt("FLTA","seen",0);
960
961 // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOC
962 // -> cfr previous settings
963 // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOB
964 // -> cfr previous settings
965
966 // Level 4 of B075 / Level 3 of BTO3 / Level 2 of FTOC
967 // -> cfr previous settings
968
969//======================================> Level 5
970 // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOC / Level 2 of FLTC
971 gMC->Gsatt("FALC","seen",0); // no children for FALC
972 gMC->Gsatt("FSTR","seen",-2);
973 gMC->Gsatt("FPEC","seen",0); // no children for FPEC
974 gMC->Gsatt("FECC","seen",0); // no children for FECC
975 gMC->Gsatt("FWAC","seen",0); // no children for FWAC
976 gMC->Gsatt("FAIC","seen",0); // no children for FAIC
977
978 // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOB / Level 2 of FLTB
979 gMC->Gsatt("FALB","seen",0); // no children for FALB
980//--> gMC->Gsatt("FSTR","seen",-2);
981
982
983 // -> cfr previous settings
984 gMC->Gsatt("FPEB","seen",0); // no children for FPEB
985 gMC->Gsatt("FECB","seen",0); // no children for FECB
986 gMC->Gsatt("FWAB","seen",0); // no children for FWAB
987 gMC->Gsatt("FAIB","seen",0); // no children for FAIB
988
989 // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOA / Level 2 of FLTA
990 gMC->Gsatt("FALA","seen",0); // no children for FALB
991//--> gMC->Gsatt("FSTR","seen",-2);
992 // -> cfr previous settings
993 gMC->Gsatt("FPEA","seen",0); // no children for FPEA
994 gMC->Gsatt("FECA","seen",0); // no children for FECA
995 gMC->Gsatt("FWAA","seen",0); // no children for FWAA
996 gMC->Gsatt("FAIA","seen",0); // no children for FAIA
997
998 // Level 2 of B074
999 gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
1000 gMC->Gsatt("BTO2","seen",0);
1001
1002 // Level 2 of B075
1003 gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
1004 gMC->Gsatt("BTO3","seen",0);
1005
1006// for others Level 5, cfr. previous settings
1007
1008 gMC->Gdopt("hide","on");
1009 gMC->Gdopt("shad","on");
1010 gMC->Gsatt("*", "fill", 5);
1011 gMC->SetClipBox(".");
1012 gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
1013 gMC->DefaultRange();
1014 gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
1015 gMC->Gdhead(1111,"TOF Strips V1");
1016 gMC->Gdman(18, 4, "MAN");
1017 gMC->Gdopt("hide","off");
1018}
1019
1020//_____________________________________________________________________________
1021void AliTOFv2::CreateMaterials()
1022{
1023 //
1024 // Define materials for the Time Of Flight
1025 //
1026 AliTOF::CreateMaterials();
1027}
1028
1029//_____________________________________________________________________________
1030void AliTOFv2::Init()
1031{
1032 //
1033 // Initialise the detector after the geometry has been defined
1034 //
1035 if(fDebug) {
1036 printf("%s: **************************************"
1037 " TOF "
1038 "**************************************\n",ClassName());
1039 printf("\n%s: Version 2 of TOF initialing, "
1040 "TOF with holes for PHOS and HMPID \n",ClassName());
1041 }
1042
1043 AliTOF::Init();
1044
1045 fIdFTOA = gMC->VolId("FTOA");
1046 fIdFTOB = gMC->VolId("FTOB");
1047 fIdFTOC = gMC->VolId("FTOC");
1048 fIdFLTA = gMC->VolId("FLTA");
1049 fIdFLTB = gMC->VolId("FLTB");
1050 fIdFLTC = gMC->VolId("FLTC");
1051
1052 if(fDebug) {
1053 printf("%s: **************************************"
1054 " TOF "
1055 "**************************************\n",ClassName());
1056 }
1057}
1058
1059//_____________________________________________________________________________
1060void AliTOFv2::StepManager()
1061{
1062 //
1063 // Procedure called at each step in the Time Of Flight
1064 //
1065 TLorentzVector mom, pos;
1066 Float_t xm[3],pm[3],xpad[3],ppad[3];
1067 Float_t hits[13],phi,phid,z;
1068 Int_t vol[5];
1069 Int_t sector, plate, padx, padz, strip;
1070 Int_t copy, padzid, padxid, stripid, i;
1071 Int_t *idtmed = fIdtmed->GetArray()-499;
1072 Float_t incidenceAngle;
1073
1074 if(gMC->CurrentMedium()==idtmed[513] &&
1075 gMC->IsTrackEntering() && gMC->TrackCharge()
1076 && gMC->CurrentVolID(copy)==fIdSens)
1077 {
1078 // getting information about hit volumes
1079
1080 padzid=gMC->CurrentVolOffID(2,copy);
1081 padz=copy;
1082
1083 padxid=gMC->CurrentVolOffID(1,copy);
1084 padx=copy;
1085
1086 stripid=gMC->CurrentVolOffID(4,copy);
1087 strip=copy;
1088
1089 gMC->TrackPosition(pos);
1090 gMC->TrackMomentum(mom);
1091
1092// Double_t NormPos=1./pos.Rho();
1093 Double_t normMom=1./mom.Rho();
1094
1095// getting the cohordinates in pad ref system
1096 xm[0] = (Float_t)pos.X();
1097 xm[1] = (Float_t)pos.Y();
1098 xm[2] = (Float_t)pos.Z();
1099
1100 pm[0] = (Float_t)mom.X()*normMom;
1101 pm[1] = (Float_t)mom.Y()*normMom;
1102 pm[2] = (Float_t)mom.Z()*normMom;
1103
1104 gMC->Gmtod(xm,xpad,1);
1105 gMC->Gmtod(pm,ppad,2);
1106
1107 if (ppad[1] > 1.) ppad[1]=1;
1108 if (ppad[1] < -1.) ppad[1]=-1;
1109 incidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
1110
1111 z = pos[2];
1112
1113 plate = 0;
1114 if (TMath::Abs(z) <= fZlenA*0.5) plate = 2; //3; // AdC
1115 if (z < (fZlenA*0.5+fZlenB) &&
1116 z > fZlenA*0.5) plate = 1; //4; // AdC
1117 if (z >-(fZlenA*0.5+fZlenB) &&
1118 z < -fZlenA*0.5) plate = 3; //2; // AdC
1119 if (z > (fZlenA*0.5+fZlenB)) plate = 0; //5;
1120 if (z <-(fZlenA*0.5+fZlenB)) plate = 4; //1; // AdC
1121
1122 if (plate==0) strip=AliTOFConstants::fgkNStripC-strip; // AdC
1123 else if (plate==1) strip=AliTOFConstants::fgkNStripB-strip; // AdC
1124 else strip--; // AdC
1125
1126 if (z<=0.) padx=AliTOFConstants::fgkNpadX-padx; // AdC
1127 else padx--; // AdC
1128
1129 if (plate==3 || plate==4) padz=AliTOFConstants::fgkNpadZ-padz; // AdC
1130 else padz--; // AdC
1131
1132 phi = pos.Phi();
1133 if (phi>=0.) phid = phi*kRaddeg; //+180.; // AdC
1134 else phid = phi*kRaddeg + 360.; //+180.; // AdC
1135 sector = Int_t (phid/20.);
1136 //sector++; // AdC
1137
1138 for(i=0;i<3;++i) {
1139 hits[i] = pos[i];
1140 hits[i+3] = pm[i];
1141 }
1142
1143 hits[6] = mom.Rho();
1144 hits[7] = pos[3];
1145 hits[8] = xpad[0];
1146 hits[9] = xpad[1];
1147 hits[10]= xpad[2];
1148 hits[11]= incidenceAngle;
1149 hits[12]= gMC->Edep();
1150
1151 vol[0]= sector;
1152 vol[1]= plate;
1153 vol[2]= strip;
1154 vol[3]= padx;
1155 vol[4]= padz;
1156
1157 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
1158 }
1159}