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