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