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