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