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