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