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 **************************************************************************/
17 ///////////////////////////////////////////////////////////////////////
19 // AliZDCv2 --- new ZDC geometry //
20 // with the EM ZDC at about 10 m from IP //
21 // Just one set of ZDC is inserted //
22 // (on the same side of the dimuon arm realtive to IP) //
23 // Compensator in ZDC geometry (Nov. 2004) //
25 ///////////////////////////////////////////////////////////////////////
27 // --- Standard libraries
32 #include <TLorentzVector.h>
38 #include <TVirtualMC.h>
40 // --- AliRoot classes
42 #include "AliDetector.h"
46 #include "AliZDCHit.h"
53 //_____________________________________________________________________________
54 AliZDCv2::AliZDCv2() : AliZDC()
57 // Default constructor for Zero Degree Calorimeter
69 //_____________________________________________________________________________
70 AliZDCv2::AliZDCv2(const char *name, const char *title)
74 // Standard constructor for Zero Degree Calorimeter
77 // Check that DIPO, ABSO, DIPO and SHIL is there (otherwise tracking is wrong!!!)
79 AliModule* pipe=gAlice->GetModule("PIPE");
80 AliModule* abso=gAlice->GetModule("ABSO");
81 AliModule* dipo=gAlice->GetModule("DIPO");
82 AliModule* shil=gAlice->GetModule("SHIL");
83 if((!pipe) || (!abso) || (!dipo) || (!shil)) {
84 Error("Constructor","ZDC needs PIPE, ABSO, DIPO and SHIL!!!\n");
98 // Parameters for light tables
99 fNalfan = 90; // Number of Alfa (neutrons)
100 fNalfap = 90; // Number of Alfa (protons)
101 fNben = 18; // Number of beta (neutrons)
102 fNbep = 28; // Number of beta (protons)
104 for(ip=0; ip<4; ip++){
105 for(kp=0; kp<fNalfap; kp++){
106 for(jp=0; jp<fNbep; jp++){
107 fTablep[ip][kp][jp] = 0;
112 for(in=0; in<4; in++){
113 for(kn=0; kn<fNalfan; kn++){
114 for(jn=0; jn<fNben; jn++){
115 fTablen[in][kn][jn] = 0;
120 // Parameters for hadronic calorimeters geometry
140 // Parameters for EM calorimeter geometry
148 //_____________________________________________________________________________
149 void AliZDCv2::CreateGeometry()
152 // Create the geometry for the Zero Degree Calorimeter version 2
153 //* Initialize COMMON block ZDC_CGEOM
160 //_____________________________________________________________________________
161 void AliZDCv2::CreateBeamLine()
164 // Create the beam line elements
167 Float_t zc, zq, zd1, zd2;
168 Float_t conpar[9], tubpar[3], tubspar[5], boxpar[3];
171 Int_t *idtmed = fIdtmed->GetArray();
173 // -- Mother of the ZDCs (Vacuum PCON)
174 // zd1 = 2092.; // (Without compensator in ZDC geometry)
186 gMC->Gsvolu("ZDC ", "PCON", idtmed[11], conpar, 9);
187 gMC->Gspos("ZDC ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
189 // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to
190 // the beginning of D1)
193 // From beginning of ZDC volumes to beginning of D1
194 tubpar[2] = (5838.3-zd1)/2.;
195 gMC->Gsvolu("QT01", "TUBE", idtmed[7], tubpar, 3);
196 gMC->Gspos("QT01", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
198 //printf("\n QT01 TUBE pipe from z = %f to z= %f (D1 beg.)\n",-zd1,-2*tubpar[2]-zd1);
200 //-- SECOND SECTION OF THE BEAM PIPE (from the end of D1 to the
203 //-- FROM MAGNETIC BEGINNING OF D1 TO MAGNETIC END OF D1 + 13.5 cm
204 //-- Cylindrical pipe (r = 3.47) + conical flare
206 // -> Beginning of D1
210 tubpar[1] = 3.47+0.2;
211 tubpar[2] = 958.5/2.;
212 gMC->Gsvolu("QT02", "TUBE", idtmed[7], tubpar, 3);
213 gMC->Gspos("QT02", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
215 //printf("\n QT02 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
224 gMC->Gsvolu("QC01", "CONE", idtmed[7], conpar, 5);
225 gMC->Gspos("QC01", 1, "ZDC ", 0., 0., -conpar[0]-zd1, 0, "ONLY");
227 //printf("\n QC01 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
234 gMC->Gsvolu("QT03", "TUBE", idtmed[7], tubpar, 3);
235 gMC->Gspos("QT03", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
237 //printf("\n QT03 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
244 gMC->Gsvolu("QT04", "TUBE", idtmed[7], tubpar, 3);
245 gMC->Gspos("QT04", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
247 //printf("\n QT04 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
249 zd1 += tubpar[2] * 2.;
254 gMC->Gsvolu("QT05", "TUBE", idtmed[7], tubpar, 3);
255 gMC->Gspos("QT05", 1, "ZDC ", 0., 0., -tubpar[0]-zd1, 0, "ONLY");
257 //printf("\n QT05 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
259 zd1 += tubpar[2] * 2.;
264 gMC->Gsvolu("QT06", "TUBE", idtmed[7], tubpar, 3);
265 gMC->Gspos("QT06", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
267 //printf("\n QT06 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
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 //printf("\n QC02 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
281 zd1 += conpar[0] * 2.;
286 gMC->Gsvolu("QT07", "TUBE", idtmed[7], tubpar, 3);
287 gMC->Gspos("QT07", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
289 //printf("\n QT07 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
291 zd1 += tubpar[2] * 2.;
298 gMC->Gsvolu("QC03", "CONE", idtmed[7], conpar, 5);
299 gMC->Gspos("QC03", 1, "ZDC ", 0., 0., -conpar[0]-zd1, 0, "ONLY");
301 //printf("\n QC03 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
303 zd1 += conpar[0] * 2.;
307 tubpar[2] = 205.8/2.;
308 gMC->Gsvolu("QT08", "TUBE", idtmed[7], tubpar, 3);
309 gMC->Gspos("QT08", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
311 //printf("\n QT08 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
313 zd1 += tubpar[2] * 2.;
317 // QT09 is 10 cm longer to accomodate TDI
318 tubpar[2] = 515.4/2.;
319 gMC->Gsvolu("QT09", "TUBE", idtmed[7], tubpar, 3);
320 gMC->Gspos("QT09", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
322 //printf("\n QT09 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
324 // --- Insert TDI (inside ZDC volume)
328 gMC->Gsvolu("QTD1", "BOX ", idtmed[7], boxpar, 3);
329 gMC->Gspos("QTD1", 1, "ZDC ", -3., 10.6, -tubpar[2]-zd1-56.3, 0, "ONLY");
330 gMC->Gspos("QTD1", 2, "ZDC ", -3., -10.6, -tubpar[2]-zd1-56.3, 0, "ONLY");
335 gMC->Gsvolu("QTD2", "BOX ", idtmed[6], boxpar, 3);
336 gMC->Gspos("QTD2", 1, "ZDC ", -8.6-boxpar[0], 0., -tubpar[2]-zd1-56.3, 0, "ONLY");
338 tubspar[0] = 10.5; // R = 10.5 cm------------------------------------------
340 tubspar[2] = 400./2.;
341 tubspar[3] = 360.-75.5;
343 gMC->Gsvolu("QTD3", "TUBS", idtmed[6], tubspar, 5);
344 gMC->Gspos("QTD3", 1, "ZDC ", 0., 0., -tubpar[2]-zd1-56.3, 0, "ONLY");
346 //printf("\n TDI volume from z = %f to z= %f\n",-tubpar[2]-zd1-56.3,-tubpar[2]-zd1-56.3-400.);
348 zd1 += tubpar[2] * 2.;
352 // QT10 is 10 cm shorter
354 gMC->Gsvolu("QT10", "TUBE", idtmed[7], tubpar, 3);
355 gMC->Gspos("QT10", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
357 //printf("\n QT10 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
359 zd1 += tubpar[2] * 2.;
363 tubpar[2] = 778.5/2.;
364 gMC->Gsvolu("QT11", "TUBE", idtmed[7], tubpar, 3);
365 gMC->Gspos("QT11", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
367 //printf("\n QT11 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
369 zd1 += tubpar[2] * 2.;
371 conpar[0] = 14.18/2.;
376 gMC->Gsvolu("QC04", "CONE", idtmed[7], conpar, 5);
377 gMC->Gspos("QC04", 1, "ZDC ", 0., 0., -conpar[0]-zd1, 0, "ONLY");
379 //printf("\n QC04 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
381 zd1 += conpar[0] * 2.;
386 gMC->Gsvolu("QT12", "TUBE", idtmed[7], tubpar, 3);
387 gMC->Gspos("QT12", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
389 //printf("\n QT12 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
391 zd1 += tubpar[2] * 2.;
393 conpar[0] = 36.86/2.;
398 gMC->Gsvolu("QC05", "CONE", idtmed[7], conpar, 5);
399 gMC->Gspos("QC05", 1, "ZDC ", 0., 0., -conpar[0]-zd1, 0, "ONLY");
401 //printf("\n QC05 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
403 zd1 += conpar[0] * 2.;
407 tubpar[2] = 927.3/2.;
408 gMC->Gsvolu("QT13", "TUBE", idtmed[7], tubpar, 3);
409 gMC->Gspos("QT13", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
411 //printf("\n QT13 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
413 zd1 += tubpar[2] * 2.;
418 gMC->Gsvolu("QT14", "TUBE", idtmed[8], tubpar, 3);
419 gMC->Gspos("QT14", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
421 //printf("\n QT14 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
423 zd1 += tubpar[2] * 2.;
428 gMC->Gsvolu("QT15", "TUBE", idtmed[11], tubpar, 3);
429 //-- Position QT15 inside QT14
430 gMC->Gspos("QT15", 1, "QT14", -7.7, 0., 0., 0, "ONLY");
432 gMC->Gsvolu("QT16", "TUBE", idtmed[11], tubpar, 3);
433 //-- Position QT16 inside QT14
434 gMC->Gspos("QT16", 1, "QT14", 7.7, 0., 0., 0, "ONLY");
437 //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2
441 tubpar[2] = 680.8/2.;
442 gMC->Gsvolu("QT17", "TUBE", idtmed[7], tubpar, 3);
446 tubpar[2] = 680.8/2.;
447 gMC->Gsvolu("QT18", "TUBE", idtmed[7], tubpar, 3);
450 Float_t angle = 0.143*kDegrad; // Rotation angle
452 AliMatrix(im1, 90.+0.143, 0., 90., 90., 0.143, 180.); // x<0
453 gMC->Gspos("QT17", 1, "ZDC ", TMath::Sin(angle) * 680.8/ 2. - 9.4,
454 0., -tubpar[2]-zd1, im1, "ONLY");
456 AliMatrix(im2, 90.-0.143, 0., 90., 90., 0.143, 0.); // x>0 (ZP)
457 gMC->Gspos("QT18", 1, "ZDC ", 9.7 - TMath::Sin(angle) * 680.8 / 2.,
458 0., -tubpar[2]-zd1, im2, "ONLY");
460 // -- END OF BEAM PIPE VOLUME DEFINITION.
461 // ----------------------------------------------------------------
463 // ----------------------------------------------------------------
464 // -- MAGNET DEFINITION -> LHC OPTICS 6.5
465 // ----------------------------------------------------------------
466 // -- COMPENSATOR DIPOLE (MBXW)
469 // -- GAP (VACUUM WITH MAGNETIC FIELD)
473 gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3);
479 gMC->Gsvolu("YMBX", "TUBE", idtmed[7], tubpar, 3);
481 gMC->Gspos("MBXW", 1, "ZDC ", 0., 0., -tubpar[2]-zc, 0, "ONLY");
482 gMC->Gspos("YMBX", 1, "ZDC ", 0., 0., -tubpar[2]-zc, 0, "ONLY");
488 // -- DEFINE MQXL AND MQX QUADRUPOLE ELEMENT
490 // -- GAP (VACUUM WITH MAGNETIC FIELD)
494 gMC->Gsvolu("MCBW", "TUBE", idtmed[11], tubpar, 3);
500 gMC->Gsvolu("YMQL", "TUBE", idtmed[7], tubpar, 3);
502 gMC->Gspos("MQXL", 1, "ZDC ", 0., 0., -tubpar[2]-zq, 0, "ONLY");
503 gMC->Gspos("YMQL", 1, "ZDC ", 0., 0., -tubpar[2]-zq, 0, "ONLY");
505 gMC->Gspos("MQXL", 2, "ZDC ", 0., 0., -tubpar[2]-zq-2430., 0, "ONLY");
506 gMC->Gspos("YMQL", 2, "ZDC ", 0., 0., -tubpar[2]-zq-2430., 0, "ONLY");
509 // -- GAP (VACUUM WITH MAGNETIC FIELD)
513 gMC->Gsvolu("MQX ", "TUBE", idtmed[11], tubpar, 3);
519 gMC->Gsvolu("YMQ ", "TUBE", idtmed[7], tubpar, 3);
521 gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., -tubpar[2]-zq-908.5, 0, "ONLY");
522 gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., -tubpar[2]-zq-908.5, 0, "ONLY");
524 gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., -tubpar[2]-zq-1558.5, 0, "ONLY");
525 gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., -tubpar[2]-zq-1558.5, 0, "ONLY");
527 // -- SEPARATOR DIPOLE D1
530 // -- GAP (VACUUM WITH MAGNETIC FIELD)
534 gMC->Gsvolu("MD1 ", "TUBE", idtmed[11], tubpar, 3);
536 // -- Insert horizontal Cu plates inside D1
537 // -- (to simulate the vacuum chamber)
538 boxpar[0] = TMath::Sqrt(tubpar[1]*tubpar[1]-(2.98+0.2)*(2.98+0.2)) - 0.05;
541 gMC->Gsvolu("MD1V", "BOX ", idtmed[6], boxpar, 3);
542 gMC->Gspos("MD1V", 1, "MD1 ", 0., 2.98+boxpar[1], 0., 0, "ONLY");
543 gMC->Gspos("MD1V", 2, "MD1 ", 0., -2.98-boxpar[1], 0., 0, "ONLY");
549 gMC->Gsvolu("YD1 ", "TUBE", idtmed[7], tubpar, 3);
551 gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
552 gMC->Gspos("MD1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
555 // --- LHC optics v6.4
558 // -- GAP (VACUUM WITH MAGNETIC FIELD)
562 gMC->Gsvolu("MD2 ", "TUBE", idtmed[11], tubpar, 3);
568 gMC->Gsvolu("YD2 ", "TUBE", idtmed[7], tubpar, 3);
570 gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., -tubpar[2]-zd2, 0, "ONLY");
572 gMC->Gspos("MD2 ", 1, "YD2 ", -9.4, 0., 0., 0, "ONLY");
573 gMC->Gspos("MD2 ", 2, "YD2 ", 9.4, 0., 0., 0, "ONLY");
575 // -- END OF MAGNET DEFINITION
578 //_____________________________________________________________________________
579 void AliZDCv2::CreateZDC()
582 // Create the various ZDCs (ZN + ZP)
585 Float_t dimPb[6], dimVoid[6];
587 Int_t *idtmed = fIdtmed->GetArray();
589 // Parameters for hadronic calorimeters geometry
590 // NB -> parameters used ONLY in CreateZDC()
591 Float_t fGrvZN[3] = {0.03, 0.03, 50.}; // Grooves for neutron detector
592 Float_t fGrvZP[3] = {0.04, 0.04, 75.}; // Grooves for proton detector
593 Int_t fDivZN[3] = {11, 11, 0}; // Division for neutron detector
594 Int_t fDivZP[3] = {7, 15, 0}; // Division for proton detector
595 Int_t fTowZN[2] = {2, 2}; // Tower for neutron detector
596 Int_t fTowZP[2] = {4, 1}; // Tower for proton detector
598 // Parameters for EM calorimeter geometry
599 // NB -> parameters used ONLY in CreateZDC()
600 Float_t fDimZEMPb = 0.15*(TMath::Sqrt(2.)); // z-dimension of the Pb slice
601 Float_t fDimZEMAir = 0.001; // scotch
602 Float_t fFibRadZEM = 0.0315; // External fiber radius (including cladding)
603 Int_t fDivZEM[3] = {92, 0, 20}; // Divisions for EM detector
604 Float_t fDimZEM0 = 2*fDivZEM[2]*(fDimZEMPb+fDimZEMAir+fFibRadZEM*(TMath::Sqrt(2.)));
605 fZEMLength = fDimZEM0;
606 Float_t fDimZEM[6] = {fDimZEM0, 3.5, 3.5, 45., 0., 0.}; // Dimensions of EM detector
607 Float_t fFibZEM2 = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-fFibRadZEM;
608 Float_t fFibZEM[3] = {0., 0.0275, fFibZEM2}; // Fibers for EM calorimeter
611 //-- Create calorimeters geometry
613 // -------------------------------------------------------------------------------
614 //--> Neutron calorimeter (ZN)
616 gMC->Gsvolu("ZNEU", "BOX ", idtmed[1], fDimZN, 3); // Passive material
617 gMC->Gsvolu("ZNF1", "TUBE", idtmed[3], fFibZN, 3); // Active material
618 gMC->Gsvolu("ZNF2", "TUBE", idtmed[4], fFibZN, 3);
619 gMC->Gsvolu("ZNF3", "TUBE", idtmed[4], fFibZN, 3);
620 gMC->Gsvolu("ZNF4", "TUBE", idtmed[3], fFibZN, 3);
621 gMC->Gsvolu("ZNG1", "BOX ", idtmed[12], fGrvZN, 3); // Empty grooves
622 gMC->Gsvolu("ZNG2", "BOX ", idtmed[12], fGrvZN, 3);
623 gMC->Gsvolu("ZNG3", "BOX ", idtmed[12], fGrvZN, 3);
624 gMC->Gsvolu("ZNG4", "BOX ", idtmed[12], fGrvZN, 3);
626 // Divide ZNEU in towers (for hits purposes)
628 gMC->Gsdvn("ZNTX", "ZNEU", fTowZN[0], 1); // x-tower
629 gMC->Gsdvn("ZN1 ", "ZNTX", fTowZN[1], 2); // y-tower
631 //-- Divide ZN1 in minitowers
632 // fDivZN[0]= NUMBER OF FIBERS PER TOWER ALONG X-AXIS,
633 // fDivZN[1]= NUMBER OF FIBERS PER TOWER ALONG Y-AXIS
634 // (4 fibres per minitower)
636 gMC->Gsdvn("ZNSL", "ZN1 ", fDivZN[1], 2); // Slices
637 gMC->Gsdvn("ZNST", "ZNSL", fDivZN[0], 1); // Sticks
639 // --- Position the empty grooves in the sticks (4 grooves per stick)
640 Float_t dx = fDimZN[0] / fDivZN[0] / 4.;
641 Float_t dy = fDimZN[1] / fDivZN[1] / 4.;
643 gMC->Gspos("ZNG1", 1, "ZNST", 0.-dx, 0.+dy, 0., 0, "ONLY");
644 gMC->Gspos("ZNG2", 1, "ZNST", 0.+dx, 0.+dy, 0., 0, "ONLY");
645 gMC->Gspos("ZNG3", 1, "ZNST", 0.-dx, 0.-dy, 0., 0, "ONLY");
646 gMC->Gspos("ZNG4", 1, "ZNST", 0.+dx, 0.-dy, 0., 0, "ONLY");
648 // --- Position the fibers in the grooves
649 gMC->Gspos("ZNF1", 1, "ZNG1", 0., 0., 0., 0, "ONLY");
650 gMC->Gspos("ZNF2", 1, "ZNG2", 0., 0., 0., 0, "ONLY");
651 gMC->Gspos("ZNF3", 1, "ZNG3", 0., 0., 0., 0, "ONLY");
652 gMC->Gspos("ZNF4", 1, "ZNG4", 0., 0., 0., 0, "ONLY");
654 // --- Position the neutron calorimeter in ZDC
655 gMC->Gspos("ZNEU", 1, "ZDC ", fPosZN[0], fPosZN[1], fPosZN[2]-fDimZN[2], 0, "ONLY");
657 //printf("\n ZN -> %f < z < %f cm\n",fPosZN[2],fPosZN[2]-2*fDimZN[2]);
659 // -------------------------------------------------------------------------------
660 //--> Proton calorimeter (ZP)
662 gMC->Gsvolu("ZPRO", "BOX ", idtmed[2], fDimZP, 3); // Passive material
663 gMC->Gsvolu("ZPF1", "TUBE", idtmed[3], fFibZP, 3); // Active material
664 gMC->Gsvolu("ZPF2", "TUBE", idtmed[4], fFibZP, 3);
665 gMC->Gsvolu("ZPF3", "TUBE", idtmed[4], fFibZP, 3);
666 gMC->Gsvolu("ZPF4", "TUBE", idtmed[3], fFibZP, 3);
667 gMC->Gsvolu("ZPG1", "BOX ", idtmed[12], fGrvZP, 3); // Empty grooves
668 gMC->Gsvolu("ZPG2", "BOX ", idtmed[12], fGrvZP, 3);
669 gMC->Gsvolu("ZPG3", "BOX ", idtmed[12], fGrvZP, 3);
670 gMC->Gsvolu("ZPG4", "BOX ", idtmed[12], fGrvZP, 3);
672 //-- Divide ZPRO in towers(for hits purposes)
674 gMC->Gsdvn("ZPTX", "ZPRO", fTowZP[0], 1); // x-tower
675 gMC->Gsdvn("ZP1 ", "ZPTX", fTowZP[1], 2); // y-tower
678 //-- Divide ZP1 in minitowers
679 // fDivZP[0]= NUMBER OF FIBERS ALONG X-AXIS PER MINITOWER,
680 // fDivZP[1]= NUMBER OF FIBERS ALONG Y-AXIS PER MINITOWER
681 // (4 fiber per minitower)
683 gMC->Gsdvn("ZPSL", "ZP1 ", fDivZP[1], 2); // Slices
684 gMC->Gsdvn("ZPST", "ZPSL", fDivZP[0], 1); // Sticks
686 // --- Position the empty grooves in the sticks (4 grooves per stick)
687 dx = fDimZP[0] / fTowZP[0] / fDivZP[0] / 2.;
688 dy = fDimZP[1] / fTowZP[1] / fDivZP[1] / 2.;
690 gMC->Gspos("ZPG1", 1, "ZPST", 0.-dx, 0.+dy, 0., 0, "ONLY");
691 gMC->Gspos("ZPG2", 1, "ZPST", 0.+dx, 0.+dy, 0., 0, "ONLY");
692 gMC->Gspos("ZPG3", 1, "ZPST", 0.-dx, 0.-dy, 0., 0, "ONLY");
693 gMC->Gspos("ZPG4", 1, "ZPST", 0.+dx, 0.-dy, 0., 0, "ONLY");
695 // --- Position the fibers in the grooves
696 gMC->Gspos("ZPF1", 1, "ZPG1", 0., 0., 0., 0, "ONLY");
697 gMC->Gspos("ZPF2", 1, "ZPG2", 0., 0., 0., 0, "ONLY");
698 gMC->Gspos("ZPF3", 1, "ZPG3", 0., 0., 0., 0, "ONLY");
699 gMC->Gspos("ZPF4", 1, "ZPG4", 0., 0., 0., 0, "ONLY");
702 // --- Position the proton calorimeter in ZDC
703 gMC->Gspos("ZPRO", 1, "ZDC ", fPosZP[0], fPosZP[1], fPosZP[2]-fDimZP[2], 0, "ONLY");
705 //printf("\n ZP -> %f < z < %f cm\n",fPosZP[2],fPosZP[2]-2*fDimZP[2]);
708 // -------------------------------------------------------------------------------
709 // -> EM calorimeter (ZEM)
711 gMC->Gsvolu("ZEM ", "PARA", idtmed[10], fDimZEM, 6);
714 gMC->Matrix(irot1,0.,0.,90.,90.,-90.,0.); // Rotation matrix 1
715 gMC->Matrix(irot2,180.,0.,90.,fDimZEM[3]+90.,90.,fDimZEM[3]);// Rotation matrix 2
716 //printf("irot1 = %d, irot2 = %d \n", irot1, irot2);
718 gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material
720 gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches
722 dimPb[0] = fDimZEMPb; // Lead slices
723 dimPb[1] = fDimZEM[2];
724 dimPb[2] = fDimZEM[1];
725 //dimPb[3] = fDimZEM[3]; //controllare
726 dimPb[3] = 90.-fDimZEM[3]; //originale
729 gMC->Gsvolu("ZEL0", "PARA", idtmed[5], dimPb, 6);
730 gMC->Gsvolu("ZEL1", "PARA", idtmed[5], dimPb, 6);
731 gMC->Gsvolu("ZEL2", "PARA", idtmed[5], dimPb, 6);
733 // --- Position the lead slices in the tranche
734 Float_t zTran = fDimZEM[0]/fDivZEM[2];
735 Float_t zTrPb = -zTran+fDimZEMPb;
736 gMC->Gspos("ZEL0", 1, "ZETR", zTrPb, 0., 0., 0, "ONLY");
737 gMC->Gspos("ZEL1", 1, "ZETR", fDimZEMPb, 0., 0., 0, "ONLY");
739 // --- Vacuum zone (to be filled with fibres)
740 dimVoid[0] = (zTran-2*fDimZEMPb)/2.;
741 dimVoid[1] = fDimZEM[2];
742 dimVoid[2] = fDimZEM[1];
743 dimVoid[3] = 90.-fDimZEM[3];
746 gMC->Gsvolu("ZEV0", "PARA", idtmed[10], dimVoid,6);
747 gMC->Gsvolu("ZEV1", "PARA", idtmed[10], dimVoid,6);
749 // --- Divide the vacuum slice into sticks along x axis
750 gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3);
751 gMC->Gsdvn("ZES1", "ZEV1", fDivZEM[0], 3);
753 // --- Positioning the fibers into the sticks
754 gMC->Gspos("ZEMF", 1,"ZES0", 0., 0., 0., irot2, "ONLY");
755 gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY");
757 // --- Positioning the vacuum slice into the tranche
758 Float_t displFib = fDimZEM[1]/fDivZEM[0];
759 gMC->Gspos("ZEV0", 1,"ZETR", -dimVoid[0], 0., 0., 0, "ONLY");
760 gMC->Gspos("ZEV1", 1,"ZETR", -dimVoid[0]+zTran, 0., displFib, 0, "ONLY");
762 // --- Positioning the ZEM into the ZDC - rotation for 90 degrees
763 // NB -> In AliZDCv2 ZEM is positioned in ALIC (instead of in ZDC) volume
764 // beacause it's impossible to make a ZDC pcon volume to contain
765 // both hadronics and EM calorimeters.
766 gMC->Gspos("ZEM ", 1,"ALIC", -fPosZEM[0], fPosZEM[1], fPosZEM[2]+fDimZEM[0], irot1, "ONLY");
768 // Second EM ZDC (same side w.r.t. IP, just on the other side w.r.t. beam pipe)
769 gMC->Gspos("ZEM ", 2,"ALIC", fPosZEM[0], fPosZEM[1], fPosZEM[2]+fDimZEM[0], irot1, "ONLY");
771 // --- Adding last slice at the end of the EM calorimeter
772 Float_t zLastSlice = fPosZEM[2]+fDimZEMPb+2*fDimZEM[0];
773 gMC->Gspos("ZEL2", 1,"ALIC", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY");
775 //printf("\n ZEM lenght = %f cm\n",2*fZEMLength);
776 //printf("\n ZEM -> %f < z < %f cm\n",fPosZEM[2],fPosZEM[2]+2*fZEMLength+zLastSlice+fDimZEMPb);
780 //_____________________________________________________________________________
781 void AliZDCv2::DrawModule() const
784 // Draw a shaded view of the Zero Degree Calorimeter version 1
787 // Set everything unseen
788 gMC->Gsatt("*", "seen", -1);
790 // Set ALIC mother transparent
791 gMC->Gsatt("ALIC","SEEN",0);
793 // Set the volumes visible
794 gMC->Gsatt("ZDC ","SEEN",0);
795 gMC->Gsatt("QT01","SEEN",1);
796 gMC->Gsatt("QT02","SEEN",1);
797 gMC->Gsatt("QT03","SEEN",1);
798 gMC->Gsatt("QT04","SEEN",1);
799 gMC->Gsatt("QT05","SEEN",1);
800 gMC->Gsatt("QT06","SEEN",1);
801 gMC->Gsatt("QT07","SEEN",1);
802 gMC->Gsatt("QT08","SEEN",1);
803 gMC->Gsatt("QT09","SEEN",1);
804 gMC->Gsatt("QT10","SEEN",1);
805 gMC->Gsatt("QT11","SEEN",1);
806 gMC->Gsatt("QT12","SEEN",1);
807 gMC->Gsatt("QT13","SEEN",1);
808 gMC->Gsatt("QT14","SEEN",1);
809 gMC->Gsatt("QT15","SEEN",1);
810 gMC->Gsatt("QT16","SEEN",1);
811 gMC->Gsatt("QT17","SEEN",1);
812 gMC->Gsatt("QT18","SEEN",1);
813 gMC->Gsatt("QC01","SEEN",1);
814 gMC->Gsatt("QC02","SEEN",1);
815 gMC->Gsatt("QC03","SEEN",1);
816 gMC->Gsatt("QC04","SEEN",1);
817 gMC->Gsatt("QC05","SEEN",1);
818 gMC->Gsatt("QTD1","SEEN",1);
819 gMC->Gsatt("QTD2","SEEN",1);
820 gMC->Gsatt("QTD3","SEEN",1);
821 gMC->Gsatt("MQXL","SEEN",1);
822 gMC->Gsatt("YMQL","SEEN",1);
823 gMC->Gsatt("MQX ","SEEN",1);
824 gMC->Gsatt("YMQ ","SEEN",1);
825 gMC->Gsatt("ZQYX","SEEN",1);
826 gMC->Gsatt("MD1 ","SEEN",1);
827 gMC->Gsatt("MD1V","SEEN",1);
828 gMC->Gsatt("YD1 ","SEEN",1);
829 gMC->Gsatt("MD2 ","SEEN",1);
830 gMC->Gsatt("YD2 ","SEEN",1);
831 gMC->Gsatt("ZNEU","SEEN",0);
832 gMC->Gsatt("ZNF1","SEEN",0);
833 gMC->Gsatt("ZNF2","SEEN",0);
834 gMC->Gsatt("ZNF3","SEEN",0);
835 gMC->Gsatt("ZNF4","SEEN",0);
836 gMC->Gsatt("ZNG1","SEEN",0);
837 gMC->Gsatt("ZNG2","SEEN",0);
838 gMC->Gsatt("ZNG3","SEEN",0);
839 gMC->Gsatt("ZNG4","SEEN",0);
840 gMC->Gsatt("ZNTX","SEEN",0);
841 gMC->Gsatt("ZN1 ","COLO",4);
842 gMC->Gsatt("ZN1 ","SEEN",1);
843 gMC->Gsatt("ZNSL","SEEN",0);
844 gMC->Gsatt("ZNST","SEEN",0);
845 gMC->Gsatt("ZPRO","SEEN",0);
846 gMC->Gsatt("ZPF1","SEEN",0);
847 gMC->Gsatt("ZPF2","SEEN",0);
848 gMC->Gsatt("ZPF3","SEEN",0);
849 gMC->Gsatt("ZPF4","SEEN",0);
850 gMC->Gsatt("ZPG1","SEEN",0);
851 gMC->Gsatt("ZPG2","SEEN",0);
852 gMC->Gsatt("ZPG3","SEEN",0);
853 gMC->Gsatt("ZPG4","SEEN",0);
854 gMC->Gsatt("ZPTX","SEEN",0);
855 gMC->Gsatt("ZP1 ","COLO",6);
856 gMC->Gsatt("ZP1 ","SEEN",1);
857 gMC->Gsatt("ZPSL","SEEN",0);
858 gMC->Gsatt("ZPST","SEEN",0);
859 gMC->Gsatt("ZEM ","COLO",7);
860 gMC->Gsatt("ZEM ","SEEN",1);
861 gMC->Gsatt("ZEMF","SEEN",0);
862 gMC->Gsatt("ZETR","SEEN",0);
863 gMC->Gsatt("ZEL0","SEEN",0);
864 gMC->Gsatt("ZEL1","SEEN",0);
865 gMC->Gsatt("ZEL2","SEEN",0);
866 gMC->Gsatt("ZEV0","SEEN",0);
867 gMC->Gsatt("ZEV1","SEEN",0);
868 gMC->Gsatt("ZES0","SEEN",0);
869 gMC->Gsatt("ZES1","SEEN",0);
872 gMC->Gdopt("hide", "on");
873 gMC->Gdopt("shad", "on");
874 gMC->Gsatt("*", "fill", 7);
875 gMC->SetClipBox(".");
876 gMC->SetClipBox("*", 0, 100, -100, 100, 12000, 16000);
878 gMC->Gdraw("alic", 40, 30, 0, 488, 220, .07, .07);
879 gMC->Gdhead(1111, "Zero Degree Calorimeter Version 1");
880 gMC->Gdman(18, 4, "MAN");
883 //_____________________________________________________________________________
884 void AliZDCv2::CreateMaterials()
887 // Create Materials for the Zero Degree Calorimeter
890 Int_t *idtmed = fIdtmed->GetArray();
892 Float_t dens, ubuf[1], wmat[2], a[2], z[2], deemax = -1;
895 // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3
897 // --- Tantalum -> ZN passive material
899 AliMaterial(1, "TANT", 180.95, 73., 16.65, .4, 11.9, ubuf, 1);
903 // AliMaterial(1, "TUNG", 183.85, 74., 19.3, .35, 10.3, ubuf, 1);
905 // --- Brass (CuZn) -> ZP passive material
913 AliMixture(2, "BRASS ", a, z, dens, 2, wmat);
923 AliMixture(3, "SIO2 ", a, z, dens, -2, wmat);
927 AliMaterial(5, "LEAD", 207.19, 82., 11.35, .56, 18.5, ubuf, 1);
931 AliMaterial(6, "COPP", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
933 // --- Iron (energy loss taken into account)
935 AliMaterial(7, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
937 // --- Iron (no energy loss)
939 AliMaterial(8, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
941 // --- Vacuum (no magnetic field)
942 AliMaterial(10, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
944 // --- Vacuum (with magnetic field)
945 AliMaterial(11, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
947 // --- Air (no magnetic field)
948 AliMaterial(12, "Air $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0);
950 // --- Definition of tracking media:
952 // --- Tantalum = 1 ;
954 // --- Fibers (SiO2) = 3 ;
955 // --- Fibers (SiO2) = 4 ;
958 // --- Iron (with energy loss) = 7 ;
959 // --- Iron (without energy loss) = 8 ;
960 // --- Vacuum (no field) = 10
961 // --- Vacuum (with field) = 11
962 // --- Air (no field) = 12
965 // --- Tracking media parameters
966 Float_t epsil = .01, stmin=0.01, stemax = 1.;
967 // Int_t isxfld = gAlice->Field()->Integ();
968 Float_t fieldm = 0., tmaxfd = 0.;
969 Int_t ifield = 0, isvolActive = 1, isvol = 0, inofld = 0;
971 AliMedium(1, "ZTANT", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
972 // AliMedium(1, "ZW", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
973 AliMedium(2, "ZBRASS",2, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
974 AliMedium(3, "ZSIO2", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
975 AliMedium(4, "ZQUAR", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
976 AliMedium(5, "ZLEAD", 5, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
977 // AliMedium(6, "ZCOPP", 6, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
978 // AliMedium(7, "ZIRON", 7, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
979 AliMedium(6, "ZCOPP", 6, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
980 AliMedium(7, "ZIRON", 7, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
981 AliMedium(8, "ZIRONN",8, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
982 AliMedium(10,"ZVOID",10, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
983 AliMedium(12,"ZAIR", 12, 0, inofld, fieldm, tmaxfd, stemax,deemax, epsil, stmin);
987 AliMedium(11, "ZVOIM", 11, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
989 // Thresholds for showering in the ZDCs
991 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
992 gMC->Gstpar(idtmed[i], "CUTELE", .001);
993 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
994 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
996 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
997 gMC->Gstpar(idtmed[i], "CUTELE", .001);
998 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
999 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
1001 gMC->Gstpar(idtmed[i], "CUTGAM", .001);
1002 gMC->Gstpar(idtmed[i], "CUTELE", .001);
1003 gMC->Gstpar(idtmed[i], "CUTNEU", .01);
1004 gMC->Gstpar(idtmed[i], "CUTHAD", .01);
1006 // Avoid too detailed showering in TDI
1008 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1009 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1010 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1011 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1013 // Avoid too detailed showering along the beam line
1014 i = 7; //iron with energy loss (ZIRON)
1015 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1016 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1017 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1018 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1020 // Avoid too detailed showering along the beam line
1021 i = 8; //iron with energy loss (ZIRONN)
1022 gMC->Gstpar(idtmed[i], "CUTGAM", .1);
1023 gMC->Gstpar(idtmed[i], "CUTELE", .1);
1024 gMC->Gstpar(idtmed[i], "CUTNEU", 1.);
1025 gMC->Gstpar(idtmed[i], "CUTHAD", 1.);
1027 // Avoid interaction in fibers (only energy loss allowed)
1028 i = 3; //fibers (ZSI02)
1029 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1030 gMC->Gstpar(idtmed[i], "MULS", 0.);
1031 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1032 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1033 gMC->Gstpar(idtmed[i], "LOSS", 1.);
1034 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1035 gMC->Gstpar(idtmed[i], "COMP", 0.);
1036 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1037 gMC->Gstpar(idtmed[i], "BREM", 0.);
1038 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1039 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1040 gMC->Gstpar(idtmed[i], "HADR", 0.);
1041 i = 4; //fibers (ZQUAR)
1042 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1043 gMC->Gstpar(idtmed[i], "MULS", 0.);
1044 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1045 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1046 gMC->Gstpar(idtmed[i], "LOSS", 1.);
1047 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1048 gMC->Gstpar(idtmed[i], "COMP", 0.);
1049 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1050 gMC->Gstpar(idtmed[i], "BREM", 0.);
1051 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1052 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1053 gMC->Gstpar(idtmed[i], "HADR", 0.);
1055 // Avoid interaction in void
1056 i = 11; //void with field
1057 gMC->Gstpar(idtmed[i], "DCAY", 0.);
1058 gMC->Gstpar(idtmed[i], "MULS", 0.);
1059 gMC->Gstpar(idtmed[i], "PFIS", 0.);
1060 gMC->Gstpar(idtmed[i], "MUNU", 0.);
1061 gMC->Gstpar(idtmed[i], "LOSS", 0.);
1062 gMC->Gstpar(idtmed[i], "PHOT", 0.);
1063 gMC->Gstpar(idtmed[i], "COMP", 0.);
1064 gMC->Gstpar(idtmed[i], "PAIR", 0.);
1065 gMC->Gstpar(idtmed[i], "BREM", 0.);
1066 gMC->Gstpar(idtmed[i], "DRAY", 0.);
1067 gMC->Gstpar(idtmed[i], "ANNI", 0.);
1068 gMC->Gstpar(idtmed[i], "HADR", 0.);
1071 fMedSensZN = idtmed[1]; // Sensitive volume: ZN passive material
1072 fMedSensZP = idtmed[2]; // Sensitive volume: ZP passive material
1073 fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1
1074 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2
1075 fMedSensZEM = idtmed[5]; // Sensitive volume: ZEM passive material
1076 fMedSensTDI = idtmed[6]; // Sensitive volume: TDI Cu shield
1077 fMedSensPI = idtmed[7]; // Sensitive volume: beam pipes
1078 fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves
1081 //_____________________________________________________________________________
1082 void AliZDCv2::Init()
1087 //_____________________________________________________________________________
1088 void AliZDCv2::InitTables()
1091 // Read light tables for Cerenkov light production parameterization
1096 char *lightfName1,*lightfName2,*lightfName3,*lightfName4,
1097 *lightfName5,*lightfName6,*lightfName7,*lightfName8;
1098 FILE *fp1, *fp2, *fp3, *fp4, *fp5, *fp6, *fp7, *fp8;
1100 // --- Reading light tables for ZN
1101 lightfName1 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362207s");
1102 if((fp1 = fopen(lightfName1,"r")) == NULL){
1103 printf("Cannot open file fp1 \n");
1106 lightfName2 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362208s");
1107 if((fp2 = fopen(lightfName2,"r")) == NULL){
1108 printf("Cannot open file fp2 \n");
1111 lightfName3 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362209s");
1112 if((fp3 = fopen(lightfName3,"r")) == NULL){
1113 printf("Cannot open file fp3 \n");
1116 lightfName4 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362210s");
1117 if((fp4 = fopen(lightfName4,"r")) == NULL){
1118 printf("Cannot open file fp4 \n");
1122 for(k=0; k<fNalfan; k++){
1123 for(j=0; j<fNben; j++){
1124 fscanf(fp1,"%f",&fTablen[0][k][j]);
1125 fscanf(fp2,"%f",&fTablen[1][k][j]);
1126 fscanf(fp3,"%f",&fTablen[2][k][j]);
1127 fscanf(fp4,"%f",&fTablen[3][k][j]);
1135 // --- Reading light tables for ZP and ZEM
1136 lightfName5 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552207s");
1137 if((fp5 = fopen(lightfName5,"r")) == NULL){
1138 printf("Cannot open file fp5 \n");
1141 lightfName6 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552208s");
1142 if((fp6 = fopen(lightfName6,"r")) == NULL){
1143 printf("Cannot open file fp6 \n");
1146 lightfName7 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552209s");
1147 if((fp7 = fopen(lightfName7,"r")) == NULL){
1148 printf("Cannot open file fp7 \n");
1151 lightfName8 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552210s");
1152 if((fp8 = fopen(lightfName8,"r")) == NULL){
1153 printf("Cannot open file fp8 \n");
1157 for(k=0; k<fNalfap; k++){
1158 for(j=0; j<fNbep; j++){
1159 fscanf(fp5,"%f",&fTablep[0][k][j]);
1160 fscanf(fp6,"%f",&fTablep[1][k][j]);
1161 fscanf(fp7,"%f",&fTablep[2][k][j]);
1162 fscanf(fp8,"%f",&fTablep[3][k][j]);
1170 //_____________________________________________________________________________
1171 void AliZDCv2::StepManager()
1174 // Routine called at every step in the Zero Degree Calorimeters
1177 Int_t j, vol[2], ibeta=0, ialfa, ibe, nphe;
1178 Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, radius, out;
1179 Float_t xalic[3], z, guiEff, guiPar[4]={0.31,-0.0004,0.0197,0.7958};
1180 TLorentzVector s, p;
1183 for (j=0;j<10;j++) hits[j]=-999.;
1185 // --- This part is for no shower developement in beam pipe and TDI
1186 // If particle interacts with beam pipe or TDI -> return
1187 if((gMC->GetMedium() == fMedSensPI) || (gMC->GetMedium() == fMedSensTDI)){
1188 // If option NoShower is set -> StopTrack
1190 if(gMC->GetMedium() == fMedSensPI) {
1191 knamed = gMC->CurrentVolName();
1192 //printf("\t fMedSensPI -> medium: %d, Volume: %s \n",gMC->GetMedium(),knamed);
1193 if(!strncmp(knamed,"YMQ",3)) fpLostIT += 1;
1194 if(!strncmp(knamed,"YD1",3)) fpLostD1 += 1;
1196 else if(gMC->GetMedium() == fMedSensTDI){ // NB->Cu = TDI or D1 vacuum chamber
1197 knamed = gMC->CurrentVolName();
1198 //printf("\t fMedSensTDI -> medium: %d, Volume: %s \n",gMC->GetMedium(),knamed);
1199 if(!strncmp(knamed,"MD1",3)) fpLostD1 += 1;
1200 if(!strncmp(knamed,"QTD",3)) fpLostTDI += 1;
1202 printf("\n # of p lost in Inner Triplet = %d\n",fpLostIT);
1203 printf("\n # of p lost in D1 = %d\n",fpLostD1);
1204 printf("\n # of p lost in TDI = %d\n\n",fpLostTDI);
1210 if((gMC->GetMedium() == fMedSensZN) || (gMC->GetMedium() == fMedSensZP) ||
1211 (gMC->GetMedium() == fMedSensGR) || (gMC->GetMedium() == fMedSensF1) ||
1212 (gMC->GetMedium() == fMedSensF2) || (gMC->GetMedium() == fMedSensZEM)){
1215 //Particle coordinates
1216 gMC->TrackPosition(s);
1217 for(j=0; j<=2; j++) x[j] = s[j];
1222 // Determine in which ZDC the particle is
1223 knamed = gMC->CurrentVolName();
1224 if(!strncmp(knamed,"ZN",2)) vol[0]=1;
1225 else if(!strncmp(knamed,"ZP",2)) vol[0]=2;
1226 else if(!strncmp(knamed,"ZE",2)) vol[0]=3;
1228 // Determine in which quadrant the particle is
1229 if(vol[0]==1){ //Quadrant in ZN
1230 // Calculating particle coordinates inside ZN
1231 xdet[0] = x[0]-fPosZN[0];
1232 xdet[1] = x[1]-fPosZN[1];
1233 // Calculating quadrant in ZN
1235 if(xdet[1]>=0.) vol[1]=1;
1236 else if(xdet[1]<0.) vol[1]=3;
1238 else if(xdet[0]>0.){
1239 if(xdet[1]>=0.) vol[1]=2;
1240 else if(xdet[1]<0.) vol[1]=4;
1242 if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4))
1243 printf("\n ZDC StepManager->ERROR in ZN!!! vol[1] = %d, xdet[0] = %f,"
1244 "xdet[1] = %f\n",vol[1], xdet[0], xdet[1]);
1247 else if(vol[0]==2){ //Quadrant in ZP
1248 // Calculating particle coordinates inside ZP
1249 xdet[0] = x[0]-fPosZP[0];
1250 xdet[1] = x[1]-fPosZP[1];
1251 if(xdet[0]>=fDimZP[0]) xdet[0]=fDimZP[0]-0.01;
1252 if(xdet[0]<=-fDimZP[0]) xdet[0]=-fDimZP[0]+0.01;
1253 // Calculating tower in ZP
1254 Float_t xqZP = xdet[0]/(fDimZP[0]/2.);
1255 for(int i=1; i<=4; i++){
1256 if(xqZP>=(i-3) && xqZP<(i-2)){
1261 if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4))
1262 printf(" ZDC StepManager->ERROR in ZP!!! vol[1] = %d, xdet[0] = %f,"
1263 "xdet[1] = %f\n",vol[1], xdet[0], xdet[1]);
1266 // Quadrant in ZEM: vol[1] = 1 -> particle in 1st ZEM (placed at x = 8.5 cm)
1267 // vol[1] = 2 -> particle in 2nd ZEM (placed at x = -8.5 cm)
1268 else if(vol[0] == 3){
1271 // Particle x-coordinate inside ZEM1
1272 xdet[0] = x[0]-fPosZEM[0];
1276 // Particle x-coordinate inside ZEM2
1277 xdet[0] = x[0]+fPosZEM[0];
1279 xdet[1] = x[1]-fPosZEM[1];
1282 // Store impact point and kinetic energy of the ENTERING particle
1284 if(gMC->IsTrackEntering()){
1286 gMC->TrackMomentum(p);
1288 // Impact point on ZDC
1296 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
1301 if(vol[0]==2) printf("\n # of detected p = %d\n\n",fpDetected);
1306 // Charged particles -> Energy loss
1307 if((destep=gMC->Edep())){
1308 if(gMC->IsTrackStop()){
1309 gMC->TrackMomentum(p);
1310 m = gMC->TrackMass();
1315 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
1321 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
1327 // *** Light production in fibres
1328 if((gMC->GetMedium() == fMedSensF1) || (gMC->GetMedium() == fMedSensF2)){
1330 //Select charged particles
1331 if((destep=gMC->Edep())){
1333 // Particle velocity
1335 gMC->TrackMomentum(p);
1336 Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]);
1337 if(p[3] > 0.00001) beta = ptot/p[3];
1342 else if((beta>=0.67) && (beta<=0.75)){
1345 if((beta>0.75) && (beta<=0.85)){
1348 if((beta>0.85) && (beta<=0.95)){
1355 // Angle between particle trajectory and fibre axis
1356 // 1 -> Momentum directions
1360 gMC->Gmtod(um,ud,2);
1361 // 2 -> Angle < limit angle
1362 Double_t alfar = TMath::ACos(ud[2]);
1363 Double_t alfa = alfar*kRaddeg;
1364 if(alfa>=110.) return;
1365 ialfa = Int_t(1.+alfa/2.);
1367 // Distance between particle trajectory and fibre axis
1368 gMC->TrackPosition(s);
1369 for(j=0; j<=2; j++){
1372 gMC->Gmtod(x,xdet,1);
1373 if(TMath::Abs(ud[0])>0.00001){
1374 Float_t dcoeff = ud[1]/ud[0];
1375 be = TMath::Abs((xdet[1]-dcoeff*xdet[0])/TMath::Sqrt(dcoeff*dcoeff+1.));
1378 be = TMath::Abs(ud[0]);
1384 else if((vol[0]==2)){
1387 ibe = Int_t(be*1000.+1);
1389 //Looking into the light tables
1390 Float_t charge = gMC->TrackCharge();
1392 if((vol[0]==1)) { // (1) ZN fibres
1393 if(ibe>fNben) ibe=fNben;
1394 out = charge*charge*fTablen[ibeta][ialfa][ibe];
1395 nphe = gRandom->Poisson(out);
1396 // printf("ZN --- ibeta = %d, ialfa = %d, ibe = %d"
1397 // " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
1398 if(gMC->GetMedium() == fMedSensF1){
1399 hits[7] = nphe; //fLightPMQ
1402 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
1406 hits[8] = nphe; //fLightPMC
1408 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
1411 else if((vol[0]==2)) { // (2) ZP fibres
1412 if(ibe>fNbep) ibe=fNbep;
1413 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1414 nphe = gRandom->Poisson(out);
1415 // printf("ZP --- ibeta = %d, ialfa = %d, ibe = %d"
1416 // " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
1417 if(gMC->GetMedium() == fMedSensF1){
1418 hits[7] = nphe; //fLightPMQ
1421 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
1425 hits[8] = nphe; //fLightPMC
1427 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
1430 else if((vol[0]==3)) { // (3) ZEM fibres
1431 if(ibe>fNbep) ibe=fNbep;
1432 out = charge*charge*fTablep[ibeta][ialfa][ibe];
1433 gMC->TrackPosition(s);
1434 for(j=0; j<=2; j++){
1437 // z-coordinate from ZEM front face
1438 // NB-> fPosZEM[2]+fZEMLength = -1000.+2*10.3 = 979.69 cm
1439 z = -xalic[2]+fPosZEM[2]+2*fZEMLength-xalic[1];
1440 // z = xalic[2]-fPosZEM[2]-fZEMLength-xalic[1]*(TMath::Tan(45.*kDegrad));
1441 // printf("\n fPosZEM[2]+2*fZEMLength = %f", fPosZEM[2]+2*fZEMLength);
1442 guiEff = guiPar[0]*(guiPar[1]*z*z+guiPar[2]*z+guiPar[3]);
1443 // printf("\n xalic[0] = %f xalic[1] = %f xalic[2] = %f z = %f \n",
1444 // xalic[0],xalic[1],xalic[2],z);
1446 nphe = gRandom->Poisson(out);
1447 // printf(" out*guiEff = %f nphe = %d", out, nphe);
1448 // printf("ZEM --- ibeta = %d, ialfa = %d, ibe = %d"
1449 // " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe);
1452 hits[8] = nphe; //fLightPMC (ZEM1)
1454 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
1457 hits[7] = nphe; //fLightPMQ (ZEM2)
1460 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);