1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.9 2000/12/13 10:33:49 coppedis
19 Prints only if fDebug==1
21 Revision 1.8 2000/12/12 14:10:02 coppedis
22 Correction suggested by M. Masera
24 Revision 1.7 2000/11/30 17:23:47 coppedis
25 Remove first corrector dipole and introduce digitization
27 Revision 1.6 2000/11/22 11:33:10 coppedis
30 Revision 1.5 2000/10/02 21:28:20 fca
31 Removal of useless dependecies via forward declarations
33 Revision 1.3.2.1 2000/08/24 09:25:47 hristov
34 Patch by P.Hristov: Bug in ZDC geometry corrected by E.Scomparin
36 Revision 1.4 2000/08/24 09:23:59 hristov
37 Bug in ZDC geometry corrected by E.Scomparin
39 Revision 1.3 2000/07/12 06:59:16 fca
40 Fixing dimension of hits array
42 Revision 1.2 2000/07/11 11:12:34 fca
43 Some syntax corrections for non standard HP aCC
45 Revision 1.1 2000/07/10 13:58:01 fca
46 New version of ZDC from E.Scomparin & C.Oppedisano
48 Revision 1.7 2000/01/19 17:17:40 fca
50 Revision 1.6 1999/09/29 09:24:35 fca
51 Introduction of the Copyright and cvs Log
55 ///////////////////////////////////////////////////////////////////////////////
57 // Zero Degree Calorimeter //
58 // This class contains the basic functions for the ZDC //
59 // Functions specific to one particular geometry are //
60 // contained in the derived classes //
62 ///////////////////////////////////////////////////////////////////////////////
64 // --- Standard libraries
76 // --- AliRoot classes
78 #include "AliZDCHit.h"
79 #include "AliZDCDigit.h"
81 #include "AliDetector.h"
84 #include "AliCallf77.h"
87 #include "TLorentzVector.h"
93 ///////////////////////////////////////////////////////////////////////////////
95 // Zero Degree Calorimeter version 1 //
97 ///////////////////////////////////////////////////////////////////////////////
99 //_____________________________________________________________________________
100 AliZDCv1::AliZDCv1() : AliZDC()
103 // Default constructor for Zero Degree Calorimeter
116 //_____________________________________________________________________________
117 AliZDCv1::AliZDCv1(const char *name, const char *title)
121 // Standard constructor for Zero Degree Calorimeter
124 fDigits = new TClonesArray("AliZDCDigit",1000);
136 //_____________________________________________________________________________
137 void AliZDCv1::CreateGeometry()
140 // Create the geometry for the Zero Degree Calorimeter version 1
141 //* Initialize COMMON block ZDC_CGEOM
148 //_____________________________________________________________________________
149 void AliZDCv1::CreateBeamLine()
153 Float_t zq, conpar[9], elpar[3], tubpar[3];
158 Int_t *idtmed = fIdtmed->GetArray();
160 // -- Mother of the ZDC
171 gMC->Gsvolu("ZDC ", "PCON", idtmed[10], conpar, 9);
172 gMC->Gspos("ZDC ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
174 // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to
181 tubpar[2] = 3916.7/2.;
182 gMC->Gsvolu("P001", "TUBE", idtmed[5], tubpar, 3);
183 gMC->Gspos("P001", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
185 //-- SECOND SECTION OF THE BEAM PIPE (FROM THE END OF D1 TO THE BEGINNING OF
188 //-- FROM MAGNETIC BEGINNING OG D1 TO MAGNETIC END OF D1 + 23.5 cm
196 // gMC->Gsvolu("E001", "ELTU", idtmed[5], elpar, 3);
197 // gMC->Gspos("E001", 1, "ZDC ", 0., 0., elpar[2] + zd1, 0, "ONLY");
202 // gMC->Gsvolu("E002", "ELTU", idtmed[10], elpar, 3);
203 // gMC->Gspos("E002", 1, "E001", 0., 0., 0., 0, "ONLY");
210 // gMC->Gsvolu("E003", "ELTU", idtmed[5], elpar, 3);
211 // gMC->Gspos("E002", 1, "ZDC ", 0., 0., elpar[2] + zd1, 0, "ONLY");
216 // gMC->Gsvolu("E004", "ELTU", idtmed[10], elpar, 3);
217 // gMC->Gspos("E004", 1, "E003", 0., 0., 0., 0, "ONLY");
226 gMC->Gsvolu("C001", "CONE", idtmed[5], conpar, 5);
227 gMC->Gspos("C001", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
234 gMC->Gsvolu("P002", "TUBE", idtmed[5], tubpar, 3);
235 gMC->Gspos("P002", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
237 zd1 += tubpar[2] * 2.;
242 gMC->Gsvolu("P003", "TUBE", idtmed[5], tubpar, 3);
243 gMC->Gspos("P003", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
245 zd1 += tubpar[2] * 2.;
250 gMC->Gsvolu("P004", "TUBE", idtmed[5], tubpar, 3);
251 gMC->Gspos("P004", 1, "ZDC ", 0., 0., tubpar[0] + zd1, 0, "ONLY");
253 zd1 += tubpar[2] * 2.;
258 gMC->Gsvolu("P005", "TUBE", idtmed[5], tubpar, 3);
259 gMC->Gspos("P005", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
261 zd1 += tubpar[2] * 2.;
268 gMC->Gsvolu("P006", "CONE", idtmed[5], conpar, 5);
269 gMC->Gspos("P006", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
271 zd1 += conpar[0] * 2.;
276 gMC->Gsvolu("P007", "TUBE", idtmed[5], tubpar, 3);
277 gMC->Gspos("P007", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
279 zd1 += tubpar[2] * 2.;
286 gMC->Gsvolu("P008", "CONE", idtmed[5], conpar, 5);
287 gMC->Gspos("P008", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
289 zd1 += conpar[0] * 2.;
293 tubpar[2] = 205.8/2.;
294 gMC->Gsvolu("P009", "TUBE", idtmed[5], tubpar, 3);
295 gMC->Gspos("P009", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
297 zd1 += tubpar[2] * 2.;
301 tubpar[2] = 505.4/2.;
302 gMC->Gsvolu("P010", "TUBE", idtmed[5], tubpar, 3);
303 gMC->Gspos("P010", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
305 zd1 += tubpar[2] * 2.;
310 gMC->Gsvolu("P011", "TUBE", idtmed[5], tubpar, 3);
311 gMC->Gspos("P011", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
313 zd1 += tubpar[2] * 2.;
317 tubpar[2] = 778.5/2.;
318 gMC->Gsvolu("P012", "TUBE", idtmed[5], tubpar, 3);
319 gMC->Gspos("P012", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
321 zd1 += tubpar[2] * 2.;
323 conpar[0] = 14.18/2.;
328 gMC->Gsvolu("P013", "CONE", idtmed[5], conpar, 5);
329 gMC->Gspos("P013", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
331 zd1 += conpar[0] * 2.;
336 gMC->Gsvolu("P014", "TUBE", idtmed[5], tubpar, 3);
337 gMC->Gspos("P014", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
339 zd1 += tubpar[2] * 2.;
341 conpar[0] = 36.86/2.;
346 gMC->Gsvolu("P015", "CONE", idtmed[5], conpar, 5);
347 gMC->Gspos("P015", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
349 zd1 += conpar[0] * 2.;
353 tubpar[2] = 927.3/2.;
354 gMC->Gsvolu("P016", "TUBE", idtmed[5], tubpar, 3);
355 gMC->Gspos("P016", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
357 zd1 += tubpar[2] * 2.;
362 gMC->Gsvolu("P017", "TUBE", idtmed[8], tubpar, 3);
363 gMC->Gspos("P017", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
365 zd1 += tubpar[2] * 2.;
370 gMC->Gsvolu("Q017", "TUBE", idtmed[10], tubpar, 3);
372 //-- Position Q017 inside P017
373 gMC->Gspos("Q017", 1, "P017", -7.7, 0., 0., 0, "ONLY");
378 gMC->Gsvolu("R017", "TUBE", idtmed[10], tubpar, 3);
380 //-- Position R017 inside P017
381 gMC->Gspos("R017", 1, "P017", 7.7, 0., 0., 0, "ONLY");
383 //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2
388 gMC->Gsvolu("P018", "TUBE", idtmed[5], tubpar, 3);
393 gMC->Gsvolu("P019", "TUBE", idtmed[5], tubpar, 3);
397 AliMatrix(im1, 90.-0.071, 0., 90., 90., .071, 180.);
398 angle = .071*kDegrad;
399 gMC->Gspos("P018", 1, "ZDC ", TMath::Sin(angle) * 645. / 2. - 9.7 +
400 TMath::Sin(angle) * 945. / 2., 0., tubpar[2] + zd1, im1, "ONLY");
401 AliMatrix(im2, 90.+0.071, 0., 90., 90., .071, 0.);
402 gMC->Gspos("P019", 1, "ZDC ", 9.7 - TMath::Sin(angle) * 645. / 2., 0.,
403 tubpar[2] + zd1, im2, "ONLY");
405 // -- END OF BEAM PIPE VOLUME DEFINITION. MAGNET DEFINITION FOLLOWS
408 // -- COMPENSATOR DIPOLE (MBXW)
409 // GAP (VACUUM WITH MAGNETIC FIELD)
413 // tubpar[2] = 340./2.;
414 // gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3);
415 // gMC->Gspos("MBXW", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
417 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
421 // tubpar[2] = 340./2.;
422 // gMC->Gsvolu("YMBX", "TUBE", idtmed[5], tubpar, 3);
423 // gMC->Gspos("YMBX", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
425 // -- COMPENSATOR DIPOLE (MCBWA)
426 // GAP (VACUUM WITH MAGNETIC FIELD)
431 gMC->Gsvolu("MCBW", "TUBE", idtmed[11], tubpar, 3);
432 gMC->Gspos("MCBW", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
434 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
439 gMC->Gsvolu("YMCB", "TUBE", idtmed[5], tubpar, 3);
440 gMC->Gspos("YMCB", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
446 // -- DEFINE MQXL AND MQX QUADRUPOLE ELEMENT
449 // -- GAP (VACUUM WITH MAGNETIC FIELD)
454 gMC->Gsvolu("MQXL", "TUBE", idtmed[11], tubpar, 3);
461 gMC->Gsvolu("YMQL", "TUBE", idtmed[5], tubpar, 3);
463 gMC->Gspos("MQXL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
464 gMC->Gspos("YMQL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
466 gMC->Gspos("MQXL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
467 gMC->Gspos("YMQL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
470 // -- GAP (VACUUM WITH MAGNETIC FIELD)
475 gMC->Gsvolu("MQX ", "TUBE", idtmed[11], tubpar, 3);
482 gMC->Gsvolu("YMQ ", "TUBE", idtmed[5], tubpar, 3);
484 gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880., 0, "ONLY");
485 gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880., 0, "ONLY");
487 gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
488 gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
490 // -- SEPARATOR DIPOLE D1
494 // -- GAP (VACUUM WITH MAGNETIC FIELD)
499 gMC->Gsvolu("D1 ", "TUBE", idtmed[11], tubpar, 3);
506 gMC->Gsvolu("YD1 ", "TUBE", idtmed[5], tubpar, 3);
508 gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
509 gMC->Gspos("D1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
515 // -- GAP (VACUUM WITH MAGNETIC FIELD)
520 gMC->Gsvolu("D2 ", "TUBE", idtmed[11], tubpar, 3);
527 gMC->Gsvolu("YD2 ", "TUBE", idtmed[5], tubpar, 3);
529 gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., tubpar[2] + zd2, 0, "ONLY");
531 gMC->Gspos("D2 ", 1, "YD2 ", -9.7, 0., 0., 0, "ONLY");
532 gMC->Gspos("D2 ", 2, "YD2 ", 9.7, 0., 0., 0, "ONLY");
534 // -- END OF MAGNET DEFINITION
537 //_____________________________________________________________________________
538 void AliZDCv1::CreateZDC()
541 Int_t *idtmed = fIdtmed->GetArray();
543 Float_t DimPb[6], DimVoid[6];
546 //-- Create calorimeters geometry
548 //--> Neutron calorimeter (ZN)
550 gMC->Gsvolu("ZNEU", "BOX ", idtmed[1], fDimZN, 3); // Passive material
551 gMC->Gsvolu("ZNF1", "TUBE", idtmed[3], fFibZN, 3); // Active material
552 gMC->Gsvolu("ZNF2", "TUBE", idtmed[4], fFibZN, 3);
553 gMC->Gsvolu("ZNF3", "TUBE", idtmed[4], fFibZN, 3);
554 gMC->Gsvolu("ZNF4", "TUBE", idtmed[3], fFibZN, 3);
555 gMC->Gsvolu("ZNG1", "BOX ", idtmed[12], fGrvZN, 3); // Empty grooves
556 gMC->Gsvolu("ZNG2", "BOX ", idtmed[12], fGrvZN, 3);
557 gMC->Gsvolu("ZNG3", "BOX ", idtmed[12], fGrvZN, 3);
558 gMC->Gsvolu("ZNG4", "BOX ", idtmed[12], fGrvZN, 3);
560 // Divide ZNEU in towers (for hits purposes)
562 gMC->Gsdvn("ZNTX", "ZNEU", fTowZN[0], 1); // x-tower
563 gMC->Gsdvn("ZN1 ", "ZNTX", fTowZN[1], 2); // y-tower
565 //-- Divide ZN1 in minitowers
566 // fDivZN[0]= NUMBER OF FIBERS PER TOWER ALONG X-AXIS,
567 // fDivZN[1]= NUMBER OF FIBERS PER TOWER ALONG Y-AXIS
568 // (4 fibres per minitower)
570 gMC->Gsdvn("ZNSL", "ZN1 ", fDivZN[1], 2); // Slices
571 gMC->Gsdvn("ZNST", "ZNSL", fDivZN[0], 1); // Sticks
573 // --- Position the empty grooves in the sticks (4 grooves per stick)
574 Float_t dx = fDimZN[0] / fDivZN[0] / 4.;
575 Float_t dy = fDimZN[1] / fDivZN[1] / 4.;
577 gMC->Gspos("ZNG1", 1, "ZNST", 0.-dx, 0.+dy, 0., 0, "ONLY");
578 gMC->Gspos("ZNG2", 1, "ZNST", 0.+dx, 0.+dy, 0., 0, "ONLY");
579 gMC->Gspos("ZNG3", 1, "ZNST", 0.-dx, 0.-dy, 0., 0, "ONLY");
580 gMC->Gspos("ZNG4", 1, "ZNST", 0.+dx, 0.-dy, 0., 0, "ONLY");
582 // --- Position the fibers in the grooves
583 gMC->Gspos("ZNF1", 1, "ZNG1", 0., 0., 0., 0, "ONLY");
584 gMC->Gspos("ZNF2", 1, "ZNG2", 0., 0., 0., 0, "ONLY");
585 gMC->Gspos("ZNF3", 1, "ZNG3", 0., 0., 0., 0, "ONLY");
586 gMC->Gspos("ZNF4", 1, "ZNG4", 0., 0., 0., 0, "ONLY");
588 // --- Position the neutron calorimeter in ZDC
589 gMC->Gspos("ZNEU", 1, "ZDC ", fPosZN[0], fPosZN[1], fPosZN[2] + fDimZN[2], 0, "ONLY");
592 //--> Proton calorimeter (ZP)
594 gMC->Gsvolu("ZPRO", "BOX ", idtmed[2], fDimZP, 3); // Passive material
595 gMC->Gsvolu("ZPF1", "TUBE", idtmed[3], fFibZP, 3); // Active material
596 gMC->Gsvolu("ZPF2", "TUBE", idtmed[4], fFibZP, 3);
597 gMC->Gsvolu("ZPF3", "TUBE", idtmed[4], fFibZP, 3);
598 gMC->Gsvolu("ZPF4", "TUBE", idtmed[3], fFibZP, 3);
599 gMC->Gsvolu("ZPG1", "BOX ", idtmed[12], fGrvZP, 3); // Empty grooves
600 gMC->Gsvolu("ZPG2", "BOX ", idtmed[12], fGrvZP, 3);
601 gMC->Gsvolu("ZPG3", "BOX ", idtmed[12], fGrvZP, 3);
602 gMC->Gsvolu("ZPG4", "BOX ", idtmed[12], fGrvZP, 3);
604 //-- Divide ZPRO in towers(for hits purposes)
606 gMC->Gsdvn("ZPTX", "ZPRO", fTowZP[0], 1); // x-tower
607 gMC->Gsdvn("ZP1 ", "ZPTX", fTowZP[1], 2); // y-tower
610 //-- Divide ZP1 in minitowers
611 // fDivZP[0]= NUMBER OF FIBERS ALONG X-AXIS PER MINITOWER,
612 // fDivZP[1]= NUMBER OF FIBERS ALONG Y-AXIS PER MINITOWER
613 // (4 fiber per minitower)
615 gMC->Gsdvn("ZPSL", "ZP1 ", fDivZP[1], 2); // Slices
616 gMC->Gsdvn("ZPST", "ZPSL", fDivZP[0], 1); // Sticks
618 // --- Position the empty grooves in the sticks (4 grooves per stick)
619 dx = fDimZP[0] / fTowZP[0] / fDivZP[0] / 2.;
620 dy = fDimZP[1] / fTowZP[1] / fDivZP[1] / 2.;
622 gMC->Gspos("ZPG1", 1, "ZPST", 0.-dx, 0.+dy, 0., 0, "ONLY");
623 gMC->Gspos("ZPG2", 1, "ZPST", 0.+dx, 0.+dy, 0., 0, "ONLY");
624 gMC->Gspos("ZPG3", 1, "ZPST", 0.-dx, 0.-dy, 0., 0, "ONLY");
625 gMC->Gspos("ZPG4", 1, "ZPST", 0.+dx, 0.-dy, 0., 0, "ONLY");
627 // --- Position the fibers in the grooves
628 gMC->Gspos("ZPF1", 1, "ZPG1", 0., 0., 0., 0, "ONLY");
629 gMC->Gspos("ZPF2", 1, "ZPG2", 0., 0., 0., 0, "ONLY");
630 gMC->Gspos("ZPF3", 1, "ZPG3", 0., 0., 0., 0, "ONLY");
631 gMC->Gspos("ZPF4", 1, "ZPG4", 0., 0., 0., 0, "ONLY");
634 // --- Position the proton calorimeter in ZDC
635 gMC->Gspos("ZPRO", 1, "ZDC ", fPosZP[0], fPosZP[1], fPosZP[2] + fDimZP[2], 0, "ONLY");
639 //--> EM calorimeter (ZEM)
641 gMC->Gsvolu("ZEM ", "PARA", idtmed[10], fDimZEM, 6);
643 gMC->Matrix(irot1,0.,0.,90.,90.,90.,180.); // Rotation matrix 1
644 gMC->Matrix(irot2,180.,0.,90.,fDimZEM[3]+90.,90.,fDimZEM[3]); // Rotation matrix 2
645 // printf("irot1 = %d, irot2 = %d \n", irot1, irot2);
647 gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material
649 gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches
651 DimPb[0] = fDimZEMPb; // Lead slices
652 DimPb[1] = fDimZEM[2];
653 DimPb[2] = fDimZEM[1];
654 DimPb[3] = 90.-fDimZEM[3];
657 gMC->Gsvolu("ZEL0", "PARA", idtmed[6], DimPb, 6);
658 gMC->Gsvolu("ZEL1", "PARA", idtmed[6], DimPb, 6);
659 gMC->Gsvolu("ZEL2", "PARA", idtmed[6], DimPb, 6);
661 // --- Position the lead slices in the tranche
662 Float_t zTran = fDimZEM[0]/fDivZEM[2];
663 Float_t zTrPb = -zTran+fDimZEMPb;
664 gMC->Gspos("ZEL0", 1, "ZETR", zTrPb, 0., 0., 0, "ONLY");
665 gMC->Gspos("ZEL1", 1, "ZETR", fDimZEMPb, 0., 0., 0, "ONLY");
667 // --- Vacuum zone (to be filled with fibres)
668 DimVoid[0] = (zTran-2*fDimZEMPb)/2.;
669 DimVoid[1] = fDimZEM[2];
670 DimVoid[2] = fDimZEM[1];
671 DimVoid[3] = 90.-fDimZEM[3];
674 gMC->Gsvolu("ZEV0", "PARA", idtmed[10], DimVoid,6);
675 gMC->Gsvolu("ZEV1", "PARA", idtmed[10], DimVoid,6);
677 // --- Divide the vacuum slice into sticks along x axis
678 gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3);
679 gMC->Gsdvn("ZES1", "ZEV1", fDivZEM[0], 3);
681 // --- Positioning the fibers into the sticks
682 gMC->Gspos("ZEMF", 1,"ZES0", 0., 0., 0., irot2, "ONLY");
683 gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY");
685 // --- Positioning the vacuum slice into the tranche
686 Float_t DisplFib = fDimZEM[1]/fDivZEM[0];
687 gMC->Gspos("ZEV0", 1,"ZETR", -DimVoid[0], 0., 0., 0, "ONLY");
688 gMC->Gspos("ZEV1", 1,"ZETR", -DimVoid[0]+zTran, 0., DisplFib, 0, "ONLY");
690 // --- Positioning the ZEM into the ZDC - rotation for 90 degrees
691 gMC->Gspos("ZEM ", 1,"ZDC ", fPosZEM[0], fPosZEM[1], fPosZEM[2], irot1, "ONLY");
693 // --- Adding last slice at the end of the EM calorimeter
694 Float_t zLastSlice = fPosZEM[2]+fDimZEMPb+fDimZEM[0];
695 gMC->Gspos("ZEL2", 1,"ZDC ", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY");
699 //_____________________________________________________________________________
700 void AliZDCv1::DrawModule()
703 // Draw a shaded view of the Zero Degree Calorimeter version 1
706 // Set everything unseen
707 gMC->Gsatt("*", "seen", -1);
709 // Set ALIC mother transparent
710 gMC->Gsatt("ALIC","SEEN",0);
712 // Set the volumes visible
713 gMC->Gsatt("ZDC ","SEEN",0);
714 gMC->Gsatt("P001","SEEN",1);
715 gMC->Gsatt("E001","SEEN",1);
716 gMC->Gsatt("E002","SEEN",1);
717 gMC->Gsatt("E003","SEEN",1);
718 gMC->Gsatt("E004","SEEN",1);
719 gMC->Gsatt("C001","SEEN",1);
720 gMC->Gsatt("P002","SEEN",1);
721 gMC->Gsatt("P003","SEEN",1);
722 gMC->Gsatt("P004","SEEN",1);
723 gMC->Gsatt("P005","SEEN",1);
724 gMC->Gsatt("P006","SEEN",1);
725 gMC->Gsatt("P007","SEEN",1);
726 gMC->Gsatt("P008","SEEN",1);
727 gMC->Gsatt("P009","SEEN",1);
728 gMC->Gsatt("P010","SEEN",1);
729 gMC->Gsatt("P011","SEEN",1);
730 gMC->Gsatt("P012","SEEN",1);
731 gMC->Gsatt("P013","SEEN",1);
732 gMC->Gsatt("P014","SEEN",1);
733 gMC->Gsatt("P015","SEEN",1);
734 gMC->Gsatt("P016","SEEN",1);
735 gMC->Gsatt("P017","SEEN",1);
736 gMC->Gsatt("Q017","SEEN",1);
737 gMC->Gsatt("R017","SEEN",1);
738 gMC->Gsatt("P018","SEEN",1);
739 gMC->Gsatt("P019","SEEN",1);
740 // gMC->Gsatt("MBXW","SEEN",1);
741 // gMC->Gsatt("YMBX","SEEN",1);
742 gMC->Gsatt("MCBW","SEEN",1);
743 gMC->Gsatt("YMCB","SEEN",1);
744 gMC->Gsatt("MQXL","SEEN",1);
745 gMC->Gsatt("YMQL","SEEN",1);
746 gMC->Gsatt("MQX ","SEEN",1);
747 gMC->Gsatt("YMQ ","SEEN",1);
748 gMC->Gsatt("D1 ","SEEN",1);
749 gMC->Gsatt("YD1 ","SEEN",1);
750 gMC->Gsatt("D2 ","SEEN",1);
751 gMC->Gsatt("YD2 ","SEEN",1);
752 gMC->Gsatt("ZNEU","SEEN",0);
753 gMC->Gsatt("ZNF1","SEEN",0);
754 gMC->Gsatt("ZNF2","SEEN",0);
755 gMC->Gsatt("ZNF3","SEEN",0);
756 gMC->Gsatt("ZNF4","SEEN",0);
757 gMC->Gsatt("ZNG1","SEEN",0);
758 gMC->Gsatt("ZNG2","SEEN",0);
759 gMC->Gsatt("ZNG3","SEEN",0);
760 gMC->Gsatt("ZNG4","SEEN",0);
761 gMC->Gsatt("ZNTX","SEEN",0);
762 gMC->Gsatt("ZN1 ","COLO",2);
763 gMC->Gsatt("ZN1 ","SEEN",1);
764 gMC->Gsatt("ZNSL","SEEN",0);
765 gMC->Gsatt("ZNST","SEEN",0);
766 gMC->Gsatt("ZPRO","SEEN",0);
767 gMC->Gsatt("ZPF1","SEEN",0);
768 gMC->Gsatt("ZPF2","SEEN",0);
769 gMC->Gsatt("ZPF3","SEEN",0);
770 gMC->Gsatt("ZPF4","SEEN",0);
771 gMC->Gsatt("ZPG1","SEEN",0);
772 gMC->Gsatt("ZPG2","SEEN",0);
773 gMC->Gsatt("ZPG3","SEEN",0);
774 gMC->Gsatt("ZPG4","SEEN",0);
775 gMC->Gsatt("ZPTX","SEEN",0);
776 gMC->Gsatt("ZP1 ","COLO",2);
777 gMC->Gsatt("ZP1 ","SEEN",1);
778 gMC->Gsatt("ZPSL","SEEN",0);
779 gMC->Gsatt("ZPST","SEEN",0);
780 gMC->Gsatt("ZEM ","COLO",2);
781 gMC->Gsatt("ZEM ","SEEN",1);
782 gMC->Gsatt("ZEMF","SEEN",0);
783 gMC->Gsatt("ZETR","SEEN",0);
784 gMC->Gsatt("ZEL0","SEEN",0);
785 gMC->Gsatt("ZEL1","SEEN",0);
786 gMC->Gsatt("ZEL2","SEEN",0);
787 gMC->Gsatt("ZEV0","SEEN",0);
788 gMC->Gsatt("ZEV1","SEEN",0);
789 gMC->Gsatt("ZES0","SEEN",0);
790 gMC->Gsatt("ZES1","SEEN",0);
793 gMC->Gdopt("hide", "on");
794 gMC->Gdopt("shad", "on");
795 gMC->Gsatt("*", "fill", 7);
796 gMC->SetClipBox(".");
797 gMC->SetClipBox("*", 0, 100, -100, 100, 12000, 16000);
799 gMC->Gdraw("alic", 40, 30, 0, 488, 220, .07, .07);
800 gMC->Gdhead(1111, "Zero Degree Calorimeter Version 1");
801 gMC->Gdman(18, 4, "MAN");
804 //_____________________________________________________________________________
805 void AliZDCv1::CreateMaterials()
808 // Create Materials for the Zero Degree Calorimeter
810 // Origin : E. Scomparin
812 Int_t *idtmed = fIdtmed->GetArray();
814 Float_t dens, ubuf[1], wmat[2], a[2], z[2], epsil=0.001, stmin=0.01;
815 Int_t i, isvolActive, isvol, inofld;
816 Float_t fieldm = gAlice->Field()->Max();
817 Float_t tmaxfd=gAlice->Field()->Max();
818 Int_t isxfld = gAlice->Field()->Integ();
822 // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3
824 // --- Tantalum -> ZN passive material
826 AliMaterial(1, "TANT", 180.95, 73., 16.65, .4, 11.9, ubuf, 1);
830 // AliMaterial(1, "TUNG", 183.85, 74., 19.3, .35, 10.3, ubuf, 1);
832 // --- Brass (CuZn) -> ZP passive material
840 AliMixture(2, "BRASS ", a, z, dens, 2, wmat);
850 AliMixture(3, "SIO2 ", a, z, dens, -2, wmat);
855 AliMaterial(5, "LEAD", 207.19, 82., 11.35, .56, 18.5, ubuf, 1);
859 // AliMaterial(7, "COPP", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
861 // --- Iron (energy loss taken into account)
863 AliMaterial(6, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
865 // --- Iron (no energy loss)
867 AliMaterial(7, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
869 // --- Vacuum (no magnetic field)
870 AliMaterial(10, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
872 // --- Vacuum (with magnetic field)
873 AliMaterial(11, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
875 // --- Air (no magnetic field)
876 AliMaterial(12, "Air $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0);
878 // --- Definition of tracking media:
880 // --- Tantalum = 1 ;
882 // --- Fibers (SiO2) = 3 ;
883 // --- Fibers (SiO2) = 4 ;
885 // --- Iron (with energy loss) = 6 ;
886 // --- Iron (without energy loss) = 7 ;
887 // --- Vacuum (no field) = 10
888 // --- Vacuum (with field) = 11
889 // --- Air (no field) = 12
892 // --- Tracking media parameters
900 AliMedium(1, "ZTANT", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
901 // AliMedium(1, "ZW", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
902 AliMedium(2, "ZBRASS", 2, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
903 AliMedium(3, "ZSIO2", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
904 AliMedium(4, "ZQUAR", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
905 AliMedium(6, "ZLEAD", 5, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
906 // AliMedium(7, "ZCOPP", 7, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
907 AliMedium(5, "ZIRON", 6, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
908 AliMedium(8, "ZIRONN", 7, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
909 AliMedium(10, "ZVOID", 10, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
910 AliMedium(12, "ZAIR", 12, 0, inofld, fieldm, tmaxfd, stemax,deemax, epsil, stmin);
913 AliMedium(11, "ZVOIM", 11, isvol, isxfld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
915 // Thresholds for showering in the ZDCs
918 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
919 gMC->Gstpar(idtmed[i], "CUTELE", .001);
920 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
921 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
923 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
924 gMC->Gstpar(idtmed[i], "CUTELE", .001);
925 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
926 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
928 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
929 gMC->Gstpar(idtmed[i], "CUTELE", .001);
930 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
931 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
933 // Avoid too detailed showering along the beam line
936 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
937 gMC->Gstpar(idtmed[i], "CUTELE", .1);
938 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
939 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
941 // Avoid interaction in fibers (only energy loss allowed)
943 gMC->Gstpar(idtmed[i], "DCAY", 0.);
944 gMC->Gstpar(idtmed[i], "MULS", 0.);
945 gMC->Gstpar(idtmed[i], "PFIS", 0.);
946 gMC->Gstpar(idtmed[i], "MUNU", 0.);
947 gMC->Gstpar(idtmed[i], "LOSS", 1.);
948 gMC->Gstpar(idtmed[i], "PHOT", 0.);
949 gMC->Gstpar(idtmed[i], "COMP", 0.);
950 gMC->Gstpar(idtmed[i], "PAIR", 0.);
951 gMC->Gstpar(idtmed[i], "BREM", 0.);
952 gMC->Gstpar(idtmed[i], "DRAY", 0.);
953 gMC->Gstpar(idtmed[i], "ANNI", 0.);
954 gMC->Gstpar(idtmed[i], "HADR", 0.);
956 gMC->Gstpar(idtmed[i], "DCAY", 0.);
957 gMC->Gstpar(idtmed[i], "MULS", 0.);
958 gMC->Gstpar(idtmed[i], "PFIS", 0.);
959 gMC->Gstpar(idtmed[i], "MUNU", 0.);
960 gMC->Gstpar(idtmed[i], "LOSS", 1.);
961 gMC->Gstpar(idtmed[i], "PHOT", 0.);
962 gMC->Gstpar(idtmed[i], "COMP", 0.);
963 gMC->Gstpar(idtmed[i], "PAIR", 0.);
964 gMC->Gstpar(idtmed[i], "BREM", 0.);
965 gMC->Gstpar(idtmed[i], "DRAY", 0.);
966 gMC->Gstpar(idtmed[i], "ANNI", 0.);
967 gMC->Gstpar(idtmed[i], "HADR", 0.);
969 // Avoid interaction in void
971 gMC->Gstpar(idtmed[i], "DCAY", 0.);
972 gMC->Gstpar(idtmed[i], "MULS", 0.);
973 gMC->Gstpar(idtmed[i], "PFIS", 0.);
974 gMC->Gstpar(idtmed[i], "MUNU", 0.);
975 gMC->Gstpar(idtmed[i], "LOSS", 0.);
976 gMC->Gstpar(idtmed[i], "PHOT", 0.);
977 gMC->Gstpar(idtmed[i], "COMP", 0.);
978 gMC->Gstpar(idtmed[i], "PAIR", 0.);
979 gMC->Gstpar(idtmed[i], "BREM", 0.);
980 gMC->Gstpar(idtmed[i], "DRAY", 0.);
981 gMC->Gstpar(idtmed[i], "ANNI", 0.);
982 gMC->Gstpar(idtmed[i], "HADR", 0.);
985 fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1
986 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2
987 fMedSensZN = idtmed[1]; // Sensitive volume: ZN passive material
988 fMedSensZP = idtmed[2]; // Sensitive volume: ZP passive material
989 fMedSensZEM = idtmed[6]; // Sensitive volume: ZEM passive material
990 fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves
991 fMedSensPI = idtmed[5]; // Sensitive volume: beam pipes
994 //_____________________________________________________________________________
995 void AliZDCv1::Init()
1000 //_____________________________________________________________________________
1001 void AliZDCv1::InitTables()
1004 //Initialize parameters for light tables and read them
1010 char *lightfName1,*lightfName2,*lightfName3,*lightfName4,
1011 *lightfName5,*lightfName6,*lightfName7,*lightfName8;
1012 FILE *fp1, *fp2, *fp3, *fp4, *fp5, *fp6, *fp7, *fp8;
1014 lightfName1 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362207s");
1015 if((fp1 = fopen(lightfName1,"r")) == NULL){
1016 printf("Cannot open file fp1 \n");
1019 lightfName2 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362208s");
1020 if((fp2 = fopen(lightfName2,"r")) == NULL){
1021 printf("Cannot open file fp2 \n");
1024 lightfName3 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362209s");
1025 if((fp3 = fopen(lightfName3,"r")) == NULL){
1026 printf("Cannot open file fp3 \n");
1029 lightfName4 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362210s");
1030 if((fp4 = fopen(lightfName4,"r")) == NULL){
1031 printf("Cannot open file fp4 \n");
1034 // printf(" --- Reading light tables for ZN \n");
1035 for(k=0; k<fNalfan; k++){
1036 for(j=0; j<fNben; j++){
1037 fscanf(fp1,"%f",&fTablen[0][k][j]);
1038 fscanf(fp2,"%f",&fTablen[1][k][j]);
1039 fscanf(fp3,"%f",&fTablen[2][k][j]);
1040 fscanf(fp4,"%f",&fTablen[3][k][j]);
1048 lightfName5 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552207s");
1049 if((fp5 = fopen(lightfName5,"r")) == NULL){
1050 printf("Cannot open file fp5 \n");
1053 lightfName6 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552208s");
1054 if((fp6 = fopen(lightfName6,"r")) == NULL){
1055 printf("Cannot open file fp6 \n");
1058 lightfName7 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552209s");
1059 if((fp7 = fopen(lightfName7,"r")) == NULL){
1060 printf("Cannot open file fp7 \n");
1063 lightfName8 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552210s");
1064 if((fp8 = fopen(lightfName8,"r")) == NULL){
1065 printf("Cannot open file fp8 \n");
1068 // printf(" --- Reading light tables for ZP and ZEM \n");
1069 for(k=0; k<fNalfap; k++){
1070 for(j=0; j<fNbep; j++){
1071 fscanf(fp5,"%f",&fTablep[0][k][j]);
1072 fscanf(fp6,"%f",&fTablep[1][k][j]);
1073 fscanf(fp7,"%f",&fTablep[2][k][j]);
1074 fscanf(fp8,"%f",&fTablep[3][k][j]);
1083 //_____________________________________________________________________________
1084 Int_t AliZDCv1::Digitize(Int_t Det, Int_t Quad, Int_t Light)
1086 // Evaluation of the ADC channel corresponding to the light yield Light
1089 printf("\n Digitize -> Det = %d, Quad = %d, Light = %d\n", Det, Quad, Light);
1095 fPedMean[i][j] = 50.;
1096 fPedSigma[i][j] = 10.;
1097 fPMGain[i][j] = 10000000.;
1100 fADCRes = 0.00000064; // ADC Resolution: 250 fC/ADCch
1102 Float_t Ped = gRandom->Gaus(fPedMean[Det-1][Quad],fPedSigma[Det-1][Quad]);
1103 Int_t ADCch = Int_t(Light*fPMGain[Det-1][Quad]*fADCRes+Ped);
1106 printf(" Ped = %f, ADCch = %d\n", Ped, ADCch);
1111 //_____________________________________________________________________________
1112 void AliZDCv1::Hits2Digits(Int_t ntracks)
1114 // Creation of the digits from hits
1116 if(fDigits!=0) fDigits->Clear();
1117 else fDigits = new TClonesArray ("AliZDCDigit",1000);
1119 char branchname[10];
1120 sprintf(branchname,"%s",GetName());
1121 gAlice->TreeD()->Branch(branchname,&fDigits, fBufferSize);
1123 gAlice->TreeD()->GetEvent(0);
1125 AliZDCDigit *newdigit;
1128 Int_t PMCZN = 0, PMCZP = 0, PMQZN[4], PMQZP[4], PMZEM = 0;
1137 for(itrack=0; itrack<ntracks; itrack++){
1138 gAlice->ResetHits();
1139 gAlice->TreeH()->GetEvent(itrack);
1140 for(i=0; i<fHits->GetEntries(); i++){
1141 hit = (AliZDCHit*)fHits->At(i);
1142 Int_t det = hit->GetVolume(0);
1143 Int_t quad = hit->GetVolume(1);
1144 Int_t lightQ = Int_t(hit->GetLightPMQ());
1145 Int_t lightC = Int_t(hit->GetLightPMC());
1147 printf(" \n itrack = %d, fNhits = %d, det = %d, quad = %d,"
1148 "lightC = %d lightQ = %d\n", itrack, fNhits, det, quad, lightC, lightQ);
1151 PMCZN = PMCZN + lightC;
1152 PMQZN[quad-1] = PMQZN[quad-1] + lightQ;
1156 PMCZP = PMCZP + lightC;
1157 PMQZP[quad-1] = PMQZP[quad-1] + lightQ;
1161 PMZEM = PMZEM + lightC;
1166 printf("\n PMCZN = %d, PMQZN[0] = %d, PMQZN[1] = %d, PMQZN[2] = %d, PMQZN[3] = %d\n"
1167 , PMCZN, PMQZN[0], PMQZN[1], PMQZN[2], PMQZN[3]);
1168 printf("\n PMCZP = %d, PMQZP[0] = %d, PMQZP[1] = %d, PMQZP[2] = %d, PMQZP[3] = %d\n"
1169 , PMCZP, PMQZP[0], PMQZP[1], PMQZP[2], PMQZP[3]);
1170 printf("\n PMZEM = %d\n", PMZEM);
1173 // ------------------------------------ Hits2Digits
1175 newdigit = new AliZDCDigit(1, 0, Digitize(1, 0, PMCZN));
1176 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1182 newdigit = new AliZDCDigit(1, j+1, Digitize(1, j+1, PMQZN[j]));
1183 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1189 newdigit = new AliZDCDigit(2, 0, Digitize(2, 0, PMCZP));
1190 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1196 newdigit = new AliZDCDigit(2, k+1, Digitize(2, k+1, PMQZP[k]));
1197 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1203 newdigit = new AliZDCDigit(3, 0, Digitize(3, 0, PMZEM));
1204 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1211 gAlice->TreeD()->Fill();
1212 gAlice->TreeD()->Write(0,TObject::kOverwrite);
1215 printf("\n Event Digits -----------------------------------------------------\n");
1220 //_____________________________________________________________________________
1221 void AliZDCv1::MakeBranch(Option_t *opt)
1224 // Create a new branch in the current Root Tree
1227 AliDetector::MakeBranch(opt);
1229 char branchname[10];
1230 sprintf(branchname,"%s",GetName());
1231 char *cD = strstr(opt,"D");
1233 if (fDigits && gAlice->TreeD() && cD) {
1234 gAlice->TreeD()->Branch(branchname,&fDigits, fBufferSize);
1235 printf("* AliZDCv1::MakeBranch * Making Branch %s for digits\n\n",branchname);
1238 //_____________________________________________________________________________
1239 void AliZDCv1::StepManager()
1242 // Routine called at every step in the Zero Degree Calorimeters
1247 Int_t vol[2], ibeta=0, ialfa, ibe, nphe;
1248 Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, radius, out;
1249 TLorentzVector s, p;
1253 if((gMC->GetMedium() == fMedSensZN) || (gMC->GetMedium() == fMedSensZP) ||
1254 (gMC->GetMedium() == fMedSensGR) || (gMC->GetMedium() == fMedSensF1) ||
1255 (gMC->GetMedium() == fMedSensF2) || (gMC->GetMedium() == fMedSensZEM) ||
1256 (gMC->GetMedium() == fMedSensPI)){
1258 // If particle interacts with beam pipe -> return
1259 if(gMC->GetMedium() == fMedSensPI){
1261 // If option NoShower is set -> StopTrack
1262 if(fNoShower==1) gMC->StopTrack();
1266 //Particle coordinates
1267 gMC->TrackPosition(s);
1268 for(j=0; j<=2; j++){
1275 // Determine in which ZDC the particle is
1276 knamed = gMC->CurrentVolName();
1277 if(!strncmp(knamed,"ZN",2))vol[0]=1;
1278 if(!strncmp(knamed,"ZP",2))vol[0]=2;
1279 if(!strncmp(knamed,"ZE",2))vol[0]=3;
1281 // Determine in which quadrant the particle is
1285 xdet[0] = x[0]-fPosZN[0];
1286 xdet[1] = x[1]-fPosZN[1];
1287 if((xdet[0]<=0.) && (xdet[1]>=0.)) vol[1]=1;
1288 if((xdet[0]>0.) && (xdet[1]>0.)) vol[1]=2;
1289 if((xdet[0]<0.) && (xdet[1]<0.)) vol[1]=3;
1290 if((xdet[0]>0.) && (xdet[1]<0.)) vol[1]=4;
1295 xdet[0] = x[0]-fPosZP[0];
1296 xdet[1] = x[1]-fPosZP[1];
1297 if(xdet[0]>fDimZP[0])xdet[0]=fDimZP[0]-0.01;
1298 if(xdet[0]<-fDimZP[0])xdet[0]=-fDimZP[0]+0.01;
1299 Float_t xqZP = xdet[0]/(fDimZP[0]/2);
1300 for(int i=1; i<=4; i++){
1301 if(xqZP>=(i-3) && xqZP<(i-2)){
1308 //ZEM has only 1 quadrant
1311 xdet[0] = x[0]-fPosZEM[0];
1312 xdet[1] = x[1]-fPosZEM[1];
1313 // printf("x %f %f xdet %f %f\n",x[0],x[1],xdet[0],xdet[1]);
1317 // printf("\n-> Det. %d Quad. %d \n", vol[0], vol[1]);
1318 // printf("x %f %f xdet %f %f\n",x[0],x[1],xdet[0],xdet[1]);}
1320 // Store impact point and kinetic energy of the ENTERING particle
1322 // Int_t Curtrack = gAlice->CurrentTrack();
1323 // Int_t Prim = gAlice->GetPrimary(Curtrack);
1324 // printf ("Primary: %d, Current Track: %d \n", Prim, Curtrack);
1326 // if(Curtrack==Prim){
1327 if(gMC->IsTrackEntering()){
1329 gMC->TrackMomentum(p);
1330 // printf("p[0] = %f, p[1] = %f, p[2] = %f, p[3] = %f \n",
1331 // p[0], p[1], p[2], p[3]);
1334 // Impact point on ZDC
1342 // Int_t PcID = gMC->TrackPid();
1343 // printf("Pc ID -> %d\n",PcID);
1344 AddHit(gAlice->CurrentTrack(), vol, hits);
1353 // Charged particles -> Energy loss
1354 if((destep=gMC->Edep())){
1355 if(gMC->IsTrackStop()){
1356 gMC->TrackMomentum(p);
1357 m = gMC->TrackMass();
1359 if(ekin<0.) printf("ATTENTION!!!!!!!!!!!!!!! -> ekin = %f <0 (?)",ekin);
1363 AddHit(gAlice->CurrentTrack(), vol, hits);
1369 AddHit(gAlice->CurrentTrack(), vol, hits);
1371 // printf(" -> Charged particle -> Dep. E = %f eV \n",hits[8]);
1377 // *** Light production in fibres
1378 if((gMC->GetMedium() == fMedSensF1) || (gMC->GetMedium() == fMedSensF2)){
1380 //Select charged particles
1381 if((destep=gMC->Edep())){
1382 // printf(" -> CHARGED particle!!! \n");
1384 // Particle velocity
1385 gMC->TrackMomentum(p);
1386 Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
1387 Float_t beta = ptot/p[3];
1388 // Int_t pcID = gMC->TrackPid();
1389 // printf(" Pc %d in quadrant %d -> beta = %f \n", pcID, vol[1], beta);
1390 if(beta<0.67) return;
1391 if((beta>=0.67) && (beta<=0.75)) ibeta = 0;
1392 if((beta>0.75) && (beta<=0.85)) ibeta = 1;
1393 if((beta>0.85) && (beta<=0.95)) ibeta = 2;
1394 // if((beta>0.95) && (beta<=1.00)) ibeta = 3;
1395 if(beta>0.95) ibeta = 3;
1397 // Angle between particle trajectory and fibre axis
1398 // 1 -> Momentum directions
1402 gMC->Gmtod(um,ud,2);
1403 // 2 -> Angle < limit angle
1404 Double_t alfar = TMath::ACos(ud[2]);
1405 Double_t alfa = alfar*kRaddeg;
1406 if(alfa>=110.) return;
1407 ialfa = Int_t(1.+alfa/2.);
1409 // Distance between particle trajectory and fibre axis
1410 gMC->TrackPosition(s);
1411 for(j=0; j<=2; j++){
1414 gMC->Gmtod(x,xdet,1);
1415 if(TMath::Abs(ud[0])>0.00001){
1416 Float_t dcoeff = ud[1]/ud[0];
1417 be = TMath::Abs((xdet[1]-dcoeff*xdet[0])/TMath::Sqrt(dcoeff*dcoeff+1.));
1420 be = TMath::Abs(ud[0]);
1423 if((vol[0]==1)) radius = fFibZN[1];
1424 if((vol[0]==2)) radius = fFibZP[1];
1425 ibe = Int_t(be*1000.+1);
1427 //Looking into the light tables
1428 Float_t charge = gMC->TrackCharge();
1432 if(ibe>fNben) ibe=fNben;
1433 out = charge*charge*fTablen[ibeta][ialfa][ibe];
1434 nphe = gRandom->Poisson(out);
1435 if(gMC->GetMedium() == fMedSensF1){
1436 hits[7] = nphe; //fLightPMQ
1439 AddHit(gAlice->CurrentTrack(), vol, hits);
1443 hits[8] = nphe; //fLightPMC
1445 AddHit(gAlice->CurrentTrack(), vol, hits);
1451 if(ibe>fNbep) ibe=fNbep;
1452 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1453 nphe = gRandom->Poisson(out);
1454 if(gMC->GetMedium() == fMedSensF1){
1455 hits[7] = nphe; //fLightPMQ
1458 AddHit(gAlice->CurrentTrack(), vol, hits);
1462 hits[8] = nphe; //fLightPMC
1464 AddHit(gAlice->CurrentTrack(), vol, hits);
1469 if(ibe>fNbep) ibe=fNbep;
1470 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1471 nphe = gRandom->Poisson(out);
1472 hits[7] = nphe; //fLightPMQ
1475 AddHit(gAlice->CurrentTrack(), vol, hits);