X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ZDC%2FAliZDCv2.cxx;h=1c2b55bedf1f023cf991005448ed99a95142cd7e;hb=7bce547d90d42ed2b7b6bdbe58e651ff5df3ddb8;hp=5024f74bb3e9c02b0ed8456066b46d1d671e7f3e;hpb=c63eb7abf7f070c2b8c1060c22252deb2dfb9164;p=u%2Fmrichter%2FAliRoot.git diff --git a/ZDC/AliZDCv2.cxx b/ZDC/AliZDCv2.cxx index 5024f74bb3e..1c2b55bedf1 100644 --- a/ZDC/AliZDCv2.cxx +++ b/ZDC/AliZDCv2.cxx @@ -13,66 +13,43 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.4 2001/06/13 11:17:49 coppedis -Bug corrected -Revision 1.3 2001/06/13 11:11:02 coppedis -Minor changes - -Revision 1.2 2001/06/12 13:45:11 coppedis -TDI in correct position and minor correction - -Revision 1.1 2001/05/14 09:57:39 coppedis -A different geometry for the ZDCs - - -*/ - -/////////////////////////////////////////////////////////////////////////////// -// // -// Zero Degree Calorimeter // -// This class contains the basic functions for the ZDC // -// Functions specific to one particular geometry are // -// contained in the derived classes // -// // -/////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////// +// // +// AliZDCv2 --- new ZDC geometry // +// with the EM ZDC at about 10 m from IP // +// Just one set of ZDC is inserted // +// (on the same side of the dimuon arm realtive to IP) // +// Compensator in ZDC geometry (Nov. 2004) // +// // +/////////////////////////////////////////////////////////////////////// // --- Standard libraries #include "stdio.h" // --- ROOT system #include -#include +#include #include +#include #include #include #include - +#include +#include // --- AliRoot classes -#include "AliZDCv2.h" -#include "AliZDCHit.h" -#include "AliZDCDigit.h" -#include "AliRun.h" -#include "AliDetector.h" +#include "AliConst.h" #include "AliMagF.h" +#include "AliRun.h" +#include "AliZDCv2.h" #include "AliMC.h" -#include "AliCallf77.h" -#include "AliConst.h" -#include "AliPDG.h" -#include "TLorentzVector.h" +class AliZDCHit; +class AliPDG; +class AliDetector; ClassImp(AliZDCv2) - - -/////////////////////////////////////////////////////////////////////////////// -// // -// Zero Degree Calorimeter version 2 // -// // -/////////////////////////////////////////////////////////////////////////////// //_____________________________________________________________________________ AliZDCv2::AliZDCv2() : AliZDC() @@ -87,8 +64,7 @@ AliZDCv2::AliZDCv2() : AliZDC() fMedSensZP = 0; fMedSensZEM = 0; fMedSensGR = 0; -// fMedSensPI = 0; -// fMedSensTDI = 0; + } //_____________________________________________________________________________ @@ -101,11 +77,11 @@ AliZDCv2::AliZDCv2(const char *name, const char *title) // // Check that DIPO, ABSO, DIPO and SHIL is there (otherwise tracking is wrong!!!) - AliModule* PIPE=gAlice->GetModule("PIPE"); - AliModule* ABSO=gAlice->GetModule("ABSO"); - AliModule* DIPO=gAlice->GetModule("DIPO"); - AliModule* SHIL=gAlice->GetModule("SHIL"); - if((!PIPE) || (!ABSO) || (!DIPO) || (!SHIL)) { + AliModule* pipe=gAlice->GetModule("PIPE"); + AliModule* abso=gAlice->GetModule("ABSO"); + AliModule* dipo=gAlice->GetModule("DIPO"); + AliModule* shil=gAlice->GetModule("SHIL"); + if((!pipe) || (!abso) || (!dipo) || (!shil)) { Error("Constructor","ZDC needs PIPE, ABSO, DIPO and SHIL!!!\n"); exit(1); } @@ -116,8 +92,8 @@ AliZDCv2::AliZDCv2(const char *name, const char *title) fMedSensZP = 0; fMedSensZEM = 0; fMedSensGR = 0; -// fMedSensPI = 0; -// fMedSensTDI = 0; + fMedSensPI = 0; + fMedSensTDI = 0; // Parameters for light tables @@ -143,15 +119,18 @@ AliZDCv2::AliZDCv2(const char *name, const char *title) } // Parameters for hadronic calorimeters geometry + fDimZN[0] = 3.52; + fDimZN[1] = 3.52; + fDimZN[2] = 50.; fDimZP[0] = 11.2; fDimZP[1] = 6.; fDimZP[2] = 75.; fPosZN[0] = 0.; - fPosZN[1] = -1.2; - fPosZN[2] = 11650.; - fPosZP[0] = -24.; + fPosZN[1] = 1.2; + fPosZN[2] = -11650.; + fPosZP[0] = 23.9; fPosZP[1] = 0.; - fPosZP[2] = 11600.; + fPosZP[2] = -11600.; fFibZN[0] = 0.; fFibZN[1] = 0.01825; fFibZN[2] = 50.; @@ -162,17 +141,22 @@ AliZDCv2::AliZDCv2(const char *name, const char *title) // Parameters for EM calorimeter geometry fPosZEM[0] = 8.5; fPosZEM[1] = 0.; - fPosZEM[2] = -1000.; - + fPosZEM[2] = 735.; - fDigits = new TClonesArray("AliZDCDigit",1000); + Float_t kDimZEMPb = 0.15*(TMath::Sqrt(2.)); // z-dimension of the Pb slice + Float_t kDimZEMAir = 0.001; // scotch + Float_t kFibRadZEM = 0.0315; // External fiber radius (including cladding) + Int_t kDivZEM[3] = {92, 0, 20}; // Divisions for EM detector + Float_t kDimZEM0 = 2*kDivZEM[2]*(kDimZEMPb+kDimZEMAir+kFibRadZEM*(TMath::Sqrt(2.))); + fZEMLength = kDimZEM0; + } //_____________________________________________________________________________ void AliZDCv2::CreateGeometry() { // - // Create the geometry for the Zero Degree Calorimeter version 1 + // Create the geometry for the Zero Degree Calorimeter version 2 //* Initialize COMMON block ZDC_CGEOM //* @@ -183,22 +167,27 @@ void AliZDCv2::CreateGeometry() //_____________________________________________________________________________ void AliZDCv2::CreateBeamLine() { + // + // Create the beam line elements + // - Float_t zq, zd1, zd2; + Float_t zc, zq, zd1, zd2; Float_t conpar[9], tubpar[3], tubspar[5], boxpar[3]; Int_t im1, im2; Int_t *idtmed = fIdtmed->GetArray(); // -- Mother of the ZDCs (Vacuum PCON) + // zd1 = 2092.; // (Without compensator in ZDC geometry) + zd1 = 1921.6; conpar[0] = 0.; conpar[1] = 360.; conpar[2] = 2.; - conpar[3] = 2000.; + conpar[3] = -13500.; conpar[4] = 0.; conpar[5] = 55.; - conpar[6] = 13060.; + conpar[6] = -zd1; conpar[7] = 0.; conpar[8] = 55.; gMC->Gsvolu("ZDC ", "PCON", idtmed[11], conpar, 9); @@ -206,14 +195,14 @@ void AliZDCv2::CreateBeamLine() // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to // the beginning of D1) - - zd1 = 2000.; - tubpar[0] = 6.3/2.; tubpar[1] = 6.7/2.; - tubpar[2] = 3838.3/2.; + // From beginning of ZDC volumes to beginning of D1 + tubpar[2] = (5838.3-zd1)/2.; gMC->Gsvolu("QT01", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT01", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT01", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT01 TUBE pipe from z = %f to z= %f (D1 beg.)\n",-zd1,-2*tubpar[2]-zd1); //-- SECOND SECTION OF THE BEAM PIPE (from the end of D1 to the // beginning of D2) @@ -228,17 +217,21 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 3.47+0.2; tubpar[2] = 958.5/2.; gMC->Gsvolu("QT02", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT02", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT02", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT02 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += 2.*tubpar[2]; conpar[0] = 25./2.; - conpar[1] = 6.44/2.; - conpar[2] = 6.84/2.; - conpar[3] = 10./2.; - conpar[4] = 10.4/2.; + conpar[1] = 10./2.; + conpar[2] = 10.4/2.; + conpar[3] = 6.44/2.; + conpar[4] = 6.84/2.; gMC->Gsvolu("QC01", "CONE", idtmed[7], conpar, 5); - gMC->Gspos("QC01", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY"); + gMC->Gspos("QC01", 1, "ZDC ", 0., 0., -conpar[0]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QC01 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1); zd1 += 2.*conpar[0]; @@ -246,7 +239,9 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 10.4/2.; tubpar[2] = 50./2.; gMC->Gsvolu("QT03", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT03", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT03", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT03 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += tubpar[2]*2.; @@ -254,7 +249,9 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 10.4/2.; tubpar[2] = 10./2.; gMC->Gsvolu("QT04", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT04", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT04", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT04 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += tubpar[2] * 2.; @@ -262,7 +259,9 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 10.4/2.; tubpar[2] = 3.16/2.; gMC->Gsvolu("QT05", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT05", 1, "ZDC ", 0., 0., tubpar[0] + zd1, 0, "ONLY"); + gMC->Gspos("QT05", 1, "ZDC ", 0., 0., -tubpar[0]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT05 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += tubpar[2] * 2.; @@ -270,17 +269,21 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 10.4/2; tubpar[2] = 190./2.; gMC->Gsvolu("QT06", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT06", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT06", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT06 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += tubpar[2] * 2.; conpar[0] = 30./2.; - conpar[1] = 10./2.; - conpar[2] = 10.4/2.; - conpar[3] = 20.6/2.; - conpar[4] = 21./2.; + conpar[1] = 20.6/2.; + conpar[2] = 21./2.; + conpar[3] = 10./2.; + conpar[4] = 10.4/2.; gMC->Gsvolu("QC02", "CONE", idtmed[7], conpar, 5); - gMC->Gspos("QC02", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY"); + gMC->Gspos("QC02", 1, "ZDC ", 0., 0., -conpar[0]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QC02 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1); zd1 += conpar[0] * 2.; @@ -288,17 +291,21 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 21./2.; tubpar[2] = 450./2.; gMC->Gsvolu("QT07", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT07", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT07", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT07 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += tubpar[2] * 2.; conpar[0] = 13.6/2.; - conpar[1] = 20.6/2.; - conpar[2] = 21./2.; - conpar[3] = 25.4/2.; - conpar[4] = 25.8/2.; + conpar[1] = 25.4/2.; + conpar[2] = 25.8/2.; + conpar[3] = 20.6/2.; + conpar[4] = 21./2.; gMC->Gsvolu("QC03", "CONE", idtmed[7], conpar, 5); - gMC->Gspos("QC03", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY"); + gMC->Gspos("QC03", 1, "ZDC ", 0., 0., -conpar[0]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QC03 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1); zd1 += conpar[0] * 2.; @@ -306,7 +313,9 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 25.8/2.; tubpar[2] = 205.8/2.; gMC->Gsvolu("QT08", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT08", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT08", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT08 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += tubpar[2] * 2.; @@ -315,35 +324,33 @@ void AliZDCv2::CreateBeamLine() // QT09 is 10 cm longer to accomodate TDI tubpar[2] = 515.4/2.; gMC->Gsvolu("QT09", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT09", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT09", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT09 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); // --- Insert TDI (inside ZDC volume) - boxpar[0] = 5.6; boxpar[1] = 5.6; boxpar[2] = 400./2.; gMC->Gsvolu("QTD1", "BOX ", idtmed[7], boxpar, 3); - gMC->Gspos("QTD1", 1, "ZDC ", 3., 10.6, tubpar[2] + zd1 + 56.3, 0, "ONLY"); - gMC->Gspos("QTD1", 2, "ZDC ", 3., -10.6, tubpar[2] + zd1 + 56.3, 0, "ONLY"); + gMC->Gspos("QTD1", 1, "ZDC ", -3., 10.6, -tubpar[2]-zd1-56.3, 0, "ONLY"); + gMC->Gspos("QTD1", 2, "ZDC ", -3., -10.6, -tubpar[2]-zd1-56.3, 0, "ONLY"); boxpar[0] = 0.2/2.; boxpar[1] = 5.6; boxpar[2] = 400./2.; gMC->Gsvolu("QTD2", "BOX ", idtmed[6], boxpar, 3); - gMC->Gspos("QTD2", 1, "ZDC ", 8.6+boxpar[0], 0., tubpar[2] + zd1 + 56.3, 0, "ONLY"); + gMC->Gspos("QTD2", 1, "ZDC ", -8.6-boxpar[0], 0., -tubpar[2]-zd1-56.3, 0, "ONLY"); -// tubspar[0] = 6.2; // R = 6.2 cm---------------------------------------- -// tubspar[1] = 6.4; -// tubspar[2] = 400./2.; -// tubspar[3] = 180.-62.5; -// tubspar[4] = 180.+62.5; tubspar[0] = 10.5; // R = 10.5 cm------------------------------------------ tubspar[1] = 10.7; tubspar[2] = 400./2.; - tubspar[3] = 180.-75.5; - tubspar[4] = 180.+75.5; + tubspar[3] = 360.-75.5; + tubspar[4] = 75.5; gMC->Gsvolu("QTD3", "TUBS", idtmed[6], tubspar, 5); - gMC->Gspos("QTD3", 1, "ZDC ", 0., 0., tubpar[2] + zd1 + 56.3, 0, "ONLY"); + gMC->Gspos("QTD3", 1, "ZDC ", 0., 0., -tubpar[2]-zd1-56.3, 0, "ONLY"); + // Ch.debug + //printf("\n TDI volume from z = %f to z= %f\n",-tubpar[2]-zd1-56.3,-tubpar[2]-zd1-56.3-400.); zd1 += tubpar[2] * 2.; @@ -352,7 +359,9 @@ void AliZDCv2::CreateBeamLine() // QT10 is 10 cm shorter tubpar[2] = 690./2.; gMC->Gsvolu("QT10", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT10", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT10", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT10 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += tubpar[2] * 2.; @@ -360,17 +369,21 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 50.4/2.; tubpar[2] = 778.5/2.; gMC->Gsvolu("QT11", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT11", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT11", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT11 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += tubpar[2] * 2.; conpar[0] = 14.18/2.; - conpar[1] = 50./2.; - conpar[2] = 50.4/2.; - conpar[3] = 55./2.; - conpar[4] = 55.4/2.; + conpar[1] = 55./2.; + conpar[2] = 55.4/2.; + conpar[3] = 50./2.; + conpar[4] = 50.4/2.; gMC->Gsvolu("QC04", "CONE", idtmed[7], conpar, 5); - gMC->Gspos("QC04", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY"); + gMC->Gspos("QC04", 1, "ZDC ", 0., 0., -conpar[0]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QC04 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1); zd1 += conpar[0] * 2.; @@ -378,17 +391,21 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 55.4/2.; tubpar[2] = 730./2.; gMC->Gsvolu("QT12", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT12", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT12", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT12 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += tubpar[2] * 2.; conpar[0] = 36.86/2.; - conpar[1] = 55./2.; - conpar[2] = 55.4/2.; - conpar[3] = 68./2.; - conpar[4] = 68.4/2.; + conpar[1] = 68./2.; + conpar[2] = 68.4/2.; + conpar[3] = 55./2.; + conpar[4] = 55.4/2.; gMC->Gsvolu("QC05", "CONE", idtmed[7], conpar, 5); - gMC->Gspos("QC05", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY"); + gMC->Gspos("QC05", 1, "ZDC ", 0., 0., -conpar[0]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QC05 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1); zd1 += conpar[0] * 2.; @@ -396,7 +413,9 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 68.4/2.; tubpar[2] = 927.3/2.; gMC->Gsvolu("QT13", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT13", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT13", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT13 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += tubpar[2] * 2.; @@ -404,7 +423,9 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 68.4/2.; tubpar[2] = 0.2/2.; gMC->Gsvolu("QT14", "TUBE", idtmed[8], tubpar, 3); - gMC->Gspos("QT14", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("QT14", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); + // Ch.debug + //printf("\n QT14 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1); zd1 += tubpar[2] * 2.; @@ -412,20 +433,15 @@ void AliZDCv2::CreateBeamLine() tubpar[1] = 6.4/2.; tubpar[2] = 0.2/2.; gMC->Gsvolu("QT15", "TUBE", idtmed[11], tubpar, 3); - //-- Position QT15 inside QT14 gMC->Gspos("QT15", 1, "QT14", -7.7, 0., 0., 0, "ONLY"); - - tubpar[0] = 0./2.; - tubpar[1] = 6.4/2.; - tubpar[2] = 0.2/2.; - gMC->Gsvolu("QT16", "TUBE", idtmed[11], tubpar, 3); - + + gMC->Gsvolu("QT16", "TUBE", idtmed[11], tubpar, 3); //-- Position QT16 inside QT14 gMC->Gspos("QT16", 1, "QT14", 7.7, 0., 0., 0, "ONLY"); - //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2 + //-- BEAM PIPE BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2 tubpar[0] = 6.4/2.; tubpar[1] = 6.8/2.; @@ -438,126 +454,90 @@ void AliZDCv2::CreateBeamLine() gMC->Gsvolu("QT18", "TUBE", idtmed[7], tubpar, 3); // -- ROTATE PIPES - - Float_t angle = 0.143*kDegrad; + Float_t angle = 0.143*kDegrad; // Rotation angle - AliMatrix(im1, 90.-0.143, 0., 90., 90., 0.143, 180.); + //AliMatrix(im1, 90.+0.143, 0., 90., 90., 0.143, 0.); // x<0 + gMC->Matrix(im1, 90.+0.143, 0., 90., 90., 0.143, 0.); // x<0 gMC->Gspos("QT17", 1, "ZDC ", TMath::Sin(angle) * 680.8/ 2. - 9.4, - 0., tubpar[2] + zd1, im1, "ONLY"); + 0., -tubpar[2]-zd1, im1, "ONLY"); - AliMatrix(im2, 90.+0.143, 0., 90., 90., 0.143, 0.); + //AliMatrix(im2, 90.-0.143, 0., 90., 90., 0.143, 180.); // x>0 (ZP) + gMC->Matrix(im2, 90.-0.143, 0., 90., 90., 0.143, 180.); // x>0 (ZP) gMC->Gspos("QT18", 1, "ZDC ", 9.7 - TMath::Sin(angle) * 680.8 / 2., - 0., tubpar[2] + zd1, im2, "ONLY"); - - // -- BEAM PIPE ON THE OTHER SIDE OF I.P. TILL THE EM ZDC - - Float_t zb = -800.; // End of QBPM (from AliPIPEv0.cxx) - tubpar[0] = 8.0/2.; - tubpar[1] = 8.2/2.; - tubpar[2] = (1050+zb)/2.; // From the end of QBPM to z=1050. - gMC->Gsvolu("QT19", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("QT19", 1, "ALIC", 0., 0., zb - tubpar[2], 0, "ONLY"); - - + 0., -tubpar[2]-zd1, im2, "ONLY"); + // -- END OF BEAM PIPE VOLUME DEFINITION. // ---------------------------------------------------------------- - // -- MAGNET DEFINITION -> LHC OPTICS 6.2 (preliminary version) - - // ---------------------------------------------------------------- - // Replaced by the muon dipole // ---------------------------------------------------------------- - // -- COMPENSATOR DIPOLE (MBXW) - // GAP (VACUUM WITH MAGNETIC FIELD) + // -- MAGNET DEFINITION -> LHC OPTICS 6.5 + // ---------------------------------------------------------------- + // -- COMPENSATOR DIPOLE (MBXW) + zc = 1921.6; -// tubpar[0] = 0.; -// tubpar[1] = 4.5; -// tubpar[2] = 340./2.; -// gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3); -// gMC->Gspos("MBXW", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY"); - - // -- YOKE (IRON WITHOUT MAGNETIC FIELD) - -// tubpar[0] = 4.5; -// tubpar[1] = 55.; -// tubpar[2] = 340./2.; -// gMC->Gsvolu("YMBX", "TUBE", idtmed[7], tubpar, 3); -// gMC->Gspos("YMBX", 1, "ZDC ", 0., 0., tubpar[2] + 805., 0, "ONLY"); - - // ---------------------------------------------------------------- - // Replaced by the second dipole - // ---------------------------------------------------------------- - // -- COMPENSATOR DIPOLE (MCBWA) - // GAP (VACUUM WITH MAGNETIC FIELD) - -// tubpar[0] = 0.; -// tubpar[1] = 4.5; -// tubpar[2] = 170./2.; -// gMC->Gsvolu("MCBW", "TUBE", idtmed[11], tubpar, 3); -// gMC->Gspos("MCBW", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY"); - - // -- YOKE (IRON WITHOUT MAGNETIC FIELD) + // -- GAP (VACUUM WITH MAGNETIC FIELD) + tubpar[0] = 0.; + tubpar[1] = 4.5; + tubpar[2] = 170./2.; + gMC->Gsvolu("MBXW", "TUBE", idtmed[11], tubpar, 3); + + // -- YOKE + tubpar[0] = 4.5; + tubpar[1] = 55.; + tubpar[2] = 170./2.; + gMC->Gsvolu("YMBX", "TUBE", idtmed[13], tubpar, 3); + + gMC->Gspos("MBXW", 1, "ZDC ", 0., 0., -tubpar[2]-zc, 0, "ONLY"); + gMC->Gspos("YMBX", 1, "ZDC ", 0., 0., -tubpar[2]-zc, 0, "ONLY"); -// tubpar[0] = 4.5; -// tubpar[1] = 55.; -// tubpar[2] = 170./2.; -// gMC->Gsvolu("YMCB", "TUBE", idtmed[7], tubpar, 3); -// gMC->Gspos("YMCB", 1, "ZDC ", 0., 0., tubpar[2] + 1921.6, 0, "ONLY"); // -- INNER TRIPLET - - zq = 2296.5; - + zq = 2296.5; + // -- DEFINE MQXL AND MQX QUADRUPOLE ELEMENT - - // MQXL + // -- MQXL // -- GAP (VACUUM WITH MAGNETIC FIELD) - tubpar[0] = 0.; tubpar[1] = 3.5; tubpar[2] = 637./2.; gMC->Gsvolu("MQXL", "TUBE", idtmed[11], tubpar, 3); - // -- YOKE + // -- YOKE tubpar[0] = 3.5; tubpar[1] = 22.; tubpar[2] = 637./2.; gMC->Gsvolu("YMQL", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("MQXL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY"); - gMC->Gspos("YMQL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY"); + gMC->Gspos("MQXL", 1, "ZDC ", 0., 0., -tubpar[2]-zq, 0, "ONLY"); + gMC->Gspos("YMQL", 1, "ZDC ", 0., 0., -tubpar[2]-zq, 0, "ONLY"); - gMC->Gspos("MQXL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY"); - gMC->Gspos("YMQL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY"); + gMC->Gspos("MQXL", 2, "ZDC ", 0., 0., -tubpar[2]-zq-2430., 0, "ONLY"); + gMC->Gspos("YMQL", 2, "ZDC ", 0., 0., -tubpar[2]-zq-2430., 0, "ONLY"); // -- MQX // -- GAP (VACUUM WITH MAGNETIC FIELD) - tubpar[0] = 0.; tubpar[1] = 3.5; tubpar[2] = 550./2.; gMC->Gsvolu("MQX ", "TUBE", idtmed[11], tubpar, 3); // -- YOKE - tubpar[0] = 3.5; tubpar[1] = 22.; tubpar[2] = 550./2.; gMC->Gsvolu("YMQ ", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 883.5, 0, "ONLY"); - gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 883.5, 0, "ONLY"); + gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., -tubpar[2]-zq-908.5, 0, "ONLY"); + gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., -tubpar[2]-zq-908.5, 0, "ONLY"); - gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1533.5, 0, "ONLY"); - gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1533.5, 0, "ONLY"); + gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., -tubpar[2]-zq-1558.5, 0, "ONLY"); + gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., -tubpar[2]-zq-1558.5, 0, "ONLY"); // -- SEPARATOR DIPOLE D1 - zd1 = 5838.3; // -- GAP (VACUUM WITH MAGNETIC FIELD) - tubpar[0] = 0.; tubpar[1] = 6.94/2.; tubpar[2] = 945./2.; @@ -565,8 +545,7 @@ void AliZDCv2::CreateBeamLine() // -- Insert horizontal Cu plates inside D1 // -- (to simulate the vacuum chamber) - - boxpar[0] = TMath::Sqrt(tubpar[1]*tubpar[1]-(2.98+0.2)*(2.98+0.2)); + boxpar[0] = TMath::Sqrt(tubpar[1]*tubpar[1]-(2.98+0.2)*(2.98+0.2)) - 0.05; boxpar[1] = 0.2/2.; boxpar[2] =945./2.; gMC->Gsvolu("MD1V", "BOX ", idtmed[6], boxpar, 3); @@ -574,34 +553,31 @@ void AliZDCv2::CreateBeamLine() gMC->Gspos("MD1V", 2, "MD1 ", 0., -2.98-boxpar[1], 0., 0, "ONLY"); // -- YOKE - tubpar[0] = 0.; tubpar[1] = 110./2; tubpar[2] = 945./2.; gMC->Gsvolu("YD1 ", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY"); + gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., -tubpar[2]-zd1, 0, "ONLY"); gMC->Gspos("MD1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY"); // -- DIPOLE D2 - + // --- LHC optics v6.4 zd2 = 12147.6; // -- GAP (VACUUM WITH MAGNETIC FIELD) - tubpar[0] = 0.; tubpar[1] = 7.5/2.; tubpar[2] = 945./2.; gMC->Gsvolu("MD2 ", "TUBE", idtmed[11], tubpar, 3); // -- YOKE - tubpar[0] = 0.; tubpar[1] = 55.; tubpar[2] = 945./2.; gMC->Gsvolu("YD2 ", "TUBE", idtmed[7], tubpar, 3); - gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., tubpar[2] + zd2, 0, "ONLY"); + gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., -tubpar[2]-zd2, 0, "ONLY"); gMC->Gspos("MD2 ", 1, "YD2 ", -9.4, 0., 0., 0, "ONLY"); gMC->Gspos("MD2 ", 2, "YD2 ", 9.4, 0., 0., 0, "ONLY"); @@ -612,14 +588,16 @@ void AliZDCv2::CreateBeamLine() //_____________________________________________________________________________ void AliZDCv2::CreateZDC() { + // + // Create the various ZDCs (ZN + ZP) + // - Float_t DimPb[6], DimVoid[6]; + Float_t dimPb[6], dimVoid[6]; Int_t *idtmed = fIdtmed->GetArray(); // Parameters for hadronic calorimeters geometry // NB -> parameters used ONLY in CreateZDC() - Float_t fDimZN[3] = {3.52, 3.52, 50.}; // Dimensions of neutron detector Float_t fGrvZN[3] = {0.03, 0.03, 50.}; // Grooves for neutron detector Float_t fGrvZP[3] = {0.04, 0.04, 75.}; // Grooves for proton detector Int_t fDivZN[3] = {11, 11, 0}; // Division for neutron detector @@ -629,13 +607,11 @@ void AliZDCv2::CreateZDC() // Parameters for EM calorimeter geometry // NB -> parameters used ONLY in CreateZDC() - Float_t fDimZEMPb = 0.15*(TMath::Sqrt(2.)); // z-dimension of the Pb slice - Float_t fDimZEMAir = 0.001; // scotch - Float_t fFibRadZEM = 0.0315; // External fiber radius (including cladding) + Float_t kDimZEMPb = 0.15*(TMath::Sqrt(2.)); // z-dimension of the Pb slice + Float_t kFibRadZEM = 0.0315; // External fiber radius (including cladding) Int_t fDivZEM[3] = {92, 0, 20}; // Divisions for EM detector - Float_t fDimZEM0 = 2*fDivZEM[2]*(fDimZEMPb+fDimZEMAir+fFibRadZEM*(TMath::Sqrt(2.))); - Float_t fDimZEM[6] = {fDimZEM0, 3.5, 3.5, 45., 0., 0.}; // Dimensions of EM detector - Float_t fFibZEM2 = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-fFibRadZEM; + Float_t fDimZEM[6] = {fZEMLength, 3.5, 3.5, 45., 0., 0.}; // Dimensions of EM detector + Float_t fFibZEM2 = fDimZEM[2]/TMath::Sin(fDimZEM[3]*kDegrad)-kFibRadZEM; Float_t fFibZEM[3] = {0., 0.0275, fFibZEM2}; // Fibers for EM calorimeter @@ -683,8 +659,13 @@ void AliZDCv2::CreateZDC() gMC->Gspos("ZNF4", 1, "ZNG4", 0., 0., 0., 0, "ONLY"); // --- Position the neutron calorimeter in ZDC - gMC->Gspos("ZNEU", 1, "ZDC ", fPosZN[0], fPosZN[1], fPosZN[2] + fDimZN[2], 0, "ONLY"); - + // -- Rotation of ZDCs + Int_t irotzdc; + gMC->Matrix(irotzdc, 90., 180., 90., 90., 180., 0.); + // + gMC->Gspos("ZNEU", 1, "ZDC ", fPosZN[0], fPosZN[1], fPosZN[2]-fDimZN[2], irotzdc, "ONLY"); + //Ch debug + //printf("\n ZN -> %f < z < %f cm\n",fPosZN[2],fPosZN[2]-2*fDimZN[2]); // ------------------------------------------------------------------------------- //--> Proton calorimeter (ZP) @@ -730,7 +711,9 @@ void AliZDCv2::CreateZDC() // --- Position the proton calorimeter in ZDC - gMC->Gspos("ZPRO", 1, "ZDC ", fPosZP[0], fPosZP[1], fPosZP[2] + fDimZP[2], 0, "ONLY"); + gMC->Gspos("ZPRO", 1, "ZDC ", fPosZP[0], fPosZP[1], fPosZP[2]-fDimZP[2], irotzdc, "ONLY"); + //Ch debug + //printf("\n ZP -> %f < z < %f cm\n",fPosZP[2],fPosZP[2]-2*fDimZP[2]); // ------------------------------------------------------------------------------- @@ -739,40 +722,40 @@ void AliZDCv2::CreateZDC() gMC->Gsvolu("ZEM ", "PARA", idtmed[10], fDimZEM, 6); Int_t irot1, irot2; - - gMC->Matrix(irot1,180.,0.,90.,90.,90.,0.); // Rotation matrix 1 + gMC->Matrix(irot1,0.,0.,90.,90.,-90.,0.); // Rotation matrix 1 gMC->Matrix(irot2,180.,0.,90.,fDimZEM[3]+90.,90.,fDimZEM[3]);// Rotation matrix 2 -// printf("irot1 = %d, irot2 = %d \n", irot1, irot2); + //printf("irot1 = %d, irot2 = %d \n", irot1, irot2); - gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material + gMC->Gsvolu("ZEMF", "TUBE", idtmed[3], fFibZEM, 3); // Active material - gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches - - DimPb[0] = fDimZEMPb; // Lead slices - DimPb[1] = fDimZEM[2]; - DimPb[2] = fDimZEM[1]; - DimPb[3] = 90.-fDimZEM[3]; - DimPb[4] = 0.; - DimPb[5] = 0.; - gMC->Gsvolu("ZEL0", "PARA", idtmed[5], DimPb, 6); - gMC->Gsvolu("ZEL1", "PARA", idtmed[5], DimPb, 6); -// gMC->Gsvolu("ZEL2", "PARA", idtmed[5], DimPb, 6); + gMC->Gsdvn("ZETR", "ZEM ", fDivZEM[2], 1); // Tranches + + dimPb[0] = kDimZEMPb; // Lead slices + dimPb[1] = fDimZEM[2]; + dimPb[2] = fDimZEM[1]; + //dimPb[3] = fDimZEM[3]; //controllare + dimPb[3] = 90.-fDimZEM[3]; //originale + dimPb[4] = 0.; + dimPb[5] = 0.; + gMC->Gsvolu("ZEL0", "PARA", idtmed[5], dimPb, 6); + gMC->Gsvolu("ZEL1", "PARA", idtmed[5], dimPb, 6); + gMC->Gsvolu("ZEL2", "PARA", idtmed[5], dimPb, 6); // --- Position the lead slices in the tranche Float_t zTran = fDimZEM[0]/fDivZEM[2]; - Float_t zTrPb = -zTran+fDimZEMPb; + Float_t zTrPb = -zTran+kDimZEMPb; gMC->Gspos("ZEL0", 1, "ZETR", zTrPb, 0., 0., 0, "ONLY"); - gMC->Gspos("ZEL1", 1, "ZETR", fDimZEMPb, 0., 0., 0, "ONLY"); + gMC->Gspos("ZEL1", 1, "ZETR", kDimZEMPb, 0., 0., 0, "ONLY"); // --- Vacuum zone (to be filled with fibres) - DimVoid[0] = (zTran-2*fDimZEMPb)/2.; - DimVoid[1] = fDimZEM[2]; - DimVoid[2] = fDimZEM[1]; - DimVoid[3] = 90.-fDimZEM[3]; - DimVoid[4] = 0.; - DimVoid[5] = 0.; - gMC->Gsvolu("ZEV0", "PARA", idtmed[10], DimVoid,6); - gMC->Gsvolu("ZEV1", "PARA", idtmed[10], DimVoid,6); + dimVoid[0] = (zTran-2*kDimZEMPb)/2.; + dimVoid[1] = fDimZEM[2]; + dimVoid[2] = fDimZEM[1]; + dimVoid[3] = 90.-fDimZEM[3]; + dimVoid[4] = 0.; + dimVoid[5] = 0.; + gMC->Gsvolu("ZEV0", "PARA", idtmed[10], dimVoid,6); + gMC->Gsvolu("ZEV1", "PARA", idtmed[10], dimVoid,6); // --- Divide the vacuum slice into sticks along x axis gMC->Gsdvn("ZES0", "ZEV0", fDivZEM[0], 3); @@ -783,24 +766,30 @@ void AliZDCv2::CreateZDC() gMC->Gspos("ZEMF", 1,"ZES1", 0., 0., 0., irot2, "ONLY"); // --- Positioning the vacuum slice into the tranche - Float_t DisplFib = fDimZEM[1]/fDivZEM[0]; - gMC->Gspos("ZEV0", 1,"ZETR", -DimVoid[0], 0., 0., 0, "ONLY"); - gMC->Gspos("ZEV1", 1,"ZETR", -DimVoid[0]+zTran, 0., DisplFib, 0, "ONLY"); + Float_t displFib = fDimZEM[1]/fDivZEM[0]; + gMC->Gspos("ZEV0", 1,"ZETR", -dimVoid[0], 0., 0., 0, "ONLY"); + gMC->Gspos("ZEV1", 1,"ZETR", -dimVoid[0]+zTran, 0., displFib, 0, "ONLY"); // --- Positioning the ZEM into the ZDC - rotation for 90 degrees // NB -> In AliZDCv2 ZEM is positioned in ALIC (instead of in ZDC) volume // beacause it's impossible to make a ZDC pcon volume to contain - // both hadronics and EM calorimeters. (It causes many tracks abandoning). - gMC->Gspos("ZEM ", 1,"ALIC", fPosZEM[0], fPosZEM[1], fPosZEM[2]+fDimZEM[0], irot1, "ONLY"); + // both hadronics and EM calorimeters. + gMC->Gspos("ZEM ", 1,"ALIC", -fPosZEM[0], fPosZEM[1], fPosZEM[2]+fDimZEM[0], irot1, "ONLY"); + + // Second EM ZDC (same side w.r.t. IP, just on the other side w.r.t. beam pipe) + gMC->Gspos("ZEM ", 2,"ALIC", fPosZEM[0], fPosZEM[1], fPosZEM[2]+fDimZEM[0], irot1, "ONLY"); // --- Adding last slice at the end of the EM calorimeter -// Float_t zLastSlice = fPosZEM[2]+fDimZEMPb+fDimZEM[0]; -// gMC->Gspos("ZEL2", 1,"ALIC", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY"); + Float_t zLastSlice = fPosZEM[2]+kDimZEMPb+2*fDimZEM[0]; + gMC->Gspos("ZEL2", 1,"ALIC", fPosZEM[0], fPosZEM[1], zLastSlice, irot1, "ONLY"); + //Ch debug + //printf("\n ZEM lenght = %f cm\n",2*fZEMLength); + //printf("\n ZEM -> %f < z < %f cm\n",fPosZEM[2],fPosZEM[2]+2*fZEMLength+zLastSlice+kDimZEMPb); } //_____________________________________________________________________________ -void AliZDCv2::DrawModule() +void AliZDCv2::DrawModule() const { // // Draw a shaded view of the Zero Degree Calorimeter version 1 @@ -911,7 +900,7 @@ void AliZDCv2::CreateMaterials() Int_t *idtmed = fIdtmed->GetArray(); - Float_t dens, ubuf[1], wmat[2], a[2], z[2], deemax = -1; + Float_t dens, ubuf[1], wmat[2], a[2], z[2]; Int_t i; // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3 @@ -954,20 +943,35 @@ void AliZDCv2::CreateMaterials() // --- Iron (energy loss taken into account) ubuf[0] = 1.1; - AliMaterial(7, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1); + AliMaterial(7, "IRON0", 55.85, 26., 7.87, 1.76, 0., ubuf, 1); // --- Iron (no energy loss) ubuf[0] = 1.1; - AliMaterial(8, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1); + AliMaterial(8, "IRON1", 55.85, 26., 7.87, 1.76, 0., ubuf, 1); + AliMaterial(13, "IRON2", 55.85, 26., 7.87, 1.76, 0., ubuf, 1); + // --------------------------------------------------------- + Float_t aResGas[3]={1.008,12.0107,15.9994}; + Float_t zResGas[3]={1.,6.,8.}; + Float_t wResGas[3]={0.28,0.28,0.44}; + Float_t dResGas = 3.2E-14; + // --- Vacuum (no magnetic field) - AliMaterial(10, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0); + AliMixture(10, "VOID", aResGas, zResGas, dResGas, 3, wResGas); + //AliMaterial(10, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0); // --- Vacuum (with magnetic field) - AliMaterial(11, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0); + AliMixture(11, "VOIM", aResGas, zResGas, dResGas, 3, wResGas); + //AliMaterial(11, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0); // --- Air (no magnetic field) - AliMaterial(12, "Air $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0); + Float_t aAir[4]={12.0107,14.0067,15.9994,39.948}; + Float_t zAir[4]={6.,7.,8.,18.}; + Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827}; + Float_t dAir = 1.20479E-3; + // + AliMixture(12, "Air $", aAir, zAir, dAir, 4, wAir); + //AliMaterial(12, "Air $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0); // --- Definition of tracking media: @@ -983,30 +987,35 @@ void AliZDCv2::CreateMaterials() // --- Vacuum (with field) = 11 // --- Air (no field) = 12 - - // --- Tracking media parameters - Float_t epsil = .01, stmin=0.01, stemax = 1.; -// Int_t isxfld = gAlice->Field()->Integ(); - Float_t fieldm = 0., tmaxfd = 0.; - Int_t ifield = 0, isvolActive = 1, isvol = 0, inofld = 0; - - AliMedium(1, "ZTANT", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); -// AliMedium(1, "ZW", 1, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(2, "ZBRASS",2, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(3, "ZSIO2", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(4, "ZQUAR", 3, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(5, "ZLEAD", 5, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); -// AliMedium(6, "ZCOPP", 6, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); -// AliMedium(7, "ZIRON", 7, isvolActive, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(6, "ZCOPP", 6, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(7, "ZIRON", 7, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(8, "ZIRONN",8, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(10,"ZVOID",10, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin); - AliMedium(12,"ZAIR", 12, 0, inofld, fieldm, tmaxfd, stemax,deemax, epsil, stmin); - - ifield =2; - fieldm = 45.; - AliMedium(11, "ZVOIM", 11, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, stmin); + // **************************************************** + // Tracking media parameters + // + Float_t epsil = 0.01; // Tracking precision, + Float_t stmin = 0.01; // Min. value 4 max. step (cm) + Float_t stemax = 1.; // Max. step permitted (cm) + Float_t tmaxfd = 0.; // Maximum angle due to field (degrees) + Float_t deemax = -1.; // Maximum fractional energy loss + Float_t nofieldm = 0.; // Max. field value (no field) + Float_t fieldm = 45.; // Max. field value (with field) + Int_t isvol = 0; // ISVOL =0 -> not sensitive volume + Int_t isvolActive = 1; // ISVOL =1 -> sensitive volume + Int_t inofld = 0; // IFIELD=0 -> no magnetic field + Int_t ifield =2; // IFIELD=2 -> magnetic field defined in AliMagFC.h + // ***************************************************** + + AliMedium(1, "ZTANT", 1, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin); + AliMedium(2, "ZBRASS",2, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin); + AliMedium(3, "ZSIO2", 3, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin); + AliMedium(4, "ZQUAR", 3, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin); + AliMedium(5, "ZLEAD", 5, isvolActive, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin); + AliMedium(6, "ZCOPP", 6, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin); + AliMedium(7, "ZIRON", 7, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin); + AliMedium(8, "ZIRONN",8, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin); + AliMedium(10,"ZVOID",10, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin); + AliMedium(12,"ZAIR", 12, isvol, inofld, nofieldm, tmaxfd, stemax, deemax, epsil, stmin); + // + AliMedium(11,"ZVOIM", 11, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, stmin); + AliMedium(13,"ZIRONE",13, isvol, ifield, fieldm, tmaxfd, stemax, deemax, epsil, stmin); // Thresholds for showering in the ZDCs i = 1; //tantalum @@ -1045,6 +1054,12 @@ void AliZDCv2::CreateMaterials() gMC->Gstpar(idtmed[i], "CUTELE", .1); gMC->Gstpar(idtmed[i], "CUTNEU", 1.); gMC->Gstpar(idtmed[i], "CUTHAD", 1.); + // Avoid too detailed showering along the beam line + i = 13; //iron with energy loss (ZIRONN) + gMC->Gstpar(idtmed[i], "CUTGAM", 1.); + gMC->Gstpar(idtmed[i], "CUTELE", 1.); + gMC->Gstpar(idtmed[i], "CUTNEU", 1.); + gMC->Gstpar(idtmed[i], "CUTHAD", 1.); // Avoid interaction in fibers (only energy loss allowed) i = 3; //fibers (ZSI02) @@ -1095,11 +1110,32 @@ void AliZDCv2::CreateMaterials() fMedSensF1 = idtmed[3]; // Sensitive volume: fibres type 1 fMedSensF2 = idtmed[4]; // Sensitive volume: fibres type 2 fMedSensZEM = idtmed[5]; // Sensitive volume: ZEM passive material -// fMedSensTDI = idtmed[6]; // Sensitive volume: TDI Cu shield -// fMedSensPI = idtmed[7]; // Sensitive volume: beam pipes + fMedSensTDI = idtmed[6]; // Sensitive volume: TDI Cu shield + fMedSensPI = idtmed[7]; // Sensitive volume: beam pipes fMedSensGR = idtmed[12]; // Sensitive volume: air into the grooves } +//_____________________________________________________________________________ +void AliZDCv2::AddAlignableVolumes() const +{ + // + // Create entries for alignable volumes associating the symbolic volume + // name with the corresponding volume path. Needs to be syncronized with + // eventual changes in the geometry. + // + TString volpath1 = "ALIC_1/ZDC_1/ZNEU_1"; + TString volpath2 = "ALIC_1/ZDC_1/ZPRO_1"; + + TString symname1="ZDC/NeutronZDC"; + TString symname2="ZDC/ProtonZDC"; + + if(!gGeoManager->SetAlignableEntry(symname1.Data(),volpath1.Data())) + AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname1.Data(),volpath1.Data())); + + if(!gGeoManager->SetAlignableEntry(symname2.Data(),volpath2.Data())) + AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname2.Data(),volpath2.Data())); +} + //_____________________________________________________________________________ void AliZDCv2::Init() { @@ -1109,6 +1145,10 @@ void AliZDCv2::Init() //_____________________________________________________________________________ void AliZDCv2::InitTables() { + // + // Read light tables for Cerenkov light production parameterization + // + Int_t k, j; char *lightfName1,*lightfName2,*lightfName3,*lightfName4, @@ -1116,22 +1156,22 @@ void AliZDCv2::InitTables() FILE *fp1, *fp2, *fp3, *fp4, *fp5, *fp6, *fp7, *fp8; // --- Reading light tables for ZN - lightfName1 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362207s"); + lightfName1 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362207s"); if((fp1 = fopen(lightfName1,"r")) == NULL){ printf("Cannot open file fp1 \n"); return; } - lightfName2 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362208s"); + lightfName2 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362208s"); if((fp2 = fopen(lightfName2,"r")) == NULL){ printf("Cannot open file fp2 \n"); return; } - lightfName3 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362209s"); + lightfName3 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362209s"); if((fp3 = fopen(lightfName3,"r")) == NULL){ printf("Cannot open file fp3 \n"); return; } - lightfName4 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620362210s"); + lightfName4 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620362210s"); if((fp4 = fopen(lightfName4,"r")) == NULL){ printf("Cannot open file fp4 \n"); return; @@ -1151,22 +1191,22 @@ void AliZDCv2::InitTables() fclose(fp4); // --- Reading light tables for ZP and ZEM - lightfName5 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552207s"); + lightfName5 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552207s"); if((fp5 = fopen(lightfName5,"r")) == NULL){ printf("Cannot open file fp5 \n"); return; } - lightfName6 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552208s"); + lightfName6 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552208s"); if((fp6 = fopen(lightfName6,"r")) == NULL){ printf("Cannot open file fp6 \n"); return; } - lightfName7 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552209s"); + lightfName7 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552209s"); if((fp7 = fopen(lightfName7,"r")) == NULL){ printf("Cannot open file fp7 \n"); return; } - lightfName8 = gSystem->ExpandPathName("$ALICE/$ALICE_LEVEL/ZDC/light22620552210s"); + lightfName8 = gSystem->ExpandPathName("$ALICE_ROOT/ZDC/light22620552210s"); if((fp8 = fopen(lightfName8,"r")) == NULL){ printf("Cannot open file fp8 \n"); return; @@ -1185,257 +1225,122 @@ void AliZDCv2::InitTables() fclose(fp7); fclose(fp8); } - -//_____________________________________________________________________________ -Int_t AliZDCv2::Digitize(Int_t Det, Int_t Quad, Int_t Light) -{ - // Evaluation of the ADC channel corresponding to the light yield Light - - if(fDebug == 1){ - printf("\n Digitize -> Det = %d, Quad = %d, Light = %d\n", Det, Quad, Light); - } - - // Parameters for conversion of light yield in ADC channels - Float_t fPMGain[3][5]; // PM gain - Float_t fADCRes; // ADC conversion factor - - Int_t j,i; - for(i=0; i<3; i++){ - for(j=0; j<5; j++){ - fPMGain[i][j] = 100000.; - } - } - fADCRes = 0.00000064; // ADC Resolution: 250 fC/ADCch - - Int_t ADCch = Int_t(Light*fPMGain[Det-1][Quad]*fADCRes); - - return ADCch; -} - - -//_____________________________________________________________________________ -void AliZDCv2::SDigits2Digits() -{ - Hits2Digits(gAlice->GetNtrack()); -} - -//_____________________________________________________________________________ -void AliZDCv2::Hits2Digits(Int_t ntracks) -{ - AliZDCDigit *newdigit; - AliZDCHit *hit; - - Int_t PMCZN = 0, PMCZP = 0, PMQZN[4], PMQZP[4], PMZEM = 0; - - Int_t i; - for(i=0; i<4; i++){ - PMQZN[i] =0; - PMQZP[i] =0; - } - - Int_t itrack = 0; - for(itrack=0; itrackResetHits(); - gAlice->TreeH()->GetEvent(itrack); - for(i=0; iGetEntries(); i++){ - hit = (AliZDCHit*)fHits->At(i); - Int_t det = hit->GetVolume(0); - Int_t quad = hit->GetVolume(1); - Int_t lightQ = Int_t(hit->GetLightPMQ()); - Int_t lightC = Int_t(hit->GetLightPMC()); - if(fDebug == 1) - printf(" \n itrack = %d, fNhits = %d, det = %d, quad = %d," - "lightC = %d lightQ = %d\n", itrack, fNhits, det, quad, lightC, lightQ); - - if(det == 1){ //ZN - PMCZN = PMCZN + lightC; - PMQZN[quad-1] = PMQZN[quad-1] + lightQ; - } - - if(det == 2){ //ZP - PMCZP = PMCZP + lightC; - PMQZP[quad-1] = PMQZP[quad-1] + lightQ; - } - - if(det == 3){ //ZEM - PMZEM = PMZEM + lightC; - } - } // Hits loop - - } // Tracks loop - - if(fDebug == 1){ - printf("\n PMCZN = %d, PMQZN[0] = %d, PMQZN[1] = %d, PMQZN[2] = %d, PMQZN[3] = %d\n" - , PMCZN, PMQZN[0], PMQZN[1], PMQZN[2], PMQZN[3]); - printf("\n PMCZP = %d, PMQZP[0] = %d, PMQZP[1] = %d, PMQZP[2] = %d, PMQZP[3] = %d\n" - , PMCZP, PMQZP[0], PMQZP[1], PMQZP[2], PMQZP[3]); - printf("\n PMZEM = %d\n", PMZEM); - } - - // ------------------------------------ Hits2Digits - // Digits for ZN - newdigit = new AliZDCDigit(1, 0, Digitize(1, 0, PMCZN)); - new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit); - fNdigits++; - delete newdigit; - - Int_t j; - for(j=0; j<4; j++){ - newdigit = new AliZDCDigit(1, j+1, Digitize(1, j+1, PMQZN[j])); - new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit); - fNdigits++; - delete newdigit; - } - - // Digits for ZP - newdigit = new AliZDCDigit(2, 0, Digitize(2, 0, PMCZP)); - new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit); - fNdigits++; - delete newdigit; - - Int_t k; - for(k=0; k<4; k++){ - newdigit = new AliZDCDigit(2, k+1, Digitize(2, k+1, PMQZP[k])); - new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit); - fNdigits++; - delete newdigit; - } - - // Digits for ZEM - newdigit = new AliZDCDigit(3, 0, Digitize(3, 0, PMZEM)); - new((*fDigits)[fNdigits]) AliZDCDigit(*newdigit); - fNdigits++; - delete newdigit; - - - gAlice->TreeD()->Fill(); - gAlice->TreeD()->Write(0,TObject::kOverwrite); - -// if(fDebug == 1){ -// printf("\n Event Digits -----------------------------------------------------\n"); -// fDigits->Print(""); -// } - -} -//_____________________________________________________________________________ - void AliZDCv2::MakeBranch(Option_t *opt, const char *file) -{ - // - // Create a new branch in the current Root Tree - // - - AliDetector::MakeBranch(opt); - - Char_t branchname[10]; - sprintf(branchname,"%s",GetName()); - const char *cD = strstr(opt,"D"); - - if (gAlice->TreeD() && cD) { - - // Creation of the digits from hits - - if(fDigits!=0) fDigits->Clear(); - else fDigits = new TClonesArray ("AliZDCDigit",1000); - char branchname[10]; - sprintf(branchname,"%s",GetName()); - MakeBranchInTree(gAlice->TreeD(), - branchname, &fDigits, fBufferSize, file) ; - printf("* AliZDCv2::MakeBranch * Making Branch %s for digits\n\n",branchname); - } - -} //_____________________________________________________________________________ void AliZDCv2::StepManager() { // // Routine called at every step in the Zero Degree Calorimeters // - + Int_t j, vol[2], ibeta=0, ialfa, ibe, nphe; - Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, radius, out; - TLorentzVector s, p; + Float_t x[3], xdet[3], destep, hits[10], m, ekin, um[3], ud[3], be, out; + //Float_t radius; + Float_t xalic[3], z, guiEff, guiPar[4]={0.31,-0.0004,0.0197,0.7958}; + Double_t s[3], p[4]; const char *knamed; - for (j=0;j<10;j++) hits[j]=0; + for (j=0;j<10;j++) hits[j]=-999.; + + // --- This part is for no shower developement in beam pipe and TDI + // If particle interacts with beam pipe or TDI -> return + if((gMC->CurrentMedium() == fMedSensPI) || (gMC->CurrentMedium() == fMedSensTDI)){ + // If option NoShower is set -> StopTrack + if(fNoShower==1) { + if(gMC->CurrentMedium() == fMedSensPI) { + knamed = gMC->CurrentVolName(); + if(!strncmp(knamed,"YMQ",3)) fpLostIT += 1; + if(!strncmp(knamed,"YD1",3)) fpLostD1 += 1; + } + else if(gMC->CurrentMedium() == fMedSensTDI){ // NB->Cu = TDI or D1 vacuum chamber + knamed = gMC->CurrentVolName(); + if(!strncmp(knamed,"MD1",3)) fpLostD1 += 1; + if(!strncmp(knamed,"QTD",3)) fpLostTDI += 1; + } + printf("\n # of spectators lost in IT = %d\n",fpLostIT); + printf("\n # of spectators lost in D1 = %d\n",fpLostD1); + printf("\n # of spectators lost in TDI = %d\n\n",fpLostTDI); + gMC->StopTrack(); + } + return; + } + + if((gMC->CurrentMedium() == fMedSensZN) || (gMC->CurrentMedium() == fMedSensZP) || + (gMC->CurrentMedium() == fMedSensGR) || (gMC->CurrentMedium() == fMedSensF1) || + (gMC->CurrentMedium() == fMedSensF2) || (gMC->CurrentMedium() == fMedSensZEM)){ - if((gMC->GetMedium() == fMedSensZN) || (gMC->GetMedium() == fMedSensZP) || - (gMC->GetMedium() == fMedSensGR) || (gMC->GetMedium() == fMedSensF1) || - (gMC->GetMedium() == fMedSensF2) || (gMC->GetMedium() == fMedSensZEM)){ -// (gMC->GetMedium() == fMedSensPI) || (gMC->GetMedium() == fMedSensTDI)){ - - // If particle interacts with beam pipe -> return -// if((gMC->GetMedium() == fMedSensPI) || (gMC->GetMedium() == fMedSensTDI)){ - // If option NoShower is set -> StopTrack -// if(fNoShower==1) { -// if(gMC->GetMedium() == fMedSensPI) { -// knamed = gMC->CurrentVolName(); -// if((!strncmp(knamed,"MQ",2)) || (!strncmp(knamed,"YM",2))) fpLostIT += 1; -// if((!strncmp(knamed,"MD1",3))|| (!strncmp(knamed,"YD1",2))) fpLostD1 += 1; -// } -// if(gMC->GetMedium() == fMedSensTDI) fpLostTDI += 1; -// gMC->StopTrack(); -// printf("\n # of p lost in Inner Triplet = %d\n",fpLostIT); -// printf("\n # of p lost in D1 = %d\n",fpLostD1); -// printf("\n # of p lost in TDI = %d\n",fpLostTDI); -// } -// return; -// } //Particle coordinates - gMC->TrackPosition(s); - for(j=0; j<=2; j++){ - x[j] = s[j]; - } + gMC->TrackPosition(s[0],s[1],s[2]); + for(j=0; j<=2; j++) x[j] = s[j]; hits[0] = x[0]; hits[1] = x[1]; hits[2] = x[2]; // Determine in which ZDC the particle is knamed = gMC->CurrentVolName(); - if(!strncmp(knamed,"ZN",2))vol[0]=1; - if(!strncmp(knamed,"ZP",2))vol[0]=2; - if(!strncmp(knamed,"ZE",2))vol[0]=3; + if(!strncmp(knamed,"ZN",2)) vol[0]=1; + else if(!strncmp(knamed,"ZP",2)) vol[0]=2; + else if(!strncmp(knamed,"ZE",2)) vol[0]=3; // Determine in which quadrant the particle is - - //Quadrant in ZN - if(vol[0]==1){ + if(vol[0]==1){ //Quadrant in ZN + // Calculating particle coordinates inside ZN xdet[0] = x[0]-fPosZN[0]; xdet[1] = x[1]-fPosZN[1]; - if((xdet[0]<=0.) && (xdet[1]>=0.)) vol[1]=1; - if((xdet[0]>0.) && (xdet[1]>0.)) vol[1]=2; - if((xdet[0]<0.) && (xdet[1]<0.)) vol[1]=3; - if((xdet[0]>0.) && (xdet[1]<0.)) vol[1]=4; + // Calculating quadrant in ZN + if(xdet[0]<=0.){ + if(xdet[1]>=0.) vol[1]=1; + else if(xdet[1]<0.) vol[1]=3; + } + else if(xdet[0]>0.){ + if(xdet[1]>=0.) vol[1]=2; + else if(xdet[1]<0.) vol[1]=4; + } + if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4)) + printf("\n ZDC StepManager->ERROR in ZN!!! vol[1] = %d, xdet[0] = %f," + "xdet[1] = %f\n",vol[1], xdet[0], xdet[1]); } - //Quadrant in ZP - if(vol[0]==2){ + else if(vol[0]==2){ //Quadrant in ZP + // Calculating particle coordinates inside ZP xdet[0] = x[0]-fPosZP[0]; xdet[1] = x[1]-fPosZP[1]; - if(xdet[0]>fDimZP[0])xdet[0]=fDimZP[0]-0.01; - if(xdet[0]<-fDimZP[0])xdet[0]=-fDimZP[0]+0.01; - Float_t xqZP = xdet[0]/(fDimZP[0]/2); + if(xdet[0]>=fDimZP[0]) xdet[0]=fDimZP[0]-0.01; + if(xdet[0]<=-fDimZP[0]) xdet[0]=-fDimZP[0]+0.01; + // Calculating tower in ZP + Float_t xqZP = xdet[0]/(fDimZP[0]/2.); for(int i=1; i<=4; i++){ if(xqZP>=(i-3) && xqZP<(i-2)){ vol[1] = i; break; } } + if((vol[1]!=1) && (vol[1]!=2) && (vol[1]!=3) && (vol[1]!=4)) + printf(" ZDC StepManager->ERROR in ZP!!! vol[1] = %d, xdet[0] = %f," + "xdet[1] = %f\n",vol[1], xdet[0], xdet[1]); } - //ZEM has only 1 quadrant - if(vol[0] == 3){ - vol[1] = 1; - xdet[0] = x[0]-fPosZEM[0]; + // Quadrant in ZEM: vol[1] = 1 -> particle in 1st ZEM (placed at x = 8.5 cm) + // vol[1] = 2 -> particle in 2nd ZEM (placed at x = -8.5 cm) + else if(vol[0] == 3){ + if(x[0]>0.){ + vol[1] = 1; + // Particle x-coordinate inside ZEM1 + xdet[0] = x[0]-fPosZEM[0]; + } + else{ + vol[1] = 2; + // Particle x-coordinate inside ZEM2 + xdet[0] = x[0]+fPosZEM[0]; + } xdet[1] = x[1]-fPosZEM[1]; } // Store impact point and kinetic energy of the ENTERING particle -// if(Curtrack==Prim){ if(gMC->IsTrackEntering()){ //Particle energy - gMC->TrackMomentum(p); + gMC->TrackMomentum(p[0],p[1],p[2],p[3]); hits[3] = p[3]; // Impact point on ZDC hits[4] = xdet[0]; @@ -1445,56 +1350,56 @@ void AliZDCv2::StepManager() hits[8] = 0; hits[9] = 0; -// Int_t PcID = gMC->TrackPid(); -// printf("Pc ID -> %d\n",PcID); - AddHit(gAlice->CurrentTrack(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); if(fNoShower==1){ -// fpDetected += 1; + if(vol[0]==1) fnDetected += 1; + else if(vol[0]==2) fpDetected += 1; + printf("\n # of nucleons in ZN = %d",fnDetected); + printf("\n # of nucleons in ZP = %d\n\n",fpDetected); gMC->StopTrack(); -// printf("\n # of detected p = %d\n",fpDetected); return; } } -// } // Curtrack IF // Charged particles -> Energy loss if((destep=gMC->Edep())){ if(gMC->IsTrackStop()){ - gMC->TrackMomentum(p); + gMC->TrackMomentum(p[0],p[1],p[2],p[3]); m = gMC->TrackMass(); ekin = p[3]-m; hits[9] = ekin; hits[7] = 0.; hits[8] = 0.; - AddHit(gAlice->CurrentTrack(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } else{ hits[9] = destep; hits[7] = 0.; hits[8] = 0.; - AddHit(gAlice->CurrentTrack(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } -// printf(" Dep. E = %f \n",hits[9]); } - }// NB -> Questa parentesi (chiude il primo IF) io la sposterei al fondo!??? + } // *** Light production in fibres - if((gMC->GetMedium() == fMedSensF1) || (gMC->GetMedium() == fMedSensF2)){ + if((gMC->CurrentMedium() == fMedSensF1) || (gMC->CurrentMedium() == fMedSensF2)){ //Select charged particles if((destep=gMC->Edep())){ // Particle velocity - gMC->TrackMomentum(p); + Float_t beta = 0.; + gMC->TrackMomentum(p[0],p[1],p[2],p[3]); Float_t ptot=TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]); - Float_t beta = ptot/p[3]; - if(beta<0.67) return; - if((beta>=0.67) && (beta<=0.75)) ibeta = 0; - if((beta>0.75) && (beta<=0.85)) ibeta = 1; - if((beta>0.85) && (beta<=0.95)) ibeta = 2; - if(beta>0.95) ibeta = 3; + if(p[3] > 0.00001) beta = ptot/p[3]; + else return; + if(beta<0.67)return; + else if((beta>=0.67) && (beta<=0.75)) ibeta = 0; + else if((beta>0.75) && (beta<=0.85)) ibeta = 1; + else if((beta>0.85) && (beta<=0.95)) ibeta = 2; + else if(beta>0.95) ibeta = 3; // Angle between particle trajectory and fibre axis // 1 -> Momentum directions @@ -1506,10 +1411,11 @@ void AliZDCv2::StepManager() Double_t alfar = TMath::ACos(ud[2]); Double_t alfa = alfar*kRaddeg; if(alfa>=110.) return; + // ialfa = Int_t(1.+alfa/2.); // Distance between particle trajectory and fibre axis - gMC->TrackPosition(s); + gMC->TrackPosition(s[0],s[1],s[2]); for(j=0; j<=2; j++){ x[j] = s[j]; } @@ -1522,65 +1428,78 @@ void AliZDCv2::StepManager() be = TMath::Abs(ud[0]); } - if((vol[0]==1)) radius = fFibZN[1]; - if((vol[0]==2)) radius = fFibZP[1]; ibe = Int_t(be*1000.+1); + //if((vol[0]==1)) radius = fFibZN[1]; + //else if((vol[0]==2)) radius = fFibZP[1]; //Looking into the light tables Float_t charge = gMC->TrackCharge(); - // (1) ZN - if((vol[0]==1)) { + if((vol[0]==1)) { // (1) ZN fibres if(ibe>fNben) ibe=fNben; out = charge*charge*fTablen[ibeta][ialfa][ibe]; nphe = gRandom->Poisson(out); -// printf("ZN --- ibeta = %d, ialfa = %d, ibe = %d" -// " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe); - if(gMC->GetMedium() == fMedSensF1){ + // Ch. debug + //if(ibeta==3) printf("\t %f \t %f \t %f\n",alfa, be, out); + //printf("\t ibeta = %d, ialfa = %d, ibe = %d -> nphe = %d\n\n",ibeta,ialfa,ibe,nphe); + if(gMC->CurrentMedium() == fMedSensF1){ hits[7] = nphe; //fLightPMQ hits[8] = 0; hits[9] = 0; - AddHit(gAlice->CurrentTrack(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } else{ hits[7] = 0; hits[8] = nphe; //fLightPMC hits[9] = 0; - AddHit(gAlice->CurrentTrack(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } } - - // (2) ZP - if((vol[0]==2)) { + else if((vol[0]==2)) { // (2) ZP fibres if(ibe>fNbep) ibe=fNbep; out = charge*charge*fTablep[ibeta][ialfa][ibe]; nphe = gRandom->Poisson(out); -// printf("ZP --- ibeta = %d, ialfa = %d, ibe = %d" -// " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe); - if(gMC->GetMedium() == fMedSensF1){ + if(gMC->CurrentMedium() == fMedSensF1){ hits[7] = nphe; //fLightPMQ hits[8] = 0; hits[9] = 0; - AddHit(gAlice->CurrentTrack(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } else{ hits[7] = 0; hits[8] = nphe; //fLightPMC hits[9] = 0; - AddHit(gAlice->CurrentTrack(), vol, hits); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); } } - // (3) ZEM - if((vol[0]==3)) { + else if((vol[0]==3)) { // (3) ZEM fibres if(ibe>fNbep) ibe=fNbep; out = charge*charge*fTablep[ibeta][ialfa][ibe]; + gMC->TrackPosition(s[0],s[1],s[2]); + for(j=0; j<=2; j++){ + xalic[j] = s[j]; + } + // z-coordinate from ZEM front face + // NB-> fPosZEM[2]+fZEMLength = -1000.+2*10.3 = 979.69 cm + z = -xalic[2]+fPosZEM[2]+2*fZEMLength-xalic[1]; +// z = xalic[2]-fPosZEM[2]-fZEMLength-xalic[1]*(TMath::Tan(45.*kDegrad)); +// printf("\n fPosZEM[2]+2*fZEMLength = %f", fPosZEM[2]+2*fZEMLength); + guiEff = guiPar[0]*(guiPar[1]*z*z+guiPar[2]*z+guiPar[3]); + out = out*guiEff; nphe = gRandom->Poisson(out); -// printf("ZEM --- ibeta = %d, ialfa = %d, ibe = %d" -// " -> out = %f, nphe = %d\n", ibeta, ialfa, ibe, out, nphe); - hits[7] = 0; - hits[8] = nphe; //fLightPMC - hits[9] = 0; - AddHit(gAlice->CurrentTrack(), vol, hits); +// printf(" out*guiEff = %f nphe = %d", out, nphe); + if(vol[1] == 1){ + hits[7] = 0; + hits[8] = nphe; //fLightPMC (ZEM1) + hits[9] = 0; + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); + } + else{ + hits[7] = nphe; //fLightPMQ (ZEM2) + hits[8] = 0; + hits[9] = 0; + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits); + } } } }