]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDv1.cxx
Changed scripts for new TrainSetup
[u/mrichter/AliRoot.git] / PMD / AliPMDv1.cxx
index 118794bd97fed3b34a3f6ed4dd4216a4c54645ea..0f9e2fb640d5f337281e23f85ae7a2a99a53525d 100644 (file)
@@ -41,6 +41,7 @@
 ////
 
 #include <Riostream.h>
+#include <TGeoManager.h>
 #include <TGeoGlobalMagField.h>
 #include <TVirtualMC.h>
 
@@ -852,8 +853,9 @@ void AliPMDv1::CreatePMD()
   xb1 = dboxSM2[0] - 0.1 - dboxUM2[0];
   xb2 = xb1 - dboxUM2[0] - 0.1 - dboxUM2[0];
   yb1 = dboxSM2[1] -  0.2 - dboxUM2[1];
-  yb2 = yb1 - dboxUM2[1] - 0.3 -  dboxUM2[1];
-  yb3 = yb2 - dboxUM2[1] - 0.3 -  dboxUM2[1];
+  yb2 = yb1 - dboxUM2[1] - 0.2 -  dboxUM2[1];
+  yb3 = yb2 - dboxUM2[1] - 0.3-  dboxUM2[1];
+
 
   // Create Volumes for Lead(Pb) Plates
 
@@ -1402,21 +1404,27 @@ void AliPMDv1::CreatePMD()
   gMC->Gspos("ECHB", 1, "EPM3", xchanepm31, ychanepm31, zchanPS, 0, "ONLY");
   gMC->Gspos("ECHB", 2, "EPM3", xchanepm31, ychanepm32, zchanPS, 0, "ONLY"); 
   gMC->Gspos("ECHB", 3, "EPM3", xchanepm31, ychanepm33, zchanPS, 0, "ONLY");
-  gMC->Gspos("ECHB", 4, "EPM3", xchanepm31, ychanepm34, zchanPS, 0, "ONLY"); 
+  gMC->Gspos("ECHB", 4, "EPM3", xchanepm31, ychanepm34 + 0.200005, zchanPS, 0, "ONLY"); 
+  // Because of overlaping a factor 0.200005 is added in ychanepm34
+  
   gMC->Gspos("ECHB", 5, "EPM3", xchanepm31, ychanepm31, zchanVeto, 0, "ONLY");
   gMC->Gspos("ECHB", 6, "EPM3", xchanepm31, ychanepm32, zchanVeto, 0, "ONLY"); 
   gMC->Gspos("ECHB", 7, "EPM3", xchanepm31, ychanepm33, zchanVeto, 0, "ONLY");
-  gMC->Gspos("ECHB", 8, "EPM3", xchanepm31, ychanepm34, zchanVeto, 0, "ONLY"); 
+  gMC->Gspos("ECHB", 8, "EPM3", xchanepm31, ychanepm34 + 0.200005, zchanVeto, 0, "ONLY"); 
+  // Because of overlaping a factor 0.200005 is added in ychanepm34
   
   gMC->Gspos("ECHB", 1, "EPM4", xchanepm41, ychanepm41, zchanPS, 0, "ONLY");
   gMC->Gspos("ECHB", 2, "EPM4", xchanepm41, ychanepm42, zchanPS, 0, "ONLY"); 
   gMC->Gspos("ECHB", 3, "EPM4", xchanepm41, ychanepm43, zchanPS, 0, "ONLY");
-  gMC->Gspos("ECHB", 4, "EPM4", xchanepm41, ychanepm44, zchanPS, 0, "ONLY"); 
+  gMC->Gspos("ECHB", 4, "EPM4", xchanepm41, ychanepm44 - 0.200002, zchanPS, 0, "ONLY"); 
+  // Because of overlaping a factor 0.200002 is subtracted in ychanepm44
+
   gMC->Gspos("ECHB", 5, "EPM4", xchanepm41, ychanepm41, zchanVeto, 0, "ONLY");
   gMC->Gspos("ECHB", 6, "EPM4", xchanepm41, ychanepm42, zchanVeto, 0, "ONLY"); 
   gMC->Gspos("ECHB", 7, "EPM4", xchanepm41, ychanepm43, zchanVeto, 0, "ONLY");
-  gMC->Gspos("ECHB", 8, "EPM4", xchanepm41, ychanepm44, zchanVeto, 0, "ONLY"); 
-  
+  gMC->Gspos("ECHB", 8, "EPM4", xchanepm41, ychanepm44 -0.200002, zchanVeto, 0, "ONLY"); 
+  // Because of overlaping a factor 0.200002 is subtracted in ychanepm44
+
   //================= Channel Placement Completed  ======================//
   //============ Now to Create Al Box and then LVDBs and Cables          //
   //             are Placed inside it                                    //
@@ -1456,10 +1464,11 @@ void AliPMDv1::CreatePMD()
   eairA1[2]= esvdA1[2] - 0.3;
 
   gMC->Gsvolu("EIR1", "BOX", idtmed[698], eairA1, 3);
+  gMC->Gsvolu("EIR2", "BOX", idtmed[698], eairA1, 3);
 
-  // Put air strip inside ESV1 & ESV2    
+  // Put air strips EIR1 & EIR2 inside ESV1 & ESV2 respectively    
   gMC->Gspos("EIR1", 1,  "ESV1", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("EIR1", 1,  "ESV2", 0., 0., 0., 0, "ONLY");
+  gMC->Gspos("EIR2", 1,  "ESV2", 0., 0., 0., 0, "ONLY");
   
 
   // For Short Type
@@ -1486,11 +1495,12 @@ void AliPMDv1::CreatePMD()
   eairA2[1]= esvdA2[1];
   eairA2[2]= esvdA2[2] - 0.3;
 
-  gMC->Gsvolu("EIR2", "BOX", idtmed[698], eairA2, 3);
+  gMC->Gsvolu("EIR3", "BOX", idtmed[698], eairA2, 3);
+  gMC->Gsvolu("EIR4", "BOX", idtmed[698], eairA2, 3);
   
-  // Put air strip inside ESV3 & ESV4    
-  gMC->Gspos("EIR2", 1,  "ESV3", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("EIR2", 1,  "ESV4", 0., 0., 0., 0, "ONLY");
+  // Put air strips EIR3 & EIR4 inside ESV3 & ESV4 respectively        
+  gMC->Gspos("EIR3", 1,  "ESV3", 0., 0., 0., 0, "ONLY");
+  gMC->Gspos("EIR4", 1,  "ESV4", 0., 0., 0., 0, "ONLY");
   
   
   // FOR VETO
@@ -1524,11 +1534,12 @@ void AliPMDv1::CreatePMD()
   eairB1[1]= esvdB1[1];
   eairB1[2]= esvdB1[2] - 0.3;
 
-  gMC->Gsvolu("EIR3", "BOX", idtmed[698], eairB1, 3);
+  gMC->Gsvolu("EIR5", "BOX", idtmed[698], eairB1, 3);
+  gMC->Gsvolu("EIR6", "BOX", idtmed[698], eairB1, 3);
  
-  // Put air strip inside EVV1 & EVV2    
-  gMC->Gspos("EIR3", 1,  "EVV1", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("EIR3", 1,  "EVV2", 0., 0., 0., 0, "ONLY");
+  // Put air strips EIR5 & EIR6 inside EVV1 & EVV2 respectively        
+  gMC->Gspos("EIR5", 1,  "EVV1", 0., 0., 0., 0, "ONLY");
+  gMC->Gspos("EIR6", 1,  "EVV2", 0., 0., 0., 0, "ONLY");
 
 
   // For Short Type
@@ -1557,11 +1568,12 @@ void AliPMDv1::CreatePMD()
   eairB2[1]= esvdB2[1];
   eairB2[2]= esvdB2[2] - 0.3;
   
-  gMC->Gsvolu("EIR4", "BOX", idtmed[698], eairB2, 3);
+  gMC->Gsvolu("EIR7", "BOX", idtmed[698], eairB2, 3);
+  gMC->Gsvolu("EIR8", "BOX", idtmed[698], eairB2, 3);
   
-  // Put air strip inside EVV3 & EVV4  
-  gMC->Gspos("EIR4", 1,  "EVV3", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("EIR4", 1,  "EVV4", 0., 0., 0., 0, "ONLY");
+  // Put air strips EIR7 & EIR8 inside EVV3 & EVV4 respectively      
+  gMC->Gspos("EIR7", 1,  "EVV3", 0., 0., 0., 0, "ONLY");
+  gMC->Gspos("EIR8", 1,  "EVV4", 0., 0., 0., 0, "ONLY");
   
   //------------ Al Boxes Completed ----------------------/
   
@@ -1580,14 +1592,15 @@ void AliPMDv1::CreatePMD()
   
   gMC->Gsvolu("ELVD", "BOX", idtmed[607], elvdb, 3);
   
-  // Put the LVDBs inside Al Boxes
+
+  // Put the LVDBs inside Air Boxes
   Float_t yesvd = dboxFea1[1] - 25.0 - 4.0;
   
   for(Int_t jj =1; jj<=6; jj++){
     
-    gMC->Gspos("ELVD", jj,  "ESV1", 0., yesvd, 0., 0, "ONLY");
-    gMC->Gspos("ELVD", jj,  "ESV2", 0., yesvd, 0., 0, "ONLY");
-    
+    gMC->Gspos("ELVD", jj,  "EIR1", 0., yesvd, 0., 0, "ONLY");
+    gMC->Gspos("ELVD", jj,  "EIR2", 0., yesvd, 0., 0, "ONLY");
+
     yesvd = yesvd -  4.0 - 0.5 - 4.0;
     
   }
@@ -1596,9 +1609,9 @@ void AliPMDv1::CreatePMD()
   
   for(Int_t jj =1; jj<=6; jj++){
     
-    gMC->Gspos("ELVD", jj,  "ESV3", 0., yesvd, 0., 0, "ONLY");
-    gMC->Gspos("ELVD", jj,  "ESV4", 0., yesvd, 0., 0, "ONLY");
-    
+    gMC->Gspos("ELVD", jj,  "EIR3", 0., yesvd, 0., 0, "ONLY");
+    gMC->Gspos("ELVD", jj,  "EIR4", 0., yesvd, 0., 0, "ONLY");
+
     yesvd = yesvd -  4.0 - 0.5 - 4.0;
   }
   
@@ -1606,9 +1619,9 @@ void AliPMDv1::CreatePMD()
   
   for(Int_t jj =1; jj<=6; jj++){
     
-    gMC->Gspos("ELVD", jj,  "EVV1", 0., yesvd, 0., 0, "ONLY");
-    gMC->Gspos("ELVD", jj,  "EVV2", 0., yesvd, 0., 0, "ONLY");
-    
+    gMC->Gspos("ELVD", jj,  "EIR5", 0., yesvd, 0., 0, "ONLY");
+    gMC->Gspos("ELVD", jj,  "EIR6", 0., yesvd, 0., 0, "ONLY");
+
     yesvd = yesvd -  4.0 - 0.5 - 4.0;
   }
   
@@ -1616,11 +1629,12 @@ void AliPMDv1::CreatePMD()
   
   for(Int_t jj =1; jj<=6; jj++){
     
-    gMC->Gspos("ELVD", jj,  "EVV3", 0., yesvd, 0., 0, "ONLY");
-    gMC->Gspos("ELVD", jj,  "EVV4", 0., yesvd, 0., 0, "ONLY");
-    
+    gMC->Gspos("ELVD", jj,  "EIR7", 0., yesvd, 0., 0, "ONLY");
+    gMC->Gspos("ELVD", jj,  "EIR8", 0., yesvd, 0., 0, "ONLY");
+
     yesvd = yesvd -  4.0 - 0.5 - 4.0;
   }
+
   
   //----------------- LVDBs Placement Completed--------------//
   
@@ -1699,34 +1713,36 @@ void AliPMDv1::CreatePMD()
   
   zcablePS   = -esvdA1[2] + 0.3 + cable1[2];
   zcableVeto =  esvdB1[2] - 0.3 - cable1[2];
+
+
+
+  // Placement of Cables in Air Boxes
+  gMC->Gspos("ECB2", 1,  "EIR1", xcable2pm1, ycable2pm1, zcablePS, 0, "ONLY");
+  gMC->Gspos("ECB3", 1,  "EIR1", xcable3pm1, ycable3pm1, zcablePS, 0, "ONLY");
+  gMC->Gspos("ECB2", 1,  "EIR5", xcable2pm1, ycable2pm1, zcableVeto, 0, "ONLY");
+  gMC->Gspos("ECB3", 1,  "EIR5", xcable3pm1, ycable3pm1, zcableVeto, 0, "ONLY");
+  
+  gMC->Gspos("ECB1", 1,  "EIR2", xcable11pm2,    0.,     zcablePS, 0, "ONLY");
+  gMC->Gspos("ECB1", 2,  "EIR2", xcable12pm2,    0.,     zcablePS, 0, "ONLY");
+  gMC->Gspos("ECB2", 1,  "EIR2", xcable2pm2, ycable2pm2, zcablePS, 0, "ONLY");
+  gMC->Gspos("ECB1", 1,  "EIR6", xcable11pm2,    0.,     zcableVeto, 0, "ONLY");
+  gMC->Gspos("ECB1", 2,  "EIR6", xcable12pm2,    0.,     zcableVeto, 0, "ONLY");
+  gMC->Gspos("ECB2", 1,  "EIR6", xcable2pm2, ycable2pm2, zcableVeto, 0, "ONLY");
   
+  gMC->Gspos("ECB3", 1,  "EIR3", xcable3pm3, ycable3pm3, zcablePS, 0, "ONLY");
+  gMC->Gspos("ECB4", 1,  "EIR3", xcable4pm3, ycable4pm3, zcablePS, 0, "ONLY");
+  gMC->Gspos("ECB3", 1,  "EIR7", xcable3pm3, ycable3pm3, zcableVeto, 0, "ONLY");
+  gMC->Gspos("ECB4", 1,  "EIR7", xcable4pm3, ycable4pm3, zcableVeto, 0, "ONLY");
   
-  // Placement of Cables in Al Boxes
-  gMC->Gspos("ECB2", 1,  "ESV1", xcable2pm1, ycable2pm1, zcablePS, 0, "ONLY");
-  gMC->Gspos("ECB3", 1,  "ESV1", xcable3pm1, ycable3pm1, zcablePS, 0, "ONLY");
-  gMC->Gspos("ECB2", 1,  "EVV1", xcable2pm1, ycable2pm1, zcableVeto, 0, "ONLY");
-  gMC->Gspos("ECB3", 1,  "EVV1", xcable3pm1, ycable3pm1, zcableVeto, 0, "ONLY");
-  
-  gMC->Gspos("ECB1", 1,  "ESV2", xcable11pm2,    0.,     zcablePS, 0, "ONLY");
-  gMC->Gspos("ECB1", 2,  "ESV2", xcable12pm2,    0.,     zcablePS, 0, "ONLY");
-  gMC->Gspos("ECB2", 1,  "ESV2", xcable2pm2, ycable2pm2, zcablePS, 0, "ONLY");
-  gMC->Gspos("ECB1", 1,  "EVV2", xcable11pm2,    0.,     zcableVeto, 0, "ONLY");
-  gMC->Gspos("ECB1", 2,  "EVV2", xcable12pm2,    0.,     zcableVeto, 0, "ONLY");
-  gMC->Gspos("ECB2", 1,  "EVV2", xcable2pm2, ycable2pm2, zcableVeto, 0, "ONLY");
-  
-  gMC->Gspos("ECB3", 1,  "ESV3", xcable3pm3, ycable3pm3, zcablePS, 0, "ONLY");
-  gMC->Gspos("ECB4", 1,  "ESV3", xcable4pm3, ycable4pm3, zcablePS, 0, "ONLY");
-  gMC->Gspos("ECB3", 1,  "EVV3", xcable3pm3, ycable3pm3, zcableVeto, 0, "ONLY");
-  gMC->Gspos("ECB4", 1,  "EVV3", xcable4pm3, ycable4pm3, zcableVeto, 0, "ONLY");
-  
-  gMC->Gspos("ECB2", 1,  "ESV4", xcable21pm4,    0.,     zcablePS, 0, "ONLY");
-  gMC->Gspos("ECB2", 2,  "ESV4", xcable22pm4,    0.,     zcablePS, 0, "ONLY");
-  gMC->Gspos("ECB3", 1,  "ESV4", xcable3pm4, ycable3pm4, zcablePS, 0, "ONLY");
-  gMC->Gspos("ECB2", 1,  "EVV4", xcable21pm4,    0.,     zcableVeto, 0, "ONLY");
-  gMC->Gspos("ECB2", 2,  "EVV4", xcable22pm4,    0.,     zcableVeto, 0, "ONLY");
-  gMC->Gspos("ECB3", 1,  "EVV4", xcable3pm4, ycable3pm4, zcableVeto, 0, "ONLY");
+  gMC->Gspos("ECB2", 1,  "EIR4", xcable21pm4,    0.,     zcablePS, 0, "ONLY");
+  gMC->Gspos("ECB2", 2,  "EIR4", xcable22pm4,    0.,     zcablePS, 0, "ONLY");
+  gMC->Gspos("ECB3", 1,  "EIR4", xcable3pm4, ycable3pm4, zcablePS, 0, "ONLY");
+  gMC->Gspos("ECB2", 1,  "EIR8", xcable21pm4,    0.,     zcableVeto, 0, "ONLY");
+  gMC->Gspos("ECB2", 2,  "EIR8", xcable22pm4,    0.,     zcableVeto, 0, "ONLY");
+  gMC->Gspos("ECB3", 1,  "EIR8", xcable3pm4, ycable3pm4, zcableVeto, 0, "ONLY");
      
 
+
   //=============== NOW POSITIONING THE Al Boxes IN EPM'S================//
   
    
@@ -1749,9 +1765,9 @@ void AliPMDv1::CreatePMD()
 
   // First to create Air Volume to place ELMBs
   Float_t xelmb[3];
-  xelmb[0] = 20.0/2.;
-  xelmb[1] = 8.0/2.;
-  xelmb[2] = 1.0/2.;
+  xelmb[0] = 10.0;
+  xelmb[1] = 4.0;
+  xelmb[2] = 0.5;
   
   gMC->Gsvolu("ELMB", "BOX", idtmed[698], xelmb, 3);
   
@@ -1760,16 +1776,16 @@ void AliPMDv1::CreatePMD()
   // ELM1 & ELM2
   
   Float_t xelmb1[3];
-  xelmb1[0] = 19.4/2.;
-  xelmb1[1] = 7.2/2.;
-  xelmb1[2] = 0.2/2.;
+  xelmb1[0] = 9.7;
+  xelmb1[1] = 3.6;
+  xelmb1[2] = 0.1;
   
   gMC->Gsvolu("ELM1", "BOX", idtmed[607], xelmb1, 3);
   
   Float_t xelmb2[3];
-  xelmb2[0] = 12.0/2.;
-  xelmb2[1] = 6.0/2.;
-  xelmb2[2] = 0.2/2.;
+  xelmb2[0] = 6.0;
+  xelmb2[1] = 3.0;
+  xelmb2[2] = 0.1;
   
   gMC->Gsvolu("ELM2", "BOX", idtmed[607], xelmb2, 3);
   
@@ -1875,15 +1891,15 @@ void AliPMDv1::CreatePMD()
   ycord[13] = yb1;
   ycord[14] = yb2;
   ycord[15] = yb2;
-  ycord[16] = yb3;
-  ycord[17] = yb3;
+  ycord[16] = yb3+0.100007; //Because of overlapping the factor 0.100007 
+  ycord[17] = yb3+0.100007; // is added
   ycord[18] = -yb1;
   ycord[19] = -yb1;
   ycord[20] = -yb2;
   ycord[21] = -yb2;
-  ycord[22] = -yb3;
-  ycord[23] = -yb3;
-
+  ycord[22] = -yb3-0.100004; //Because of overlapping the factor 0.100007 
+  ycord[23] = -yb3-0.100004; // is added
 
   // Placement of unit modules EUM1 & EUV1(long type)
   // and EUM2 & EUV2(short type)
@@ -1988,6 +2004,7 @@ void AliPMDv1::CreatePMD()
   
   gMC->Gspos("EPM1", 1, "ALIC",  xsm1,ysm1,zp, 0, "ONLY");
   gMC->Gspos("EPM2", 1, "ALIC",  xsm2,ysm2,zp, 0, "ONLY");
   gMC->Gspos("EPM3", 1, "ALIC",  xsm3,ysm3,zp, 0, "ONLY");
   gMC->Gspos("EPM4", 1, "ALIC",  xsm4,ysm4,zp, 0, "ONLY");
   
@@ -1996,47 +2013,6 @@ void AliPMDv1::CreatePMD()
 
 //_____________________________________________________________________________
 
-void AliPMDv1::DrawModule() const
-{
-  // Draw a shaded view of the Photon Multiplicity Detector
-  //
-  //  cout << " Inside Draw Modules " << endl;
-  
-  // Set everything unseen
-  gMC->Gsatt("*", "seen", -1);
-  
-  // Set ALIC mother transparent
-  gMC->Gsatt("ALIC", "seen", 0);
-  //
-  // Set the visibility of the components
-  // 
-  gMC->Gsatt("ECAR","seen",0);
-  gMC->Gsatt("ECCU","seen",1);
-  gMC->Gsatt("EST1","seen",1);
-  gMC->Gsatt("EST2","seen",1);
-  gMC->Gsatt("EUM1","seen",1);
-  gMC->Gsatt("EUM2","seen",1);
-  
-  gMC->Gsatt("EPMD","seen",1);
-  
-  //
-  gMC->Gdopt("hide", "on");
-  gMC->Gdopt("shad", "on");
-  gMC->Gsatt("*", "fill", 7);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("*", 0, 3000, -3000, 3000, -6000, 6000);
-  gMC->DefaultRange();
-  gMC->Gdraw("ALIC", 40, 30, 0, 22, 20.5, .02, .02);
-  gMC->Gdhead(1111, "Photon Multiplicity Detector Version 1");
-  
-  //gMC->Gdman(17, 5, "MAN");
-  gMC->Gdopt("hide", "off");
-  
-  AliDebug(1,"Outside Draw Modules");
-}
-
-//_____________________________________________________________________________
-
 void AliPMDv1::CreateMaterials()
 {
   // Create materials for the PMD
@@ -2156,120 +2132,82 @@ void AliPMDv1::Init()
   Int_t *idtmed = fIdtmed->GetArray()-599;
   fMedSens=idtmed[605-1];
   // --- Generate explicitly delta rays in the iron, aluminium and lead --- 
-  gMC->Gstpar(idtmed[600], "LOSS", 3.);
-  gMC->Gstpar(idtmed[600], "DRAY", 1.);
-  
-  gMC->Gstpar(idtmed[603], "LOSS", 3.);
-  gMC->Gstpar(idtmed[603], "DRAY", 1.);
-  
-  gMC->Gstpar(idtmed[604], "LOSS", 3.);
-  gMC->Gstpar(idtmed[604], "DRAY", 1.);
-  
-  gMC->Gstpar(idtmed[605], "LOSS", 3.);
-  gMC->Gstpar(idtmed[605], "DRAY", 1.);
-  
-  gMC->Gstpar(idtmed[607], "LOSS", 3.);
-  gMC->Gstpar(idtmed[607], "DRAY", 1.);
-  
-  // --- Energy cut-offs in the Pb and Al to gain time in tracking --- 
-  // --- without affecting the hit patterns --- 
-  gMC->Gstpar(idtmed[600], "CUTGAM", 1e-4);
-  gMC->Gstpar(idtmed[600], "CUTELE", 1e-4);
-  gMC->Gstpar(idtmed[600], "CUTNEU", 1e-4);
-  gMC->Gstpar(idtmed[600], "CUTHAD", 1e-4);
-
-  gMC->Gstpar(idtmed[605], "CUTGAM", 1e-4);
-  gMC->Gstpar(idtmed[605], "CUTELE", 1e-4);
-  gMC->Gstpar(idtmed[605], "CUTNEU", 1e-4);
-  gMC->Gstpar(idtmed[605], "CUTHAD", 1e-4);
-
-  gMC->Gstpar(idtmed[603], "CUTGAM", 1e-4);
-  gMC->Gstpar(idtmed[603], "CUTELE", 1e-4);
-  gMC->Gstpar(idtmed[603], "CUTNEU", 1e-4);
-  gMC->Gstpar(idtmed[603], "CUTHAD", 1e-4);
-
-  //   gMC->Gstpar(idtmed[609], "CUTGAM", 1e-4);
-  //   gMC->Gstpar(idtmed[609], "CUTELE", 1e-4);
-  //   gMC->Gstpar(idtmed[609], "CUTNEU", 1e-4);
-  //   gMC->Gstpar(idtmed[609], "CUTHAD", 1e-4);
-  
-  // --- Prevent particles stopping in the gas due to energy cut-off --- 
-  gMC->Gstpar(idtmed[604], "CUTGAM", 1e-5);
-  gMC->Gstpar(idtmed[604], "CUTELE", 1e-5);
-  gMC->Gstpar(idtmed[604], "CUTNEU", 1e-5);
-  gMC->Gstpar(idtmed[604], "CUTHAD", 1e-5);
-  gMC->Gstpar(idtmed[604], "CUTMUO", 1e-5);
-
+  // Gstpar is removed from this place and 
+  // the energy cut offs in the medium moved to galice.cuts
+  
+  //gMC->Gstpar(idtmed[605], "LOSS", 3.);
+  //gMC->Gstpar(idtmed[605], "DRAY", 1.);
+  
   // Visualization of volumes
-  gMC->Gsatt("ECAR", "SEEN", 0);
-  gMC->Gsatt("ECCU", "SEEN", 1);
-  gMC->Gsatt("ECCU", "COLO", 4);
-  gMC->Gsatt("EST1", "SEEN", 0);
-  gMC->Gsatt("EST2", "SEEN", 0);
-  gMC->Gsatt("EHC1", "SEEN", 0);  
-  gMC->Gsatt("EHC2", "SEEN", 0);
-  gMC->Gsatt("EDGA", "SEEN", 1);
-  gMC->Gsatt("EDGB", "SEEN", 1);
-  gMC->Gsatt("EEGA", "SEEN", 1);
-  gMC->Gsatt("EEGB", "SEEN", 1);
-  gMC->Gsatt("EUM1", "SEEN", 0);
-  gMC->Gsatt("EUV1", "SEEN", 0);
-  gMC->Gsatt("EUM2", "SEEN", 0);
-  gMC->Gsatt("EUV2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECAR", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECCU", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("ECCU", "COLO", 4);
+  gGeoManager->SetVolumeAttribute("EST1", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EST2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EHC1", "SEEN", 0);  
+  gGeoManager->SetVolumeAttribute("EHC2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EDGA", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EDGB", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EEGA", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EEGB", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EUM1", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EUV1", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EUM2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EUV2", "SEEN", 0);
 
  
-  gMC->Gsatt("EFEE", "SEEN", 0);
-  gMC->Gsatt("EFEE", "COLO", 4);
-  gMC->Gsatt("EFBA", "SEEN", 1);
-  gMC->Gsatt("EFBA", "COLO", 4);
-  gMC->Gsatt("EFBB", "SEEN", 0);
-  gMC->Gsatt("EFBB", "COLO", 4);
-
-  gMC->Gsatt("ELDA", "SEEN", 0);
-  gMC->Gsatt("ELDB", "SEEN", 0);
-
-  gMC->Gsatt("EFE1", "SEEN", 0); 
-  gMC->Gsatt("EFE2", "SEEN", 0);
-  gMC->Gsatt("EFE3", "SEEN", 0);
-  gMC->Gsatt("EFE4", "SEEN", 0);
-
-  gMC->Gsatt("ESC1", "SEEN", 0);
-  gMC->Gsatt("ECC1", "COLO", 2);
-  gMC->Gsatt("ESC2", "SEEN", 0);
-  gMC->Gsatt("ECC2", "COLO", 2);
-  gMC->Gsatt("ESC3", "SEEN", 0);
-  gMC->Gsatt("ECC3", "COLO", 2);
-  gMC->Gsatt("ESC4", "SEEN", 0);
-  gMC->Gsatt("ECC4", "COLO", 2);
-
-  gMC->Gsatt("ECC1", "SEEN", 0);
-  gMC->Gsatt("ECC2", "SEEN", 0);
-  gMC->Gsatt("ECC3", "SEEN", 0);
-  gMC->Gsatt("ECC4", "SEEN", 0);
-
-  gMC->Gsatt("EPM1", "SEEN", 1);
-  gMC->Gsatt("EPM2", "SEEN", 1);
-  gMC->Gsatt("EPM3", "SEEN", 1);
-  gMC->Gsatt("EPM4", "SEEN", 1);
-
-  gMC->Gsatt("ECB1", "SEEN", 0);
-  gMC->Gsatt("ECB2", "SEEN", 0);
-  gMC->Gsatt("ECB3", "SEEN", 0);
-  gMC->Gsatt("ECB4", "SEEN", 0);
-
-  gMC->Gsatt("ELMB", "SEEN", 0);
-  
-  gMC->Gsatt("ESV1", "SEEN", 0);
-  gMC->Gsatt("ESV2", "SEEN", 0);
-  gMC->Gsatt("ESV3", "SEEN", 0);
-  gMC->Gsatt("ESV4", "SEEN", 0);
-
-  gMC->Gsatt("EVV1", "SEEN", 0);
-  gMC->Gsatt("EVV2", "SEEN", 0);
-  gMC->Gsatt("EVV3", "SEEN", 0);
-  gMC->Gsatt("EVV4", "SEEN", 0);
-
-  gMC->Gsatt("EFGD", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EFEE", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EFEE", "COLO", 4);
+  gGeoManager->SetVolumeAttribute("EFBA", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EFBA", "COLO", 4);
+  gGeoManager->SetVolumeAttribute("EFBB", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EFBB", "COLO", 4);
+
+  gGeoManager->SetVolumeAttribute("ELDA", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ELDB", "SEEN", 0);
+
+  gGeoManager->SetVolumeAttribute("EFE1", "SEEN", 0); 
+  gGeoManager->SetVolumeAttribute("EFE2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EFE3", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EFE4", "SEEN", 0);
+
+  gGeoManager->SetVolumeAttribute("ESC1", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECC1", "COLO", 2);
+  gGeoManager->SetVolumeAttribute("ESC2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECC2", "COLO", 2);
+  gGeoManager->SetVolumeAttribute("ESC3", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECC3", "COLO", 2);
+  gGeoManager->SetVolumeAttribute("ESC4", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECC4", "COLO", 2);
+
+  gGeoManager->SetVolumeAttribute("ECC1", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECC2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECC3", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECC4", "SEEN", 0);
+
+  gGeoManager->SetVolumeAttribute("EPM1", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EPM2", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EPM3", "SEEN", 1);
+  gGeoManager->SetVolumeAttribute("EPM4", "SEEN", 1);
+
+  gGeoManager->SetVolumeAttribute("ECB1", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECB2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECB3", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ECB4", "SEEN", 0);
+
+  gGeoManager->SetVolumeAttribute("ELMB", "SEEN", 0);
+  
+  gGeoManager->SetVolumeAttribute("ESV1", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ESV2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ESV3", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("ESV4", "SEEN", 0);
+
+  gGeoManager->SetVolumeAttribute("EVV1", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EVV2", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EVV3", "SEEN", 0);
+  gGeoManager->SetVolumeAttribute("EVV4", "SEEN", 0);
+
+  gGeoManager->SetVolumeAttribute("EFGD", "SEEN", 0);
 }
 
 //_____________________________________________________________________________
@@ -2281,7 +2219,7 @@ void AliPMDv1::StepManager()
   //
   
   Int_t   copy;
-  Float_t hits[4], destep;
+  Float_t hits[5], destep;
   Float_t center[3] = {0,0,0};
   Int_t   vol[6];
   //const char *namep;
@@ -2324,6 +2262,10 @@ void AliPMDv1::StepManager()
     
     gMC->Gdtom(center,hits,1);
     hits[3] = destep*1e9; //Number in eV
+
+    // this is for pile-up events
+    hits[4] = gMC->TrackTime();
+
     AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
 
     AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kPMD);