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