]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFv4T0.cxx
Coding conventions
[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 }
74ea065c 96 fTOFGeometry->SetHoles(fTOFHoles);
0f4a7374 97}
d599d913 98
0f4a7374 99//____________________________________________________________________________
d599d913 100void AliTOFv4T0::BuildGeometry()
101{
102 //
103 // Build TOF ROOT geometry for the ALICE event display
104 //
105 TNode *node, *top;
106 const int kColorTOF = 27;
9e9add11 107
d599d913 108 // Find top TNODE
109 top = gAlice->GetGeometry()->GetNode("alice");
9e9add11 110
d599d913 111 // Position the different copies
112 const Float_t krTof =(fRmax+fRmin)/2;
113 const Float_t khTof = fRmax-fRmin;
114 const Int_t kNTof = fNTof;
115 const Float_t kPi = TMath::Pi();
116 const Float_t kangle = 2*kPi/kNTof;
117 Float_t ang;
9e9add11 118
119 // define offset for nodes
120 Float_t zOffsetC = fZtof - fZlenC*0.5;
121 Float_t zOffsetB = fZtof - fZlenC - fZlenB*0.5;
122 Float_t zOffsetA = 0.;
d599d913 123 // Define TOF basic volume
124
da3d3acd 125 char nodeName0[7], nodeName1[7], nodeName2[7];
d599d913 126 char nodeName3[7], nodeName4[7], rotMatNum[7];
9e9add11 127
d599d913 128 new TBRIK("S_TOF_C","TOF box","void",
9e9add11 129 fStripLn*0.5,khTof*0.5,fZlenC*0.5);
d599d913 130 new TBRIK("S_TOF_B","TOF box","void",
9e9add11 131 fStripLn*0.5,khTof*0.5,fZlenB*0.5);
d599d913 132 new TBRIK("S_TOF_A","TOF box","void",
9e9add11 133 fStripLn*0.5,khTof*0.5,fZlenA*0.5);
134
d599d913 135 for (Int_t nodeNum=1;nodeNum<19;nodeNum++){
9e9add11 136
137 if (nodeNum<10) {
138 sprintf(rotMatNum,"rot50%i",nodeNum);
139 sprintf(nodeName0,"FTO00%i",nodeNum);
140 sprintf(nodeName1,"FTO10%i",nodeNum);
141 sprintf(nodeName2,"FTO20%i",nodeNum);
142 sprintf(nodeName3,"FTO30%i",nodeNum);
143 sprintf(nodeName4,"FTO40%i",nodeNum);
144 }
145 if (nodeNum>9) {
146 sprintf(rotMatNum,"rot5%i",nodeNum);
147 sprintf(nodeName0,"FTO0%i",nodeNum);
148 sprintf(nodeName1,"FTO1%i",nodeNum);
149 sprintf(nodeName2,"FTO2%i",nodeNum);
150 sprintf(nodeName3,"FTO3%i",nodeNum);
151 sprintf(nodeName4,"FTO4%i",nodeNum);
152 }
153
154 new TRotMatrix(rotMatNum,rotMatNum,90,-20*nodeNum,90,90-20*nodeNum,0,0);
155 ang = (4.5-nodeNum) * kangle;
156
157 top->cd();
158 node = new TNode(nodeName0,nodeName0,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetC,rotMatNum);
159 node->SetLineColor(kColorTOF);
da3d3acd 160 fNodes->Add(node);
9e9add11 161
da3d3acd 162 top->cd();
9e9add11 163 node = new TNode(nodeName1,nodeName1,"S_TOF_C",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetC,rotMatNum);
164 node->SetLineColor(kColorTOF);
da3d3acd 165 fNodes->Add(node);
9e9add11 166
167 top->cd();
168 node = new TNode(nodeName2,nodeName2,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetB,rotMatNum);
169 node->SetLineColor(kColorTOF);
da3d3acd 170 fNodes->Add(node);
9e9add11 171
172 top->cd();
173 node = new TNode(nodeName3,nodeName3,"S_TOF_B",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),-zOffsetB,rotMatNum);
174 node->SetLineColor(kColorTOF);
da3d3acd 175 fNodes->Add(node);
9e9add11 176
177 top->cd();
178 node = new TNode(nodeName4,nodeName4,"S_TOF_A",krTof*TMath::Cos(ang),krTof*TMath::Sin(ang),zOffsetA,rotMatNum);
179 node->SetLineColor(kColorTOF);
da3d3acd 180 fNodes->Add(node);
d599d913 181 } // end loop on nodeNum
182}
183
184
185
186//_____________________________________________________________________________
187void AliTOFv4T0::CreateGeometry()
188{
189 //
190 // Create geometry for Time Of Flight version 0
191 //
192 //Begin_Html
193 /*
194 <img src="picts/AliTOFv4T0.gif">
195 */
196 //End_Html
197 //
198 // Creates common geometry
199 //
200 AliTOF::CreateGeometry();
201}
202
0f4a7374 203
d599d913 204//_____________________________________________________________________________
205void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
206 Float_t zlenB, Float_t zlenA, Float_t ztof0)
207{
208 //
209 // Definition of the Time Of Fligh Resistive Plate Chambers
210 // xFLT, yFLT, zFLT - sizes of TOF modules (large)
211
0f4a7374 212 Float_t ycoor;
d599d913 213 Float_t par[3];
214 Int_t *idtmed = fIdtmed->GetArray()-499;
215 Int_t idrotm[100];
216 Int_t nrot = 0;
0f4a7374 217
d599d913 218 Float_t radius = fRmin+2.;//cm
0f4a7374 219
43808676 220
d599d913 221 par[0] = xtof * 0.5;
222 par[1] = ytof * 0.5;
223 par[2] = zlenC * 0.5;
224 gMC->Gsvolu("FTOC", "BOX ", idtmed[506], par, 3);
225 par[2] = zlenB * 0.5;
226 gMC->Gsvolu("FTOB", "BOX ", idtmed[506], par, 3);
227 par[2] = zlenA * 0.5;
228 gMC->Gsvolu("FTOA", "BOX ", idtmed[506], par, 3);
43808676 229
230
231 // Positioning of modules
232
233 Float_t zcor1 = ztof0 - zlenC*0.5;
234 Float_t zcor2 = ztof0 - zlenC - zlenB*0.5;
235 Float_t zcor3 = 0.;
236
237 AliMatrix(idrotm[0], 90., 0., 0., 0., 90,-90.);
238 AliMatrix(idrotm[1], 90.,180., 0., 0., 90, 90.);
0f4a7374 239
43808676 240 gMC->Gspos("FTOC", 1, "BTO1", 0, zcor1, 0, idrotm[0], "ONLY");
241 gMC->Gspos("FTOC", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
242 gMC->Gspos("FTOC", 1, "BTO2", 0, zcor1, 0, idrotm[0], "ONLY");
243 gMC->Gspos("FTOC", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
244 gMC->Gspos("FTOC", 1, "BTO3", 0, zcor1, 0, idrotm[0], "ONLY");
245 gMC->Gspos("FTOC", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
246
247 gMC->Gspos("FTOB", 1, "BTO1", 0, zcor2, 0, idrotm[0], "ONLY");
248 gMC->Gspos("FTOB", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
249 gMC->Gspos("FTOB", 1, "BTO2", 0, zcor2, 0, idrotm[0], "ONLY");
250 gMC->Gspos("FTOB", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
251 gMC->Gspos("FTOB", 1, "BTO3", 0, zcor2, 0, idrotm[0], "ONLY");
252 gMC->Gspos("FTOB", 2, "BTO3", 0, -zcor2, 0, idrotm[1], "ONLY");
253
254 gMC->Gspos("FTOA", 0, "BTO1", 0, zcor3, 0, idrotm[0], "ONLY");
0f4a7374 255 if(!fTOFHoles)gMC->Gspos("FTOA", 0, "BTO2", 0, zcor3, 0, idrotm[0], "ONLY");
43808676 256 gMC->Gspos("FTOA", 0, "BTO3", 0, zcor3, 0, idrotm[0], "ONLY");
257
0f4a7374 258
d599d913 259 Float_t db = 0.5;//cm
260 Float_t xFLT, xFST, yFLT, zFLTA, zFLTB, zFLTC;
43808676 261
d599d913 262 xFLT = fStripLn;
263 yFLT = ytof;
264 zFLTA = zlenA;
265 zFLTB = zlenB;
266 zFLTC = zlenC;
43808676 267
d599d913 268 xFST = xFLT-fDeadBndX*2;//cm
43808676 269
270 // Sizes of MRPC pads
271
d599d913 272 Float_t yPad = 0.505;//cm
273
43808676 274 // Large not sensitive volumes with Insensitive Freon
d599d913 275 par[0] = xFLT*0.5;
276 par[1] = yFLT*0.5;
277
278 if (fDebug) cout << ClassName() <<
43808676 279 ": ************************* TOF geometry **************************"<<endl;
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;
43808676 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
d599d913 317 const Float_t kdeadBound = fDeadBndZ; //cm non-sensitive between the pad edge
43808676 318 //and the boundary of the strip
d599d913 319 const Int_t knx = fNpadX; // number of pads along x
320 const Int_t knz = fNpadZ; // number of pads along z
43808676 321
d599d913 322 Float_t zSenStrip = fZpad*fNpadZ;//cm
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
43808676 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};
0f4a7374 351 // Coordinates of the strip center in the strip reference frame;
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);
463 gMC->Gspos("FSTR",fNStripA-istrip,"FLTA",0.,ypos, zpos,idrotm[0], "ONLY");
61e4c9ba 464 if(fDebug>=1) {
0f4a7374 465 printf("y = %f, z = %f, , z coord = %f, Rot ang = %f, St. %2i \n",ypos,zpos,tan(ang)*radius ,ang*kRaddeg,istrip);
43808676 466 }
da3d3acd 467 }
0f4a7374 468
469
470 ///////////////////Positioning B module//////////////////////////
471
472 for(Int_t istrip =0; istrip < fTOFGeometry->NStripB(); istrip++){
473
474 Float_t ang = fTOFGeometry->GetAngles(3,istrip);
475 AliMatrix (idrotm[0],90.,0.,90.-ang,90.,-ang, 90.);
43808676 476 ang /= kRaddeg;
0f4a7374 477 Float_t zpos = tan(ang)*radius+(zFLTA*0.5+zFLTB*0.5+db);
478 Float_t ypos= fTOFGeometry->GetHeights(3,istrip);
479 gMC->Gspos("FSTR",istrip+1,"FLTB",0.,ypos, zpos,idrotm[nrot], "ONLY");
61e4c9ba 480 if(fDebug>=1) {
0f4a7374 481 printf("y = %f, z = %f, , z coord = %f, Rot ang = %f, St. %2i \n",ypos,zpos,tan(ang)*radius,ang*kRaddeg,istrip);
43808676 482 }
0f4a7374 483 }
484
43808676 485
0f4a7374 486 ///////////////////Positioning C module//////////////////////////
487
488 for(Int_t istrip =0; istrip < fTOFGeometry->NStripC(); istrip++){
489
490 Float_t ang = fTOFGeometry->GetAngles(4,istrip);
491 AliMatrix (idrotm[0],90.,0.,90.-ang,90.,-ang, 90.);
43808676 492 ang /= kRaddeg;
0f4a7374 493 Float_t zpos = tan(ang)*radius+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
494 Float_t ypos= fTOFGeometry->GetHeights(4,istrip);
495 gMC->Gspos("FSTR",istrip+1,"FLTC",0.,ypos, zpos,idrotm[nrot], "ONLY");
61e4c9ba 496 if(fDebug>=1) {
0f4a7374 497 printf("y = %f, z = %f, z coord = %f, Rot ang = %f, St. %2i \n",ypos,zpos,tan(ang)*radius,ang*kRaddeg,istrip);
498 }
499 }
500
43808676 501 ////////// Layers after strips /////////////////
502 // Al Layer thickness (2.3mm) factor 0.7
503
d599d913 504 Float_t overSpace = fOverSpc;//cm
43808676 505
d599d913 506 par[0] = xFLT*0.5;
43808676 507 par[1] = 0.115*0.7; // factor 0.7
d599d913 508 par[2] = (zFLTA *0.5);
509 ycoor = -yFLT/2 + overSpace + par[1];
43808676 510 gMC->Gsvolu("FPEA", "BOX ", idtmed[508], par, 3); // Al
d599d913 511 gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
512 par[2] = (zFLTB *0.5);
43808676 513 gMC->Gsvolu("FPEB", "BOX ", idtmed[508], par, 3); // Al
d599d913 514 gMC->Gspos ("FPEB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
515 par[2] = (zFLTC *0.5);
43808676 516 gMC->Gsvolu("FPEC", "BOX ", idtmed[508], par, 3); // Al
d599d913 517 gMC->Gspos ("FPEC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
43808676 518
519
520 // plexiglass thickness: 1.5 mm ; factor 0.3
0f4a7374 521
d599d913 522 ycoor += par[1];
523 par[0] = xFLT*0.5;
43808676 524 par[1] = 0.075*0.3; // factor 0.3
d599d913 525 par[2] = (zFLTA *0.5);
526 ycoor += par[1];
43808676 527 gMC->Gsvolu("FECA", "BOX ", idtmed[505], par, 3); // Plexigl.
d599d913 528 gMC->Gspos ("FECA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
529 par[2] = (zFLTB *0.5);
43808676 530 gMC->Gsvolu("FECB", "BOX ", idtmed[505], par, 3); // Plexigl.
d599d913 531 gMC->Gspos ("FECB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
532 par[2] = (zFLTC *0.5);
43808676 533 gMC->Gsvolu("FECC", "BOX ", idtmed[505], par, 3); // Plexigl.
d599d913 534 gMC->Gspos ("FECC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
43808676 535
536 // frame of Air
0f4a7374 537
d599d913 538 ycoor += par[1];
539 par[0] = xFLT*0.5;
43808676 540 par[1] = (yFLT/2-ycoor-khAlWall)*0.5; // Aluminum layer considered (0.18 cm)
d599d913 541 par[2] = (zFLTA *0.5);
542 ycoor += par[1];
543 gMC->Gsvolu("FAIA", "BOX ", idtmed[500], par, 3); // Air
544 gMC->Gspos ("FAIA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
545 par[2] = (zFLTB *0.5);
546 gMC->Gsvolu("FAIB", "BOX ", idtmed[500], par, 3); // Air
547 gMC->Gspos ("FAIB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
548 par[2] = (zFLTC *0.5);
549 gMC->Gsvolu("FAIC", "BOX ", idtmed[500], par, 3); // Air
550 gMC->Gspos ("FAIC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
43808676 551
552
553 // start with cards and cooling tubes
554 // finally, cards, cooling tubes and layer for thermal dispersion
555 // 3 volumes
556 // card volume definition
557
558 // see GEOM200 in GEANT manual
0f4a7374 559
560
43808676 561 AliMatrix(idrotm[98], 90., 0., 90., 90., 0., 0.); // 0 deg
562
563 Float_t cardpar[3];
564 cardpar[0]= 61.;
565 cardpar[1]= 5.;
566 cardpar[2]= 0.1;
567 gMC->Gsvolu("FCAR", "BOX ", idtmed[504], cardpar, 3); // PCB Card
568 //alu plate volume definition
569 cardpar[1]= 3.5;
570 cardpar[2]= 0.05;
571 gMC->Gsvolu("FALP", "BOX ", idtmed[508], cardpar, 3); // Alu Plate
572
573
574 // central module positioning (FAIA)
575 Float_t cardpos[3], aplpos2, stepforcardA=6.625;
576 cardpos[0]= 0.;
577 cardpos[1]= -0.5;
578 cardpos[2]= -53.;
579 Float_t aplpos1 = -2.;
580 Int_t icard;
0f4a7374 581 for (icard=0; icard < fTOFGeometry->NStripA(); ++icard) {
43808676 582 cardpos[2]= cardpos[2]+stepforcardA;
583 aplpos2 = cardpos[2]+0.15;
da3d3acd 584 gMC->Gspos("FCAR",icard,"FAIA",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
43808676 585 gMC->Gspos("FALP",icard,"FAIA",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
586
587 }
588
589
590 // intermediate module positioning (FAIB)
591 Float_t stepforcardB= 7.05;
592 cardpos[2]= -70.5;
0f4a7374 593 for (icard=0; icard < fTOFGeometry->NStripB(); ++icard) {
43808676 594 cardpos[2]= cardpos[2]+stepforcardB;
da3d3acd 595 aplpos2 = cardpos[2]+0.15;
596 gMC->Gspos("FCAR",icard,"FAIB",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
597 gMC->Gspos("FALP",icard,"FAIB",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
43808676 598 }
599
600
601 // outer module positioning (FAIC)
602 Float_t stepforcardC= 8.45238;
603 cardpos[2]= -88.75;
0f4a7374 604 for (icard=0; icard < fTOFGeometry->NStripC(); ++icard) {
43808676 605 cardpos[2]= cardpos[2]+stepforcardC;
606 aplpos2 = cardpos[2]+0.15;
da3d3acd 607 gMC->Gspos("FCAR",icard,"FAIC",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
43808676 608 gMC->Gspos("FALP",icard,"FAIC",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
609 }
610
611 // tube volume definition
0f4a7374 612
43808676 613 Float_t tubepar[3];
614 tubepar[0]= 0.;
615 tubepar[1]= 0.4;
616 tubepar[2]= 61.;
617 gMC->Gsvolu("FTUB", "TUBE", idtmed[516], tubepar, 3); // cooling tubes (steel)
618 tubepar[0]= 0.;
619 tubepar[1]= 0.35;
620 tubepar[2]= 61.;
621 gMC->Gsvolu("FITU", "TUBE", idtmed[515], tubepar, 3); // cooling water
622 // positioning water tube into the steel one
623 gMC->Gspos("FITU",1,"FTUB",0.,0.,0.,0,"ONLY");
624
625
626 // rotation matrix
627 AliMatrix(idrotm[99], 180., 90., 90., 90., 90., 0.);
628 // central module positioning (FAIA)
629 Float_t tubepos[3], tdis=0.6;
630 tubepos[0]= 0.;
631 tubepos[1]= cardpos[1];
632 tubepos[2]= -53.+tdis;
633 // tub1pos = 5.;
634 Int_t itub;
0f4a7374 635 for (itub=0; itub < fTOFGeometry->NStripA(); ++itub) {
43808676 636 tubepos[2]= tubepos[2]+stepforcardA;
637 gMC->Gspos("FTUB",itub,"FAIA",tubepos[0],tubepos[1],tubepos[2],idrotm[99],
638 "ONLY");
639 }
640
641
642 // intermediate module positioning (FAIB)
643 tubepos[2]= -70.5+tdis;
0f4a7374 644 for (itub=0; itub < fTOFGeometry->NStripB(); ++itub) {
43808676 645 tubepos[2]= tubepos[2]+stepforcardB;
646 gMC->Gspos("FTUB",itub,"FAIB",tubepos[0],tubepos[1],tubepos[2],idrotm[99],
647 "ONLY");
648 }
649
650 // outer module positioning (FAIC)
651 tubepos[2]= -88.75+tdis;
0f4a7374 652 for (itub=0; itub < fTOFGeometry->NStripC(); ++itub) {
43808676 653 tubepos[2]= tubepos[2]+stepforcardC;
654 gMC->Gspos("FTUB",itub,"FAIC",tubepos[0],tubepos[1],tubepos[2],idrotm[99],
655 "ONLY");
656 }
657
d599d913 658}
d599d913 659//_____________________________________________________________________________
660void AliTOFv4T0::DrawModule() const
661{
662 //
663 // Draw a shaded view of the Time Of Flight version 4
664 //
665 // Set everything unseen
666 gMC->Gsatt("*", "seen", -1);
667 //
668 // Set ALIC mother transparent
669 gMC->Gsatt("ALIC","SEEN",0);
670 //
671 // Set the volumes visible
672 gMC->Gsatt("ALIC","SEEN",0);
673
674 gMC->Gsatt("FTOA","SEEN",1);
675 gMC->Gsatt("FTOB","SEEN",1);
676 gMC->Gsatt("FTOC","SEEN",1);
677 gMC->Gsatt("FLTA","SEEN",1);
678 gMC->Gsatt("FLTB","SEEN",1);
679 gMC->Gsatt("FLTC","SEEN",1);
680 gMC->Gsatt("FPLA","SEEN",1);
681 gMC->Gsatt("FPLB","SEEN",1);
682 gMC->Gsatt("FPLC","SEEN",1);
683 gMC->Gsatt("FSTR","SEEN",1);
684 gMC->Gsatt("FPEA","SEEN",1);
685 gMC->Gsatt("FPEB","SEEN",1);
686 gMC->Gsatt("FPEC","SEEN",1);
687
688 gMC->Gsatt("FLZ1","SEEN",0);
689 gMC->Gsatt("FLZ2","SEEN",0);
690 gMC->Gsatt("FLZ3","SEEN",0);
691 gMC->Gsatt("FLX1","SEEN",0);
692 gMC->Gsatt("FLX2","SEEN",0);
693 gMC->Gsatt("FLX3","SEEN",0);
694 gMC->Gsatt("FPAD","SEEN",0);
695
696 gMC->Gdopt("hide", "on");
697 gMC->Gdopt("shad", "on");
698 gMC->Gsatt("*", "fill", 7);
699 gMC->SetClipBox(".");
700 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
701 gMC->DefaultRange();
702 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
703 gMC->Gdhead(1111, "Time Of Flight");
704 gMC->Gdman(18, 4, "MAN");
705 gMC->Gdopt("hide","off");
706}
707//_____________________________________________________________________________
708void AliTOFv4T0::DrawDetectorModules()
709{
710//
711// Draw a shaded view of the TOF detector version 4
712//
713
88cb7938 714
715//Set ALIC mother transparent
4c475d27 716 gMC->Gsatt("ALIC","SEEN",0);
d599d913 717
718//
719//Set volumes visible
720//
721//=====> Level 1
722 // Level 1 for TOF volumes
723 gMC->Gsatt("B077","seen",0);
724
725
726//==========> Level 2
727 // Level 2
728 gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
729 gMC->Gsatt("B071","seen",0);
730 gMC->Gsatt("B074","seen",0);
731 gMC->Gsatt("B075","seen",0);
732 gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
733
734
735 // Level 2 of B071
736 gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped -
737 gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped -
738 gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped -
739 gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped -
740 gMC->Gsatt("B056","seen",0); // B056 does not has sub-levels -
741 gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped -
742 gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped -
743 gMC->Gsatt("BTR1","seen",0); // BTR1 do not have sub-levels -
744 gMC->Gsatt("BTO1","seen",0);
745
746
747 // Level 2 of B074
748 gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
749 gMC->Gsatt("BTO2","seen",0);
750
751 // Level 2 of B075
752 gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
753 gMC->Gsatt("BTO3","seen",0);
754
755// ==================> Level 3
756 // Level 3 of B071 / Level 2 of BTO1
757 gMC->Gsatt("FTOC","seen",-2);
758 gMC->Gsatt("FTOB","seen",-2);
759 gMC->Gsatt("FTOA","seen",-2);
760
761 // Level 3 of B074 / Level 2 of BTO2
762 // -> cfr previous settings
763
764 // Level 3 of B075 / Level 2 of BTO3
765 // -> cfr previous settings
766
767 gMC->Gdopt("hide","on");
768 gMC->Gdopt("shad","on");
769 gMC->Gsatt("*", "fill", 5);
770 gMC->SetClipBox(".");
771 gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
772 gMC->DefaultRange();
773 gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
774 gMC->Gdhead(1111,"TOF detector V1");
775 gMC->Gdman(18, 4, "MAN");
776 gMC->Gdopt("hide","off");
777}
778
779//_____________________________________________________________________________
780void AliTOFv4T0::DrawDetectorStrips()
781{
782 //
783 // Draw a shaded view of the TOF strips for version 4
784 //
785
d599d913 786 //Set ALIC mother transparent
4c475d27 787 gMC->Gsatt("ALIC","SEEN",0);
d599d913 788
789 //
790 //Set volumes visible
791 //=====> Level 1
792 // Level 1 for TOF volumes
793 gMC->Gsatt("B077","seen",0);
794
795 //==========> Level 2
796 // Level 2
797 gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
798 gMC->Gsatt("B071","seen",0);
799 gMC->Gsatt("B074","seen",0);
800 gMC->Gsatt("B075","seen",0);
801 gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
802
803 // Level 2 of B071
804 gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped -
805 gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped -
806 gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped -
807 gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped -
808 gMC->Gsatt("B056","seen",0); // B056 does not has sub-levels -
809 gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped -
810 gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped -
811 gMC->Gsatt("BTR1","seen",0); // BTR1 do not have sub-levels -
812 gMC->Gsatt("BTO1","seen",0);
813
814 // ==================> Level 3
815 // Level 3 of B071 / Level 2 of BTO1
816 gMC->Gsatt("FTOC","seen",0);
817 gMC->Gsatt("FTOB","seen",0);
818 gMC->Gsatt("FTOA","seen",0);
819
820 // Level 3 of B074 / Level 2 of BTO2
821 // -> cfr previous settings
822
823 // Level 3 of B075 / Level 2 of BTO3
824 // -> cfr previous settings
825
826
827 // ==========================> Level 4
828 // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOC
829 gMC->Gsatt("FLTC","seen",0);
830 // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOB
831 gMC->Gsatt("FLTB","seen",0);
832 // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOA
833 gMC->Gsatt("FLTA","seen",0);
834
835 // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOC
836 // -> cfr previous settings
837 // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOB
838 // -> cfr previous settings
839
840 // Level 4 of B075 / Level 3 of BTO3 / Level 2 of FTOC
841 // -> cfr previous settings
842
843 //======================================> Level 5
844 // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOC / Level 2 of FLTC
845 gMC->Gsatt("FALC","seen",0); // no children for FALC
846 gMC->Gsatt("FSTR","seen",-2);
847 gMC->Gsatt("FPEC","seen",0); // no children for FPEC
848 gMC->Gsatt("FECC","seen",0); // no children for FECC
849 gMC->Gsatt("FWAC","seen",0); // no children for FWAC
850 gMC->Gsatt("FAIC","seen",0); // no children for FAIC
851
852 // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOB / Level 2 of FLTB
853 gMC->Gsatt("FALB","seen",0); // no children for FALB
854 //--> gMC->Gsatt("FSTR","seen",-2);
855
856
857 // -> cfr previous settings
858 gMC->Gsatt("FPEB","seen",0); // no children for FPEB
859 gMC->Gsatt("FECB","seen",0); // no children for FECB
860 gMC->Gsatt("FWAB","seen",0); // no children for FWAB
861 gMC->Gsatt("FAIB","seen",0); // no children for FAIB
862
863 // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOA / Level 2 of FLTA
864 gMC->Gsatt("FALA","seen",0); // no children for FALB
865 //--> gMC->Gsatt("FSTR","seen",-2);
866 // -> cfr previous settings
867 gMC->Gsatt("FPEA","seen",0); // no children for FPEA
868 gMC->Gsatt("FECA","seen",0); // no children for FECA
869 gMC->Gsatt("FWAA","seen",0); // no children for FWAA
870 gMC->Gsatt("FAIA","seen",0); // no children for FAIA
871
872 // Level 2 of B074
873 gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
874 gMC->Gsatt("BTO2","seen",0);
875
876 // Level 2 of B075
877 gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
878 gMC->Gsatt("BTO3","seen",0);
879
880 // for others Level 5, cfr. previous settings
881
882 gMC->Gdopt("hide","on");
883 gMC->Gdopt("shad","on");
884 gMC->Gsatt("*", "fill", 5);
885 gMC->SetClipBox(".");
886 gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
887 gMC->DefaultRange();
888 gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
889 gMC->Gdhead(1111,"TOF Strips V1");
890 gMC->Gdman(18, 4, "MAN");
891 gMC->Gdopt("hide","off");
892}
893
894//_____________________________________________________________________________
895void AliTOFv4T0::CreateMaterials()
896{
897 //
898 // Define materials for the Time Of Flight
899 //
900 AliTOF::CreateMaterials();
901}
902
903//_____________________________________________________________________________
904void AliTOFv4T0::Init()
905{
906 //
907 // Initialise the detector after the geometry has been defined
908 //
909 if(fDebug) {
910 printf("%s: **************************************"
911 " TOF "
912 "**************************************\n",ClassName());
913 printf("\n%s: Version 4 of TOF initialing, "
914 "symmetric TOF - Full Coverage version\n",ClassName());
915 }
916
917 AliTOF::Init();
918
919 fIdFTOA = gMC->VolId("FTOA");
920 fIdFTOB = gMC->VolId("FTOB");
921 fIdFTOC = gMC->VolId("FTOC");
922 fIdFLTA = gMC->VolId("FLTA");
923 fIdFLTB = gMC->VolId("FLTB");
924 fIdFLTC = gMC->VolId("FLTC");
925
926 if(fDebug) {
927 printf("%s: **************************************"
928 " TOF "
929 "**************************************\n",ClassName());
930 }
931}
932
933//_____________________________________________________________________________
934void AliTOFv4T0::StepManager()
935{
0f4a7374 936
d599d913 937 //
938 // Procedure called at each step in the Time Of Flight
939 //
0f4a7374 940
d599d913 941 TLorentzVector mom, pos;
942 Float_t xm[3],pm[3],xpad[3],ppad[3];
943 Float_t hits[14],phi,phid,z;
944 Int_t vol[5];
945 Int_t sector, plate, padx, padz, strip;
946 Int_t copy, padzid, padxid, stripid, i;
947 Int_t *idtmed = fIdtmed->GetArray()-499;
948 Float_t incidenceAngle;
0f4a7374 949
d599d913 950 if(gMC->GetMedium()==idtmed[513] &&
951 gMC->IsTrackEntering() && gMC->TrackCharge()
952 && gMC->CurrentVolID(copy)==fIdSens)
74ea065c 953 {
954
955 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
956
d599d913 957 // getting information about hit volumes
958
959 padzid=gMC->CurrentVolOffID(2,copy);
da3d3acd 960 padz=copy;
0f4a7374 961
d599d913 962
963 padxid=gMC->CurrentVolOffID(1,copy);
da3d3acd 964 padx=copy;
d599d913 965
966 stripid=gMC->CurrentVolOffID(4,copy);
da3d3acd 967 strip=copy;
d599d913 968
969 gMC->TrackPosition(pos);
970 gMC->TrackMomentum(mom);
971
0f4a7374 972
973 // Double_t NormPos=1./pos.Rho();
974
d599d913 975 Double_t normMom=1./mom.Rho();
976
0f4a7374 977 // getting the cohordinates in pad ref system
978
d599d913 979 xm[0] = (Float_t)pos.X();
980 xm[1] = (Float_t)pos.Y();
981 xm[2] = (Float_t)pos.Z();
982
983 pm[0] = (Float_t)mom.X()*normMom;
984 pm[1] = (Float_t)mom.Y()*normMom;
985 pm[2] = (Float_t)mom.Z()*normMom;
986
987 gMC->Gmtod(xm,xpad,1);
988 gMC->Gmtod(pm,ppad,2);
989
644cbb5e 990
991 if (TMath::Abs(ppad[1])>1) {
992 Warning("StepManager","Abs(ppad) > 1");
993 ppad[1]=TMath::Sign((Float_t)1,ppad[1]);
994 }
d599d913 995 incidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
996
0f4a7374 997
d599d913 998 z = pos[2];
999
0f4a7374 1000 plate = -1;
1001
da3d3acd 1002 if (TMath::Abs(z) <= fZlenA*0.5) plate = 2; //3; // AdC
d599d913 1003 if (z < (fZlenA*0.5+fZlenB) &&
da3d3acd 1004 z > fZlenA*0.5) plate = 1; //4; // AdC
d599d913 1005 if (z >-(fZlenA*0.5+fZlenB) &&
da3d3acd 1006 z < -fZlenA*0.5) plate = 3; //2; // AdC
1007 if (z > (fZlenA*0.5+fZlenB)) plate = 0; //5; // AdC
1008 if (z <-(fZlenA*0.5+fZlenB)) plate = 4; //1; // AdC
1009
0f4a7374 1010
1011 if (plate==0) strip=fTOFGeometry->NStripC()-strip; // AdC
1012 else if (plate==1) strip=fTOFGeometry->NStripB()-strip; // AdC
da3d3acd 1013 else strip--; // AdC
0f4a7374 1014
1015 //Apply ALICE conventions for volume numbering increasing with theta, phi
1016
1017 if (plate==3 || plate==4){
1018 padx=fTOFGeometry->NpadX()-padx; // SA
1019 padz=fTOFGeometry->NpadZ()-padz; // AdC
1020 xpad[0]=-xpad[0];
1021 xpad[2]=-xpad[2];
1022 }
1023 else {
1024 padx--; // AdC
1025 padz--; // AdC
1026 }
da3d3acd 1027
da3d3acd 1028
d599d913 1029
1030 phi = pos.Phi();
da3d3acd 1031 if (phi>=0.) phid = phi*kRaddeg; //+180.; // AdC
1032 else phid = phi*kRaddeg + 360.; // AdC
0f4a7374 1033
d599d913 1034 sector = Int_t (phid/20.);
d599d913 1035
1036 for(i=0;i<3;++i) {
1037 hits[i] = pos[i];
1038 hits[i+3] = pm[i];
1039 }
1040
1041 hits[6] = mom.Rho();
1042 hits[7] = pos[3];
1043 hits[8] = xpad[0];
1044 hits[9] = xpad[1];
1045 hits[10]= xpad[2];
1046 hits[11]= incidenceAngle;
1047 hits[12]= gMC->Edep();
1048 hits[13]= gMC->TrackLength();
1049
1050 vol[0]= sector;
1051 vol[1]= plate;
1052 vol[2]= strip;
1053 vol[3]= padx;
0f4a7374 1054 vol[4]= padz;
1055
5d12ce38 1056 AddT0Hit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
d599d913 1057 }
1058}