]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/AliZDCv3.cxx
ZDC information from A-side (Chiara)
[u/mrichter/AliRoot.git] / ZDC / AliZDCv3.cxx
index 79b81f42b0106d1e4994b63975606f043bee06bf..2f8ca27d2856e73ffd2993c929ac0c75df068dd5 100644 (file)
@@ -17,7 +17,7 @@
 ///////////////////////////////////////////////////////////////////////
 //                                                                   //
 //             AliZDCv3 --- new ZDC geometry                        //
-//         with the both ZDC set geometry implemented               //
+//         with both ZDC arms geometry implemented                  //
 //                                                                   //  
 ///////////////////////////////////////////////////////////////////////
 
 #include <TTree.h>
 #include <TVirtualMC.h>
 #include <TGeoManager.h>
+#include <TGeoMatrix.h>
+#include <TGeoCone.h>
+#include <TGeoShape.h>
+#include <TGeoCompositeShape.h>
 #include <TParticle.h>
 
 // --- AliRoot classes
@@ -202,9 +206,14 @@ void AliZDCv3::CreateBeamLine()
   // Create the beam line elements
   //
   
-  Float_t zc, zq, zd1, zd2, zql, zd2l;
-  Float_t conpar[9], tubpar[3], tubspar[5], boxpar[3];
-  Int_t im1, im2;
+  Double_t zc, zq, zd1, zd2, zql, zd2l;
+  Double_t conpar[9], tubpar[3], tubspar[5], boxpar[3];
+
+  //-- rotation matrices for the legs
+  Int_t irotpipe7, irotpipe8;
+  gMC->Matrix(irotpipe7,90.-1.0027,0.,90.,90.,1.0027,180.);      
+  gMC->Matrix(irotpipe8,90.+1.0027,0.,90.,90.,1.0027,0.);
+
   //
   Int_t *idtmed = fIdtmed->GetArray();
   
@@ -240,7 +249,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QT01", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT01", 1, "ZDCC", 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);
+  //printf("   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) 
@@ -257,7 +266,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QT02", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT02", 1, "ZDCC", 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);
+  //printf("   QT02 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
 
   zd1 += 2.*tubpar[2];
   
@@ -269,7 +278,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QC01", "CONE", idtmed[7], conpar, 5);
   gMC->Gspos("QC01", 1, "ZDCC", 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);
+  //printf("   QC01 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
 
   zd1 += 2.*conpar[0];
   
@@ -279,7 +288,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QT03", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT03", 1, "ZDCC", 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);
+  //printf("   QT03 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
   zd1 += tubpar[2]*2.;
   
@@ -289,7 +298,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QT04", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT04", 1, "ZDCC", 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);
+  //printf("   QT04 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
   zd1 += tubpar[2] * 2.;
   
@@ -297,9 +306,9 @@ void AliZDCv3::CreateBeamLine()
   tubpar[1] = 10.4/2.;
   tubpar[2] = 3.16/2.;
   gMC->Gsvolu("QT05", "TUBE", idtmed[7], tubpar, 3);
-  gMC->Gspos("QT05", 1, "ZDCC", 0., 0., -tubpar[0]-zd1, 0, "ONLY");
+  gMC->Gspos("QT05", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
   // Ch.debug
-  //printf("\n QT05 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
+  //printf("   QT05 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
   zd1 += tubpar[2] * 2.;
   
@@ -309,7 +318,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QT06", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT06", 1, "ZDCC", 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);
+  //printf("   QT06 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
   zd1 += tubpar[2] * 2.;
   
@@ -321,7 +330,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QC02", "CONE", idtmed[7], conpar, 5);
   gMC->Gspos("QC02", 1, "ZDCC", 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);
+  //printf("   QC02 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
   
   zd1 += conpar[0] * 2.;
   
@@ -331,7 +340,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QT07", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT07", 1, "ZDCC", 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);
+  //printf("   QT07 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
   zd1 += tubpar[2] * 2.;
   
@@ -343,7 +352,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QC03", "CONE", idtmed[7], conpar, 5);
   gMC->Gspos("QC03", 1, "ZDCC", 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);
+  //printf("   QC03 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
   
   zd1 += conpar[0] * 2.;
   
@@ -353,7 +362,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QT08", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT08", 1, "ZDCC", 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);
+  //printf("   QT08 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
   zd1 += tubpar[2] * 2.;
   
@@ -364,7 +373,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QT09", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT09", 1, "ZDCC", 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);
+  //printf("   QT09 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
   zd1 += tubpar[2] * 2.;
   
@@ -375,7 +384,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QT10", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT10", 1, "ZDCC", 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);
+  //printf("   QT10 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
   zd1 += tubpar[2] * 2.;
   
@@ -385,7 +394,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QT11", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT11", 1, "ZDCC", 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);
+  //printf("   QT11 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
   zd1 += tubpar[2] * 2.;
   
@@ -397,7 +406,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QC04", "CONE", idtmed[7], conpar, 5);
   gMC->Gspos("QC04", 1, "ZDCC", 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);
+  //printf("   QC04 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
   
   zd1 += conpar[0] * 2.;
   
@@ -407,7 +416,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QT12", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT12", 1, "ZDCC", 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);
+  //printf("   QT12 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
   zd1 += tubpar[2] * 2.;
   
@@ -419,67 +428,130 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QC05", "CONE", idtmed[7], conpar, 5);
   gMC->Gspos("QC05", 1, "ZDCC", 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);
+  //printf("   QC05 CONE pipe from z = %f to z= %f\n",-zd1,-2*conpar[0]-zd1);
   
   zd1 += conpar[0] * 2.;
   
   tubpar[0] = 68./2.;
   tubpar[1] = 68.4/2.;
-  tubpar[2] = 927.3/2.;
+  tubpar[2] = 848.6/2.;
   gMC->Gsvolu("QT13", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QT13", 1, "ZDCC", 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);
+  //printf("   QT13 TUBE pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
   zd1 += tubpar[2] * 2.;
+
+  // --------------------------------------------------------
+  // RECOMBINATION CHAMBER IMPLEMENTED USING TGeo CLASSES!!!!
+  // author: Chiara (August 2008)
+  // --------------------------------------------------------
+  // TRANSFORMATION MATRICES
+  // Combi transformation: 
+  Double_t dx = -3.970000;
+  Double_t dy = 0.000000;
+  Double_t dz = 0.0;
+  // Rotation: 
+  Double_t thx = 84.989100;   Double_t phx = 0.000000;
+  Double_t thy = 90.000000;   Double_t phy = 90.000000;
+  Double_t thz = 5.010900;    Double_t phz = 180.000000;
+  TGeoRotation *rotMatrix1c = new TGeoRotation("c",thx,phx,thy,phy,thz,phz);
+  // Combi transformation: 
+  dx = -3.970000;
+  dy = 0.000000;
+  dz = 0.0;
+  TGeoCombiTrans *rotMatrix2c = new TGeoCombiTrans("ZDCC_c1", dx,dy,dz,rotMatrix1c);
+  rotMatrix2c->RegisterYourself();
+  // Combi transformation: 
+  dx = 3.970000;
+  dy = 0.000000;
+  dz = 0.0;
+  // Rotation: 
+  thx = 95.010900;    phx = 0.000000;
+  thy = 90.000000;    phy = 90.000000;
+  thz = 5.010900;    phz = 0.000000;
+  TGeoRotation *rotMatrix3c = new TGeoRotation("",thx,phx,thy,phy,thz,phz);
+  TGeoCombiTrans *rotMatrix4c = new TGeoCombiTrans("ZDCC_c2", dx,dy,dz,rotMatrix3c);
+  rotMatrix4c->RegisterYourself();
+
+  // VOLUMES DEFINITION
+  // Volume: ZDCC
+  TGeoVolume *pZDCC = gGeoManager->GetVolume("ZDCC");
+  //pZDCC->PrintNodes();
   
-  tubpar[0] = 0./2.;
-  tubpar[1] = 68.4/2.;
-  tubpar[2] = 0.2/2.;
-  gMC->Gsvolu("QT14", "TUBE", idtmed[8], tubpar, 3);
-  gMC->Gspos("QT14", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
+  conpar[0] = (90.1-0.95-0.26)/2.;
+  conpar[1] = 0.0/2.;
+  conpar[2] = 21.6/2.;
+  conpar[3] = 0.0/2.;
+  conpar[4] = 5.8/2.;
+  new TGeoCone("QCLext", conpar[0],conpar[1],conpar[2],conpar[3],conpar[4]);
+  
+  conpar[0] = (90.1-0.95-0.26)/2.;
+  conpar[1] = 0.0/2.;
+  conpar[2] = 21.2/2.;
+  conpar[3] = 0.0/2.;
+  conpar[4] = 5.4/2.;
+  new TGeoCone("QCLint", conpar[0],conpar[1],conpar[2],conpar[3],conpar[4]);
+
+  // Outer trousers
+  TGeoCompositeShape *pOutTrousersC = new TGeoCompositeShape("outTrousersC", "QCLext:ZDCC_c1+QCLext:ZDCC_c2");
+  
+  // Volume: QCLext
+  TGeoMedium *medZDCFe = gGeoManager->GetMedium("ZDC_ZIRON");
+  TGeoVolume *pQCLext = new TGeoVolume("QCLext",pOutTrousersC, medZDCFe);
+  pQCLext->SetLineColor(kGreen);
+  pQCLext->SetVisLeaves(kTRUE);
+  //
+  TGeoTranslation *tr1c = new TGeoTranslation(0., 0., (Double_t) conpar[0]+0.95+zd1);
+  pZDCC->AddNode(pQCLext, 1, tr1c);
+  // Inner trousers
+  TGeoCompositeShape *pIntTrousersC = new TGeoCompositeShape("intTrousersC", "QCLint:ZDCC_c1+QCLint:ZDCC_c2");
+  // Volume: QCLint
+  TGeoMedium *medZDCvoid = gGeoManager->GetMedium("ZDC_ZVOID");
+  TGeoVolume *pQCLint = new TGeoVolume("QCLint",pIntTrousersC, medZDCvoid);
+  pQCLint->SetLineColor(kTeal);
+  pQCLint->SetVisLeaves(kTRUE);
+  pQCLext->AddNode(pQCLint, 1);
+    
+  zd1 += 90.1;
+  
+  //  second section : 2 tubes (ID = 54. OD = 58.)  
+  tubpar[0] = 5.4/2.;
+  tubpar[1] = 5.8/2.;
+  tubpar[2] = 40.0/2.;
+  gMC->Gsvolu("QC14", "TUBE", idtmed[7], tubpar, 3);
+  gMC->Gspos("QC14", 1, "ZDCC", -15.8/2., 0., -tubpar[2]-zd1, 0, "ONLY");
+  gMC->Gspos("QC14", 2, "ZDCC",  15.8/2., 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);
+  //printf("   QC14 TUBE from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
   
-  zd1 += tubpar[2] * 2.;
+  zd1 += 2.*tubpar[2];
   
-  tubpar[0] = 0./2.;
-  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");
-
-  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 
-  
-  tubpar[0] = 6.4/2.;
-  tubpar[1] = 6.8/2.;
-  tubpar[2] = 680.8/2.;
-  gMC->Gsvolu("QT17", "TUBE", idtmed[7], tubpar, 3);
-
-  tubpar[0] = 6.4/2.;
-  tubpar[1] = 6.8/2.;
-  tubpar[2] = 680.8/2.;
-  gMC->Gsvolu("QT18", "TUBE", idtmed[7], tubpar, 3);
-  
-  // -- ROTATE PIPES 
-  Float_t angle = 0.143*kDegrad; // Rotation angle
-  
-  //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, "ZDCC", TMath::Sin(angle) * 680.8/ 2. - 9.4, 
-             0., -tubpar[2]-zd1, im1, "ONLY"); 
-  //printf("\n QT17-18 pipe from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);
-            
-  //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, "ZDCC", 9.7 - TMath::Sin(angle) * 680.8 / 2., 
-             0., -tubpar[2]-zd1, im2, "ONLY"); 
+  // transition x2zdc to recombination chamber : skewed cone  
+  conpar[0] = (10.-0.2)/2.;
+  conpar[1] = 5.4/2.;
+  conpar[2] = 5.8/2.;
+  conpar[3] = 6.3/2.;
+  conpar[4] = 7.0/2.;
+  gMC->Gsvolu("QC15", "CONE", idtmed[7], conpar, 5); 
+  gMC->Gspos("QC15", 1, "ZDCC", -7.9-0.175, 0., -conpar[0]-0.1-zd1, irotpipe7, "ONLY");
+  gMC->Gspos("QC15", 2, "ZDCC", 7.9+0.175, 0., -conpar[0]-0.1-zd1, irotpipe8, "ONLY");
+  //printf("   QC15 CONE from z = %f to z= %f\n",-zd1,-2*conpar[0]-0.2-zd1);
+
+  zd1 += 2.*conpar[0]+0.2;
+  
+  // 2 tubes (ID = 63 mm OD=70 mm)      
+  tubpar[0] = 6.3/2.;
+  tubpar[1] = 7.0/2.;
+  tubpar[2] = 512.9/2.;
+  gMC->Gsvolu("QC16", "TUBE", idtmed[7], tubpar, 3);
+  gMC->Gspos("QC16", 1, "ZDCC", -16.5/2., 0., -tubpar[2]-zd1, 0, "ONLY");
+  gMC->Gspos("QC16", 2, "ZDCC",  16.5/2., 0., -tubpar[2]-zd1, 0, "ONLY");
+  //printf("   QA16 TUBE from z = %f to z= %f\n",-zd1,-2*tubpar[2]-zd1);  
+
+  zd1 += 2.*tubpar[2];
+  //printf("\n END OF SIDE C BEAM PIPE DEFINITION @ z = %f\n",-zd1);
+
           
   // -- Luminometer (Cu box) in front of ZN - side C
   boxpar[0] = 8.0/2.;
@@ -487,7 +559,7 @@ void AliZDCv3::CreateBeamLine()
   boxpar[2] = 15./2.;
   gMC->Gsvolu("QLUC", "BOX ", idtmed[6], boxpar, 3);
   gMC->Gspos("QLUC", 1, "ZDCC", 0., 0.,  fPosZNC[2]+66.+boxpar[2], 0, "ONLY");
-  //printf("\n QLUC LUMINOMETER from z = %f to z= %f\n",  fPosZNC[2]+66., fPosZNC[2]+66.+2*boxpar[2]);
+  //printf("   QLUC LUMINOMETER from z = %f to z= %f\n",  fPosZNC[2]+66., fPosZNC[2]+66.+2*boxpar[2]);
                 
   // --  END OF BEAM PIPE VOLUME DEFINITION FOR SIDE C (RB26 SIDE) 
   // ----------------------------------------------------------------
@@ -499,16 +571,16 @@ void AliZDCv3::CreateBeamLine()
   ///////////////////////////////////////////////////////////////
 
   // Rotation Matrices definition
-  Int_t irotpipe2, irotpipe1,irotpipe5, irotpipe6, irotpipe7, irotpipe8;
-  //-- rotation matrices for the tilted tube before and after the TDI 
-  gMC->Matrix(irotpipe2,90.+6.3025,0.,90.,90.,6.3025,0.);       
+  Int_t irotpipe1, irotpipe2;
   //-- rotation matrices for the tilted cone after the TDI to recenter vacuum chamber      
   gMC->Matrix(irotpipe1,90.-2.2918,0.,90.,90.,2.2918,180.);    
-  //-- rotation matrices for the legs
-  gMC->Matrix(irotpipe5,90.-5.0109,0.,90.,90.,5.0109,180.);      
-  gMC->Matrix(irotpipe6,90.+5.0109,0.,90.,90.,5.0109,0.);         
+  //-- rotation matrices for the tilted tube before and after the TDI 
+  gMC->Matrix(irotpipe2,90.+6.3025,0.,90.,90.,6.3025,0.);       
+/*  //-- rotation matrices for the legs
+  Int_t irotpipe7, irotpipe8;
   gMC->Matrix(irotpipe7,90.-1.0027,0.,90.,90.,1.0027,180.);      
   gMC->Matrix(irotpipe8,90.+1.0027,0.,90.,90.,1.0027,0.);
+*/
 
   // -- Mother of the ZDCs (Vacuum PCON)               
   zd2 = 1910.22;// zd2 initial value
@@ -525,14 +597,18 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("ZDCA", "PCON", idtmed[10], conpar, 9);
   gMC->Gspos("ZDCA", 1, "ALIC", 0., 0., 0., 0, "ONLY");
   
+  // To avoid overlaps 1 micron are left between certain volumes!
+  Double_t dxNoOverlap = 0.0001;
+  zd2 += dxNoOverlap;  
+  
   // BEAM PIPE from 19.10 m to inner triplet beginning (22.965 m)  
   tubpar[0] = 6.0/2.;
   tubpar[1] = 6.4/2.;
-  tubpar[2] = (386.5 - 0.22)/2.;
+  tubpar[2] = 386.28/2. - dxNoOverlap; 
   gMC->Gsvolu("QA01", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QA01", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
   // Ch.debug
-  //printf("\n QA01 TUBE from z = %f to z= %f (Inner triplet beg.)\n",zd2,2*tubpar[2]+zd2);
+  //printf("   QA01 TUBE centred in %f from z = %f to z = %f (IT begin)\n",tubpar[2]+zd2,zd2,2*tubpar[2]+zd2);
   
   zd2 += 2.*tubpar[2];  
 
@@ -540,11 +616,11 @@ void AliZDCv3::CreateBeamLine()
   //    beginning of D1)  
   tubpar[0] = 6.3/2.;
   tubpar[1] = 6.7/2.;
-  tubpar[2] = 3541.8/2.;
+  tubpar[2] = 3541.8/2. - dxNoOverlap;
   gMC->Gsvolu("QA02", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QA02", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
   // Ch.debug
-  //printf("\n QA02 TUBE from z = %f to z= %f (D1 beg.)\n",zd2,2*tubpar[2]+zd2);
+  //printf("   QA02 TUBE from z = %f to z = %f (D1 begin)\n",zd2,2*tubpar[2]+zd2);
   
   zd2 += 2.*tubpar[2]; 
   
@@ -558,7 +634,7 @@ void AliZDCv3::CreateBeamLine()
   //  2) 2.5 cm conical section from ID = 6.75 to ID = 8.0 cm
   //  3) 43.9 cm straight section (tube) with ID = 8.0 cm
   //
-  //printf("\n Beginning of D1 at z= %f\n",zd2);
+  //printf("   Beginning of D1 at z= %f\n",zd2);
 
   tubpar[0] = 6.75/2.;
   tubpar[1] = 7.15/2.;
@@ -566,7 +642,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QA03", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QA03", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
   // Ch.debug
-  //printf("\n QA03 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
+  //printf("   QA03 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
   
   zd2 += 2.*tubpar[2];
 
@@ -588,7 +664,7 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QA05", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QA05", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
   // Ch.debug
-  //printf("\n QA05 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
+  //printf("   QA05 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
   
   zd2 += 2.*tubpar[2];
   
@@ -753,7 +829,7 @@ void AliZDCv3::CreateBeamLine()
   tubspar[4] = 180.;  
   gMC->Gsvolu("Q08T", "TUBS", idtmed[7], tubspar, 5);
   // Ch.debug
-  //printf("\n upper part : one single phi segment of a tube (Q08T)\n");  
+  //printf("   upper part : one single phi segment of a tube (Q08T)\n");  
   
   // rectangular beam pipe inside TCDD upper section (Vacuum)  
   boxpar[0] = 7.0/2.;
@@ -1031,14 +1107,14 @@ void AliZDCv3::CreateBeamLine()
   // the third 8 mm thick
   //
   // First section
-  conpar[0] = 9.09/2.; // 15 degree
+  conpar[0] = (9.09 - dxNoOverlap)/2.; // 15 degree
   conpar[1] = 79.7/2.;
   conpar[2] = 81.3/2.; // thickness 8 mm  
   conpar[3] = 74.82868/2.;
   conpar[4] = 76.42868/2.; // thickness 8 mm 
   gMC->Gsvolu("Q24A", "CONE", idtmed[7], conpar, 5);
-  gMC->Gspos("Q24A", 1, "ZDCA", 0., 0., conpar[0]+zd2, 0, "ONLY");
-  //printf("   Q24A CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
+  gMC->Gspos("Q24A", 1, "ZDCA", 0., 0., conpar[0]+zd2+dxNoOverlap/2., 0, "ONLY");
+  //printf("   Q24A CONE from z = %f to z= %f\n",zd2+dxNoOverlap/2.,2*conpar[0]+zd2+dxNoOverlap/2.);
 
   zd2 += 2.*conpar[0];  
 
@@ -1178,19 +1254,7 @@ void AliZDCv3::CreateBeamLine()
   // Ch.debug  
   //printf("   QA34 CONE from z = %f to z= %f\n",zd2,2*conpar[0]+zd2);
 
-  zd2 += 2.*conpar[0];
-  // Flange:  first support for the trousers
-  boxpar[0] = 25.3/2.;
-  boxpar[1] = 25.3/2.;
-  boxpar[2] = 2.5/2.;
-  gMC->Gsvolu("QF03", "BOX ", idtmed[7], boxpar, 3);
-  tubpar[0] = 0.0/2.;
-  tubpar[1] = 22.06/2.;
-  tubpar[2] = 2.5/2.;
-  gMC->Gsvolu("QFV1", "TUBE", idtmed[10], tubpar, 3);
-  gMC->Gspos("QFV1", 1, "QF03", 0., 0., 0., 0, "MANY");
-  gMC->Gspos("QF03", 1, "ZDCA", 0., 0., 14.3+zd2, 0, "MANY");  
+  zd2 += 2.*conpar[0]; 
   
   // tube  
   tubpar[0] = 21.66/2.;
@@ -1199,31 +1263,81 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("QA35", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("QA35", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");
   // Ch.debug 
-  //printf("\n QA35  TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
+  //printf("   QA35  TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);
 
   zd2 += 2.*tubpar[2];
 
-  // legs of the trousers
+  // --------------------------------------------------------
+  // RECOMBINATION CHAMBER IMPLEMENTED USING TGeo CLASSES!!!!
+  // author: Chiara (June 2008)
+  // --------------------------------------------------------
+  // TRANSFORMATION MATRICES
+  // Combi transformation: 
+  dx = -3.970000;
+  dy = 0.000000;
+  dz = 0.0;
+  // Rotation: 
+  thx = 84.989100;   phx = 0.000000;
+  thy = 90.000000;   phy = 90.000000;
+  thz = 5.010900;    phz = 180.000000;
+  TGeoRotation *rotMatrix1 = new TGeoRotation("",thx,phx,thy,phy,thz,phz);
+  // Combi transformation: 
+  dx = -3.970000;
+  dy = 0.000000;
+  dz = 0.0;
+  TGeoCombiTrans *rotMatrix2 = new TGeoCombiTrans("ZDC_c1", dx,dy,dz,rotMatrix1);
+  rotMatrix2->RegisterYourself();
+  // Combi transformation: 
+  dx = 3.970000;
+  dy = 0.000000;
+  dz = 0.0;
+  // Rotation: 
+  thx = 95.010900;   phx = 0.000000;
+  thy = 90.000000;   phy = 90.000000;
+  thz = 5.010900;    phz = 0.000000;
+  TGeoRotation *rotMatrix3 = new TGeoRotation("",thx,phx,thy,phy,thz,phz);
+  TGeoCombiTrans *rotMatrix4 = new TGeoCombiTrans("ZDC_c2", dx,dy,dz,rotMatrix3);
+  rotMatrix4->RegisterYourself();
+  
+  
+  // VOLUMES DEFINITION
+  // Volume: ZDCA
+  TGeoVolume *pZDCA = gGeoManager->GetVolume("ZDCA");
+  //pZDCA->PrintNodes();
+  
   conpar[0] = (90.1-0.95-0.26)/2.;
   conpar[1] = 0.0/2.;
   conpar[2] = 21.6/2.;
   conpar[3] = 0.0/2.;
   conpar[4] = 5.8/2.;
-  gMC->Gsvolu("QAL1", "CONE", idtmed[7], conpar, 5);
-  gMC->Gsvolu("QAL2", "CONE", idtmed[7], conpar, 5); 
-  gMC->Gspos("QAL1", 1, "ZDCA", -3.45-0.52, 0., conpar[0]+0.95+zd2, irotpipe5, "MANY");
-  gMC->Gspos("QAL2", 1, "ZDCA", 3.45+0.52, 0., conpar[0]+0.95+zd2, irotpipe6, "MANY");
+  new TGeoCone("QALext", conpar[0],conpar[1],conpar[2],conpar[3],conpar[4]);
   
   conpar[0] = (90.1-0.95-0.26)/2.;
   conpar[1] = 0.0/2.;
   conpar[2] = 21.2/2.;
   conpar[3] = 0.0/2.;
   conpar[4] = 5.4/2.;
-  gMC->Gsvolu("QAL3", "CONE", idtmed[10], conpar, 5);
-  gMC->Gsvolu("QAL4", "CONE", idtmed[10], conpar, 5); 
-  gMC->Gspos("QAL3", 1, "ZDCA", -3.45-0.52, 0., conpar[0]+0.95+zd2, irotpipe5, "ONLY");
-  //gMC->Gspos("QAL4", 1, "ZDCA", 3.45+0.52, 0., conpar[0]+0.95+zd2, irotpipe6, "ONLY");
-  gMC->Gspos("QAL4", 1, "QAL2", 0., 0., 0., 0, "ONLY");      
+  new TGeoCone("QALint", conpar[0],conpar[1],conpar[2],conpar[3],conpar[4]);
+
+  // Outer trousers
+  TGeoCompositeShape *pOutTrousers = new TGeoCompositeShape("outTrousers", "QALext:ZDC_c1+QALext:ZDC_c2");
+  
+  // Volume: QALext
+  //TGeoMedium *medZDCFe = gGeoManager->GetMedium("ZDC_ZIRON");
+  TGeoVolume *pQALext = new TGeoVolume("QALext",pOutTrousers, medZDCFe);
+  pQALext->SetLineColor(kBlue);
+  pQALext->SetVisLeaves(kTRUE);
+  //
+  TGeoTranslation *tr1 = new TGeoTranslation(0., 0., (Double_t) conpar[0]+0.95+zd2);
+  pZDCA->AddNode(pQALext, 1, tr1);
+  // Inner trousers
+  TGeoCompositeShape *pIntTrousers = new TGeoCompositeShape("intTrousers", "QALint:ZDC_c1+QALint:ZDC_c2");
+  // Volume: QALint
+  //TGeoMedium *medZDCvoid = gGeoManager->GetMedium("ZDC_ZVOID");
+  TGeoVolume *pQALint = new TGeoVolume("QALint",pIntTrousers, medZDCvoid);
+  pQALint->SetLineColor(kAzure);
+  pQALint->SetVisLeaves(kTRUE);
+  pQALext->AddNode(pQALint, 1);
     
   zd2 += 90.1;
   
@@ -1252,32 +1366,6 @@ void AliZDCv3::CreateBeamLine()
 
   zd2 += 2.*conpar[0]+0.2;
   
-  // Flange: second support for the trousers
-  boxpar[0] = 25.9/2.;
-  boxpar[1] = 9.4/2.;
-  boxpar[2] = 1./2.;
-  gMC->Gsvolu("QF04", "BOX ", idtmed[7], boxpar, 3);
-  boxpar[0] = 16.5/2.;
-  boxpar[1] = 7./2.;
-  boxpar[2] = 1./2.;
-  gMC->Gsvolu("QFV2", "BOX ", idtmed[10], boxpar, 3);
-  gMC->Gspos("QFV2", 1, "QF04", 0., 0., 0., 0, "MANY");
-  tubspar[0] = 0.0/2.;
-  tubspar[1] = 7./2.;
-  tubspar[2] = 1./2.;
-  tubspar[3] = 90.;
-  tubspar[4] = 270.;  
-  gMC->Gsvolu("QFV3", "TUBS", idtmed[10], tubspar, 5);
-  gMC->Gspos("QFV3", 1, "QF04", -16.5/2., 0.,  0., 0, "MANY"); 
-  tubspar[0] = 0.0/2.;
-  tubspar[1] = 7./2.;
-  tubspar[2] = 1./2.;
-  tubspar[3] = -90.;
-  tubspar[4] = 90.;  
-  gMC->Gsvolu("QFV4", "TUBS", idtmed[10], tubspar, 5);
-  gMC->Gspos("QFV4", 1, "QF04", 16.5/2., 0.,  0., 0, "MANY");
-  gMC->Gspos("QF04", 1, "ZDCA", 0., 0.,  18.5+zd2, 0, "MANY");
-  
   // 2 tubes (ID = 63 mm OD=70 mm)      
   tubpar[0] = 6.3/2.;
   tubpar[1] = 7.0/2.;
@@ -1288,12 +1376,13 @@ void AliZDCv3::CreateBeamLine()
   //printf("   QA38 TUBE from z = %f to z= %f\n",zd2,2*tubpar[2]+zd2);  
 
   zd2 += 2.*tubpar[2];
-  //printf("\n END OF BEAM PIPE VOLUME DEFINITION AT z= %f\n",zd2);
+  //printf("\n END OF SIDE A BEAM PIPE DEFINITION @ z= %f\n",zd2);
           
   // -- Luminometer (Cu box) in front of ZN - side A
   boxpar[0] = 8.0/2.;
   boxpar[1] = 8.0/2.;
   boxpar[2] = 15./2.;
+  //boxpar[2] = (15.+15.+7.5)/2.;
   gMC->Gsvolu("QLUA", "BOX ", idtmed[7], boxpar, 3);
   gMC->Gspos("QLUA", 1, "ZDCA", 0., 0.,  fPosZNA[2]-66.-boxpar[2], 0, "ONLY");
   //printf("\n QLUC LUMINOMETER from z = %f to z= %f\n\n",  fPosZNA[2]-66., fPosZNA[2]-66.-2*boxpar[2]);
@@ -1367,11 +1456,11 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gspos("YMQ ", 2, "ZDCC", 0., 0., -tubpar[2]-zq-1558.5, 0, "ONLY");
   
   // -- SEPARATOR DIPOLE D1 
-  zd1 = 5838.3;
+  zd1 = 5838.3001;
   
   // --  GAP (VACUUM WITH MAGNETIC FIELD) 
   tubpar[0] = 0.;
-  tubpar[1] = 6.94/2.;
+  tubpar[1] = 3.46;
   tubpar[2] = 945./2.;
   gMC->Gsvolu("MD1 ", "TUBE", idtmed[11], tubpar, 3);
   
@@ -1385,15 +1474,15 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gspos("MD1V", 2, "MD1 ", 0., -2.98-boxpar[1], 0., 0, "ONLY");
     
   // --  YOKE 
-  tubpar[0] = 3.48;
+  tubpar[0] = 3.68;
   tubpar[1] = 110./2.;
   tubpar[2] = 945./2.;
   gMC->Gsvolu("YD1 ", "TUBE", idtmed[7], tubpar, 3);
   
   gMC->Gspos("YD1 ", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
-  gMC->Gspos("MD1 ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
+  gMC->Gspos("MD1 ", 1, "ZDCC", 0., 0., -tubpar[2]-zd1, 0, "ONLY");
   // Ch debug
-  //printf("\t **** D1 positioned! It goes from z = %1.2f to z = %1.2f cm\n",-zd1, -zd1-2*tubpar[2]); 
+  //printf("   MD1 from z = %f to z = %f cm\n",-zd1, -zd1-2*tubpar[2]); 
   
   // -- DIPOLE D2 
   // --- LHC optics v6.4
@@ -1423,7 +1512,6 @@ void AliZDCv3::CreateBeamLine()
   // COMPENSATOR DIPOLE (MCBWA) (2nd compensator)
   // --  GAP (VACUUM WITH MAGNETIC FIELD) 
   tubpar[0] = 0.;
-  //tubpar[1] = 4.5;
   tubpar[1] = 3.;  
   tubpar[2] = 153./2.;
   gMC->Gsvolu("MCBW", "TUBE", idtmed[11], tubpar, 3);  
@@ -1436,7 +1524,6 @@ void AliZDCv3::CreateBeamLine()
   gMC->Gsvolu("YMCB", "TUBE", idtmed[7], tubpar, 3);
   gMC->Gspos("YMCB", 1, "ZDCA", 0., 0., tubpar[2]+1972.5, 0, "ONLY");  
   
-  
    // -- INNER TRIPLET 
   zql = 2296.5; 
 
@@ -1444,9 +1531,10 @@ void AliZDCv3::CreateBeamLine()
   // --  MQX1 
   // --  GAP (VACUUM WITH MAGNETIC FIELD) 
   tubpar[0] = 0.;
-  tubpar[1] = 3.5;
+  tubpar[1] = 3.14;
   tubpar[2] = 637./2.;
   gMC->Gsvolu("MQX1", "TUBE", idtmed[11], tubpar, 3);
+  gMC->Gsvolu("MQX4", "TUBE", idtmed[11], tubpar, 3);
     
   // --  YOKE 
   tubpar[0] = 3.5;
@@ -1454,56 +1542,57 @@ void AliZDCv3::CreateBeamLine()
   tubpar[2] = 637./2.;
   gMC->Gsvolu("YMQ1", "TUBE", idtmed[7], tubpar, 3);
 
+  // -- Q1
+  gMC->Gspos("MQX1", 1, "ZDCA", 0., 0., tubpar[2]+zql, 0, "ONLY");
+  gMC->Gspos("YMQ1", 1, "ZDCA", 0., 0., tubpar[2]+zql, 0, "ONLY");
+
    // -- BEAM SCREEN FOR Q1
    tubpar[0] = 4.78/2.;
    tubpar[1] = 5.18/2.;
    tubpar[2] = 637./2.;
    gMC->Gsvolu("QBS1", "TUBE", idtmed[6], tubpar, 3);
-   gMC->Gspos("QBS1", 1, "ZDCA", 0., 0., tubpar[2]+zql, 0, "ONLY");
+   gMC->Gspos("QBS1", 1, "MQX1", 0., 0., 0., 0, "ONLY");
    // INSERT VERTICAL PLATE INSIDE Q1
    boxpar[0] = 0.2/2.0;
    boxpar[1] = TMath::Sqrt(tubpar[0]*tubpar[0]-(1.9+0.2)*(1.9+0.2));
    boxpar[2] =637./2.;
    gMC->Gsvolu("QBS2", "BOX ", idtmed[6], boxpar, 3);
-   gMC->Gspos("QBS2", 1, "ZDCA", 1.9+boxpar[0], 0., boxpar[2]+zql, 0, "ONLY");
-   gMC->Gspos("QBS2", 2, "ZDCA", -1.9-boxpar[0], 0., boxpar[2]+zql, 0, "ONLY");
+   gMC->Gspos("QBS2", 1, "MQX1", 1.9+boxpar[0], 0., 0., 0, "ONLY");
+   gMC->Gspos("QBS2", 2, "MQX1", -1.9-boxpar[0], 0., 0., 0, "ONLY");
+
+   // -- Q3   
+   gMC->Gspos("MQX4", 1, "ZDCA", 0., 0., tubpar[2]+zql+2400., 0, "ONLY");
+   gMC->Gspos("YMQ1", 2, "ZDCA", 0., 0., tubpar[2]+zql+2400., 0, "ONLY");
 
    // -- BEAM SCREEN FOR Q3
    tubpar[0] = 5.79/2.;
    tubpar[1] = 6.14/2.;
    tubpar[2] = 637./2.;
    gMC->Gsvolu("QBS3", "TUBE", idtmed[6], tubpar, 3);
-   gMC->Gspos("QBS3", 1, "ZDCA", 0., 0., tubpar[2]+zql+2400., 0, "ONLY");
+   gMC->Gspos("QBS3", 1, "MQX4", 0., 0., 0., 0, "ONLY");
    // INSERT VERTICAL PLATE INSIDE Q3
    boxpar[0] = 0.2/2.0;
    boxpar[1] = TMath::Sqrt(tubpar[0]*tubpar[0]-(2.405+0.2)*(2.405+0.2));
    boxpar[2] =637./2.;
    gMC->Gsvolu("QBS4", "BOX ", idtmed[6], boxpar, 3);
-   gMC->Gspos("QBS4", 1, "ZDCA", 2.405+boxpar[0], 0., boxpar[2]+zql+2400., 0, "ONLY");
-   gMC->Gspos("QBS4", 2, "ZDCA", -2.405-boxpar[0], 0., boxpar[2]+zql+2400., 0, "ONLY");
-  
-  // -- Q1
-  gMC->Gspos("MQX1", 1, "ZDCA", 0., 0., tubpar[2]+zql, 0, "MANY");
-  gMC->Gspos("YMQ1", 1, "ZDCA", 0., 0., tubpar[2]+zql, 0, "ONLY");
-  
-  // -- Q3
-  gMC->Gspos("MQX1", 2, "ZDCA", 0., 0., tubpar[2]+zql+2400., 0, "MANY");
-  gMC->Gspos("YMQ1", 2, "ZDCA", 0., 0., tubpar[2]+zql+2400., 0, "ONLY");  
+   gMC->Gspos("QBS4", 1, "MQX4", 2.405+boxpar[0], 0., 0., 0, "ONLY");
+   gMC->Gspos("QBS4", 2, "MQX4", -2.405-boxpar[0], 0., 0., 0, "ONLY");
+    
   
   
   // --  MQX2
   // --  GAP (VACUUM WITH MAGNETIC FIELD) 
   tubpar[0] = 0.;
-  tubpar[1] = 3.5;
+  tubpar[1] = 3.14;
   tubpar[2] = 550./2.;
   gMC->Gsvolu("MQX2", "TUBE", idtmed[11], tubpar, 3);
+  gMC->Gsvolu("MQX3", "TUBE", idtmed[11], tubpar, 3);
   
   // --  YOKE 
   tubpar[0] = 3.5;
   tubpar[1] = 22.;
   tubpar[2] = 550./2.;
   gMC->Gsvolu("YMQ2", "TUBE", idtmed[7], tubpar, 3);
-  
 
    // -- BEAM SCREEN FOR Q2
    tubpar[0] = 5.79/2.;
@@ -1517,18 +1606,18 @@ void AliZDCv3::CreateBeamLine()
    gMC->Gsvolu("QBS6", "BOX ", idtmed[6], boxpar, 3);
 
   // -- Q2A
-  gMC->Gspos("MQX2", 1, "ZDCA", 0., 0., tubpar[2]+zql+908.5,  0, "MANY");
-  gMC->Gspos("QBS5", 1, "ZDCA", 0., 0., tubpar[2]+zql+908.5, 0, "ONLY");  
-  gMC->Gspos("QBS6", 1, "ZDCA", 2.405+boxpar[0], 0., boxpar[2]+zql+908.5, 0, "ONLY");
-  gMC->Gspos("QBS6", 2, "ZDCA", -2.405-boxpar[0], 0., boxpar[2]+zql+908.5, 0, "ONLY");  
+  gMC->Gspos("MQX2", 1, "ZDCA", 0., 0., tubpar[2]+zql+908.5,  0, "ONLY");
+  gMC->Gspos("QBS5", 1, "MQX2", 0., 0., 0., 0, "ONLY");  
+  gMC->Gspos("QBS6", 1, "MQX2", 2.405+boxpar[0], 0., 0., 0, "ONLY");
+  gMC->Gspos("QBS6", 2, "MQX2", -2.405-boxpar[0], 0., 0., 0, "ONLY");  
   gMC->Gspos("YMQ2", 1, "ZDCA", 0., 0., tubpar[2]+zql+908.5,  0, "ONLY");
 
   
   // -- Q2B
-  gMC->Gspos("MQX2", 2, "ZDCA", 0., 0., tubpar[2]+zql+1558.5, 0, "MANY");
-  gMC->Gspos("QBS5", 2, "ZDCA", 0., 0., tubpar[2]+zql+1558.5, 0, "ONLY");  
-  gMC->Gspos("QBS6", 3, "ZDCA", 2.405+boxpar[0], 0., boxpar[2]+zql+1558.5, 0, "ONLY");
-  gMC->Gspos("QBS6", 4, "ZDCA", -2.405-boxpar[0], 0., boxpar[2]+zql+1558.5, 0, "ONLY");
+  gMC->Gspos("MQX3", 1, "ZDCA", 0., 0., tubpar[2]+zql+1558.5, 0, "ONLY");
+  gMC->Gspos("QBS5", 2, "MQX3", 0., 0., 0., 0, "ONLY");  
+  gMC->Gspos("QBS6", 3, "MQX3", 2.405+boxpar[0], 0., 0., 0, "ONLY");
+  gMC->Gspos("QBS6", 4, "MQX3", -2.405-boxpar[0], 0., 0., 0, "ONLY");
   gMC->Gspos("YMQ2", 2, "ZDCA", 0., 0., tubpar[2]+zql+1558.5, 0, "ONLY");
 
     // -- SEPARATOR DIPOLE D1 
@@ -1536,29 +1625,28 @@ void AliZDCv3::CreateBeamLine()
   
   // --  GAP (VACUUM WITH MAGNETIC FIELD) 
   tubpar[0] = 0.;
-  tubpar[1] = 6.75/2.;
+  tubpar[1] = 6.75/2.;//3.375
   tubpar[2] = 945./2.;
   gMC->Gsvolu("MD1L", "TUBE", idtmed[11], tubpar, 3);
-  
+
   // --  The beam screen tube is provided by the beam pipe in D1 (QA03 volume)
   // --  Insert the beam screen horizontal Cu plates inside D1  
   // --   (to simulate the vacuum chamber)
   boxpar[0] = TMath::Sqrt(tubpar[1]*tubpar[1]-(2.885+0.2)*(2.885+0.2));
   boxpar[1] = 0.2/2.;
-  boxpar[2] =(945.+80.1)/2.;
+  boxpar[2] =945./2.;  
   gMC->Gsvolu("QBS7", "BOX ", idtmed[6], boxpar, 3);
-  gMC->Gspos("QBS7", 1, "ZDCA", 0., 2.885+boxpar[1],boxpar[2]+zd2, 0, "ONLY");
-  gMC->Gspos("QBS7", 2, "ZDCA", 0., -2.885-boxpar[1],boxpar[2]+zd2, 0, "ONLY");
+  gMC->Gspos("QBS7", 1, "MD1L", 0., 2.885+boxpar[1],0., 0, "ONLY");
+  gMC->Gspos("QBS7", 2, "MD1L", 0., -2.885-boxpar[1],0., 0, "ONLY");  
     
   // --  YOKE 
-  tubpar[0] = 7.34/2.; // to be checked
+  tubpar[0] = 3.68;
   tubpar[1] = 110./2;
   tubpar[2] = 945./2.;
   gMC->Gsvolu("YD1L", "TUBE", idtmed[7], tubpar, 3);
   
   gMC->Gspos("YD1L", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");  
-  gMC->Gspos("MD1L", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "MANY");
-
+  gMC->Gspos("MD1L", 1, "ZDCA", 0., 0., tubpar[2]+zd2, 0, "ONLY");  
   
   // -- DIPOLE D2 
   // --- LHC optics v6.5
@@ -1907,15 +1995,21 @@ void AliZDCv3::CreateMaterials()
   //
   // Create Materials for the Zero Degree Calorimeter
   //
-  
-  Float_t dens, ubuf[1], wmat[2], a[2], z[2];
-
-  // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3 
+  Float_t dens, ubuf[1], wmat[3], a[3], z[3];
+
+  // --- W alloy -> ZN passive material
+  dens = 17.6;
+  a[0] = 183.85;
+  a[1] = 55.85;
+  a[2] = 58.71;
+  z[0] = 74.;
+  z[1] = 26.;
+  z[2] = 28.;
+  wmat[0] = .93;
+  wmat[1] = .03;
+  wmat[2] = .04;
+  AliMixture(1, "WALL", a, z, dens, 3, wmat);
 
-  // --- Tantalum -> ZN passive material
-  ubuf[0] = 1.1;
-  AliMaterial(1, "TANT", 180.95, 73., 16.65, .4, 11.9, ubuf, 1);
-  
   // --- Brass (CuZn)  -> ZP passive material
   dens = 8.48;
   a[0] = 63.546;
@@ -1950,8 +2044,7 @@ void AliZDCv3::CreateMaterials()
   
   // --- Iron (no energy loss)
   ubuf[0] = 1.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);
+  AliMaterial(8, "IRON1", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
     
   // ---------------------------------------------------------  
   Float_t aResGas[3]={1.008,12.0107,15.9994};
@@ -2016,7 +2109,7 @@ void AliZDCv3::CreateMaterials()
   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);  
+
 
 } 
 
@@ -2097,13 +2190,6 @@ void AliZDCv3::Init()
   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)
   gMC->Gstpar(idtmed[i], "DCAY", 0.);
@@ -2261,7 +2347,8 @@ void AliZDCv3::StepManager()
   // --- 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 option NoShower is set -> StopTrack
+    Int_t ipr = 0; 
     if(fNoShower==1){
       gMC->TrackPosition(s[0],s[1],s[2]);
       if(gMC->CurrentMedium() == fMedSensPI){
@@ -2269,10 +2356,12 @@ void AliZDCv3::StepManager()
         if(!strncmp(knamed,"YMQ",3)){
          if(s[2]<0) fpLostITC += 1;
          else fpLostITA += 1;
+         ipr=1;
         }
        else if(!strncmp(knamed,"YD1",3)){
          if(s[2]<0) fpLostD1C += 1;
          else fpLostD1A += 1;
+         ipr=1;
        }
        else if(!strncmp(knamed,"QAL",3)) fnTrou++;
       }
@@ -2281,11 +2370,13 @@ void AliZDCv3::StepManager()
         if(!strncmp(knamed,"MD1",3)){
          if(s[2]<0) fpLostD1C += 1;
          else  fpLostD1A += 1;
+         ipr=1;
         }
        else if(!strncmp(knamed,"QTD",3)) fpLostTDI += 1;
        else if(!strncmp(knamed,"QLU",3)){
          if(s[2]<0) fnLumiC ++;
          else fnLumiA++;
+         ipr=1;
        }
       }
       //
@@ -2293,18 +2384,20 @@ void AliZDCv3::StepManager()
       //printf("\t Particle: mass = %1.3f, E = %1.3f GeV, pz = %1.2f GeV -> stopped in volume %s\n", 
       //     gMC->TrackMass(), p[3], p[2], gMC->CurrentVolName());
       //
-      printf("\n\t **********************************\n");
-      printf("\t ********** Side C **********\n");
-      printf("\t # of spectators in IT = %d\n",fpLostITC);
-      printf("\t # of spectators in D1 = %d\n",fpLostD1C);
-      printf("\t # of spectators in luminometer = %d\n",fnLumiC);
-      printf("\t ********** Side A **********\n");
-      printf("\t # of spectators in IT = %d\n",fpLostITA);
-      printf("\t # of spectators in D1 = %d\n",fpLostD1A);
-      printf("\t # of spectators in TDI = %d\n",fpLostTDI);
-      printf("\t # of spectators in luminometer = %d\n",fnLumiA);
-      printf("\t # of spectators in trousers = %d\n",fnTrou);
-      printf("\t **********************************\n");
+      if(ipr!=0){
+        printf("\n\t **********************************\n");
+        printf("\t ********** Side C **********\n");
+        printf("\t # of spectators in IT = %d\n",fpLostITC);
+        printf("\t # of spectators in D1 = %d\n",fpLostD1C);
+        printf("\t # of spectators in luminometer = %d\n",fnLumiC);
+        printf("\t ********** Side A **********\n");
+        printf("\t # of spectators in IT = %d\n",fpLostITA);
+        printf("\t # of spectators in D1 = %d\n",fpLostD1A);
+        printf("\t # of spectators in TDI = %d\n",fpLostTDI);
+        printf("\t # of spectators in luminometer = %d\n",fnLumiA);
+        printf("\t # of spectators in trousers = %d\n",fnTrou);
+        printf("\t **********************************\n");
+      }
       gMC->StopTrack();
     }
     return;
@@ -2356,8 +2449,8 @@ void AliZDCv3::StepManager()
     
     else if(vol[0]==2){        //Quadrant in ZPC
       // Calculating particle coordinates inside ZPC
-      xdet[0] = x[0]-fPosZPA[0];
-      xdet[1] = x[1]-fPosZPA[1];
+      xdet[0] = x[0]-fPosZPC[0];
+      xdet[1] = x[1]-fPosZPC[1];
       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
@@ -2409,8 +2502,8 @@ void AliZDCv3::StepManager()
     //
     else if(vol[0]==5){        //Quadrant in ZPA
       // Calculating particle coordinates inside ZPA
-      xdet[0] = x[0]-fPosZPC[0];
-      xdet[1] = x[1]-fPosZPC[1];
+      xdet[0] = x[0]-fPosZPA[0];
+      xdet[1] = x[1]-fPosZPA[1];
       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
@@ -2597,12 +2690,12 @@ void AliZDCv3::StepManager()
         // z-coordinate from ZEM front face 
         // NB-> fPosZEM[2]+fZEMLength = -1000.+2*10.3 = 979.69 cm
         Float_t 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);
+        //z = xalic[2]-fPosZEM[2]-fZEMLength-xalic[1]*(TMath::Tan(45.*kDegrad));
+         //printf("\n  fPosZEM[2]+2*fZEMLength = %f", fPosZEM[2]+2*fZEMLength);
         Float_t guiEff = guiPar[0]*(guiPar[1]*z*z+guiPar[2]*z+guiPar[3]);
         out = out*guiEff;
         nphe = gRandom->Poisson(out);
-//         printf("    out*guiEff = %f nphe = %d", out, nphe);
+         //printf("    out*guiEff = %f nphe = %d", out, nphe);
         if(vol[1] == 1){
           hits[7] = 0;         
           hits[8] = nphe;      //fLightPMC (ZEM1)