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.15 2001/03/12 17:47:56 hristov
19 Changes needed on Sun with CC 5.0
21 Revision 1.14 2001/02/23 16:48:28 coppedis
22 Correct bug in ZEM hit definition
24 Revision 1.13 2001/02/07 18:07:41 coppedis
27 Revision 1.12 2001/01/26 19:56:27 hristov
28 Major upgrade of AliRoot code
30 Revision 1.11 2001/01/16 07:43:33 hristov
31 Initialisation of ZDC hits
33 Revision 1.10 2000/12/14 15:20:02 coppedis
34 Hits2Digits method for digitization
36 Revision 1.9 2000/12/13 10:33:49 coppedis
37 Prints only if fDebug==1
39 Revision 1.8 2000/12/12 14:10:02 coppedis
40 Correction suggested by M. Masera
42 Revision 1.7 2000/11/30 17:23:47 coppedis
43 Remove first corrector dipole and introduce digitization
45 Revision 1.6 2000/11/22 11:33:10 coppedis
48 Revision 1.5 2000/10/02 21:28:20 fca
49 Removal of useless dependecies via forward declarations
51 Revision 1.3.2.1 2000/08/24 09:25:47 hristov
52 Patch by P.Hristov: Bug in ZDC geometry corrected by E.Scomparin
54 Revision 1.4 2000/08/24 09:23:59 hristov
55 Bug in ZDC geometry corrected by E.Scomparin
57 Revision 1.3 2000/07/12 06:59:16 fca
58 Fixing dimension of hits array
60 Revision 1.2 2000/07/11 11:12:34 fca
61 Some syntax corrections for non standard HP aCC
63 Revision 1.1 2000/07/10 13:58:01 fca
64 New version of ZDC from E.Scomparin & C.Oppedisano
66 Revision 1.7 2000/01/19 17:17:40 fca
68 Revision 1.6 1999/09/29 09:24:35 fca
69 Introduction of the Copyright and cvs Log
73 ///////////////////////////////////////////////////////////////////////////////
75 // Zero Degree Calorimeter //
76 // This class contains the basic functions for the ZDC //
77 // Functions specific to one particular geometry are //
78 // contained in the derived classes //
80 ///////////////////////////////////////////////////////////////////////////////
82 // --- Standard libraries
94 // --- AliRoot classes
96 #include "AliZDCHit.h"
97 #include "AliZDCDigit.h"
99 #include "AliDetector.h"
102 #include "AliCallf77.h"
103 #include "AliConst.h"
105 #include "TLorentzVector.h"
111 ///////////////////////////////////////////////////////////////////////////////
113 // Zero Degree Calorimeter version 1 //
115 ///////////////////////////////////////////////////////////////////////////////
117 //_____________________________________________________________________________
118 AliZDCv1::AliZDCv1() : AliZDC()
121 // Default constructor for Zero Degree Calorimeter
133 //_____________________________________________________________________________
134 AliZDCv1::AliZDCv1(const char *name, const char *title)
138 // Standard constructor for Zero Degree Calorimeter
150 // Parameters for light tables
151 fNalfan = 90; // Number of Alfa (neutrons)
152 fNalfap = 90; // Number of Alfa (protons)
153 fNben = 18; // Number of beta (neutrons)
154 fNbep = 28; // Number of beta (protons)
156 for(ip=0; ip<4; ip++){
157 for(kp=0; kp<fNalfap; kp++){
158 for(jp=0; jp<fNbep; jp++){
159 fTablep[ip][kp][jp] = 0;
164 for(in=0; in<4; in++){
165 for(kn=0; kn<fNalfan; kn++){
166 for(jn=0; jn<fNben; jn++){
167 fTablen[in][kn][jn] = 0;
172 // Parameters for hadronic calorimeters geometry
189 // Parameters for EM calorimeter geometry
195 fDigits = new TClonesArray("AliZDCDigit",1000);
198 //_____________________________________________________________________________
199 void AliZDCv1::CreateGeometry()
202 // Create the geometry for the Zero Degree Calorimeter version 1
203 //* Initialize COMMON block ZDC_CGEOM
210 //_____________________________________________________________________________
211 void AliZDCv1::CreateBeamLine()
214 Float_t angle, zq, conpar[9], elpar[3], tubpar[3], zd1, zd2;
217 Int_t *idtmed = fIdtmed->GetArray();
219 // -- Mother of the ZDCs
230 gMC->Gsvolu("ZDC ", "PCON", idtmed[10], conpar, 9);
231 gMC->Gspos("ZDC ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
233 // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to
240 tubpar[2] = 3916.7/2.;
241 gMC->Gsvolu("P001", "TUBE", idtmed[5], tubpar, 3);
242 gMC->Gspos("P001", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
244 //-- SECOND SECTION OF THE BEAM PIPE (FROM THE END OF D1 TO THE BEGINNING OF
247 //-- FROM MAGNETIC BEGINNING OG D1 TO MAGNETIC END OF D1 + 23.5 cm
255 // gMC->Gsvolu("E001", "ELTU", idtmed[5], elpar, 3);
256 // gMC->Gspos("E001", 1, "ZDC ", 0., 0., elpar[2] + zd1, 0, "ONLY");
261 // gMC->Gsvolu("E002", "ELTU", idtmed[10], elpar, 3);
262 // gMC->Gspos("E002", 1, "E001", 0., 0., 0., 0, "ONLY");
269 // gMC->Gsvolu("E003", "ELTU", idtmed[5], elpar, 3);
270 // gMC->Gspos("E002", 1, "ZDC ", 0., 0., elpar[2] + zd1, 0, "ONLY");
275 // gMC->Gsvolu("E004", "ELTU", idtmed[10], elpar, 3);
276 // gMC->Gspos("E004", 1, "E003", 0., 0., 0., 0, "ONLY");
285 gMC->Gsvolu("C001", "CONE", idtmed[5], conpar, 5);
286 gMC->Gspos("C001", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
293 gMC->Gsvolu("P002", "TUBE", idtmed[5], tubpar, 3);
294 gMC->Gspos("P002", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
301 gMC->Gsvolu("P003", "TUBE", idtmed[5], tubpar, 3);
302 gMC->Gspos("P003", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
304 zd1 += tubpar[2] * 2.;
309 gMC->Gsvolu("P004", "TUBE", idtmed[5], tubpar, 3);
310 gMC->Gspos("P004", 1, "ZDC ", 0., 0., tubpar[0] + zd1, 0, "ONLY");
312 zd1 += tubpar[2] * 2.;
317 gMC->Gsvolu("P005", "TUBE", idtmed[5], tubpar, 3);
318 gMC->Gspos("P005", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
320 zd1 += tubpar[2] * 2.;
327 gMC->Gsvolu("P006", "CONE", idtmed[5], conpar, 5);
328 gMC->Gspos("P006", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
330 zd1 += conpar[0] * 2.;
335 gMC->Gsvolu("P007", "TUBE", idtmed[5], tubpar, 3);
336 gMC->Gspos("P007", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
338 zd1 += tubpar[2] * 2.;
345 gMC->Gsvolu("P008", "CONE", idtmed[5], conpar, 5);
346 gMC->Gspos("P008", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
348 zd1 += conpar[0] * 2.;
352 tubpar[2] = 205.8/2.;
353 gMC->Gsvolu("P009", "TUBE", idtmed[5], tubpar, 3);
354 gMC->Gspos("P009", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
356 zd1 += tubpar[2] * 2.;
360 tubpar[2] = 505.4/2.;
361 gMC->Gsvolu("P010", "TUBE", idtmed[5], tubpar, 3);
362 gMC->Gspos("P010", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
364 zd1 += tubpar[2] * 2.;
369 gMC->Gsvolu("P011", "TUBE", idtmed[5], tubpar, 3);
370 gMC->Gspos("P011", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
372 zd1 += tubpar[2] * 2.;
376 tubpar[2] = 778.5/2.;
377 gMC->Gsvolu("P012", "TUBE", idtmed[5], tubpar, 3);
378 gMC->Gspos("P012", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
380 zd1 += tubpar[2] * 2.;
382 conpar[0] = 14.18/2.;
387 gMC->Gsvolu("P013", "CONE", idtmed[5], conpar, 5);
388 gMC->Gspos("P013", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
390 zd1 += conpar[0] * 2.;
395 gMC->Gsvolu("P014", "TUBE", idtmed[5], tubpar, 3);
396 gMC->Gspos("P014", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
398 zd1 += tubpar[2] * 2.;
400 conpar[0] = 36.86/2.;
405 gMC->Gsvolu("P015", "CONE", idtmed[5], conpar, 5);
406 gMC->Gspos("P015", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
408 zd1 += conpar[0] * 2.;
412 tubpar[2] = 927.3/2.;
413 gMC->Gsvolu("P016", "TUBE", idtmed[5], tubpar, 3);
414 gMC->Gspos("P016", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
416 zd1 += tubpar[2] * 2.;
421 gMC->Gsvolu("P017", "TUBE", idtmed[8], tubpar, 3);
422 gMC->Gspos("P017", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
424 zd1 += tubpar[2] * 2.;
429 gMC->Gsvolu("Q017", "TUBE", idtmed[10], tubpar, 3);
431 //-- Position Q017 inside P017
432 gMC->Gspos("Q017", 1, "P017", -7.7, 0., 0., 0, "ONLY");
437 gMC->Gsvolu("R017", "TUBE", idtmed[10], tubpar, 3);
439 //-- Position R017 inside P017
440 gMC->Gspos("R017", 1, "P017", 7.7, 0., 0., 0, "ONLY");
442 //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2
447 gMC->Gsvolu("P018", "TUBE", idtmed[5], tubpar, 3);
452 gMC->Gsvolu("P019", "TUBE", idtmed[5], tubpar, 3);
456 AliMatrix(im1, 90.-0.071, 0., 90., 90., .071, 180.);
457 angle = .071*kDegrad;
458 gMC->Gspos("P018", 1, "ZDC ", TMath::Sin(angle) * 645. / 2. - 9.7 +
459 TMath::Sin(angle) * 945. / 2., 0., tubpar[2] + zd1, im1, "ONLY");
460 AliMatrix(im2, 90.+0.071, 0., 90., 90., .071, 0.);
461 gMC->Gspos("P019", 1, "ZDC ", 9.7 - TMath::Sin(angle) * 645. / 2., 0.,
462 tubpar[2] + zd1, im2, "ONLY");
464 // -- END OF BEAM PIPE VOLUME DEFINITION. MAGNET DEFINITION FOLLOWS
467 // -- COMPENSATOR DIPOLE (MBXW)
468 // GAP (VACUUM WITH MAGNETIC FIELD)
472 // tubpar[2] = 340./2.;
473 // gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3);
474 // gMC->Gspos("MBXW", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
476 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
480 // tubpar[2] = 340./2.;
481 // gMC->Gsvolu("YMBX", "TUBE", idtmed[5], tubpar, 3);
482 // gMC->Gspos("YMBX", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
484 // -- COMPENSATOR DIPOLE (MCBWA)
485 // GAP (VACUUM WITH MAGNETIC FIELD)
490 gMC->Gsvolu("MCBW", "TUBE", idtmed[11], tubpar, 3);
491 gMC->Gspos("MCBW", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
493 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
498 gMC->Gsvolu("YMCB", "TUBE", idtmed[5], tubpar, 3);
499 gMC->Gspos("YMCB", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
505 // -- DEFINE MQXL AND MQX QUADRUPOLE ELEMENT
508 // -- GAP (VACUUM WITH MAGNETIC FIELD)
513 gMC->Gsvolu("MQXL", "TUBE", idtmed[11], tubpar, 3);
520 gMC->Gsvolu("YMQL", "TUBE", idtmed[5], tubpar, 3);
522 gMC->Gspos("MQXL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
523 gMC->Gspos("YMQL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
525 gMC->Gspos("MQXL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
526 gMC->Gspos("YMQL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
529 // -- GAP (VACUUM WITH MAGNETIC FIELD)
534 gMC->Gsvolu("MQX ", "TUBE", idtmed[11], tubpar, 3);
541 gMC->Gsvolu("YMQ ", "TUBE", idtmed[5], tubpar, 3);
543 gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880., 0, "ONLY");
544 gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880., 0, "ONLY");
546 gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
547 gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
549 // -- SEPARATOR DIPOLE D1
553 // -- GAP (VACUUM WITH MAGNETIC FIELD)
558 gMC->Gsvolu("D1 ", "TUBE", idtmed[11], tubpar, 3);
565 gMC->Gsvolu("YD1 ", "TUBE", idtmed[5], tubpar, 3);
567 gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
568 gMC->Gspos("D1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
574 // -- GAP (VACUUM WITH MAGNETIC FIELD)
579 gMC->Gsvolu("D2 ", "TUBE", idtmed[11], tubpar, 3);
586 gMC->Gsvolu("YD2 ", "TUBE", idtmed[5], tubpar, 3);
588 gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., tubpar[2] + zd2, 0, "ONLY");
590 gMC->Gspos("D2 ", 1, "YD2 ", -9.7, 0., 0., 0, "ONLY");
591 gMC->Gspos("D2 ", 2, "YD2 ", 9.7, 0., 0., 0, "ONLY");
593 // -- END OF MAGNET DEFINITION
596 //_____________________________________________________________________________
597 void AliZDCv1::CreateZDC()
601 Float_t DimPb[6], DimVoid[6];
603 Int_t *idtmed = fIdtmed->GetArray();
605 // Parameters for hadronic calorimeters geometry
606 // NB -> parameters used ONLY in CreateZDC()
607 Float_t fDimZN[3] = {3.52, 3.52, 50.}; // Dimensions of neutron detector
608 Float_t fGrvZN[3] = {0.03, 0.03, 50.}; // Grooves for neutron detector
609 Float_t fGrvZP[3] = {0.04, 0.04, 75.}; // Grooves for proton detector
610 Int_t fDivZN[3] = {11, 11, 0}; // Division for neutron detector
611 Int_t fDivZP[3] = {7, 15, 0}; // Division for proton detector
612 Int_t fTowZN[2] = {2, 2}; // Tower for neutron detector
613 Int_t fTowZP[2] = {4, 1}; // Tower for proton detector
615 // Parameters for EM calorimeter geometry
616 // NB -> parameters used ONLY in CreateZDC()
617 Float_t fDimZEMPb = 0.15*(TMath::Sqrt(2.)); // z-dimension of the Pb slice
618 Float_t fDimZEMAir = 0.001; // scotch
619 Float_t fFibRadZEM = 0.0315; // External fiber radius (including cladding)
620 Int_t fDivZEM[3] = {92, 0, 20}; // Divisions for EM detector
621 Float_t fDimZEM0 = 2*fDivZEM[2]*(fDimZEMPb+fDimZEMAir+fFibRadZEM*(TMath::Sqrt(2.)));
622 Float_t fDimZEM[6] = {fDimZEM0, 3.5, 3.5, 45., 0., 0.}; // Dimensions of EM detector
623 Float_t fFibZEM2 = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-fFibRadZEM;
624 Float_t fFibZEM[3] = {0., 0.0275, fFibZEM2}; // Fibers for EM calorimeter
627 //-- Create calorimeters geometry
629 //--> Neutron calorimeter (ZN)
631 gMC->Gsvolu("ZNEU", "BOX ", idtmed[1], fDimZN, 3); // Passive material
632 gMC->Gsvolu("ZNF1", "TUBE", idtmed[3], fFibZN, 3); // Active material
633 gMC->Gsvolu("ZNF2", "TUBE", idtmed[4], fFibZN, 3);
634 gMC->Gsvolu("ZNF3", "TUBE", idtmed[4], fFibZN, 3);
635 gMC->Gsvolu("ZNF4", "TUBE", idtmed[3], fFibZN, 3);
636 gMC->Gsvolu("ZNG1", "BOX ", idtmed[12], fGrvZN, 3); // Empty grooves
637 gMC->Gsvolu("ZNG2", "BOX ", idtmed[12], fGrvZN, 3);
638 gMC->Gsvolu("ZNG3", "BOX ", idtmed[12], fGrvZN, 3);
639 gMC->Gsvolu("ZNG4", "BOX ", idtmed[12], fGrvZN, 3);
641 // Divide ZNEU in towers (for hits purposes)
643 gMC->Gsdvn("ZNTX", "ZNEU", fTowZN[0], 1); // x-tower
644 gMC->Gsdvn("ZN1 ", "ZNTX", fTowZN[1], 2); // y-tower
646 //-- Divide ZN1 in minitowers
647 // fDivZN[0]= NUMBER OF FIBERS PER TOWER ALONG X-AXIS,
648 // fDivZN[1]= NUMBER OF FIBERS PER TOWER ALONG Y-AXIS
649 // (4 fibres per minitower)
651 gMC->Gsdvn("ZNSL", "ZN1 ", fDivZN[1], 2); // Slices
652 gMC->Gsdvn("ZNST", "ZNSL", fDivZN[0], 1); // Sticks
654 // --- Position the empty grooves in the sticks (4 grooves per stick)
655 Float_t dx = fDimZN[0] / fDivZN[0] / 4.;
656 Float_t dy = fDimZN[1] / fDivZN[1] / 4.;
658 gMC->Gspos("ZNG1", 1, "ZNST", 0.-dx, 0.+dy, 0., 0, "ONLY");
659 gMC->Gspos("ZNG2", 1, "ZNST", 0.+dx, 0.+dy, 0., 0, "ONLY");
660 gMC->Gspos("ZNG3", 1, "ZNST", 0.-dx, 0.-dy, 0., 0, "ONLY");
661 gMC->Gspos("ZNG4", 1, "ZNST", 0.+dx, 0.-dy, 0., 0, "ONLY");
663 // --- Position the fibers in the grooves
664 gMC->Gspos("ZNF1", 1, "ZNG1", 0., 0., 0., 0, "ONLY");
665 gMC->Gspos("ZNF2", 1, "ZNG2", 0., 0., 0., 0, "ONLY");
666 gMC->Gspos("ZNF3", 1, "ZNG3", 0., 0., 0., 0, "ONLY");
667 gMC->Gspos("ZNF4", 1, "ZNG4", 0., 0., 0., 0, "ONLY");
669 // --- Position the neutron calorimeter in ZDC
670 gMC->Gspos("ZNEU", 1, "ZDC ", fPosZN[0], fPosZN[1], fPosZN[2] + fDimZN[2], 0, "ONLY");
673 //--> Proton calorimeter (ZP)
675 gMC->Gsvolu("ZPRO", "BOX ", idtmed[2], fDimZP, 3); // Passive material
676 gMC->Gsvolu("ZPF1", "TUBE", idtmed[3], fFibZP, 3); // Active material
677 gMC->Gsvolu("ZPF2", "TUBE", idtmed[4], fFibZP, 3);
678 gMC->Gsvolu("ZPF3", "TUBE", idtmed[4], fFibZP, 3);
679 gMC->Gsvolu("ZPF4", "TUBE", idtmed[3], fFibZP, 3);
680 gMC->Gsvolu("ZPG1", "BOX ", idtmed[12], fGrvZP, 3); // Empty grooves
681 gMC->Gsvolu("ZPG2", "BOX ", idtmed[12], fGrvZP, 3);
682 gMC->Gsvolu("ZPG3", "BOX ", idtmed[12], fGrvZP, 3);
683 gMC->Gsvolu("ZPG4", "BOX ", idtmed[12], fGrvZP, 3);
685 //-- Divide ZPRO in towers(for hits purposes)
687 gMC->Gsdvn("ZPTX", "ZPRO", fTowZP[0], 1); // x-tower
688 gMC->Gsdvn("ZP1 ", "ZPTX", fTowZP[1], 2); // y-tower
691 //-- Divide ZP1 in minitowers
692 // fDivZP[0]= NUMBER OF FIBERS ALONG X-AXIS PER MINITOWER,
693 // fDivZP[1]= NUMBER OF FIBERS ALONG Y-AXIS PER MINITOWER
694 // (4 fiber per minitower)
696 gMC->Gsdvn("ZPSL", "ZP1 ", fDivZP[1], 2); // Slices
697 gMC->Gsdvn("ZPST", "ZPSL", fDivZP[0], 1); // Sticks
699 // --- Position the empty grooves in the sticks (4 grooves per stick)
700 dx = fDimZP[0] / fTowZP[0] / fDivZP[0] / 2.;
701 dy = fDimZP[1] / fTowZP[1] / fDivZP[1] / 2.;
703 gMC->Gspos("ZPG1", 1, "ZPST", 0.-dx, 0.+dy, 0., 0, "ONLY");
704 gMC->Gspos("ZPG2", 1, "ZPST", 0.+dx, 0.+dy, 0., 0, "ONLY");
705 gMC->Gspos("ZPG3", 1, "ZPST", 0.-dx, 0.-dy, 0., 0, "ONLY");
706 gMC->Gspos("ZPG4", 1, "ZPST", 0.+dx, 0.-dy, 0., 0, "ONLY");
708 // --- Position the fibers in the grooves
709 gMC->Gspos("ZPF1", 1, "ZPG1", 0., 0., 0., 0, "ONLY");
710 gMC->Gspos("ZPF2", 1, "ZPG2", 0., 0., 0., 0, "ONLY");
711 gMC->Gspos("ZPF3", 1, "ZPG3", 0., 0., 0., 0, "ONLY");
712 gMC->Gspos("ZPF4", 1, "ZPG4", 0., 0., 0., 0, "ONLY");
715 // --- Position the proton calorimeter in ZDC
716 gMC->Gspos("ZPRO", 1, "ZDC ", fPosZP[0], fPosZP[1], fPosZP[2] + fDimZP[2], 0, "ONLY");
720 //--> EM calorimeter (ZEM)
722 gMC->Gsvolu("ZEM ", "PARA", idtmed[10], fDimZEM, 6);
724 gMC->Matrix(irot1,0.,0.,90.,90.,90.,180.); // Rotation matrix 1
725 gMC->Matrix(irot2,180.,0.,90.,fDimZEM[3]+90.,90.,fDimZEM[3]); // Rotation matrix 2
726 // printf("irot1 = %d, irot2 = %d \n", irot1, irot2);
728 gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material
730 gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches
732 DimPb[0] = fDimZEMPb; // Lead slices
733 DimPb[1] = fDimZEM[2];
734 DimPb[2] = fDimZEM[1];
735 DimPb[3] = 90.-fDimZEM[3];
738 gMC->Gsvolu("ZEL0", "PARA", idtmed[6], DimPb, 6);
739 gMC->Gsvolu("ZEL1", "PARA", idtmed[6], DimPb, 6);
740 gMC->Gsvolu("ZEL2", "PARA", idtmed[6], DimPb, 6);
742 // --- Position the lead slices in the tranche
743 Float_t zTran = fDimZEM[0]/fDivZEM[2];
744 Float_t zTrPb = -zTran+fDimZEMPb;
745 gMC->Gspos("ZEL0", 1, "ZETR", zTrPb, 0., 0., 0, "ONLY");
746 gMC->Gspos("ZEL1", 1, "ZETR", fDimZEMPb, 0., 0., 0, "ONLY");
748 // --- Vacuum zone (to be filled with fibres)
749 DimVoid[0] = (zTran-2*fDimZEMPb)/2.;
750 DimVoid[1] = fDimZEM[2];
751 DimVoid[2] = fDimZEM[1];
752 DimVoid[3] = 90.-fDimZEM[3];
755 gMC->Gsvolu("ZEV0", "PARA", idtmed[10], DimVoid,6);
756 gMC->Gsvolu("ZEV1", "PARA", idtmed[10], DimVoid,6);
758 // --- Divide the vacuum slice into sticks along x axis
759 gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3);
760 gMC->Gsdvn("ZES1", "ZEV1", fDivZEM[0], 3);
762 // --- Positioning the fibers into the sticks
763 gMC->Gspos("ZEMF", 1,"ZES0", 0., 0., 0., irot2, "ONLY");
764 gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY");
766 // --- Positioning the vacuum slice into the tranche
767 Float_t DisplFib = fDimZEM[1]/fDivZEM[0];
768 gMC->Gspos("ZEV0", 1,"ZETR", -DimVoid[0], 0., 0., 0, "ONLY");
769 gMC->Gspos("ZEV1", 1,"ZETR", -DimVoid[0]+zTran, 0., DisplFib, 0, "ONLY");
771 // --- Positioning the ZEM into the ZDC - rotation for 90 degrees
772 gMC->Gspos("ZEM ", 1,"ZDC ", fPosZEM[0], fPosZEM[1], fPosZEM[2], irot1, "ONLY");
774 // --- Adding last slice at the end of the EM calorimeter
775 Float_t zLastSlice = fPosZEM[2]+fDimZEMPb+fDimZEM[0];
776 gMC->Gspos("ZEL2", 1,"ZDC ", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY");
780 //_____________________________________________________________________________
781 void AliZDCv1::DrawModule()
784 // Draw a shaded view of the Zero Degree Calorimeter version 1
787 // Set everything unseen
788 gMC->Gsatt("*", "seen", -1);
790 // Set ALIC mother transparent
791 gMC->Gsatt("ALIC","SEEN",0);
793 // Set the volumes visible
794 gMC->Gsatt("ZDC ","SEEN",0);
795 gMC->Gsatt("P001","SEEN",1);
796 gMC->Gsatt("E001","SEEN",1);
797 gMC->Gsatt("E002","SEEN",1);
798 gMC->Gsatt("E003","SEEN",1);
799 gMC->Gsatt("E004","SEEN",1);
800 gMC->Gsatt("C001","SEEN",1);
801 gMC->Gsatt("P002","SEEN",1);
802 gMC->Gsatt("P003","SEEN",1);
803 gMC->Gsatt("P004","SEEN",1);
804 gMC->Gsatt("P005","SEEN",1);
805 gMC->Gsatt("P006","SEEN",1);
806 gMC->Gsatt("P007","SEEN",1);
807 gMC->Gsatt("P008","SEEN",1);
808 gMC->Gsatt("P009","SEEN",1);
809 gMC->Gsatt("P010","SEEN",1);
810 gMC->Gsatt("P011","SEEN",1);
811 gMC->Gsatt("P012","SEEN",1);
812 gMC->Gsatt("P013","SEEN",1);
813 gMC->Gsatt("P014","SEEN",1);
814 gMC->Gsatt("P015","SEEN",1);
815 gMC->Gsatt("P016","SEEN",1);
816 gMC->Gsatt("P017","SEEN",1);
817 gMC->Gsatt("Q017","SEEN",1);
818 gMC->Gsatt("R017","SEEN",1);
819 gMC->Gsatt("P018","SEEN",1);
820 gMC->Gsatt("P019","SEEN",1);
821 // gMC->Gsatt("MBXW","SEEN",1);
822 // gMC->Gsatt("YMBX","SEEN",1);
823 gMC->Gsatt("MCBW","SEEN",1);
824 gMC->Gsatt("YMCB","SEEN",1);
825 gMC->Gsatt("MQXL","SEEN",1);
826 gMC->Gsatt("YMQL","SEEN",1);
827 gMC->Gsatt("MQX ","SEEN",1);
828 gMC->Gsatt("YMQ ","SEEN",1);
829 gMC->Gsatt("D1 ","SEEN",1);
830 gMC->Gsatt("YD1 ","SEEN",1);
831 gMC->Gsatt("D2 ","SEEN",1);
832 gMC->Gsatt("YD2 ","SEEN",1);
833 gMC->Gsatt("ZNEU","SEEN",0);
834 gMC->Gsatt("ZNF1","SEEN",0);
835 gMC->Gsatt("ZNF2","SEEN",0);
836 gMC->Gsatt("ZNF3","SEEN",0);
837 gMC->Gsatt("ZNF4","SEEN",0);
838 gMC->Gsatt("ZNG1","SEEN",0);
839 gMC->Gsatt("ZNG2","SEEN",0);
840 gMC->Gsatt("ZNG3","SEEN",0);
841 gMC->Gsatt("ZNG4","SEEN",0);
842 gMC->Gsatt("ZNTX","SEEN",0);
843 gMC->Gsatt("ZN1 ","COLO",2);
844 gMC->Gsatt("ZN1 ","SEEN",1);
845 gMC->Gsatt("ZNSL","SEEN",0);
846 gMC->Gsatt("ZNST","SEEN",0);
847 gMC->Gsatt("ZPRO","SEEN",0);
848 gMC->Gsatt("ZPF1","SEEN",0);
849 gMC->Gsatt("ZPF2","SEEN",0);
850 gMC->Gsatt("ZPF3","SEEN",0);
851 gMC->Gsatt("ZPF4","SEEN",0);
852 gMC->Gsatt("ZPG1","SEEN",0);
853 gMC->Gsatt("ZPG2","SEEN",0);
854 gMC->Gsatt("ZPG3","SEEN",0);
855 gMC->Gsatt("ZPG4","SEEN",0);
856 gMC->Gsatt("ZPTX","SEEN",0);
857 gMC->Gsatt("ZP1 ","COLO",2);
858 gMC->Gsatt("ZP1 ","SEEN",1);
859 gMC->Gsatt("ZPSL","SEEN",0);
860 gMC->Gsatt("ZPST","SEEN",0);
861 gMC->Gsatt("ZEM ","COLO",2);
862 gMC->Gsatt("ZEM ","SEEN",1);
863 gMC->Gsatt("ZEMF","SEEN",0);
864 gMC->Gsatt("ZETR","SEEN",0);
865 gMC->Gsatt("ZEL0","SEEN",0);
866 gMC->Gsatt("ZEL1","SEEN",0);
867 gMC->Gsatt("ZEL2","SEEN",0);
868 gMC->Gsatt("ZEV0","SEEN",0);
869 gMC->Gsatt("ZEV1","SEEN",0);
870 gMC->Gsatt("ZES0","SEEN",0);
871 gMC->Gsatt("ZES1","SEEN",0);
874 gMC->Gdopt("hide", "on");
875 gMC->Gdopt("shad", "on");
876 gMC->Gsatt("*", "fill", 7);
877 gMC->SetClipBox(".");
878 gMC->SetClipBox("*", 0, 100, -100, 100, 12000, 16000);
880 gMC->Gdraw("alic", 40, 30, 0, 488, 220, .07, .07);
881 gMC->Gdhead(1111, "Zero Degree Calorimeter Version 1");
882 gMC->Gdman(18, 4, "MAN");
885 //_____________________________________________________________________________
886 void AliZDCv1::CreateMaterials()
889 // Create Materials for the Zero Degree Calorimeter
891 // Origin : E. Scomparin
893 Int_t *idtmed = fIdtmed->GetArray();
895 Float_t dens, ubuf[1], wmat[2], a[2], z[2], epsil=0.001, stmin=0.01;
896 Float_t deemax = -1, stemax;
897 Float_t fieldm = gAlice->Field()->Max();
898 Float_t tmaxfd=gAlice->Field()->Max();
899 Int_t i, isvolActive, isvol, inofld;
900 Int_t isxfld = gAlice->Field()->Integ();
902 // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3
904 // --- Tantalum -> ZN passive material
906 AliMaterial(1, "TANT", 180.95, 73., 16.65, .4, 11.9, ubuf, 1);
910 // AliMaterial(1, "TUNG", 183.85, 74., 19.3, .35, 10.3, ubuf, 1);
912 // --- Brass (CuZn) -> ZP passive material
920 AliMixture(2, "BRASS ", a, z, dens, 2, wmat);
930 AliMixture(3, "SIO2 ", a, z, dens, -2, wmat);
935 AliMaterial(5, "LEAD", 207.19, 82., 11.35, .56, 18.5, ubuf, 1);
939 // AliMaterial(7, "COPP", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
941 // --- Iron (energy loss taken into account)
943 AliMaterial(6, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
945 // --- Iron (no energy loss)
947 AliMaterial(7, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
949 // --- Vacuum (no magnetic field)
950 AliMaterial(10, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
952 // --- Vacuum (with magnetic field)
953 AliMaterial(11, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
955 // --- Air (no magnetic field)
956 AliMaterial(12, "Air $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0);
958 // --- Definition of tracking media:
960 // --- Tantalum = 1 ;
962 // --- Fibers (SiO2) = 3 ;
963 // --- Fibers (SiO2) = 4 ;
965 // --- Iron (with energy loss) = 6 ;
966 // --- Iron (without energy loss) = 7 ;
967 // --- Vacuum (no field) = 10
968 // --- Vacuum (with field) = 11
969 // --- Air (no field) = 12
972 // --- Tracking media parameters
980 AliMedium(1, "ZTANT", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
981 // AliMedium(1, "ZW", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
982 AliMedium(2, "ZBRASS", 2, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
983 AliMedium(3, "ZSIO2", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
984 AliMedium(4, "ZQUAR", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
985 AliMedium(6, "ZLEAD", 5, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
986 // AliMedium(7, "ZCOPP", 7, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
987 AliMedium(5, "ZIRON", 6, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
988 AliMedium(8, "ZIRONN", 7, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
989 AliMedium(10, "ZVOID", 10, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
990 AliMedium(12, "ZAIR", 12, 0, inofld, fieldm, tmaxfd, stemax,deemax, epsil, stmin);
993 AliMedium(11, "ZVOIM", 11, isvol, isxfld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
995 // Thresholds for showering in the ZDCs
998 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
999 gMC->Gstpar(idtmed[i], "CUTELE", .001);
1000 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
1001 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
1003 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
1004 gMC->Gstpar(idtmed[i], "CUTELE", .001);
1005 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
1006 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
1008 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
1009 gMC->Gstpar(idtmed[i], "CUTELE", .001);
1010 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
1011 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
1013 // Avoid too detailed showering along the beam line
1016 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1017 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1018 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1019 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1021 // Avoid interaction in fibers (only energy loss allowed)
1023 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1024 gMC->Gstpar(idtmed[i], "MULS", 0.);
1025 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1026 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1027 gMC->Gstpar(idtmed[i], "LOSS", 1.);
1028 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1029 gMC->Gstpar(idtmed[i], "COMP", 0.);
1030 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1031 gMC->Gstpar(idtmed[i], "BREM", 0.);
1032 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1033 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1034 gMC->Gstpar(idtmed[i], "HADR", 0.);
1036 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1037 gMC->Gstpar(idtmed[i], "MULS", 0.);
1038 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1039 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1040 gMC->Gstpar(idtmed[i], "LOSS", 1.);
1041 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1042 gMC->Gstpar(idtmed[i], "COMP", 0.);
1043 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1044 gMC->Gstpar(idtmed[i], "BREM", 0.);
1045 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1046 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1047 gMC->Gstpar(idtmed[i], "HADR", 0.);
1049 // Avoid interaction in void
1051 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1052 gMC->Gstpar(idtmed[i], "MULS", 0.);
1053 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1054 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1055 gMC->Gstpar(idtmed[i], "LOSS", 0.);
1056 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1057 gMC->Gstpar(idtmed[i], "COMP", 0.);
1058 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1059 gMC->Gstpar(idtmed[i], "BREM", 0.);
1060 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1061 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1062 gMC->Gstpar(idtmed[i], "HADR", 0.);
1065 fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1
1066 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2
1067 fMedSensZN = idtmed[1]; // Sensitive volume: ZN passive material
1068 fMedSensZP = idtmed[2]; // Sensitive volume: ZP passive material
1069 fMedSensZEM = idtmed[6]; // Sensitive volume: ZEM passive material
1070 fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves
1071 fMedSensPI = idtmed[5]; // Sensitive volume: beam pipes
1074 //_____________________________________________________________________________
1075 void AliZDCv1::Init()
1080 //_____________________________________________________________________________
1081 void AliZDCv1::InitTables()
1085 char *lightfName1,*lightfName2,*lightfName3,*lightfName4,
1086 *lightfName5,*lightfName6,*lightfName7,*lightfName8;
1087 FILE *fp1, *fp2, *fp3, *fp4, *fp5, *fp6, *fp7, *fp8;
1089 lightfName1 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362207s");
1090 if((fp1 = fopen(lightfName1,"r")) == NULL){
1091 printf("Cannot open file fp1 \n");
1094 lightfName2 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362208s");
1095 if((fp2 = fopen(lightfName2,"r")) == NULL){
1096 printf("Cannot open file fp2 \n");
1099 lightfName3 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362209s");
1100 if((fp3 = fopen(lightfName3,"r")) == NULL){
1101 printf("Cannot open file fp3 \n");
1104 lightfName4 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362210s");
1105 if((fp4 = fopen(lightfName4,"r")) == NULL){
1106 printf("Cannot open file fp4 \n");
1109 // printf(" --- Reading light tables for ZN \n");
1110 for(k=0; k<fNalfan; k++){
1111 for(j=0; j<fNben; j++){
1112 fscanf(fp1,"%f",&fTablen[0][k][j]);
1113 fscanf(fp2,"%f",&fTablen[1][k][j]);
1114 fscanf(fp3,"%f",&fTablen[2][k][j]);
1115 fscanf(fp4,"%f",&fTablen[3][k][j]);
1123 lightfName5 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552207s");
1124 if((fp5 = fopen(lightfName5,"r")) == NULL){
1125 printf("Cannot open file fp5 \n");
1128 lightfName6 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552208s");
1129 if((fp6 = fopen(lightfName6,"r")) == NULL){
1130 printf("Cannot open file fp6 \n");
1133 lightfName7 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552209s");
1134 if((fp7 = fopen(lightfName7,"r")) == NULL){
1135 printf("Cannot open file fp7 \n");
1138 lightfName8 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552210s");
1139 if((fp8 = fopen(lightfName8,"r")) == NULL){
1140 printf("Cannot open file fp8 \n");
1143 // printf(" --- Reading light tables for ZP and ZEM \n");
1144 for(k=0; k<fNalfap; k++){
1145 for(j=0; j<fNbep; j++){
1146 fscanf(fp5,"%f",&fTablep[0][k][j]);
1147 fscanf(fp6,"%f",&fTablep[1][k][j]);
1148 fscanf(fp7,"%f",&fTablep[2][k][j]);
1149 fscanf(fp8,"%f",&fTablep[3][k][j]);
1158 //_____________________________________________________________________________
1159 Int_t AliZDCv1::Digitize(Int_t Det, Int_t Quad, Int_t Light)
1161 // Evaluation of the ADC channel corresponding to the light yield Light
1164 printf("\n Digitize -> Det = %d, Quad = %d, Light = %d\n", Det, Quad, Light);
1167 // Parameters for conversion of light yield in ADC channels
1168 Float_t fPMGain[3][5]; // PM gain
1169 Float_t fADCRes; // ADC conversion factor
1174 fPMGain[i][j] = 100000.;
1177 fADCRes = 0.00000064; // ADC Resolution: 250 fC/ADCch
1179 Int_t ADCch = Int_t(Light*fPMGain[Det-1][Quad]*fADCRes);
1185 //_____________________________________________________________________________
1186 void AliZDCv1::SDigits2Digits()
1188 Hits2Digits(gAlice->GetNtrack());
1191 //_____________________________________________________________________________
1192 void AliZDCv1::Hits2Digits(Int_t ntracks)
1194 AliZDCDigit *newdigit;
1197 Int_t PMCZN = 0, PMCZP = 0, PMQZN[4], PMQZP[4], PMZEM = 0;
1206 for(itrack=0; itrack<ntracks; itrack++){
1207 gAlice->ResetHits();
1208 gAlice->TreeH()->GetEvent(itrack);
1209 for(i=0; i<fHits->GetEntries(); i++){
1210 hit = (AliZDCHit*)fHits->At(i);
1211 Int_t det = hit->GetVolume(0);
1212 Int_t quad = hit->GetVolume(1);
1213 Int_t lightQ = Int_t(hit->GetLightPMQ());
1214 Int_t lightC = Int_t(hit->GetLightPMC());
1216 printf(" \n itrack = %d, fNhits = %d, det = %d, quad = %d,"
1217 "lightC = %d lightQ = %d\n", itrack, fNhits, det, quad, lightC, lightQ);
1220 PMCZN = PMCZN + lightC;
1221 PMQZN[quad-1] = PMQZN[quad-1] + lightQ;
1225 PMCZP = PMCZP + lightC;
1226 PMQZP[quad-1] = PMQZP[quad-1] + lightQ;
1230 PMZEM = PMZEM + lightC;
1237 printf("\n PMCZN = %d, PMQZN[0] = %d, PMQZN[1] = %d, PMQZN[2] = %d, PMQZN[3] = %d\n"
1238 , PMCZN, PMQZN[0], PMQZN[1], PMQZN[2], PMQZN[3]);
1239 printf("\n PMCZP = %d, PMQZP[0] = %d, PMQZP[1] = %d, PMQZP[2] = %d, PMQZP[3] = %d\n"
1240 , PMCZP, PMQZP[0], PMQZP[1], PMQZP[2], PMQZP[3]);
1241 printf("\n PMZEM = %d\n", PMZEM);
1244 // ------------------------------------ Hits2Digits
1246 newdigit = new AliZDCDigit(1, 0, Digitize(1, 0, PMCZN));
1247 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1253 newdigit = new AliZDCDigit(1, j+1, Digitize(1, j+1, PMQZN[j]));
1254 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1260 newdigit = new AliZDCDigit(2, 0, Digitize(2, 0, PMCZP));
1261 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1267 newdigit = new AliZDCDigit(2, k+1, Digitize(2, k+1, PMQZP[k]));
1268 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1274 newdigit = new AliZDCDigit(3, 0, Digitize(3, 0, PMZEM));
1275 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1280 gAlice->TreeD()->Fill();
1281 gAlice->TreeD()->Write(0,TObject::kOverwrite);
1284 printf("\n Event Digits -----------------------------------------------------\n");
1289 //_____________________________________________________________________________
1290 void AliZDCv1::MakeBranch(Option_t *opt, char *file)
1293 // Create a new branch in the current Root Tree
1296 AliDetector::MakeBranch(opt);
1298 Char_t branchname[10];
1299 sprintf(branchname,"%s",GetName());
1300 const char *cD = strstr(opt,"D");
1302 if (gAlice->TreeD() && cD) {
1304 // Creation of the digits from hits
1306 if(fDigits!=0) fDigits->Clear();
1307 else fDigits = new TClonesArray ("AliZDCDigit",1000);
1308 char branchname[10];
1309 sprintf(branchname,"%s",GetName());
1310 gAlice->MakeBranchInTree(gAlice->TreeD(),
1311 branchname, &fDigits, fBufferSize, file) ;
1312 printf("* AliZDCv1::MakeBranch * Making Branch %s for digits\n\n",branchname);
1315 //_____________________________________________________________________________
1316 void AliZDCv1::StepManager()
1319 // Routine called at every step in the Zero Degree Calorimeters
1323 Int_t vol[2], ibeta=0, ialfa, ibe, nphe;
1324 Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, radius, out;
1325 TLorentzVector s, p;
1328 for (j=0;j<10;j++) hits[j]=0;
1330 if((gMC->GetMedium() == fMedSensZN) || (gMC->GetMedium() == fMedSensZP) ||
1331 (gMC->GetMedium() == fMedSensGR) || (gMC->GetMedium() == fMedSensF1) ||
1332 (gMC->GetMedium() == fMedSensF2) || (gMC->GetMedium() == fMedSensZEM) ||
1333 (gMC->GetMedium() == fMedSensPI)){
1335 // If particle interacts with beam pipe -> return
1336 if(gMC->GetMedium() == fMedSensPI){
1338 // If option NoShower is set -> StopTrack
1339 if(fNoShower==1) gMC->StopTrack();
1343 //Particle coordinates
1344 gMC->TrackPosition(s);
1345 for(j=0; j<=2; j++){
1352 // Determine in which ZDC the particle is
1353 knamed = gMC->CurrentVolName();
1354 if(!strncmp(knamed,"ZN",2))vol[0]=1;
1355 if(!strncmp(knamed,"ZP",2))vol[0]=2;
1356 if(!strncmp(knamed,"ZE",2))vol[0]=3;
1358 // Determine in which quadrant the particle is
1362 xdet[0] = x[0]-fPosZN[0];
1363 xdet[1] = x[1]-fPosZN[1];
1364 if((xdet[0]<=0.) && (xdet[1]>=0.)) vol[1]=1;
1365 if((xdet[0]>0.) && (xdet[1]>0.)) vol[1]=2;
1366 if((xdet[0]<0.) && (xdet[1]<0.)) vol[1]=3;
1367 if((xdet[0]>0.) && (xdet[1]<0.)) vol[1]=4;
1372 xdet[0] = x[0]-fPosZP[0];
1373 xdet[1] = x[1]-fPosZP[1];
1374 if(xdet[0]>fDimZP[0])xdet[0]=fDimZP[0]-0.01;
1375 if(xdet[0]<-fDimZP[0])xdet[0]=-fDimZP[0]+0.01;
1376 Float_t xqZP = xdet[0]/(fDimZP[0]/2);
1377 for(int i=1; i<=4; i++){
1378 if(xqZP>=(i-3) && xqZP<(i-2)){
1385 //ZEM has only 1 quadrant
1388 xdet[0] = x[0]-fPosZEM[0];
1389 xdet[1] = x[1]-fPosZEM[1];
1393 // Store impact point and kinetic energy of the ENTERING particle
1395 // if(Curtrack==Prim){
1396 if(gMC->IsTrackEntering()){
1398 gMC->TrackMomentum(p);
1401 // Impact point on ZDC
1409 // Int_t PcID = gMC->TrackPid();
1410 // printf("Pc ID -> %d\n",PcID);
1411 AddHit(gAlice->CurrentTrack(), vol, hits);
1420 // Charged particles -> Energy loss
1421 if((destep=gMC->Edep())){
1422 if(gMC->IsTrackStop()){
1423 gMC->TrackMomentum(p);
1424 m = gMC->TrackMass();
1426 if(ekin<0.) printf("ATTENTION!!!!!!!!!!!!!!! -> ekin = %f <0 (?)",ekin);
1430 AddHit(gAlice->CurrentTrack(), vol, hits);
1436 AddHit(gAlice->CurrentTrack(), vol, hits);
1438 // printf(" -> Charged particle -> Dep. E = %f eV \n",hits[8]);
1444 // *** Light production in fibres
1445 if((gMC->GetMedium() == fMedSensF1) || (gMC->GetMedium() == fMedSensF2)){
1447 //Select charged particles
1448 if((destep=gMC->Edep())){
1449 // printf(" -> CHARGED particle!!! \n");
1451 // Particle velocity
1452 gMC->TrackMomentum(p);
1453 Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
1454 Float_t beta = ptot/p[3];
1455 if(beta<0.67) return;
1456 if((beta>=0.67) && (beta<=0.75)) ibeta = 0;
1457 if((beta>0.75) && (beta<=0.85)) ibeta = 1;
1458 if((beta>0.85) && (beta<=0.95)) ibeta = 2;
1459 // if((beta>0.95) && (beta<=1.00)) ibeta = 3;
1460 if(beta>0.95) ibeta = 3;
1462 // Angle between particle trajectory and fibre axis
1463 // 1 -> Momentum directions
1467 gMC->Gmtod(um,ud,2);
1468 // 2 -> Angle < limit angle
1469 Double_t alfar = TMath::ACos(ud[2]);
1470 Double_t alfa = alfar*kRaddeg;
1471 if(alfa>=110.) return;
1472 ialfa = Int_t(1.+alfa/2.);
1474 // Distance between particle trajectory and fibre axis
1475 gMC->TrackPosition(s);
1476 for(j=0; j<=2; j++){
1479 gMC->Gmtod(x,xdet,1);
1480 if(TMath::Abs(ud[0])>0.00001){
1481 Float_t dcoeff = ud[1]/ud[0];
1482 be = TMath::Abs((xdet[1]-dcoeff*xdet[0])/TMath::Sqrt(dcoeff*dcoeff+1.));
1485 be = TMath::Abs(ud[0]);
1488 if((vol[0]==1)) radius = fFibZN[1];
1489 if((vol[0]==2)) radius = fFibZP[1];
1490 ibe = Int_t(be*1000.+1);
1492 //Looking into the light tables
1493 Float_t charge = gMC->TrackCharge();
1497 if(ibe>fNben) ibe=fNben;
1498 out = charge*charge*fTablen[ibeta][ialfa][ibe];
1499 nphe = gRandom->Poisson(out);
1500 if(gMC->GetMedium() == fMedSensF1){
1501 hits[7] = nphe; //fLightPMQ
1504 AddHit(gAlice->CurrentTrack(), vol, hits);
1508 hits[8] = nphe; //fLightPMC
1510 AddHit(gAlice->CurrentTrack(), vol, hits);
1516 if(ibe>fNbep) ibe=fNbep;
1517 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1518 nphe = gRandom->Poisson(out);
1519 if(gMC->GetMedium() == fMedSensF1){
1520 hits[7] = nphe; //fLightPMQ
1523 AddHit(gAlice->CurrentTrack(), vol, hits);
1527 hits[8] = nphe; //fLightPMC
1529 AddHit(gAlice->CurrentTrack(), vol, hits);
1534 if(ibe>fNbep) ibe=fNbep;
1535 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1536 nphe = gRandom->Poisson(out);
1538 hits[8] = nphe; //fLightPMC
1540 AddHit(gAlice->CurrentTrack(), vol, hits);