Added TPC in the macro search path which is useful to run TPC/ITS tracking from withi...
[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$
0cc62300 18Revision 1.17 2000/10/02 21:28:17 fca
19Removal of useless dependecies via forward declarations
20
94de3818 21Revision 1.16 2000/05/10 16:52:18 vicinanz
22New TOF version with holes for PHOS/RICH
23
2cef3cb2 24Revision 1.14.2.1 2000/05/10 09:37:16 vicinanz
25New version with Holes for PHOS/RICH
26
da39da0c 27Revision 1.14 1999/11/05 22:39:06 fca
28New hits structure
29
2cef3cb2 30Revision 1.13 1999/11/02 11:26:39 fca
31added stdlib.h for exit
32
33Revision 1.12 1999/11/01 20:41:57 fca
826b71ec 34Added protections against using the wrong version of FRAME
35
2cef3cb2 36Revision 1.11 1999/10/22 08:04:14 fca
ab76897d 37Correct improper use of negative parameters
38
2cef3cb2 39Revision 1.10 1999/10/16 19:30:06 fca
d0a635a0 40Corrected Rotation Matrix and CVS log
41
2cef3cb2 42Revision 1.9 1999/10/15 15:35:20 fca
00e5f8d9 43New version for frame1099 with and without holes
44
2cef3cb2 45Revision 1.8 1999/09/29 09:24:33 fca
937fe4a4 46Introduction of the Copyright and cvs Log
47
4c039060 48*/
49
fe4da5cc 50///////////////////////////////////////////////////////////////////////////////
51// //
937fe4a4 52// Time Of Flight: design of C.Williams FCA //
53// This class contains the functions for version 1 of the Time Of Flight //
fe4da5cc 54// detector. //
937fe4a4 55//
56// VERSION WITH 5 MODULES AND TILTED STRIPS
57//
2cef3cb2 58// FULL COVERAGE VERSION
937fe4a4 59//
60// Authors:
2cef3cb2 61//
937fe4a4 62// Alessio Seganti
63// Domenico Vicinanza
64//
65// University of Salerno - Italy
66//
67//
fe4da5cc 68//Begin_Html
69/*
1439f98e 70<img src="picts/AliTOFv0Class.gif">
fe4da5cc 71*/
72//End_Html
73// //
74///////////////////////////////////////////////////////////////////////////////
75
826b71ec 76#include <iostream.h>
ab76897d 77#include <stdlib.h>
78
fe4da5cc 79#include "AliTOFv0.h"
2cef3cb2 80#include "TBRIK.h"
94de3818 81#include "TGeometry.h"
2cef3cb2 82#include "TNode.h"
83#include "TObject.h"
0cc62300 84#include <TLorentzVector.h>
fe4da5cc 85#include "AliRun.h"
94de3818 86#include "AliMC.h"
fe4da5cc 87#include "AliConst.h"
3fe3a833 88
fe4da5cc 89ClassImp(AliTOFv0)
90
91//_____________________________________________________________________________
151e057e 92AliTOFv0::AliTOFv0()
fe4da5cc 93{
94 //
95 // Default constructor
96 //
2cef3cb2 97
da39da0c 98 //
99 // Check that FRAME is there otherwise we have no place where to
100 // put TOF
101 AliModule* FRAME=gAlice->GetModule("FRAME");
102 if(!FRAME) {
103 Error("Ctor","TOF needs FRAME to be present\n");
104 exit(1);
2cef3cb2 105 } else
106 if(FRAME->IsVersion()!=1) {
107 Error("Ctor","FRAME version 1 needed with this version of TOF\n");
da39da0c 108 exit(1);
109 }
2cef3cb2 110
da39da0c 111
fe4da5cc 112}
113
114//_____________________________________________________________________________
2cef3cb2 115AliTOFv0::AliTOFv0(const char *name, const char *title)
116 : AliTOF(name,title)
117{
118 //
119 // Standard constructor
120 //
121}
122
123//_____________________________________________________________________________
124void AliTOFv0::BuildGeometry()
125{
126 // Build TOF ROOT geometry for the ALICE event viewver
127 //
128 TNode *Node, *Top;
129 const int kColorTOF = 27;
130
131 // Find top TNODE
132 Top = gAlice->GetGeometry()->GetNode("alice");
133
134 // Position the different copies
135 const Float_t rTof =(fRmax+fRmin)/2;
136 const Float_t hTof = fRmax-fRmin;
137 const Int_t fNTof = 18;
138 const Float_t kPi = TMath::Pi();
139 const Float_t angle = 2*kPi/fNTof;
140 Float_t ang;
141
142 // Define TOF basic volume
143
144 char NodeName0[6], NodeName1[6], NodeName2[6];
145 char NodeName3[6], NodeName4[6], RotMatNum[6];
146
147 new TBRIK("S_TOF_C","TOF box","void",
148 120*0.5,hTof*0.5,fZlenC*0.5);
149 new TBRIK("S_TOF_B","TOF box","void",
150 120*0.5,hTof*0.5,fZlenB*0.5);
151 new TBRIK("S_TOF_A","TOF box","void",
152 120*0.5,hTof*0.5,fZlenA*0.5);
153
154 for (Int_t NodeNum=1;NodeNum<19;NodeNum++){
155
156 if (NodeNum<10) {
157 sprintf(RotMatNum,"rot50%i",NodeNum);
158 sprintf(NodeName0,"FTO00%i",NodeNum);
159 sprintf(NodeName1,"FTO10%i",NodeNum);
160 sprintf(NodeName2,"FTO20%i",NodeNum);
161 sprintf(NodeName3,"FTO30%i",NodeNum);
162 sprintf(NodeName4,"FTO40%i",NodeNum);
163 }
164 if (NodeNum>9) {
165 sprintf(RotMatNum,"rot5%i",NodeNum);
166 sprintf(NodeName0,"FTO0%i",NodeNum);
167 sprintf(NodeName1,"FTO1%i",NodeNum);
168 sprintf(NodeName2,"FTO2%i",NodeNum);
169 sprintf(NodeName3,"FTO3%i",NodeNum);
170 sprintf(NodeName4,"FTO4%i",NodeNum);
171 }
172
173 new TRotMatrix(RotMatNum,RotMatNum,90,-20*NodeNum,90,90-20*NodeNum,0,0);
174 ang = (4.5-NodeNum) * angle;
175
176 Top->cd();
177 Node = new TNode(NodeName0,NodeName0,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),299.15,RotMatNum);
178 Node->SetLineColor(kColorTOF);
179 fNodes->Add(Node);
180
181 Top->cd();
182 Node = new TNode(NodeName1,NodeName1,"S_TOF_C",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-299.15,RotMatNum);
183 Node->SetLineColor(kColorTOF);
184 fNodes->Add(Node);
185
186 Top->cd();
187 Node = new TNode(NodeName2,NodeName2,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),146.45,RotMatNum);
188 Node->SetLineColor(kColorTOF);
189 fNodes->Add(Node);
190
191 Top->cd();
192 Node = new TNode(NodeName3,NodeName3,"S_TOF_B",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),-146.45,RotMatNum);
193 Node->SetLineColor(kColorTOF);
194 fNodes->Add(Node);
195
196 Top->cd();
197 Node = new TNode(NodeName4,NodeName4,"S_TOF_A",rTof*TMath::Cos(ang),rTof*TMath::Sin(ang),0.,RotMatNum);
198 Node->SetLineColor(kColorTOF);
199 fNodes->Add(Node);
200 }
201}
202
203//_____________________________________________________________________________
fe4da5cc 204void AliTOFv0::CreateGeometry()
205{
206 //
3fe3a833 207 // Create geometry for Time Of Flight version 0
208 //
fe4da5cc 209 //Begin_Html
210 /*
1439f98e 211 <img src="picts/AliTOFv0.gif">
fe4da5cc 212 */
213 //End_Html
214 //
937fe4a4 215 // Creates common geometry
fe4da5cc 216 //
3fe3a833 217 AliTOF::CreateGeometry();
fe4da5cc 218}
219
220//_____________________________________________________________________________
2cef3cb2 221void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
222 Float_t zlenB, Float_t zlenA, Float_t ztof0)
fe4da5cc 223{
224 //
3fe3a833 225 // Definition of the Time Of Fligh Resistive Plate Chambers
937fe4a4 226 // xFLT, yFLT, zFLT - sizes of TOF modules (large)
3fe3a833 227
2cef3cb2 228 Float_t ycoor, zcoor;
3fe3a833 229 Float_t par[10];
2cef3cb2 230 Int_t *idtmed = fIdtmed->GetArray()-499;
937fe4a4 231 Int_t idrotm[100];
232 Int_t nrot = 0;
3fe3a833 233
2cef3cb2 234 Float_t Radius = fRmin+2.;//cm
937fe4a4 235
2cef3cb2 236 par[0] = xtof * 0.5;
237 par[1] = ytof * 0.5;
238 par[2] = zlenC * 0.5;
239 gMC->Gsvolu("FTOC", "BOX ", idtmed[506], par, 3);
240 par[2] = zlenB * 0.5;
241 gMC->Gsvolu("FTOB", "BOX ", idtmed[506], par, 3);
242 par[2] = zlenA * 0.5;
243 gMC->Gsvolu("FTOA", "BOX ", idtmed[506], par, 3);
937fe4a4 244
245
246// Positioning of modules
247
2cef3cb2 248 Float_t zcor1 = ztof0 - zlenC*0.5;
249 Float_t zcor2 = ztof0 - zlenC - zlenB*0.5;
937fe4a4 250 Float_t zcor3 = 0.;
251
252 AliMatrix(idrotm[0], 90., 0., 0., 0., 90, -90.);
253 AliMatrix(idrotm[1], 90., 180., 0., 0., 90, 90.);
2cef3cb2 254 gMC->Gspos("FTOC", 1, "BTO1", 0, zcor1, 0, idrotm[0], "ONLY");
255 gMC->Gspos("FTOC", 2, "BTO1", 0, -zcor1, 0, idrotm[1], "ONLY");
256 gMC->Gspos("FTOC", 1, "BTO2", 0, zcor1, 0, idrotm[0], "ONLY");
257 gMC->Gspos("FTOC", 2, "BTO2", 0, -zcor1, 0, idrotm[1], "ONLY");
258 gMC->Gspos("FTOC", 1, "BTO3", 0, zcor1, 0, idrotm[0], "ONLY");
259 gMC->Gspos("FTOC", 2, "BTO3", 0, -zcor1, 0, idrotm[1], "ONLY");
260
261 gMC->Gspos("FTOB", 1, "BTO1", 0, zcor2, 0, idrotm[0], "ONLY");
262 gMC->Gspos("FTOB", 2, "BTO1", 0, -zcor2, 0, idrotm[1], "ONLY");
263 gMC->Gspos("FTOB", 1, "BTO2", 0, zcor2, 0, idrotm[0], "ONLY");
264 gMC->Gspos("FTOB", 2, "BTO2", 0, -zcor2, 0, idrotm[1], "ONLY");
265 gMC->Gspos("FTOB", 1, "BTO3", 0, zcor2, 0, idrotm[0], "ONLY");
266 gMC->Gspos("FTOB", 2, "BTO3", 0, -zcor2, 0, idrotm[1], "ONLY");
267
268 gMC->Gspos("FTOA", 0, "BTO1", 0, zcor3, 0, idrotm[0], "ONLY");
269 gMC->Gspos("FTOA", 0, "BTO2", 0, zcor3, 0, idrotm[0], "ONLY");
270 gMC->Gspos("FTOA", 0, "BTO3", 0, zcor3, 0, idrotm[0], "ONLY");
271
272 Float_t db = 0.5;//cm
273 Float_t xFLT, yFLT, zFLTA, zFLTB, zFLTC;
274
275 xFLT = 122.0;//cm
937fe4a4 276 yFLT = ytof;
2cef3cb2 277 zFLTA = zlenA - db*0.5;
278 zFLTB = zlenB - db*0.5;
279 zFLTC = zlenC - db*0.5;
280
937fe4a4 281// Sizes of MRPC pads
282
2cef3cb2 283 Float_t yPad = 0.505;//cm
3fe3a833 284
937fe4a4 285// Large not sensitive volumes with CO2
2cef3cb2 286 par[0] = xFLT*0.5;
287 par[1] = yFLT*0.5;
937fe4a4 288
3fe3a833 289 cout <<"************************* TOF geometry **************************"<<endl;
937fe4a4 290
2cef3cb2 291 par[2] = (zFLTA *0.5);
292 gMC->Gsvolu("FLTA", "BOX ", idtmed[506], par, 3); // CO2
293 gMC->Gspos ("FLTA", 0, "FTOA", 0., 0., 0., 0, "ONLY");
937fe4a4 294
2cef3cb2 295 par[2] = (zFLTB * 0.5);
296 gMC->Gsvolu("FLTB", "BOX ", idtmed[506], par, 3); // CO2
297 gMC->Gspos ("FLTB", 0, "FTOB", 0., 0., 0., 0, "ONLY");
937fe4a4 298
2cef3cb2 299 par[2] = (zFLTC * 0.5);
300 gMC->Gsvolu("FLTC", "BOX ", idtmed[506], par, 3); // CO2
301 gMC->Gspos ("FLTC", 0, "FTOC", 0., 0., 0., 0, "ONLY");
937fe4a4 302
3fe3a833 303////////// Layers before detector ////////////////////
937fe4a4 304
2cef3cb2 305// MYlar layer in front 1.0 mm thick at the beginning
3fe3a833 306 par[0] = -1;
2cef3cb2 307 par[1] = 0.1;//cm
3fe3a833 308 par[2] = -1;
937fe4a4 309 ycoor = -yFLT/2 + par[1];
2cef3cb2 310 gMC->Gsvolu("FMYA", "BOX ", idtmed[508], par, 3); // Alluminium
311 gMC->Gspos ("FMYA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
312 gMC->Gsvolu("FMYB", "BOX ", idtmed[508], par, 3); // Alluminium
313 gMC->Gspos ("FMYB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
314 gMC->Gsvolu("FMYC", "BOX ", idtmed[508], par, 3); // Alluminium
315 gMC->Gspos ("FMYC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
316
317// honeycomb (special Polyethilene Layer of 1cm)
3fe3a833 318 ycoor = ycoor + par[1];
319 par[0] = -1;
2cef3cb2 320 par[1] = 0.5;//cm
3fe3a833 321 par[2] = -1;
322 ycoor = ycoor + par[1];
2cef3cb2 323 gMC->Gsvolu("FPLA", "BOX ", idtmed[503], par, 3); // Hony
324 gMC->Gspos ("FPLA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
325 gMC->Gsvolu("FPLB", "BOX ", idtmed[503], par, 3); // Hony
326 gMC->Gspos ("FPLB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
327 gMC->Gsvolu("FPLC", "BOX ", idtmed[503], par, 3); // Hony
328 gMC->Gspos ("FPLC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
937fe4a4 329
3fe3a833 330///////////////// Detector itself //////////////////////
937fe4a4 331
2cef3cb2 332 const Float_t StripWidth = 10.0;//cm
333 const Float_t DeadBound = 1.5;//cm non-sensitive between the pad edge
334 //and the boundary of the strip
335 const Int_t nx = 48; // number of pads along x
336 const Int_t nz = 2; // number of pads along z
337 const Float_t Space= 5.5; //cm distance from the front plate of the box
937fe4a4 338
339 Float_t zSenStrip;
340 zSenStrip = StripWidth-2*DeadBound;//cm
341
826b71ec 342 par[0] = xFLT/2;
937fe4a4 343 par[1] = yPad/2;
344 par[2] = StripWidth/2.;
345
2cef3cb2 346 // glass layer of detector STRip
937fe4a4 347 gMC->Gsvolu("FSTR","BOX",idtmed[514],par,3);
348
2cef3cb2 349 // Non-Sesitive Freon boundaries
350 par[0] = xFLT*0.5;
351 par[1] = 0.110*0.5;//cm
3fe3a833 352 par[2] = -1;
937fe4a4 353 gMC->Gsvolu("FNSF","BOX",idtmed[512],par,3);
2cef3cb2 354 gMC->Gspos ("FNSF",0,"FSTR",0.,0.,0.,0,"ONLY");
355
356 // MYlar for Internal non-sesitive boundaries
357 par[1] = 0.025;//cm
937fe4a4 358 gMC->Gsvolu("FMYI","BOX",idtmed[510],par,3);
2cef3cb2 359 gMC->Gspos ("FMYI",0,"FNSF",0.,0.,0.,0,"ONLY");
937fe4a4 360
2cef3cb2 361 // MYlar eXternal layers
362 par[1] = 0.035*0.5;//cm
363 ycoor = -yPad*0.5+par[1];
937fe4a4 364 gMC->Gsvolu("FMYX","BOX",idtmed[510],par,3);
2cef3cb2 365 gMC->Gspos ("FMYX",1,"FSTR",0.,ycoor,0.,0,"ONLY");
366 gMC->Gspos ("FMYX",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
937fe4a4 367 ycoor += par[1];
368
2cef3cb2 369 // GRaphyte Layers
370 par[1] = 0.003*0.5;
937fe4a4 371 ycoor += par[1];
372 gMC->Gsvolu("FGRL","BOX",idtmed[502],par,3);
2cef3cb2 373 gMC->Gspos ("FGRL",1,"FSTR",0.,ycoor,0.,0,"ONLY");
374 gMC->Gspos ("FGRL",2,"FSTR",0.,-ycoor,0.,0,"ONLY");
937fe4a4 375
2cef3cb2 376 // freon sensitive layer (Chlorine-Fluorine-Carbon)
826b71ec 377 par[0] = -1;
2cef3cb2 378 par[1] = 0.110*0.5;
379 par[2] = zSenStrip*0.5;
937fe4a4 380 gMC->Gsvolu("FCFC","BOX",idtmed[513],par,3);
2cef3cb2 381 gMC->Gspos ("FCFC",0,"FNSF",0.,0.,0.,0,"ONLY");
937fe4a4 382
383 // Pad definition x & z
384 gMC->Gsdvn("FLZ","FCFC", nz, 3);
385 gMC->Gsdvn("FLX","FLZ" , nx, 1);
386
2cef3cb2 387 // MRPC PAD itself
388 par[0] = -1;
389 par[1] = -1;
390 par[2] = -1;
391 gMC->Gsvolu("FPAD", "BOX ", idtmed[513], par, 3);
392 gMC->Gspos ("FPAD", 0, "FLX", 0., 0., 0., 0, "ONLY");
393
937fe4a4 394//// Positioning the Strips (FSTR) in the FLT volumes /////
395
2cef3cb2 396 // Plate A (Central)
397
398 Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
399
400 Float_t Gap = 4.; //cm distance between the strip axis
937fe4a4 401 Float_t zpos = 0;
2cef3cb2 402 Float_t ang = 0;
937fe4a4 403 Float_t last;
937fe4a4 404 Int_t i=1,j=1;
2cef3cb2 405 nrot = 0;
406 zcoor = 0;
407 ycoor = -14.5 + Space ; //2 cm over front plate
408
409 AliMatrix (idrotm[0], 90., 0.,90.,90.,0., 90.);
410 gMC->Gspos("FSTR",j,"FLTA",0.,ycoor, 0.,idrotm[0],"ONLY");
411 zcoor -= zSenStrip;
412
413 j++;
414 Int_t UpDown = -1; // UpDown=-1 -> Upper strip
415 // UpDown=+1 -> Lower strip
937fe4a4 416 do{
2cef3cb2 417 ang = atan(zcoor/Radius);
418 ang *= kRaddeg;
826b71ec 419 AliMatrix (idrotm[nrot], 90., 0.,90.-ang,90.,-ang, 90.);
2cef3cb2 420 AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
421 ang /= kRaddeg;
937fe4a4 422 ycoor = -14.5+ Space; //2 cm over front plate
423 ycoor += (1-(UpDown+1)/2)*Gap;
2cef3cb2 424 gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY");
425 gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
426 j += 2;
937fe4a4 427 UpDown*= -1; // Alternate strips
2cef3cb2 428 zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
429 UpDown*Gap*TMath::Tan(ang)-
430 (zSenStrip/2)/TMath::Cos(ang);
431 } while (zcoor-(StripWidth/2)*TMath::Cos(ang)>-t+zFLTC+zFLTB+db*2);
937fe4a4 432
2cef3cb2 433 zcoor = zcoor+(zSenStrip/2)/TMath::Cos(ang)-
434 UpDown*Gap*TMath::Tan(ang)+
435 (zSenStrip/2)/TMath::Cos(ang);
436
437 Gap = 6.;
438 zcoor = zcoor-(zSenStrip/2)/TMath::Cos(ang)-
439 UpDown*Gap*TMath::Tan(ang)-
440 (zSenStrip/2)/TMath::Cos(ang);
441
442 ang = atan(zcoor/Radius);
443 ang *= kRaddeg;
444 AliMatrix (idrotm[nrot], 90., 0.,90.-ang,90.,-ang, 90.);
445 AliMatrix (idrotm[nrot+1],90.,180.,90.+ang,90., ang, 90.);
446 ang /= kRaddeg;
447
448 ycoor = -14.5+ Space; //2 cm over front plate
449 ycoor += (1-(UpDown+1)/2)*Gap;
450 gMC->Gspos("FSTR",j ,"FLTA",0.,ycoor, zcoor,idrotm[nrot], "ONLY");
451 gMC->Gspos("FSTR",j+1,"FLTA",0.,ycoor,-zcoor,idrotm[nrot+1],"ONLY");
452
453 ycoor = -29./2.+ Space;//2 cm over front plate
454
455 // Plate B
937fe4a4 456
937fe4a4 457 nrot = 0;
458 i=1;
2cef3cb2 459 UpDown *= -1;
460
461 zpos = zcoor - (zSenStrip/2)/TMath::Cos(ang)-
462 UpDown*Gap*TMath::Tan(ang)-
463 (zSenStrip/2)/TMath::Cos(ang)-0.5/TMath::Cos(ang);
464
465 ang = atan(zpos/Radius);
466 ang *= kRaddeg;
467 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
468 ang /= kRaddeg;
469 ycoor = -29.*0.5+ Space ; //2 cm over front plate
470 ycoor += (1-(UpDown+1)/2)*Gap;
471 zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
472 gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
473 i++;
474 UpDown*=-1;
937fe4a4 475
476 do {
2cef3cb2 477 zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)-
478 UpDown*Gap*TMath::Tan(ang)-
479 (zSenStrip/2)/TMath::Cos(ang);
480 ang = atan(zpos/Radius);
481 ang *= kRaddeg;
826b71ec 482 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
2cef3cb2 483 ang /= kRaddeg;
484 ycoor = -29.*0.5+ Space ; //2 cm over front plate
937fe4a4 485 ycoor += (1-(UpDown+1)/2)*Gap;
2cef3cb2 486 zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
487 gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
937fe4a4 488 UpDown*=-1;
2cef3cb2 489 i++;
490 } while (TMath::Abs(ang*kRaddeg)<22.5);//till we reach a tilting angle of 22.5 degrees
937fe4a4 491
2cef3cb2 492 ycoor = -29.*0.5+ Space ; //2 cm over front plate
493
494 do {
937fe4a4 495 i++;
2cef3cb2 496 ang = atan(zpos/Radius);
497 ang *= kRaddeg;
498 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
499 ang /= kRaddeg;
500 zcoor = zpos+(zFLTB/2+zFLTA/2+db);
501 gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
937fe4a4 502 zpos = zpos - zSenStrip/TMath::Cos(ang);
503 last = StripWidth*TMath::Cos(ang)/2.;
2cef3cb2 504 } while (zpos>-t+zFLTC+db);
505
506 // Plate C
507
508 zpos = zpos - (zSenStrip/2)/TMath::Cos(ang)-
509 Gap*TMath::Tan(ang)-
510 (zSenStrip/2)/TMath::Cos(ang);
511
512 nrot = 0;
513 i=0;
514 ycoor= -29.*0.5+Space+Gap;
937fe4a4 515
2cef3cb2 516 do {
517 i++;
518 ang = atan(zpos/Radius);
519 ang *= kRaddeg;
520 AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
521 ang /= kRaddeg;
522 zcoor = zpos+(zFLTC*0.5+zFLTB+zFLTA*0.5+db*2);
523 gMC->Gspos("FSTR",i, "FLTC", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
937fe4a4 524 zpos = zpos - zSenStrip/TMath::Cos(ang);
2cef3cb2 525 last = StripWidth*TMath::Cos(ang)*0.5;
526 } while (zpos>-t+last);
527
937fe4a4 528
529////////// Layers after detector /////////////////
530
2cef3cb2 531// honeycomb (Polyethilene) Layer after (3cm)
937fe4a4 532
2cef3cb2 533 Float_t OverSpace = 15.30;//cm
937fe4a4 534
535 par[0] = -1;
536 par[1] = 0.6;
3fe3a833 537 par[2] = -1;
937fe4a4 538 ycoor = -yFLT/2 + OverSpace + par[1];
2cef3cb2 539 gMC->Gsvolu("FPEA", "BOX ", idtmed[503], par, 3); // Hony
540 gMC->Gspos ("FPEA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
541 gMC->Gsvolu("FPEB", "BOX ", idtmed[503], par, 3); // Hony
542 gMC->Gspos ("FPEB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
543 gMC->Gsvolu("FPEC", "BOX ", idtmed[503], par, 3); // Hony
544 gMC->Gspos ("FPEC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
937fe4a4 545
546// Electronics (Cu) after
547 ycoor += par[1];
3fe3a833 548 par[0] = -1;
2cef3cb2 549 par[1] = 1.43*0.05*0.5; // 5% of X0
3fe3a833 550 par[2] = -1;
937fe4a4 551 ycoor += par[1];
2cef3cb2 552 gMC->Gsvolu("FECA", "BOX ", idtmed[501], par, 3); // Cu
553 gMC->Gspos ("FECA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
554 gMC->Gsvolu("FECB", "BOX ", idtmed[501], par, 3); // Cu
555 gMC->Gspos ("FECB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
556 gMC->Gsvolu("FECC", "BOX ", idtmed[501], par, 3); // Cu
557 gMC->Gspos ("FECC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
558
559// cooling WAter after
937fe4a4 560 ycoor += par[1];
3fe3a833 561 par[0] = -1;
2cef3cb2 562 par[1] = 36.1*0.02*0.5; // 2% of X0
3fe3a833 563 par[2] = -1;
937fe4a4 564 ycoor += par[1];
2cef3cb2 565 gMC->Gsvolu("FWAA", "BOX ", idtmed[515], par, 3); // Water
566 gMC->Gspos ("FWAA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
567 gMC->Gsvolu("FWAB", "BOX ", idtmed[515], par, 3); // Water
568 gMC->Gspos ("FWAB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
569 gMC->Gsvolu("FWAC", "BOX ", idtmed[515], par, 3); // Water
570 gMC->Gspos ("FWAC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
571
572//Back Plate honycomb (2cm)
3fe3a833 573 par[0] = -1;
2cef3cb2 574 par[1] = 2 *0.5;
3fe3a833 575 par[2] = -1;
937fe4a4 576 ycoor = yFLT/2 - par[1];
2cef3cb2 577 gMC->Gsvolu("FBPA", "BOX ", idtmed[503], par, 3); // Hony
578 gMC->Gspos ("FBPA", 0, "FLTA", 0., ycoor, 0., 0, "ONLY");
579 gMC->Gsvolu("FBPB", "BOX ", idtmed[503], par, 3); // Hony
580 gMC->Gspos ("FBPB", 0, "FLTB", 0., ycoor, 0., 0, "ONLY");
581 gMC->Gsvolu("FBPC", "BOX ", idtmed[503], par, 3); // Hony
582 gMC->Gspos ("FBPC", 0, "FLTC", 0., ycoor, 0., 0, "ONLY");
3fe3a833 583}
fe4da5cc 584
3fe3a833 585//_____________________________________________________________________________
586void AliTOFv0::DrawModule()
587{
588 //
937fe4a4 589 // Draw a shaded view of the Time Of Flight version 1
3fe3a833 590 //
fe4da5cc 591 // Set everything unseen
cfce8870 592 gMC->Gsatt("*", "seen", -1);
fe4da5cc 593 //
594 // Set ALIC mother transparent
cfce8870 595 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 596 //
597 // Set the volumes visible
3fe3a833 598 gMC->Gsatt("ALIC","SEEN",0);
2cef3cb2 599
600 gMC->Gsatt("FTOA","SEEN",1);
601 gMC->Gsatt("FTOB","SEEN",1);
602 gMC->Gsatt("FTOC","SEEN",1);
603 gMC->Gsatt("FLTA","SEEN",1);
604 gMC->Gsatt("FLTB","SEEN",1);
605 gMC->Gsatt("FLTC","SEEN",1);
606 gMC->Gsatt("FPLA","SEEN",1);
607 gMC->Gsatt("FPLB","SEEN",1);
608 gMC->Gsatt("FPLC","SEEN",1);
609 gMC->Gsatt("FSTR","SEEN",1);
610 gMC->Gsatt("FPEA","SEEN",1);
611 gMC->Gsatt("FPEB","SEEN",1);
612 gMC->Gsatt("FPEC","SEEN",1);
613
614 gMC->Gsatt("FLZ1","SEEN",0);
615 gMC->Gsatt("FLZ2","SEEN",0);
616 gMC->Gsatt("FLZ3","SEEN",0);
617 gMC->Gsatt("FLX1","SEEN",0);
618 gMC->Gsatt("FLX2","SEEN",0);
619 gMC->Gsatt("FLX3","SEEN",0);
620 gMC->Gsatt("FPAD","SEEN",0);
621
cfce8870 622 gMC->Gdopt("hide", "on");
623 gMC->Gdopt("shad", "on");
624 gMC->Gsatt("*", "fill", 7);
cfce8870 625 gMC->SetClipBox(".");
626 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
627 gMC->DefaultRange();
628 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
629 gMC->Gdhead(1111, "Time Of Flight");
630 gMC->Gdman(18, 4, "MAN");
631 gMC->Gdopt("hide","off");
fe4da5cc 632}
633
634//_____________________________________________________________________________
635void AliTOFv0::CreateMaterials()
636{
637 //
638 // Define materials for the Time Of Flight
639 //
640 AliTOF::CreateMaterials();
641}
642
643//_____________________________________________________________________________
644void AliTOFv0::Init()
645{
646 //
3fe3a833 647 // Initialise the detector after the geometry has been defined
fe4da5cc 648 //
ab76897d 649 printf("**************************************"
650 " TOF "
651 "**************************************\n");
2cef3cb2 652 printf("\n Version 0 of TOF initialing, "
653 "symmetric TOF\n");
ab76897d 654
fe4da5cc 655 AliTOF::Init();
ab76897d 656
2cef3cb2 657 fIdFTOA = gMC->VolId("FTOA");
658 fIdFTOB = gMC->VolId("FTOB");
659 fIdFTOC = gMC->VolId("FTOC");
660 fIdFLTA = gMC->VolId("FLTA");
661 fIdFLTB = gMC->VolId("FLTB");
662 fIdFLTC = gMC->VolId("FLTC");
ab76897d 663
664 printf("**************************************"
665 " TOF "
666 "**************************************\n");
fe4da5cc 667}
668
669//_____________________________________________________________________________
670void AliTOFv0::StepManager()
671{
672 //
673 // Procedure called at each step in the Time Of Flight
3fe3a833 674 //
826b71ec 675 Float_t hits[8],rho,phi,phid,z;
2cef3cb2 676 Int_t sector, plate, pad_x, pad_z, strip;
677 Int_t copy, pad_z_id, pad_x_id, strip_id, i;
678 Int_t vol[4];
679 Int_t *idtmed = fIdtmed->GetArray()-499;
680 TLorentzVector mom, pos;
826b71ec 681
682
683 if(gMC->GetMedium()==idtmed[513] &&
0a6d8768 684 gMC->IsTrackEntering() && gMC->TrackCharge()
826b71ec 685 && gMC->CurrentVolID(copy)==fIdSens)
2cef3cb2 686 {
687// getting information about hit volumes
826b71ec 688
689 pad_z_id=gMC->CurrentVolOffID(2,copy);
690 pad_z=copy;
691
692 pad_x_id=gMC->CurrentVolOffID(1,copy);
693 pad_x=copy;
694
695 strip_id=gMC->CurrentVolOffID(5,copy);
696 strip=copy;
697
698 pad_z = (strip-1)*2+pad_z;
699
0a6d8768 700 gMC->TrackPosition(pos);
701 gMC->TrackMomentum(mom);
826b71ec 702
703 rho = sqrt(pos[0]*pos[0]+pos[1]*pos[1]);
704 phi = TMath::ACos(pos[0]/rho);
705 Float_t as = TMath::ASin(pos[1]/rho);
706 if (as<0) phi = 2*3.141592654-phi;
707
708 z = pos[2];
709
2cef3cb2 710 plate = 0;
711 Float_t limA = fZlenA*0.5;
712 Float_t limB = fZlenB+limA;
713
714 if (TMath::Abs(z)<=limA) plate = 3;
715 if (z<= limB && z> limA) plate = 2;
716 if (z>=-limB && z<-limA) plate = 4;
717 if (z> limB) plate = 1;
718 if (z<-limB) plate = 5;
719
720 if (plate==3) pad_z -= 2;
826b71ec 721
2cef3cb2 722 phid = phi*kRaddeg;
826b71ec 723 sector = Int_t (phid/20.);
724 sector++;
725
2cef3cb2 726 Double_t ptot = mom.Rho();
727 Double_t norm = 1/ptot;
0a6d8768 728 for(i=0;i<3;++i) {
2cef3cb2 729 hits[i] = pos[i];
730 hits[i+3] = mom[i]*norm;
0a6d8768 731 }
2cef3cb2 732 hits[6] = ptot;
733 hits[7] = pos[3];
734
735 vol[0] = sector;
736 vol[1] = plate;
737 vol[2] = pad_x;
738 vol[3] = pad_z;
739
740 Int_t track = gAlice->CurrentTrack();
741 AliTOF::AddHit(track,vol, hits);
fe4da5cc 742 }
743}