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.16 2001/03/15 16:12:04 coppedis
21 Revision 1.15 2001/03/12 17:47:56 hristov
22 Changes needed on Sun with CC 5.0
24 Revision 1.14 2001/02/23 16:48:28 coppedis
25 Correct bug in ZEM hit definition
27 Revision 1.13 2001/02/07 18:07:41 coppedis
30 Revision 1.12 2001/01/26 19:56:27 hristov
31 Major upgrade of AliRoot code
33 Revision 1.11 2001/01/16 07:43:33 hristov
34 Initialisation of ZDC hits
36 Revision 1.10 2000/12/14 15:20:02 coppedis
37 Hits2Digits method for digitization
39 Revision 1.9 2000/12/13 10:33:49 coppedis
40 Prints only if fDebug==1
42 Revision 1.8 2000/12/12 14:10:02 coppedis
43 Correction suggested by M. Masera
45 Revision 1.7 2000/11/30 17:23:47 coppedis
46 Remove first corrector dipole and introduce digitization
48 Revision 1.6 2000/11/22 11:33:10 coppedis
51 Revision 1.5 2000/10/02 21:28:20 fca
52 Removal of useless dependecies via forward declarations
54 Revision 1.3.2.1 2000/08/24 09:25:47 hristov
55 Patch by P.Hristov: Bug in ZDC geometry corrected by E.Scomparin
57 Revision 1.4 2000/08/24 09:23:59 hristov
58 Bug in ZDC geometry corrected by E.Scomparin
60 Revision 1.3 2000/07/12 06:59:16 fca
61 Fixing dimension of hits array
63 Revision 1.2 2000/07/11 11:12:34 fca
64 Some syntax corrections for non standard HP aCC
66 Revision 1.1 2000/07/10 13:58:01 fca
67 New version of ZDC from E.Scomparin & C.Oppedisano
69 Revision 1.7 2000/01/19 17:17:40 fca
71 Revision 1.6 1999/09/29 09:24:35 fca
72 Introduction of the Copyright and cvs Log
76 ///////////////////////////////////////////////////////////////////////////////
78 // Zero Degree Calorimeter //
79 // This class contains the basic functions for the ZDC //
80 // Functions specific to one particular geometry are //
81 // contained in the derived classes //
83 ///////////////////////////////////////////////////////////////////////////////
85 // --- Standard libraries
97 // --- AliRoot classes
99 #include "AliZDCHit.h"
100 #include "AliZDCDigit.h"
102 #include "AliDetector.h"
105 #include "AliCallf77.h"
106 #include "AliConst.h"
108 #include "TLorentzVector.h"
114 ///////////////////////////////////////////////////////////////////////////////
116 // Zero Degree Calorimeter version 1 //
118 ///////////////////////////////////////////////////////////////////////////////
120 //_____________________________________________________________________________
121 AliZDCv1::AliZDCv1() : AliZDC()
124 // Default constructor for Zero Degree Calorimeter
136 //_____________________________________________________________________________
137 AliZDCv1::AliZDCv1(const char *name, const char *title)
141 // Standard constructor for Zero Degree Calorimeter
153 // Parameters for light tables
154 fNalfan = 90; // Number of Alfa (neutrons)
155 fNalfap = 90; // Number of Alfa (protons)
156 fNben = 18; // Number of beta (neutrons)
157 fNbep = 28; // Number of beta (protons)
159 for(ip=0; ip<4; ip++){
160 for(kp=0; kp<fNalfap; kp++){
161 for(jp=0; jp<fNbep; jp++){
162 fTablep[ip][kp][jp] = 0;
167 for(in=0; in<4; in++){
168 for(kn=0; kn<fNalfan; kn++){
169 for(jn=0; jn<fNben; jn++){
170 fTablen[in][kn][jn] = 0;
175 // Parameters for hadronic calorimeters geometry
192 // Parameters for EM calorimeter geometry
198 fDigits = new TClonesArray("AliZDCDigit",1000);
201 //_____________________________________________________________________________
202 void AliZDCv1::CreateGeometry()
205 // Create the geometry for the Zero Degree Calorimeter version 1
206 //* Initialize COMMON block ZDC_CGEOM
213 //_____________________________________________________________________________
214 void AliZDCv1::CreateBeamLine()
217 Float_t angle, zq, conpar[9], elpar[3], tubpar[3], zd1, zd2;
220 Int_t *idtmed = fIdtmed->GetArray();
222 // -- Mother of the ZDCs
233 gMC->Gsvolu("ZDC ", "PCON", idtmed[10], conpar, 9);
234 gMC->Gspos("ZDC ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
236 // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to
243 tubpar[2] = 3838.3/2.;
244 gMC->Gsvolu("P001", "TUBE", idtmed[5], tubpar, 3);
245 gMC->Gspos("P001", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
247 //-- SECOND SECTION OF THE BEAM PIPE (FROM THE END OF D1 TO THE BEGINNING OF
250 //-- FROM MAGNETIC BEGINNING OF D1 TO MAGNETIC END OF D1 + 23.5 cm
251 //-- Elliptic pipe -> ELLIPTIC PIPE NOT INSERTED FOR THE MOMENT!
253 //-> D1 begins at (6310.8-472.5)
259 // gMC->Gsvolu("E001", "ELTU", idtmed[5], elpar, 3);
260 // gMC->Gspos("E001", 1, "ZDC ", 0., 0., elpar[2] + zd1, 0, "ONLY");
265 // gMC->Gsvolu("E002", "ELTU", idtmed[10], elpar, 3);
266 // gMC->Gspos("E002", 1, "E001", 0., 0., 0., 0, "ONLY");
273 // gMC->Gsvolu("E003", "ELTU", idtmed[5], elpar, 3);
274 // gMC->Gspos("E002", 1, "ZDC ", 0., 0., elpar[2] + zd1, 0, "ONLY");
279 // gMC->Gsvolu("E004", "ELTU", idtmed[10], elpar, 3);
280 // gMC->Gspos("E004", 1, "E003", 0., 0., 0., 0, "ONLY");
289 gMC->Gsvolu("C001", "CONE", idtmed[5], conpar, 5);
290 gMC->Gspos("C001", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
297 gMC->Gsvolu("P002", "TUBE", idtmed[5], tubpar, 3);
298 gMC->Gspos("P002", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
305 gMC->Gsvolu("P003", "TUBE", idtmed[5], tubpar, 3);
306 gMC->Gspos("P003", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
308 zd1 += tubpar[2] * 2.;
313 gMC->Gsvolu("P004", "TUBE", idtmed[5], tubpar, 3);
314 gMC->Gspos("P004", 1, "ZDC ", 0., 0., tubpar[0] + zd1, 0, "ONLY");
316 zd1 += tubpar[2] * 2.;
321 gMC->Gsvolu("P005", "TUBE", idtmed[5], tubpar, 3);
322 gMC->Gspos("P005", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
324 zd1 += tubpar[2] * 2.;
331 gMC->Gsvolu("P006", "CONE", idtmed[5], conpar, 5);
332 gMC->Gspos("P006", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
334 zd1 += conpar[0] * 2.;
339 gMC->Gsvolu("P007", "TUBE", idtmed[5], tubpar, 3);
340 gMC->Gspos("P007", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
342 zd1 += tubpar[2] * 2.;
349 gMC->Gsvolu("P008", "CONE", idtmed[5], conpar, 5);
350 gMC->Gspos("P008", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
352 zd1 += conpar[0] * 2.;
356 tubpar[2] = 205.8/2.;
357 gMC->Gsvolu("P009", "TUBE", idtmed[5], tubpar, 3);
358 gMC->Gspos("P009", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
360 zd1 += tubpar[2] * 2.;
364 tubpar[2] = 505.4/2.;
365 gMC->Gsvolu("P010", "TUBE", idtmed[5], tubpar, 3);
366 gMC->Gspos("P010", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
368 zd1 += tubpar[2] * 2.;
373 gMC->Gsvolu("P011", "TUBE", idtmed[5], tubpar, 3);
374 gMC->Gspos("P011", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
376 zd1 += tubpar[2] * 2.;
380 tubpar[2] = 778.5/2.;
381 gMC->Gsvolu("P012", "TUBE", idtmed[5], tubpar, 3);
382 gMC->Gspos("P012", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
384 zd1 += tubpar[2] * 2.;
386 conpar[0] = 14.18/2.;
391 gMC->Gsvolu("P013", "CONE", idtmed[5], conpar, 5);
392 gMC->Gspos("P013", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
394 zd1 += conpar[0] * 2.;
399 gMC->Gsvolu("P014", "TUBE", idtmed[5], tubpar, 3);
400 gMC->Gspos("P014", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
402 zd1 += tubpar[2] * 2.;
404 conpar[0] = 36.86/2.;
409 gMC->Gsvolu("P015", "CONE", idtmed[5], conpar, 5);
410 gMC->Gspos("P015", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
412 zd1 += conpar[0] * 2.;
416 tubpar[2] = 927.3/2.;
417 gMC->Gsvolu("P016", "TUBE", idtmed[5], tubpar, 3);
418 gMC->Gspos("P016", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
420 zd1 += tubpar[2] * 2.;
425 gMC->Gsvolu("P017", "TUBE", idtmed[8], tubpar, 3);
426 gMC->Gspos("P017", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
428 zd1 += tubpar[2] * 2.;
433 gMC->Gsvolu("Q017", "TUBE", idtmed[10], tubpar, 3);
435 //-- Position Q017 inside P017
436 gMC->Gspos("Q017", 1, "P017", -7.7, 0., 0., 0, "ONLY");
441 gMC->Gsvolu("R017", "TUBE", idtmed[10], tubpar, 3);
443 //-- Position R017 inside P017
444 gMC->Gspos("R017", 1, "P017", 7.7, 0., 0., 0, "ONLY");
446 //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2
451 gMC->Gsvolu("P018", "TUBE", idtmed[5], tubpar, 3);
456 gMC->Gsvolu("P019", "TUBE", idtmed[5], tubpar, 3);
460 AliMatrix(im1, 90.-0.071, 0., 90., 90., .071, 180.);
461 angle = .071*kDegrad;
462 gMC->Gspos("P018", 1, "ZDC ", TMath::Sin(angle) * 645. / 2. - 9.7 +
463 TMath::Sin(angle) * 945. / 2., 0., tubpar[2] + zd1, im1, "ONLY");
464 AliMatrix(im2, 90.+0.071, 0., 90., 90., .071, 0.);
465 gMC->Gspos("P019", 1, "ZDC ", 9.7 - TMath::Sin(angle) * 645. / 2., 0.,
466 tubpar[2] + zd1, im2, "ONLY");
468 // -- END OF BEAM PIPE VOLUME DEFINITION. MAGNET DEFINITION FOLLOWS
471 // ----------------------------------------------------------------
472 // Replaced by the muon dipole
473 // ----------------------------------------------------------------
474 // -- COMPENSATOR DIPOLE (MBXW)
475 // GAP (VACUUM WITH MAGNETIC FIELD)
479 // tubpar[2] = 340./2.;
480 // gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3);
481 // gMC->Gspos("MBXW", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
483 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
487 // tubpar[2] = 340./2.;
488 // gMC->Gsvolu("YMBX", "TUBE", idtmed[5], tubpar, 3);
489 // gMC->Gspos("YMBX", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
491 // ----------------------------------------------------------------
492 // Replaced by the muon compesator
493 // ----------------------------------------------------------------
494 // -- COMPENSATOR DIPOLE (MCBWA)
495 // GAP (VACUUM WITH MAGNETIC FIELD)
499 // tubpar[2] = 170./2.;
500 // gMC->Gsvolu("MCBW", "TUBE", idtmed[11], tubpar, 3);
501 // gMC->Gspos("MCBW", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
503 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
507 // tubpar[2] = 170./2.;
508 // gMC->Gsvolu("YMCB", "TUBE", idtmed[5], tubpar, 3);
509 // gMC->Gspos("YMCB", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
515 // -- DEFINE MQXL AND MQX QUADRUPOLE ELEMENT
518 // -- GAP (VACUUM WITH MAGNETIC FIELD)
523 gMC->Gsvolu("MQXL", "TUBE", idtmed[11], tubpar, 3);
530 gMC->Gsvolu("YMQL", "TUBE", idtmed[5], tubpar, 3);
532 gMC->Gspos("MQXL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
533 gMC->Gspos("YMQL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
535 gMC->Gspos("MQXL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
536 gMC->Gspos("YMQL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
539 // -- GAP (VACUUM WITH MAGNETIC FIELD)
544 gMC->Gsvolu("MQX ", "TUBE", idtmed[11], tubpar, 3);
551 gMC->Gsvolu("YMQ ", "TUBE", idtmed[5], tubpar, 3);
553 gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880., 0, "ONLY");
554 gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880., 0, "ONLY");
556 gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
557 gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
559 // -- SEPARATOR DIPOLE D1
563 // -- GAP (VACUUM WITH MAGNETIC FIELD)
568 gMC->Gsvolu("D1 ", "TUBE", idtmed[11], tubpar, 3);
575 gMC->Gsvolu("YD1 ", "TUBE", idtmed[5], tubpar, 3);
577 gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
578 gMC->Gspos("D1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
584 // -- GAP (VACUUM WITH MAGNETIC FIELD)
589 gMC->Gsvolu("D2 ", "TUBE", idtmed[11], tubpar, 3);
596 gMC->Gsvolu("YD2 ", "TUBE", idtmed[5], tubpar, 3);
598 gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., tubpar[2] + zd2, 0, "ONLY");
600 gMC->Gspos("D2 ", 1, "YD2 ", -9.7, 0., 0., 0, "ONLY");
601 gMC->Gspos("D2 ", 2, "YD2 ", 9.7, 0., 0., 0, "ONLY");
603 // -- END OF MAGNET DEFINITION
606 //_____________________________________________________________________________
607 void AliZDCv1::CreateZDC()
611 Float_t DimPb[6], DimVoid[6];
613 Int_t *idtmed = fIdtmed->GetArray();
615 // Parameters for hadronic calorimeters geometry
616 // NB -> parameters used ONLY in CreateZDC()
617 Float_t fDimZN[3] = {3.52, 3.52, 50.}; // Dimensions of neutron detector
618 Float_t fGrvZN[3] = {0.03, 0.03, 50.}; // Grooves for neutron detector
619 Float_t fGrvZP[3] = {0.04, 0.04, 75.}; // Grooves for proton detector
620 Int_t fDivZN[3] = {11, 11, 0}; // Division for neutron detector
621 Int_t fDivZP[3] = {7, 15, 0}; // Division for proton detector
622 Int_t fTowZN[2] = {2, 2}; // Tower for neutron detector
623 Int_t fTowZP[2] = {4, 1}; // Tower for proton detector
625 // Parameters for EM calorimeter geometry
626 // NB -> parameters used ONLY in CreateZDC()
627 Float_t fDimZEMPb = 0.15*(TMath::Sqrt(2.)); // z-dimension of the Pb slice
628 Float_t fDimZEMAir = 0.001; // scotch
629 Float_t fFibRadZEM = 0.0315; // External fiber radius (including cladding)
630 Int_t fDivZEM[3] = {92, 0, 20}; // Divisions for EM detector
631 Float_t fDimZEM0 = 2*fDivZEM[2]*(fDimZEMPb+fDimZEMAir+fFibRadZEM*(TMath::Sqrt(2.)));
632 Float_t fDimZEM[6] = {fDimZEM0, 3.5, 3.5, 45., 0., 0.}; // Dimensions of EM detector
633 Float_t fFibZEM2 = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-fFibRadZEM;
634 Float_t fFibZEM[3] = {0., 0.0275, fFibZEM2}; // Fibers for EM calorimeter
637 //-- Create calorimeters geometry
639 //--> Neutron calorimeter (ZN)
641 gMC->Gsvolu("ZNEU", "BOX ", idtmed[1], fDimZN, 3); // Passive material
642 gMC->Gsvolu("ZNF1", "TUBE", idtmed[3], fFibZN, 3); // Active material
643 gMC->Gsvolu("ZNF2", "TUBE", idtmed[4], fFibZN, 3);
644 gMC->Gsvolu("ZNF3", "TUBE", idtmed[4], fFibZN, 3);
645 gMC->Gsvolu("ZNF4", "TUBE", idtmed[3], fFibZN, 3);
646 gMC->Gsvolu("ZNG1", "BOX ", idtmed[12], fGrvZN, 3); // Empty grooves
647 gMC->Gsvolu("ZNG2", "BOX ", idtmed[12], fGrvZN, 3);
648 gMC->Gsvolu("ZNG3", "BOX ", idtmed[12], fGrvZN, 3);
649 gMC->Gsvolu("ZNG4", "BOX ", idtmed[12], fGrvZN, 3);
651 // Divide ZNEU in towers (for hits purposes)
653 gMC->Gsdvn("ZNTX", "ZNEU", fTowZN[0], 1); // x-tower
654 gMC->Gsdvn("ZN1 ", "ZNTX", fTowZN[1], 2); // y-tower
656 //-- Divide ZN1 in minitowers
657 // fDivZN[0]= NUMBER OF FIBERS PER TOWER ALONG X-AXIS,
658 // fDivZN[1]= NUMBER OF FIBERS PER TOWER ALONG Y-AXIS
659 // (4 fibres per minitower)
661 gMC->Gsdvn("ZNSL", "ZN1 ", fDivZN[1], 2); // Slices
662 gMC->Gsdvn("ZNST", "ZNSL", fDivZN[0], 1); // Sticks
664 // --- Position the empty grooves in the sticks (4 grooves per stick)
665 Float_t dx = fDimZN[0] / fDivZN[0] / 4.;
666 Float_t dy = fDimZN[1] / fDivZN[1] / 4.;
668 gMC->Gspos("ZNG1", 1, "ZNST", 0.-dx, 0.+dy, 0., 0, "ONLY");
669 gMC->Gspos("ZNG2", 1, "ZNST", 0.+dx, 0.+dy, 0., 0, "ONLY");
670 gMC->Gspos("ZNG3", 1, "ZNST", 0.-dx, 0.-dy, 0., 0, "ONLY");
671 gMC->Gspos("ZNG4", 1, "ZNST", 0.+dx, 0.-dy, 0., 0, "ONLY");
673 // --- Position the fibers in the grooves
674 gMC->Gspos("ZNF1", 1, "ZNG1", 0., 0., 0., 0, "ONLY");
675 gMC->Gspos("ZNF2", 1, "ZNG2", 0., 0., 0., 0, "ONLY");
676 gMC->Gspos("ZNF3", 1, "ZNG3", 0., 0., 0., 0, "ONLY");
677 gMC->Gspos("ZNF4", 1, "ZNG4", 0., 0., 0., 0, "ONLY");
679 // --- Position the neutron calorimeter in ZDC
680 gMC->Gspos("ZNEU", 1, "ZDC ", fPosZN[0], fPosZN[1], fPosZN[2] + fDimZN[2], 0, "ONLY");
683 //--> Proton calorimeter (ZP)
685 gMC->Gsvolu("ZPRO", "BOX ", idtmed[2], fDimZP, 3); // Passive material
686 gMC->Gsvolu("ZPF1", "TUBE", idtmed[3], fFibZP, 3); // Active material
687 gMC->Gsvolu("ZPF2", "TUBE", idtmed[4], fFibZP, 3);
688 gMC->Gsvolu("ZPF3", "TUBE", idtmed[4], fFibZP, 3);
689 gMC->Gsvolu("ZPF4", "TUBE", idtmed[3], fFibZP, 3);
690 gMC->Gsvolu("ZPG1", "BOX ", idtmed[12], fGrvZP, 3); // Empty grooves
691 gMC->Gsvolu("ZPG2", "BOX ", idtmed[12], fGrvZP, 3);
692 gMC->Gsvolu("ZPG3", "BOX ", idtmed[12], fGrvZP, 3);
693 gMC->Gsvolu("ZPG4", "BOX ", idtmed[12], fGrvZP, 3);
695 //-- Divide ZPRO in towers(for hits purposes)
697 gMC->Gsdvn("ZPTX", "ZPRO", fTowZP[0], 1); // x-tower
698 gMC->Gsdvn("ZP1 ", "ZPTX", fTowZP[1], 2); // y-tower
701 //-- Divide ZP1 in minitowers
702 // fDivZP[0]= NUMBER OF FIBERS ALONG X-AXIS PER MINITOWER,
703 // fDivZP[1]= NUMBER OF FIBERS ALONG Y-AXIS PER MINITOWER
704 // (4 fiber per minitower)
706 gMC->Gsdvn("ZPSL", "ZP1 ", fDivZP[1], 2); // Slices
707 gMC->Gsdvn("ZPST", "ZPSL", fDivZP[0], 1); // Sticks
709 // --- Position the empty grooves in the sticks (4 grooves per stick)
710 dx = fDimZP[0] / fTowZP[0] / fDivZP[0] / 2.;
711 dy = fDimZP[1] / fTowZP[1] / fDivZP[1] / 2.;
713 gMC->Gspos("ZPG1", 1, "ZPST", 0.-dx, 0.+dy, 0., 0, "ONLY");
714 gMC->Gspos("ZPG2", 1, "ZPST", 0.+dx, 0.+dy, 0., 0, "ONLY");
715 gMC->Gspos("ZPG3", 1, "ZPST", 0.-dx, 0.-dy, 0., 0, "ONLY");
716 gMC->Gspos("ZPG4", 1, "ZPST", 0.+dx, 0.-dy, 0., 0, "ONLY");
718 // --- Position the fibers in the grooves
719 gMC->Gspos("ZPF1", 1, "ZPG1", 0., 0., 0., 0, "ONLY");
720 gMC->Gspos("ZPF2", 1, "ZPG2", 0., 0., 0., 0, "ONLY");
721 gMC->Gspos("ZPF3", 1, "ZPG3", 0., 0., 0., 0, "ONLY");
722 gMC->Gspos("ZPF4", 1, "ZPG4", 0., 0., 0., 0, "ONLY");
725 // --- Position the proton calorimeter in ZDC
726 gMC->Gspos("ZPRO", 1, "ZDC ", fPosZP[0], fPosZP[1], fPosZP[2] + fDimZP[2], 0, "ONLY");
730 //--> EM calorimeter (ZEM)
732 gMC->Gsvolu("ZEM ", "PARA", idtmed[10], fDimZEM, 6);
734 gMC->Matrix(irot1,0.,0.,90.,90.,90.,180.); // Rotation matrix 1
735 gMC->Matrix(irot2,180.,0.,90.,fDimZEM[3]+90.,90.,fDimZEM[3]); // Rotation matrix 2
736 // printf("irot1 = %d, irot2 = %d \n", irot1, irot2);
738 gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material
740 gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches
742 DimPb[0] = fDimZEMPb; // Lead slices
743 DimPb[1] = fDimZEM[2];
744 DimPb[2] = fDimZEM[1];
745 DimPb[3] = 90.-fDimZEM[3];
748 gMC->Gsvolu("ZEL0", "PARA", idtmed[6], DimPb, 6);
749 gMC->Gsvolu("ZEL1", "PARA", idtmed[6], DimPb, 6);
750 gMC->Gsvolu("ZEL2", "PARA", idtmed[6], DimPb, 6);
752 // --- Position the lead slices in the tranche
753 Float_t zTran = fDimZEM[0]/fDivZEM[2];
754 Float_t zTrPb = -zTran+fDimZEMPb;
755 gMC->Gspos("ZEL0", 1, "ZETR", zTrPb, 0., 0., 0, "ONLY");
756 gMC->Gspos("ZEL1", 1, "ZETR", fDimZEMPb, 0., 0., 0, "ONLY");
758 // --- Vacuum zone (to be filled with fibres)
759 DimVoid[0] = (zTran-2*fDimZEMPb)/2.;
760 DimVoid[1] = fDimZEM[2];
761 DimVoid[2] = fDimZEM[1];
762 DimVoid[3] = 90.-fDimZEM[3];
765 gMC->Gsvolu("ZEV0", "PARA", idtmed[10], DimVoid,6);
766 gMC->Gsvolu("ZEV1", "PARA", idtmed[10], DimVoid,6);
768 // --- Divide the vacuum slice into sticks along x axis
769 gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3);
770 gMC->Gsdvn("ZES1", "ZEV1", fDivZEM[0], 3);
772 // --- Positioning the fibers into the sticks
773 gMC->Gspos("ZEMF", 1,"ZES0", 0., 0., 0., irot2, "ONLY");
774 gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY");
776 // --- Positioning the vacuum slice into the tranche
777 Float_t DisplFib = fDimZEM[1]/fDivZEM[0];
778 gMC->Gspos("ZEV0", 1,"ZETR", -DimVoid[0], 0., 0., 0, "ONLY");
779 gMC->Gspos("ZEV1", 1,"ZETR", -DimVoid[0]+zTran, 0., DisplFib, 0, "ONLY");
781 // --- Positioning the ZEM into the ZDC - rotation for 90 degrees
782 gMC->Gspos("ZEM ", 1,"ZDC ", fPosZEM[0], fPosZEM[1], fPosZEM[2], irot1, "ONLY");
784 // --- Adding last slice at the end of the EM calorimeter
785 Float_t zLastSlice = fPosZEM[2]+fDimZEMPb+fDimZEM[0];
786 gMC->Gspos("ZEL2", 1,"ZDC ", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY");
790 //_____________________________________________________________________________
791 void AliZDCv1::DrawModule()
794 // Draw a shaded view of the Zero Degree Calorimeter version 1
797 // Set everything unseen
798 gMC->Gsatt("*", "seen", -1);
800 // Set ALIC mother transparent
801 gMC->Gsatt("ALIC","SEEN",0);
803 // Set the volumes visible
804 gMC->Gsatt("ZDC ","SEEN",0);
805 gMC->Gsatt("P001","SEEN",1);
806 gMC->Gsatt("E001","SEEN",1);
807 gMC->Gsatt("E002","SEEN",1);
808 gMC->Gsatt("E003","SEEN",1);
809 gMC->Gsatt("E004","SEEN",1);
810 gMC->Gsatt("C001","SEEN",1);
811 gMC->Gsatt("P002","SEEN",1);
812 gMC->Gsatt("P003","SEEN",1);
813 gMC->Gsatt("P004","SEEN",1);
814 gMC->Gsatt("P005","SEEN",1);
815 gMC->Gsatt("P006","SEEN",1);
816 gMC->Gsatt("P007","SEEN",1);
817 gMC->Gsatt("P008","SEEN",1);
818 gMC->Gsatt("P009","SEEN",1);
819 gMC->Gsatt("P010","SEEN",1);
820 gMC->Gsatt("P011","SEEN",1);
821 gMC->Gsatt("P012","SEEN",1);
822 gMC->Gsatt("P013","SEEN",1);
823 gMC->Gsatt("P014","SEEN",1);
824 gMC->Gsatt("P015","SEEN",1);
825 gMC->Gsatt("P016","SEEN",1);
826 gMC->Gsatt("P017","SEEN",1);
827 gMC->Gsatt("Q017","SEEN",1);
828 gMC->Gsatt("R017","SEEN",1);
829 gMC->Gsatt("P018","SEEN",1);
830 gMC->Gsatt("P019","SEEN",1);
831 // gMC->Gsatt("MBXW","SEEN",1);
832 // gMC->Gsatt("YMBX","SEEN",1);
833 gMC->Gsatt("MCBW","SEEN",1);
834 gMC->Gsatt("YMCB","SEEN",1);
835 gMC->Gsatt("MQXL","SEEN",1);
836 gMC->Gsatt("YMQL","SEEN",1);
837 gMC->Gsatt("MQX ","SEEN",1);
838 gMC->Gsatt("YMQ ","SEEN",1);
839 gMC->Gsatt("D1 ","SEEN",1);
840 gMC->Gsatt("YD1 ","SEEN",1);
841 gMC->Gsatt("D2 ","SEEN",1);
842 gMC->Gsatt("YD2 ","SEEN",1);
843 gMC->Gsatt("ZNEU","SEEN",0);
844 gMC->Gsatt("ZNF1","SEEN",0);
845 gMC->Gsatt("ZNF2","SEEN",0);
846 gMC->Gsatt("ZNF3","SEEN",0);
847 gMC->Gsatt("ZNF4","SEEN",0);
848 gMC->Gsatt("ZNG1","SEEN",0);
849 gMC->Gsatt("ZNG2","SEEN",0);
850 gMC->Gsatt("ZNG3","SEEN",0);
851 gMC->Gsatt("ZNG4","SEEN",0);
852 gMC->Gsatt("ZNTX","SEEN",0);
853 gMC->Gsatt("ZN1 ","COLO",2);
854 gMC->Gsatt("ZN1 ","SEEN",1);
855 gMC->Gsatt("ZNSL","SEEN",0);
856 gMC->Gsatt("ZNST","SEEN",0);
857 gMC->Gsatt("ZPRO","SEEN",0);
858 gMC->Gsatt("ZPF1","SEEN",0);
859 gMC->Gsatt("ZPF2","SEEN",0);
860 gMC->Gsatt("ZPF3","SEEN",0);
861 gMC->Gsatt("ZPF4","SEEN",0);
862 gMC->Gsatt("ZPG1","SEEN",0);
863 gMC->Gsatt("ZPG2","SEEN",0);
864 gMC->Gsatt("ZPG3","SEEN",0);
865 gMC->Gsatt("ZPG4","SEEN",0);
866 gMC->Gsatt("ZPTX","SEEN",0);
867 gMC->Gsatt("ZP1 ","COLO",2);
868 gMC->Gsatt("ZP1 ","SEEN",1);
869 gMC->Gsatt("ZPSL","SEEN",0);
870 gMC->Gsatt("ZPST","SEEN",0);
871 gMC->Gsatt("ZEM ","COLO",2);
872 gMC->Gsatt("ZEM ","SEEN",1);
873 gMC->Gsatt("ZEMF","SEEN",0);
874 gMC->Gsatt("ZETR","SEEN",0);
875 gMC->Gsatt("ZEL0","SEEN",0);
876 gMC->Gsatt("ZEL1","SEEN",0);
877 gMC->Gsatt("ZEL2","SEEN",0);
878 gMC->Gsatt("ZEV0","SEEN",0);
879 gMC->Gsatt("ZEV1","SEEN",0);
880 gMC->Gsatt("ZES0","SEEN",0);
881 gMC->Gsatt("ZES1","SEEN",0);
884 gMC->Gdopt("hide", "on");
885 gMC->Gdopt("shad", "on");
886 gMC->Gsatt("*", "fill", 7);
887 gMC->SetClipBox(".");
888 gMC->SetClipBox("*", 0, 100, -100, 100, 12000, 16000);
890 gMC->Gdraw("alic", 40, 30, 0, 488, 220, .07, .07);
891 gMC->Gdhead(1111, "Zero Degree Calorimeter Version 1");
892 gMC->Gdman(18, 4, "MAN");
895 //_____________________________________________________________________________
896 void AliZDCv1::CreateMaterials()
899 // Create Materials for the Zero Degree Calorimeter
901 // Origin : E. Scomparin
903 Int_t *idtmed = fIdtmed->GetArray();
905 Float_t dens, ubuf[1], wmat[2], a[2], z[2], epsil=0.001, stmin=0.01;
906 Float_t deemax = -1, stemax;
907 Float_t fieldm = gAlice->Field()->Max();
908 Float_t tmaxfd=gAlice->Field()->Max();
909 Int_t i, isvolActive, isvol, inofld;
910 Int_t isxfld = gAlice->Field()->Integ();
912 // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3
914 // --- Tantalum -> ZN passive material
916 AliMaterial(1, "TANT", 180.95, 73., 16.65, .4, 11.9, ubuf, 1);
920 // AliMaterial(1, "TUNG", 183.85, 74., 19.3, .35, 10.3, ubuf, 1);
922 // --- Brass (CuZn) -> ZP passive material
930 AliMixture(2, "BRASS ", a, z, dens, 2, wmat);
940 AliMixture(3, "SIO2 ", a, z, dens, -2, wmat);
945 AliMaterial(5, "LEAD", 207.19, 82., 11.35, .56, 18.5, ubuf, 1);
949 // AliMaterial(7, "COPP", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
951 // --- Iron (energy loss taken into account)
953 AliMaterial(6, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
955 // --- Iron (no energy loss)
957 AliMaterial(7, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
959 // --- Vacuum (no magnetic field)
960 AliMaterial(10, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
962 // --- Vacuum (with magnetic field)
963 AliMaterial(11, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
965 // --- Air (no magnetic field)
966 AliMaterial(12, "Air $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0);
968 // --- Definition of tracking media:
970 // --- Tantalum = 1 ;
972 // --- Fibers (SiO2) = 3 ;
973 // --- Fibers (SiO2) = 4 ;
975 // --- Iron (with energy loss) = 6 ;
976 // --- Iron (without energy loss) = 7 ;
977 // --- Vacuum (no field) = 10
978 // --- Vacuum (with field) = 11
979 // --- Air (no field) = 12
982 // --- Tracking media parameters
990 AliMedium(1, "ZTANT", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
991 // AliMedium(1, "ZW", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
992 AliMedium(2, "ZBRASS", 2, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
993 AliMedium(3, "ZSIO2", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
994 AliMedium(4, "ZQUAR", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
995 AliMedium(6, "ZLEAD", 5, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
996 // AliMedium(7, "ZCOPP", 7, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
997 AliMedium(5, "ZIRON", 6, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
998 AliMedium(8, "ZIRONN", 7, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
999 AliMedium(10, "ZVOID", 10, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1000 AliMedium(12, "ZAIR", 12, 0, inofld, fieldm, tmaxfd, stemax,deemax, epsil, stmin);
1003 AliMedium(11, "ZVOIM", 11, isvol, isxfld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1005 // Thresholds for showering in the ZDCs
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 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
1014 gMC->Gstpar(idtmed[i], "CUTELE", .001);
1015 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
1016 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
1018 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
1019 gMC->Gstpar(idtmed[i], "CUTELE", .001);
1020 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
1021 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
1023 // Avoid too detailed showering along the beam line
1026 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1027 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1028 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1029 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1031 // Avoid interaction in fibers (only energy loss allowed)
1033 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1034 gMC->Gstpar(idtmed[i], "MULS", 0.);
1035 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1036 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1037 gMC->Gstpar(idtmed[i], "LOSS", 1.);
1038 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1039 gMC->Gstpar(idtmed[i], "COMP", 0.);
1040 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1041 gMC->Gstpar(idtmed[i], "BREM", 0.);
1042 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1043 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1044 gMC->Gstpar(idtmed[i], "HADR", 0.);
1046 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1047 gMC->Gstpar(idtmed[i], "MULS", 0.);
1048 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1049 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1050 gMC->Gstpar(idtmed[i], "LOSS", 1.);
1051 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1052 gMC->Gstpar(idtmed[i], "COMP", 0.);
1053 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1054 gMC->Gstpar(idtmed[i], "BREM", 0.);
1055 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1056 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1057 gMC->Gstpar(idtmed[i], "HADR", 0.);
1059 // Avoid interaction in void
1061 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1062 gMC->Gstpar(idtmed[i], "MULS", 0.);
1063 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1064 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1065 gMC->Gstpar(idtmed[i], "LOSS", 0.);
1066 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1067 gMC->Gstpar(idtmed[i], "COMP", 0.);
1068 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1069 gMC->Gstpar(idtmed[i], "BREM", 0.);
1070 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1071 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1072 gMC->Gstpar(idtmed[i], "HADR", 0.);
1075 fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1
1076 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2
1077 fMedSensZN = idtmed[1]; // Sensitive volume: ZN passive material
1078 fMedSensZP = idtmed[2]; // Sensitive volume: ZP passive material
1079 fMedSensZEM = idtmed[6]; // Sensitive volume: ZEM passive material
1080 fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves
1081 fMedSensPI = idtmed[5]; // Sensitive volume: beam pipes
1084 //_____________________________________________________________________________
1085 void AliZDCv1::Init()
1090 //_____________________________________________________________________________
1091 void AliZDCv1::InitTables()
1095 char *lightfName1,*lightfName2,*lightfName3,*lightfName4,
1096 *lightfName5,*lightfName6,*lightfName7,*lightfName8;
1097 FILE *fp1, *fp2, *fp3, *fp4, *fp5, *fp6, *fp7, *fp8;
1099 lightfName1 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362207s");
1100 if((fp1 = fopen(lightfName1,"r")) == NULL){
1101 printf("Cannot open file fp1 \n");
1104 lightfName2 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362208s");
1105 if((fp2 = fopen(lightfName2,"r")) == NULL){
1106 printf("Cannot open file fp2 \n");
1109 lightfName3 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362209s");
1110 if((fp3 = fopen(lightfName3,"r")) == NULL){
1111 printf("Cannot open file fp3 \n");
1114 lightfName4 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362210s");
1115 if((fp4 = fopen(lightfName4,"r")) == NULL){
1116 printf("Cannot open file fp4 \n");
1119 // printf(" --- Reading light tables for ZN \n");
1120 for(k=0; k<fNalfan; k++){
1121 for(j=0; j<fNben; j++){
1122 fscanf(fp1,"%f",&fTablen[0][k][j]);
1123 fscanf(fp2,"%f",&fTablen[1][k][j]);
1124 fscanf(fp3,"%f",&fTablen[2][k][j]);
1125 fscanf(fp4,"%f",&fTablen[3][k][j]);
1133 lightfName5 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552207s");
1134 if((fp5 = fopen(lightfName5,"r")) == NULL){
1135 printf("Cannot open file fp5 \n");
1138 lightfName6 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552208s");
1139 if((fp6 = fopen(lightfName6,"r")) == NULL){
1140 printf("Cannot open file fp6 \n");
1143 lightfName7 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552209s");
1144 if((fp7 = fopen(lightfName7,"r")) == NULL){
1145 printf("Cannot open file fp7 \n");
1148 lightfName8 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552210s");
1149 if((fp8 = fopen(lightfName8,"r")) == NULL){
1150 printf("Cannot open file fp8 \n");
1153 // printf(" --- Reading light tables for ZP and ZEM \n");
1154 for(k=0; k<fNalfap; k++){
1155 for(j=0; j<fNbep; j++){
1156 fscanf(fp5,"%f",&fTablep[0][k][j]);
1157 fscanf(fp6,"%f",&fTablep[1][k][j]);
1158 fscanf(fp7,"%f",&fTablep[2][k][j]);
1159 fscanf(fp8,"%f",&fTablep[3][k][j]);
1168 //_____________________________________________________________________________
1169 Int_t AliZDCv1::Digitize(Int_t Det, Int_t Quad, Int_t Light)
1171 // Evaluation of the ADC channel corresponding to the light yield Light
1174 printf("\n Digitize -> Det = %d, Quad = %d, Light = %d\n", Det, Quad, Light);
1177 // Parameters for conversion of light yield in ADC channels
1178 Float_t fPMGain[3][5]; // PM gain
1179 Float_t fADCRes; // ADC conversion factor
1184 fPMGain[i][j] = 100000.;
1187 fADCRes = 0.00000064; // ADC Resolution: 250 fC/ADCch
1189 Int_t ADCch = Int_t(Light*fPMGain[Det-1][Quad]*fADCRes);
1195 //_____________________________________________________________________________
1196 void AliZDCv1::SDigits2Digits()
1198 Hits2Digits(gAlice->GetNtrack());
1201 //_____________________________________________________________________________
1202 void AliZDCv1::Hits2Digits(Int_t ntracks)
1204 AliZDCDigit *newdigit;
1207 Int_t PMCZN = 0, PMCZP = 0, PMQZN[4], PMQZP[4], PMZEM = 0;
1216 for(itrack=0; itrack<ntracks; itrack++){
1217 gAlice->ResetHits();
1218 gAlice->TreeH()->GetEvent(itrack);
1219 for(i=0; i<fHits->GetEntries(); i++){
1220 hit = (AliZDCHit*)fHits->At(i);
1221 Int_t det = hit->GetVolume(0);
1222 Int_t quad = hit->GetVolume(1);
1223 Int_t lightQ = Int_t(hit->GetLightPMQ());
1224 Int_t lightC = Int_t(hit->GetLightPMC());
1226 printf(" \n itrack = %d, fNhits = %d, det = %d, quad = %d,"
1227 "lightC = %d lightQ = %d\n", itrack, fNhits, det, quad, lightC, lightQ);
1230 PMCZN = PMCZN + lightC;
1231 PMQZN[quad-1] = PMQZN[quad-1] + lightQ;
1235 PMCZP = PMCZP + lightC;
1236 PMQZP[quad-1] = PMQZP[quad-1] + lightQ;
1240 PMZEM = PMZEM + lightC;
1247 printf("\n PMCZN = %d, PMQZN[0] = %d, PMQZN[1] = %d, PMQZN[2] = %d, PMQZN[3] = %d\n"
1248 , PMCZN, PMQZN[0], PMQZN[1], PMQZN[2], PMQZN[3]);
1249 printf("\n PMCZP = %d, PMQZP[0] = %d, PMQZP[1] = %d, PMQZP[2] = %d, PMQZP[3] = %d\n"
1250 , PMCZP, PMQZP[0], PMQZP[1], PMQZP[2], PMQZP[3]);
1251 printf("\n PMZEM = %d\n", PMZEM);
1254 // ------------------------------------ Hits2Digits
1256 newdigit = new AliZDCDigit(1, 0, Digitize(1, 0, PMCZN));
1257 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1263 newdigit = new AliZDCDigit(1, j+1, Digitize(1, j+1, PMQZN[j]));
1264 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1270 newdigit = new AliZDCDigit(2, 0, Digitize(2, 0, PMCZP));
1271 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1277 newdigit = new AliZDCDigit(2, k+1, Digitize(2, k+1, PMQZP[k]));
1278 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1284 newdigit = new AliZDCDigit(3, 0, Digitize(3, 0, PMZEM));
1285 new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit);
1290 gAlice->TreeD()->Fill();
1291 gAlice->TreeD()->Write(0,TObject::kOverwrite);
1294 printf("\n Event Digits -----------------------------------------------------\n");
1299 //_____________________________________________________________________________
1300 void AliZDCv1::MakeBranch(Option_t *opt, char *file)
1303 // Create a new branch in the current Root Tree
1306 AliDetector::MakeBranch(opt);
1308 Char_t branchname[10];
1309 sprintf(branchname,"%s",GetName());
1310 const char *cD = strstr(opt,"D");
1312 if (gAlice->TreeD() && cD) {
1314 // Creation of the digits from hits
1316 if(fDigits!=0) fDigits->Clear();
1317 else fDigits = new TClonesArray ("AliZDCDigit",1000);
1318 char branchname[10];
1319 sprintf(branchname,"%s",GetName());
1320 gAlice->MakeBranchInTree(gAlice->TreeD(),
1321 branchname, &fDigits, fBufferSize, file) ;
1322 printf("* AliZDCv1::MakeBranch * Making Branch %s for digits\n\n",branchname);
1325 //_____________________________________________________________________________
1326 void AliZDCv1::StepManager()
1329 // Routine called at every step in the Zero Degree Calorimeters
1333 Int_t vol[2], ibeta=0, ialfa, ibe, nphe;
1334 Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, radius, out;
1335 TLorentzVector s, p;
1338 for (j=0;j<10;j++) hits[j]=0;
1340 if((gMC->GetMedium() == fMedSensZN) || (gMC->GetMedium() == fMedSensZP) ||
1341 (gMC->GetMedium() == fMedSensGR) || (gMC->GetMedium() == fMedSensF1) ||
1342 (gMC->GetMedium() == fMedSensF2) || (gMC->GetMedium() == fMedSensZEM) ||
1343 (gMC->GetMedium() == fMedSensPI)){
1345 // If particle interacts with beam pipe -> return
1346 if(gMC->GetMedium() == fMedSensPI){
1348 // If option NoShower is set -> StopTrack
1349 if(fNoShower==1) gMC->StopTrack();
1353 //Particle coordinates
1354 gMC->TrackPosition(s);
1355 for(j=0; j<=2; j++){
1362 // Determine in which ZDC the particle is
1363 knamed = gMC->CurrentVolName();
1364 if(!strncmp(knamed,"ZN",2))vol[0]=1;
1365 if(!strncmp(knamed,"ZP",2))vol[0]=2;
1366 if(!strncmp(knamed,"ZE",2))vol[0]=3;
1368 // Determine in which quadrant the particle is
1372 xdet[0] = x[0]-fPosZN[0];
1373 xdet[1] = x[1]-fPosZN[1];
1374 if((xdet[0]<=0.) && (xdet[1]>=0.)) vol[1]=1;
1375 if((xdet[0]>0.) && (xdet[1]>0.)) vol[1]=2;
1376 if((xdet[0]<0.) && (xdet[1]<0.)) vol[1]=3;
1377 if((xdet[0]>0.) && (xdet[1]<0.)) vol[1]=4;
1382 xdet[0] = x[0]-fPosZP[0];
1383 xdet[1] = x[1]-fPosZP[1];
1384 if(xdet[0]>fDimZP[0])xdet[0]=fDimZP[0]-0.01;
1385 if(xdet[0]<-fDimZP[0])xdet[0]=-fDimZP[0]+0.01;
1386 Float_t xqZP = xdet[0]/(fDimZP[0]/2);
1387 for(int i=1; i<=4; i++){
1388 if(xqZP>=(i-3) && xqZP<(i-2)){
1395 //ZEM has only 1 quadrant
1398 xdet[0] = x[0]-fPosZEM[0];
1399 xdet[1] = x[1]-fPosZEM[1];
1403 // Store impact point and kinetic energy of the ENTERING particle
1405 // if(Curtrack==Prim){
1406 if(gMC->IsTrackEntering()){
1408 gMC->TrackMomentum(p);
1411 // Impact point on ZDC
1419 // Int_t PcID = gMC->TrackPid();
1420 // printf("Pc ID -> %d\n",PcID);
1421 AddHit(gAlice->CurrentTrack(), vol, hits);
1430 // Charged particles -> Energy loss
1431 if((destep=gMC->Edep())){
1432 if(gMC->IsTrackStop()){
1433 gMC->TrackMomentum(p);
1434 m = gMC->TrackMass();
1436 if(ekin<0.) printf("ATTENTION!!!!!!!!!!!!!!! -> ekin = %f <0 (?)",ekin);
1440 AddHit(gAlice->CurrentTrack(), vol, hits);
1446 AddHit(gAlice->CurrentTrack(), vol, hits);
1448 // printf(" -> Charged particle -> Dep. E = %f eV \n",hits[8]);
1454 // *** Light production in fibres
1455 if((gMC->GetMedium() == fMedSensF1) || (gMC->GetMedium() == fMedSensF2)){
1457 //Select charged particles
1458 if((destep=gMC->Edep())){
1459 // printf(" -> CHARGED particle!!! \n");
1461 // Particle velocity
1462 gMC->TrackMomentum(p);
1463 Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
1464 Float_t beta = ptot/p[3];
1465 if(beta<0.67) return;
1466 if((beta>=0.67) && (beta<=0.75)) ibeta = 0;
1467 if((beta>0.75) && (beta<=0.85)) ibeta = 1;
1468 if((beta>0.85) && (beta<=0.95)) ibeta = 2;
1469 // if((beta>0.95) && (beta<=1.00)) ibeta = 3;
1470 if(beta>0.95) ibeta = 3;
1472 // Angle between particle trajectory and fibre axis
1473 // 1 -> Momentum directions
1477 gMC->Gmtod(um,ud,2);
1478 // 2 -> Angle < limit angle
1479 Double_t alfar = TMath::ACos(ud[2]);
1480 Double_t alfa = alfar*kRaddeg;
1481 if(alfa>=110.) return;
1482 ialfa = Int_t(1.+alfa/2.);
1484 // Distance between particle trajectory and fibre axis
1485 gMC->TrackPosition(s);
1486 for(j=0; j<=2; j++){
1489 gMC->Gmtod(x,xdet,1);
1490 if(TMath::Abs(ud[0])>0.00001){
1491 Float_t dcoeff = ud[1]/ud[0];
1492 be = TMath::Abs((xdet[1]-dcoeff*xdet[0])/TMath::Sqrt(dcoeff*dcoeff+1.));
1495 be = TMath::Abs(ud[0]);
1498 if((vol[0]==1)) radius = fFibZN[1];
1499 if((vol[0]==2)) radius = fFibZP[1];
1500 ibe = Int_t(be*1000.+1);
1502 //Looking into the light tables
1503 Float_t charge = gMC->TrackCharge();
1507 if(ibe>fNben) ibe=fNben;
1508 out = charge*charge*fTablen[ibeta][ialfa][ibe];
1509 nphe = gRandom->Poisson(out);
1510 if(gMC->GetMedium() == fMedSensF1){
1511 hits[7] = nphe; //fLightPMQ
1514 AddHit(gAlice->CurrentTrack(), vol, hits);
1518 hits[8] = nphe; //fLightPMC
1520 AddHit(gAlice->CurrentTrack(), vol, hits);
1526 if(ibe>fNbep) ibe=fNbep;
1527 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1528 nphe = gRandom->Poisson(out);
1529 if(gMC->GetMedium() == fMedSensF1){
1530 hits[7] = nphe; //fLightPMQ
1533 AddHit(gAlice->CurrentTrack(), vol, hits);
1537 hits[8] = nphe; //fLightPMC
1539 AddHit(gAlice->CurrentTrack(), vol, hits);
1544 if(ibe>fNbep) ibe=fNbep;
1545 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1546 nphe = gRandom->Poisson(out);
1548 hits[8] = nphe; //fLightPMC
1550 AddHit(gAlice->CurrentTrack(), vol, hits);