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