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