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