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