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