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