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