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