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.6 2001/09/26 16:07:40 coppedis
19 Changes in StepManager suggested by J.Chudoba
21 Revision 1.5 2001/06/15 14:51:39 coppedis
22 Geometry bug corrected
24 Revision 1.4 2001/06/13 11:17:49 coppedis
27 Revision 1.3 2001/06/13 11:11:02 coppedis
30 Revision 1.2 2001/06/12 13:45:11 coppedis
31 TDI in correct position and minor correction
33 Revision 1.1 2001/05/14 09:57:39 coppedis
34 A different geometry for the ZDCs
39 ///////////////////////////////////////////////////////////////////////
41 // AliZDCv2 --- new ZDC geometry, //
42 // with the EM ZDC at about 10 m from IP //
43 // Just one set of ZDC is inserted //
44 // (on the same side of the dimuon arm realtive to IP) //
46 ///////////////////////////////////////////////////////////////////////
48 // --- Standard libraries
60 // --- AliRoot classes
62 #include "AliZDCHit.h"
64 #include "AliDetector.h"
67 #include "AliCallf77.h"
70 #include "TLorentzVector.h"
75 //_____________________________________________________________________________
76 AliZDCv2::AliZDCv2() : AliZDC()
79 // Default constructor for Zero Degree Calorimeter
92 //_____________________________________________________________________________
93 AliZDCv2::AliZDCv2(const char *name, const char *title)
97 // Standard constructor for Zero Degree Calorimeter
100 // Check that DIPO, ABSO, DIPO and SHIL is there (otherwise tracking is wrong!!!)
102 AliModule* PIPE=gAlice->GetModule("PIPE");
103 AliModule* ABSO=gAlice->GetModule("ABSO");
104 AliModule* DIPO=gAlice->GetModule("DIPO");
105 AliModule* SHIL=gAlice->GetModule("SHIL");
106 if((!PIPE) || (!ABSO) || (!DIPO) || (!SHIL)) {
107 Error("Constructor","ZDC needs PIPE, ABSO, DIPO and SHIL!!!\n");
121 // Parameters for light tables
122 fNalfan = 90; // Number of Alfa (neutrons)
123 fNalfap = 90; // Number of Alfa (protons)
124 fNben = 18; // Number of beta (neutrons)
125 fNbep = 28; // Number of beta (protons)
127 for(ip=0; ip<4; ip++){
128 for(kp=0; kp<fNalfap; kp++){
129 for(jp=0; jp<fNbep; jp++){
130 fTablep[ip][kp][jp] = 0;
135 for(in=0; in<4; in++){
136 for(kn=0; kn<fNalfan; kn++){
137 for(jn=0; jn<fNben; jn++){
138 fTablen[in][kn][jn] = 0;
143 // Parameters for hadronic calorimeters geometry
163 // Parameters for EM calorimeter geometry
166 // fPosZEM[2] = -830.;
172 //_____________________________________________________________________________
173 void AliZDCv2::CreateGeometry()
176 // Create the geometry for the Zero Degree Calorimeter version 1
177 //* Initialize COMMON block ZDC_CGEOM
184 //_____________________________________________________________________________
185 void AliZDCv2::CreateBeamLine()
188 Float_t zq, zd1, zd2;
189 Float_t conpar[9], tubpar[3], tubspar[5], boxpar[3];
192 Int_t *idtmed = fIdtmed->GetArray();
194 // -- Mother of the ZDCs (Vacuum PCON)
205 gMC->Gsvolu("ZDC ", "PCON", idtmed[11], conpar, 9);
206 gMC->Gspos("ZDC ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
208 // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to
209 // the beginning of D1)
215 tubpar[2] = 3838.3/2.;
216 gMC->Gsvolu("QT01", "TUBE", idtmed[7], tubpar, 3);
217 gMC->Gspos("QT01", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
219 //-- SECOND SECTION OF THE BEAM PIPE (from the end of D1 to the
222 //-- FROM MAGNETIC BEGINNING OF D1 TO MAGNETIC END OF D1 + 13.5 cm
223 //-- Cylindrical pipe (r = 3.47) + conical flare
225 // -> Beginning of D1
229 tubpar[1] = 3.47+0.2;
230 tubpar[2] = 958.5/2.;
231 gMC->Gsvolu("QT02", "TUBE", idtmed[7], tubpar, 3);
232 gMC->Gspos("QT02", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
241 gMC->Gsvolu("QC01", "CONE", idtmed[7], conpar, 5);
242 gMC->Gspos("QC01", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
249 gMC->Gsvolu("QT03", "TUBE", idtmed[7], tubpar, 3);
250 gMC->Gspos("QT03", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
257 gMC->Gsvolu("QT04", "TUBE", idtmed[7], tubpar, 3);
258 gMC->Gspos("QT04", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
260 zd1 += tubpar[2] * 2.;
265 gMC->Gsvolu("QT05", "TUBE", idtmed[7], tubpar, 3);
266 gMC->Gspos("QT05", 1, "ZDC ", 0., 0., tubpar[0] + zd1, 0, "ONLY");
268 zd1 += tubpar[2] * 2.;
273 gMC->Gsvolu("QT06", "TUBE", idtmed[7], tubpar, 3);
274 gMC->Gspos("QT06", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
276 zd1 += tubpar[2] * 2.;
283 gMC->Gsvolu("QC02", "CONE", idtmed[7], conpar, 5);
284 gMC->Gspos("QC02", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
286 zd1 += conpar[0] * 2.;
291 gMC->Gsvolu("QT07", "TUBE", idtmed[7], tubpar, 3);
292 gMC->Gspos("QT07", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
294 zd1 += tubpar[2] * 2.;
301 gMC->Gsvolu("QC03", "CONE", idtmed[7], conpar, 5);
302 gMC->Gspos("QC03", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
304 zd1 += conpar[0] * 2.;
308 tubpar[2] = 205.8/2.;
309 gMC->Gsvolu("QT08", "TUBE", idtmed[7], tubpar, 3);
310 gMC->Gspos("QT08", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
312 zd1 += tubpar[2] * 2.;
316 // QT09 is 10 cm longer to accomodate TDI
317 tubpar[2] = 515.4/2.;
318 gMC->Gsvolu("QT09", "TUBE", idtmed[7], tubpar, 3);
319 gMC->Gspos("QT09", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
321 // --- Insert TDI (inside ZDC volume)
326 gMC->Gsvolu("QTD1", "BOX ", idtmed[7], boxpar, 3);
327 gMC->Gspos("QTD1", 1, "ZDC ", 3., 10.6, tubpar[2] + zd1 + 56.3, 0, "ONLY");
328 gMC->Gspos("QTD1", 2, "ZDC ", 3., -10.6, tubpar[2] + zd1 + 56.3, 0, "ONLY");
333 gMC->Gsvolu("QTD2", "BOX ", idtmed[6], boxpar, 3);
334 gMC->Gspos("QTD2", 1, "ZDC ", 8.6+boxpar[0], 0., tubpar[2] + zd1 + 56.3, 0, "ONLY");
336 // tubspar[0] = 6.2; // R = 6.2 cm----------------------------------------
338 // tubspar[2] = 400./2.;
339 // tubspar[3] = 180.-62.5;
340 // tubspar[4] = 180.+62.5;
341 tubspar[0] = 10.5; // R = 10.5 cm------------------------------------------
343 tubspar[2] = 400./2.;
344 tubspar[3] = 180.-75.5;
345 tubspar[4] = 180.+75.5;
346 gMC->Gsvolu("QTD3", "TUBS", idtmed[6], tubspar, 5);
347 gMC->Gspos("QTD3", 1, "ZDC ", 0., 0., tubpar[2] + zd1 + 56.3, 0, "ONLY");
349 zd1 += tubpar[2] * 2.;
353 // QT10 is 10 cm shorter
355 gMC->Gsvolu("QT10", "TUBE", idtmed[7], tubpar, 3);
356 gMC->Gspos("QT10", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
358 zd1 += tubpar[2] * 2.;
362 tubpar[2] = 778.5/2.;
363 gMC->Gsvolu("QT11", "TUBE", idtmed[7], tubpar, 3);
364 gMC->Gspos("QT11", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
366 zd1 += tubpar[2] * 2.;
368 conpar[0] = 14.18/2.;
373 gMC->Gsvolu("QC04", "CONE", idtmed[7], conpar, 5);
374 gMC->Gspos("QC04", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
376 zd1 += conpar[0] * 2.;
381 gMC->Gsvolu("QT12", "TUBE", idtmed[7], tubpar, 3);
382 gMC->Gspos("QT12", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
384 zd1 += tubpar[2] * 2.;
386 conpar[0] = 36.86/2.;
391 gMC->Gsvolu("QC05", "CONE", idtmed[7], conpar, 5);
392 gMC->Gspos("QC05", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
394 zd1 += conpar[0] * 2.;
398 tubpar[2] = 927.3/2.;
399 gMC->Gsvolu("QT13", "TUBE", idtmed[7], tubpar, 3);
400 gMC->Gspos("QT13", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
402 zd1 += tubpar[2] * 2.;
407 gMC->Gsvolu("QT14", "TUBE", idtmed[8], tubpar, 3);
408 gMC->Gspos("QT14", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
410 zd1 += tubpar[2] * 2.;
415 gMC->Gsvolu("QT15", "TUBE", idtmed[11], tubpar, 3);
417 //-- Position QT15 inside QT14
418 gMC->Gspos("QT15", 1, "QT14", -7.7, 0., 0., 0, "ONLY");
423 gMC->Gsvolu("QT16", "TUBE", idtmed[11], tubpar, 3);
425 //-- Position QT16 inside QT14
426 gMC->Gspos("QT16", 1, "QT14", 7.7, 0., 0., 0, "ONLY");
429 //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2
433 tubpar[2] = 680.8/2.;
434 gMC->Gsvolu("QT17", "TUBE", idtmed[7], tubpar, 3);
438 tubpar[2] = 680.8/2.;
439 gMC->Gsvolu("QT18", "TUBE", idtmed[7], tubpar, 3);
443 Float_t angle = 0.143*kDegrad;
445 AliMatrix(im1, 90.-0.143, 0., 90., 90., 0.143, 180.);
446 gMC->Gspos("QT17", 1, "ZDC ", TMath::Sin(angle) * 680.8/ 2. - 9.4,
447 0., tubpar[2] + zd1, im1, "ONLY");
449 AliMatrix(im2, 90.+0.143, 0., 90., 90., 0.143, 0.);
450 gMC->Gspos("QT18", 1, "ZDC ", 9.7 - TMath::Sin(angle) * 680.8 / 2.,
451 0., tubpar[2] + zd1, im2, "ONLY");
453 // -- BEAM PIPE ON THE OTHER SIDE OF I.P. TILL THE EM ZDC
455 Float_t zb = -800.; // End of QBPM (from AliPIPEv0.cxx)
458 tubpar[2] = (1050+zb)/2.; // From the end of QBPM to z=1050.
459 gMC->Gsvolu("QT19", "TUBE", idtmed[7], tubpar, 3);
460 gMC->Gspos("QT19", 1, "ALIC", 0., 0., zb - tubpar[2], 0, "ONLY");
463 // -- END OF BEAM PIPE VOLUME DEFINITION.
464 // ----------------------------------------------------------------
466 // -- MAGNET DEFINITION -> LHC OPTICS 6.2 (preliminary version)
468 // ----------------------------------------------------------------
469 // Replaced by the muon dipole
470 // ----------------------------------------------------------------
471 // -- COMPENSATOR DIPOLE (MBXW)
472 // GAP (VACUUM WITH MAGNETIC FIELD)
476 // tubpar[2] = 340./2.;
477 // gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3);
478 // gMC->Gspos("MBXW", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
480 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
484 // tubpar[2] = 340./2.;
485 // gMC->Gsvolu("YMBX", "TUBE", idtmed[7], tubpar, 3);
486 // gMC->Gspos("YMBX", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
488 // ----------------------------------------------------------------
489 // Replaced by the second dipole
490 // ----------------------------------------------------------------
491 // -- COMPENSATOR DIPOLE (MCBWA)
492 // GAP (VACUUM WITH MAGNETIC FIELD)
496 // tubpar[2] = 170./2.;
497 // gMC->Gsvolu("MCBW", "TUBE", idtmed[11], tubpar, 3);
498 // gMC->Gspos("MCBW", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
500 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
504 // tubpar[2] = 170./2.;
505 // gMC->Gsvolu("YMCB", "TUBE", idtmed[7], tubpar, 3);
506 // gMC->Gspos("YMCB", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY");
512 // -- DEFINE MQXL AND MQX QUADRUPOLE ELEMENT
515 // -- GAP (VACUUM WITH MAGNETIC FIELD)
520 gMC->Gsvolu("MQXL", "TUBE", idtmed[11], tubpar, 3);
527 gMC->Gsvolu("YMQL", "TUBE", idtmed[7], tubpar, 3);
529 gMC->Gspos("MQXL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
530 gMC->Gspos("YMQL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
532 gMC->Gspos("MQXL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
533 gMC->Gspos("YMQL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
536 // -- GAP (VACUUM WITH MAGNETIC FIELD)
541 gMC->Gsvolu("MQX ", "TUBE", idtmed[11], tubpar, 3);
548 gMC->Gsvolu("YMQ ", "TUBE", idtmed[7], tubpar, 3);
550 gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 883.5, 0, "ONLY");
551 gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 883.5, 0, "ONLY");
553 gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1533.5, 0, "ONLY");
554 gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1533.5, 0, "ONLY");
556 // -- SEPARATOR DIPOLE D1
560 // -- GAP (VACUUM WITH MAGNETIC FIELD)
565 gMC->Gsvolu("MD1 ", "TUBE", idtmed[11], tubpar, 3);
567 // -- Insert horizontal Cu plates inside D1
568 // -- (to simulate the vacuum chamber)
570 boxpar[0] = TMath::Sqrt(tubpar[1]*tubpar[1]-(2.98+0.2)*(2.98+0.2));
573 gMC->Gsvolu("MD1V", "BOX ", idtmed[6], boxpar, 3);
574 gMC->Gspos("MD1V", 1, "MD1 ", 0., 2.98+boxpar[1], 0., 0, "ONLY");
575 gMC->Gspos("MD1V", 2, "MD1 ", 0., -2.98-boxpar[1], 0., 0, "ONLY");
582 gMC->Gsvolu("YD1 ", "TUBE", idtmed[7], tubpar, 3);
584 gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
585 gMC->Gspos("MD1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
591 // -- GAP (VACUUM WITH MAGNETIC FIELD)
596 gMC->Gsvolu("MD2 ", "TUBE", idtmed[11], tubpar, 3);
603 gMC->Gsvolu("YD2 ", "TUBE", idtmed[7], tubpar, 3);
605 gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., tubpar[2] + zd2, 0, "ONLY");
607 gMC->Gspos("MD2 ", 1, "YD2 ", -9.4, 0., 0., 0, "ONLY");
608 gMC->Gspos("MD2 ", 2, "YD2 ", 9.4, 0., 0., 0, "ONLY");
610 // -- END OF MAGNET DEFINITION
613 //_____________________________________________________________________________
614 void AliZDCv2::CreateZDC()
617 Float_t DimPb[6], DimVoid[6];
619 Int_t *idtmed = fIdtmed->GetArray();
621 // Parameters for hadronic calorimeters geometry
622 // NB -> parameters used ONLY in CreateZDC()
623 Float_t fGrvZN[3] = {0.03, 0.03, 50.}; // Grooves for neutron detector
624 Float_t fGrvZP[3] = {0.04, 0.04, 75.}; // Grooves for proton detector
625 Int_t fDivZN[3] = {11, 11, 0}; // Division for neutron detector
626 Int_t fDivZP[3] = {7, 15, 0}; // Division for proton detector
627 Int_t fTowZN[2] = {2, 2}; // Tower for neutron detector
628 Int_t fTowZP[2] = {4, 1}; // Tower for proton detector
630 // Parameters for EM calorimeter geometry
631 // NB -> parameters used ONLY in CreateZDC()
632 Float_t fDimZEMPb = 0.15*(TMath::Sqrt(2.)); // z-dimension of the Pb slice
633 Float_t fDimZEMAir = 0.001; // scotch
634 Float_t fFibRadZEM = 0.0315; // External fiber radius (including cladding)
635 Int_t fDivZEM[3] = {92, 0, 20}; // Divisions for EM detector
636 Float_t fDimZEM0 = 2*fDivZEM[2]*(fDimZEMPb+fDimZEMAir+fFibRadZEM*(TMath::Sqrt(2.)));
637 fZEMLength = fDimZEM0;
638 Float_t fDimZEM[6] = {fDimZEM0, 3.5, 3.5, 45., 0., 0.}; // Dimensions of EM detector
639 Float_t fFibZEM2 = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-fFibRadZEM;
640 Float_t fFibZEM[3] = {0., 0.0275, fFibZEM2}; // Fibers for EM calorimeter
643 //-- Create calorimeters geometry
645 // -------------------------------------------------------------------------------
646 //--> Neutron calorimeter (ZN)
648 gMC->Gsvolu("ZNEU", "BOX ", idtmed[1], fDimZN, 3); // Passive material
649 gMC->Gsvolu("ZNF1", "TUBE", idtmed[3], fFibZN, 3); // Active material
650 gMC->Gsvolu("ZNF2", "TUBE", idtmed[4], fFibZN, 3);
651 gMC->Gsvolu("ZNF3", "TUBE", idtmed[4], fFibZN, 3);
652 gMC->Gsvolu("ZNF4", "TUBE", idtmed[3], fFibZN, 3);
653 gMC->Gsvolu("ZNG1", "BOX ", idtmed[12], fGrvZN, 3); // Empty grooves
654 gMC->Gsvolu("ZNG2", "BOX ", idtmed[12], fGrvZN, 3);
655 gMC->Gsvolu("ZNG3", "BOX ", idtmed[12], fGrvZN, 3);
656 gMC->Gsvolu("ZNG4", "BOX ", idtmed[12], fGrvZN, 3);
658 // Divide ZNEU in towers (for hits purposes)
660 gMC->Gsdvn("ZNTX", "ZNEU", fTowZN[0], 1); // x-tower
661 gMC->Gsdvn("ZN1 ", "ZNTX", fTowZN[1], 2); // y-tower
663 //-- Divide ZN1 in minitowers
664 // fDivZN[0]= NUMBER OF FIBERS PER TOWER ALONG X-AXIS,
665 // fDivZN[1]= NUMBER OF FIBERS PER TOWER ALONG Y-AXIS
666 // (4 fibres per minitower)
668 gMC->Gsdvn("ZNSL", "ZN1 ", fDivZN[1], 2); // Slices
669 gMC->Gsdvn("ZNST", "ZNSL", fDivZN[0], 1); // Sticks
671 // --- Position the empty grooves in the sticks (4 grooves per stick)
672 Float_t dx = fDimZN[0] / fDivZN[0] / 4.;
673 Float_t dy = fDimZN[1] / fDivZN[1] / 4.;
675 gMC->Gspos("ZNG1", 1, "ZNST", 0.-dx, 0.+dy, 0., 0, "ONLY");
676 gMC->Gspos("ZNG2", 1, "ZNST", 0.+dx, 0.+dy, 0., 0, "ONLY");
677 gMC->Gspos("ZNG3", 1, "ZNST", 0.-dx, 0.-dy, 0., 0, "ONLY");
678 gMC->Gspos("ZNG4", 1, "ZNST", 0.+dx, 0.-dy, 0., 0, "ONLY");
680 // --- Position the fibers in the grooves
681 gMC->Gspos("ZNF1", 1, "ZNG1", 0., 0., 0., 0, "ONLY");
682 gMC->Gspos("ZNF2", 1, "ZNG2", 0., 0., 0., 0, "ONLY");
683 gMC->Gspos("ZNF3", 1, "ZNG3", 0., 0., 0., 0, "ONLY");
684 gMC->Gspos("ZNF4", 1, "ZNG4", 0., 0., 0., 0, "ONLY");
686 // --- Position the neutron calorimeter in ZDC
687 gMC->Gspos("ZNEU", 1, "ZDC ", fPosZN[0], fPosZN[1], fPosZN[2] + fDimZN[2], 0, "ONLY");
690 // -------------------------------------------------------------------------------
691 //--> Proton calorimeter (ZP)
693 gMC->Gsvolu("ZPRO", "BOX ", idtmed[2], fDimZP, 3); // Passive material
694 gMC->Gsvolu("ZPF1", "TUBE", idtmed[3], fFibZP, 3); // Active material
695 gMC->Gsvolu("ZPF2", "TUBE", idtmed[4], fFibZP, 3);
696 gMC->Gsvolu("ZPF3", "TUBE", idtmed[4], fFibZP, 3);
697 gMC->Gsvolu("ZPF4", "TUBE", idtmed[3], fFibZP, 3);
698 gMC->Gsvolu("ZPG1", "BOX ", idtmed[12], fGrvZP, 3); // Empty grooves
699 gMC->Gsvolu("ZPG2", "BOX ", idtmed[12], fGrvZP, 3);
700 gMC->Gsvolu("ZPG3", "BOX ", idtmed[12], fGrvZP, 3);
701 gMC->Gsvolu("ZPG4", "BOX ", idtmed[12], fGrvZP, 3);
703 //-- Divide ZPRO in towers(for hits purposes)
705 gMC->Gsdvn("ZPTX", "ZPRO", fTowZP[0], 1); // x-tower
706 gMC->Gsdvn("ZP1 ", "ZPTX", fTowZP[1], 2); // y-tower
709 //-- Divide ZP1 in minitowers
710 // fDivZP[0]= NUMBER OF FIBERS ALONG X-AXIS PER MINITOWER,
711 // fDivZP[1]= NUMBER OF FIBERS ALONG Y-AXIS PER MINITOWER
712 // (4 fiber per minitower)
714 gMC->Gsdvn("ZPSL", "ZP1 ", fDivZP[1], 2); // Slices
715 gMC->Gsdvn("ZPST", "ZPSL", fDivZP[0], 1); // Sticks
717 // --- Position the empty grooves in the sticks (4 grooves per stick)
718 dx = fDimZP[0] / fTowZP[0] / fDivZP[0] / 2.;
719 dy = fDimZP[1] / fTowZP[1] / fDivZP[1] / 2.;
721 gMC->Gspos("ZPG1", 1, "ZPST", 0.-dx, 0.+dy, 0., 0, "ONLY");
722 gMC->Gspos("ZPG2", 1, "ZPST", 0.+dx, 0.+dy, 0., 0, "ONLY");
723 gMC->Gspos("ZPG3", 1, "ZPST", 0.-dx, 0.-dy, 0., 0, "ONLY");
724 gMC->Gspos("ZPG4", 1, "ZPST", 0.+dx, 0.-dy, 0., 0, "ONLY");
726 // --- Position the fibers in the grooves
727 gMC->Gspos("ZPF1", 1, "ZPG1", 0., 0., 0., 0, "ONLY");
728 gMC->Gspos("ZPF2", 1, "ZPG2", 0., 0., 0., 0, "ONLY");
729 gMC->Gspos("ZPF3", 1, "ZPG3", 0., 0., 0., 0, "ONLY");
730 gMC->Gspos("ZPF4", 1, "ZPG4", 0., 0., 0., 0, "ONLY");
733 // --- Position the proton calorimeter in ZDC
734 gMC->Gspos("ZPRO", 1, "ZDC ", fPosZP[0], fPosZP[1], fPosZP[2] + fDimZP[2], 0, "ONLY");
737 // -------------------------------------------------------------------------------
738 // -> EM calorimeter (ZEM)
740 gMC->Gsvolu("ZEM ", "PARA", idtmed[10], fDimZEM, 6);
744 gMC->Matrix(irot1,180.,0.,90.,90.,90.,0.); // Rotation matrix 1
745 gMC->Matrix(irot2,180.,0.,90.,fDimZEM[3]+90.,90.,fDimZEM[3]);// Rotation matrix 2
746 // printf("irot1 = %d, irot2 = %d \n", irot1, irot2);
748 gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material
750 gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches
752 DimPb[0] = fDimZEMPb; // Lead slices
753 DimPb[1] = fDimZEM[2];
754 DimPb[2] = fDimZEM[1];
755 DimPb[3] = 90.-fDimZEM[3];
758 gMC->Gsvolu("ZEL0", "PARA", idtmed[5], DimPb, 6);
759 gMC->Gsvolu("ZEL1", "PARA", idtmed[5], DimPb, 6);
760 // gMC->Gsvolu("ZEL2", "PARA", idtmed[5], DimPb, 6);
762 // --- Position the lead slices in the tranche
763 Float_t zTran = fDimZEM[0]/fDivZEM[2];
764 Float_t zTrPb = -zTran+fDimZEMPb;
765 gMC->Gspos("ZEL0", 1, "ZETR", zTrPb, 0., 0., 0, "ONLY");
766 gMC->Gspos("ZEL1", 1, "ZETR", fDimZEMPb, 0., 0., 0, "ONLY");
768 // --- Vacuum zone (to be filled with fibres)
769 DimVoid[0] = (zTran-2*fDimZEMPb)/2.;
770 DimVoid[1] = fDimZEM[2];
771 DimVoid[2] = fDimZEM[1];
772 DimVoid[3] = 90.-fDimZEM[3];
775 gMC->Gsvolu("ZEV0", "PARA", idtmed[10], DimVoid,6);
776 gMC->Gsvolu("ZEV1", "PARA", idtmed[10], DimVoid,6);
778 // --- Divide the vacuum slice into sticks along x axis
779 gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3);
780 gMC->Gsdvn("ZES1", "ZEV1", fDivZEM[0], 3);
782 // --- Positioning the fibers into the sticks
783 gMC->Gspos("ZEMF", 1,"ZES0", 0., 0., 0., irot2, "ONLY");
784 gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY");
786 // --- Positioning the vacuum slice into the tranche
787 Float_t DisplFib = fDimZEM[1]/fDivZEM[0];
788 gMC->Gspos("ZEV0", 1,"ZETR", -DimVoid[0], 0., 0., 0, "ONLY");
789 gMC->Gspos("ZEV1", 1,"ZETR", -DimVoid[0]+zTran, 0., DisplFib, 0, "ONLY");
791 // --- Positioning the ZEM into the ZDC - rotation for 90 degrees
792 // NB -> In AliZDCv2 ZEM is positioned in ALIC (instead of in ZDC) volume
793 // beacause it's impossible to make a ZDC pcon volume to contain
794 // both hadronics and EM calorimeters. (It causes many tracks abandoning).
795 gMC->Gspos("ZEM ", 1,"ALIC", fPosZEM[0], fPosZEM[1], fPosZEM[2]+fDimZEM[0], irot1, "ONLY");
797 // Second EM ZDC (same side w.r.t. IP, just on the other side w.r.t. beam pipe)
798 gMC->Gspos("ZEM ", 2,"ALIC", -fPosZEM[0], fPosZEM[1], fPosZEM[2]+fDimZEM[0], irot1, "ONLY");
800 // --- Adding last slice at the end of the EM calorimeter
801 // Float_t zLastSlice = fPosZEM[2]+fDimZEMPb+fDimZEM[0];
802 // gMC->Gspos("ZEL2", 1,"ALIC", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY");
806 //_____________________________________________________________________________
807 void AliZDCv2::DrawModule()
810 // Draw a shaded view of the Zero Degree Calorimeter version 1
813 // Set everything unseen
814 gMC->Gsatt("*", "seen", -1);
816 // Set ALIC mother transparent
817 gMC->Gsatt("ALIC","SEEN",0);
819 // Set the volumes visible
820 gMC->Gsatt("ZDC ","SEEN",0);
821 gMC->Gsatt("QT01","SEEN",1);
822 gMC->Gsatt("QT02","SEEN",1);
823 gMC->Gsatt("QT03","SEEN",1);
824 gMC->Gsatt("QT04","SEEN",1);
825 gMC->Gsatt("QT05","SEEN",1);
826 gMC->Gsatt("QT06","SEEN",1);
827 gMC->Gsatt("QT07","SEEN",1);
828 gMC->Gsatt("QT08","SEEN",1);
829 gMC->Gsatt("QT09","SEEN",1);
830 gMC->Gsatt("QT10","SEEN",1);
831 gMC->Gsatt("QT11","SEEN",1);
832 gMC->Gsatt("QT12","SEEN",1);
833 gMC->Gsatt("QT13","SEEN",1);
834 gMC->Gsatt("QT14","SEEN",1);
835 gMC->Gsatt("QT15","SEEN",1);
836 gMC->Gsatt("QT16","SEEN",1);
837 gMC->Gsatt("QT17","SEEN",1);
838 gMC->Gsatt("QT18","SEEN",1);
839 gMC->Gsatt("QC01","SEEN",1);
840 gMC->Gsatt("QC02","SEEN",1);
841 gMC->Gsatt("QC03","SEEN",1);
842 gMC->Gsatt("QC04","SEEN",1);
843 gMC->Gsatt("QC05","SEEN",1);
844 gMC->Gsatt("QTD1","SEEN",1);
845 gMC->Gsatt("QTD2","SEEN",1);
846 gMC->Gsatt("QTD3","SEEN",1);
847 gMC->Gsatt("MQXL","SEEN",1);
848 gMC->Gsatt("YMQL","SEEN",1);
849 gMC->Gsatt("MQX ","SEEN",1);
850 gMC->Gsatt("YMQ ","SEEN",1);
851 gMC->Gsatt("ZQYX","SEEN",1);
852 gMC->Gsatt("MD1 ","SEEN",1);
853 gMC->Gsatt("MD1V","SEEN",1);
854 gMC->Gsatt("YD1 ","SEEN",1);
855 gMC->Gsatt("MD2 ","SEEN",1);
856 gMC->Gsatt("YD2 ","SEEN",1);
857 gMC->Gsatt("ZNEU","SEEN",0);
858 gMC->Gsatt("ZNF1","SEEN",0);
859 gMC->Gsatt("ZNF2","SEEN",0);
860 gMC->Gsatt("ZNF3","SEEN",0);
861 gMC->Gsatt("ZNF4","SEEN",0);
862 gMC->Gsatt("ZNG1","SEEN",0);
863 gMC->Gsatt("ZNG2","SEEN",0);
864 gMC->Gsatt("ZNG3","SEEN",0);
865 gMC->Gsatt("ZNG4","SEEN",0);
866 gMC->Gsatt("ZNTX","SEEN",0);
867 gMC->Gsatt("ZN1 ","COLO",4);
868 gMC->Gsatt("ZN1 ","SEEN",1);
869 gMC->Gsatt("ZNSL","SEEN",0);
870 gMC->Gsatt("ZNST","SEEN",0);
871 gMC->Gsatt("ZPRO","SEEN",0);
872 gMC->Gsatt("ZPF1","SEEN",0);
873 gMC->Gsatt("ZPF2","SEEN",0);
874 gMC->Gsatt("ZPF3","SEEN",0);
875 gMC->Gsatt("ZPF4","SEEN",0);
876 gMC->Gsatt("ZPG1","SEEN",0);
877 gMC->Gsatt("ZPG2","SEEN",0);
878 gMC->Gsatt("ZPG3","SEEN",0);
879 gMC->Gsatt("ZPG4","SEEN",0);
880 gMC->Gsatt("ZPTX","SEEN",0);
881 gMC->Gsatt("ZP1 ","COLO",6);
882 gMC->Gsatt("ZP1 ","SEEN",1);
883 gMC->Gsatt("ZPSL","SEEN",0);
884 gMC->Gsatt("ZPST","SEEN",0);
885 gMC->Gsatt("ZEM ","COLO",7);
886 gMC->Gsatt("ZEM ","SEEN",1);
887 gMC->Gsatt("ZEMF","SEEN",0);
888 gMC->Gsatt("ZETR","SEEN",0);
889 gMC->Gsatt("ZEL0","SEEN",0);
890 gMC->Gsatt("ZEL1","SEEN",0);
891 gMC->Gsatt("ZEL2","SEEN",0);
892 gMC->Gsatt("ZEV0","SEEN",0);
893 gMC->Gsatt("ZEV1","SEEN",0);
894 gMC->Gsatt("ZES0","SEEN",0);
895 gMC->Gsatt("ZES1","SEEN",0);
898 gMC->Gdopt("hide", "on");
899 gMC->Gdopt("shad", "on");
900 gMC->Gsatt("*", "fill", 7);
901 gMC->SetClipBox(".");
902 gMC->SetClipBox("*", 0, 100, -100, 100, 12000, 16000);
904 gMC->Gdraw("alic", 40, 30, 0, 488, 220, .07, .07);
905 gMC->Gdhead(1111, "Zero Degree Calorimeter Version 1");
906 gMC->Gdman(18, 4, "MAN");
909 //_____________________________________________________________________________
910 void AliZDCv2::CreateMaterials()
913 // Create Materials for the Zero Degree Calorimeter
916 Int_t *idtmed = fIdtmed->GetArray();
918 Float_t dens, ubuf[1], wmat[2], a[2], z[2], deemax = -1;
921 // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3
923 // --- Tantalum -> ZN passive material
925 AliMaterial(1, "TANT", 180.95, 73., 16.65, .4, 11.9, ubuf, 1);
929 // AliMaterial(1, "TUNG", 183.85, 74., 19.3, .35, 10.3, ubuf, 1);
931 // --- Brass (CuZn) -> ZP passive material
939 AliMixture(2, "BRASS ", a, z, dens, 2, wmat);
949 AliMixture(3, "SIO2 ", a, z, dens, -2, wmat);
953 AliMaterial(5, "LEAD", 207.19, 82., 11.35, .56, 18.5, ubuf, 1);
957 AliMaterial(6, "COPP", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
959 // --- Iron (energy loss taken into account)
961 AliMaterial(7, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
963 // --- Iron (no energy loss)
965 AliMaterial(8, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
967 // --- Vacuum (no magnetic field)
968 AliMaterial(10, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
970 // --- Vacuum (with magnetic field)
971 AliMaterial(11, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
973 // --- Air (no magnetic field)
974 AliMaterial(12, "Air $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0);
976 // --- Definition of tracking media:
978 // --- Tantalum = 1 ;
980 // --- Fibers (SiO2) = 3 ;
981 // --- Fibers (SiO2) = 4 ;
984 // --- Iron (with energy loss) = 7 ;
985 // --- Iron (without energy loss) = 8 ;
986 // --- Vacuum (no field) = 10
987 // --- Vacuum (with field) = 11
988 // --- Air (no field) = 12
991 // --- Tracking media parameters
992 Float_t epsil = .01, stmin=0.01, stemax = 1.;
993 // Int_t isxfld = gAlice->Field()->Integ();
994 Float_t fieldm = 0., tmaxfd = 0.;
995 Int_t ifield = 0, isvolActive = 1, isvol = 0, inofld = 0;
997 AliMedium(1, "ZTANT", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
998 // AliMedium(1, "ZW", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
999 AliMedium(2, "ZBRASS",2, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1000 AliMedium(3, "ZSIO2", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1001 AliMedium(4, "ZQUAR", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1002 AliMedium(5, "ZLEAD", 5, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1003 // AliMedium(6, "ZCOPP", 6, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1004 // AliMedium(7, "ZIRON", 7, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1005 AliMedium(6, "ZCOPP", 6, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1006 AliMedium(7, "ZIRON", 7, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1007 AliMedium(8, "ZIRONN",8, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1008 AliMedium(10,"ZVOID",10, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1009 AliMedium(12,"ZAIR", 12, 0, inofld, fieldm, tmaxfd, stemax,deemax, epsil, stmin);
1013 AliMedium(11, "ZVOIM", 11, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1015 // Thresholds for showering in the ZDCs
1017 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
1018 gMC->Gstpar(idtmed[i], "CUTELE", .001);
1019 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
1020 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
1022 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
1023 gMC->Gstpar(idtmed[i], "CUTELE", .001);
1024 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
1025 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
1027 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
1028 gMC->Gstpar(idtmed[i], "CUTELE", .001);
1029 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
1030 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
1032 // Avoid too detailed showering in TDI
1034 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1035 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1036 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1037 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1039 // Avoid too detailed showering along the beam line
1040 i = 7; //iron with energy loss (ZIRON)
1041 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1042 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1043 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1044 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1046 // Avoid too detailed showering along the beam line
1047 i = 8; //iron with energy loss (ZIRONN)
1048 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1049 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1050 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1051 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1053 // Avoid interaction in fibers (only energy loss allowed)
1054 i = 3; //fibers (ZSI02)
1055 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1056 gMC->Gstpar(idtmed[i], "MULS", 0.);
1057 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1058 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1059 gMC->Gstpar(idtmed[i], "LOSS", 1.);
1060 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1061 gMC->Gstpar(idtmed[i], "COMP", 0.);
1062 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1063 gMC->Gstpar(idtmed[i], "BREM", 0.);
1064 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1065 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1066 gMC->Gstpar(idtmed[i], "HADR", 0.);
1067 i = 4; //fibers (ZQUAR)
1068 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1069 gMC->Gstpar(idtmed[i], "MULS", 0.);
1070 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1071 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1072 gMC->Gstpar(idtmed[i], "LOSS", 1.);
1073 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1074 gMC->Gstpar(idtmed[i], "COMP", 0.);
1075 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1076 gMC->Gstpar(idtmed[i], "BREM", 0.);
1077 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1078 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1079 gMC->Gstpar(idtmed[i], "HADR", 0.);
1081 // Avoid interaction in void
1082 i = 11; //void with field
1083 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1084 gMC->Gstpar(idtmed[i], "MULS", 0.);
1085 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1086 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1087 gMC->Gstpar(idtmed[i], "LOSS", 0.);
1088 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1089 gMC->Gstpar(idtmed[i], "COMP", 0.);
1090 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1091 gMC->Gstpar(idtmed[i], "BREM", 0.);
1092 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1093 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1094 gMC->Gstpar(idtmed[i], "HADR", 0.);
1097 fMedSensZN = idtmed[1]; // Sensitive volume: ZN passive material
1098 fMedSensZP = idtmed[2]; // Sensitive volume: ZP passive material
1099 fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1
1100 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2
1101 fMedSensZEM = idtmed[5]; // Sensitive volume: ZEM passive material
1102 // fMedSensTDI = idtmed[6]; // Sensitive volume: TDI Cu shield
1103 // fMedSensPI = idtmed[7]; // Sensitive volume: beam pipes
1104 fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves
1107 //_____________________________________________________________________________
1108 void AliZDCv2::Init()
1113 //_____________________________________________________________________________
1114 void AliZDCv2::InitTables()
1118 char *lightfName1,*lightfName2,*lightfName3,*lightfName4,
1119 *lightfName5,*lightfName6,*lightfName7,*lightfName8;
1120 FILE *fp1, *fp2, *fp3, *fp4, *fp5, *fp6, *fp7, *fp8;
1122 // --- Reading light tables for ZN
1123 lightfName1 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362207s");
1124 if((fp1 = fopen(lightfName1,"r")) == NULL){
1125 printf("Cannot open file fp1 \n");
1128 lightfName2 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362208s");
1129 if((fp2 = fopen(lightfName2,"r")) == NULL){
1130 printf("Cannot open file fp2 \n");
1133 lightfName3 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362209s");
1134 if((fp3 = fopen(lightfName3,"r")) == NULL){
1135 printf("Cannot open file fp3 \n");
1138 lightfName4 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362210s");
1139 if((fp4 = fopen(lightfName4,"r")) == NULL){
1140 printf("Cannot open file fp4 \n");
1144 for(k=0; k<fNalfan; k++){
1145 for(j=0; j<fNben; j++){
1146 fscanf(fp1,"%f",&fTablen[0][k][j]);
1147 fscanf(fp2,"%f",&fTablen[1][k][j]);
1148 fscanf(fp3,"%f",&fTablen[2][k][j]);
1149 fscanf(fp4,"%f",&fTablen[3][k][j]);
1157 // --- Reading light tables for ZP and ZEM
1158 lightfName5 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552207s");
1159 if((fp5 = fopen(lightfName5,"r")) == NULL){
1160 printf("Cannot open file fp5 \n");
1163 lightfName6 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552208s");
1164 if((fp6 = fopen(lightfName6,"r")) == NULL){
1165 printf("Cannot open file fp6 \n");
1168 lightfName7 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552209s");
1169 if((fp7 = fopen(lightfName7,"r")) == NULL){
1170 printf("Cannot open file fp7 \n");
1173 lightfName8 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552210s");
1174 if((fp8 = fopen(lightfName8,"r")) == NULL){
1175 printf("Cannot open file fp8 \n");
1179 for(k=0; k<fNalfap; k++){
1180 for(j=0; j<fNbep; j++){
1181 fscanf(fp5,"%f",&fTablep[0][k][j]);
1182 fscanf(fp6,"%f",&fTablep[1][k][j]);
1183 fscanf(fp7,"%f",&fTablep[2][k][j]);
1184 fscanf(fp8,"%f",&fTablep[3][k][j]);
1192 //_____________________________________________________________________________
1193 void AliZDCv2::StepManager()
1196 // Routine called at every step in the Zero Degree Calorimeters
1199 Int_t j, vol[2], ibeta=0, ialfa, ibe, nphe;
1200 Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, radius, out;
1201 Float_t xalic[3], z, GuiEff, GuiPar[4]={0.31,-0.0004,0.0197,0.7958};
1202 TLorentzVector s, p;
1205 for (j=0;j<10;j++) hits[j]=0;
1207 if((gMC->GetMedium() == fMedSensZN) || (gMC->GetMedium() == fMedSensZP) ||
1208 (gMC->GetMedium() == fMedSensGR) || (gMC->GetMedium() == fMedSensF1) ||
1209 (gMC->GetMedium() == fMedSensF2) || (gMC->GetMedium() == fMedSensZEM)){
1211 // --- This part is for no shower developement in beam pipe and TDI
1212 // (gMC->GetMedium() == fMedSensPI) || (gMC->GetMedium() == fMedSensTDI)){
1214 // If particle interacts with beam pipe -> return
1215 // if((gMC->GetMedium() == fMedSensPI) || (gMC->GetMedium() == fMedSensTDI)){
1216 // If option NoShower is set -> StopTrack
1217 // if(fNoShower==1) {
1218 // if(gMC->GetMedium() == fMedSensPI) {
1219 // knamed = gMC->CurrentVolName();
1220 // if((!strncmp(knamed,"MQ",2)) || (!strncmp(knamed,"YM",2))) fpLostIT += 1;
1221 // if((!strncmp(knamed,"MD1",3))|| (!strncmp(knamed,"YD1",2))) fpLostD1 += 1;
1223 // if(gMC->GetMedium() == fMedSensTDI) fpLostTDI += 1;
1224 // gMC->StopTrack();
1225 // printf("\n # of p lost in Inner Triplet = %d\n",fpLostIT);
1226 // printf("\n # of p lost in D1 = %d\n",fpLostD1);
1227 // printf("\n # of p lost in TDI = %d\n",fpLostTDI);
1232 //Particle coordinates
1233 gMC->TrackPosition(s);
1234 for(j=0; j<=2; j++){
1241 // Determine in which ZDC the particle is
1242 knamed = gMC->CurrentVolName();
1243 if(!strncmp(knamed,"ZN",2)){
1246 else if(!strncmp(knamed,"ZP",2)){
1249 else if(!strncmp(knamed,"ZE",2)){
1253 // Determine in which quadrant the particle is
1255 if(vol[0]==1){ //Quadrant in ZN
1256 // Calculating particle coordinates inside ZN
1257 xdet[0] = x[0]-fPosZN[0];
1258 xdet[1] = x[1]-fPosZN[1];
1259 // Calculating quadrant in ZN
1261 if(xdet[1]>=0.) vol[1]=1;
1262 else if(xdet[1]<0.) vol[1]=3;
1264 else if(xdet[0]>0.){
1265 if(xdet[1]>=0.) vol[1]=2;
1266 else if(xdet[1]<0.) vol[1]=4;
1268 if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4))
1269 printf("\n StepManager->ERROR in ZN!!! vol[1] = %d, xdet[0] = %f,"
1270 "xdet[1] = %f\n",vol[1], xdet[0], xdet[1]);
1273 else if(vol[0]==2){ //Quadrant in ZP
1274 // Calculating particle coordinates inside ZP
1275 xdet[0] = x[0]-fPosZP[0];
1276 xdet[1] = x[1]-fPosZP[1];
1277 if(xdet[0]>=fDimZP[0]) xdet[0]=fDimZP[0]-0.01;
1278 if(xdet[0]<=-fDimZP[0]) xdet[0]=-fDimZP[0]+0.01;
1279 // Calculating tower in ZP
1280 Float_t xqZP = xdet[0]/(fDimZP[0]/2.);
1281 for(int i=1; i<=4; i++){
1282 if(xqZP>=(i-3) && xqZP<(i-2)){
1287 if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4))
1288 printf(" StepManager->ERROR in ZP!!! vol[1] = %d, xdet[0] = %f,"
1289 "xdet[1] = %f",vol[1], xdet[0], xdet[1]);
1292 // Quadrant in ZEM: vol[1] = 1 -> particle in 1st ZEM (placed at x = 8.5 cm)
1293 // vol[1] = 2 -> particle in 2nd ZEM (placed at x = -8.5 cm)
1294 else if(vol[0] == 3){
1297 // Particle x-coordinate inside ZEM1
1298 xdet[0] = x[0]-fPosZEM[0];
1302 // Particle x-coordinate inside ZEM2
1303 xdet[0] = x[0]+fPosZEM[0];
1305 xdet[1] = x[1]-fPosZEM[1];
1308 // Store impact point and kinetic energy of the ENTERING particle
1310 // if(Curtrack==Prim){
1311 if(gMC->IsTrackEntering()){
1313 gMC->TrackMomentum(p);
1315 // Impact point on ZDC
1323 // Int_t PcID = gMC->TrackPid();
1324 // printf("Pc ID -> %d\n",PcID);
1325 AddHit(gAlice->CurrentTrack(), vol, hits);
1330 // printf("\n # of detected p = %d\n",fpDetected);
1336 // Charged particles -> Energy loss
1337 if((destep=gMC->Edep())){
1338 if(gMC->IsTrackStop()){
1339 gMC->TrackMomentum(p);
1340 m = gMC->TrackMass();
1345 AddHit(gAlice->CurrentTrack(), vol, hits);
1351 AddHit(gAlice->CurrentTrack(), vol, hits);
1353 // printf(" Dep. E = %f \n",hits[9]);
1355 }// NB -> Questa parentesi (chiude il primo IF) io la sposterei al fondo!???
1358 // *** Light production in fibres
1359 if((gMC->GetMedium() == fMedSensF1) || (gMC->GetMedium() == fMedSensF2)){
1361 //Select charged particles
1362 if((destep=gMC->Edep())){
1364 // Particle velocity
1366 gMC->TrackMomentum(p);
1367 Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
1368 if(p[3] > 0.00001) beta = ptot/p[3];
1373 else if((beta>=0.67) && (beta<=0.75)){
1376 if((beta>0.75) && (beta<=0.85)){
1379 if((beta>0.85) && (beta<=0.95)){
1386 // Angle between particle trajectory and fibre axis
1387 // 1 -> Momentum directions
1391 gMC->Gmtod(um,ud,2);
1392 // 2 -> Angle < limit angle
1393 Double_t alfar = TMath::ACos(ud[2]);
1394 Double_t alfa = alfar*kRaddeg;
1395 if(alfa>=110.) return;
1396 ialfa = Int_t(1.+alfa/2.);
1398 // Distance between particle trajectory and fibre axis
1399 gMC->TrackPosition(s);
1400 for(j=0; j<=2; j++){
1403 gMC->Gmtod(x,xdet,1);
1404 if(TMath::Abs(ud[0])>0.00001){
1405 Float_t dcoeff = ud[1]/ud[0];
1406 be = TMath::Abs((xdet[1]-dcoeff*xdet[0])/TMath::Sqrt(dcoeff*dcoeff+1.));
1409 be = TMath::Abs(ud[0]);
1415 else if((vol[0]==2)){
1418 ibe = Int_t(be*1000.+1);
1420 //Looking into the light tables
1421 Float_t charge = gMC->TrackCharge();
1423 if((vol[0]==1)) { // (1) ZN fibres
1424 if(ibe>fNben) ibe=fNben;
1425 out = charge*charge*fTablen[ibeta][ialfa][ibe];
1426 nphe = gRandom->Poisson(out);
1427 // printf("ZN --- ibeta = %d, ialfa = %d, ibe = %d"
1428 // " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
1429 if(gMC->GetMedium() == fMedSensF1){
1430 hits[7] = nphe; //fLightPMQ
1433 AddHit(gAlice->CurrentTrack(), vol, hits);
1437 hits[8] = nphe; //fLightPMC
1439 AddHit(gAlice->CurrentTrack(), vol, hits);
1442 else if((vol[0]==2)) { // (2) ZP fibres
1443 if(ibe>fNbep) ibe=fNbep;
1444 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1445 nphe = gRandom->Poisson(out);
1446 // printf("ZP --- ibeta = %d, ialfa = %d, ibe = %d"
1447 // " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
1448 if(gMC->GetMedium() == fMedSensF1){
1449 hits[7] = nphe; //fLightPMQ
1452 AddHit(gAlice->CurrentTrack(), vol, hits);
1456 hits[8] = nphe; //fLightPMC
1458 AddHit(gAlice->CurrentTrack(), vol, hits);
1461 else if((vol[0]==3)) { // (3) ZEM fibres
1462 if(ibe>fNbep) ibe=fNbep;
1463 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1464 gMC->TrackPosition(s);
1465 for(j=0; j<=2; j++){
1468 // z-coordinate from ZEM front face
1469 // NB-> fPosZEM[2]+fZEMLength = -1000.+2*10.3 = 979.69 cm
1470 z = -xalic[2]+fPosZEM[2]+2*fZEMLength-xalic[1];
1471 // z = xalic[2]-fPosZEM[2]-fZEMLength-xalic[1]*(TMath::Tan(45.*kDegrad));
1472 // printf("\n fPosZEM[2]+2*fZEMLength = %f", fPosZEM[2]+2*fZEMLength);
1473 GuiEff = GuiPar[0]*(GuiPar[1]*z*z+GuiPar[2]*z+GuiPar[3]);
1474 // printf("\n xalic[0] = %f xalic[1] = %f xalic[2] = %f z = %f \n",
1475 // xalic[0],xalic[1],xalic[2],z);
1477 nphe = gRandom->Poisson(out);
1478 // printf(" out*GuiEff = %f nphe = %d", out, nphe);
1479 // printf("ZEM --- ibeta = %d, ialfa = %d, ibe = %d"
1480 // " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
1483 hits[8] = nphe; //fLightPMC (ZEM1)
1485 AddHit(gAlice->CurrentTrack(), vol, hits);
1488 hits[7] = nphe; //fLightPMQ (ZEM2)
1491 AddHit(gAlice->CurrentTrack(), vol, hits);