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