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.5 2001/06/15 14:51:39 coppedis
19 Geometry bug corrected
21 Revision 1.4 2001/06/13 11:17:49 coppedis
24 Revision 1.3 2001/06/13 11:11:02 coppedis
27 Revision 1.2 2001/06/12 13:45:11 coppedis
28 TDI in correct position and minor correction
30 Revision 1.1 2001/05/14 09:57:39 coppedis
31 A different geometry for the ZDCs
36 ///////////////////////////////////////////////////////////////////////
38 // AliZDCv2 --- new ZDC geometry, //
39 // with the EM ZDC at about 10 m from IP //
40 // Just one set of ZDC is inserted //
41 // (on the same side of the dimuon arm realtive to IP) //
43 ///////////////////////////////////////////////////////////////////////
45 // --- Standard libraries
57 // --- AliRoot classes
59 #include "AliZDCHit.h"
61 #include "AliDetector.h"
64 #include "AliCallf77.h"
67 #include "TLorentzVector.h"
72 //_____________________________________________________________________________
73 AliZDCv2::AliZDCv2() : AliZDC()
76 // Default constructor for Zero Degree Calorimeter
89 //_____________________________________________________________________________
90 AliZDCv2::AliZDCv2(const char *name, const char *title)
94 // Standard constructor for Zero Degree Calorimeter
97 // Check that DIPO, ABSO, DIPO and SHIL is there (otherwise tracking is wrong!!!)
99 AliModule* PIPE=gAlice->GetModule("PIPE");
100 AliModule* ABSO=gAlice->GetModule("ABSO");
101 AliModule* DIPO=gAlice->GetModule("DIPO");
102 AliModule* SHIL=gAlice->GetModule("SHIL");
103 if((!PIPE) || (!ABSO) || (!DIPO) || (!SHIL)) {
104 Error("Constructor","ZDC needs PIPE, ABSO, DIPO and SHIL!!!\n");
118 // Parameters for light tables
119 fNalfan = 90; // Number of Alfa (neutrons)
120 fNalfap = 90; // Number of Alfa (protons)
121 fNben = 18; // Number of beta (neutrons)
122 fNbep = 28; // Number of beta (protons)
124 for(ip=0; ip<4; ip++){
125 for(kp=0; kp<fNalfap; kp++){
126 for(jp=0; jp<fNbep; jp++){
127 fTablep[ip][kp][jp] = 0;
132 for(in=0; in<4; in++){
133 for(kn=0; kn<fNalfan; kn++){
134 for(jn=0; jn<fNben; jn++){
135 fTablen[in][kn][jn] = 0;
140 // Parameters for hadronic calorimeters geometry
157 // Parameters for EM calorimeter geometry
165 //_____________________________________________________________________________
166 void AliZDCv2::CreateGeometry()
169 // Create the geometry for the Zero Degree Calorimeter version 1
170 //* Initialize COMMON block ZDC_CGEOM
177 //_____________________________________________________________________________
178 void AliZDCv2::CreateBeamLine()
181 Float_t zq, zd1, zd2;
182 Float_t conpar[9], tubpar[3], tubspar[5], boxpar[3];
185 Int_t *idtmed = fIdtmed->GetArray();
187 // -- Mother of the ZDCs (Vacuum PCON)
198 gMC->Gsvolu("ZDC ", "PCON", idtmed[11], conpar, 9);
199 gMC->Gspos("ZDC ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
201 // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to
202 // the beginning of D1)
208 tubpar[2] = 3838.3/2.;
209 gMC->Gsvolu("QT01", "TUBE", idtmed[7], tubpar, 3);
210 gMC->Gspos("QT01", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
212 //-- SECOND SECTION OF THE BEAM PIPE (from the end of D1 to the
215 //-- FROM MAGNETIC BEGINNING OF D1 TO MAGNETIC END OF D1 + 13.5 cm
216 //-- Cylindrical pipe (r = 3.47) + conical flare
218 // -> Beginning of D1
222 tubpar[1] = 3.47+0.2;
223 tubpar[2] = 958.5/2.;
224 gMC->Gsvolu("QT02", "TUBE", idtmed[7], tubpar, 3);
225 gMC->Gspos("QT02", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
234 gMC->Gsvolu("QC01", "CONE", idtmed[7], conpar, 5);
235 gMC->Gspos("QC01", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
242 gMC->Gsvolu("QT03", "TUBE", idtmed[7], tubpar, 3);
243 gMC->Gspos("QT03", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
250 gMC->Gsvolu("QT04", "TUBE", idtmed[7], tubpar, 3);
251 gMC->Gspos("QT04", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
253 zd1 += tubpar[2] * 2.;
258 gMC->Gsvolu("QT05", "TUBE", idtmed[7], tubpar, 3);
259 gMC->Gspos("QT05", 1, "ZDC ", 0., 0., tubpar[0] + zd1, 0, "ONLY");
261 zd1 += tubpar[2] * 2.;
266 gMC->Gsvolu("QT06", "TUBE", idtmed[7], tubpar, 3);
267 gMC->Gspos("QT06", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
269 zd1 += tubpar[2] * 2.;
276 gMC->Gsvolu("QC02", "CONE", idtmed[7], conpar, 5);
277 gMC->Gspos("QC02", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
279 zd1 += conpar[0] * 2.;
284 gMC->Gsvolu("QT07", "TUBE", idtmed[7], tubpar, 3);
285 gMC->Gspos("QT07", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
287 zd1 += tubpar[2] * 2.;
294 gMC->Gsvolu("QC03", "CONE", idtmed[7], conpar, 5);
295 gMC->Gspos("QC03", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
297 zd1 += conpar[0] * 2.;
301 tubpar[2] = 205.8/2.;
302 gMC->Gsvolu("QT08", "TUBE", idtmed[7], tubpar, 3);
303 gMC->Gspos("QT08", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
305 zd1 += tubpar[2] * 2.;
309 // QT09 is 10 cm longer to accomodate TDI
310 tubpar[2] = 515.4/2.;
311 gMC->Gsvolu("QT09", "TUBE", idtmed[7], tubpar, 3);
312 gMC->Gspos("QT09", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
314 // --- Insert TDI (inside ZDC volume)
319 gMC->Gsvolu("QTD1", "BOX ", idtmed[7], boxpar, 3);
320 gMC->Gspos("QTD1", 1, "ZDC ", 3., 10.6, tubpar[2] + zd1 + 56.3, 0, "ONLY");
321 gMC->Gspos("QTD1", 2, "ZDC ", 3., -10.6, tubpar[2] + zd1 + 56.3, 0, "ONLY");
326 gMC->Gsvolu("QTD2", "BOX ", idtmed[6], boxpar, 3);
327 gMC->Gspos("QTD2", 1, "ZDC ", 8.6+boxpar[0], 0., tubpar[2] + zd1 + 56.3, 0, "ONLY");
329 // tubspar[0] = 6.2; // R = 6.2 cm----------------------------------------
331 // tubspar[2] = 400./2.;
332 // tubspar[3] = 180.-62.5;
333 // tubspar[4] = 180.+62.5;
334 tubspar[0] = 10.5; // R = 10.5 cm------------------------------------------
336 tubspar[2] = 400./2.;
337 tubspar[3] = 180.-75.5;
338 tubspar[4] = 180.+75.5;
339 gMC->Gsvolu("QTD3", "TUBS", idtmed[6], tubspar, 5);
340 gMC->Gspos("QTD3", 1, "ZDC ", 0., 0., tubpar[2] + zd1 + 56.3, 0, "ONLY");
342 zd1 += tubpar[2] * 2.;
346 // QT10 is 10 cm shorter
348 gMC->Gsvolu("QT10", "TUBE", idtmed[7], tubpar, 3);
349 gMC->Gspos("QT10", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
351 zd1 += tubpar[2] * 2.;
355 tubpar[2] = 778.5/2.;
356 gMC->Gsvolu("QT11", "TUBE", idtmed[7], tubpar, 3);
357 gMC->Gspos("QT11", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
359 zd1 += tubpar[2] * 2.;
361 conpar[0] = 14.18/2.;
366 gMC->Gsvolu("QC04", "CONE", idtmed[7], conpar, 5);
367 gMC->Gspos("QC04", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
369 zd1 += conpar[0] * 2.;
374 gMC->Gsvolu("QT12", "TUBE", idtmed[7], tubpar, 3);
375 gMC->Gspos("QT12", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
377 zd1 += tubpar[2] * 2.;
379 conpar[0] = 36.86/2.;
384 gMC->Gsvolu("QC05", "CONE", idtmed[7], conpar, 5);
385 gMC->Gspos("QC05", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
387 zd1 += conpar[0] * 2.;
391 tubpar[2] = 927.3/2.;
392 gMC->Gsvolu("QT13", "TUBE", idtmed[7], tubpar, 3);
393 gMC->Gspos("QT13", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
395 zd1 += tubpar[2] * 2.;
400 gMC->Gsvolu("QT14", "TUBE", idtmed[8], tubpar, 3);
401 gMC->Gspos("QT14", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
403 zd1 += tubpar[2] * 2.;
408 gMC->Gsvolu("QT15", "TUBE", idtmed[11], tubpar, 3);
410 //-- Position QT15 inside QT14
411 gMC->Gspos("QT15", 1, "QT14", -7.7, 0., 0., 0, "ONLY");
416 gMC->Gsvolu("QT16", "TUBE", idtmed[11], tubpar, 3);
418 //-- Position QT16 inside QT14
419 gMC->Gspos("QT16", 1, "QT14", 7.7, 0., 0., 0, "ONLY");
422 //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2
426 tubpar[2] = 680.8/2.;
427 gMC->Gsvolu("QT17", "TUBE", idtmed[7], tubpar, 3);
431 tubpar[2] = 680.8/2.;
432 gMC->Gsvolu("QT18", "TUBE", idtmed[7], tubpar, 3);
436 Float_t angle = 0.143*kDegrad;
438 AliMatrix(im1, 90.-0.143, 0., 90., 90., 0.143, 180.);
439 gMC->Gspos("QT17", 1, "ZDC ", TMath::Sin(angle) * 680.8/ 2. - 9.4,
440 0., tubpar[2] + zd1, im1, "ONLY");
442 AliMatrix(im2, 90.+0.143, 0., 90., 90., 0.143, 0.);
443 gMC->Gspos("QT18", 1, "ZDC ", 9.7 - TMath::Sin(angle) * 680.8 / 2.,
444 0., tubpar[2] + zd1, im2, "ONLY");
446 // -- BEAM PIPE ON THE OTHER SIDE OF I.P. TILL THE EM ZDC
448 Float_t zb = -800.; // End of QBPM (from AliPIPEv0.cxx)
451 tubpar[2] = (1050+zb)/2.; // From the end of QBPM to z=1050.
452 gMC->Gsvolu("QT19", "TUBE", idtmed[7], tubpar, 3);
453 gMC->Gspos("QT19", 1, "ALIC", 0., 0., zb - tubpar[2], 0, "ONLY");
456 // -- END OF BEAM PIPE VOLUME DEFINITION.
457 // ----------------------------------------------------------------
459 // -- MAGNET DEFINITION -> LHC OPTICS 6.2 (preliminary version)
461 // ----------------------------------------------------------------
462 // Replaced by the muon dipole
463 // ----------------------------------------------------------------
464 // -- COMPENSATOR DIPOLE (MBXW)
465 // GAP (VACUUM WITH MAGNETIC FIELD)
469 // tubpar[2] = 340./2.;
470 // gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3);
471 // gMC->Gspos("MBXW", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
473 // -- YOKE (IRON WITHOUT MAGNETIC FIELD)
477 // tubpar[2] = 340./2.;
478 // gMC->Gsvolu("YMBX", "TUBE", idtmed[7], tubpar, 3);
479 // gMC->Gspos("YMBX", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY");
481 // ----------------------------------------------------------------
482 // Replaced by the second dipole
483 // ----------------------------------------------------------------
484 // -- COMPENSATOR DIPOLE (MCBWA)
485 // GAP (VACUUM WITH MAGNETIC FIELD)
489 // tubpar[2] = 170./2.;
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)
497 // tubpar[2] = 170./2.;
498 // gMC->Gsvolu("YMCB", "TUBE", idtmed[7], 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[7], 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[7], tubpar, 3);
543 gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 883.5, 0, "ONLY");
544 gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 883.5, 0, "ONLY");
546 gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1533.5, 0, "ONLY");
547 gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1533.5, 0, "ONLY");
549 // -- SEPARATOR DIPOLE D1
553 // -- GAP (VACUUM WITH MAGNETIC FIELD)
558 gMC->Gsvolu("MD1 ", "TUBE", idtmed[11], tubpar, 3);
560 // -- Insert horizontal Cu plates inside D1
561 // -- (to simulate the vacuum chamber)
563 boxpar[0] = TMath::Sqrt(tubpar[1]*tubpar[1]-(2.98+0.2)*(2.98+0.2));
566 gMC->Gsvolu("MD1V", "BOX ", idtmed[6], boxpar, 3);
567 gMC->Gspos("MD1V", 1, "MD1 ", 0., 2.98+boxpar[1], 0., 0, "ONLY");
568 gMC->Gspos("MD1V", 2, "MD1 ", 0., -2.98-boxpar[1], 0., 0, "ONLY");
575 gMC->Gsvolu("YD1 ", "TUBE", idtmed[7], tubpar, 3);
577 gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
578 gMC->Gspos("MD1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
584 // -- GAP (VACUUM WITH MAGNETIC FIELD)
589 gMC->Gsvolu("MD2 ", "TUBE", idtmed[11], tubpar, 3);
596 gMC->Gsvolu("YD2 ", "TUBE", idtmed[7], tubpar, 3);
598 gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., tubpar[2] + zd2, 0, "ONLY");
600 gMC->Gspos("MD2 ", 1, "YD2 ", -9.4, 0., 0., 0, "ONLY");
601 gMC->Gspos("MD2 ", 2, "YD2 ", 9.4, 0., 0., 0, "ONLY");
603 // -- END OF MAGNET DEFINITION
606 //_____________________________________________________________________________
607 void AliZDCv2::CreateZDC()
610 Float_t DimPb[6], DimVoid[6];
612 Int_t *idtmed = fIdtmed->GetArray();
614 // Parameters for hadronic calorimeters geometry
615 // NB -> parameters used ONLY in CreateZDC()
616 Float_t fDimZN[3] = {3.52, 3.52, 50.}; // Dimensions of neutron detector
617 Float_t fGrvZN[3] = {0.03, 0.03, 50.}; // Grooves for neutron detector
618 Float_t fGrvZP[3] = {0.04, 0.04, 75.}; // Grooves for proton detector
619 Int_t fDivZN[3] = {11, 11, 0}; // Division for neutron detector
620 Int_t fDivZP[3] = {7, 15, 0}; // Division for proton detector
621 Int_t fTowZN[2] = {2, 2}; // Tower for neutron detector
622 Int_t fTowZP[2] = {4, 1}; // Tower for proton detector
624 // Parameters for EM calorimeter geometry
625 // NB -> parameters used ONLY in CreateZDC()
626 Float_t fDimZEMPb = 0.15*(TMath::Sqrt(2.)); // z-dimension of the Pb slice
627 Float_t fDimZEMAir = 0.001; // scotch
628 Float_t fFibRadZEM = 0.0315; // External fiber radius (including cladding)
629 Int_t fDivZEM[3] = {92, 0, 20}; // Divisions for EM detector
630 Float_t fDimZEM0 = 2*fDivZEM[2]*(fDimZEMPb+fDimZEMAir+fFibRadZEM*(TMath::Sqrt(2.)));
631 fZEMLength = fDimZEM0;
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 // -------------------------------------------------------------------------------
640 //--> Neutron calorimeter (ZN)
642 gMC->Gsvolu("ZNEU", "BOX ", idtmed[1], fDimZN, 3); // Passive material
643 gMC->Gsvolu("ZNF1", "TUBE", idtmed[3], fFibZN, 3); // Active material
644 gMC->Gsvolu("ZNF2", "TUBE", idtmed[4], fFibZN, 3);
645 gMC->Gsvolu("ZNF3", "TUBE", idtmed[4], fFibZN, 3);
646 gMC->Gsvolu("ZNF4", "TUBE", idtmed[3], fFibZN, 3);
647 gMC->Gsvolu("ZNG1", "BOX ", idtmed[12], fGrvZN, 3); // Empty grooves
648 gMC->Gsvolu("ZNG2", "BOX ", idtmed[12], fGrvZN, 3);
649 gMC->Gsvolu("ZNG3", "BOX ", idtmed[12], fGrvZN, 3);
650 gMC->Gsvolu("ZNG4", "BOX ", idtmed[12], fGrvZN, 3);
652 // Divide ZNEU in towers (for hits purposes)
654 gMC->Gsdvn("ZNTX", "ZNEU", fTowZN[0], 1); // x-tower
655 gMC->Gsdvn("ZN1 ", "ZNTX", fTowZN[1], 2); // y-tower
657 //-- Divide ZN1 in minitowers
658 // fDivZN[0]= NUMBER OF FIBERS PER TOWER ALONG X-AXIS,
659 // fDivZN[1]= NUMBER OF FIBERS PER TOWER ALONG Y-AXIS
660 // (4 fibres per minitower)
662 gMC->Gsdvn("ZNSL", "ZN1 ", fDivZN[1], 2); // Slices
663 gMC->Gsdvn("ZNST", "ZNSL", fDivZN[0], 1); // Sticks
665 // --- Position the empty grooves in the sticks (4 grooves per stick)
666 Float_t dx = fDimZN[0] / fDivZN[0] / 4.;
667 Float_t dy = fDimZN[1] / fDivZN[1] / 4.;
669 gMC->Gspos("ZNG1", 1, "ZNST", 0.-dx, 0.+dy, 0., 0, "ONLY");
670 gMC->Gspos("ZNG2", 1, "ZNST", 0.+dx, 0.+dy, 0., 0, "ONLY");
671 gMC->Gspos("ZNG3", 1, "ZNST", 0.-dx, 0.-dy, 0., 0, "ONLY");
672 gMC->Gspos("ZNG4", 1, "ZNST", 0.+dx, 0.-dy, 0., 0, "ONLY");
674 // --- Position the fibers in the grooves
675 gMC->Gspos("ZNF1", 1, "ZNG1", 0., 0., 0., 0, "ONLY");
676 gMC->Gspos("ZNF2", 1, "ZNG2", 0., 0., 0., 0, "ONLY");
677 gMC->Gspos("ZNF3", 1, "ZNG3", 0., 0., 0., 0, "ONLY");
678 gMC->Gspos("ZNF4", 1, "ZNG4", 0., 0., 0., 0, "ONLY");
680 // --- Position the neutron calorimeter in ZDC
681 gMC->Gspos("ZNEU", 1, "ZDC ", fPosZN[0], fPosZN[1], fPosZN[2] + fDimZN[2], 0, "ONLY");
684 // -------------------------------------------------------------------------------
685 //--> Proton calorimeter (ZP)
687 gMC->Gsvolu("ZPRO", "BOX ", idtmed[2], fDimZP, 3); // Passive material
688 gMC->Gsvolu("ZPF1", "TUBE", idtmed[3], fFibZP, 3); // Active material
689 gMC->Gsvolu("ZPF2", "TUBE", idtmed[4], fFibZP, 3);
690 gMC->Gsvolu("ZPF3", "TUBE", idtmed[4], fFibZP, 3);
691 gMC->Gsvolu("ZPF4", "TUBE", idtmed[3], fFibZP, 3);
692 gMC->Gsvolu("ZPG1", "BOX ", idtmed[12], fGrvZP, 3); // Empty grooves
693 gMC->Gsvolu("ZPG2", "BOX ", idtmed[12], fGrvZP, 3);
694 gMC->Gsvolu("ZPG3", "BOX ", idtmed[12], fGrvZP, 3);
695 gMC->Gsvolu("ZPG4", "BOX ", idtmed[12], fGrvZP, 3);
697 //-- Divide ZPRO in towers(for hits purposes)
699 gMC->Gsdvn("ZPTX", "ZPRO", fTowZP[0], 1); // x-tower
700 gMC->Gsdvn("ZP1 ", "ZPTX", fTowZP[1], 2); // y-tower
703 //-- Divide ZP1 in minitowers
704 // fDivZP[0]= NUMBER OF FIBERS ALONG X-AXIS PER MINITOWER,
705 // fDivZP[1]= NUMBER OF FIBERS ALONG Y-AXIS PER MINITOWER
706 // (4 fiber per minitower)
708 gMC->Gsdvn("ZPSL", "ZP1 ", fDivZP[1], 2); // Slices
709 gMC->Gsdvn("ZPST", "ZPSL", fDivZP[0], 1); // Sticks
711 // --- Position the empty grooves in the sticks (4 grooves per stick)
712 dx = fDimZP[0] / fTowZP[0] / fDivZP[0] / 2.;
713 dy = fDimZP[1] / fTowZP[1] / fDivZP[1] / 2.;
715 gMC->Gspos("ZPG1", 1, "ZPST", 0.-dx, 0.+dy, 0., 0, "ONLY");
716 gMC->Gspos("ZPG2", 1, "ZPST", 0.+dx, 0.+dy, 0., 0, "ONLY");
717 gMC->Gspos("ZPG3", 1, "ZPST", 0.-dx, 0.-dy, 0., 0, "ONLY");
718 gMC->Gspos("ZPG4", 1, "ZPST", 0.+dx, 0.-dy, 0., 0, "ONLY");
720 // --- Position the fibers in the grooves
721 gMC->Gspos("ZPF1", 1, "ZPG1", 0., 0., 0., 0, "ONLY");
722 gMC->Gspos("ZPF2", 1, "ZPG2", 0., 0., 0., 0, "ONLY");
723 gMC->Gspos("ZPF3", 1, "ZPG3", 0., 0., 0., 0, "ONLY");
724 gMC->Gspos("ZPF4", 1, "ZPG4", 0., 0., 0., 0, "ONLY");
727 // --- Position the proton calorimeter in ZDC
728 gMC->Gspos("ZPRO", 1, "ZDC ", fPosZP[0], fPosZP[1], fPosZP[2] + fDimZP[2], 0, "ONLY");
731 // -------------------------------------------------------------------------------
732 // -> EM calorimeter (ZEM)
734 gMC->Gsvolu("ZEM ", "PARA", idtmed[10], fDimZEM, 6);
738 gMC->Matrix(irot1,180.,0.,90.,90.,90.,0.); // Rotation matrix 1
739 gMC->Matrix(irot2,180.,0.,90.,fDimZEM[3]+90.,90.,fDimZEM[3]);// Rotation matrix 2
740 // printf("irot1 = %d, irot2 = %d \n", irot1, irot2);
742 gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material
744 gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches
746 DimPb[0] = fDimZEMPb; // Lead slices
747 DimPb[1] = fDimZEM[2];
748 DimPb[2] = fDimZEM[1];
749 DimPb[3] = 90.-fDimZEM[3];
752 gMC->Gsvolu("ZEL0", "PARA", idtmed[5], DimPb, 6);
753 gMC->Gsvolu("ZEL1", "PARA", idtmed[5], DimPb, 6);
754 // gMC->Gsvolu("ZEL2", "PARA", idtmed[5], DimPb, 6);
756 // --- Position the lead slices in the tranche
757 Float_t zTran = fDimZEM[0]/fDivZEM[2];
758 Float_t zTrPb = -zTran+fDimZEMPb;
759 gMC->Gspos("ZEL0", 1, "ZETR", zTrPb, 0., 0., 0, "ONLY");
760 gMC->Gspos("ZEL1", 1, "ZETR", fDimZEMPb, 0., 0., 0, "ONLY");
762 // --- Vacuum zone (to be filled with fibres)
763 DimVoid[0] = (zTran-2*fDimZEMPb)/2.;
764 DimVoid[1] = fDimZEM[2];
765 DimVoid[2] = fDimZEM[1];
766 DimVoid[3] = 90.-fDimZEM[3];
769 gMC->Gsvolu("ZEV0", "PARA", idtmed[10], DimVoid,6);
770 gMC->Gsvolu("ZEV1", "PARA", idtmed[10], DimVoid,6);
772 // --- Divide the vacuum slice into sticks along x axis
773 gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3);
774 gMC->Gsdvn("ZES1", "ZEV1", fDivZEM[0], 3);
776 // --- Positioning the fibers into the sticks
777 gMC->Gspos("ZEMF", 1,"ZES0", 0., 0., 0., irot2, "ONLY");
778 gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY");
780 // --- Positioning the vacuum slice into the tranche
781 Float_t DisplFib = fDimZEM[1]/fDivZEM[0];
782 gMC->Gspos("ZEV0", 1,"ZETR", -DimVoid[0], 0., 0., 0, "ONLY");
783 gMC->Gspos("ZEV1", 1,"ZETR", -DimVoid[0]+zTran, 0., DisplFib, 0, "ONLY");
785 // --- Positioning the ZEM into the ZDC - rotation for 90 degrees
786 // NB -> In AliZDCv2 ZEM is positioned in ALIC (instead of in ZDC) volume
787 // beacause it's impossible to make a ZDC pcon volume to contain
788 // both hadronics and EM calorimeters. (It causes many tracks abandoning).
789 gMC->Gspos("ZEM ", 1,"ALIC", fPosZEM[0], fPosZEM[1], fPosZEM[2]+fDimZEM[0], irot1, "ONLY");
791 // --- Adding last slice at the end of the EM calorimeter
792 // Float_t zLastSlice = fPosZEM[2]+fDimZEMPb+fDimZEM[0];
793 // gMC->Gspos("ZEL2", 1,"ALIC", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY");
797 //_____________________________________________________________________________
798 void AliZDCv2::DrawModule()
801 // Draw a shaded view of the Zero Degree Calorimeter version 1
804 // Set everything unseen
805 gMC->Gsatt("*", "seen", -1);
807 // Set ALIC mother transparent
808 gMC->Gsatt("ALIC","SEEN",0);
810 // Set the volumes visible
811 gMC->Gsatt("ZDC ","SEEN",0);
812 gMC->Gsatt("QT01","SEEN",1);
813 gMC->Gsatt("QT02","SEEN",1);
814 gMC->Gsatt("QT03","SEEN",1);
815 gMC->Gsatt("QT04","SEEN",1);
816 gMC->Gsatt("QT05","SEEN",1);
817 gMC->Gsatt("QT06","SEEN",1);
818 gMC->Gsatt("QT07","SEEN",1);
819 gMC->Gsatt("QT08","SEEN",1);
820 gMC->Gsatt("QT09","SEEN",1);
821 gMC->Gsatt("QT10","SEEN",1);
822 gMC->Gsatt("QT11","SEEN",1);
823 gMC->Gsatt("QT12","SEEN",1);
824 gMC->Gsatt("QT13","SEEN",1);
825 gMC->Gsatt("QT14","SEEN",1);
826 gMC->Gsatt("QT15","SEEN",1);
827 gMC->Gsatt("QT16","SEEN",1);
828 gMC->Gsatt("QT17","SEEN",1);
829 gMC->Gsatt("QT18","SEEN",1);
830 gMC->Gsatt("QC01","SEEN",1);
831 gMC->Gsatt("QC02","SEEN",1);
832 gMC->Gsatt("QC03","SEEN",1);
833 gMC->Gsatt("QC04","SEEN",1);
834 gMC->Gsatt("QC05","SEEN",1);
835 gMC->Gsatt("QTD1","SEEN",1);
836 gMC->Gsatt("QTD2","SEEN",1);
837 gMC->Gsatt("QTD3","SEEN",1);
838 gMC->Gsatt("MQXL","SEEN",1);
839 gMC->Gsatt("YMQL","SEEN",1);
840 gMC->Gsatt("MQX ","SEEN",1);
841 gMC->Gsatt("YMQ ","SEEN",1);
842 gMC->Gsatt("ZQYX","SEEN",1);
843 gMC->Gsatt("MD1 ","SEEN",1);
844 gMC->Gsatt("MD1V","SEEN",1);
845 gMC->Gsatt("YD1 ","SEEN",1);
846 gMC->Gsatt("MD2 ","SEEN",1);
847 gMC->Gsatt("YD2 ","SEEN",1);
848 gMC->Gsatt("ZNEU","SEEN",0);
849 gMC->Gsatt("ZNF1","SEEN",0);
850 gMC->Gsatt("ZNF2","SEEN",0);
851 gMC->Gsatt("ZNF3","SEEN",0);
852 gMC->Gsatt("ZNF4","SEEN",0);
853 gMC->Gsatt("ZNG1","SEEN",0);
854 gMC->Gsatt("ZNG2","SEEN",0);
855 gMC->Gsatt("ZNG3","SEEN",0);
856 gMC->Gsatt("ZNG4","SEEN",0);
857 gMC->Gsatt("ZNTX","SEEN",0);
858 gMC->Gsatt("ZN1 ","COLO",4);
859 gMC->Gsatt("ZN1 ","SEEN",1);
860 gMC->Gsatt("ZNSL","SEEN",0);
861 gMC->Gsatt("ZNST","SEEN",0);
862 gMC->Gsatt("ZPRO","SEEN",0);
863 gMC->Gsatt("ZPF1","SEEN",0);
864 gMC->Gsatt("ZPF2","SEEN",0);
865 gMC->Gsatt("ZPF3","SEEN",0);
866 gMC->Gsatt("ZPF4","SEEN",0);
867 gMC->Gsatt("ZPG1","SEEN",0);
868 gMC->Gsatt("ZPG2","SEEN",0);
869 gMC->Gsatt("ZPG3","SEEN",0);
870 gMC->Gsatt("ZPG4","SEEN",0);
871 gMC->Gsatt("ZPTX","SEEN",0);
872 gMC->Gsatt("ZP1 ","COLO",6);
873 gMC->Gsatt("ZP1 ","SEEN",1);
874 gMC->Gsatt("ZPSL","SEEN",0);
875 gMC->Gsatt("ZPST","SEEN",0);
876 gMC->Gsatt("ZEM ","COLO",7);
877 gMC->Gsatt("ZEM ","SEEN",1);
878 gMC->Gsatt("ZEMF","SEEN",0);
879 gMC->Gsatt("ZETR","SEEN",0);
880 gMC->Gsatt("ZEL0","SEEN",0);
881 gMC->Gsatt("ZEL1","SEEN",0);
882 gMC->Gsatt("ZEL2","SEEN",0);
883 gMC->Gsatt("ZEV0","SEEN",0);
884 gMC->Gsatt("ZEV1","SEEN",0);
885 gMC->Gsatt("ZES0","SEEN",0);
886 gMC->Gsatt("ZES1","SEEN",0);
889 gMC->Gdopt("hide", "on");
890 gMC->Gdopt("shad", "on");
891 gMC->Gsatt("*", "fill", 7);
892 gMC->SetClipBox(".");
893 gMC->SetClipBox("*", 0, 100, -100, 100, 12000, 16000);
895 gMC->Gdraw("alic", 40, 30, 0, 488, 220, .07, .07);
896 gMC->Gdhead(1111, "Zero Degree Calorimeter Version 1");
897 gMC->Gdman(18, 4, "MAN");
900 //_____________________________________________________________________________
901 void AliZDCv2::CreateMaterials()
904 // Create Materials for the Zero Degree Calorimeter
907 Int_t *idtmed = fIdtmed->GetArray();
909 Float_t dens, ubuf[1], wmat[2], a[2], z[2], deemax = -1;
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);
944 AliMaterial(5, "LEAD", 207.19, 82., 11.35, .56, 18.5, ubuf, 1);
948 AliMaterial(6, "COPP", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
950 // --- Iron (energy loss taken into account)
952 AliMaterial(7, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
954 // --- Iron (no energy loss)
956 AliMaterial(8, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
958 // --- Vacuum (no magnetic field)
959 AliMaterial(10, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
961 // --- Vacuum (with magnetic field)
962 AliMaterial(11, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
964 // --- Air (no magnetic field)
965 AliMaterial(12, "Air $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0);
967 // --- Definition of tracking media:
969 // --- Tantalum = 1 ;
971 // --- Fibers (SiO2) = 3 ;
972 // --- Fibers (SiO2) = 4 ;
975 // --- Iron (with energy loss) = 7 ;
976 // --- Iron (without energy loss) = 8 ;
977 // --- Vacuum (no field) = 10
978 // --- Vacuum (with field) = 11
979 // --- Air (no field) = 12
982 // --- Tracking media parameters
983 Float_t epsil = .01, stmin=0.01, stemax = 1.;
984 // Int_t isxfld = gAlice->Field()->Integ();
985 Float_t fieldm = 0., tmaxfd = 0.;
986 Int_t ifield = 0, isvolActive = 1, isvol = 0, inofld = 0;
988 AliMedium(1, "ZTANT", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
989 // AliMedium(1, "ZW", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
990 AliMedium(2, "ZBRASS",2, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
991 AliMedium(3, "ZSIO2", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
992 AliMedium(4, "ZQUAR", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
993 AliMedium(5, "ZLEAD", 5, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
994 // AliMedium(6, "ZCOPP", 6, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
995 // AliMedium(7, "ZIRON", 7, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
996 AliMedium(6, "ZCOPP", 6, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
997 AliMedium(7, "ZIRON", 7, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
998 AliMedium(8, "ZIRONN",8, 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);
1004 AliMedium(11, "ZVOIM", 11, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
1006 // 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 in TDI
1025 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1026 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1027 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1028 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1030 // Avoid too detailed showering along the beam line
1031 i = 7; //iron with energy loss (ZIRON)
1032 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1033 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1034 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1035 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1037 // Avoid too detailed showering along the beam line
1038 i = 8; //iron with energy loss (ZIRONN)
1039 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1040 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1041 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1042 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1044 // Avoid interaction in fibers (only energy loss allowed)
1045 i = 3; //fibers (ZSI02)
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.);
1058 i = 4; //fibers (ZQUAR)
1059 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1060 gMC->Gstpar(idtmed[i], "MULS", 0.);
1061 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1062 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1063 gMC->Gstpar(idtmed[i], "LOSS", 1.);
1064 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1065 gMC->Gstpar(idtmed[i], "COMP", 0.);
1066 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1067 gMC->Gstpar(idtmed[i], "BREM", 0.);
1068 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1069 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1070 gMC->Gstpar(idtmed[i], "HADR", 0.);
1072 // Avoid interaction in void
1073 i = 11; //void with field
1074 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1075 gMC->Gstpar(idtmed[i], "MULS", 0.);
1076 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1077 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1078 gMC->Gstpar(idtmed[i], "LOSS", 0.);
1079 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1080 gMC->Gstpar(idtmed[i], "COMP", 0.);
1081 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1082 gMC->Gstpar(idtmed[i], "BREM", 0.);
1083 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1084 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1085 gMC->Gstpar(idtmed[i], "HADR", 0.);
1088 fMedSensZN = idtmed[1]; // Sensitive volume: ZN passive material
1089 fMedSensZP = idtmed[2]; // Sensitive volume: ZP passive material
1090 fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1
1091 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2
1092 fMedSensZEM = idtmed[5]; // Sensitive volume: ZEM passive material
1093 // fMedSensTDI = idtmed[6]; // Sensitive volume: TDI Cu shield
1094 // fMedSensPI = idtmed[7]; // Sensitive volume: beam pipes
1095 fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves
1098 //_____________________________________________________________________________
1099 void AliZDCv2::Init()
1104 //_____________________________________________________________________________
1105 void AliZDCv2::InitTables()
1109 char *lightfName1,*lightfName2,*lightfName3,*lightfName4,
1110 *lightfName5,*lightfName6,*lightfName7,*lightfName8;
1111 FILE *fp1, *fp2, *fp3, *fp4, *fp5, *fp6, *fp7, *fp8;
1113 // --- Reading light tables for ZN
1114 lightfName1 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362207s");
1115 if((fp1 = fopen(lightfName1,"r")) == NULL){
1116 printf("Cannot open file fp1 \n");
1119 lightfName2 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362208s");
1120 if((fp2 = fopen(lightfName2,"r")) == NULL){
1121 printf("Cannot open file fp2 \n");
1124 lightfName3 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362209s");
1125 if((fp3 = fopen(lightfName3,"r")) == NULL){
1126 printf("Cannot open file fp3 \n");
1129 lightfName4 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362210s");
1130 if((fp4 = fopen(lightfName4,"r")) == NULL){
1131 printf("Cannot open file fp4 \n");
1135 for(k=0; k<fNalfan; k++){
1136 for(j=0; j<fNben; j++){
1137 fscanf(fp1,"%f",&fTablen[0][k][j]);
1138 fscanf(fp2,"%f",&fTablen[1][k][j]);
1139 fscanf(fp3,"%f",&fTablen[2][k][j]);
1140 fscanf(fp4,"%f",&fTablen[3][k][j]);
1148 // --- Reading light tables for ZP and ZEM
1149 lightfName5 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552207s");
1150 if((fp5 = fopen(lightfName5,"r")) == NULL){
1151 printf("Cannot open file fp5 \n");
1154 lightfName6 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552208s");
1155 if((fp6 = fopen(lightfName6,"r")) == NULL){
1156 printf("Cannot open file fp6 \n");
1159 lightfName7 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552209s");
1160 if((fp7 = fopen(lightfName7,"r")) == NULL){
1161 printf("Cannot open file fp7 \n");
1164 lightfName8 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552210s");
1165 if((fp8 = fopen(lightfName8,"r")) == NULL){
1166 printf("Cannot open file fp8 \n");
1170 for(k=0; k<fNalfap; k++){
1171 for(j=0; j<fNbep; j++){
1172 fscanf(fp5,"%f",&fTablep[0][k][j]);
1173 fscanf(fp6,"%f",&fTablep[1][k][j]);
1174 fscanf(fp7,"%f",&fTablep[2][k][j]);
1175 fscanf(fp8,"%f",&fTablep[3][k][j]);
1183 //_____________________________________________________________________________
1184 void AliZDCv2::StepManager()
1187 // Routine called at every step in the Zero Degree Calorimeters
1190 Int_t j, vol[2], ibeta=0, ialfa, ibe, nphe;
1191 Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, radius, out;
1192 Float_t xalic[3], z, GuiEff, GuiPar[4]={0.31,-0.0004,0.0197,0.7958};
1193 TLorentzVector s, p;
1196 for (j=0;j<10;j++) hits[j]=0;
1198 if((gMC->GetMedium() == fMedSensZN) || (gMC->GetMedium() == fMedSensZP) ||
1199 (gMC->GetMedium() == fMedSensGR) || (gMC->GetMedium() == fMedSensF1) ||
1200 (gMC->GetMedium() == fMedSensF2) || (gMC->GetMedium() == fMedSensZEM)){
1202 // --- This part is for no shower developement in beam pipe and TDI
1203 // (gMC->GetMedium() == fMedSensPI) || (gMC->GetMedium() == fMedSensTDI)){
1205 // If particle interacts with beam pipe -> return
1206 // if((gMC->GetMedium() == fMedSensPI) || (gMC->GetMedium() == fMedSensTDI)){
1207 // If option NoShower is set -> StopTrack
1208 // if(fNoShower==1) {
1209 // if(gMC->GetMedium() == fMedSensPI) {
1210 // knamed = gMC->CurrentVolName();
1211 // if((!strncmp(knamed,"MQ",2)) || (!strncmp(knamed,"YM",2))) fpLostIT += 1;
1212 // if((!strncmp(knamed,"MD1",3))|| (!strncmp(knamed,"YD1",2))) fpLostD1 += 1;
1214 // if(gMC->GetMedium() == fMedSensTDI) fpLostTDI += 1;
1215 // gMC->StopTrack();
1216 // printf("\n # of p lost in Inner Triplet = %d\n",fpLostIT);
1217 // printf("\n # of p lost in D1 = %d\n",fpLostD1);
1218 // printf("\n # of p lost in TDI = %d\n",fpLostTDI);
1223 //Particle coordinates
1224 gMC->TrackPosition(s);
1225 for(j=0; j<=2; j++){
1232 // Determine in which ZDC the particle is
1233 knamed = gMC->CurrentVolName();
1234 if(!strncmp(knamed,"ZN",2)){
1237 else if(!strncmp(knamed,"ZP",2)){
1240 else if(!strncmp(knamed,"ZE",2)){
1244 // Determine in which quadrant the particle is
1246 if(vol[0]==1){ //Quadrant in ZN
1247 xdet[0] = x[0]-fPosZN[0];
1248 xdet[1] = x[1]-fPosZN[1];
1249 if((xdet[0]<=0.) && (xdet[1]>=0.)) vol[1]=1;
1250 if((xdet[0]>0.) && (xdet[1]>0.)) vol[1]=2;
1251 if((xdet[0]<0.) && (xdet[1]<0.)) vol[1]=3;
1252 if((xdet[0]>0.) && (xdet[1]<0.)) vol[1]=4;
1254 else if(vol[0]==2){ //Quadrant in ZP
1255 xdet[0] = x[0]-fPosZP[0];
1256 xdet[1] = x[1]-fPosZP[1];
1257 if(xdet[0]>fDimZP[0])xdet[0]=fDimZP[0]-0.01;
1258 if(xdet[0]<-fDimZP[0])xdet[0]=-fDimZP[0]+0.01;
1259 Float_t xqZP = xdet[0]/(fDimZP[0]/2);
1260 for(int i=1; i<=4; i++){
1261 if(xqZP>=(i-3) && xqZP<(i-2)){
1267 else if(vol[0] == 3){ //ZEM has only 1 quadrant
1269 xdet[0] = x[0]-fPosZEM[0];
1270 xdet[1] = x[1]-fPosZEM[1];
1273 // Store impact point and kinetic energy of the ENTERING particle
1275 // if(Curtrack==Prim){
1276 if(gMC->IsTrackEntering()){
1278 gMC->TrackMomentum(p);
1280 // Impact point on ZDC
1288 // Int_t PcID = gMC->TrackPid();
1289 // printf("Pc ID -> %d\n",PcID);
1290 AddHit(gAlice->CurrentTrack(), vol, hits);
1295 // printf("\n # of detected p = %d\n",fpDetected);
1301 // Charged particles -> Energy loss
1302 if((destep=gMC->Edep())){
1303 if(gMC->IsTrackStop()){
1304 gMC->TrackMomentum(p);
1305 m = gMC->TrackMass();
1310 AddHit(gAlice->CurrentTrack(), vol, hits);
1316 AddHit(gAlice->CurrentTrack(), vol, hits);
1318 // printf(" Dep. E = %f \n",hits[9]);
1320 }// NB -> Questa parentesi (chiude il primo IF) io la sposterei al fondo!???
1323 // *** Light production in fibres
1324 if((gMC->GetMedium() == fMedSensF1) || (gMC->GetMedium() == fMedSensF2)){
1326 //Select charged particles
1327 if((destep=gMC->Edep())){
1329 // Particle velocity
1330 gMC->TrackMomentum(p);
1331 Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
1332 Float_t beta = ptot/p[3];
1336 else if((beta>=0.67) && (beta<=0.75)){
1339 if((beta>0.75) && (beta<=0.85)){
1342 if((beta>0.85) && (beta<=0.95)){
1349 // Angle between particle trajectory and fibre axis
1350 // 1 -> Momentum directions
1354 gMC->Gmtod(um,ud,2);
1355 // 2 -> Angle < limit angle
1356 Double_t alfar = TMath::ACos(ud[2]);
1357 Double_t alfa = alfar*kRaddeg;
1358 if(alfa>=110.) return;
1359 ialfa = Int_t(1.+alfa/2.);
1361 // Distance between particle trajectory and fibre axis
1362 gMC->TrackPosition(s);
1363 for(j=0; j<=2; j++){
1366 gMC->Gmtod(x,xdet,1);
1367 if(TMath::Abs(ud[0])>0.00001){
1368 Float_t dcoeff = ud[1]/ud[0];
1369 be = TMath::Abs((xdet[1]-dcoeff*xdet[0])/TMath::Sqrt(dcoeff*dcoeff+1.));
1372 be = TMath::Abs(ud[0]);
1378 else if((vol[0]==2)){
1381 ibe = Int_t(be*1000.+1);
1383 //Looking into the light tables
1384 Float_t charge = gMC->TrackCharge();
1386 if((vol[0]==1)) { // (1) ZN fibres
1387 if(ibe>fNben) ibe=fNben;
1388 out = charge*charge*fTablen[ibeta][ialfa][ibe];
1389 nphe = gRandom->Poisson(out);
1390 // printf("ZN --- ibeta = %d, ialfa = %d, ibe = %d"
1391 // " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
1392 if(gMC->GetMedium() == fMedSensF1){
1393 hits[7] = nphe; //fLightPMQ
1396 AddHit(gAlice->CurrentTrack(), vol, hits);
1400 hits[8] = nphe; //fLightPMC
1402 AddHit(gAlice->CurrentTrack(), vol, hits);
1405 else if((vol[0]==2)) { // (2) ZP fibres
1406 if(ibe>fNbep) ibe=fNbep;
1407 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1408 nphe = gRandom->Poisson(out);
1409 // printf("ZP --- ibeta = %d, ialfa = %d, ibe = %d"
1410 // " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
1411 if(gMC->GetMedium() == fMedSensF1){
1412 hits[7] = nphe; //fLightPMQ
1415 AddHit(gAlice->CurrentTrack(), vol, hits);
1419 hits[8] = nphe; //fLightPMC
1421 AddHit(gAlice->CurrentTrack(), vol, hits);
1424 else if((vol[0]==3)) { // (3) ZEM fibres
1425 if(ibe>fNbep) ibe=fNbep;
1426 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1427 gMC->TrackPosition(s);
1428 for(j=0; j<=2; j++){
1431 // z-coordinate from ZEM front face
1432 // NB-> fPosZEM[2]+fZEMLength = -1000.+2*10.3 = 979.69 cm
1433 z = -xalic[2]+fPosZEM[2]+2*fZEMLength-xalic[1];
1434 // z = xalic[2]-fPosZEM[2]-fZEMLength-xalic[1]*(TMath::Tan(45.*kDegrad));
1435 // printf("\n fPosZEM[2]+2*fZEMLength = %f", fPosZEM[2]+2*fZEMLength);
1436 GuiEff = GuiPar[0]*(GuiPar[1]*z*z+GuiPar[2]*z+GuiPar[3]);
1437 // printf("\n xalic[0] = %f xalic[1] = %f xalic[2] = %f z = %f \n",
1438 // xalic[0],xalic[1],xalic[2],z);
1440 nphe = gRandom->Poisson(out);
1441 // printf(" out*GuiEff = %f nphe = %d", out, nphe);
1442 // printf("ZEM --- ibeta = %d, ialfa = %d, ibe = %d"
1443 // " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
1445 hits[8] = nphe; //fLightPMC
1447 AddHit(gAlice->CurrentTrack(), vol, hits);