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