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