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