Updated macro to generate spectators
[u/mrichter/AliRoot.git] / ZDC / AliZDCv1.cxx
CommitLineData
68ca986e 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
88cb7938 16/* $Id$ */
68ca986e 17
18///////////////////////////////////////////////////////////////////////////////
19// //
47388856 20// AliZDCv1 --- ZDC geometry as designed in TDR (obsolete!) //
21// with the EM ZDC at 116 m from IP //
22// Just one set of ZDC is inserted, on the same side of the dimuon arm //
68ca986e 23// //
24///////////////////////////////////////////////////////////////////////////////
25
cc9c0243 26// --- Standard libraries
27#include "stdio.h"
28
5ce39387 29// --- ROOT system
68ca986e 30#include <TBRIK.h>
88cb7938 31#include <TLorentzVector.h>
68ca986e 32#include <TMath.h>
88cb7938 33#include <TNode.h>
5ce39387 34#include <TRandom.h>
866ab5a2 35#include <TSystem.h>
5ce39387 36#include <TTree.h>
88cb7938 37#include <TVirtualMC.h>
5ce39387 38
39// --- AliRoot classes
88cb7938 40#include "AliConst.h"
5ce39387 41#include "AliDetector.h"
94de3818 42#include "AliMagF.h"
68ca986e 43#include "AliPDG.h"
88cb7938 44#include "AliRun.h"
45#include "AliZDCHit.h"
46#include "AliZDCv1.h"
5d12ce38 47#include "AliMC.h"
68ca986e 48
49
50ClassImp(AliZDCv1)
51
68ca986e 52//_____________________________________________________________________________
53AliZDCv1::AliZDCv1() : AliZDC()
54{
55 //
56 // Default constructor for Zero Degree Calorimeter
57 //
5ce39387 58
866ab5a2 59 fMedSensF1 = 0;
60 fMedSensF2 = 0;
61 fMedSensZN = 0;
62 fMedSensZP = 0;
866ab5a2 63 fMedSensZEM = 0;
5a881c97 64 fMedSensGR = 0;
de28527d 65// fMedSensPI = 0;
66// fMedSensTDI = 0;
68ca986e 67}
68
69//_____________________________________________________________________________
70AliZDCv1::AliZDCv1(const char *name, const char *title)
71 : AliZDC(name,title)
72{
73 //
74 // Standard constructor for Zero Degree Calorimeter
75 //
a2216698 76 //
77 // Check that DIPO, ABSO, DIPO and SHIL is there (otherwise tracking is wrong!!!)
78
c6937a87 79 AliModule *pipe=gAlice->GetModule("PIPE");
80 AliModule *abso=gAlice->GetModule("ABSO");
81 AliModule *dipo=gAlice->GetModule("DIPO");
82 AliModule *shil=gAlice->GetModule("SHIL");
83 if((!pipe) || (!abso) || (!dipo) || (!shil)) {
a2216698 84 Error("Constructor","ZDC needs PIPE, ABSO, DIPO and SHIL!!!\n");
85 exit(1);
86 }
5ce39387 87
866ab5a2 88 fMedSensF1 = 0;
89 fMedSensF2 = 0;
90 fMedSensZN = 0;
91 fMedSensZP = 0;
866ab5a2 92 fMedSensZEM = 0;
5a881c97 93 fMedSensGR = 0;
de28527d 94// fMedSensPI = 0;
95// fMedSensTDI = 0;
5a881c97 96
97
98 // Parameters for light tables
99 fNalfan = 90; // Number of Alfa (neutrons)
100 fNalfap = 90; // Number of Alfa (protons)
101 fNben = 18; // Number of beta (neutrons)
102 fNbep = 28; // Number of beta (protons)
103 Int_t ip,jp,kp;
104 for(ip=0; ip<4; ip++){
105 for(kp=0; kp<fNalfap; kp++){
106 for(jp=0; jp<fNbep; jp++){
107 fTablep[ip][kp][jp] = 0;
108 }
109 }
110 }
111 Int_t in,jn,kn;
112 for(in=0; in<4; in++){
113 for(kn=0; kn<fNalfan; kn++){
114 for(jn=0; jn<fNben; jn++){
115 fTablen[in][kn][jn] = 0;
116 }
117 }
118 }
119
120 // Parameters for hadronic calorimeters geometry
121 fDimZP[0] = 11.2;
122 fDimZP[1] = 6.;
123 fDimZP[2] = 75.;
124 fPosZN[0] = 0.;
47388856 125 fPosZN[1] = 1.2;
5a881c97 126 fPosZN[2] = 11650.;
a2216698 127 fPosZP[0] = -24.;
5a881c97 128 fPosZP[1] = 0.;
129 fPosZP[2] = 11600.;
130 fFibZN[0] = 0.;
131 fFibZN[1] = 0.01825;
132 fFibZN[2] = 50.;
133 fFibZP[0] = 0.;
134 fFibZP[1] = 0.0275;
135 fFibZP[2] = 75.;
136
137 // Parameters for EM calorimeter geometry
138 fPosZEM[0] = 0.;
139 fPosZEM[1] = 5.8;
140 fPosZEM[2] = 11600.;
141
68ca986e 142}
143
144//_____________________________________________________________________________
145void AliZDCv1::CreateGeometry()
146{
147 //
148 // Create the geometry for the Zero Degree Calorimeter version 1
149 //* Initialize COMMON block ZDC_CGEOM
150 //*
151
152 CreateBeamLine();
153 CreateZDC();
154}
155
156//_____________________________________________________________________________
157void AliZDCv1::CreateBeamLine()
158{
c6937a87 159 //
160 // Create the beam line elements
161 //
162
a2216698 163 Float_t zq, zd1, zd2;
164 Float_t conpar[9], tubpar[3], tubspar[5], boxpar[3];
68ca986e 165 Int_t im1, im2;
68ca986e 166
167 Int_t *idtmed = fIdtmed->GetArray();
168
a2216698 169 // -- Mother of the ZDCs (Vacuum PCON)
68ca986e 170
171 conpar[0] = 0.;
172 conpar[1] = 360.;
173 conpar[2] = 2.;
0014adbc 174 conpar[3] = 2000.;
68ca986e 175 conpar[4] = 0.;
176 conpar[5] = 55.;
177 conpar[6] = 13060.;
178 conpar[7] = 0.;
179 conpar[8] = 55.;
a2216698 180 gMC->Gsvolu("ZDC ", "PCON", idtmed[11], conpar, 9);
68ca986e 181 gMC->Gspos("ZDC ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
182
183 // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to
a2216698 184 // the beginning of D1)
68ca986e 185
0014adbc 186 zd1 = 2000.;
68ca986e 187
188 tubpar[0] = 6.3/2.;
189 tubpar[1] = 6.7/2.;
0014adbc 190 tubpar[2] = 3838.3/2.;
a2216698 191 gMC->Gsvolu("QT01", "TUBE", idtmed[7], tubpar, 3);
192 gMC->Gspos("QT01", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
193
194 //-- SECOND SECTION OF THE BEAM PIPE (from the end of D1 to the
195 // beginning of D2)
196
197 //-- FROM MAGNETIC BEGINNING OF D1 TO MAGNETIC END OF D1 + 13.5 cm
198 //-- Cylindrical pipe (r = 3.47) + conical flare
199
200 // -> Beginning of D1
201 zd1 += 2.*tubpar[2];
202
203 tubpar[0] = 3.47;
204 tubpar[1] = 3.47+0.2;
205 tubpar[2] = 958.5/2.;
206 gMC->Gsvolu("QT02", "TUBE", idtmed[7], tubpar, 3);
207 gMC->Gspos("QT02", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
208
209 zd1 += 2.*tubpar[2];
68ca986e 210
211 conpar[0] = 25./2.;
212 conpar[1] = 6.44/2.;
213 conpar[2] = 6.84/2.;
214 conpar[3] = 10./2.;
215 conpar[4] = 10.4/2.;
a2216698 216 gMC->Gsvolu("QC01", "CONE", idtmed[7], conpar, 5);
217 gMC->Gspos("QC01", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
68ca986e 218
219 zd1 += 2.*conpar[0];
220
221 tubpar[0] = 10./2.;
222 tubpar[1] = 10.4/2.;
223 tubpar[2] = 50./2.;
a2216698 224 gMC->Gsvolu("QT03", "TUBE", idtmed[7], tubpar, 3);
225 gMC->Gspos("QT03", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
68ca986e 226
5a881c97 227 zd1 += tubpar[2]*2.;
68ca986e 228
229 tubpar[0] = 10./2.;
230 tubpar[1] = 10.4/2.;
231 tubpar[2] = 10./2.;
a2216698 232 gMC->Gsvolu("QT04", "TUBE", idtmed[7], tubpar, 3);
233 gMC->Gspos("QT04", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
68ca986e 234
235 zd1 += tubpar[2] * 2.;
236
237 tubpar[0] = 10./2.;
238 tubpar[1] = 10.4/2.;
239 tubpar[2] = 3.16/2.;
a2216698 240 gMC->Gsvolu("QT05", "TUBE", idtmed[7], tubpar, 3);
241 gMC->Gspos("QT05", 1, "ZDC ", 0., 0., tubpar[0] + zd1, 0, "ONLY");
68ca986e 242
243 zd1 += tubpar[2] * 2.;
244
245 tubpar[0] = 10.0/2.;
246 tubpar[1] = 10.4/2;
247 tubpar[2] = 190./2.;
a2216698 248 gMC->Gsvolu("QT06", "TUBE", idtmed[7], tubpar, 3);
249 gMC->Gspos("QT06", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
68ca986e 250
251 zd1 += tubpar[2] * 2.;
252
253 conpar[0] = 30./2.;
254 conpar[1] = 10./2.;
255 conpar[2] = 10.4/2.;
256 conpar[3] = 20.6/2.;
257 conpar[4] = 21./2.;
a2216698 258 gMC->Gsvolu("QC02", "CONE", idtmed[7], conpar, 5);
259 gMC->Gspos("QC02", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
68ca986e 260
261 zd1 += conpar[0] * 2.;
262
263 tubpar[0] = 20.6/2.;
264 tubpar[1] = 21./2.;
265 tubpar[2] = 450./2.;
a2216698 266 gMC->Gsvolu("QT07", "TUBE", idtmed[7], tubpar, 3);
267 gMC->Gspos("QT07", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
68ca986e 268
269 zd1 += tubpar[2] * 2.;
270
271 conpar[0] = 13.6/2.;
272 conpar[1] = 20.6/2.;
273 conpar[2] = 21./2.;
274 conpar[3] = 25.4/2.;
275 conpar[4] = 25.8/2.;
a2216698 276 gMC->Gsvolu("QC03", "CONE", idtmed[7], conpar, 5);
277 gMC->Gspos("QC03", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
68ca986e 278
279 zd1 += conpar[0] * 2.;
280
281 tubpar[0] = 25.4/2.;
282 tubpar[1] = 25.8/2.;
283 tubpar[2] = 205.8/2.;
a2216698 284 gMC->Gsvolu("QT08", "TUBE", idtmed[7], tubpar, 3);
285 gMC->Gspos("QT08", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
68ca986e 286
287 zd1 += tubpar[2] * 2.;
288
289 tubpar[0] = 50./2.;
290 tubpar[1] = 50.4/2.;
a2216698 291 // QT09 is 10 cm longer to accomodate TDI
292 tubpar[2] = 515.4/2.;
293 gMC->Gsvolu("QT09", "TUBE", idtmed[7], tubpar, 3);
47388856 294 gMC->Gspos("QT09", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
7cc664ae 295
a2216698 296 // --- Insert TDI (inside ZDC volume)
297
298 boxpar[0] = 5.6;
299 boxpar[1] = 5.6;
300 boxpar[2] = 400./2.;
301 gMC->Gsvolu("QTD1", "BOX ", idtmed[7], boxpar, 3);
7cc664ae 302 gMC->Gspos("QTD1", 1, "ZDC ", 3., 10.6, tubpar[2] + zd1 + 56.3, 0, "ONLY");
303 gMC->Gspos("QTD1", 2, "ZDC ", 3., -10.6, tubpar[2] + zd1 + 56.3, 0, "ONLY");
a2216698 304
305 boxpar[0] = 0.2/2.;
306 boxpar[1] = 5.6;
307 boxpar[2] = 400./2.;
308 gMC->Gsvolu("QTD2", "BOX ", idtmed[6], boxpar, 3);
7cc664ae 309 gMC->Gspos("QTD2", 1, "ZDC ", 8.6+boxpar[0], 0., tubpar[2] + zd1 + 56.3, 0, "ONLY");
a2216698 310
6d5d9c06 311// tubspar[0] = 6.2; // R = 6.2 cm----------------------------------------
312// tubspar[1] = 6.4;
7cc664ae 313// tubspar[2] = 400./2.;
6d5d9c06 314// tubspar[3] = 180.-62.5;
315// tubspar[4] = 180.+62.5;
316 tubspar[0] = 10.5; // R = 10.5 cm------------------------------------------
317 tubspar[1] = 10.7;
318 tubspar[2] = 400./2.;
319 tubspar[3] = 180.-75.5;
320 tubspar[4] = 180.+75.5;
a2216698 321 gMC->Gsvolu("QTD3", "TUBS", idtmed[6], tubspar, 5);
7cc664ae 322 gMC->Gspos("QTD3", 1, "ZDC ", 0., 0., tubpar[2] + zd1 + 56.3, 0, "ONLY");
a2216698 323
68ca986e 324 zd1 += tubpar[2] * 2.;
325
326 tubpar[0] = 50./2.;
327 tubpar[1] = 50.4/2.;
a2216698 328 // QT10 is 10 cm shorter
329 tubpar[2] = 690./2.;
330 gMC->Gsvolu("QT10", "TUBE", idtmed[7], tubpar, 3);
331 gMC->Gspos("QT10", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
68ca986e 332
333 zd1 += tubpar[2] * 2.;
334
335 tubpar[0] = 50./2.;
336 tubpar[1] = 50.4/2.;
337 tubpar[2] = 778.5/2.;
a2216698 338 gMC->Gsvolu("QT11", "TUBE", idtmed[7], tubpar, 3);
339 gMC->Gspos("QT11", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
68ca986e 340
341 zd1 += tubpar[2] * 2.;
342
343 conpar[0] = 14.18/2.;
344 conpar[1] = 50./2.;
345 conpar[2] = 50.4/2.;
346 conpar[3] = 55./2.;
347 conpar[4] = 55.4/2.;
a2216698 348 gMC->Gsvolu("QC04", "CONE", idtmed[7], conpar, 5);
349 gMC->Gspos("QC04", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
68ca986e 350
351 zd1 += conpar[0] * 2.;
352
353 tubpar[0] = 55./2.;
354 tubpar[1] = 55.4/2.;
355 tubpar[2] = 730./2.;
a2216698 356 gMC->Gsvolu("QT12", "TUBE", idtmed[7], tubpar, 3);
357 gMC->Gspos("QT12", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
68ca986e 358
359 zd1 += tubpar[2] * 2.;
360
361 conpar[0] = 36.86/2.;
362 conpar[1] = 55./2.;
363 conpar[2] = 55.4/2.;
364 conpar[3] = 68./2.;
365 conpar[4] = 68.4/2.;
a2216698 366 gMC->Gsvolu("QC05", "CONE", idtmed[7], conpar, 5);
367 gMC->Gspos("QC05", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
68ca986e 368
369 zd1 += conpar[0] * 2.;
370
371 tubpar[0] = 68./2.;
372 tubpar[1] = 68.4/2.;
373 tubpar[2] = 927.3/2.;
a2216698 374 gMC->Gsvolu("QT13", "TUBE", idtmed[7], tubpar, 3);
375 gMC->Gspos("QT13", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
68ca986e 376
377 zd1 += tubpar[2] * 2.;
378
379 tubpar[0] = 0./2.;
380 tubpar[1] = 68.4/2.;
381 tubpar[2] = 0.2/2.;
a2216698 382 gMC->Gsvolu("QT14", "TUBE", idtmed[8], tubpar, 3);
383 gMC->Gspos("QT14", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
68ca986e 384
385 zd1 += tubpar[2] * 2.;
386
387 tubpar[0] = 0./2.;
a2216698 388 tubpar[1] = 6.4/2.;
68ca986e 389 tubpar[2] = 0.2/2.;
a2216698 390 gMC->Gsvolu("QT15", "TUBE", idtmed[11], tubpar, 3);
68ca986e 391
a2216698 392 //-- Position QT15 inside QT14
393 gMC->Gspos("QT15", 1, "QT14", -7.7, 0., 0., 0, "ONLY");
68ca986e 394
395 tubpar[0] = 0./2.;
a2216698 396 tubpar[1] = 6.4/2.;
68ca986e 397 tubpar[2] = 0.2/2.;
a2216698 398 gMC->Gsvolu("QT16", "TUBE", idtmed[11], tubpar, 3);
399
400 //-- Position QT16 inside QT14
401 gMC->Gspos("QT16", 1, "QT14", 7.7, 0., 0., 0, "ONLY");
68ca986e 402
68ca986e 403
404 //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2
405
a2216698 406 tubpar[0] = 6.4/2.;
407 tubpar[1] = 6.8/2.;
408 tubpar[2] = 680.8/2.;
409 gMC->Gsvolu("QT17", "TUBE", idtmed[7], tubpar, 3);
68ca986e 410
a2216698 411 tubpar[0] = 6.4/2.;
412 tubpar[1] = 6.8/2.;
413 tubpar[2] = 680.8/2.;
414 gMC->Gsvolu("QT18", "TUBE", idtmed[7], tubpar, 3);
68ca986e 415
416 // -- ROTATE PIPES
417
a2216698 418 Float_t angle = 0.143*kDegrad;
68ca986e 419
a2216698 420 AliMatrix(im1, 90.-0.143, 0., 90., 90., 0.143, 180.);
421 gMC->Gspos("QT17", 1, "ZDC ", TMath::Sin(angle) * 680.8/ 2. - 9.4,
422 0., tubpar[2] + zd1, im1, "ONLY");
423
424 AliMatrix(im2, 90.+0.143, 0., 90., 90., 0.143, 0.);
425 gMC->Gspos("QT18", 1, "ZDC ", 9.7 - TMath::Sin(angle) * 680.8 / 2.,
426 0., tubpar[2] + zd1, im2, "ONLY");
427
428
429 // -- END OF BEAM PIPE VOLUME DEFINITION.
430 // ----------------------------------------------------------------
431
432 // -- MAGNET DEFINITION -> LHC OPTICS 6.2 (preliminary version)
68ca986e 433
0014adbc 434 // ----------------------------------------------------------------
435 // Replaced by the muon dipole
436 // ----------------------------------------------------------------
68ca986e 437 // -- COMPENSATOR DIPOLE (MBXW)
438 // GAP (VACUUM WITH MAGNETIC FIELD)
439
5ce39387 440// tubpar[0] = 0.;
441// tubpar[1] = 4.5;
442// tubpar[2] = 340./2.;
443// gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3);
444// gMC->Gspos("MBXW", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
68ca986e 445
446 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
447
5ce39387 448// tubpar[0] = 4.5;
449// tubpar[1] = 55.;
450// tubpar[2] = 340./2.;
a2216698 451// gMC->Gsvolu("YMBX", "TUBE", idtmed[7], tubpar, 3);
5ce39387 452// gMC->Gspos("YMBX", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
68ca986e 453
0014adbc 454 // ----------------------------------------------------------------
a2216698 455 // Replaced by the second dipole
0014adbc 456 // ----------------------------------------------------------------
68ca986e 457 // -- COMPENSATOR DIPOLE (MCBWA)
458 // GAP (VACUUM WITH MAGNETIC FIELD)
459
0014adbc 460// tubpar[0] = 0.;
461// tubpar[1] = 4.5;
462// tubpar[2] = 170./2.;
463// gMC->Gsvolu("MCBW", "TUBE", idtmed[11], tubpar, 3);
464// gMC->Gspos("MCBW", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
68ca986e 465
466 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
467
0014adbc 468// tubpar[0] = 4.5;
469// tubpar[1] = 55.;
470// tubpar[2] = 170./2.;
a2216698 471// gMC->Gsvolu("YMCB", "TUBE", idtmed[7], tubpar, 3);
0014adbc 472// gMC->Gspos("YMCB", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
68ca986e 473
474 // -- INNER TRIPLET
475
a2216698 476 zq = 2296.5;
68ca986e 477
478 // -- DEFINE MQXL AND MQX QUADRUPOLE ELEMENT
479
480 // MQXL
481 // -- GAP (VACUUM WITH MAGNETIC FIELD)
482
483 tubpar[0] = 0.;
484 tubpar[1] = 3.5;
a2216698 485 tubpar[2] = 637./2.;
68ca986e 486 gMC->Gsvolu("MQXL", "TUBE", idtmed[11], tubpar, 3);
487
488 // -- YOKE
489
490 tubpar[0] = 3.5;
491 tubpar[1] = 22.;
a2216698 492 tubpar[2] = 637./2.;
493 gMC->Gsvolu("YMQL", "TUBE", idtmed[7], tubpar, 3);
68ca986e 494
495 gMC->Gspos("MQXL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
496 gMC->Gspos("YMQL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
497
498 gMC->Gspos("MQXL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
499 gMC->Gspos("YMQL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
500
501 // -- MQX
502 // -- GAP (VACUUM WITH MAGNETIC FIELD)
503
504 tubpar[0] = 0.;
505 tubpar[1] = 3.5;
506 tubpar[2] = 550./2.;
507 gMC->Gsvolu("MQX ", "TUBE", idtmed[11], tubpar, 3);
508
509 // -- YOKE
510
511 tubpar[0] = 3.5;
512 tubpar[1] = 22.;
513 tubpar[2] = 550./2.;
a2216698 514 gMC->Gsvolu("YMQ ", "TUBE", idtmed[7], tubpar, 3);
68ca986e 515
a2216698 516 gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 883.5, 0, "ONLY");
517 gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 883.5, 0, "ONLY");
68ca986e 518
a2216698 519 gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1533.5, 0, "ONLY");
520 gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1533.5, 0, "ONLY");
68ca986e 521
522 // -- SEPARATOR DIPOLE D1
523
524 zd1 = 5838.3;
525
526 // -- GAP (VACUUM WITH MAGNETIC FIELD)
527
528 tubpar[0] = 0.;
a2216698 529 tubpar[1] = 6.94/2.;
68ca986e 530 tubpar[2] = 945./2.;
a2216698 531 gMC->Gsvolu("MD1 ", "TUBE", idtmed[11], tubpar, 3);
532
533 // -- Insert horizontal Cu plates inside D1
534 // -- (to simulate the vacuum chamber)
68ca986e 535
a2216698 536 boxpar[0] = TMath::Sqrt(tubpar[1]*tubpar[1]-(2.98+0.2)*(2.98+0.2));
537 boxpar[1] = 0.2/2.;
538 boxpar[2] =945./2.;
539 gMC->Gsvolu("MD1V", "BOX ", idtmed[6], boxpar, 3);
540 gMC->Gspos("MD1V", 1, "MD1 ", 0., 2.98+boxpar[1], 0., 0, "ONLY");
541 gMC->Gspos("MD1V", 2, "MD1 ", 0., -2.98-boxpar[1], 0., 0, "ONLY");
542
68ca986e 543 // -- YOKE
544
545 tubpar[0] = 0.;
546 tubpar[1] = 110./2;
547 tubpar[2] = 945./2.;
a2216698 548 gMC->Gsvolu("YD1 ", "TUBE", idtmed[7], tubpar, 3);
68ca986e 549
550 gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
a2216698 551 gMC->Gspos("MD1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
68ca986e 552
553 // -- DIPOLE D2
554
555 zd2 = 12147.6;
556
557 // -- GAP (VACUUM WITH MAGNETIC FIELD)
558
559 tubpar[0] = 0.;
560 tubpar[1] = 7.5/2.;
561 tubpar[2] = 945./2.;
a2216698 562 gMC->Gsvolu("MD2 ", "TUBE", idtmed[11], tubpar, 3);
68ca986e 563
564 // -- YOKE
565
566 tubpar[0] = 0.;
567 tubpar[1] = 55.;
568 tubpar[2] = 945./2.;
a2216698 569 gMC->Gsvolu("YD2 ", "TUBE", idtmed[7], tubpar, 3);
68ca986e 570
571 gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., tubpar[2] + zd2, 0, "ONLY");
572
a2216698 573 gMC->Gspos("MD2 ", 1, "YD2 ", -9.4, 0., 0., 0, "ONLY");
574 gMC->Gspos("MD2 ", 2, "YD2 ", 9.4, 0., 0., 0, "ONLY");
68ca986e 575
576 // -- END OF MAGNET DEFINITION
577}
578
579//_____________________________________________________________________________
580void AliZDCv1::CreateZDC()
581{
c6937a87 582 //
583 // Create the various ZDCs (ZN + ZP)
584 //
68ca986e 585
c6937a87 586 Float_t dimPb[6], dimVoid[6];
5a881c97 587
588 Int_t *idtmed = fIdtmed->GetArray();
589
590 // Parameters for hadronic calorimeters geometry
591 // NB -> parameters used ONLY in CreateZDC()
592 Float_t fDimZN[3] = {3.52, 3.52, 50.}; // Dimensions of neutron detector
593 Float_t fGrvZN[3] = {0.03, 0.03, 50.}; // Grooves for neutron detector
594 Float_t fGrvZP[3] = {0.04, 0.04, 75.}; // Grooves for proton detector
595 Int_t fDivZN[3] = {11, 11, 0}; // Division for neutron detector
596 Int_t fDivZP[3] = {7, 15, 0}; // Division for proton detector
597 Int_t fTowZN[2] = {2, 2}; // Tower for neutron detector
598 Int_t fTowZP[2] = {4, 1}; // Tower for proton detector
599
600 // Parameters for EM calorimeter geometry
601 // NB -> parameters used ONLY in CreateZDC()
602 Float_t fDimZEMPb = 0.15*(TMath::Sqrt(2.)); // z-dimension of the Pb slice
603 Float_t fDimZEMAir = 0.001; // scotch
604 Float_t fFibRadZEM = 0.0315; // External fiber radius (including cladding)
605 Int_t fDivZEM[3] = {92, 0, 20}; // Divisions for EM detector
606 Float_t fDimZEM0 = 2*fDivZEM[2]*(fDimZEMPb+fDimZEMAir+fFibRadZEM*(TMath::Sqrt(2.)));
607 Float_t fDimZEM[6] = {fDimZEM0, 3.5, 3.5, 45., 0., 0.}; // Dimensions of EM detector
608 Float_t fFibZEM2 = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-fFibRadZEM;
609 Float_t fFibZEM[3] = {0., 0.0275, fFibZEM2}; // Fibers for EM calorimeter
866ab5a2 610
68ca986e 611
612 //-- Create calorimeters geometry
613
a2216698 614 // -------------------------------------------------------------------------------
68ca986e 615 //--> Neutron calorimeter (ZN)
616
617 gMC->Gsvolu("ZNEU", "BOX ", idtmed[1], fDimZN, 3); // Passive material
618 gMC->Gsvolu("ZNF1", "TUBE", idtmed[3], fFibZN, 3); // Active material
619 gMC->Gsvolu("ZNF2", "TUBE", idtmed[4], fFibZN, 3);
620 gMC->Gsvolu("ZNF3", "TUBE", idtmed[4], fFibZN, 3);
621 gMC->Gsvolu("ZNF4", "TUBE", idtmed[3], fFibZN, 3);
622 gMC->Gsvolu("ZNG1", "BOX ", idtmed[12], fGrvZN, 3); // Empty grooves
623 gMC->Gsvolu("ZNG2", "BOX ", idtmed[12], fGrvZN, 3);
624 gMC->Gsvolu("ZNG3", "BOX ", idtmed[12], fGrvZN, 3);
625 gMC->Gsvolu("ZNG4", "BOX ", idtmed[12], fGrvZN, 3);
626
627 // Divide ZNEU in towers (for hits purposes)
628
629 gMC->Gsdvn("ZNTX", "ZNEU", fTowZN[0], 1); // x-tower
630 gMC->Gsdvn("ZN1 ", "ZNTX", fTowZN[1], 2); // y-tower
631
632 //-- Divide ZN1 in minitowers
633 // fDivZN[0]= NUMBER OF FIBERS PER TOWER ALONG X-AXIS,
634 // fDivZN[1]= NUMBER OF FIBERS PER TOWER ALONG Y-AXIS
635 // (4 fibres per minitower)
636
637 gMC->Gsdvn("ZNSL", "ZN1 ", fDivZN[1], 2); // Slices
638 gMC->Gsdvn("ZNST", "ZNSL", fDivZN[0], 1); // Sticks
639
640 // --- Position the empty grooves in the sticks (4 grooves per stick)
641 Float_t dx = fDimZN[0] / fDivZN[0] / 4.;
642 Float_t dy = fDimZN[1] / fDivZN[1] / 4.;
643
644 gMC->Gspos("ZNG1", 1, "ZNST", 0.-dx, 0.+dy, 0., 0, "ONLY");
645 gMC->Gspos("ZNG2", 1, "ZNST", 0.+dx, 0.+dy, 0., 0, "ONLY");
646 gMC->Gspos("ZNG3", 1, "ZNST", 0.-dx, 0.-dy, 0., 0, "ONLY");
647 gMC->Gspos("ZNG4", 1, "ZNST", 0.+dx, 0.-dy, 0., 0, "ONLY");
648
649 // --- Position the fibers in the grooves
650 gMC->Gspos("ZNF1", 1, "ZNG1", 0., 0., 0., 0, "ONLY");
651 gMC->Gspos("ZNF2", 1, "ZNG2", 0., 0., 0., 0, "ONLY");
652 gMC->Gspos("ZNF3", 1, "ZNG3", 0., 0., 0., 0, "ONLY");
653 gMC->Gspos("ZNF4", 1, "ZNG4", 0., 0., 0., 0, "ONLY");
654
655 // --- Position the neutron calorimeter in ZDC
656 gMC->Gspos("ZNEU", 1, "ZDC ", fPosZN[0], fPosZN[1], fPosZN[2] + fDimZN[2], 0, "ONLY");
657
866ab5a2 658
a2216698 659 // -------------------------------------------------------------------------------
866ab5a2 660 //--> Proton calorimeter (ZP)
68ca986e 661
662 gMC->Gsvolu("ZPRO", "BOX ", idtmed[2], fDimZP, 3); // Passive material
663 gMC->Gsvolu("ZPF1", "TUBE", idtmed[3], fFibZP, 3); // Active material
664 gMC->Gsvolu("ZPF2", "TUBE", idtmed[4], fFibZP, 3);
665 gMC->Gsvolu("ZPF3", "TUBE", idtmed[4], fFibZP, 3);
666 gMC->Gsvolu("ZPF4", "TUBE", idtmed[3], fFibZP, 3);
667 gMC->Gsvolu("ZPG1", "BOX ", idtmed[12], fGrvZP, 3); // Empty grooves
668 gMC->Gsvolu("ZPG2", "BOX ", idtmed[12], fGrvZP, 3);
669 gMC->Gsvolu("ZPG3", "BOX ", idtmed[12], fGrvZP, 3);
670 gMC->Gsvolu("ZPG4", "BOX ", idtmed[12], fGrvZP, 3);
671
672 //-- Divide ZPRO in towers(for hits purposes)
673
674 gMC->Gsdvn("ZPTX", "ZPRO", fTowZP[0], 1); // x-tower
675 gMC->Gsdvn("ZP1 ", "ZPTX", fTowZP[1], 2); // y-tower
676
677
678 //-- Divide ZP1 in minitowers
679 // fDivZP[0]= NUMBER OF FIBERS ALONG X-AXIS PER MINITOWER,
680 // fDivZP[1]= NUMBER OF FIBERS ALONG Y-AXIS PER MINITOWER
681 // (4 fiber per minitower)
682
683 gMC->Gsdvn("ZPSL", "ZP1 ", fDivZP[1], 2); // Slices
684 gMC->Gsdvn("ZPST", "ZPSL", fDivZP[0], 1); // Sticks
685
686 // --- Position the empty grooves in the sticks (4 grooves per stick)
687 dx = fDimZP[0] / fTowZP[0] / fDivZP[0] / 2.;
688 dy = fDimZP[1] / fTowZP[1] / fDivZP[1] / 2.;
689
690 gMC->Gspos("ZPG1", 1, "ZPST", 0.-dx, 0.+dy, 0., 0, "ONLY");
691 gMC->Gspos("ZPG2", 1, "ZPST", 0.+dx, 0.+dy, 0., 0, "ONLY");
692 gMC->Gspos("ZPG3", 1, "ZPST", 0.-dx, 0.-dy, 0., 0, "ONLY");
693 gMC->Gspos("ZPG4", 1, "ZPST", 0.+dx, 0.-dy, 0., 0, "ONLY");
694
695 // --- Position the fibers in the grooves
696 gMC->Gspos("ZPF1", 1, "ZPG1", 0., 0., 0., 0, "ONLY");
697 gMC->Gspos("ZPF2", 1, "ZPG2", 0., 0., 0., 0, "ONLY");
698 gMC->Gspos("ZPF3", 1, "ZPG3", 0., 0., 0., 0, "ONLY");
699 gMC->Gspos("ZPF4", 1, "ZPG4", 0., 0., 0., 0, "ONLY");
700
701
702 // --- Position the proton calorimeter in ZDC
703 gMC->Gspos("ZPRO", 1, "ZDC ", fPosZP[0], fPosZP[1], fPosZP[2] + fDimZP[2], 0, "ONLY");
866ab5a2 704
705
a2216698 706 // -------------------------------------------------------------------------------
707 // -> EM calorimeter (ZEM)
866ab5a2 708
709 gMC->Gsvolu("ZEM ", "PARA", idtmed[10], fDimZEM, 6);
a2216698 710
711 Int_t irot1, irot2;
866ab5a2 712
a2216698 713 gMC->Matrix(irot1,0.,0.,90.,90.,90.,180.); // Rotation matrix 1
866ab5a2 714 gMC->Matrix(irot2,180.,0.,90.,fDimZEM[3]+90.,90.,fDimZEM[3]); // Rotation matrix 2
715// printf("irot1 = %d, irot2 = %d \n", irot1, irot2);
716
717 gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material
718
719 gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches
720
c6937a87 721 dimPb[0] = fDimZEMPb; // Lead slices
722 dimPb[1] = fDimZEM[2];
723 dimPb[2] = fDimZEM[1];
724 dimPb[3] = 90.-fDimZEM[3];
725 dimPb[4] = 0.;
726 dimPb[5] = 0.;
727 gMC->Gsvolu("ZEL0", "PARA", idtmed[5], dimPb, 6);
728 gMC->Gsvolu("ZEL1", "PARA", idtmed[5], dimPb, 6);
729 gMC->Gsvolu("ZEL2", "PARA", idtmed[5], dimPb, 6);
866ab5a2 730
731 // --- Position the lead slices in the tranche
732 Float_t zTran = fDimZEM[0]/fDivZEM[2];
733 Float_t zTrPb = -zTran+fDimZEMPb;
734 gMC->Gspos("ZEL0", 1, "ZETR", zTrPb, 0., 0., 0, "ONLY");
735 gMC->Gspos("ZEL1", 1, "ZETR", fDimZEMPb, 0., 0., 0, "ONLY");
736
737 // --- Vacuum zone (to be filled with fibres)
c6937a87 738 dimVoid[0] = (zTran-2*fDimZEMPb)/2.;
739 dimVoid[1] = fDimZEM[2];
740 dimVoid[2] = fDimZEM[1];
741 dimVoid[3] = 90.-fDimZEM[3];
742 dimVoid[4] = 0.;
743 dimVoid[5] = 0.;
744 gMC->Gsvolu("ZEV0", "PARA", idtmed[10], dimVoid,6);
745 gMC->Gsvolu("ZEV1", "PARA", idtmed[10], dimVoid,6);
866ab5a2 746
747 // --- Divide the vacuum slice into sticks along x axis
748 gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3);
749 gMC->Gsdvn("ZES1", "ZEV1", fDivZEM[0], 3);
750
751 // --- Positioning the fibers into the sticks
752 gMC->Gspos("ZEMF", 1,"ZES0", 0., 0., 0., irot2, "ONLY");
753 gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY");
754
755 // --- Positioning the vacuum slice into the tranche
c6937a87 756 Float_t displFib = fDimZEM[1]/fDivZEM[0];
757 gMC->Gspos("ZEV0", 1,"ZETR", -dimVoid[0], 0., 0., 0, "ONLY");
758 gMC->Gspos("ZEV1", 1,"ZETR", -dimVoid[0]+zTran, 0., displFib, 0, "ONLY");
866ab5a2 759
760 // --- Positioning the ZEM into the ZDC - rotation for 90 degrees
761 gMC->Gspos("ZEM ", 1,"ZDC ", fPosZEM[0], fPosZEM[1], fPosZEM[2], irot1, "ONLY");
762
763 // --- Adding last slice at the end of the EM calorimeter
764 Float_t zLastSlice = fPosZEM[2]+fDimZEMPb+fDimZEM[0];
765 gMC->Gspos("ZEL2", 1,"ZDC ", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY");
68ca986e 766
767}
768
769//_____________________________________________________________________________
c6937a87 770void AliZDCv1::DrawModule() const
68ca986e 771{
772 //
773 // Draw a shaded view of the Zero Degree Calorimeter version 1
774 //
775
776 // Set everything unseen
777 gMC->Gsatt("*", "seen", -1);
778 //
779 // Set ALIC mother transparent
780 gMC->Gsatt("ALIC","SEEN",0);
781 //
782 // Set the volumes visible
783 gMC->Gsatt("ZDC ","SEEN",0);
a2216698 784 gMC->Gsatt("QT01","SEEN",1);
785 gMC->Gsatt("QT02","SEEN",1);
786 gMC->Gsatt("QT03","SEEN",1);
787 gMC->Gsatt("QT04","SEEN",1);
788 gMC->Gsatt("QT05","SEEN",1);
789 gMC->Gsatt("QT06","SEEN",1);
790 gMC->Gsatt("QT07","SEEN",1);
791 gMC->Gsatt("QT08","SEEN",1);
792 gMC->Gsatt("QT09","SEEN",1);
793 gMC->Gsatt("QT10","SEEN",1);
794 gMC->Gsatt("QT11","SEEN",1);
795 gMC->Gsatt("QT12","SEEN",1);
796 gMC->Gsatt("QT13","SEEN",1);
797 gMC->Gsatt("QT14","SEEN",1);
798 gMC->Gsatt("QT15","SEEN",1);
799 gMC->Gsatt("QT16","SEEN",1);
800 gMC->Gsatt("QT17","SEEN",1);
801 gMC->Gsatt("QT18","SEEN",1);
802 gMC->Gsatt("QC01","SEEN",1);
803 gMC->Gsatt("QC02","SEEN",1);
804 gMC->Gsatt("QC03","SEEN",1);
805 gMC->Gsatt("QC04","SEEN",1);
806 gMC->Gsatt("QC05","SEEN",1);
807 gMC->Gsatt("QTD1","SEEN",1);
808 gMC->Gsatt("QTD2","SEEN",1);
809 gMC->Gsatt("QTD3","SEEN",1);
68ca986e 810 gMC->Gsatt("MQXL","SEEN",1);
811 gMC->Gsatt("YMQL","SEEN",1);
812 gMC->Gsatt("MQX ","SEEN",1);
813 gMC->Gsatt("YMQ ","SEEN",1);
a2216698 814 gMC->Gsatt("ZQYX","SEEN",1);
815 gMC->Gsatt("MD1 ","SEEN",1);
816 gMC->Gsatt("MD1V","SEEN",1);
68ca986e 817 gMC->Gsatt("YD1 ","SEEN",1);
a2216698 818 gMC->Gsatt("MD2 ","SEEN",1);
68ca986e 819 gMC->Gsatt("YD2 ","SEEN",1);
820 gMC->Gsatt("ZNEU","SEEN",0);
821 gMC->Gsatt("ZNF1","SEEN",0);
822 gMC->Gsatt("ZNF2","SEEN",0);
823 gMC->Gsatt("ZNF3","SEEN",0);
824 gMC->Gsatt("ZNF4","SEEN",0);
825 gMC->Gsatt("ZNG1","SEEN",0);
826 gMC->Gsatt("ZNG2","SEEN",0);
827 gMC->Gsatt("ZNG3","SEEN",0);
828 gMC->Gsatt("ZNG4","SEEN",0);
829 gMC->Gsatt("ZNTX","SEEN",0);
a2216698 830 gMC->Gsatt("ZN1 ","COLO",4);
68ca986e 831 gMC->Gsatt("ZN1 ","SEEN",1);
832 gMC->Gsatt("ZNSL","SEEN",0);
833 gMC->Gsatt("ZNST","SEEN",0);
834 gMC->Gsatt("ZPRO","SEEN",0);
835 gMC->Gsatt("ZPF1","SEEN",0);
836 gMC->Gsatt("ZPF2","SEEN",0);
837 gMC->Gsatt("ZPF3","SEEN",0);
838 gMC->Gsatt("ZPF4","SEEN",0);
839 gMC->Gsatt("ZPG1","SEEN",0);
840 gMC->Gsatt("ZPG2","SEEN",0);
841 gMC->Gsatt("ZPG3","SEEN",0);
842 gMC->Gsatt("ZPG4","SEEN",0);
843 gMC->Gsatt("ZPTX","SEEN",0);
a2216698 844 gMC->Gsatt("ZP1 ","COLO",6);
68ca986e 845 gMC->Gsatt("ZP1 ","SEEN",1);
846 gMC->Gsatt("ZPSL","SEEN",0);
847 gMC->Gsatt("ZPST","SEEN",0);
a2216698 848 gMC->Gsatt("ZEM ","COLO",7);
866ab5a2 849 gMC->Gsatt("ZEM ","SEEN",1);
850 gMC->Gsatt("ZEMF","SEEN",0);
851 gMC->Gsatt("ZETR","SEEN",0);
852 gMC->Gsatt("ZEL0","SEEN",0);
853 gMC->Gsatt("ZEL1","SEEN",0);
854 gMC->Gsatt("ZEL2","SEEN",0);
855 gMC->Gsatt("ZEV0","SEEN",0);
856 gMC->Gsatt("ZEV1","SEEN",0);
857 gMC->Gsatt("ZES0","SEEN",0);
858 gMC->Gsatt("ZES1","SEEN",0);
68ca986e 859
860 //
861 gMC->Gdopt("hide", "on");
862 gMC->Gdopt("shad", "on");
863 gMC->Gsatt("*", "fill", 7);
864 gMC->SetClipBox(".");
865 gMC->SetClipBox("*", 0, 100, -100, 100, 12000, 16000);
866 gMC->DefaultRange();
867 gMC->Gdraw("alic", 40, 30, 0, 488, 220, .07, .07);
868 gMC->Gdhead(1111, "Zero Degree Calorimeter Version 1");
869 gMC->Gdman(18, 4, "MAN");
870}
871
872//_____________________________________________________________________________
873void AliZDCv1::CreateMaterials()
874{
875 //
876 // Create Materials for the Zero Degree Calorimeter
877 //
68ca986e 878
879 Int_t *idtmed = fIdtmed->GetArray();
880
a2216698 881 Float_t dens, ubuf[1], wmat[2], a[2], z[2], deemax = -1;
882 Int_t i;
68ca986e 883
884 // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3
885
886 // --- Tantalum -> ZN passive material
887 ubuf[0] = 1.1;
888 AliMaterial(1, "TANT", 180.95, 73., 16.65, .4, 11.9, ubuf, 1);
889
890 // --- Tungsten
891// ubuf[0] = 1.11;
892// AliMaterial(1, "TUNG", 183.85, 74., 19.3, .35, 10.3, ubuf, 1);
893
894 // --- Brass (CuZn) -> ZP passive material
895 dens = 8.48;
896 a[0] = 63.546;
897 a[1] = 65.39;
898 z[0] = 29.;
899 z[1] = 30.;
900 wmat[0] = .63;
901 wmat[1] = .37;
902 AliMixture(2, "BRASS ", a, z, dens, 2, wmat);
903
904 // --- SiO2
905 dens = 2.64;
906 a[0] = 28.086;
907 a[1] = 15.9994;
908 z[0] = 14.;
909 z[1] = 8.;
910 wmat[0] = 1.;
911 wmat[1] = 2.;
a2216698 912 AliMixture(3, "SIO2 ", a, z, dens, -2, wmat);
866ab5a2 913
914 // --- Lead
915 ubuf[0] = 1.12;
916 AliMaterial(5, "LEAD", 207.19, 82., 11.35, .56, 18.5, ubuf, 1);
68ca986e 917
918 // --- Copper
a2216698 919 ubuf[0] = 1.10;
920 AliMaterial(6, "COPP", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
68ca986e 921
866ab5a2 922 // --- Iron (energy loss taken into account)
923 ubuf[0] = 1.1;
a2216698 924 AliMaterial(7, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
68ca986e 925
866ab5a2 926 // --- Iron (no energy loss)
68ca986e 927 ubuf[0] = 1.1;
a2216698 928 AliMaterial(8, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
68ca986e 929
930 // --- Vacuum (no magnetic field)
931 AliMaterial(10, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
932
933 // --- Vacuum (with magnetic field)
934 AliMaterial(11, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
935
936 // --- Air (no magnetic field)
937 AliMaterial(12, "Air $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0);
938
939 // --- Definition of tracking media:
940
941 // --- Tantalum = 1 ;
942 // --- Brass = 2 ;
943 // --- Fibers (SiO2) = 3 ;
944 // --- Fibers (SiO2) = 4 ;
866ab5a2 945 // --- Lead = 5 ;
a2216698 946 // --- Copper = 6 ;
947 // --- Iron (with energy loss) = 7 ;
948 // --- Iron (without energy loss) = 8 ;
68ca986e 949 // --- Vacuum (no field) = 10
950 // --- Vacuum (with field) = 11
951 // --- Air (no field) = 12
952
953
954 // --- Tracking media parameters
a2216698 955 Float_t epsil = .01, stmin=0.01, stemax = 1.;
7cc664ae 956// Int_t isxfld = gAlice->Field()->Integ();
d213f1fa 957// Float_t fieldm = gAlice->Field()->Max();
de28527d 958 Float_t fieldm = 0., tmaxfd = 0.;
a2216698 959 Int_t ifield = 0, isvolActive = 1, isvol = 0, inofld = 0;
68ca986e 960
961 AliMedium(1, "ZTANT", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
962// AliMedium(1, "ZW", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
a2216698 963 AliMedium(2, "ZBRASS",2, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
68ca986e 964 AliMedium(3, "ZSIO2", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
965 AliMedium(4, "ZQUAR", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
a2216698 966 AliMedium(5, "ZLEAD", 5, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
de28527d 967// AliMedium(6, "ZCOPP", 6, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
968// AliMedium(7, "ZIRON", 7, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
969 AliMedium(6, "ZCOPP", 6, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
970 AliMedium(7, "ZIRON", 7, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
a2216698 971 AliMedium(8, "ZIRONN",8, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
972 AliMedium(10,"ZVOID",10, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
973 AliMedium(12,"ZAIR", 12, 0, inofld, fieldm, tmaxfd, stemax,deemax, epsil, stmin);
974
975 ifield =2;
68ca986e 976 fieldm = 45.;
7cc664ae 977 AliMedium(11, "ZVOIM", 11, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
68ca986e 978
979 // Thresholds for showering in the ZDCs
a2216698 980 i = 1; //tantalum
68ca986e 981 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
982 gMC->Gstpar(idtmed[i], "CUTELE", .001);
983 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
984 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
a2216698 985 i = 2; //brass
68ca986e 986 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
987 gMC->Gstpar(idtmed[i], "CUTELE", .001);
988 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
989 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
a2216698 990 i = 5; //lead
866ab5a2 991 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
992 gMC->Gstpar(idtmed[i], "CUTELE", .001);
993 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
994 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
68ca986e 995
d213f1fa 996 // Avoid too detailed showering in TDI
997 i = 6; //copper
998 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
999 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1000 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1001 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1002
68ca986e 1003 // Avoid too detailed showering along the beam line
a2216698 1004 i = 7; //iron with energy loss (ZIRON)
68ca986e 1005 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1006 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1007 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1008 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1009
d213f1fa 1010 // Avoid too detailed showering along the beam line
1011 i = 8; //iron with energy loss (ZIRONN)
1012 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1013 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1014 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1015 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1016
68ca986e 1017 // Avoid interaction in fibers (only energy loss allowed)
a2216698 1018 i = 3; //fibers (ZSI02)
68ca986e 1019 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1020 gMC->Gstpar(idtmed[i], "MULS", 0.);
1021 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1022 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1023 gMC->Gstpar(idtmed[i], "LOSS", 1.);
1024 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1025 gMC->Gstpar(idtmed[i], "COMP", 0.);
1026 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1027 gMC->Gstpar(idtmed[i], "BREM", 0.);
1028 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1029 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1030 gMC->Gstpar(idtmed[i], "HADR", 0.);
a2216698 1031 i = 4; //fibers (ZQUAR)
68ca986e 1032 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1033 gMC->Gstpar(idtmed[i], "MULS", 0.);
1034 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1035 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1036 gMC->Gstpar(idtmed[i], "LOSS", 1.);
1037 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1038 gMC->Gstpar(idtmed[i], "COMP", 0.);
1039 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1040 gMC->Gstpar(idtmed[i], "BREM", 0.);
1041 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1042 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1043 gMC->Gstpar(idtmed[i], "HADR", 0.);
866ab5a2 1044
1045 // Avoid interaction in void
d213f1fa 1046 i = 11; //void with field
1047 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1048 gMC->Gstpar(idtmed[i], "MULS", 0.);
1049 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1050 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1051 gMC->Gstpar(idtmed[i], "LOSS", 0.);
1052 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1053 gMC->Gstpar(idtmed[i], "COMP", 0.);
1054 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1055 gMC->Gstpar(idtmed[i], "BREM", 0.);
1056 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1057 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1058 gMC->Gstpar(idtmed[i], "HADR", 0.);
866ab5a2 1059
68ca986e 1060 //
866ab5a2 1061 fMedSensZN = idtmed[1]; // Sensitive volume: ZN passive material
1062 fMedSensZP = idtmed[2]; // Sensitive volume: ZP passive material
a2216698 1063 fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1
1064 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2
1065 fMedSensZEM = idtmed[5]; // Sensitive volume: ZEM passive material
de28527d 1066// fMedSensTDI = idtmed[6]; // Sensitive volume: TDI Cu shield
1067// fMedSensPI = idtmed[7]; // Sensitive volume: beam pipes
866ab5a2 1068 fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves
68ca986e 1069}
1070
1071//_____________________________________________________________________________
1072void AliZDCv1::Init()
1073{
1074 InitTables();
68ca986e 1075}
1076
1077//_____________________________________________________________________________
1078void AliZDCv1::InitTables()
1079{
c6937a87 1080 //
1081 // Read light tables for Cerenkov light production parameterization
1082 //
1083
c0ceba4c 1084 Int_t k, j;
5a881c97 1085
866ab5a2 1086 char *lightfName1,*lightfName2,*lightfName3,*lightfName4,
1087 *lightfName5,*lightfName6,*lightfName7,*lightfName8;
68ca986e 1088 FILE *fp1, *fp2, *fp3, *fp4, *fp5, *fp6, *fp7, *fp8;
1089
a2216698 1090 // --- Reading light tables for ZN
866ab5a2 1091 lightfName1 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362207s");
1092 if((fp1 = fopen(lightfName1,"r")) == NULL){
68ca986e 1093 printf("Cannot open file fp1 \n");
1094 return;
1095 }
866ab5a2 1096 lightfName2 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362208s");
1097 if((fp2 = fopen(lightfName2,"r")) == NULL){
68ca986e 1098 printf("Cannot open file fp2 \n");
1099 return;
1100 }
866ab5a2 1101 lightfName3 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362209s");
1102 if((fp3 = fopen(lightfName3,"r")) == NULL){
68ca986e 1103 printf("Cannot open file fp3 \n");
1104 return;
1105 }
866ab5a2 1106 lightfName4 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362210s");
1107 if((fp4 = fopen(lightfName4,"r")) == NULL){
68ca986e 1108 printf("Cannot open file fp4 \n");
1109 return;
1110 }
a2216698 1111
c0ceba4c 1112 for(k=0; k<fNalfan; k++){
1113 for(j=0; j<fNben; j++){
68ca986e 1114 fscanf(fp1,"%f",&fTablen[0][k][j]);
1115 fscanf(fp2,"%f",&fTablen[1][k][j]);
1116 fscanf(fp3,"%f",&fTablen[2][k][j]);
1117 fscanf(fp4,"%f",&fTablen[3][k][j]);
1118 }
1119 }
1120 fclose(fp1);
1121 fclose(fp2);
1122 fclose(fp3);
1123 fclose(fp4);
1124
a2216698 1125 // --- Reading light tables for ZP and ZEM
866ab5a2 1126 lightfName5 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552207s");
1127 if((fp5 = fopen(lightfName5,"r")) == NULL){
68ca986e 1128 printf("Cannot open file fp5 \n");
1129 return;
1130 }
866ab5a2 1131 lightfName6 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552208s");
1132 if((fp6 = fopen(lightfName6,"r")) == NULL){
68ca986e 1133 printf("Cannot open file fp6 \n");
1134 return;
1135 }
866ab5a2 1136 lightfName7 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552209s");
1137 if((fp7 = fopen(lightfName7,"r")) == NULL){
68ca986e 1138 printf("Cannot open file fp7 \n");
1139 return;
1140 }
866ab5a2 1141 lightfName8 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552210s");
1142 if((fp8 = fopen(lightfName8,"r")) == NULL){
68ca986e 1143 printf("Cannot open file fp8 \n");
1144 return;
1145 }
a2216698 1146
c0ceba4c 1147 for(k=0; k<fNalfap; k++){
1148 for(j=0; j<fNbep; j++){
68ca986e 1149 fscanf(fp5,"%f",&fTablep[0][k][j]);
1150 fscanf(fp6,"%f",&fTablep[1][k][j]);
1151 fscanf(fp7,"%f",&fTablep[2][k][j]);
1152 fscanf(fp8,"%f",&fTablep[3][k][j]);
1153 }
1154 }
1155 fclose(fp5);
1156 fclose(fp6);
1157 fclose(fp7);
1158 fclose(fp8);
1159}
68ca986e 1160//_____________________________________________________________________________
1161void AliZDCv1::StepManager()
1162{
1163 //
1164 // Routine called at every step in the Zero Degree Calorimeters
1165 //
1166
a2216698 1167 Int_t j, vol[2], ibeta=0, ialfa, ibe, nphe;
366ff5c2 1168 Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, radius, out;
c6937a87 1169 Float_t xalic[3], z, guiEff, guiPar[4]={0.31,-0.0004,0.0197,0.7958};
68ca986e 1170 TLorentzVector s, p;
1171 const char *knamed;
866ab5a2 1172
de6bc247 1173 for (j=0;j<10;j++) hits[j]=0;
866ab5a2 1174
68ca986e 1175 if((gMC->GetMedium() == fMedSensZN) || (gMC->GetMedium() == fMedSensZP) ||
1176 (gMC->GetMedium() == fMedSensGR) || (gMC->GetMedium() == fMedSensF1) ||
d213f1fa 1177 (gMC->GetMedium() == fMedSensF2) || (gMC->GetMedium() == fMedSensZEM)){
47388856 1178
1179// --- This part is for no shower developement in beam pipe and TDI
d213f1fa 1180// (gMC->GetMedium() == fMedSensPI) || (gMC->GetMedium() == fMedSensTDI)){
cc9c0243 1181
866ab5a2 1182 // If particle interacts with beam pipe -> return
d213f1fa 1183// if((gMC->GetMedium() == fMedSensPI) || (gMC->GetMedium() == fMedSensTDI)){
a2216698 1184 // If option NoShower is set -> StopTrack
d213f1fa 1185// if(fNoShower==1) {
4f9ca16e 1186// if(gMC->GetMedium() == fMedSensPI) {
1187// knamed = gMC->CurrentVolName();
1188// if((!strncmp(knamed,"MQ",2)) || (!strncmp(knamed,"YM",2))) fpLostIT += 1;
1189// if((!strncmp(knamed,"MD1",3))|| (!strncmp(knamed,"YD1",2))) fpLostD1 += 1;
1190// }
1191// if(gMC->GetMedium() == fMedSensTDI) fpLostTDI += 1;
d213f1fa 1192// gMC->StopTrack();
a2216698 1193// printf("\n # of p lost in Inner Triplet = %d\n",fpLostIT);
1194// printf("\n # of p lost in D1 = %d\n",fpLostD1);
1195// printf("\n # of p lost in TDI = %d\n",fpLostTDI);
d213f1fa 1196// }
7cc664ae 1197// return;
d213f1fa 1198// }
866ab5a2 1199
68ca986e 1200 //Particle coordinates
1201 gMC->TrackPosition(s);
c0ceba4c 1202 for(j=0; j<=2; j++){
68ca986e 1203 x[j] = s[j];
1204 }
1205 hits[0] = x[0];
1206 hits[1] = x[1];
1207 hits[2] = x[2];
1208
1209 // Determine in which ZDC the particle is
1210 knamed = gMC->CurrentVolName();
47388856 1211 if(!strncmp(knamed,"ZN",2)){
1212 vol[0]=1;
1213 }
1214 else if(!strncmp(knamed,"ZP",2)){
1215 vol[0]=2;
1216 }
1217 else if(!strncmp(knamed,"ZE",2)){
1218 vol[0]=3;
1219 }
68ca986e 1220
1221 // Determine in which quadrant the particle is
47388856 1222
1223 if(vol[0]==1){ //Quadrant in ZN
866ab5a2 1224 xdet[0] = x[0]-fPosZN[0];
1225 xdet[1] = x[1]-fPosZN[1];
5a881c97 1226 if((xdet[0]<=0.) && (xdet[1]>=0.)) vol[1]=1;
1227 if((xdet[0]>0.) && (xdet[1]>0.)) vol[1]=2;
1228 if((xdet[0]<0.) && (xdet[1]<0.)) vol[1]=3;
1229 if((xdet[0]>0.) && (xdet[1]<0.)) vol[1]=4;
68ca986e 1230 }
47388856 1231 else if(vol[0]==2){ //Quadrant in ZP
866ab5a2 1232 xdet[0] = x[0]-fPosZP[0];
1233 xdet[1] = x[1]-fPosZP[1];
1234 if(xdet[0]>fDimZP[0])xdet[0]=fDimZP[0]-0.01;
1235 if(xdet[0]<-fDimZP[0])xdet[0]=-fDimZP[0]+0.01;
68ca986e 1236 Float_t xqZP = xdet[0]/(fDimZP[0]/2);
1237 for(int i=1; i<=4; i++){
866ab5a2 1238 if(xqZP>=(i-3) && xqZP<(i-2)){
68ca986e 1239 vol[1] = i;
1240 break;
5a881c97 1241 }
1242 }
68ca986e 1243 }
47388856 1244 else if(vol[0] == 3){ //ZEM has only 1 quadrant
866ab5a2 1245 vol[1] = 1;
1246 xdet[0] = x[0]-fPosZEM[0];
1247 xdet[1] = x[1]-fPosZEM[1];
866ab5a2 1248 }
1249
68ca986e 1250 // Store impact point and kinetic energy of the ENTERING particle
1251
68ca986e 1252// if(Curtrack==Prim){
1253 if(gMC->IsTrackEntering()){
1254 //Particle energy
1255 gMC->TrackMomentum(p);
68ca986e 1256 hits[3] = p[3];
866ab5a2 1257 // Impact point on ZDC
68ca986e 1258 hits[4] = xdet[0];
1259 hits[5] = xdet[1];
866ab5a2 1260 hits[6] = 0;
68ca986e 1261 hits[7] = 0;
1262 hits[8] = 0;
1263 hits[9] = 0;
1264
866ab5a2 1265// Int_t PcID = gMC->TrackPid();
1266// printf("Pc ID -> %d\n",PcID);
5d12ce38 1267 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
866ab5a2 1268
1269 if(fNoShower==1){
4f9ca16e 1270// fpDetected += 1;
a2216698 1271 gMC->StopTrack();
1272// printf("\n # of detected p = %d\n",fpDetected);
1273 return;
866ab5a2 1274 }
68ca986e 1275 }
a2216698 1276// } // Curtrack IF
68ca986e 1277
1278 // Charged particles -> Energy loss
1279 if((destep=gMC->Edep())){
1280 if(gMC->IsTrackStop()){
1281 gMC->TrackMomentum(p);
1282 m = gMC->TrackMass();
1283 ekin = p[3]-m;
68ca986e 1284 hits[9] = ekin;
1285 hits[7] = 0.;
1286 hits[8] = 0.;
5d12ce38 1287 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
68ca986e 1288 }
1289 else{
1290 hits[9] = destep;
1291 hits[7] = 0.;
1292 hits[8] = 0.;
5d12ce38 1293 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
68ca986e 1294 }
a2216698 1295// printf(" Dep. E = %f \n",hits[9]);
1296 }
1297 }// NB -> Questa parentesi (chiude il primo IF) io la sposterei al fondo!???
68ca986e 1298
1299
1300 // *** Light production in fibres
1301 if((gMC->GetMedium() == fMedSensF1) || (gMC->GetMedium() == fMedSensF2)){
68ca986e 1302
1303 //Select charged particles
1304 if((destep=gMC->Edep())){
68ca986e 1305
1306 // Particle velocity
1307 gMC->TrackMomentum(p);
1308 Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
1309 Float_t beta = ptot/p[3];
47388856 1310 if(beta<0.67){
1311 return;
1312 }
1313 else if((beta>=0.67) && (beta<=0.75)){
1314 ibeta = 0;
1315 }
1316 if((beta>0.75) && (beta<=0.85)){
1317 ibeta = 1;
1318 }
1319 if((beta>0.85) && (beta<=0.95)){
1320 ibeta = 2;
1321 }
1322 if(beta>0.95){
1323 ibeta = 3;
1324 }
68ca986e 1325
1326 // Angle between particle trajectory and fibre axis
1327 // 1 -> Momentum directions
1328 um[0] = p[0]/ptot;
1329 um[1] = p[1]/ptot;
1330 um[2] = p[2]/ptot;
1331 gMC->Gmtod(um,ud,2);
1332 // 2 -> Angle < limit angle
1333 Double_t alfar = TMath::ACos(ud[2]);
1334 Double_t alfa = alfar*kRaddeg;
866ab5a2 1335 if(alfa>=110.) return;
68ca986e 1336 ialfa = Int_t(1.+alfa/2.);
1337
1338 // Distance between particle trajectory and fibre axis
1339 gMC->TrackPosition(s);
c0ceba4c 1340 for(j=0; j<=2; j++){
68ca986e 1341 x[j] = s[j];
1342 }
1343 gMC->Gmtod(x,xdet,1);
1344 if(TMath::Abs(ud[0])>0.00001){
1345 Float_t dcoeff = ud[1]/ud[0];
1346 be = TMath::Abs((xdet[1]-dcoeff*xdet[0])/TMath::Sqrt(dcoeff*dcoeff+1.));
1347 }
1348 else{
1349 be = TMath::Abs(ud[0]);
1350 }
1351
47388856 1352 if((vol[0]==1)){
1353 radius = fFibZN[1];
1354 }
1355 else if((vol[0]==2)){
1356 radius = fFibZP[1];
1357 }
68ca986e 1358 ibe = Int_t(be*1000.+1);
1359
1360 //Looking into the light tables
1361 Float_t charge = gMC->TrackCharge();
1362
47388856 1363 if((vol[0]==1)) { // (1) ZN fibres
68ca986e 1364 if(ibe>fNben) ibe=fNben;
1365 out = charge*charge*fTablen[ibeta][ialfa][ibe];
5ce39387 1366 nphe = gRandom->Poisson(out);
a2216698 1367// printf("ZN --- ibeta = %d, ialfa = %d, ibe = %d"
1368// " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
68ca986e 1369 if(gMC->GetMedium() == fMedSensF1){
5ce39387 1370 hits[7] = nphe; //fLightPMQ
68ca986e 1371 hits[8] = 0;
1372 hits[9] = 0;
5d12ce38 1373 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
68ca986e 1374 }
1375 else{
1376 hits[7] = 0;
5ce39387 1377 hits[8] = nphe; //fLightPMC
68ca986e 1378 hits[9] = 0;
5d12ce38 1379 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
68ca986e 1380 }
1381 }
47388856 1382 else if((vol[0]==2)) { // (2) ZP fibres
68ca986e 1383 if(ibe>fNbep) ibe=fNbep;
1384 out = charge*charge*fTablep[ibeta][ialfa][ibe];
5ce39387 1385 nphe = gRandom->Poisson(out);
a2216698 1386// printf("ZP --- ibeta = %d, ialfa = %d, ibe = %d"
1387// " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
68ca986e 1388 if(gMC->GetMedium() == fMedSensF1){
5ce39387 1389 hits[7] = nphe; //fLightPMQ
68ca986e 1390 hits[8] = 0;
1391 hits[9] = 0;
5d12ce38 1392 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
68ca986e 1393 }
1394 else{
1395 hits[7] = 0;
5ce39387 1396 hits[8] = nphe; //fLightPMC
68ca986e 1397 hits[9] = 0;
5d12ce38 1398 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
68ca986e 1399 }
1400 }
47388856 1401 else if((vol[0]==3)) { // (3) ZEM fibres
866ab5a2 1402 if(ibe>fNbep) ibe=fNbep;
1403 out = charge*charge*fTablep[ibeta][ialfa][ibe];
47388856 1404 gMC->TrackPosition(s);
1405 for(j=0; j<=2; j++){
1406 xalic[j] = s[j];
1407 }
1408 // z-coordinate from ZEM front face
1409 // NB-> fPosZEM[2]+fZEMLength = -1000.+2*10.3 = 979.69 cm
1410 z = -xalic[2]+fPosZEM[2]+2*fZEMLength-xalic[1];
1411// z = xalic[2]-fPosZEM[2]-fZEMLength-xalic[1]*(TMath::Tan(45.*kDegrad));
1412// printf("\n fPosZEM[2]+2*fZEMLength = %f", fPosZEM[2]+2*fZEMLength);
c6937a87 1413 guiEff = guiPar[0]*(guiPar[1]*z*z+guiPar[2]*z+guiPar[3]);
47388856 1414// printf("\n xalic[0] = %f xalic[1] = %f xalic[2] = %f z = %f \n",
1415// xalic[0],xalic[1],xalic[2],z);
c6937a87 1416 out = out*guiEff;
5ce39387 1417 nphe = gRandom->Poisson(out);
c6937a87 1418// printf(" out*guiEff = %f nphe = %d", out, nphe);
a2216698 1419// printf("ZEM --- ibeta = %d, ialfa = %d, ibe = %d"
1420// " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
0c9b76ab 1421 hits[7] = 0;
1422 hits[8] = nphe; //fLightPMC
5ce39387 1423 hits[9] = 0;
5d12ce38 1424 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
a2216698 1425 }
68ca986e 1426 }
68ca986e 1427 }
1428}