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