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