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