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