TOF raw data: preliminary implementation and style changes
[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"
7e6dce66 54#include "AliTOFGeometry.h"
5d12ce38 55#include "AliMC.h"
d599d913 56
57ClassImp(AliTOFv4T0)
58
59//_____________________________________________________________________________
60AliTOFv4T0::AliTOFv4T0()
61{
62 //
63 // Default constructor
64 //
65}
66
67//_____________________________________________________________________________
68AliTOFv4T0::AliTOFv4T0(const char *name, const char *title)
69 : AliTOF(name,title,"tzero")
70{
71 //
72 // Standard constructor
73 //
74 //
75 // Check that FRAME is there otherwise we have no place where to
76 // put TOF
0f4a7374 77
78
d599d913 79 AliModule* frame=gAlice->GetModule("FRAME");
80 if(!frame) {
81 Error("Ctor","TOF needs FRAME to be present\n");
82 exit(1);
0f4a7374 83 } else{
84
85 if (fTOFGeometry) delete fTOFGeometry;
86 fTOFGeometry = new AliTOFGeometry();
d599d913 87
0f4a7374 88 if(frame->IsVersion()==1) {
89 cout << " Frame version " << frame->IsVersion() << endl;
90 cout << " Full Coverage for TOF" << endl;
91 fTOFHoles=false;}
92 else {
93 cout << " Frame version " << frame->IsVersion() << endl;
94 cout << " TOF with Holes for PHOS " << endl;
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
279 if (fDebug) cout << ClassName() <<
43808676 280 ": ************************* TOF geometry **************************"<<endl;
281
d599d913 282 par[2] = (zFLTA *0.5);
283 gMC->Gsvolu("FLTA", "BOX ", idtmed[512], par, 3); // Insensitive Freon
284 gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY");
43808676 285
d599d913 286 par[2] = (zFLTB * 0.5);
287 gMC->Gsvolu("FLTB", "BOX ", idtmed[512], par, 3); // Insensitive Freon
288 gMC->Gspos ("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY");
43808676 289
d599d913 290 par[2] = (zFLTC * 0.5);
291 gMC->Gsvolu("FLTC", "BOX ", idtmed[512], par, 3); // Insensitive Freon
292 gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY");
43808676 293
294 ///// Layers of Aluminum before and after detector /////
295 ///// Aluminum Box for Modules (1.8 mm thickness) /////
296 ///// lateral walls not simulated for the time being
0f4a7374 297 // const Float_t khAlWall = 0.18;
43808676 298 // fp to be checked
299 const Float_t khAlWall = 0.11;
d599d913 300 par[0] = xFLT*0.5;
7e6dce66 301 par[1] = khAlWall/2.; // cm
d599d913 302 ycoor = -yFLT/2 + par[1];
303 par[2] = (zFLTA *0.5);
304 gMC->Gsvolu("FALA", "BOX ", idtmed[508], par, 3); // Alluminium
305 gMC->Gspos ("FALA", 1, "FLTA", 0., ycoor, 0., 0, "ONLY");
306 gMC->Gspos ("FALA", 2, "FLTA", 0.,-ycoor, 0., 0, "ONLY");
307 par[2] = (zFLTB *0.5);
308 gMC->Gsvolu("FALB", "BOX ", idtmed[508], par, 3); // Alluminium
309 gMC->Gspos ("FALB", 1, "FLTB", 0., ycoor, 0., 0, "ONLY");
310 gMC->Gspos ("FALB", 2, "FLTB", 0.,-ycoor, 0., 0, "ONLY");
311 par[2] = (zFLTC *0.5);
312 gMC->Gsvolu("FALC", "BOX ", idtmed[508], par, 3); // Alluminium
313 gMC->Gspos ("FALC", 1, "FLTC", 0., ycoor, 0., 0, "ONLY");
314 gMC->Gspos ("FALC", 2, "FLTC", 0.,-ycoor, 0., 0, "ONLY");
315
43808676 316 ///////////////// Detector itself //////////////////////
317
7e6dce66 318 const Float_t kdeadBound = AliTOFGeometry::DeadBndZ(); //cm non-sensitive between the pad edge
43808676 319 //and the boundary of the strip
7e6dce66 320 const Int_t knx = AliTOFGeometry::NpadX(); // number of pads along x
321 const Int_t knz = AliTOFGeometry::NpadZ(); // number of pads along z
43808676 322
7e6dce66 323 Float_t zSenStrip = AliTOFGeometry::ZPad() * AliTOFGeometry::NpadZ(); // cm
d599d913 324 Float_t stripWidth = zSenStrip + 2*kdeadBound;
43808676 325
d599d913 326 par[0] = xFLT*0.5;
da3d3acd 327 par[1] = yPad*0.5;
d599d913 328 par[2] = stripWidth*0.5;
329
43808676 330 // new description for strip volume -double stack strip-
331 // -- all constants are expressed in cm
332 // heigth of different layers
333 const Float_t khhony = 0.8 ; // heigth of HONY Layer
334 const Float_t khpcby = 0.08 ; // heigth of PCB Layer
d599d913 335 const Float_t khmyly = 0.035 ; // heigth of MYLAR Layer
336 const Float_t khgraphy = 0.02 ; // heigth of GRAPHITE Layer
7e6dce66 337 const Float_t khglasseiy = 0.135; // 0.6 Ext. Glass + 1.1 i.e. (Int. Glass/2) (mm)
d599d913 338 const Float_t khsensmy = 0.11 ; // heigth of Sensitive Freon Mixture
339 const Float_t kwsensmz = 2*3.5 ; // cm
340 const Float_t klsensmx = 48*2.5; // cm
341 const Float_t kwpadz = 3.5; // cm z dimension of the FPAD volume
342 const Float_t klpadx = 2.5; // cm x dimension of the FPAD volume
343
344 // heigth of the FSTR Volume (the strip volume)
345 const Float_t khstripy = 2*khhony+3*khpcby+4*(khmyly+khgraphy+khglasseiy)+2*khsensmy;
346 // width of the FSTR Volume (the strip volume)
347 const Float_t kwstripz = 10.;
348 // length of the FSTR Volume (the strip volume)
349 const Float_t klstripx = 122.;
350
351 Float_t parfp[3]={klstripx*0.5,khstripy*0.5,kwstripz*0.5};
7e6dce66 352 // Coordinates of the strip center in the strip reference frame;
0f4a7374 353 // used for positioninG internal strip volumes
da3d3acd 354 Float_t posfp[3]={0.,0.,0.};
43808676 355
d599d913 356
0f4a7374 357 // FSTR volume definition-filling this volume with non sensitive Gas Mixture
d599d913 358 gMC->Gsvolu("FSTR","BOX",idtmed[512],parfp,3);
359 //-- HONY Layer definition
43808676 360 // parfp[0] = -1;
d599d913 361 parfp[1] = khhony*0.5;
43808676 362 // parfp[2] = -1;
d599d913 363 gMC->Gsvolu("FHON","BOX",idtmed[503],parfp,3);
364 // positioning 2 HONY Layers on FSTR volume
43808676 365
d599d913 366 posfp[1]=-khstripy*0.5+parfp[1];
367 gMC->Gspos("FHON",1,"FSTR",0., posfp[1],0.,0,"ONLY");
368 gMC->Gspos("FHON",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
43808676 369
d599d913 370 //-- PCB Layer definition
0f4a7374 371
d599d913 372 parfp[1] = khpcby*0.5;
373 gMC->Gsvolu("FPCB","BOX",idtmed[504],parfp,3);
374 // positioning 2 PCB Layers on FSTR volume
375 posfp[1]=-khstripy*0.5+khhony+parfp[1];
376 gMC->Gspos("FPCB",1,"FSTR",0., posfp[1],0.,0,"ONLY");
377 gMC->Gspos("FPCB",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
378 // positioning the central PCB layer
379 gMC->Gspos("FPCB",3,"FSTR",0.,0.,0.,0,"ONLY");
43808676 380
381
382
d599d913 383 //-- MYLAR Layer definition
0f4a7374 384
d599d913 385 parfp[1] = khmyly*0.5;
386 gMC->Gsvolu("FMYL","BOX",idtmed[511],parfp,3);
387 // positioning 2 MYLAR Layers on FSTR volume
da3d3acd 388 posfp[1] = -khstripy*0.5+khhony+khpcby+parfp[1];
d599d913 389 gMC->Gspos("FMYL",1,"FSTR",0., posfp[1],0.,0,"ONLY");
390 gMC->Gspos("FMYL",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
391 // adding further 2 MYLAR Layers on FSTR volume
392 posfp[1] = khpcby*0.5+parfp[1];
393 gMC->Gspos("FMYL",3,"FSTR",0., posfp[1],0.,0,"ONLY");
394 gMC->Gspos("FMYL",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
43808676 395
396
d599d913 397 //-- Graphite Layer definition
0f4a7374 398
d599d913 399 parfp[1] = khgraphy*0.5;
400 gMC->Gsvolu("FGRP","BOX",idtmed[502],parfp,3);
401 // positioning 2 Graphite Layers on FSTR volume
402 posfp[1] = -khstripy*0.5+khhony+khpcby+khmyly+parfp[1];
403 gMC->Gspos("FGRP",1,"FSTR",0., posfp[1],0.,0,"ONLY");
404 gMC->Gspos("FGRP",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
405 // adding further 2 Graphite Layers on FSTR volume
406 posfp[1] = khpcby*0.5+khmyly+parfp[1];
407 gMC->Gspos("FGRP",3,"FSTR",0., posfp[1],0.,0,"ONLY");
408 gMC->Gspos("FGRP",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
43808676 409
410
d599d913 411 //-- Glass (EXT. +Semi INT.) Layer definition
0f4a7374 412
d599d913 413 parfp[1] = khglasseiy*0.5;
414 gMC->Gsvolu("FGLA","BOX",idtmed[514],parfp,3);
415 // positioning 2 Glass Layers on FSTR volume
416 posfp[1] = -khstripy*0.5+khhony+khpcby+khmyly+khgraphy+parfp[1];
417 gMC->Gspos("FGLA",1,"FSTR",0., posfp[1],0.,0,"ONLY");
418 gMC->Gspos("FGLA",2,"FSTR",0.,-posfp[1],0.,0,"ONLY");
419 // adding further 2 Glass Layers on FSTR volume
420 posfp[1] = khpcby*0.5+khmyly+khgraphy+parfp[1];
421 gMC->Gspos("FGLA",3,"FSTR",0., posfp[1],0.,0,"ONLY");
422 gMC->Gspos("FGLA",4,"FSTR",0.,-posfp[1],0.,0,"ONLY");
43808676 423
d599d913 424
425 //-- Sensitive Mixture Layer definition
0f4a7374 426
d599d913 427 parfp[0] = klsensmx*0.5;
428 parfp[1] = khsensmy*0.5;
429 parfp[2] = kwsensmz*0.5;
430 gMC->Gsvolu("FSEN","BOX",idtmed[513],parfp,3);
431 gMC->Gsvolu("FNSE","BOX",idtmed[512],parfp,3);
432 // positioning 2 gas Layers on FSTR volume
433 // the upper is insensitive freon
434 // while the remaining is sensitive
435 posfp[1] = khpcby*0.5+khmyly+khgraphy+khglasseiy+parfp[1];
436 gMC->Gspos("FNSE",0,"FSTR", 0., posfp[1],0.,0,"ONLY");
437 gMC->Gspos("FSEN",0,"FSTR", 0.,-posfp[1],0.,0,"ONLY");
43808676 438
d599d913 439 // dividing FSEN along z in knz=2 and along x in knx=48
0f4a7374 440
d599d913 441 gMC->Gsdvn("FSEZ","FSEN",knz,3);
442 gMC->Gsdvn("FSEX","FSEZ",knx,1);
443
444 // FPAD volume definition
0f4a7374 445
da3d3acd 446 parfp[0] = klpadx*0.5;
d599d913 447 parfp[1] = khsensmy*0.5;
448 parfp[2] = kwpadz*0.5;
449 gMC->Gsvolu("FPAD","BOX",idtmed[513],parfp,3);
450 // positioning the FPAD volumes on previous divisions
451 gMC->Gspos("FPAD",0,"FSEX",0.,0.,0.,0,"ONLY");
452
da3d3acd 453
0f4a7374 454 ///////////////////Positioning A module//////////////////////////
da3d3acd 455
0f4a7374 456
457 for(Int_t istrip =0; istrip < fTOFGeometry->NStripA(); istrip++){
458
459 Float_t ang = fTOFGeometry->GetAngles(2,istrip);
460 AliMatrix (idrotm[0],90.,0.,90.-ang,90.,-ang, 90.);
43808676 461 ang /= kRaddeg;
0f4a7374 462 Float_t zpos = tan(ang)*radius;
463 Float_t ypos= fTOFGeometry->GetHeights(2,istrip);
7e6dce66 464 gMC->Gspos("FSTR",AliTOFGeometry::NStripA()-istrip,"FLTA",0.,ypos, zpos,idrotm[0], "ONLY");
61e4c9ba 465 if(fDebug>=1) {
0f4a7374 466 printf("y = %f, z = %f, , z coord = %f, Rot ang = %f, St. %2i \n",ypos,zpos,tan(ang)*radius ,ang*kRaddeg,istrip);
43808676 467 }
da3d3acd 468 }
0f4a7374 469
470
471 ///////////////////Positioning B module//////////////////////////
472
473 for(Int_t istrip =0; istrip < fTOFGeometry->NStripB(); istrip++){
474
475 Float_t ang = fTOFGeometry->GetAngles(3,istrip);
476 AliMatrix (idrotm[0],90.,0.,90.-ang,90.,-ang, 90.);
43808676 477 ang /= kRaddeg;
0f4a7374 478 Float_t zpos = tan(ang)*radius+(zFLTA*0.5+zFLTB*0.5+db);
479 Float_t ypos= fTOFGeometry->GetHeights(3,istrip);
480 gMC->Gspos("FSTR",istrip+1,"FLTB",0.,ypos, zpos,idrotm[nrot], "ONLY");
61e4c9ba 481 if(fDebug>=1) {
0f4a7374 482 printf("y = %f, z = %f, , z coord = %f, Rot ang = %f, St. %2i \n",ypos,zpos,tan(ang)*radius,ang*kRaddeg,istrip);
43808676 483 }
0f4a7374 484 }
485
43808676 486
0f4a7374 487 ///////////////////Positioning C module//////////////////////////
488
489 for(Int_t istrip =0; istrip < fTOFGeometry->NStripC(); istrip++){
490
491 Float_t ang = fTOFGeometry->GetAngles(4,istrip);
492 AliMatrix (idrotm[0],90.,0.,90.-ang,90.,-ang, 90.);
43808676 493 ang /= kRaddeg;
0f4a7374 494 Float_t zpos = tan(ang)*radius+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
495 Float_t ypos= fTOFGeometry->GetHeights(4,istrip);
496 gMC->Gspos("FSTR",istrip+1,"FLTC",0.,ypos, zpos,idrotm[nrot], "ONLY");
61e4c9ba 497 if(fDebug>=1) {
0f4a7374 498 printf("y = %f, z = %f, z coord = %f, Rot ang = %f, St. %2i \n",ypos,zpos,tan(ang)*radius,ang*kRaddeg,istrip);
499 }
500 }
501
43808676 502 ////////// Layers after strips /////////////////
503 // Al Layer thickness (2.3mm) factor 0.7
504
7e6dce66 505 Float_t overSpace = AliTOFGeometry::OverSpc();//cm
43808676 506
d599d913 507 par[0] = xFLT*0.5;
43808676 508 par[1] = 0.115*0.7; // factor 0.7
d599d913 509 par[2] = (zFLTA *0.5);
510 ycoor = -yFLT/2 + overSpace + par[1];
43808676 511 gMC->Gsvolu("FPEA", "BOX ", idtmed[508], par, 3); // Al
d599d913 512 gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
513 par[2] = (zFLTB *0.5);
43808676 514 gMC->Gsvolu("FPEB", "BOX ", idtmed[508], par, 3); // Al
d599d913 515 gMC->Gspos ("FPEB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
516 par[2] = (zFLTC *0.5);
43808676 517 gMC->Gsvolu("FPEC", "BOX ", idtmed[508], par, 3); // Al
d599d913 518 gMC->Gspos ("FPEC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
43808676 519
520
521 // plexiglass thickness: 1.5 mm ; factor 0.3
0f4a7374 522
d599d913 523 ycoor += par[1];
524 par[0] = xFLT*0.5;
43808676 525 par[1] = 0.075*0.3; // factor 0.3
d599d913 526 par[2] = (zFLTA *0.5);
527 ycoor += par[1];
43808676 528 gMC->Gsvolu("FECA", "BOX ", idtmed[505], par, 3); // Plexigl.
d599d913 529 gMC->Gspos ("FECA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
530 par[2] = (zFLTB *0.5);
43808676 531 gMC->Gsvolu("FECB", "BOX ", idtmed[505], par, 3); // Plexigl.
d599d913 532 gMC->Gspos ("FECB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
533 par[2] = (zFLTC *0.5);
43808676 534 gMC->Gsvolu("FECC", "BOX ", idtmed[505], par, 3); // Plexigl.
d599d913 535 gMC->Gspos ("FECC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
43808676 536
537 // frame of Air
0f4a7374 538
d599d913 539 ycoor += par[1];
540 par[0] = xFLT*0.5;
43808676 541 par[1] = (yFLT/2-ycoor-khAlWall)*0.5; // Aluminum layer considered (0.18 cm)
d599d913 542 par[2] = (zFLTA *0.5);
543 ycoor += par[1];
544 gMC->Gsvolu("FAIA", "BOX ", idtmed[500], par, 3); // Air
545 gMC->Gspos ("FAIA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
546 par[2] = (zFLTB *0.5);
547 gMC->Gsvolu("FAIB", "BOX ", idtmed[500], par, 3); // Air
548 gMC->Gspos ("FAIB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
549 par[2] = (zFLTC *0.5);
550 gMC->Gsvolu("FAIC", "BOX ", idtmed[500], par, 3); // Air
551 gMC->Gspos ("FAIC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
43808676 552
553
554 // start with cards and cooling tubes
555 // finally, cards, cooling tubes and layer for thermal dispersion
556 // 3 volumes
557 // card volume definition
558
559 // see GEOM200 in GEANT manual
0f4a7374 560
561
43808676 562 AliMatrix(idrotm[98], 90., 0., 90., 90., 0., 0.); // 0 deg
563
564 Float_t cardpar[3];
565 cardpar[0]= 61.;
566 cardpar[1]= 5.;
567 cardpar[2]= 0.1;
568 gMC->Gsvolu("FCAR", "BOX ", idtmed[504], cardpar, 3); // PCB Card
569 //alu plate volume definition
570 cardpar[1]= 3.5;
571 cardpar[2]= 0.05;
572 gMC->Gsvolu("FALP", "BOX ", idtmed[508], cardpar, 3); // Alu Plate
573
574
575 // central module positioning (FAIA)
576 Float_t cardpos[3], aplpos2, stepforcardA=6.625;
577 cardpos[0]= 0.;
578 cardpos[1]= -0.5;
579 cardpos[2]= -53.;
580 Float_t aplpos1 = -2.;
581 Int_t icard;
0f4a7374 582 for (icard=0; icard < fTOFGeometry->NStripA(); ++icard) {
43808676 583 cardpos[2]= cardpos[2]+stepforcardA;
584 aplpos2 = cardpos[2]+0.15;
da3d3acd 585 gMC->Gspos("FCAR",icard,"FAIA",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
43808676 586 gMC->Gspos("FALP",icard,"FAIA",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
587
588 }
589
590
591 // intermediate module positioning (FAIB)
592 Float_t stepforcardB= 7.05;
593 cardpos[2]= -70.5;
0f4a7374 594 for (icard=0; icard < fTOFGeometry->NStripB(); ++icard) {
43808676 595 cardpos[2]= cardpos[2]+stepforcardB;
da3d3acd 596 aplpos2 = cardpos[2]+0.15;
597 gMC->Gspos("FCAR",icard,"FAIB",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
598 gMC->Gspos("FALP",icard,"FAIB",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
43808676 599 }
600
601
602 // outer module positioning (FAIC)
603 Float_t stepforcardC= 8.45238;
604 cardpos[2]= -88.75;
0f4a7374 605 for (icard=0; icard < fTOFGeometry->NStripC(); ++icard) {
43808676 606 cardpos[2]= cardpos[2]+stepforcardC;
607 aplpos2 = cardpos[2]+0.15;
da3d3acd 608 gMC->Gspos("FCAR",icard,"FAIC",cardpos[0],cardpos[1],cardpos[2],idrotm[98],"ONLY");
43808676 609 gMC->Gspos("FALP",icard,"FAIC",cardpos[0],aplpos1,aplpos2,idrotm[98],"ONLY");
610 }
611
612 // tube volume definition
0f4a7374 613
43808676 614 Float_t tubepar[3];
615 tubepar[0]= 0.;
616 tubepar[1]= 0.4;
617 tubepar[2]= 61.;
618 gMC->Gsvolu("FTUB", "TUBE", idtmed[516], tubepar, 3); // cooling tubes (steel)
619 tubepar[0]= 0.;
620 tubepar[1]= 0.35;
621 tubepar[2]= 61.;
622 gMC->Gsvolu("FITU", "TUBE", idtmed[515], tubepar, 3); // cooling water
623 // positioning water tube into the steel one
624 gMC->Gspos("FITU",1,"FTUB",0.,0.,0.,0,"ONLY");
625
626
627 // rotation matrix
628 AliMatrix(idrotm[99], 180., 90., 90., 90., 90., 0.);
629 // central module positioning (FAIA)
630 Float_t tubepos[3], tdis=0.6;
631 tubepos[0]= 0.;
632 tubepos[1]= cardpos[1];
633 tubepos[2]= -53.+tdis;
634 // tub1pos = 5.;
635 Int_t itub;
0f4a7374 636 for (itub=0; itub < fTOFGeometry->NStripA(); ++itub) {
43808676 637 tubepos[2]= tubepos[2]+stepforcardA;
638 gMC->Gspos("FTUB",itub,"FAIA",tubepos[0],tubepos[1],tubepos[2],idrotm[99],
639 "ONLY");
640 }
641
642
643 // intermediate module positioning (FAIB)
644 tubepos[2]= -70.5+tdis;
0f4a7374 645 for (itub=0; itub < fTOFGeometry->NStripB(); ++itub) {
43808676 646 tubepos[2]= tubepos[2]+stepforcardB;
647 gMC->Gspos("FTUB",itub,"FAIB",tubepos[0],tubepos[1],tubepos[2],idrotm[99],
648 "ONLY");
649 }
650
651 // outer module positioning (FAIC)
652 tubepos[2]= -88.75+tdis;
0f4a7374 653 for (itub=0; itub < fTOFGeometry->NStripC(); ++itub) {
43808676 654 tubepos[2]= tubepos[2]+stepforcardC;
655 gMC->Gspos("FTUB",itub,"FAIC",tubepos[0],tubepos[1],tubepos[2],idrotm[99],
656 "ONLY");
657 }
658
d599d913 659}
d599d913 660//_____________________________________________________________________________
661void AliTOFv4T0::DrawModule() const
662{
663 //
664 // Draw a shaded view of the Time Of Flight version 4
665 //
666 // Set everything unseen
667 gMC->Gsatt("*", "seen", -1);
668 //
669 // Set ALIC mother transparent
670 gMC->Gsatt("ALIC","SEEN",0);
671 //
672 // Set the volumes visible
673 gMC->Gsatt("ALIC","SEEN",0);
674
675 gMC->Gsatt("FTOA","SEEN",1);
676 gMC->Gsatt("FTOB","SEEN",1);
677 gMC->Gsatt("FTOC","SEEN",1);
678 gMC->Gsatt("FLTA","SEEN",1);
679 gMC->Gsatt("FLTB","SEEN",1);
680 gMC->Gsatt("FLTC","SEEN",1);
681 gMC->Gsatt("FPLA","SEEN",1);
682 gMC->Gsatt("FPLB","SEEN",1);
683 gMC->Gsatt("FPLC","SEEN",1);
684 gMC->Gsatt("FSTR","SEEN",1);
685 gMC->Gsatt("FPEA","SEEN",1);
686 gMC->Gsatt("FPEB","SEEN",1);
687 gMC->Gsatt("FPEC","SEEN",1);
688
689 gMC->Gsatt("FLZ1","SEEN",0);
690 gMC->Gsatt("FLZ2","SEEN",0);
691 gMC->Gsatt("FLZ3","SEEN",0);
692 gMC->Gsatt("FLX1","SEEN",0);
693 gMC->Gsatt("FLX2","SEEN",0);
694 gMC->Gsatt("FLX3","SEEN",0);
695 gMC->Gsatt("FPAD","SEEN",0);
696
697 gMC->Gdopt("hide", "on");
698 gMC->Gdopt("shad", "on");
699 gMC->Gsatt("*", "fill", 7);
700 gMC->SetClipBox(".");
701 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
702 gMC->DefaultRange();
703 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
704 gMC->Gdhead(1111, "Time Of Flight");
705 gMC->Gdman(18, 4, "MAN");
706 gMC->Gdopt("hide","off");
707}
708//_____________________________________________________________________________
709void AliTOFv4T0::DrawDetectorModules()
710{
711//
712// Draw a shaded view of the TOF detector version 4
713//
714
88cb7938 715
716//Set ALIC mother transparent
4c475d27 717 gMC->Gsatt("ALIC","SEEN",0);
d599d913 718
719//
720//Set volumes visible
721//
722//=====> Level 1
723 // Level 1 for TOF volumes
724 gMC->Gsatt("B077","seen",0);
725
726
727//==========> Level 2
728 // Level 2
729 gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
730 gMC->Gsatt("B071","seen",0);
731 gMC->Gsatt("B074","seen",0);
732 gMC->Gsatt("B075","seen",0);
733 gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
734
735
736 // Level 2 of B071
737 gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped -
738 gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped -
739 gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped -
740 gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped -
741 gMC->Gsatt("B056","seen",0); // B056 does not has sub-levels -
742 gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped -
743 gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped -
744 gMC->Gsatt("BTR1","seen",0); // BTR1 do not have sub-levels -
745 gMC->Gsatt("BTO1","seen",0);
746
747
748 // Level 2 of B074
749 gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
750 gMC->Gsatt("BTO2","seen",0);
751
752 // Level 2 of B075
753 gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
754 gMC->Gsatt("BTO3","seen",0);
755
756// ==================> Level 3
757 // Level 3 of B071 / Level 2 of BTO1
758 gMC->Gsatt("FTOC","seen",-2);
759 gMC->Gsatt("FTOB","seen",-2);
760 gMC->Gsatt("FTOA","seen",-2);
761
762 // Level 3 of B074 / Level 2 of BTO2
763 // -> cfr previous settings
764
765 // Level 3 of B075 / Level 2 of BTO3
766 // -> cfr previous settings
767
768 gMC->Gdopt("hide","on");
769 gMC->Gdopt("shad","on");
770 gMC->Gsatt("*", "fill", 5);
771 gMC->SetClipBox(".");
772 gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
773 gMC->DefaultRange();
774 gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
775 gMC->Gdhead(1111,"TOF detector V1");
776 gMC->Gdman(18, 4, "MAN");
777 gMC->Gdopt("hide","off");
778}
779
780//_____________________________________________________________________________
781void AliTOFv4T0::DrawDetectorStrips()
782{
783 //
784 // Draw a shaded view of the TOF strips for version 4
785 //
786
d599d913 787 //Set ALIC mother transparent
4c475d27 788 gMC->Gsatt("ALIC","SEEN",0);
d599d913 789
790 //
791 //Set volumes visible
792 //=====> Level 1
793 // Level 1 for TOF volumes
794 gMC->Gsatt("B077","seen",0);
795
796 //==========> Level 2
797 // Level 2
798 gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
799 gMC->Gsatt("B071","seen",0);
800 gMC->Gsatt("B074","seen",0);
801 gMC->Gsatt("B075","seen",0);
802 gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
803
804 // Level 2 of B071
805 gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped -
806 gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped -
807 gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped -
808 gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped -
809 gMC->Gsatt("B056","seen",0); // B056 does not has sub-levels -
810 gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped -
811 gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped -
812 gMC->Gsatt("BTR1","seen",0); // BTR1 do not have sub-levels -
813 gMC->Gsatt("BTO1","seen",0);
814
815 // ==================> Level 3
816 // Level 3 of B071 / Level 2 of BTO1
817 gMC->Gsatt("FTOC","seen",0);
818 gMC->Gsatt("FTOB","seen",0);
819 gMC->Gsatt("FTOA","seen",0);
820
821 // Level 3 of B074 / Level 2 of BTO2
822 // -> cfr previous settings
823
824 // Level 3 of B075 / Level 2 of BTO3
825 // -> cfr previous settings
826
827
828 // ==========================> Level 4
829 // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOC
830 gMC->Gsatt("FLTC","seen",0);
831 // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOB
832 gMC->Gsatt("FLTB","seen",0);
833 // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOA
834 gMC->Gsatt("FLTA","seen",0);
835
836 // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOC
837 // -> cfr previous settings
838 // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOB
839 // -> cfr previous settings
840
841 // Level 4 of B075 / Level 3 of BTO3 / Level 2 of FTOC
842 // -> cfr previous settings
843
844 //======================================> Level 5
845 // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOC / Level 2 of FLTC
846 gMC->Gsatt("FALC","seen",0); // no children for FALC
847 gMC->Gsatt("FSTR","seen",-2);
848 gMC->Gsatt("FPEC","seen",0); // no children for FPEC
849 gMC->Gsatt("FECC","seen",0); // no children for FECC
850 gMC->Gsatt("FWAC","seen",0); // no children for FWAC
851 gMC->Gsatt("FAIC","seen",0); // no children for FAIC
852
853 // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOB / Level 2 of FLTB
854 gMC->Gsatt("FALB","seen",0); // no children for FALB
855 //--> gMC->Gsatt("FSTR","seen",-2);
856
857
858 // -> cfr previous settings
859 gMC->Gsatt("FPEB","seen",0); // no children for FPEB
860 gMC->Gsatt("FECB","seen",0); // no children for FECB
861 gMC->Gsatt("FWAB","seen",0); // no children for FWAB
862 gMC->Gsatt("FAIB","seen",0); // no children for FAIB
863
864 // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOA / Level 2 of FLTA
865 gMC->Gsatt("FALA","seen",0); // no children for FALB
866 //--> gMC->Gsatt("FSTR","seen",-2);
867 // -> cfr previous settings
868 gMC->Gsatt("FPEA","seen",0); // no children for FPEA
869 gMC->Gsatt("FECA","seen",0); // no children for FECA
870 gMC->Gsatt("FWAA","seen",0); // no children for FWAA
871 gMC->Gsatt("FAIA","seen",0); // no children for FAIA
872
873 // Level 2 of B074
874 gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
875 gMC->Gsatt("BTO2","seen",0);
876
877 // Level 2 of B075
878 gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
879 gMC->Gsatt("BTO3","seen",0);
880
881 // for others Level 5, cfr. previous settings
882
883 gMC->Gdopt("hide","on");
884 gMC->Gdopt("shad","on");
885 gMC->Gsatt("*", "fill", 5);
886 gMC->SetClipBox(".");
887 gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
888 gMC->DefaultRange();
889 gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
890 gMC->Gdhead(1111,"TOF Strips V1");
891 gMC->Gdman(18, 4, "MAN");
892 gMC->Gdopt("hide","off");
893}
894
895//_____________________________________________________________________________
896void AliTOFv4T0::CreateMaterials()
897{
898 //
899 // Define materials for the Time Of Flight
900 //
901 AliTOF::CreateMaterials();
902}
903
904//_____________________________________________________________________________
905void AliTOFv4T0::Init()
906{
907 //
908 // Initialise the detector after the geometry has been defined
909 //
910 if(fDebug) {
911 printf("%s: **************************************"
912 " TOF "
913 "**************************************\n",ClassName());
914 printf("\n%s: Version 4 of TOF initialing, "
915 "symmetric TOF - Full Coverage version\n",ClassName());
916 }
917
918 AliTOF::Init();
919
920 fIdFTOA = gMC->VolId("FTOA");
921 fIdFTOB = gMC->VolId("FTOB");
922 fIdFTOC = gMC->VolId("FTOC");
923 fIdFLTA = gMC->VolId("FLTA");
924 fIdFLTB = gMC->VolId("FLTB");
925 fIdFLTC = gMC->VolId("FLTC");
926
927 if(fDebug) {
928 printf("%s: **************************************"
929 " TOF "
930 "**************************************\n",ClassName());
931 }
932}
933
934//_____________________________________________________________________________
935void AliTOFv4T0::StepManager()
936{
0f4a7374 937
d599d913 938 //
939 // Procedure called at each step in the Time Of Flight
940 //
0f4a7374 941
d599d913 942 TLorentzVector mom, pos;
943 Float_t xm[3],pm[3],xpad[3],ppad[3];
944 Float_t hits[14],phi,phid,z;
945 Int_t vol[5];
946 Int_t sector, plate, padx, padz, strip;
947 Int_t copy, padzid, padxid, stripid, i;
948 Int_t *idtmed = fIdtmed->GetArray()-499;
949 Float_t incidenceAngle;
0f4a7374 950
d599d913 951 if(gMC->GetMedium()==idtmed[513] &&
952 gMC->IsTrackEntering() && gMC->TrackCharge()
953 && gMC->CurrentVolID(copy)==fIdSens)
74ea065c 954 {
955
956 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
957
d599d913 958 // getting information about hit volumes
959
960 padzid=gMC->CurrentVolOffID(2,copy);
da3d3acd 961 padz=copy;
0f4a7374 962
d599d913 963
964 padxid=gMC->CurrentVolOffID(1,copy);
da3d3acd 965 padx=copy;
d599d913 966
967 stripid=gMC->CurrentVolOffID(4,copy);
da3d3acd 968 strip=copy;
d599d913 969
970 gMC->TrackPosition(pos);
971 gMC->TrackMomentum(mom);
972
0f4a7374 973
974 // Double_t NormPos=1./pos.Rho();
975
d599d913 976 Double_t normMom=1./mom.Rho();
977
0f4a7374 978 // getting the cohordinates in pad ref system
979
d599d913 980 xm[0] = (Float_t)pos.X();
981 xm[1] = (Float_t)pos.Y();
982 xm[2] = (Float_t)pos.Z();
983
984 pm[0] = (Float_t)mom.X()*normMom;
985 pm[1] = (Float_t)mom.Y()*normMom;
986 pm[2] = (Float_t)mom.Z()*normMom;
987
988 gMC->Gmtod(xm,xpad,1);
989 gMC->Gmtod(pm,ppad,2);
990
644cbb5e 991
992 if (TMath::Abs(ppad[1])>1) {
993 Warning("StepManager","Abs(ppad) > 1");
994 ppad[1]=TMath::Sign((Float_t)1,ppad[1]);
995 }
d599d913 996 incidenceAngle = TMath::ACos(ppad[1])*kRaddeg;
997
0f4a7374 998
d599d913 999 z = pos[2];
1000
0f4a7374 1001 plate = -1;
1002
7e6dce66 1003 if (TMath::Abs(z) <= AliTOFGeometry::ZlenA()*0.5) plate = 2;
1004 if (z < (AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB()) &&
1005 z > AliTOFGeometry::ZlenA()*0.5) plate = 1;
1006 if (z >-(AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB()) &&
1007 z < -AliTOFGeometry::ZlenA()*0.5) plate = 3;
1008 if (z > (AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB())) plate = 0;
1009 if (z <-(AliTOFGeometry::ZlenA()*0.5+AliTOFGeometry::ZlenB())) plate = 4;
da3d3acd 1010
0f4a7374 1011
7e6dce66 1012 if (plate==0) strip=fTOFGeometry->NStripC()-strip;
1013 else if (plate==1) strip=fTOFGeometry->NStripB()-strip;
1014 else strip--;
0f4a7374 1015
7e6dce66 1016 //Apply ALICE conventions for volume numbering increasing with theta, phi
0f4a7374 1017
1018 if (plate==3 || plate==4){
7e6dce66 1019 padx=fTOFGeometry->NpadX()-padx;
1020 padz=fTOFGeometry->NpadZ()-padz;
0f4a7374 1021 xpad[0]=-xpad[0];
1022 xpad[2]=-xpad[2];
1023 }
1024 else {
7e6dce66 1025 padx--;
1026 padz--;
0f4a7374 1027 }
da3d3acd 1028
da3d3acd 1029
d599d913 1030
1031 phi = pos.Phi();
7e6dce66 1032 if (phi>=0.) phid = phi*kRaddeg;
1033 else phid = phi*kRaddeg + 360.;
0f4a7374 1034
d599d913 1035 sector = Int_t (phid/20.);
d599d913 1036
1037 for(i=0;i<3;++i) {
1038 hits[i] = pos[i];
1039 hits[i+3] = pm[i];
1040 }
1041
1042 hits[6] = mom.Rho();
1043 hits[7] = pos[3];
1044 hits[8] = xpad[0];
1045 hits[9] = xpad[1];
1046 hits[10]= xpad[2];
1047 hits[11]= incidenceAngle;
1048 hits[12]= gMC->Edep();
1049 hits[13]= gMC->TrackLength();
1050
1051 vol[0]= sector;
1052 vol[1]= plate;
1053 vol[2]= strip;
1054 vol[3]= padx;
0f4a7374 1055 vol[4]= padz;
1056
5d12ce38 1057 AddT0Hit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
d599d913 1058 }
1059}