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