Possibility to store and retrieve TGeo geometry to/from file (R.Grosso)
[u/mrichter/AliRoot.git] / STRUCT / AliHALL.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
eeacf08b 16/* $Id$ */
4c039060 17
fe4da5cc 18///////////////////////////////////////////////////////////////////////////////
19// //
20// Experimental Hall //
21// This class contains the description of the experimental hall //
22// //
23//Begin_Html
24/*
1439f98e 25<img src="picts/AliHALLClass.gif">
fe4da5cc 26</pre>
27<br clear=left>
28<font size=+2 color=red>
29<p>The responsible person for this module is
30<a href="mailto:andreas.morsch@cern.ch">Andreas Morsch</a>.
31</font>
32<pre>
33*/
34//End_Html
35// //
36// //
37///////////////////////////////////////////////////////////////////////////////
38
88cb7938 39#include <TVirtualMC.h>
40
41#include "AliConst.h"
fe4da5cc 42#include "AliHALL.h"
94de3818 43#include "AliMagF.h"
88cb7938 44#include "AliRun.h"
4951e003 45#include "AliLog.h"
fe4da5cc 46
47ClassImp(AliHALL)
48
49//_____________________________________________________________________________
b8032157 50AliHALL::AliHALL()
fe4da5cc 51{
52 //
53 // Default constructor for the experimental Hall
54 //
55}
56
57//_____________________________________________________________________________
58AliHALL::AliHALL(const char *name, const char *title)
b8032157 59 : AliModule(name,title)
fe4da5cc 60{
61 //
62 // Standard constructor for the experimental Hall
63 //
64 SetMarkerColor(7);
65 SetMarkerStyle(2);
66 SetMarkerSize(0.4);
67}
68
69//_____________________________________________________________________________
fe4da5cc 70void AliHALL::CreateGeometry()
71{
72 //
73 // Create the geometry of the exprimental hall
74 //
75 //Begin_Html
76 /*
1439f98e 77 <img src="picts/AliHALLTree.gif">
fe4da5cc 78 */
79 //End_Html
80 //
81 // If ZDC is not present the experimental hall includes a short
82 // section of the accelerator tunnel
83 //
84 //Begin_Html
85 /*
1439f98e 86 <img src="picts/AliHALLSmall.gif">
fe4da5cc 87 */
88 //End_Html
89 //
90 // If ZDC is present the experimental hall includes the accelerator
91 // tunnel beyond the ZDC
92 //
93 //Begin_Html
94 /*
1439f98e 95 <img src="picts/AliHALLLarge.gif">
fe4da5cc 96 */
97 //End_Html
98
99
fe4da5cc 100 Float_t r2;
9c671c0f 101 Float_t phid, phim, pbox[3], h, r, tspar[5];
fe4da5cc 102 Float_t w1, dh, am, bm, dl,cm, hm, dr, dx, xl;
103 Int_t idrotm[1999];
104 Float_t trdpar[4], trapar[11], hullen;
60404de7 105 Float_t phi;
fe4da5cc 106
ad51aeb0 107 Int_t *idtmed = fIdtmed->GetArray()-1899;
fe4da5cc 108
fe4da5cc 109 // RB24/26 TUNNEL FLOOR
110
111 r = 220.;
112 h = 140.;
113 phi = TMath::ACos(h / r);
114 xl = r * TMath::Sin(phi);
099f87ce 115 dr = 1600.;
fe4da5cc 116 dh = dr * TMath::Cos(phi);
117 dl = dr * TMath::Sin(phi);
b8032157 118 if (gAlice->GetModule("ZDC") == 0) {
fe4da5cc 119
120 // No ZDC
099f87ce 121 hullen = 370.;
fe4da5cc 122 } else {
123
124 // ZDC is present
099f87ce 125 hullen = 6520.;
fe4da5cc 126 }
127 trdpar[0] = xl + dl;
128 trdpar[1] = xl;
129 trdpar[2] = hullen;
130 trdpar[3] = dh / 2.;
131 AliMatrix(idrotm[1900], 90., 0., 0., 0., 90., 90.);
132 AliMatrix(idrotm[1901], 270., 0., 90., 90., 0., 0.);
cfce8870 133 gMC->Gsvolu("HUFL", "TRD1", idtmed[1956], trdpar, 4);
099f87ce 134 r2 = hullen + 1900.;
299e56a5 135 gMC->Gspos("HUFL", 1, "ALIC", 70.,-100-trdpar[3] , -r2, idrotm[1900], "ONLY");
fe4da5cc 136
137 // RB24/26 wall
138
139 phid = phi * 57.296;
140 tspar[0] = r;
141 tspar[1] = r + dr;
142 tspar[2] = hullen;
143 tspar[3] = phid - 90.;
144 tspar[4] = 270. - phid;
cfce8870 145 gMC->Gsvolu("HUWA", "TUBS", idtmed[1956], tspar, 5);
099f87ce 146 gMC->Gspos("HUWA", 1, "ALIC", 70., 40., -1900 - hullen , 0, "ONLY");
fe4da5cc 147
fe4da5cc 148 // END WALL
099f87ce 149 //gMC->Gsvolu("HEW1", "BOX ", idtmed[1956], pbox, 0);
150 //pbox[0] = 600.;
151 //pbox[1] = 418.;
152 //pbox[2] = 60.;
153 //gMC->Gsposp("HEW1", 1, "ALIC", 0., -pbox[1]-60., -1960, 0, "ONLY", pbox, 3);
154 //pbox[1] = 822.;
155 //gMC->Gsposp("HEW1", 2, "ALIC", 0., pbox[1]+60., -1960, 0, "ONLY", pbox, 3);
156 //pbox[0] = 270.;
157 //pbox[1] = 60.;
158 //gMC->Gsposp("HEW1", 3, "ALIC", pbox[0]+60., 0. , -1960, 0, "ONLY", pbox, 3);
159 //gMC->Gsposp("HEW1", 4, "ALIC", -pbox[0]-60., 0. , -1960, 0, "ONLY", pbox, 3);
9c671c0f 160
fe4da5cc 161 // hall floor
162
163 phid = 16.197;
164 trdpar[0] = 700.;
165 trdpar[1] = TMath::Tan(phid * kDegrad) * 190. + 700.;
166 trdpar[2] = 550.;
167 trdpar[3] = 95.;
cfce8870 168 gMC->Gsvolu("HHF1", "TRD1", idtmed[1956], trdpar, 4);
169 gMC->Gspos("HHF1", 1, "ALIC", 0., -801., 1350., idrotm[1900], "ONLY");
170 gMC->Gspos("HHF1", 2, "ALIC", 0., -801.,-1350., idrotm[1900], "ONLY");
fe4da5cc 171
172 // hall side walls
173
174 trapar[0] = 550.;
175 trapar[1] = 0.;
176 trapar[2] = 0.;
177 trapar[3] = 1273.78/2;
178 trapar[4] = 235.;
179 trapar[5] = 50.;
180 trapar[6] = TMath::ATan((trapar[4] - trapar[5]) / 2. / trapar[3]) * kRaddeg;
181 trapar[7] = trapar[3];
182 trapar[8] = trapar[4];
183 trapar[9] = trapar[5];
184 trapar[10] = trapar[6];
185 dx = trapar[4] * 1.5 + 700. - trapar[5] * .5;
cfce8870 186 gMC->Gsvolu("HHW1", "TRAP", idtmed[1956], trapar, 11);
187 gMC->Gspos("HHW1", 1, "ALIC", dx, -896+trapar[3], 1350., 0, "ONLY");
188 gMC->Gspos("HHW1", 2, "ALIC",-dx, -896+trapar[3], 1350., idrotm[1901], "ONLY");
189 gMC->Gspos("HHW1", 3, "ALIC", dx, -896+trapar[3], -1350., 0, "ONLY");
190 gMC->Gspos("HHW1", 4, "ALIC",-dx, -896+trapar[3], -1350., idrotm[1901], "ONLY");
fe4da5cc 191 pbox[0] = 50.;
192 pbox[1] = (500. - (trapar[3] * 2. - 896.)) / 2.;
193 pbox[2] = 1900.;
cfce8870 194 gMC->Gsvolu("HBW1", "BOX ", idtmed[1956], pbox, 3);
195 gMC->Gspos("HBW1", 1, "ALIC", 1120., 500-pbox[1], 0., 0, "ONLY");
196 gMC->Gspos("HBW1", 2, "ALIC", -1120., 500-pbox[1], 0., 0, "ONLY");
fe4da5cc 197
198 // slanted wall close to L3 magnet
199
200 phim = 45.;
201 hm = 790.;
202 //rm = hm / TMath::Cos(phim / 2. * kDegrad);
203 am = hm * TMath::Tan(phim / 2. * kDegrad);
204 bm = (hm + 76.) / hm * am;
205 cm = bm * 2. / TMath::Sqrt(2.);
206 trapar[0] = 800.;
207 trapar[1] = 0.;
208 trapar[2] = 0.;
209 trapar[3] = (1273.78 - cm) / 2.;
210 trapar[4] = 235. - cm * TMath::Tan(phid * kDegrad) / 2.;
211 trapar[5] = 50.;
212 trapar[6] = TMath::ATan((trapar[4] - trapar[5]) / 2. / trapar[3]) * kRaddeg;
213 trapar[7] = trapar[3];
214 trapar[8] = trapar[4];
215 trapar[9] = trapar[5];
216 trapar[10] = trapar[6];
217 w1 = trapar[4];
218 dx = cm*TMath::Tan(phid * kDegrad) + 700. + trapar[4] * 1.5 - trapar[5] * .5;
cfce8870 219 gMC->Gsvolu("HHW2", "TRAP", idtmed[1956], trapar, 11);
fe4da5cc 220 r2 = cm - 896. + trapar[3];
cfce8870 221 gMC->Gspos("HHW2", 1, "ALIC", dx, r2, 0., 0, "ONLY");
222 gMC->Gspos("HHW2", 2, "ALIC",-dx, r2, 0., idrotm[1901], "ONLY");
fe4da5cc 223 trapar[3] = cm / 2.;
224 trapar[4] = w1 + cm / 2.;
225 trapar[5] = w1;
226 trapar[6] = TMath::ATan(.5) * kRaddeg;
227 trapar[7] = trapar[3];
228 trapar[8] = trapar[4];
229 trapar[9] = trapar[5];
230 trapar[10] = trapar[6];
231 dx = 1170. - trapar[4] * .5 - trapar[5] * .5;
cfce8870 232 gMC->Gsvolu("HHW3", "TRAP", idtmed[1956], trapar, 11);
fe4da5cc 233 r2 = trapar[3] - 896.;
cfce8870 234 gMC->Gspos("HHW3", 1, "ALIC", dx, r2, 0., 0, "ONLY");
235 gMC->Gspos("HHW3", 2, "ALIC",-dx, r2, 0., idrotm[1901], "ONLY");
fe4da5cc 236
237
238 tspar[0] = 1070.;
239 tspar[1] = 1170.;
240 tspar[2] = 1900.;
241 tspar[3] = 0.;
242 tspar[4] = 180.;
cfce8870 243 gMC->Gsvolu("HHC1", "TUBS", idtmed[1956], tspar, 5);
244 gMC->Gspos("HHC1", 1, "ALIC", 0., 500., 0., 0, "ONLY");
fe4da5cc 245 trdpar[0] = 1170 - trapar[4] * 2.;
246 trdpar[1] = trdpar[0] + TMath::Tan(phim * kDegrad) * 76.;
247 trdpar[2] = 800.;
248 trdpar[3] = 38.;
cfce8870 249 gMC->Gsvolu("HHF2", "TRD1", idtmed[1956], trdpar, 4);
250 gMC->Gspos("HHF2", 1, "ALIC", 0., -858., 0., idrotm[1900], "ONLY");
fe4da5cc 251
252 // pillars for working platform
253
254 pbox[0] = 40.;
9b21f9d2 255 pbox[1] = 96.;
fe4da5cc 256 pbox[2] = 550.;
cfce8870 257 gMC->Gsvolu("HPIL", "BOX ", idtmed[1956], pbox, 3);
299e56a5 258 gMC->Gspos("HPIL", 1, "ALIC", 165.,-706+pbox[1] , -1350., 0, "ONLY");
259 gMC->Gspos("HPIL", 2, "ALIC",-165.,-706+pbox[1] , -1350., 0, "ONLY");
fe4da5cc 260
43707c21 261 // simple concrete beam shield
fe4da5cc 262
43707c21 263 Float_t ppgon[10];
264 ppgon[0] = 45.;
265 ppgon[1] = 360.;
266 ppgon[2] = 4.;
267 ppgon[3] = 2.;
299e56a5 268 ppgon[7] = 1800.;
43707c21 269 ppgon[8] = 150.;
270 ppgon[9] = 250.;
299e56a5 271 ppgon[4] = 720.;
272 ppgon[5] = 150.;
273 ppgon[6] = 250.;
43707c21 274
275 gMC->Gsvolu("HMBS", "PGON", idtmed[1956], ppgon, 10);
276 gMC->Gspos("HMBS", 1, "ALIC", 0., 70., 0., 0, "ONLY");
fe4da5cc 277}
278
279//_____________________________________________________________________________
280void AliHALL::CreateMaterials()
281{
282 //
283 // Create materials for the experimental hall
284 //
def952f1 285
286 Int_t isxfld = 0;
b43eb0dc 287 Float_t sxmgmx = gAlice->Field()->Max();
fe4da5cc 288
289 Float_t aconc[10] = { 1.,12.01,15.994,22.99,24.305,26.98,28.086,39.1,40.08,55.85 };
290 Float_t zconc[10] = { 1.,6.,8.,11.,12.,13.,14.,19.,20.,26. };
291 Float_t wconc[10] = { .01,.001,.529107,.016,.002,.033872,.337021,.013,.044,.014 };
292
002b3738 293 Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
294 Float_t zAir[4]={6.,7.,8.,18.};
295 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
296 Float_t dAir = 1.20479E-3;
297
fe4da5cc 298 Float_t epsil, stmin, deemax, tmaxfd, stemax;
299
300 // FOR CONCRETE
301
4a9de4af 302 AliMaterial(10, "IRON0$ ", 55.85, 26., 7.87, 1.76, 17.1);
303 AliMaterial(30, "IRON1$ ", 55.85, 26., 7.87, 1.76, 17.1);
304 AliMaterial(50, "IRON2$ ", 55.85, 26., 7.87, 1.76, 17.1);
002b3738 305
4a9de4af 306 AliMixture(15, "AIR0$ ", aAir, zAir, dAir, 4, wAir);
307 AliMixture(35, "AIR1$ ", aAir, zAir, dAir, 4, wAir);
308 AliMixture(55, "AIR2$ ", aAir, zAir, dAir, 4, wAir);
002b3738 309
4a9de4af 310 AliMixture(17, "CONCRETE0$", aconc, zconc, 2.35, 10, wconc);
311 AliMixture(37, "CONCRETE1$", aconc, zconc, 2.35, 10, wconc);
312 AliMixture(57, "CONCRETE2$", aconc, zconc, 2.35, 10, wconc);
fe4da5cc 313
314 // ****************
315 // Defines tracking media parameters.
316 // Les valeurs sont commentees pour laisser le defaut
317 // a GEANT (version 3-21, page CONS200), f.m.
318 epsil = .001; // Tracking precision,
319 stemax = -1.; // Maximum displacement for multiple scat
320 tmaxfd = -20.; // Maximum angle due to field deflection
321 deemax = -.3; // Maximum fractional energy loss, DLS
322 stmin = -.8;
323 // ***************
324
325 // IRON
326
b43eb0dc 327 AliMedium(10, "FE_C0 ", 10, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
328 AliMedium(30, "FE_C1 ", 30, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
329 AliMedium(50, "FE_C2 ", 50, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
fe4da5cc 330
331 // Air
332
b43eb0dc 333 AliMedium(15, "AIR_C0 ", 15, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
334 AliMedium(35, "AIR_C1 ", 35, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
335 AliMedium(55, "AIR_C2 ", 55, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
fe4da5cc 336
337 // Concrete
338
b43eb0dc 339 AliMedium(17, "CC_C0 ", 17, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
340 AliMedium(37, "CC_C1 ", 37, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
341 AliMedium(57, "CC_C2 ", 57, 0, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
fe4da5cc 342}
343
344//_____________________________________________________________________________
345void AliHALL::Init()
346{
347 //
348 // Initialise the HALL after it has been built
349 //
350 Int_t i;
351 //
4951e003 352 if(AliLog::GetGlobalDebugLevel()>0) {
9e1a0ddb 353 printf("\n%s: ",ClassName());
354 for(i=0;i<35;i++) printf("*");
355 printf(" HALL_INIT ");
356 for(i=0;i<35;i++) printf("*");
357 printf("\n%s: ",ClassName());
358 //
359 // Here the HALL initialisation code (if any!)
360 for(i=0;i<80;i++) printf("*");
361 printf("\n");
362 }
fe4da5cc 363}
364
365//_____________________________________________________________________________
eeacf08b 366void AliHALL::DrawModule() const
fe4da5cc 367{
368 //
369 // Draw a shaded view of Experimental Hall
370 //
371
fe4da5cc 372 // Set everything unseen
cfce8870 373 gMC->Gsatt("*", "seen", -1);
fe4da5cc 374 //
375 // Set ALIC mother transparent
cfce8870 376 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 377 //
378 // Set the volumes visible
cfce8870 379 gMC->Gsatt("HUFL","seen",1);
380 gMC->Gsatt("HUWA","seen",1);
381 gMC->Gsatt("HUP2","seen",1);
382 gMC->Gsatt("HEW1","seen",1);
383 gMC->Gsatt("HHF1","seen",1);
384 gMC->Gsatt("HHW1","seen",1);
385 gMC->Gsatt("HBW1","seen",1);
386 gMC->Gsatt("HHW2","seen",1);
387 gMC->Gsatt("HHW3","seen",1);
388 gMC->Gsatt("HHC1","seen",1);
389 gMC->Gsatt("HHF2","seen",1);
390 gMC->Gsatt("HPIL","seen",1);
391 gMC->Gsatt("HMBS","seen",1);
392 gMC->Gsatt("HBBS","seen",1);
393 gMC->Gsatt("HPBS","seen",1);
394 gMC->Gsatt("HXFI","seen",1);
395 gMC->Gsatt("HXII","seen",1);
fe4da5cc 396 //
cfce8870 397 gMC->Gdopt("hide", "on");
398 gMC->Gdopt("shad", "on");
399 gMC->Gsatt("*", "fill", 7);
400 gMC->SetClipBox(".");
b8032157 401 if (gAlice->GetModule("ZDC") == 0) {
fe4da5cc 402 //
403 // ZDC is not present
404 //
cfce8870 405 gMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
406 gMC->DefaultRange();
407 gMC->Gdraw("alic", 40, 30, 0, 12, 7.5, .005, .005);
fe4da5cc 408 } else {
409 //
410 // ZDC is present
411 //
cfce8870 412 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 16000);
413 gMC->DefaultRange();
414 gMC->Gdraw("alic", 40, 30, 0, 17.5, 10, .0019, .0019);
fe4da5cc 415 }
cfce8870 416 gMC->Gdhead(1111, "Experimental Hall");
417 gMC->Gdman(18, 2, "MAN");
fe4da5cc 418}
419