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