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