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