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.12 2001/01/26 19:56:27 hristov
19 Major upgrade of AliRoot code
21 Revision 1.11 2001/01/16 07:43:33 hristov
22 Initialisation of ZDC hits
24 Revision 1.10 2000/12/14 15:20:02 coppedis
25 Hits2Digits method for digitization
27 Revision 1.9 2000/12/13 10:33:49 coppedis
28 Prints only if fDebug==1
30 Revision 1.8 2000/12/12 14:10:02 coppedis
31 Correction suggested by M. Masera
33 Revision 1.7 2000/11/30 17:23:47 coppedis
34 Remove first corrector dipole and introduce digitization
36 Revision 1.6 2000/11/22 11:33:10 coppedis
39 Revision 1.5 2000/10/02 21:28:20 fca
40 Removal of useless dependecies via forward declarations
42 Revision 1.3.2.1 2000/08/24 09:25:47 hristov
43 Patch by P.Hristov: Bug in ZDC geometry corrected by E.Scomparin
45 Revision 1.4 2000/08/24 09:23:59 hristov
46 Bug in ZDC geometry corrected by E.Scomparin
48 Revision 1.3 2000/07/12 06:59:16 fca
49 Fixing dimension of hits array
51 Revision 1.2 2000/07/11 11:12:34 fca
52 Some syntax corrections for non standard HP aCC
54 Revision 1.1 2000/07/10 13:58:01 fca
55 New version of ZDC from E.Scomparin & C.Oppedisano
57 Revision 1.7 2000/01/19 17:17:40 fca
59 Revision 1.6 1999/09/29 09:24:35 fca
60 Introduction of the Copyright and cvs Log
64 ///////////////////////////////////////////////////////////////////////////////
66 // Zero Degree Calorimeter //
67 // This class contains the basic functions for the ZDC //
68 // Functions specific to one particular geometry are //
69 // contained in the derived classes //
71 ///////////////////////////////////////////////////////////////////////////////
73 // --- Standard libraries
85 // --- AliRoot classes
87 #include "AliZDCHit.h"
88 #include "AliZDCDigit.h"
90 #include "AliDetector.h"
93 #include "AliCallf77.h"
96 #include "TLorentzVector.h"
102 ///////////////////////////////////////////////////////////////////////////////
104 // Zero Degree Calorimeter version 1 //
106 ///////////////////////////////////////////////////////////////////////////////
108 //_____________________________________________________________________________
109 AliZDCv1::AliZDCv1() : AliZDC()
112 // Default constructor for Zero Degree Calorimeter
125 //_____________________________________________________________________________
126 AliZDCv1::AliZDCv1(const char *name, const char *title)
130 // Standard constructor for Zero Degree Calorimeter
133 fDigits = new TClonesArray("AliZDCDigit",1000);
145 //_____________________________________________________________________________
146 void AliZDCv1::CreateGeometry()
149 // Create the geometry for the Zero Degree Calorimeter version 1
150 //* Initialize COMMON block ZDC_CGEOM
157 //_____________________________________________________________________________
158 void AliZDCv1::CreateBeamLine()
162 Float_t zq, conpar[9], elpar[3], tubpar[3];
167 Int_t *idtmed = fIdtmed->GetArray();
169 // -- Mother of the ZDC
180 gMC->Gsvolu("ZDC ", "PCON", idtmed[10], conpar, 9);
181 gMC->Gspos("ZDC ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
183 // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to
190 tubpar[2] = 3916.7/2.;
191 gMC->Gsvolu("P001", "TUBE", idtmed[5], tubpar, 3);
192 gMC->Gspos("P001", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
194 //-- SECOND SECTION OF THE BEAM PIPE (FROM THE END OF D1 TO THE BEGINNING OF
197 //-- FROM MAGNETIC BEGINNING OG D1 TO MAGNETIC END OF D1 + 23.5 cm
205 // gMC->Gsvolu("E001", "ELTU", idtmed[5], elpar, 3);
206 // gMC->Gspos("E001", 1, "ZDC ", 0., 0., elpar[2] + zd1, 0, "ONLY");
211 // gMC->Gsvolu("E002", "ELTU", idtmed[10], elpar, 3);
212 // gMC->Gspos("E002", 1, "E001", 0., 0., 0., 0, "ONLY");
219 // gMC->Gsvolu("E003", "ELTU", idtmed[5], elpar, 3);
220 // gMC->Gspos("E002", 1, "ZDC ", 0., 0., elpar[2] + zd1, 0, "ONLY");
225 // gMC->Gsvolu("E004", "ELTU", idtmed[10], elpar, 3);
226 // gMC->Gspos("E004", 1, "E003", 0., 0., 0., 0, "ONLY");
235 gMC->Gsvolu("C001", "CONE", idtmed[5], conpar, 5);
236 gMC->Gspos("C001", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
243 gMC->Gsvolu("P002", "TUBE", idtmed[5], tubpar, 3);
244 gMC->Gspos("P002", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
246 zd1 += tubpar[2] * 2.;
251 gMC->Gsvolu("P003", "TUBE", idtmed[5], tubpar, 3);
252 gMC->Gspos("P003", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
254 zd1 += tubpar[2] * 2.;
259 gMC->Gsvolu("P004", "TUBE", idtmed[5], tubpar, 3);
260 gMC->Gspos("P004", 1, "ZDC ", 0., 0., tubpar[0] + zd1, 0, "ONLY");
262 zd1 += tubpar[2] * 2.;
267 gMC->Gsvolu("P005", "TUBE", idtmed[5], tubpar, 3);
268 gMC->Gspos("P005", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
270 zd1 += tubpar[2] * 2.;
277 gMC->Gsvolu("P006", "CONE", idtmed[5], conpar, 5);
278 gMC->Gspos("P006", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
280 zd1 += conpar[0] * 2.;
285 gMC->Gsvolu("P007", "TUBE", idtmed[5], tubpar, 3);
286 gMC->Gspos("P007", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
288 zd1 += tubpar[2] * 2.;
295 gMC->Gsvolu("P008", "CONE", idtmed[5], conpar, 5);
296 gMC->Gspos("P008", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
298 zd1 += conpar[0] * 2.;
302 tubpar[2] = 205.8/2.;
303 gMC->Gsvolu("P009", "TUBE", idtmed[5], tubpar, 3);
304 gMC->Gspos("P009", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
306 zd1 += tubpar[2] * 2.;
310 tubpar[2] = 505.4/2.;
311 gMC->Gsvolu("P010", "TUBE", idtmed[5], tubpar, 3);
312 gMC->Gspos("P010", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
314 zd1 += tubpar[2] * 2.;
319 gMC->Gsvolu("P011", "TUBE", idtmed[5], tubpar, 3);
320 gMC->Gspos("P011", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
322 zd1 += tubpar[2] * 2.;
326 tubpar[2] = 778.5/2.;
327 gMC->Gsvolu("P012", "TUBE", idtmed[5], tubpar, 3);
328 gMC->Gspos("P012", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
330 zd1 += tubpar[2] * 2.;
332 conpar[0] = 14.18/2.;
337 gMC->Gsvolu("P013", "CONE", idtmed[5], conpar, 5);
338 gMC->Gspos("P013", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
340 zd1 += conpar[0] * 2.;
345 gMC->Gsvolu("P014", "TUBE", idtmed[5], tubpar, 3);
346 gMC->Gspos("P014", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
348 zd1 += tubpar[2] * 2.;
350 conpar[0] = 36.86/2.;
355 gMC->Gsvolu("P015", "CONE", idtmed[5], conpar, 5);
356 gMC->Gspos("P015", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
358 zd1 += conpar[0] * 2.;
362 tubpar[2] = 927.3/2.;
363 gMC->Gsvolu("P016", "TUBE", idtmed[5], tubpar, 3);
364 gMC->Gspos("P016", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
366 zd1 += tubpar[2] * 2.;
371 gMC->Gsvolu("P017", "TUBE", idtmed[8], tubpar, 3);
372 gMC->Gspos("P017", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
374 zd1 += tubpar[2] * 2.;
379 gMC->Gsvolu("Q017", "TUBE", idtmed[10], tubpar, 3);
381 //-- Position Q017 inside P017
382 gMC->Gspos("Q017", 1, "P017", -7.7, 0., 0., 0, "ONLY");
387 gMC->Gsvolu("R017", "TUBE", idtmed[10], tubpar, 3);
389 //-- Position R017 inside P017
390 gMC->Gspos("R017", 1, "P017", 7.7, 0., 0., 0, "ONLY");
392 //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2
397 gMC->Gsvolu("P018", "TUBE", idtmed[5], tubpar, 3);
402 gMC->Gsvolu("P019", "TUBE", idtmed[5], tubpar, 3);
406 AliMatrix(im1, 90.-0.071, 0., 90., 90., .071, 180.);
407 angle = .071*kDegrad;
408 gMC->Gspos("P018", 1, "ZDC ", TMath::Sin(angle) * 645. / 2. - 9.7 +
409 TMath::Sin(angle) * 945. / 2., 0., tubpar[2] + zd1, im1, "ONLY");
410 AliMatrix(im2, 90.+0.071, 0., 90., 90., .071, 0.);
411 gMC->Gspos("P019", 1, "ZDC ", 9.7 - TMath::Sin(angle) * 645. / 2., 0.,
412 tubpar[2] + zd1, im2, "ONLY");
414 // -- END OF BEAM PIPE VOLUME DEFINITION. MAGNET DEFINITION FOLLOWS
417 // -- COMPENSATOR DIPOLE (MBXW)
418 // GAP (VACUUM WITH MAGNETIC FIELD)
422 // tubpar[2] = 340./2.;
423 // gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3);
424 // gMC->Gspos("MBXW", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
426 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
430 // tubpar[2] = 340./2.;
431 // gMC->Gsvolu("YMBX", "TUBE", idtmed[5], tubpar, 3);
432 // gMC->Gspos("YMBX", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
434 // -- COMPENSATOR DIPOLE (MCBWA)
435 // GAP (VACUUM WITH MAGNETIC FIELD)
440 gMC->Gsvolu("MCBW", "TUBE", idtmed[11], tubpar, 3);
441 gMC->Gspos("MCBW", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
443 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
448 gMC->Gsvolu("YMCB", "TUBE", idtmed[5], tubpar, 3);
449 gMC->Gspos("YMCB", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
455 // -- DEFINE MQXL AND MQX QUADRUPOLE ELEMENT
458 // -- GAP (VACUUM WITH MAGNETIC FIELD)
463 gMC->Gsvolu("MQXL", "TUBE", idtmed[11], tubpar, 3);
470 gMC->Gsvolu("YMQL", "TUBE", idtmed[5], tubpar, 3);
472 gMC->Gspos("MQXL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
473 gMC->Gspos("YMQL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
475 gMC->Gspos("MQXL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
476 gMC->Gspos("YMQL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
479 // -- GAP (VACUUM WITH MAGNETIC FIELD)
484 gMC->Gsvolu("MQX ", "TUBE", idtmed[11], tubpar, 3);
491 gMC->Gsvolu("YMQ ", "TUBE", idtmed[5], tubpar, 3);
493 gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880., 0, "ONLY");
494 gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880., 0, "ONLY");
496 gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
497 gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
499 // -- SEPARATOR DIPOLE D1
503 // -- GAP (VACUUM WITH MAGNETIC FIELD)
508 gMC->Gsvolu("D1 ", "TUBE", idtmed[11], tubpar, 3);
515 gMC->Gsvolu("YD1 ", "TUBE", idtmed[5], tubpar, 3);
517 gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
518 gMC->Gspos("D1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
524 // -- GAP (VACUUM WITH MAGNETIC FIELD)
529 gMC->Gsvolu("D2 ", "TUBE", idtmed[11], tubpar, 3);
536 gMC->Gsvolu("YD2 ", "TUBE", idtmed[5], tubpar, 3);
538 gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., tubpar[2] + zd2, 0, "ONLY");
540 gMC->Gspos("D2 ", 1, "YD2 ", -9.7, 0., 0., 0, "ONLY");
541 gMC->Gspos("D2 ", 2, "YD2 ", 9.7, 0., 0., 0, "ONLY");
543 // -- END OF MAGNET DEFINITION
546 //_____________________________________________________________________________
547 void AliZDCv1::CreateZDC()
550 Int_t *idtmed = fIdtmed->GetArray();
552 Float_t DimPb[6], DimVoid[6];
555 //-- Create calorimeters geometry
557 //--> Neutron calorimeter (ZN)
559 gMC->Gsvolu("ZNEU", "BOX ", idtmed[1], fDimZN, 3); // Passive material
560 gMC->Gsvolu("ZNF1", "TUBE", idtmed[3], fFibZN, 3); // Active material
561 gMC->Gsvolu("ZNF2", "TUBE", idtmed[4], fFibZN, 3);
562 gMC->Gsvolu("ZNF3", "TUBE", idtmed[4], fFibZN, 3);
563 gMC->Gsvolu("ZNF4", "TUBE", idtmed[3], fFibZN, 3);
564 gMC->Gsvolu("ZNG1", "BOX ", idtmed[12], fGrvZN, 3); // Empty grooves
565 gMC->Gsvolu("ZNG2", "BOX ", idtmed[12], fGrvZN, 3);
566 gMC->Gsvolu("ZNG3", "BOX ", idtmed[12], fGrvZN, 3);
567 gMC->Gsvolu("ZNG4", "BOX ", idtmed[12], fGrvZN, 3);
569 // Divide ZNEU in towers (for hits purposes)
571 gMC->Gsdvn("ZNTX", "ZNEU", fTowZN[0], 1); // x-tower
572 gMC->Gsdvn("ZN1 ", "ZNTX", fTowZN[1], 2); // y-tower
574 //-- Divide ZN1 in minitowers
575 // fDivZN[0]= NUMBER OF FIBERS PER TOWER ALONG X-AXIS,
576 // fDivZN[1]= NUMBER OF FIBERS PER TOWER ALONG Y-AXIS
577 // (4 fibres per minitower)
579 gMC->Gsdvn("ZNSL", "ZN1 ", fDivZN[1], 2); // Slices
580 gMC->Gsdvn("ZNST", "ZNSL", fDivZN[0], 1); // Sticks
582 // --- Position the empty grooves in the sticks (4 grooves per stick)
583 Float_t dx = fDimZN[0] / fDivZN[0] / 4.;
584 Float_t dy = fDimZN[1] / fDivZN[1] / 4.;
586 gMC->Gspos("ZNG1", 1, "ZNST", 0.-dx, 0.+dy, 0., 0, "ONLY");
587 gMC->Gspos("ZNG2", 1, "ZNST", 0.+dx, 0.+dy, 0., 0, "ONLY");
588 gMC->Gspos("ZNG3", 1, "ZNST", 0.-dx, 0.-dy, 0., 0, "ONLY");
589 gMC->Gspos("ZNG4", 1, "ZNST", 0.+dx, 0.-dy, 0., 0, "ONLY");
591 // --- Position the fibers in the grooves
592 gMC->Gspos("ZNF1", 1, "ZNG1", 0., 0., 0., 0, "ONLY");
593 gMC->Gspos("ZNF2", 1, "ZNG2", 0., 0., 0., 0, "ONLY");
594 gMC->Gspos("ZNF3", 1, "ZNG3", 0., 0., 0., 0, "ONLY");
595 gMC->Gspos("ZNF4", 1, "ZNG4", 0., 0., 0., 0, "ONLY");
597 // --- Position the neutron calorimeter in ZDC
598 gMC->Gspos("ZNEU", 1, "ZDC ", fPosZN[0], fPosZN[1], fPosZN[2] + fDimZN[2], 0, "ONLY");
601 //--> Proton calorimeter (ZP)
603 gMC->Gsvolu("ZPRO", "BOX ", idtmed[2], fDimZP, 3); // Passive material
604 gMC->Gsvolu("ZPF1", "TUBE", idtmed[3], fFibZP, 3); // Active material
605 gMC->Gsvolu("ZPF2", "TUBE", idtmed[4], fFibZP, 3);
606 gMC->Gsvolu("ZPF3", "TUBE", idtmed[4], fFibZP, 3);
607 gMC->Gsvolu("ZPF4", "TUBE", idtmed[3], fFibZP, 3);
608 gMC->Gsvolu("ZPG1", "BOX ", idtmed[12], fGrvZP, 3); // Empty grooves
609 gMC->Gsvolu("ZPG2", "BOX ", idtmed[12], fGrvZP, 3);
610 gMC->Gsvolu("ZPG3", "BOX ", idtmed[12], fGrvZP, 3);
611 gMC->Gsvolu("ZPG4", "BOX ", idtmed[12], fGrvZP, 3);
613 //-- Divide ZPRO in towers(for hits purposes)
615 gMC->Gsdvn("ZPTX", "ZPRO", fTowZP[0], 1); // x-tower
616 gMC->Gsdvn("ZP1 ", "ZPTX", fTowZP[1], 2); // y-tower
619 //-- Divide ZP1 in minitowers
620 // fDivZP[0]= NUMBER OF FIBERS ALONG X-AXIS PER MINITOWER,
621 // fDivZP[1]= NUMBER OF FIBERS ALONG Y-AXIS PER MINITOWER
622 // (4 fiber per minitower)
624 gMC->Gsdvn("ZPSL", "ZP1 ", fDivZP[1], 2); // Slices
625 gMC->Gsdvn("ZPST", "ZPSL", fDivZP[0], 1); // Sticks
627 // --- Position the empty grooves in the sticks (4 grooves per stick)
628 dx = fDimZP[0] / fTowZP[0] / fDivZP[0] / 2.;
629 dy = fDimZP[1] / fTowZP[1] / fDivZP[1] / 2.;
631 gMC->Gspos("ZPG1", 1, "ZPST", 0.-dx, 0.+dy, 0., 0, "ONLY");
632 gMC->Gspos("ZPG2", 1, "ZPST", 0.+dx, 0.+dy, 0., 0, "ONLY");
633 gMC->Gspos("ZPG3", 1, "ZPST", 0.-dx, 0.-dy, 0., 0, "ONLY");
634 gMC->Gspos("ZPG4", 1, "ZPST", 0.+dx, 0.-dy, 0., 0, "ONLY");
636 // --- Position the fibers in the grooves
637 gMC->Gspos("ZPF1", 1, "ZPG1", 0., 0., 0., 0, "ONLY");
638 gMC->Gspos("ZPF2", 1, "ZPG2", 0., 0., 0., 0, "ONLY");
639 gMC->Gspos("ZPF3", 1, "ZPG3", 0., 0., 0., 0, "ONLY");
640 gMC->Gspos("ZPF4", 1, "ZPG4", 0., 0., 0., 0, "ONLY");
643 // --- Position the proton calorimeter in ZDC
644 gMC->Gspos("ZPRO", 1, "ZDC ", fPosZP[0], fPosZP[1], fPosZP[2] + fDimZP[2], 0, "ONLY");
648 //--> EM calorimeter (ZEM)
650 gMC->Gsvolu("ZEM ", "PARA", idtmed[10], fDimZEM, 6);
652 gMC->Matrix(irot1,0.,0.,90.,90.,90.,180.); // Rotation matrix 1
653 gMC->Matrix(irot2,180.,0.,90.,fDimZEM[3]+90.,90.,fDimZEM[3]); // Rotation matrix 2
654 // printf("irot1 = %d, irot2 = %d \n", irot1, irot2);
656 gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material
658 gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches
660 DimPb[0] = fDimZEMPb; // Lead slices
661 DimPb[1] = fDimZEM[2];
662 DimPb[2] = fDimZEM[1];
663 DimPb[3] = 90.-fDimZEM[3];
666 gMC->Gsvolu("ZEL0", "PARA", idtmed[6], DimPb, 6);
667 gMC->Gsvolu("ZEL1", "PARA", idtmed[6], DimPb, 6);
668 gMC->Gsvolu("ZEL2", "PARA", idtmed[6], DimPb, 6);
670 // --- Position the lead slices in the tranche
671 Float_t zTran = fDimZEM[0]/fDivZEM[2];
672 Float_t zTrPb = -zTran+fDimZEMPb;
673 gMC->Gspos("ZEL0", 1, "ZETR", zTrPb, 0., 0., 0, "ONLY");
674 gMC->Gspos("ZEL1", 1, "ZETR", fDimZEMPb, 0., 0., 0, "ONLY");
676 // --- Vacuum zone (to be filled with fibres)
677 DimVoid[0] = (zTran-2*fDimZEMPb)/2.;
678 DimVoid[1] = fDimZEM[2];
679 DimVoid[2] = fDimZEM[1];
680 DimVoid[3] = 90.-fDimZEM[3];
683 gMC->Gsvolu("ZEV0", "PARA", idtmed[10], DimVoid,6);
684 gMC->Gsvolu("ZEV1", "PARA", idtmed[10], DimVoid,6);
686 // --- Divide the vacuum slice into sticks along x axis
687 gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3);
688 gMC->Gsdvn("ZES1", "ZEV1", fDivZEM[0], 3);
690 // --- Positioning the fibers into the sticks
691 gMC->Gspos("ZEMF", 1,"ZES0", 0., 0., 0., irot2, "ONLY");
692 gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY");
694 // --- Positioning the vacuum slice into the tranche
695 Float_t DisplFib = fDimZEM[1]/fDivZEM[0];
696 gMC->Gspos("ZEV0", 1,"ZETR", -DimVoid[0], 0., 0., 0, "ONLY");
697 gMC->Gspos("ZEV1", 1,"ZETR", -DimVoid[0]+zTran, 0., DisplFib, 0, "ONLY");
699 // --- Positioning the ZEM into the ZDC - rotation for 90 degrees
700 gMC->Gspos("ZEM ", 1,"ZDC ", fPosZEM[0], fPosZEM[1], fPosZEM[2], irot1, "ONLY");
702 // --- Adding last slice at the end of the EM calorimeter
703 Float_t zLastSlice = fPosZEM[2]+fDimZEMPb+fDimZEM[0];
704 gMC->Gspos("ZEL2", 1,"ZDC ", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY");
708 //_____________________________________________________________________________
709 void AliZDCv1::DrawModule()
712 // Draw a shaded view of the Zero Degree Calorimeter version 1
715 // Set everything unseen
716 gMC->Gsatt("*", "seen", -1);
718 // Set ALIC mother transparent
719 gMC->Gsatt("ALIC","SEEN",0);
721 // Set the volumes visible
722 gMC->Gsatt("ZDC ","SEEN",0);
723 gMC->Gsatt("P001","SEEN",1);
724 gMC->Gsatt("E001","SEEN",1);
725 gMC->Gsatt("E002","SEEN",1);
726 gMC->Gsatt("E003","SEEN",1);
727 gMC->Gsatt("E004","SEEN",1);
728 gMC->Gsatt("C001","SEEN",1);
729 gMC->Gsatt("P002","SEEN",1);
730 gMC->Gsatt("P003","SEEN",1);
731 gMC->Gsatt("P004","SEEN",1);
732 gMC->Gsatt("P005","SEEN",1);
733 gMC->Gsatt("P006","SEEN",1);
734 gMC->Gsatt("P007","SEEN",1);
735 gMC->Gsatt("P008","SEEN",1);
736 gMC->Gsatt("P009","SEEN",1);
737 gMC->Gsatt("P010","SEEN",1);
738 gMC->Gsatt("P011","SEEN",1);
739 gMC->Gsatt("P012","SEEN",1);
740 gMC->Gsatt("P013","SEEN",1);
741 gMC->Gsatt("P014","SEEN",1);
742 gMC->Gsatt("P015","SEEN",1);
743 gMC->Gsatt("P016","SEEN",1);
744 gMC->Gsatt("P017","SEEN",1);
745 gMC->Gsatt("Q017","SEEN",1);
746 gMC->Gsatt("R017","SEEN",1);
747 gMC->Gsatt("P018","SEEN",1);
748 gMC->Gsatt("P019","SEEN",1);
749 // gMC->Gsatt("MBXW","SEEN",1);
750 // gMC->Gsatt("YMBX","SEEN",1);
751 gMC->Gsatt("MCBW","SEEN",1);
752 gMC->Gsatt("YMCB","SEEN",1);
753 gMC->Gsatt("MQXL","SEEN",1);
754 gMC->Gsatt("YMQL","SEEN",1);
755 gMC->Gsatt("MQX ","SEEN",1);
756 gMC->Gsatt("YMQ ","SEEN",1);
757 gMC->Gsatt("D1 ","SEEN",1);
758 gMC->Gsatt("YD1 ","SEEN",1);
759 gMC->Gsatt("D2 ","SEEN",1);
760 gMC->Gsatt("YD2 ","SEEN",1);
761 gMC->Gsatt("ZNEU","SEEN",0);
762 gMC->Gsatt("ZNF1","SEEN",0);
763 gMC->Gsatt("ZNF2","SEEN",0);
764 gMC->Gsatt("ZNF3","SEEN",0);
765 gMC->Gsatt("ZNF4","SEEN",0);
766 gMC->Gsatt("ZNG1","SEEN",0);
767 gMC->Gsatt("ZNG2","SEEN",0);
768 gMC->Gsatt("ZNG3","SEEN",0);
769 gMC->Gsatt("ZNG4","SEEN",0);
770 gMC->Gsatt("ZNTX","SEEN",0);
771 gMC->Gsatt("ZN1 ","COLO",2);
772 gMC->Gsatt("ZN1 ","SEEN",1);
773 gMC->Gsatt("ZNSL","SEEN",0);
774 gMC->Gsatt("ZNST","SEEN",0);
775 gMC->Gsatt("ZPRO","SEEN",0);
776 gMC->Gsatt("ZPF1","SEEN",0);
777 gMC->Gsatt("ZPF2","SEEN",0);
778 gMC->Gsatt("ZPF3","SEEN",0);
779 gMC->Gsatt("ZPF4","SEEN",0);
780 gMC->Gsatt("ZPG1","SEEN",0);
781 gMC->Gsatt("ZPG2","SEEN",0);
782 gMC->Gsatt("ZPG3","SEEN",0);
783 gMC->Gsatt("ZPG4","SEEN",0);
784 gMC->Gsatt("ZPTX","SEEN",0);
785 gMC->Gsatt("ZP1 ","COLO",2);
786 gMC->Gsatt("ZP1 ","SEEN",1);
787 gMC->Gsatt("ZPSL","SEEN",0);
788 gMC->Gsatt("ZPST","SEEN",0);
789 gMC->Gsatt("ZEM ","COLO",2);
790 gMC->Gsatt("ZEM ","SEEN",1);
791 gMC->Gsatt("ZEMF","SEEN",0);
792 gMC->Gsatt("ZETR","SEEN",0);
793 gMC->Gsatt("ZEL0","SEEN",0);
794 gMC->Gsatt("ZEL1","SEEN",0);
795 gMC->Gsatt("ZEL2","SEEN",0);
796 gMC->Gsatt("ZEV0","SEEN",0);
797 gMC->Gsatt("ZEV1","SEEN",0);
798 gMC->Gsatt("ZES0","SEEN",0);
799 gMC->Gsatt("ZES1","SEEN",0);
802 gMC->Gdopt("hide", "on");
803 gMC->Gdopt("shad", "on");
804 gMC->Gsatt("*", "fill", 7);
805 gMC->SetClipBox(".");
806 gMC->SetClipBox("*", 0, 100, -100, 100, 12000, 16000);
808 gMC->Gdraw("alic", 40, 30, 0, 488, 220, .07, .07);
809 gMC->Gdhead(1111, "Zero Degree Calorimeter Version 1");
810 gMC->Gdman(18, 4, "MAN");
813 //_____________________________________________________________________________
814 void AliZDCv1::CreateMaterials()
817 // Create Materials for the Zero Degree Calorimeter
819 // Origin : E. Scomparin
821 Int_t *idtmed = fIdtmed->GetArray();
823 Float_t dens, ubuf[1], wmat[2], a[2], z[2], epsil=0.001, stmin=0.01;
824 Int_t i, isvolActive, isvol, inofld;
825 Float_t fieldm = gAlice->Field()->Max();
826 Float_t tmaxfd=gAlice->Field()->Max();
827 Int_t isxfld = gAlice->Field()->Integ();
831 // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3
833 // --- Tantalum -> ZN passive material
835 AliMaterial(1, "TANT", 180.95, 73., 16.65, .4, 11.9, ubuf, 1);
839 // AliMaterial(1, "TUNG", 183.85, 74., 19.3, .35, 10.3, ubuf, 1);
841 // --- Brass (CuZn) -> ZP passive material
849 AliMixture(2, "BRASS ", a, z, dens, 2, wmat);
859 AliMixture(3, "SIO2 ", a, z, dens, -2, wmat);
864 AliMaterial(5, "LEAD", 207.19, 82., 11.35, .56, 18.5, ubuf, 1);
868 // AliMaterial(7, "COPP", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
870 // --- Iron (energy loss taken into account)
872 AliMaterial(6, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
874 // --- Iron (no energy loss)
876 AliMaterial(7, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
878 // --- Vacuum (no magnetic field)
879 AliMaterial(10, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
881 // --- Vacuum (with magnetic field)
882 AliMaterial(11, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
884 // --- Air (no magnetic field)
885 AliMaterial(12, "Air $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0);
887 // --- Definition of tracking media:
889 // --- Tantalum = 1 ;
891 // --- Fibers (SiO2) = 3 ;
892 // --- Fibers (SiO2) = 4 ;
894 // --- Iron (with energy loss) = 6 ;
895 // --- Iron (without energy loss) = 7 ;
896 // --- Vacuum (no field) = 10
897 // --- Vacuum (with field) = 11
898 // --- Air (no field) = 12
901 // --- Tracking media parameters
909 AliMedium(1, "ZTANT", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
910 // AliMedium(1, "ZW", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
911 AliMedium(2, "ZBRASS", 2, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
912 AliMedium(3, "ZSIO2", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
913 AliMedium(4, "ZQUAR", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
914 AliMedium(6, "ZLEAD", 5, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
915 // AliMedium(7, "ZCOPP", 7, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
916 AliMedium(5, "ZIRON", 6, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
917 AliMedium(8, "ZIRONN", 7, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
918 AliMedium(10, "ZVOID", 10, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
919 AliMedium(12, "ZAIR", 12, 0, inofld, fieldm, tmaxfd, stemax,deemax, epsil, stmin);
922 AliMedium(11, "ZVOIM", 11, isvol, isxfld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
924 // Thresholds for showering in the ZDCs
927 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
928 gMC->Gstpar(idtmed[i], "CUTELE", .001);
929 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
930 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
932 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
933 gMC->Gstpar(idtmed[i], "CUTELE", .001);
934 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
935 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
937 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
938 gMC->Gstpar(idtmed[i], "CUTELE", .001);
939 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
940 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
942 // Avoid too detailed showering along the beam line
945 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
946 gMC->Gstpar(idtmed[i], "CUTELE", .1);
947 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
948 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
950 // Avoid interaction in fibers (only energy loss allowed)
952 gMC->Gstpar(idtmed[i], "DCAY", 0.);
953 gMC->Gstpar(idtmed[i], "MULS", 0.);
954 gMC->Gstpar(idtmed[i], "PFIS", 0.);
955 gMC->Gstpar(idtmed[i], "MUNU", 0.);
956 gMC->Gstpar(idtmed[i], "LOSS", 1.);
957 gMC->Gstpar(idtmed[i], "PHOT", 0.);
958 gMC->Gstpar(idtmed[i], "COMP", 0.);
959 gMC->Gstpar(idtmed[i], "PAIR", 0.);
960 gMC->Gstpar(idtmed[i], "BREM", 0.);
961 gMC->Gstpar(idtmed[i], "DRAY", 0.);
962 gMC->Gstpar(idtmed[i], "ANNI", 0.);
963 gMC->Gstpar(idtmed[i], "HADR", 0.);
965 gMC->Gstpar(idtmed[i], "DCAY", 0.);
966 gMC->Gstpar(idtmed[i], "MULS", 0.);
967 gMC->Gstpar(idtmed[i], "PFIS", 0.);
968 gMC->Gstpar(idtmed[i], "MUNU", 0.);
969 gMC->Gstpar(idtmed[i], "LOSS", 1.);
970 gMC->Gstpar(idtmed[i], "PHOT", 0.);
971 gMC->Gstpar(idtmed[i], "COMP", 0.);
972 gMC->Gstpar(idtmed[i], "PAIR", 0.);
973 gMC->Gstpar(idtmed[i], "BREM", 0.);
974 gMC->Gstpar(idtmed[i], "DRAY", 0.);
975 gMC->Gstpar(idtmed[i], "ANNI", 0.);
976 gMC->Gstpar(idtmed[i], "HADR", 0.);
978 // Avoid interaction in void
980 gMC->Gstpar(idtmed[i], "DCAY", 0.);
981 gMC->Gstpar(idtmed[i], "MULS", 0.);
982 gMC->Gstpar(idtmed[i], "PFIS", 0.);
983 gMC->Gstpar(idtmed[i], "MUNU", 0.);
984 gMC->Gstpar(idtmed[i], "LOSS", 0.);
985 gMC->Gstpar(idtmed[i], "PHOT", 0.);
986 gMC->Gstpar(idtmed[i], "COMP", 0.);
987 gMC->Gstpar(idtmed[i], "PAIR", 0.);
988 gMC->Gstpar(idtmed[i], "BREM", 0.);
989 gMC->Gstpar(idtmed[i], "DRAY", 0.);
990 gMC->Gstpar(idtmed[i], "ANNI", 0.);
991 gMC->Gstpar(idtmed[i], "HADR", 0.);
994 fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1
995 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2
996 fMedSensZN = idtmed[1]; // Sensitive volume: ZN passive material
997 fMedSensZP = idtmed[2]; // Sensitive volume: ZP passive material
998 fMedSensZEM = idtmed[6]; // Sensitive volume: ZEM passive material
999 fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves
1000 fMedSensPI = idtmed[5]; // Sensitive volume: beam pipes
1003 //_____________________________________________________________________________
1004 void AliZDCv1::Init()
1009 //_____________________________________________________________________________
1010 void AliZDCv1::InitTables()
1013 //Initialize parameters for light tables and read them
1019 char *lightfName1,*lightfName2,*lightfName3,*lightfName4,
1020 *lightfName5,*lightfName6,*lightfName7,*lightfName8;
1021 FILE *fp1, *fp2, *fp3, *fp4, *fp5, *fp6, *fp7, *fp8;
1023 lightfName1 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362207s");
1024 if((fp1 = fopen(lightfName1,"r")) == NULL){
1025 printf("Cannot open file fp1 \n");
1028 lightfName2 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362208s");
1029 if((fp2 = fopen(lightfName2,"r")) == NULL){
1030 printf("Cannot open file fp2 \n");
1033 lightfName3 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362209s");
1034 if((fp3 = fopen(lightfName3,"r")) == NULL){
1035 printf("Cannot open file fp3 \n");
1038 lightfName4 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362210s");
1039 if((fp4 = fopen(lightfName4,"r")) == NULL){
1040 printf("Cannot open file fp4 \n");
1043 // printf(" --- Reading light tables for ZN \n");
1044 for(k=0; k<fNalfan; k++){
1045 for(j=0; j<fNben; j++){
1046 fscanf(fp1,"%f",&fTablen[0][k][j]);
1047 fscanf(fp2,"%f",&fTablen[1][k][j]);
1048 fscanf(fp3,"%f",&fTablen[2][k][j]);
1049 fscanf(fp4,"%f",&fTablen[3][k][j]);
1057 lightfName5 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552207s");
1058 if((fp5 = fopen(lightfName5,"r")) == NULL){
1059 printf("Cannot open file fp5 \n");
1062 lightfName6 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552208s");
1063 if((fp6 = fopen(lightfName6,"r")) == NULL){
1064 printf("Cannot open file fp6 \n");
1067 lightfName7 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552209s");
1068 if((fp7 = fopen(lightfName7,"r")) == NULL){
1069 printf("Cannot open file fp7 \n");
1072 lightfName8 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552210s");
1073 if((fp8 = fopen(lightfName8,"r")) == NULL){
1074 printf("Cannot open file fp8 \n");
1077 // printf(" --- Reading light tables for ZP and ZEM \n");
1078 for(k=0; k<fNalfap; k++){
1079 for(j=0; j<fNbep; j++){
1080 fscanf(fp5,"%f",&fTablep[0][k][j]);
1081 fscanf(fp6,"%f",&fTablep[1][k][j]);
1082 fscanf(fp7,"%f",&fTablep[2][k][j]);
1083 fscanf(fp8,"%f",&fTablep[3][k][j]);
1092 //_____________________________________________________________________________
1093 Int_t AliZDCv1::Digitize(Int_t Det, Int_t Quad, Int_t Light)
1095 // Evaluation of the ADC channel corresponding to the light yield Light
1098 printf("\n Digitize -> Det = %d, Quad = %d, Light = %d\n", Det, Quad, Light);
1104 fPedMean[i][j] = 50.;
1105 fPedSigma[i][j] = 10.;
1106 fPMGain[i][j] = 10000000.;
1109 fADCRes = 0.00000064; // ADC Resolution: 250 fC/ADCch
1111 Float_t Ped = gRandom->Gaus(fPedMean[Det-1][Quad],fPedSigma[Det-1][Quad]);
1112 Int_t ADCch = Int_t(Light*fPMGain[Det-1][Quad]*fADCRes+Ped);
1115 printf(" Ped = %f, ADCch = %d\n", Ped, ADCch);
1121 //____________________________________________________________________________
1122 void AliZDCv1::FinishEvent()
1124 // Code moved to Hits2SDigits();
1127 //_____________________________________________________________________________
1128 void AliZDCv1::SDigits2Digits()
1130 Hits2Digits(gAlice->GetNtrack());
1133 //_____________________________________________________________________________
1134 void AliZDCv1::Hits2Digits(Int_t ntracks)
1136 AliZDCDigit *newdigit;
1139 Int_t PMCZN = 0, PMCZP = 0, PMQZN[4], PMQZP[4], PMZEM = 0;
1148 for(itrack=0; itrack<ntracks; itrack++){
1149 gAlice->ResetHits();
1150 gAlice->TreeH()->GetEvent(itrack);
1151 for(i=0; i<fHits->GetEntries(); i++){
1152 hit = (AliZDCHit*)fHits->At(i);
1153 Int_t det = hit->GetVolume(0);
1154 Int_t quad = hit->GetVolume(1);
1155 Int_t lightQ = Int_t(hit->GetLightPMQ());
1156 Int_t lightC = Int_t(hit->GetLightPMC());
1158 printf(" \n itrack = %d, fNhits = %d, det = %d, quad = %d,"
1159 "lightC = %d lightQ = %d\n", itrack, fNhits, det, quad, lightC, lightQ);
1162 PMCZN = PMCZN + lightC;
1163 PMQZN[quad-1] = PMQZN[quad-1] + lightQ;
1167 PMCZP = PMCZP + lightC;
1168 PMQZP[quad-1] = PMQZP[quad-1] + lightQ;
1172 PMZEM = PMZEM + lightC;
1177 printf("\n PMCZN = %d, PMQZN[0] = %d, PMQZN[1] = %d, PMQZN[2] = %d, PMQZN[3] = %d\n"
1178 , PMCZN, PMQZN[0], PMQZN[1], PMQZN[2], PMQZN[3]);
1179 printf("\n PMCZP = %d, PMQZP[0] = %d, PMQZP[1] = %d, PMQZP[2] = %d, PMQZP[3] = %d\n"
1180 , PMCZP, PMQZP[0], PMQZP[1], PMQZP[2], PMQZP[3]);
1181 printf("\n PMZEM = %d\n", PMZEM);
1184 // ------------------------------------ Hits2Digits
1186 newdigit = new AliZDCDigit(1, 0, Digitize(1, 0, PMCZN));
1187 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1193 newdigit = new AliZDCDigit(1, j+1, Digitize(1, j+1, PMQZN[j]));
1194 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1200 newdigit = new AliZDCDigit(2, 0, Digitize(2, 0, PMCZP));
1201 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1207 newdigit = new AliZDCDigit(2, k+1, Digitize(2, k+1, PMQZP[k]));
1208 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1214 newdigit = new AliZDCDigit(3, 0, Digitize(3, 0, PMZEM));
1215 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1222 gAlice->TreeD()->Fill();
1223 gAlice->TreeD()->Write(0,TObject::kOverwrite);
1226 printf("\n Event Digits -----------------------------------------------------\n");
1231 //_____________________________________________________________________________
1232 void AliZDCv1::MakeBranch(Option_t *opt, char *file)
1235 // Create a new branch in the current Root Tree
1238 AliDetector::MakeBranch(opt);
1240 Char_t branchname[10];
1241 sprintf(branchname,"%s",GetName());
1242 char *cD = strstr(opt,"D");
1244 if (gAlice->TreeD() && cD) {
1246 // Creation of the digits from hits
1248 if(fDigits!=0) fDigits->Clear();
1249 else fDigits = new TClonesArray ("AliZDCDigit",1000);
1250 char branchname[10];
1251 sprintf(branchname,"%s",GetName());
1252 gAlice->MakeBranchInTree(gAlice->TreeD(),
1253 branchname, &fDigits, fBufferSize, file) ;
1254 printf("* AliZDCv1::MakeBranch * Making Branch %s for digits\n\n",branchname);
1257 //_____________________________________________________________________________
1258 void AliZDCv1::StepManager()
1261 // Routine called at every step in the Zero Degree Calorimeters
1266 Int_t vol[2], ibeta=0, ialfa, ibe, nphe;
1267 Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, radius, out;
1268 TLorentzVector s, p;
1271 for (j=0;j<10;j++) hits[j]=0;
1273 if((gMC->GetMedium() == fMedSensZN) || (gMC->GetMedium() == fMedSensZP) ||
1274 (gMC->GetMedium() == fMedSensGR) || (gMC->GetMedium() == fMedSensF1) ||
1275 (gMC->GetMedium() == fMedSensF2) || (gMC->GetMedium() == fMedSensZEM) ||
1276 (gMC->GetMedium() == fMedSensPI)){
1278 // If particle interacts with beam pipe -> return
1279 if(gMC->GetMedium() == fMedSensPI){
1281 // If option NoShower is set -> StopTrack
1282 if(fNoShower==1) gMC->StopTrack();
1286 //Particle coordinates
1287 gMC->TrackPosition(s);
1288 for(j=0; j<=2; j++){
1295 // Determine in which ZDC the particle is
1296 knamed = gMC->CurrentVolName();
1297 if(!strncmp(knamed,"ZN",2))vol[0]=1;
1298 if(!strncmp(knamed,"ZP",2))vol[0]=2;
1299 if(!strncmp(knamed,"ZE",2))vol[0]=3;
1301 // Determine in which quadrant the particle is
1305 xdet[0] = x[0]-fPosZN[0];
1306 xdet[1] = x[1]-fPosZN[1];
1307 if((xdet[0]<=0.) && (xdet[1]>=0.)) vol[1]=1;
1308 if((xdet[0]>0.) && (xdet[1]>0.)) vol[1]=2;
1309 if((xdet[0]<0.) && (xdet[1]<0.)) vol[1]=3;
1310 if((xdet[0]>0.) && (xdet[1]<0.)) vol[1]=4;
1315 xdet[0] = x[0]-fPosZP[0];
1316 xdet[1] = x[1]-fPosZP[1];
1317 if(xdet[0]>fDimZP[0])xdet[0]=fDimZP[0]-0.01;
1318 if(xdet[0]<-fDimZP[0])xdet[0]=-fDimZP[0]+0.01;
1319 Float_t xqZP = xdet[0]/(fDimZP[0]/2);
1320 for(int i=1; i<=4; i++){
1321 if(xqZP>=(i-3) && xqZP<(i-2)){
1328 //ZEM has only 1 quadrant
1331 xdet[0] = x[0]-fPosZEM[0];
1332 xdet[1] = x[1]-fPosZEM[1];
1333 // printf("x %f %f xdet %f %f\n",x[0],x[1],xdet[0],xdet[1]);
1337 // printf("\n-> Det. %d Quad. %d \n", vol[0], vol[1]);
1338 // printf("x %f %f xdet %f %f\n",x[0],x[1],xdet[0],xdet[1]);}
1340 // Store impact point and kinetic energy of the ENTERING particle
1342 // Int_t Curtrack = gAlice->CurrentTrack();
1343 // Int_t Prim = gAlice->GetPrimary(Curtrack);
1344 // printf ("Primary: %d, Current Track: %d \n", Prim, Curtrack);
1346 // if(Curtrack==Prim){
1347 if(gMC->IsTrackEntering()){
1349 gMC->TrackMomentum(p);
1350 // printf("p[0] = %f, p[1] = %f, p[2] = %f, p[3] = %f \n",
1351 // p[0], p[1], p[2], p[3]);
1354 // Impact point on ZDC
1362 // Int_t PcID = gMC->TrackPid();
1363 // printf("Pc ID -> %d\n",PcID);
1364 AddHit(gAlice->CurrentTrack(), vol, hits);
1373 // Charged particles -> Energy loss
1374 if((destep=gMC->Edep())){
1375 if(gMC->IsTrackStop()){
1376 gMC->TrackMomentum(p);
1377 m = gMC->TrackMass();
1379 if(ekin<0.) printf("ATTENTION!!!!!!!!!!!!!!! -> ekin = %f <0 (?)",ekin);
1383 AddHit(gAlice->CurrentTrack(), vol, hits);
1389 AddHit(gAlice->CurrentTrack(), vol, hits);
1391 // printf(" -> Charged particle -> Dep. E = %f eV \n",hits[8]);
1397 // *** Light production in fibres
1398 if((gMC->GetMedium() == fMedSensF1) || (gMC->GetMedium() == fMedSensF2)){
1400 //Select charged particles
1401 if((destep=gMC->Edep())){
1402 // printf(" -> CHARGED particle!!! \n");
1404 // Particle velocity
1405 gMC->TrackMomentum(p);
1406 Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
1407 Float_t beta = ptot/p[3];
1408 // Int_t pcID = gMC->TrackPid();
1409 // printf(" Pc %d in quadrant %d -> beta = %f \n", pcID, vol[1], beta);
1410 if(beta<0.67) return;
1411 if((beta>=0.67) && (beta<=0.75)) ibeta = 0;
1412 if((beta>0.75) && (beta<=0.85)) ibeta = 1;
1413 if((beta>0.85) && (beta<=0.95)) ibeta = 2;
1414 // if((beta>0.95) && (beta<=1.00)) ibeta = 3;
1415 if(beta>0.95) ibeta = 3;
1417 // Angle between particle trajectory and fibre axis
1418 // 1 -> Momentum directions
1422 gMC->Gmtod(um,ud,2);
1423 // 2 -> Angle < limit angle
1424 Double_t alfar = TMath::ACos(ud[2]);
1425 Double_t alfa = alfar*kRaddeg;
1426 if(alfa>=110.) return;
1427 ialfa = Int_t(1.+alfa/2.);
1429 // Distance between particle trajectory and fibre axis
1430 gMC->TrackPosition(s);
1431 for(j=0; j<=2; j++){
1434 gMC->Gmtod(x,xdet,1);
1435 if(TMath::Abs(ud[0])>0.00001){
1436 Float_t dcoeff = ud[1]/ud[0];
1437 be = TMath::Abs((xdet[1]-dcoeff*xdet[0])/TMath::Sqrt(dcoeff*dcoeff+1.));
1440 be = TMath::Abs(ud[0]);
1443 if((vol[0]==1)) radius = fFibZN[1];
1444 if((vol[0]==2)) radius = fFibZP[1];
1445 ibe = Int_t(be*1000.+1);
1447 //Looking into the light tables
1448 Float_t charge = gMC->TrackCharge();
1452 if(ibe>fNben) ibe=fNben;
1453 out = charge*charge*fTablen[ibeta][ialfa][ibe];
1454 nphe = gRandom->Poisson(out);
1455 if(gMC->GetMedium() == fMedSensF1){
1456 hits[7] = nphe; //fLightPMQ
1459 AddHit(gAlice->CurrentTrack(), vol, hits);
1463 hits[8] = nphe; //fLightPMC
1465 AddHit(gAlice->CurrentTrack(), vol, hits);
1471 if(ibe>fNbep) ibe=fNbep;
1472 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1473 nphe = gRandom->Poisson(out);
1474 if(gMC->GetMedium() == fMedSensF1){
1475 hits[7] = nphe; //fLightPMQ
1478 AddHit(gAlice->CurrentTrack(), vol, hits);
1482 hits[8] = nphe; //fLightPMC
1484 AddHit(gAlice->CurrentTrack(), vol, hits);
1489 if(ibe>fNbep) ibe=fNbep;
1490 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1491 nphe = gRandom->Poisson(out);
1492 hits[7] = nphe; //fLightPMQ
1495 AddHit(gAlice->CurrentTrack(), vol, hits);