]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDv1.cxx
Preprocessor modified not to send the correct gain file
[u/mrichter/AliRoot.git] / PMD / AliPMDv1.cxx
index 015e66ac1db9d35d9856977cdc2729e1ce7b9b73..fab9622d82da1e8a6ae70fb38089808488c06966 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-/*
-$Log$
-Revision 1.24  2003/10/01 08:32:51  hristov
-CurrentTrack replaced by GetCurrentTrackNumber
-
-Revision 1.23  2003/10/01 05:07:51  bnandi
-New geometry in new Alice Coordinate system
+/* $Id$ */
 
-New rectangular geometry for ALICE PMD - Bedanga Mohanty and Y. P. Viyogi
-June 2003
-*/
 //
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
 //  Photon Multiplicity Detector Version 1                                   //
-//                                                                           //
+//  Bedanga Mohanty : February 14th 2006
+//---------------------------------------------------     
+//  ALICE PMD FEE BOARDS IMPLEMENTATION
+//  Dt: 25th February 2006 
+//  M.M. Mondal, S.K. Prasad and P.K. Netrakanti
+//---------------------------------------------------
+//   Create final detector from Unit Modules
+//   Author : Bedanga and Viyogi June 2003
+//---------------------------------------------------
+// Modified by
+// Dr. Y.P. Viyogi and Ranbir Singh
+// Dt: 2nd February 2009
+//
 //Begin_Html
 /*
 <img src="picts/AliPMDv1Class.gif">
 */
 //End_Html
 //                                                                           //
-///////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
 ////
 
-#include "AliPMDv1.h"
-#include "AliRun.h"
+#include <Riostream.h>
+#include <TGeoGlobalMagField.h>
+#include <TVirtualMC.h>
+
 #include "AliConst.h" 
+#include "AliLog.h"
+#include "AliMC.h"
 #include "AliMagF.h" 
-#include "Riostream.h"
-#include <TVirtualMC.h>
-static Int_t     ncol_um1,ncol_um2, nrow_um1, nrow_um2;
-static Int_t     kdet;
-static Float_t   sm_length_ax,sm_length_ay;
-static Float_t   sm_length_bx,sm_length_by;
-static Float_t   zdist, zdist1;
-static Float_t   sm_thick, cell_radius, cell_wall, cell_depth;
-static Float_t   boundary, th_base, th_air, th_pcb;
-static Float_t   th_lead, th_steel;
+#include "AliPMDv1.h"
+#include "AliRun.h"
+#include "AliTrackReference.h"
+
+const Int_t   AliPMDv1::fgkNcolUM1    = 48;     // Number of cols in UM, type 1
+const Int_t   AliPMDv1::fgkNcolUM2    = 96;     // Number of cols in UM, type 2
+const Int_t   AliPMDv1::fgkNrowUM1    = 96;     // Number of rows in UM, type 1
+const Int_t   AliPMDv1::fgkNrowUM2    = 48;     // Number of rows in UM, type 2
+const Float_t AliPMDv1::fgkCellRadius = 0.25;     // Radius of a hexagonal cell
+const Float_t AliPMDv1::fgkCellWall   = 0.02;     // Thickness of cell Wall
+const Float_t AliPMDv1::fgkCellDepth  = 0.50;     // Gas thickness
+const Float_t AliPMDv1::fgkThPCB      = 0.16;     // Thickness of PCB 
+const Float_t AliPMDv1::fgkThLead     = 1.5;      // Thickness of Pb
+const Float_t AliPMDv1::fgkThSteel    = 0.5;      // Thickness of Steel
+const Float_t AliPMDv1::fgkGap        = 0.025;    // Air Gap
+const Float_t AliPMDv1::fgkZdist      = 361.5;    // z-position of the detector
+const Float_t AliPMDv1::fgkSqroot3    = 1.7320508;// Square Root of 3
+const Float_t AliPMDv1::fgkSqroot3by2 = 0.8660254;// Square Root of 3 by 2
+const Float_t AliPMDv1::fgkSSBoundary = 0.3;
+const Float_t AliPMDv1::fgkThSS       = 1.23;     // Old thickness of SS frame was 1.03
+const Float_t AliPMDv1::fgkThTopG10   = 0.33;
+const Float_t AliPMDv1::fgkThBotG10   = 0.4;
+
 
 ClassImp(AliPMDv1)
  
-  //_____________________________________________________________________________
-  AliPMDv1::AliPMDv1()
+//_____________________________________________________________________________
+AliPMDv1::AliPMDv1():
+  fSMthick(0.),
+  fSMthickpmd(0.),
+  fDthick(0.),
+  fSMLengthax(0.),
+  fSMLengthay(0.),
+  fSMLengthbx(0.),
+  fSMLengthby(0.),
+  fMedSens(0)
 {
-  //
+  
   // Default constructor 
-  //
-  fMedSens=0;
+  
+  for (Int_t i = 0; i < 3; i++)
+    {
+      fDboxmm1[i]  = 0.;
+      fDboxmm12[i] = 0.;
+      fDboxmm2[i]  = 0.;
+      fDboxmm22[i] = 0.;
+    }
+  for (Int_t i = 0; i < 48; i++)
+    {
+      fModStatus[i] = 1;
+    }
+
 }
  
 //_____________________________________________________________________________
-AliPMDv1::AliPMDv1(const char *name, const char *title)
-  : AliPMD(name,title)
+AliPMDv1::AliPMDv1(const char *name, const char *title):
+  AliPMD(name,title),
+  fSMthick(0.),
+  fSMthickpmd(0.),
+  fDthick(0.),
+  fSMLengthax(0.),
+  fSMLengthay(0.),
+  fSMLengthbx(0.),
+  fSMLengthby(0.),
+  fMedSens(0)
 {
-  //
+  
   // Standard constructor
-  //
-  fMedSens=0;
+  
+  for (Int_t i = 0; i < 3; i++)
+    {
+      fDboxmm1[i]  = 0.;
+      fDboxmm12[i] = 0.;
+      fDboxmm2[i]  = 0.;
+      fDboxmm22[i] = 0.;
+    }
+  for (Int_t i = 0; i < 48; i++)
+    {
+      fModStatus[i] = 1;
+    }
 }
 
+
+
+
 //_____________________________________________________________________________
 void AliPMDv1::CreateGeometry()
 {
@@ -88,646 +147,2030 @@ void AliPMDv1::CreateGeometry()
 void AliPMDv1::CreateSupermodule()
 {
   // 
-  // Creates the geometry of the cells of PMD, places them in  supermodule 
-  // which is a rectangular object.
+  // Creates the geometry of the cells of PMD, places them in  modules 
+  // which are rectangular objects.
   // Basic unit is ECAR, a hexagonal cell made of Ar+CO2, which is 
   // placed inside another hexagonal cell made of Cu (ECCU) with larger 
   // radius, compared to ECAR. The difference in radius gives the dimension 
   // of half width of each cell wall.
   // These cells are placed in a rectangular strip which are of 2 types 
-  // EST1 and EST2 
-  // 2 types of unit modules are made EUM1 and EUM2 which contains these strips
-  // placed repeatedly 
-  // Each supermodule (ESMA, ESMB), made of G10 is filled with following 
-  //components. They have 9 unit moudles inside them
-  // ESMA, ESMB are placed in EPMD along with EMPB (Pb converter) 
-  // and EMFE (iron support) 
-
+  // EST1 and EST2. 
+  // Two types of honeycomb EHC1 & EHC2 are made using strips EST1 & EST2. 
+  // 4 types of unit modules are made EUM1 & EUM2 for PRESHOWER Plane and
+  // EUV1 & EUV2 for VETO Plane which contains  strips placed repeatedly 
+  //  
+  // These unit moules are then placed inside EPM1, EPM2, EPM3 and EPM4 along
+  // with lead convertor ELDA & ELDB and Iron Supports EFE1, EFE2, EFE3 and EFE4
+  //  They have 6 unit moudles inside them in each plane. Therefore, total of 48
+  // unit modules in both the planes (PRESHOWER Plane & VETO Plane). The numbering
+  // of unit modules is from 0 to 47.
+  //
+  // Steel channels (ECHA & ECHB) are also placed which are used to place the unit modules
+  // 
+  // In order to account for the extra material around and on the detector, Girders (EGDR),
+  // girder's Carriage (EXGD), eight Aluminium boxes (ESV1,2,3,4 & EVV1,2,3,4) along with
+  // LVDBs (ELVD), cables (ECB1,2,3,4), and ELMBs (ELMB) are being placed in approximations.
+  // 
+  //  Four FR4 sheets (ECC1,2,3,4) are placed parallel to the PMD on both sides, which perform 
+  // as cooling encloser
+  // NOTE:-  VOLUME Names : begining with "E" for all PMD volumes 
   
   Int_t i,j;
-  Float_t xb, yb, zb;
   Int_t number;
   Int_t ihrotm,irotdm;
-  const Float_t root3_2 = TMath::Sqrt(3.) /2.; 
-  const Float_t root3 = TMath::Sqrt(3.); 
+  Float_t xb, yb, zb;
+
   Int_t *idtmed = fIdtmed->GetArray()-599;
  
   AliMatrix(ihrotm, 90., 30.,   90.,  120., 0., 0.);
   AliMatrix(irotdm, 90., 180.,  90.,  270., 180., 0.);
  
-  zdist = TMath::Abs(zdist1);
-
+  //******************************************************//
+  //                    STEP - I                          //
+  //******************************************************//
   // First create the sensitive medium of a hexagon cell (ECAR)
   // Inner hexagon filled with gas (Ar+CO2)
-  
+  // Integer assigned to Ar+CO2 medium is 604
+
   Float_t hexd2[10] = {0.,360.,6,2,-0.25,0.,0.23,0.25,0.,0.23};
-  hexd2[4] = -cell_depth/2.;
-  hexd2[7] =  cell_depth/2.;
-  hexd2[6] =  cell_radius - cell_wall;
-  hexd2[9] =  cell_radius - cell_wall;
+  hexd2[4] = -fgkCellDepth/2.;
+  hexd2[7] =  fgkCellDepth/2.;
+  hexd2[6] =  fgkCellRadius - fgkCellWall;
+  hexd2[9] =  fgkCellRadius - fgkCellWall;
   
   gMC->Gsvolu("ECAR", "PGON", idtmed[604], hexd2,10);
-  gMC->Gsatt("ECAR", "SEEN", 0);
-  
+
+  //******************************************************//
+  //                    STEP - II                         //
+  //******************************************************//
   // Place the sensitive medium inside a hexagon copper cell (ECCU)
   // Outer hexagon made of Copper
+  // Integer assigned to Cu medium is 614
   
   Float_t hexd1[10] = {0.,360.,6,2,-0.25,0.,0.25,0.25,0.,0.25};
-  hexd1[4] = -cell_depth/2.;
-  hexd1[7] =  cell_depth/2.;
-  hexd1[6] =  cell_radius;
-  hexd1[9] =  cell_radius;
-
+  hexd1[4] = -fgkCellDepth/2.;
+  hexd1[7] =  fgkCellDepth/2.;
+  hexd1[6] =  fgkCellRadius;
+  hexd1[9] =  fgkCellRadius;
+  
   gMC->Gsvolu("ECCU", "PGON", idtmed[614], hexd1,10);
-  gMC->Gsatt("ECCU", "SEEN", 0);
 
   // Place  inner hex (sensitive volume) inside outer hex (copper)
   
-  gMC->Gsposp("ECAR", 1, "ECCU", 0., 0., 0., 0, "ONLY", hexd2, 10);
-  
-  // Now create Rectangular TWO strips (EST1, EST2) 
-  // of 1 column and 48 or 96 cells length
+  gMC->Gspos("ECAR", 1, "ECCU", 0., 0., 0., 0, "ONLY");
+
+  //******************************************************//
+  //                    STEP - III                        //
+  //******************************************************//
+  // Now create Two types of Rectangular strips (EST1, EST2) 
+  // of 1 column and 96 or 48 cells length
 
   // volume for first strip EST1 made of AIR 
+  // Integer assigned to Air medium is 698
+  // strip type-1 is of 1 column and 96 rows i.e. of 96 cells length 
 
   Float_t dbox1[3];
-  dbox1[0] = ncol_um1*cell_radius;
-  dbox1[1] = cell_radius/root3_2;
-  dbox1[2] = cell_depth/2.;
+  dbox1[0] = fgkCellRadius/fgkSqroot3by2;
+  dbox1[1] = fgkNrowUM1*fgkCellRadius;
+  dbox1[2] = fgkCellDepth/2.;
   
   gMC->Gsvolu("EST1","BOX", idtmed[698], dbox1, 3);
-  gMC->Gsatt("EST1", "SEEN", 0);
+
 
   // volume for second strip EST2 
+  // strip type-2 is of 1 column and 48 rows i.e. of 48 cells length 
 
   Float_t dbox2[3];
-  dbox2[0] = ncol_um2*cell_radius;
-  dbox2[1] = dbox1[1];
+  dbox2[1] = fgkNrowUM2*fgkCellRadius;
+  dbox2[0] = dbox1[0];
   dbox2[2] = dbox1[2];
 
   gMC->Gsvolu("EST2","BOX", idtmed[698], dbox2, 3);
-  gMC->Gsatt("EST2", "SEEN", 0);
 
   // Place hexagonal cells ECCU placed inside EST1 
-  yb = 0.; 
-  zb = 0.;
-  xb = -(dbox1[0]) + cell_radius; 
-  for (i = 1; i <= ncol_um1; ++i) 
-       {
-         number = i;
-         gMC->Gsposp("ECCU", number, "EST1", xb,yb,zb, ihrotm, "ONLY", hexd1,10);
-         xb += (cell_radius*2.);
-       }
-  // Place hexagonal cells ECCU placed inside EST2 
-      yb = 0.; 
-      zb = 0.;
-      xb = -(dbox2[0]) + cell_radius; 
-      for (i = 1; i <= ncol_um2; ++i) 
-       {
-         number = i;
-         gMC->Gsposp("ECCU", number, "EST2", xb,yb,zb, ihrotm, "ONLY", hexd1,10);
-         xb += (cell_radius*2.);
-       }
-
 
+  xb = 0.; 
+  zb = 0.;
+  yb = (dbox1[1]) - fgkCellRadius; 
+  for (i = 1; i <= fgkNrowUM1; ++i) 
+    {
+      number = i;
+      gMC->Gspos("ECCU", number, "EST1", xb,yb,zb, 0, "ONLY");
+      yb -= (fgkCellRadius*2.);
+    }
 
-  // 2 types of rectangular shaped unit modules EUM1 and EUM2 (defined by BOX) 
+  // Place hexagonal cells ECCU placed inside EST2 
+  xb = 0.; 
+  zb = 0.;
+  yb = (dbox2[1]) - fgkCellRadius; 
+  for (i = 1; i <= fgkNrowUM2; ++i) 
+    {
+      number = i;
+      gMC->Gspos("ECCU", number, "EST2", xb,yb,zb, 0, "ONLY");
+      yb -= (fgkCellRadius*2.);
+    }
+  
+  
+  //******************************************************//
+  //                    STEP - IV                         //
+  //******************************************************//
+  // Create EHC1 : The honey combs for a unit module type-1
+  //-------------------------EHC1 Start-------------------//
+  
+  // First step is to create a honey comb unit module.
+  // This is named as EHC1 and  is a volume of Air 
+  // we will lay the EST1 strips of honey comb cells inside it.
+  
+  // Dimensions of EHC1
+  // X-dimension = (dbox1[0]*fgkNcolUM1)-(fgkCellRadius*fgkSqroot3*(fgkNcolUM1-1)/6.)+ 0.15+0.05+0.05; 
+  // Y-dimension = Number of rows * cell radius/sqrt3by2 + 0.15+0.05+0.05;  
+  // 0.15cm is the extension in honeycomb on both side of X and Y, 0.05 for air gap and 0.05
+  // for G10 boundary around, which are now merged in the dimensions of EHC1 
+  // Z-dimension = cell depth/2
 
-  // Create EUM1
+  Float_t ehcExt = 0.15;
+  Float_t ehcAround = 0.05 + 0.05;;
 
   Float_t dbox3[3];
-  dbox3[0] = dbox1[0]+cell_radius/2.;
-  dbox3[1] = (dbox1[1]*nrow_um1)-(cell_radius*root3*(nrow_um1-1)/6.); 
-  dbox3[2] = cell_depth/2.;
+  dbox3[0] = (dbox1[0]*fgkNcolUM1)-
+    (fgkCellRadius*fgkSqroot3*(fgkNcolUM1-1)/6.) + ehcExt + ehcAround;  
+  dbox3[1] = dbox1[1]+fgkCellRadius/2. + ehcExt + ehcAround; 
+  dbox3[2] = fgkCellDepth/2.;
   
-  gMC->Gsvolu("EUM1","BOX", idtmed[698], dbox3, 3);
-  gMC->Gsatt("EUM1", "SEEN", 1);
+  //Create a BOX, Material AIR
+  gMC->Gsvolu("EHC1","BOX", idtmed[698], dbox3, 3);
+  // Place rectangular strips EST1 inside EHC1 unit module
+  xb = dbox3[0]-dbox1[0];  
   
-  // Place rectangular strips EST1 inside EUM1 unit module
-
-  yb = -dbox3[1]+dbox1[1];  
-  for (j = 1; j <= nrow_um1; ++j)  
+  for (j = 1; j <= fgkNcolUM1; ++j)  
     {
       if(j%2 == 0)
        {
-      xb =cell_radius/2.0;
+         yb = -fgkCellRadius/2.0;
        }
       else
        {
-         xb = -cell_radius/2.0;
+         yb = fgkCellRadius/2.0;
        }
       number = j;
-      gMC->Gsposp("EST1",number, "EUM1", xb, yb , 0. , 0, "MANY",dbox1,3);
-      yb = (-dbox3[1]+dbox1[1])+j*1.0*cell_radius*root3;
+      gMC->Gspos("EST1",number, "EHC1", xb - 0.25, yb , 0. , 0, "MANY");
+      
+      //The strips are being placed from top towards bottom of the module
+      //This is because the first cell in a module in hardware is the top
+      //left corner cell
+      
+      xb = (dbox3[0]-dbox1[0])-j*fgkCellRadius*fgkSqroot3;
+      
     }
-
-  // Create EUM2
-
+  
+  //--------------------EHC1 done----------------------------------------//
+  
+  
+  
+  //--------------------------------EHC2 Start---------------------------//
+  // Create EHC2 : The honey combs for a unit module type-2 
+  // First step is to create a honey comb unit module.
+  // This is named as EHC2, we will lay the EST2 strips of
+  // honey comb cells inside it.
+  
+  // Dimensions of EHC2
+  // X-dimension = (dbox2[0]*fgkNcolUM2)-(fgkCellRadius*fgkSqroot3*(fgkNcolUM2-1)/6.)+ 0.15+0.05+0.05;
+  // Y-dimension = Number of rows * cell radius/sqrt3by2 + 0.15+0.05+0.05;
+  // 0.15cm is the extension in honeycomb on both side of X and Y, 0.05 for air gap and 0.05
+  // for G10 boundary around, which are now merged in the dimensions of EHC2 
+  // Z-dimension = cell depth/2
+  
+  
   Float_t dbox4[3];
-  dbox4[0] = dbox2[0]+cell_radius/2.;
-  dbox4[1] =(dbox2[1]*nrow_um2)-(cell_radius*root3*(nrow_um2-1)/6.); 
+  
+  dbox4[0] =(dbox2[0]*fgkNcolUM2)-
+    (fgkCellRadius*fgkSqroot3*(fgkNcolUM2-1)/6.) + ehcExt + ehcAround; 
+  dbox4[1] = dbox2[1] + fgkCellRadius/2. + ehcExt + ehcAround;
   dbox4[2] = dbox3[2];
-
-  gMC->Gsvolu("EUM2","BOX", idtmed[698], dbox4, 3);
-  gMC->Gsatt("EUM2", "SEEN", 1);
-
-  // Place rectangular strips EST2 inside EUM2 unit module
-
-  yb = -dbox4[1]+dbox2[1]; 
-  for (j = 1; j <= nrow_um2; ++j) 
-      {
+  
+  //Create a BOX of AIR
+  gMC->Gsvolu("EHC2","BOX", idtmed[698], dbox4, 3);
+  
+  // Place rectangular strips EST2 inside EHC2 unit module
+  xb = dbox4[0]-dbox2[0]; 
+  
+  for (j = 1; j <= fgkNcolUM2; ++j)     
+    {
       if(j%2 == 0)
        {
-      xb =cell_radius/2.0;
+         yb = -fgkCellRadius/2.0;
        }
       else
        {
-         xb = -cell_radius/2.0;
+         yb = +fgkCellRadius/2.0;
        }
       number = j;
-      gMC->Gsposp("EST2",number, "EUM2", xb, yb , 0. , 0, "MANY",dbox2,3);
-      yb = (-dbox4[1]+dbox2[1])+j*1.0*cell_radius*root3;
+      gMC->Gspos("EST2",number, "EHC2", xb - 0.25, yb , 0. ,0, "MANY");
+      xb = (dbox4[0]-dbox2[0])-j*fgkCellRadius*fgkSqroot3;
     }
-
-  // 2 types of Rectangular shaped supermodules (BOX) 
-  //each with 6 unit modules 
-  
-  // volume for SUPERMODULE ESMA 
-  //Space added to provide a gapping for HV between UM's
-
-  Float_t dbox_sm1[3];
-  dbox_sm1[0] = 3.0*dbox3[0]+(2.0*0.025);
-  dbox_sm1[1] = 2.0*dbox3[1]+0.025;
-  dbox_sm1[2] = cell_depth/2.;
-
-  gMC->Gsvolu("ESMA","BOX", idtmed[698], dbox_sm1, 3);
-  gMC->Gsatt("ESMA", "SEEN", 1);
-
-  //Position the 6 unit modules in EMSA
-  Float_t x_a1,x_a2,x_a3,y_a1,y_a2; 
-  x_a1 = -dbox_sm1[0] + dbox3[0];
-  x_a2 = 0.;
-  x_a3 = dbox_sm1[0]  - dbox3[0]; 
-  y_a1 = dbox_sm1[1]  - dbox3[1];
-  y_a2 = -dbox_sm1[1] + dbox3[1];
-  
-  gMC->Gsposp("EUM1", 1, "ESMA", x_a1, y_a1, 0., 0, "ONLY",dbox3,3);
-  gMC->Gsposp("EUM1", 2, "ESMA", x_a2, y_a1, 0., 0, "ONLY",dbox3,3);
-  gMC->Gsposp("EUM1", 3, "ESMA", x_a3, y_a1, 0., 0, "ONLY",dbox3,3);
-  gMC->Gsposp("EUM1", 4, "ESMA", x_a1, y_a2, 0., 0, "ONLY",dbox3,3);
-  gMC->Gsposp("EUM1", 5, "ESMA", x_a2, y_a2, 0., 0, "ONLY",dbox3,3);
-  gMC->Gsposp("EUM1", 6, "ESMA", x_a3, y_a2, 0., 0, "ONLY",dbox3,3);
-
-
-  // volume for SUPERMODULE ESMB 
-  //Space is added to provide a gapping for HV between UM's
-  Float_t dbox_sm2[3];
-  dbox_sm2[0] = 2.0*dbox4[0]+0.025;
-  dbox_sm2[1] = 3.0*dbox4[1]+(2.0*0.025);
-  dbox_sm2[2] = cell_depth/2.;
-  
-  gMC->Gsvolu("ESMB","BOX", idtmed[698], dbox_sm2, 3);
-  gMC->Gsatt("ESMB", "SEEN", 1);
-
-  //Position the 6 unit modules in EMSB
-  Float_t x_b1,x_b2,y_b1,y_b2,y_b3; 
-  x_b1 = -dbox_sm2[0] +dbox4[0];
-  x_b2 = dbox_sm2[0]-dbox4[0];
-  y_b1  =dbox_sm2[1]-dbox4[1];
-  y_b2  = 0.; 
-  y_b3  = -dbox_sm2[1]+dbox4[1];
-  
-  gMC->Gsposp("EUM2", 1, "ESMB", x_b1, y_b1, 0., 0, "ONLY",dbox4,3);
-  gMC->Gsposp("EUM2", 2, "ESMB", x_b2, y_b1, 0., 0, "ONLY",dbox4,3);
-  gMC->Gsposp("EUM2", 3, "ESMB", x_b1, y_b2, 0., 0, "ONLY",dbox4,3);
-  gMC->Gsposp("EUM2", 4, "ESMB", x_b2, y_b2, 0., 0, "ONLY",dbox4,3);
-  gMC->Gsposp("EUM2", 5, "ESMB", x_b1, y_b3, 0., 0, "ONLY",dbox4,3);
-  gMC->Gsposp("EUM2", 6, "ESMB", x_b2, y_b3, 0., 0, "ONLY",dbox4,3);
-
-
-  // Make a 3mm thick G10 Base plate for ESMA
-  Float_t dbox_g1a[3];
-  dbox_g1a[0] = dbox_sm1[0]; 
-  dbox_g1a[1] = dbox_sm1[1];       
-  dbox_g1a[2] = th_base/2.;
-
-  gMC->Gsvolu("EBPA","BOX", idtmed[607], dbox_g1a, 3);
-  gMC->Gsatt("EBPA", "SEEN", 1);
-
-  // Make a 1.6mm thick G10 PCB for ESMA
-  Float_t dbox_g2a[3];
-  dbox_g2a[0] = dbox_sm1[0]; 
-  dbox_g2a[1] = dbox_sm1[1];       
-  dbox_g2a[2] = th_pcb/2.;
-
-  gMC->Gsvolu("EPCA","BOX", idtmed[607], dbox_g2a, 3);
-  gMC->Gsatt("EPCA", "SEEN", 1);
-
-
-  // Make a Full module EFPA of AIR to place EBPA, 
-  // 1mm AIR, EPCA, ESMA,EPCA for PMD
   
-  Float_t dbox_alla[3];
-  dbox_alla[0] = dbox_sm1[0]; 
-  dbox_alla[1] = dbox_sm1[1];       
-  dbox_alla[2] = (th_base+0.1+th_pcb+dbox_sm1[2]+th_pcb)/2.;
-
-  gMC->Gsvolu("EFPA","BOX", idtmed[698], dbox_alla, 3);
-  gMC->Gsatt("EFPA", "SEEN", 1);
-
-
-  // Make a Full module EFCA of AIR to place EBPA, 
-  // 1mm AIR, EPCA, ESMA,EPC for CPV
-  Float_t dbox_alla2[3];
-  dbox_alla2[0] = dbox_sm1[0]; 
-  dbox_alla2[1] = dbox_sm1[1];       
-  dbox_alla2[2] = (th_base+0.1+th_pcb+dbox_sm1[2]+th_pcb)/2.;
-
-  gMC->Gsvolu("EFCA","BOX", idtmed[698], dbox_alla2, 3);
-  gMC->Gsatt("EFCA", "SEEN", 1);
-
-  // Now place everything in EFPA for PMD
-
-  Float_t z_bpa,z_pcba1,z_pcba2,z_sma; 
-  z_pcba1 = - dbox_alla[2]+th_pcb/2.0;
-  gMC->Gsposp("EPCA", 1, "EFPA", 0., 0., z_pcba1, 0, "ONLY",dbox_g2a,3);
-  z_sma = z_pcba1+dbox_sm1[2];
-  gMC->Gsposp("ESMA", 1, "EFPA", 0., 0., z_sma, 0, "ONLY",dbox_sm1,3);
-  z_pcba2 = z_sma+th_pcb/2.0;
-  gMC->Gsposp("EPCA", 2, "EFPA", 0., 0., z_pcba2, 0, "ONLY",dbox_g2a,3);
-  z_bpa = z_pcba2+0.1+th_base/2.0; // 0.1 for 0.1 mm Air gap 
-  gMC->Gsposp("EBPA", 1, "EFPA", 0., 0., z_bpa, 0, "ONLY",dbox_g1a,3);
-
-  // Now place everything in EFCA for CPV
-
-  Float_t z_bpa2,z_pcba12,z_pcba22,z_sma2; 
-  z_bpa2 = - dbox_alla2[2]+th_base/2.0;
-  gMC->Gsposp("EBPA", 1, "EFCA", 0., 0., z_bpa2, 0, "ONLY",dbox_g1a,3);
-  z_pcba12 = z_bpa2+0.1+th_pcb/2.0;
-  gMC->Gsposp("EPCA", 1, "EFCA", 0., 0., z_pcba12, 0, "ONLY",dbox_g2a,3);
-  z_sma2 = z_pcba12+dbox_sm1[2];
-  gMC->Gsposp("ESMA", 1, "EFCA", 0., 0., z_sma2, 0, "ONLY",dbox_sm1,3);
-  z_pcba22 = z_sma2+th_pcb/2.0;
-  gMC->Gsposp("EPCA", 2, "EFCA", 0., 0., z_pcba22, 0, "ONLY",dbox_g2a,3);
-
-
-
-  // Make a 3mm thick G10 Base plate for ESMB
-  Float_t dbox_g1b[3];
-  dbox_g1b[0] = dbox_sm2[0]; 
-  dbox_g1b[1] = dbox_sm2[1];       
-  dbox_g1b[2] = th_base/2.;
+  //----------------------------EHC2 done-------------------------------//
 
-  gMC->Gsvolu("EBPB","BOX", idtmed[607], dbox_g1b, 3);
-  gMC->Gsatt("EBPB", "SEEN", 1);
-
-  // Make a 1.6mm thick G10 PCB for ESMB
-  Float_t dbox_g2b[3];
-  dbox_g2b[0] = dbox_sm2[0]; 
-  dbox_g2b[1] = dbox_sm2[1];       
-  dbox_g2b[2] = th_pcb/2.;
+  //====================================================================//
+  // Now the job is to assmeble an Unit module
+  // It will have the following components
+  // (a) Base plate of G10 of 0.2cm 
+  // (b) Air gap  of 0.08cm   
+  // (c) Bottom PCB of 0.16cm G10
+  // (d) Honey comb 0f 0.5cm
+  // (e) Top PCB  of 0.16cm G10 
+  // (f) Back Plane of 0.1cm G10
+  // (g) Then all around then we have an air gap of 0.05cm
+  // (h) Then all around 0.05cm thick G10 insulation
+  // (i) Then all around Stainless Steel boundary channel 0.3 cm thick
+
+  // In order to reduce the number of volumes and simplify the geometry
+  // following steps are performed:
+  // (I)   Base Plate(0.2cm), Air gap(0.04cm) and Bottom PCB(0.16cm) 
+  //       are taken together as a G10 Plate EDGA (0.4cm)
+  // (II) Back Plane(0.1cm), Air Gap(0.04cm) and Top PCB(0.16cm) and extra 
+  //      clearance 0.03cm are taken together as G10 Plate EEGA(0.33cm)
+  // (III) The all around Air gap(0.05cm) and G10 boundary(0.05cm) are already 
+  //       merged in the dimension of EHC1, EHC2, EDGA and EEGA. Therefore, no 
+  //       separate volumes for all around materials
+  
+  //Let us first create them one by one
+  //--------------------------------------------------------------------//
+
+  // ---------------- Lets do it first for UM Long Type -----//
+  // 4mm G10 Box : Bottom PCB + Air Gap + Base Plate
+  //================================================
+  // Make a 4mm thick G10 Box for Unit module Long Type 
+  // X-dimension is EHC1 - ehcExt
+  // Y-dimension is EHC1 - ehcExt
+  // EHC1 was extended 0.15cm(ehcExt) on both sides
+  // Z-dimension 0.4/2 = 0.2 cm
+  // Integer assigned to G10 medium is 607
+
+  Float_t dboxCGA[3];
+  dboxCGA[0]  = dbox3[0] - ehcExt; 
+  dboxCGA[1]  = dbox3[1] - ehcExt; 
+  dboxCGA[2]  = fgkThBotG10/2.;
+
+  //Create a G10 BOX 
+  gMC->Gsvolu("EDGA","BOX", idtmed[607], dboxCGA, 3);
+
+  //-------------------------------------------------//
+  // 3.3mm G10 Box : Top PCB + Air GAp + Back Plane
+  //================================================
+  // Make a 3.3mm thick G10 Box for Unit module Long Type 
+  // X-dimension is EHC1 - ehcExt
+  // Y-dimension is EHC1 - ehcExt
+  // EHC1 was extended 0.15cm(ehcExt) on both sides
+  // Z-dimension 0.33/2 = 0.165 cm
+
+  Float_t dboxEEGA[3];
+  dboxEEGA[0]  = dboxCGA[0]; 
+  dboxEEGA[1]  = dboxCGA[1]; 
+  dboxEEGA[2]  = fgkThTopG10/2.;
+
+  //Create a G10 BOX 
+  gMC->Gsvolu("EEGA","BOX", idtmed[607], dboxEEGA, 3);
+
+
+  //----------------------------------------------------------//
+  //Stainless Steel Bounadry : EUM1 & EUV1
+  //
+  // Make a 3.63cm thick Stainless Steel boundary for Unit module Long Type
+  // 3.63cm equivalent to EDGA(0.4cm)+EHC1(0.5cm)+EEGA(0.33cm)+FEE Board(2.4cm)
+  // X-dimension is EEGA + fgkSSBoundary
+  // Y-dimension is EEGA + fgkSSBoundary
+  // Z-dimension 1.23/2 + 2.4/2.
+  // FEE Boards are 2.4cm thick
+  // Integer assigned to Stainless Steel medium is 618
+  //------------------------------------------------------//
+  // A Stainless Steel Boundary Channel to house the unit module
+  // along with the FEE Boards
+
+  Float_t dboxSS1[3];
+  dboxSS1[0]           = dboxCGA[0]+fgkSSBoundary; 
+  dboxSS1[1]           = dboxCGA[1]+fgkSSBoundary;       
+  dboxSS1[2]           = fgkThSS/2.+ 2.4/2.;
+  
+  //FOR PRESHOWER
+  //Stainless Steel boundary - Material Stainless Steel
+  gMC->Gsvolu("EUM1","BOX", idtmed[618], dboxSS1, 3);
+  
+  //FOR VETO
+  //Stainless Steel boundary - Material Stainless Steel
+  gMC->Gsvolu("EUV1","BOX", idtmed[618], dboxSS1, 3);
+  
+  //--------------------------------------------------------------------//
 
-  gMC->Gsvolu("EPCB","BOX", idtmed[607], dbox_g2b, 3);
-  gMC->Gsatt("EPCB", "SEEN", 1);
 
+  
 
-  // Make a Full module EFPB of AIR to place EBPB, 
-  //1mm AIR, EPCB, ESMB,EPCB for PMD
-  Float_t dbox_allb[3];
-  dbox_allb[0] = dbox_sm2[0]; 
-  dbox_allb[1] = dbox_sm2[1];       
-  dbox_allb[2] = (th_base+0.1+th_pcb+dbox_sm2[2]+th_pcb)/2.;
+  // ============ PMD FEE BOARDS IMPLEMENTATION ======================//
+  
+  // FEE board
+  // It is FR4 board of length * breadth :: 7cm * 2.4 cm
+  // and thickness 0.2cm
+  // Material medium is same as G10
 
-  gMC->Gsvolu("EFPB","BOX", idtmed[698], dbox_allb, 3);
-  gMC->Gsatt("EFPB", "SEEN", 1);
+  Float_t dboxFEE[3];
+  dboxFEE[0] = 0.2/2.;  
+  dboxFEE[1] = 7.0/2.;
+  dboxFEE[2] = 2.4/2.;
 
-  // Make a Full module EFCB of AIR to place EBPB, 
-  //1mm AIR, EPCB, ESMB,EPCB for CPV
-  Float_t dbox_allb2[3];
-  dbox_allb2[0] = dbox_sm2[0]; 
-  dbox_allb2[1] = dbox_sm2[1];       
-  dbox_allb2[2] = (th_base+0.1+th_pcb+dbox_sm2[2]+th_pcb)/2.;
+  gMC->Gsvolu("EFEE","BOX", idtmed[607], dboxFEE, 3);
 
-  gMC->Gsvolu("EFCB","BOX", idtmed[698], dbox_allb2, 3);
-  gMC->Gsatt("EFCB", "SEEN", 1);
+  // Now to create the Mother volume to accomodate FEE boards
+  // It should have the dimension few mm smaller than the back plane
+  // But, we have taken it as big as EUM1 or EUV1
+  // It is to compensate the Stainless Steel medium of EUM1 or EUV1
 
+  // Create Mother volume of Air : Long TYPE
 
-  // Now place everything in EFPB for PMD
+  Float_t dboxFEEBPlaneA[3];
+  dboxFEEBPlaneA[0]   = dboxSS1[0];  
+  dboxFEEBPlaneA[1]   = dboxSS1[1];
+  dboxFEEBPlaneA[2]   = 2.4/2.;
+  
+  //Volume of same dimension as EUM1 or EUV1 of Material AIR
+  gMC->Gsvolu("EFBA","BOX", idtmed[698], dboxFEEBPlaneA, 3);
+  
+  //Placing the FEE boards in the Mother volume of AIR
+  
 
-  Float_t z_bpb,z_pcbb1,z_pcbb2,z_smb; 
-  z_pcbb1 = - dbox_allb[2]+th_pcb/2.0;
-  gMC->Gsposp("EPCB", 1, "EFPB", 0., 0., z_pcbb1, 0, "ONLY",dbox_g2b,3);
-  z_smb = z_pcbb1+dbox_sm2[2];
-  gMC->Gsposp("ESMB", 1, "EFPB", 0., 0., z_smb, 0, "ONLY",dbox_sm2,3);
-  z_pcbb2 = z_smb+th_pcb/2.0;
-  gMC->Gsposp("EPCB", 2, "EFPB", 0., 0., z_pcbb2, 0, "ONLY",dbox_g2b,3);
-  z_bpb = z_pcbb2+0.1+th_base/2.0; // 0.1 for 0.1 mm Air gap 
-  gMC->Gsposp("EBPB", 1, "EFPB", 0., 0., z_bpb, 0, "ONLY",dbox_g1b,3);
+  Float_t xFee;          // X-position of FEE board
+  Float_t yFee;          // Y-position of FEE board
+  Float_t zFee = 0.0;    // Z-position of FEE board
+  
+  Float_t xA    = 0.5;   //distance from the border to 1st FEE board/Translator
+  Float_t yA    = 4.00;  //distance from the border to 1st FEE board
+  Float_t xSepa = 1.70;  //Distance between two FEE boards in X-side
+  Float_t ySepa = 8.00;  //Distance between two FEE boards in Y-side
+  
+  
+  
+  // FEE Boards EFEE placed inside EFBA
+  
+  yFee =  dboxFEEBPlaneA[1] - yA - 0.1 - 0.3;
+  // 0.1cm and 0.3cm are subtracted to shift the FEE Boards on their actual positions
+  // As the positions are changed, because we have taken the dimension of EFBA equal 
+  // to the dimension of EUM1 or EUV1  
+  number = 1;
+  // The loop for six rows of FEE Board
+  for (i = 1; i <= 6; ++i)
+    {
+      // First we place the translator board
+      xFee = -dboxFEEBPlaneA[0] + xA + 0.1 +0.3;
+      
+      gMC->Gspos("EFEE", number, "EFBA", xFee,yFee,zFee, 0, "ONLY");
+      
+      // The first FEE board is 11mm from the translator board
+      xFee   += 1.1;
+      number += 1;
+      
+      for (j = 1; j <= 12; ++j)
+        {
+          gMC->Gspos("EFEE", number, "EFBA", xFee,yFee,zFee, 0, "ONLY");
+          xFee += xSepa;
+          number += 1;
+        }
+      yFee -= ySepa;
+    }
+  
+  
+  // Now Place EEGA, EDGA, EHC1 and EFBA in EUM1 & EUV1 to complete the unit module
+  
+  
+  //                   FOR PRE SHOWER                //
+  // Placing of all components of UM in AIR BOX EUM1 //
+  
+  //(1)   FIRST PUT the 4mm G10 Box : EDGA
+  Float_t zedga = -dboxSS1[2] + fgkThBotG10/2.;
+  gMC->Gspos("EDGA", 1, "EUM1", 0., 0., zedga, 0, "ONLY");
+  
+  //(2)   NEXT PLACING the Honeycomb EHC1
+  Float_t zehc1 = zedga + fgkThBotG10/2. + fgkCellDepth/2.;
+  gMC->Gspos("EHC1", 1, "EUM1", 0., 0.,  zehc1, 0, "ONLY");
+  
+  //(3)   NEXT PLACING the 3.3mm G10 Box : EEGA
+  Float_t zeega = zehc1 + fgkCellDepth/2. + fgkThTopG10/2.;
+  gMC->Gspos("EEGA", 1, "EUM1", 0., 0., zeega, 0, "ONLY");
+  
+  //(4)   NEXT PLACING the FEE BOARD : EFBA
+  Float_t zfeeboardA = zeega + fgkThTopG10/2. +1.2;
+  gMC->Gspos("EFBA", 1, "EUM1", 0., 0., zfeeboardA, 0, "ONLY");
+  
+  //                    FOR VETO                       //
+  //  Placing of all components of UM in AIR BOX EUV1  //
+  
+  //(1)  FIRST PUT the FEE BOARD : EFBA
+  zfeeboardA = -dboxSS1[2] + 1.2;
+  gMC->Gspos("EFBA", 1, "EUV1", 0., 0., zfeeboardA, 0, "ONLY");
+  
+  //(2)  FIRST PLACING the 3.3mm G10 Box : EEGA
+  zeega = zfeeboardA + 1.2 + fgkThTopG10/2.;
+  gMC->Gspos("EEGA", 1, "EUV1", 0., 0., zeega, 0, "ONLY");
+  
+  //(3)   NEXT PLACING the Honeycomb EHC1
+  zehc1 = zeega + fgkThTopG10/2 + fgkCellDepth/2.;
+  gMC->Gspos("EHC1", 1, "EUV1", 0., 0.,  zehc1, 0, "ONLY");
+  
+  //(4)   NEXT PUT THE 4mm G10 Box : EDGA
+  zedga = zehc1 + fgkCellDepth/2.+ fgkThBotG10/2.;
+  gMC->Gspos("EDGA", 1, "EUV1", 0., 0., zedga, 0, "ONLY");
+  
 
+  //===================  LONG TYPE COMPLETED  =========================//
+  //------------ Lets do the same thing for UM Short Type -------------//
+  // 4mm G10 Box : Bottom PCB + Air Gap + Base Plate
+  //================================================
+  // Make a 4mm thick G10 Box for Unit module ShortType
+  // X-dimension is EHC2 - ehcExt
+  // Y-dimension is EHC2 - ehcExt
+  // EHC2 was extended 0.15cm(ehcExt) on both sides
+  // Z-dimension 0.4/2 = 0.2 cm
+  // Integer assigned to G10 medium is 607
+  
+  Float_t dboxCGB[3];
+  dboxCGB[0]  = dbox4[0] - ehcExt; 
+  dboxCGB[1]  = dbox4[1] - ehcExt; 
+  dboxCGB[2]  = 0.4/2.;
+  
+  //Create a G10 BOX 
+  gMC->Gsvolu("EDGB","BOX", idtmed[607], dboxCGB, 3);
+  
+  //-------------------------------------------------//
+  // 3.3mm G10 Box : PCB + Air Gap + Back Plane
+  //================================================
+  // Make a 3.3mm thick G10 Box for Unit module Short Type 
+  // X-dimension is EHC2 - ehcExt
+  // Y-dimension is EHC2 - ehcExt
+  // EHC2 was extended 0.15cm(ehcExt) on both sides
+  // Z-dimension 0.33/2 = 0.165 cm
+  
+  Float_t dboxEEGB[3];
+  dboxEEGB[0]  = dboxCGB[0]; 
+  dboxEEGB[1]  = dboxCGB[1]; 
+  dboxEEGB[2]  = 0.33/2.;
+  
+  // Create a G10 BOX 
+  gMC->Gsvolu("EEGB","BOX", idtmed[607], dboxEEGB, 3);
+  
+  
+  //Stainless Steel Bounadry : EUM2 & EUV2
+  //==================================
+  // Make a 3.63cm thick Stainless Steel boundary for Unit module Short Type 
+  // 3.63cm equivalent to EDGB(0.4cm)+EHC2(0.5cm)+EEGB(0.33cm)+FEE Board(2.4cm)
+  // X-dimension is EEGB + fgkSSBoundary
+  // Y-dimension is EEGB + fgkSSBoundary
+  // Z-dimension 1.23/2 + 2.4/2.
+  // FEE Boards are 2.4cm thick
+  // Integer assigned to Stainless Steel medium is 618
+  //------------------------------------------------------//
+  // A Stainless Steel Boundary Channel to house the unit module
+  // along with the FEE Boards
+  
+  
+  Float_t dboxSS2[3];
+  dboxSS2[0]  = dboxCGB[0] + fgkSSBoundary; 
+  dboxSS2[1]  = dboxCGB[1] + fgkSSBoundary;       
+  dboxSS2[2]  = fgkThSS/2.+ 2.4/2.;
+  
+  //PRESHOWER
+  //Stainless Steel boundary - Material Stainless Steel
+  gMC->Gsvolu("EUM2","BOX", idtmed[618], dboxSS2, 3);
+  
+  //VETO
+  //Stainless Steel boundary - Material Stainless Steel
+  gMC->Gsvolu("EUV2","BOX", idtmed[618], dboxSS2, 3);
+  
+  //----------------------------------------------------------------//
+  //NOW THE FEE BOARD IMPLEMENTATION
+  
+  // To create the Mother volume to accomodate FEE boards
+  // It should have the dimension few mm smaller than the back plane
+  // But, we have taken it as big as EUM2 or EUV2
+  // It is to compensate the Stainless Steel medium of EUM2 or EUV2
 
-  // Now place everything in EFCB for CPV
-
-  Float_t z_bpb2,z_pcbb12,z_pcbb22,z_smb2; 
-  z_bpb2 = - dbox_allb2[2]+th_base/2.0;
-  gMC->Gsposp("EBPB", 1, "EFCB", 0., 0., z_bpb2, 0, "ONLY",dbox_g1b,3);
-  z_pcbb12 = z_bpb2+0.1+th_pcb/2.0;
-  gMC->Gsposp("EPCB", 1, "EFCB", 0., 0., z_pcbb12, 0, "ONLY",dbox_g2b,3);
-  z_smb2 = z_pcbb12+dbox_sm2[2];
-  gMC->Gsposp("ESMB", 1, "EFCB", 0., 0., z_smb2, 0, "ONLY",dbox_sm2,3);
-  z_pcbb22 = z_smb2+th_pcb/2.0;
-  gMC->Gsposp("EPCB", 2, "EFCB", 0., 0., z_pcbb22, 0, "ONLY",dbox_g2b,3);
+  // Create Mother volume of Air : SHORT TYPE 
+  //------------------------------------------------------//
 
 
-  // Master MODULE EMPA of aluminum for PMD
-  //Float_t dbox_mm1[3];
-  dbox_mm1[0] = dbox_sm1[0]+boundary; 
-  dbox_mm1[1] = dbox_sm1[1]+boundary;       
-  dbox_mm1[2] = dbox_alla[2];
+  Float_t dboxFEEBPlaneB[3];
+  dboxFEEBPlaneB[0]   = dboxSS2[0];  
+  dboxFEEBPlaneB[1]   = dboxSS2[1];       
+  dboxFEEBPlaneB[2]   = 2.4/2.;
+  
+  //Volume of same dimension as EUM2 or EUV2 of Material AIR
+  gMC->Gsvolu("EFBB","BOX", idtmed[698], dboxFEEBPlaneB, 3);
+  
+  
+  // FEE Boards EFEE placed inside EFBB
+  
+  yFee =  dboxFEEBPlaneB[1] - yA -0.1 -0.3;  
+  // 0.1cm and 0.3cm are subtracted to shift the FEE Boards on their actual positions
+  // As the positions are changed, because we have taken the dimension of EFBB equal 
+  // to the dimension of EUM2 or EUV2  
+  number = 1;
+  for (i = 1; i <= 3; ++i) 
+    {
+      xFee = -dboxFEEBPlaneB[0] + xA + 0.1 +0.3;  
+      
+      //First we place the translator board
+      gMC->Gspos("EFEE", number, "EFBB", xFee,yFee,zFee, 0, "ONLY");
+      // The first FEE board is 11mm from the translator board    
+      xFee+=1.1;
+      number+=1;
+      
+      for (j = 1; j <= 12; ++j) 
+       {
+         gMC->Gspos("EFEE", number, "EFBB", xFee,yFee,zFee, 0, "ONLY");
+         xFee += xSepa;
+         number += 1;
+       }
+      
+      //Now we place Bridge Board
+      xFee = xFee - xSepa + 0.8 ;
+      //Bridge Board is at a distance 8mm from FEE board
+      gMC->Gspos("EFEE", number, "EFBB", xFee,yFee,zFee, 0, "ONLY");
+      
+      number+=1;
+      xFee+=0.8;
+      
+      for (j = 1; j <= 12; ++j) 
+       {
+         gMC->Gspos("EFEE", number, "EFBB", xFee,yFee,zFee, 0, "ONLY");
+         xFee += xSepa;
+         number += 1;
+       }
+      yFee -= ySepa; 
+    }
+  
+  
+  
+  // Now Place EEGB, EDGB, EHC2 and EFBB in EUM2 & EUV2 to complete the unit module
+  
+  // FOR PRE SHOWER
+  //- Placing of all components of UM in AIR BOX EUM2--//
+  //(1)   FIRST PUT the G10 Box : EDGB
+  Float_t zedgb = -dboxSS2[2] + 0.4/2.;
+  gMC->Gspos("EDGB", 1, "EUM2", 0., 0., zedgb, 0, "ONLY");
+  
+  //(2)   NEXT PLACING the Honeycomb EHC2
+  Float_t zehc2 = zedgb + 0.4/2. + fgkCellDepth/2.;
+  gMC->Gspos("EHC2", 1, "EUM2", 0., 0.,  zehc2, 0, "ONLY");
+  
+  //(3)   NEXT PLACING the G10 Box : EEGB
+  Float_t zeegb = zehc2 + fgkCellDepth/2. + 0.33/2.;
+  gMC->Gspos("EEGB", 1, "EUM2", 0., 0., zeegb, 0, "ONLY");
+  
+  //(4)   NEXT PLACING FEE BOARDS : EFBB
+  Float_t zfeeboardB = zeegb + 0.33/2.+1.2;
+  gMC->Gspos("EFBB", 1, "EUM2", 0., 0., zfeeboardB, 0, "ONLY");
+  
+  //  FOR VETO
+  //  Placing of all components of UM in AIR BOX EUV2 //
+  
+  //(1)  FIRST PUT the FEE BOARD : EUV2
+  zfeeboardB = -dboxSS2[2] + 1.2;
+  gMC->Gspos("EFBB", 1, "EUV2", 0., 0., zfeeboardB, 0, "ONLY");
+  
+  //(2)  FIRST PLACING the G10 Box : EEGB
+  zeegb = zfeeboardB + 1.2 + 0.33/2.;
+  gMC->Gspos("EEGB", 1, "EUV2", 0., 0., zeegb, 0, "ONLY");
+  
+  //(3)   NEXT PLACING the Honeycomb EHC2
+  zehc2 = zeegb + 0.33/2. + fgkCellDepth/2.;
+  gMC->Gspos("EHC2", 1, "EUV2", 0., 0.,  zehc2, 0, "ONLY");
+  
+  //(4)   NEXT PUT THE G10 Box : EDGB
+  zedgb = zehc2 + fgkCellDepth/2.+ 0.4/2.;
+  gMC->Gspos("EDGB", 1, "EUV2", 0., 0., zedgb, 0, "ONLY");
+  
+  
+  //===================================================================//
+  //---------------------- UM Type B completed ------------------------//
+  
+}
 
-  gMC->Gsvolu("EMPA","BOX", idtmed[603], dbox_mm1, 3);
-  gMC->Gsatt("EMPA", "SEEN", 1);
+//_______________________________________________________________________
 
-  // Master MODULE EMCA of aluminum for CPV
-  //Float_t dbox_mm12[3];
-  dbox_mm12[0] = dbox_sm1[0]+boundary; 
-  dbox_mm12[1] = dbox_sm1[1]+boundary;       
-  dbox_mm12[2] = dbox_alla[2];
+void AliPMDv1::CreatePMD()
+{
+  // Create final detector from Unit Modules
+  // -- Author : Bedanga and Viyogi June 2003
+  
+  
+  Float_t   zp = fgkZdist;  //Z-distance of PMD from Interaction Point 
 
-  gMC->Gsvolu("EMCA","BOX", idtmed[603], dbox_mm12, 3);
-  gMC->Gsatt("EMCA", "SEEN", 1);
+  Int_t jhrot12,jhrot13, irotdm;
+  Int_t *idtmed = fIdtmed->GetArray()-599;
+  
+  AliMatrix(irotdm, 90., 0.,  90.,  90., 180., 0.);
+  AliMatrix(jhrot12, 90., 180., 90., 270., 0., 0.);
+  AliMatrix(jhrot13, 90., 240., 90., 330., 0., 0.);
+  
+  // Now We Will Calculate Position Co-ordinates of EUM1 & EUV1 in EPM1 & EPM2
+  
+  Float_t dbox1[3];
+  dbox1[0] = fgkCellRadius/fgkSqroot3by2;
+  dbox1[1] = fgkNrowUM1*fgkCellRadius;
+  dbox1[2] = fgkCellDepth/2.;
+  
+  Float_t dbox3[3];
+  dbox3[0] = (dbox1[0]*fgkNcolUM1)-
+    (fgkCellRadius*fgkSqroot3*(fgkNcolUM1-1)/6.) + 0.15 + 0.05 + 0.05;  
+  dbox3[1] = dbox1[1]+fgkCellRadius/2. + 0.15 + 0.05 + 0.05; 
+  dbox3[2] = fgkCellDepth/2.;
+  Float_t dboxCGA[3];
+  dboxCGA[0]  = dbox3[0] - 0.15; 
+  dboxCGA[1]  = dbox3[1] - 0.15; 
+  dboxCGA[2]  = 0.4/2.;
+
+  Float_t dboxSS1[3];
+  dboxSS1[0]   = dboxCGA[0]+fgkSSBoundary; 
+  dboxSS1[1]   = dboxCGA[1]+fgkSSBoundary;       
+  dboxSS1[2]   = fgkThSS/2.; 
+
+  Float_t dboxUM1[3];
+  dboxUM1[0] = dboxSS1[0];
+  dboxUM1[1] = dboxSS1[1];
+  dboxUM1[2] = fgkThSS/2. + 1.2;
+
+  Float_t dboxSM1[3];
+  dboxSM1[0] = fSMLengthax + 0.05; // 0.05cm for the ESC1,2 
+  dboxSM1[1] = fSMLengthay;
+  dboxSM1[2] = dboxUM1[2];
+  // Position co-ordinates of the unit modules in EPM1 & EPM2
+  Float_t xa1,xa2,xa3,ya1,ya2; 
+  xa1 =  dboxSM1[0] - dboxUM1[0];
+  xa2 = xa1 - dboxUM1[0] - 0.1 - dboxUM1[0];
+  xa3 = xa2 - dboxUM1[0] - 0.1 - dboxUM1[0];
+  ya1 = dboxSM1[1]  - 0.2 - dboxUM1[1];
+  ya2 = ya1 - dboxUM1[1] - 0.3 - dboxUM1[1];
+  
+  // Next to Calculate Position Co-ordinates of EUM2 & EUV2 in EPM3 & EPM4
+  
+  Float_t dbox2[3];
+  dbox2[1] = fgkNrowUM2*fgkCellRadius;
+  dbox2[0] = dbox1[0];
+  dbox2[2] = dbox1[2];
+  
+  Float_t dbox4[3];
+  dbox4[0] =(dbox2[0]*fgkNcolUM2)-
+    (fgkCellRadius*fgkSqroot3*(fgkNcolUM2-1)/6.) + 0.15 + 0.05 + 0.05; 
+  dbox4[1] = dbox2[1] + fgkCellRadius/2. + 0.15 + 0.05 + 0.05;
+  dbox4[2] = dbox3[2];
+  
+  Float_t dboxCGB[3];
+  dboxCGB[0]  = dbox4[0] - 0.15; 
+  dboxCGB[1]  = dbox4[1] - 0.15; 
+  dboxCGB[2]  = 0.4/2.;
+  
+  Float_t dboxSS2[3];
+  dboxSS2[0]  = dboxCGB[0] + fgkSSBoundary; 
+  dboxSS2[1]  = dboxCGB[1] + fgkSSBoundary;       
+  dboxSS2[2]  = fgkThSS/2.;
+  
+  Float_t dboxUM2[3];
+  dboxUM2[0] = dboxSS2[0];
+  dboxUM2[1] = dboxSS2[1];
+  dboxUM2[2] = fgkThSS/2. + 2.4/2.; // 2.4 cm is added for  FEE Board thickness
+
+  Float_t dboxSM2[3];
+  dboxSM2[0] = fSMLengthbx + 0.05;  // 0.05cm for the ESC3,4
+  dboxSM2[1] = fSMLengthby;
+  dboxSM2[2] = dboxUM2[2];
+  
+  // Position co-ordinates of the unit modules in EPM3 & EPM4 
+  // Space is added to provide a gapping for HV between UM's
+  Float_t xb1,xb2,yb1,yb2,yb3; 
+  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.2 -  dboxUM2[1];
+  yb3 = yb2 - dboxUM2[1] - 0.3-  dboxUM2[1];
+
+
+  // Create Volumes for Lead(Pb) Plates
+
+  // Lead Plate For LONG TYPE
+  // X-dimension of Lead Plate = 3*(X-dimension of EUM1 or EUV1) + gap provided between unit modules 
+  // Y-dimension of Lead Plate = 2*(Y-dimension of EUM1 or EUV1) + thickness of SS channels 
+  // + tolerance
+  // Z-demension of Lead Plate = 1.5cm 
+  // Integer assigned to Pb-medium is 600
+
+   Float_t dboxLeadA[3];
+  dboxLeadA[0] = fSMLengthax; 
+  dboxLeadA[1] = fSMLengthay;
+  dboxLeadA[2] = fgkThLead/2.;
+
+  gMC->Gsvolu("ELDA","BOX", idtmed[600], dboxLeadA, 3);
+
+  //LEAD Plate For SHORT TYPE
+  // X-dimension of Lead Plate = 2*(X-dimension of EUM2 or EUV2) + gap provided between unit modules 
+  // Y-dimension of Lead Plate = 3*(Y-dimension of EUM2 or EUV2) + thickness of SS channels 
+  // + tolerance
+  // Z-demension of Lead Plate = 1.5cm 
+  // Integer assigned to Pb-medium is 600
+
+   Float_t dboxLeadB[3];
+  dboxLeadB[0] = fSMLengthbx; 
+  dboxLeadB[1] = fSMLengthby; 
+  dboxLeadB[2] = fgkThLead/2.;
+
+  gMC->Gsvolu("ELDB","BOX", idtmed[600], dboxLeadB, 3);
+
+  //=========== CREATE MOTHER VOLUMES FOR PMD ===========================/
+
+  Float_t serviceX    = 23.2;
+  Float_t serviceYa   = 5.2;
+  Float_t serviceYb   = 9.8;
+  Float_t serviceXext = 16.0;
+
+  // Five Mother Volumes of PMD are Created
+  // Two Volumes EPM1 & EPM2 of Long Type
+  // Other Two Volumes EPM3 & EPM4 for Short Type
+  // Fifth Volume EFGD for Girders and its Carriage
+  // Four Volmes EPM1, EPM2, EPM3 & EPM4 are Placed such that
+  // to create a hole and avoid overlap with Beam Pipe
+
+  // Create Volume FOR EPM1 
+  // X-dimension = fSMLengthax + Extended Iron Support(23.2cm) + 
+  // Extension in Module(16cm) for full coverage of Detector + 1mm thick SS-Plate
+  // Y-dimension = fSMLengthay + Extended Iron Support(5.2cm)
+  // Z-dimension = fSMthick/2.; fSMthick=17cm is full profile of PMD in Z-Side
+  // Note:- EPM1 is a Volume of Air
+
+  Float_t gaspmd1[3];
+  gaspmd1[0] = fSMLengthax + serviceX/2.+ serviceXext/2. + 0.05; //0.05cm for the thickness of 
+  gaspmd1[1] = fSMLengthay + serviceYa/2.;                       //SS-plate for cooling encloser  
+  gaspmd1[2] = fSMthick/2.;
+  
+  gMC->Gsvolu("EPM1", "BOX", idtmed[698], gaspmd1, 3);
 
 
-  //Position EFMA inside EMMA for PMD and CPV
-  gMC->Gsposp("EFPA", 1, "EMPA", 0., 0., 0., 0, "ONLY",dbox_alla,3);
-  gMC->Gsposp("EFCA", 1, "EMCA", 0., 0., 0., 0, "ONLY",dbox_alla2,3);
+  // Create Volume FOR EPM2 
 
+  // X-dimension = fSMLengthax + Extended Iron Support(23.2cm) + 
+  // Extension in Module(16cm) for full coverage of Detector + 1mm thick SS-Plate
+  // Y-dimension = fSMLengthay + Extended Iron Support(9.8cm)
+  // Z-dimension = fSMthick/2.; fSMthick=17cm is full profile of PMD in Z-Side
+  // Note:- EPM2 is a Volume of Air
 
-  // Master MODULE EMPB of aluminum for PMD
-  //Float_t dbox_mm2[3];
-  dbox_mm2[0] = dbox_sm2[0]+boundary; 
-  dbox_mm2[1] = dbox_sm2[1]+boundary;       
-  dbox_mm2[2] = dbox_allb[2];
+  Float_t gaspmd2[3];
+  gaspmd2[0] = fSMLengthax + serviceX/2. + serviceXext/2. + 0.05; //0.05cm for the thickness of 
+  gaspmd2[1] = fSMLengthay + serviceYb/2.;                        //SS-plate for cooling encloser
+  gaspmd2[2] = fSMthick/2.;
 
-  gMC->Gsvolu("EMPB","BOX", idtmed[603], dbox_mm2, 3);
-  gMC->Gsatt("EMPB", "SEEN", 1);
+  gMC->Gsvolu("EPM2", "BOX", idtmed[698], gaspmd2, 3);
 
-  // Master MODULE EMCB of aluminum for CPV
-  //Float_t dbox_mm22[3];
-  dbox_mm22[0] = dbox_sm2[0]+boundary; 
-  dbox_mm22[1] = dbox_sm2[1]+boundary;       
-  dbox_mm22[2] = dbox_allb[2];
+  // Create Volume FOR EPM3
 
-  gMC->Gsvolu("EMCB","BOX", idtmed[603], dbox_mm22, 3);
-  gMC->Gsatt("EMCB", "SEEN", 1);
+  // X-dimension = fSMLengthbx + Extended Iron Support(23.2cm) + 
+  // Extension in Module(16cm) for full coverage of Detector
+  // Y-dimension = fSMLengthby + Extended Iron Support(5.2cm)
+  // Z-dimension = fSMthick/2.; fSMthick=17cm is full profile of PMD in Z-Side
+  // Note:- EPM3 is a Volume of Air
 
-  //Position EFMB inside EMMB
-  gMC->Gsposp("EFPB", 1, "EMPB", 0., 0., 0., 0, "ONLY",dbox_allb,3);
-  gMC->Gsposp("EFCB", 1, "EMCB", 0., 0., 0., 0, "ONLY",dbox_allb2,3);
 
-}
-//_____________________________________________________________________________
+  Float_t gaspmd3[3];
+  gaspmd3[0] = fSMLengthbx + serviceX/2. + serviceXext/2.+ 0.05; //0.05cm for the thickness of  
+  gaspmd3[1] = fSMLengthby + serviceYa/2.;                       //SS-plate for cooling encloser  
+  gaspmd3[2] = fSMthick/2.;
 
-void AliPMDv1::CreatePMD()
-{
+  gMC->Gsvolu("EPM3", "BOX", idtmed[698], gaspmd3, 3);
 
-  //
-  // Create final detector from supermodules
-  // -- Author : Bedanga and Viyogi June 2003
+  // Create Volume FOR EPM4
 
-  Float_t  xp, yp, zp;
-  Int_t jhrot12,jhrot13, irotdm;
-  Int_t *idtmed = fIdtmed->GetArray()-599;
+  // X-dimension = fSMLengthbx + Extended Iron Support(23.2cm) + 
+  // Extension in Module(16cm) for full coverage of Detector
+  // Y-dimension = fSMLengthby + Extended Iron Support(9.8cm)
+  // Z-dimension = fSMthick/2.; fSMthick=17cm is full profile of PMD in Z-Side
+  // Note:- EPM4 is a Volume of Air
   
-  //VOLUMES Names : begining with "E" for all PMD volumes, 
+  Float_t gaspmd4[3];
+  gaspmd4[0] = fSMLengthbx + serviceX/2. + serviceXext/2.+ 0.05;  //0.05cm for the thickness of
+  gaspmd4[1] = fSMLengthby + serviceYb/2.;                        //SS-plate for cooling encloser   
+  gaspmd4[2] = fSMthick/2.;
 
-  // --- DEFINE Iron, and lead volumes  for SM A
+  gMC->Gsvolu("EPM4", "BOX", idtmed[698], gaspmd4, 3);
   
-  Float_t dbox_pba[3];
-  dbox_pba[0] = sm_length_ax;
-  dbox_pba[1] = sm_length_ay;
-  dbox_pba[2] = th_lead/2.;
+  //  Create the Fifth Mother Volume of Girders and its Carriage
+  //-------------------------------------------------------------//
+  // Create the Girders
   
-  gMC->Gsvolu("EPBA","BOX", idtmed[600], dbox_pba, 3);
-  gMC->Gsatt ("EPBA", "SEEN", 0);
+  // X-dimension = 238.7cm 
+  // Y-dimension = 12.0cm 
+  // Z-dimension = 7.0cm 
+  // Girders are the Volume of Iron
+  // And the Integer Assigned to SS is 618
+
+  Float_t grdr[3];
+  grdr[0] = 238.7/2.;
+  grdr[1] = 12.0/2.;
+  grdr[2] = 7.0/2.; 
+
+  gMC->Gsvolu("EGDR", "BOX", idtmed[618], grdr, 3);
+  // Create Air Strip for Girders as the Girders are hollow
+  // Girders are 1cm thick in Y and Z on both sides
+  Float_t airgrdr[3];
+  airgrdr[0] = grdr[0];
+  airgrdr[1] = grdr[1] - 1.0;
+  airgrdr[2] = grdr[2] - 1.0;
   
-  //   Fe Support 
-  Float_t dbox_fea[3];
-  dbox_fea[0] = sm_length_ax;
-  dbox_fea[1] = sm_length_ay;
-  dbox_fea[2] = th_steel/2.;
+  gMC->Gsvolu("EAIR", "BOX", idtmed[698], airgrdr, 3);
+
+  // Positioning the air strip EAIR in girder EGDR  
+  gMC->Gspos("EAIR", 1, "EGDR",  0., 0., 0.,  0, "ONLY");
   
-  gMC->Gsvolu("EFEA","BOX", idtmed[618], dbox_fea, 3);
-  gMC->Gsatt ("EFEA", "SEEN", 0);
+  // Create the Carriage for Girders
+  // Originally, Carriage is divided in two parts
+  // 64.6cm on -X side, 44.2cm on +X side and 8.2cm is the gap between two
+  // In approximation we have taken these together as a single Volume
+  // With X = 64.6cm + 44.2cm + 8.2cm
+  // Y-dimension = 4.7cm
+  // Z-dimension = 18.5cm
+  // Carriage is a Volume of SS
+    
+  Float_t xgrdr[3];
+  xgrdr[0] = (64.6 + 44.2 + 8.2)/2.;  
+  xgrdr[1] = 4.7/2.; 
+  xgrdr[2] = 18.5/2.;
 
-  // --- DEFINE Iron, and lead volumes  for SM B
+  gMC->Gsvolu("EXGD", "BOX", idtmed[618], xgrdr, 3);
 
-  Float_t dbox_pbb[3];
-  dbox_pbb[0] = sm_length_bx;
-  dbox_pbb[1] = sm_length_by;
-  dbox_pbb[2] = th_lead/2.;
-  
-  gMC->Gsvolu("EPBB","BOX", idtmed[600], dbox_pbb, 3);
-  gMC->Gsatt ("EPBB", "SEEN", 0);
+  // Create Air Strip for the Carriage EXGD as it is hollow
+  // Carriage is 1cm thick in Y on one side and in Z on both sides 
+
+  Float_t xairgrdr[3];
+  xairgrdr[0] = xgrdr[0];
+  xairgrdr[1] = xgrdr[1] - 0.5;
+  xairgrdr[2] = xgrdr[2] - 1.0;
   
-  //   Fe Support 
-  Float_t dbox_feb[3];
-  dbox_feb[0] = sm_length_bx;
-  dbox_feb[1] = sm_length_by;
-  dbox_feb[2] = th_steel/2.;
+  gMC->Gsvolu("EXIR", "BOX", idtmed[698], xairgrdr, 3);
   
-  gMC->Gsvolu("EFEB","BOX", idtmed[618], dbox_feb, 3);
-  gMC->Gsatt ("EFEB", "SEEN", 0);
+  // Positioning the air strip EXIR in CArriage EXGD
+  gMC->Gspos("EXIR", 1, "EXGD",  0., -0.05, 0.,  0, "ONLY");
 
+  // Now Create the master volume of air containing Girders & Carriage
+    
+  // X-dimension = same as X-dimension of Girders(EGDR)
+  // Y-dimension = Y of Girder(EGDR) + Y of Carriage(EXGD) + gap between two
+  // Z-dimenson = same as Z of Carriage(EXGD)
+  // Note:- It is a volume of Air
 
-  // Gaspmd, the dimension of RECTANGULAR mother volume of PMD,
+  Float_t fulgrdr[3];
+  fulgrdr[0] = 238.7/2.;
+  fulgrdr[1] = 17.5/2.; 
+  fulgrdr[2] = 18.5/2.;
 
-  Float_t gaspmd[3] = {81.5,94.5,7.};
-  gaspmd[0] = sm_length_ax+sm_length_bx;
-  gaspmd[1] = sm_length_ay+sm_length_by;
+  gMC->Gsvolu("EFGD", "BOX", idtmed[698], fulgrdr, 3);
 
+  // Positioning the EGDR and EXGD in EFGD
 
-  gMC->Gsvolu("EPMD", "BOX", idtmed[698], gaspmd, 3);
-  gMC->Gsatt("EPMD", "SEEN", 1);
+  gMC->Gspos("EXGD", 1, "EFGD",  0., 6.4, 0.,      0, "ONLY");
+  gMC->Gspos("EGDR", 1, "EFGD",  0., -2.75, -5.75, 0, "ONLY");
+  gMC->Gspos("EGDR", 2, "EFGD",  0., -2.75, 5.75,  0, "ONLY");
 
-  AliMatrix(irotdm, 90., 0.,  90.,  90., 180., 0.);
-   
-  AliMatrix(jhrot12, 90., 180., 90., 270., 0., 0.);
-  AliMatrix(jhrot13, 90., 240., 90., 330., 0., 0.);
+  //=========== Mother Volumes are Created ============================//
 
-  Float_t x_sma,y_sma;
-  Float_t x_smb,y_smb;
-  x_sma = -(sm_length_bx)/1.0;
-  y_sma = sm_length_by;
-  x_smb = -sm_length_ax;
-  y_smb = -sm_length_ay;
-
-  //Complete detector for Type A
-  //Position Super modules type A for both CPV and PMD in EPMD  
-  Float_t z_psa,z_pba,z_fea,z_cva; 
-  z_psa = - gaspmd[3] + sm_thick/2.;
-
-  gMC->Gsposp("EMPA", 1, "EPMD", x_sma, y_sma, z_psa, 0, "ONLY",dbox_mm1,3);
-  gMC->Gsposp("EMPA", 2, "EPMD", -x_sma, -y_sma, z_psa, jhrot12, "ONLY",dbox_mm1,3);
-  z_pba=z_psa+sm_thick/2.+dbox_pba[2];
-  gMC->Gsposp("EPBA", 1, "EPMD", x_sma, y_sma, z_pba, 0, "ONLY",dbox_pba,3);
-  gMC->Gsposp("EPBA", 2, "EPMD", -x_sma, -y_sma, z_pba, 0, "ONLY",dbox_pba,3);
-  z_fea=z_pba+dbox_pba[2]+dbox_fea[2];
-  gMC->Gsposp("EFEA", 1, "EPMD", x_sma, y_sma, z_fea, 0, "ONLY",dbox_fea,3);
-  gMC->Gsposp("EFEA", 2, "EPMD", -x_sma, -y_sma, z_fea, 0, "ONLY",dbox_fea,3);
-  z_cva=z_fea+dbox_fea[2]+sm_thick/2.;
-  gMC->Gsposp("EMCA", 1, "EPMD", x_sma, y_sma, z_cva, 0, "ONLY",dbox_mm12,3);
-  gMC->Gsposp("EMCA", 2, "EPMD", -x_sma,-y_sma, z_cva, jhrot12, "ONLY",dbox_mm12,3);
+  // Create the Volume of 1mm thick SS-Plate  for cooling encloser
+  // These are placed on the side close to the Beam Pipe
+  // SS-Plate is perpendicular to the plane of Detector 
  
-  //Complete detector for Type B
-  //Position Super modules type B for both CPV and PMD in EPMD  
-  Float_t z_psb,z_pbb,z_feb,z_cvb; 
-  z_psb = - gaspmd[3] + sm_thick/2.;
-  
-  gMC->Gsposp("EMPB", 3, "EPMD", x_smb, y_smb, z_psb, 0, "ONLY",dbox_mm2,3);
-  gMC->Gsposp("EMPB", 4, "EPMD", -x_smb, -y_smb, z_psb, jhrot12, "ONLY",dbox_mm2,3);
-  z_pbb=z_psb+sm_thick/2.+dbox_pbb[2];
-  gMC->Gsposp("EPBB", 3, "EPMD", x_smb, y_smb, z_pbb, 0, "ONLY",dbox_pbb,3);
-  gMC->Gsposp("EPBB", 4, "EPMD", -x_smb, -y_smb, z_pbb, 0, "ONLY",dbox_pbb,3);
-  z_feb=z_pbb+dbox_pbb[2]+dbox_feb[2];
-  gMC->Gsposp("EFEB", 3, "EPMD", x_smb, y_smb, z_feb, 0, "ONLY",dbox_feb,3);
-  gMC->Gsposp("EFEB", 4, "EPMD", -x_smb, -y_smb, z_feb, 0, "ONLY",dbox_feb,3);
-  z_cvb=z_feb+dbox_feb[2]+sm_thick/2.;
-  gMC->Gsposp("EMCB", 3, "EPMD", x_smb, y_smb, z_cvb, 0, "ONLY",dbox_mm22,3);
-  gMC->Gsposp("EMCB", 4, "EPMD", -x_smb,-y_smb, z_cvb, jhrot12, "ONLY",dbox_mm22,3);
-  
-  // --- Place the EPMD in ALICE 
-  xp = 0.;
-  yp = 0.;
-  zp = zdist1;
+  // For LONG TYPE
+
+  // For EPM1
+  // X-dimension = 0.1cm
+  // Y-dimension = same as Y of EPM1
+  // Z-dimension = Y of EPM1 - 0.1; 0.1cm is subtracted as 1mm thick 
+  // FR4 sheets for the detector encloser placed on both sides
+  // It is a Volume of SS
+  // Integer assigned to SS is 618
+  Float_t sscoolencl1[3];
+  sscoolencl1[0] = 0.05;  
+  sscoolencl1[1] = gaspmd1[1];
+  sscoolencl1[2] = gaspmd1[2] - 0.2/2.;
 
-  //Position Full PMD in ALICE   
-  gMC->Gsposp("EPMD", 1, "ALIC", xp,yp,zp, 0, "ONLY",gaspmd,3);
+  gMC->Gsvolu("ESC1", "BOX", idtmed[618], sscoolencl1, 3);
+
+  // Placement of ESC1  in EPM1
+  gMC->Gspos("ESC1", 1,  "EPM1", -gaspmd1[0] + 0.05, 0., 0., 0, "ONLY");
 
-}
 
+  // For EPM2
+  // X-dimension = 0.1cm
+  // Y-dimension = same as Y of EPM2
+  // Z-dimension = Y of EPM2 - 0.1; 0.1cm is subtracted as 1mm thick 
+  // FR4 sheets for the detector encloser placed on both sides
+  // It is a Volume of SS
  
-//_____________________________________________________________________________
-void AliPMDv1::DrawModule()
-{
-  cout << " Inside Draw Modules " << endl;
-  //
-  // Draw a shaded view of the Photon Multiplicity Detector
-  //
+  Float_t sscoolencl2[3];
+  sscoolencl2[0] = 0.05;  
+  sscoolencl2[1] = gaspmd2[1];
+  sscoolencl2[2] = gaspmd2[2] - 0.2/2.;
 
-  gMC->Gsatt("*", "seen", -1);
-  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("ESMA","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->Gsvolu("ESC2", "BOX", idtmed[618], sscoolencl2, 3);
 
-  //gMC->Gdman(17, 5, "MAN");
-  gMC->Gdopt("hide", "off");
+  // Placement of ESC2  in EPM2
+  gMC->Gspos("ESC2", 1,  "EPM2",    gaspmd2[0] - 0.05 , 0., 0., 0, "ONLY");
 
-  cout << " Outside Draw Modules " << endl;
-}
+  // For SHORT TYPE
 
-//_____________________________________________________________________________
-void AliPMDv1::CreateMaterials()
-{
-  cout << " Inside create materials " << endl;
-  //
-  // Create materials for the PMD
+  // For EPM3
+  // X-dimension = 0.1cm
+  // Y-dimension = same as Y of EPM3
+  // Z-dimension = Y of EPM3 - 0.1; 0.1cm is subtracted as 1mm thick 
+  // FR4 sheets for the detector encloser placed on both sides
+  // It is a Volume of SS
+  
+  Float_t sscoolencl3[3];
+  sscoolencl3[0] = 0.05;  
+  sscoolencl3[1] = gaspmd3[1];
+  sscoolencl3[2] = gaspmd3[2] - 0.2/2.;
+
+  gMC->Gsvolu("ESC3", "BOX", idtmed[618], sscoolencl3, 3);
+
+  // Placement of ESC3  in EPM3
+  gMC->Gspos("ESC3", 1,  "EPM3",    gaspmd3[0] - 0.05 , 0., 0., 0, "ONLY");
+
+
+  // For EPM4
+  // X-dimension = 0.1cm
+  // Y-dimension = same as Y of EPM4
+  // Z-dimension = Y of EPM4 - 0.1; 0.1cm is subtracted as 1mm thick 
+  // FR4 sheets for the detector encloser placed on both sides
+  // It is a Volume of SS
+  Float_t sscoolencl4[3];
+  sscoolencl4[0] = 0.05;  
+  sscoolencl4[1] = gaspmd4[1];
+  sscoolencl4[2] = gaspmd4[2] - 0.2/2.;
+
+  gMC->Gsvolu("ESC4", "BOX", idtmed[618], sscoolencl4, 3);
+
+  // Placement of ESC4  in EPM4
+  gMC->Gspos("ESC4", 1, "EPM4", -gaspmd4[0] + 0.05 , 0., 0., 0, "ONLY");
+
+  //======== CREATE SS SUPPORTS FOR EPM1, EPM2, EPM3 & EPM4 =========//
+  // --- DEFINE SS volumes  for EPM1 & EPM2 ---
+
+  // Create SS Support For EPM1
+
+  // X-dimension = fSMLengthax + Extended Iron Support(23.2cm)
+  // Y-dimension = fSMLengthay + Extended Iron Support(5.2cm)
+  // Z-dimension = thickness of Iron support(0.5cm)
+  // It is a Volume of SS
+  // Integer assigned to SS is 618
+
+  Float_t dboxFea1[3];
+  dboxFea1[0] = fSMLengthax + serviceX/2.;  
+  dboxFea1[1] = fSMLengthay + serviceYa/2.;
+  dboxFea1[2] = fgkThSteel/2.;
+  
+  gMC->Gsvolu("EFE1","BOX", idtmed[618], dboxFea1, 3);
+
+
+  // Create SS Support For EPM2
+
+  // X-dimension = fSMLengthax + Extended Iron Support(23.2cm)
+  // Y-dimension = fSMLengthay + Extended Iron Support(9.8cm)
+  // Z-dimension = thickness of Iron support(0.5cm)
+  // It is a Volume of SS
+  // Integer assigned to SS is 618
+
+  Float_t dboxFea2[3];
+  dboxFea2[0] = fSMLengthax + serviceX/2.;   
+  dboxFea2[1] = fSMLengthay + serviceYb/2.;  
+  dboxFea2[2] = fgkThSteel/2.;
+  
+  gMC->Gsvolu("EFE2","BOX", idtmed[618], dboxFea2, 3);
+
+  // Create SS Support For EPM3
+
+  // X-dimension = fSMLengthbx + Extended Iron Support(23.2cm)
+  // Y-dimension = fSMLengthby + Extended Iron Support(5.2cm)
+  // Z-dimension = thickness of Iron support(0.5cm)
+  // It is a Volume of SS
+  // Integer assigned to SS is 618  
+
+  Float_t dboxFea3[3];
+  dboxFea3[0] = fSMLengthbx + serviceX/2.; 
+  dboxFea3[1] = fSMLengthby + serviceYa/2.;
+  dboxFea3[2] = fgkThSteel/2.;
+  
+  gMC->Gsvolu("EFE3","BOX", idtmed[618], dboxFea3, 3);
+
+  // Create SS Support For EPM4
+
+  // X-dimension = fSMLengthbx + Extended Iron Support(23.2cm)
+  // Y-dimension = fSMLengthby + Extended Iron Support(9.8cm)
+  // Z-dimension = thickness of Iron support(0.5cm)
+  // It is a Volume of SS
+  // Integer assigned to SS is 618  
+  Float_t dboxFea4[3];
+  dboxFea4[0] = fSMLengthbx + serviceX/2.;  
+  dboxFea4[1] = fSMLengthby + serviceYb/2.; 
+  dboxFea4[2] = fgkThSteel/2.;
+  
+  gMC->Gsvolu("EFE4","BOX", idtmed[618], dboxFea4, 3);
+
+
+  //=============== Volumes for SS support are Completed =============//
+
+  // Create FR4 Sheets to enclose the PMD which are Placed parallel to the
+  // plane of the detector. Four FR4 sheets are created with the dimensions
+  // corresponding to the Iron Supports
+  // This is cooling encloser.
+
+  // Create FR4 sheet ECC1
+  // X-dimension = same as EFE1
+  // Y-dimension = same as EFE1
+  // Z-dimension = 0.1cm
+  // FR4 medium is same as that of G10
+  // Integer assigned to FR4 medium is 607
+
+  Float_t enclos1[3];
+  enclos1[0] = dboxFea1[0];   
+  enclos1[1] = dboxFea1[1];
+  enclos1[2] = 0.05;
+
+  gMC->Gsvolu("ECC1", "BOX", idtmed[607], enclos1, 3);
+
+  // Create FR4 sheet ECC2
+  // X-dimension = same as EFE2
+  // Y-dimension = same as EFE2
+  // Z-dimension = 0.1cm
+
+  Float_t enclos2[3];
+  enclos2[0] = dboxFea2[0];  
+  enclos2[1] = dboxFea2[1];
+  enclos2[2] = 0.05;
+
+  gMC->Gsvolu("ECC2", "BOX", idtmed[607], enclos2, 3);
+
+  // Create FR4 sheet ECC3
+  // X-dimension = same as EFE3
+  // Y-dimension = same as EFE3
+  // Z-dimension = 0.1cm
+
+  Float_t enclos3[3];
+  enclos3[0] = dboxFea3[0];  
+  enclos3[1] = dboxFea3[1];
+  enclos3[2] = 0.05;
+  
+  gMC->Gsvolu("ECC3", "BOX", idtmed[607], enclos3, 3);
+  
+  // Create FR4 sheet ECC4
+  // X-dimension = same as EFE4
+  // Y-dimension = same as EFE4
+  // Z-dimension = 0.1cm
+
+  Float_t enclos4[3];
+  enclos4[0] = dboxFea4[0];   
+  enclos4[1] = dboxFea4[1];
+  enclos4[2] = 0.05;
+
+  gMC->Gsvolu("ECC4", "BOX", idtmed[607], enclos4, 3);
+
+  //--------------- FR4 SHEETS COMPLETED ---------------------------//
+
+  //------------- Create the SS-Channels(Horizontal Rails) to Place
+  //     Unit Modules on SS Support -------------------------------------//
+  
+  // Two types of SS-Channels are created 
+  // as we have two types of modules
+  
+  // Create SS-channel for Long Type
+  // X-dimension = same as Lead Plate ELDA
+  // Y-dimension = 0.1cm
+  // Z-dimension = 2.0cm
+  // Volume medium is SS
+
+  Float_t channel12[3];
+  channel12[0] = fSMLengthax;  
+  channel12[1] = 0.05; 
+  channel12[2] = 2.0/2.; 
+
+  gMC->Gsvolu("ECHA", "BOX", idtmed[618], channel12, 3);
+  
+  // Create SS-channel for Short Type
+  // X-dimension = same as Lead Plate ELDB
+  // Y-dimension = 0.1cm
+  // Z-dimension = 2.0cm
+  // Volume medium is SS
+
+  Float_t channel34[3];
+  channel34[0] = fSMLengthbx;  
+  channel34[1] = 0.05; 
+  channel34[2] = 2.0/2.; 
+
+  gMC->Gsvolu("ECHB", "BOX", idtmed[618], channel34, 3);
+
+  //----------------- SS-Channels are Copmleted --------------------//
+
+  //========= POSITIONING OF SS SUPPORT AND LEAD PLATES IN QUADRANTS =====//
+  
+  /**************** Z-Distances of different Components **********/
+  
+  Float_t zcva,zfea,zpba,zpsa,zchanVeto,zchanPS, zelvdbVeto, zelvdbPS;
+  
+  
+  zpba       =  - fgkThSteel/2.;                         //z-position of Pb plate
+  zfea       =  fgkThLead/2.;                            //z-position of SS-Support
+  zchanVeto  =  zpba -  fgkThLead/2. - channel12[2];     //z-position of SS-channel on Veto
+  zchanPS    =  zfea + fgkThSteel/2. + channel12[2];     //z-position of SS-channel on Preshower
+  zpsa       =  zfea + fgkThSteel/2. + fDthick;          //z-position of Preshower
+  zcva       =  zpba - fgkThLead/2.- fDthick;            //z-position of Veto
+  
+  zelvdbVeto =  zpba + fgkThLead/2.  - 8.9/2.;           //z-position of LVDBs on Veto side
+  zelvdbPS   =  zfea + fgkThSteel/2. + 7.4/2.;           //z-position of LVDBs on Preshower side
+  
+  // FOR LONG TYPE
+  Float_t  xLead1,yLead1,zLead1, xLead2,yLead2,zLead2;
+  Float_t  xIron1,yIron1,zIron1, xIron2,yIron2,zIron2;
+  
+  
+  xIron1 = - 16.0/2. + 0.1/2.; // half of 0.1cm is added as 1mm SS sheet is placed 
+  yIron1 = 0.;
+  zIron1 = zfea;
+  
+  xIron2 = 16.0/2. - 0.1/2.;  // half of 0.1cm is added as 1mm SS sheet is placed 
+  yIron2 = 0.;
+  zIron2 = zfea;    
+
+  
+  xLead1 = xIron1 - 23.2/2.; 
+  yLead1 = -5.2/2.;
+  zLead1 = zpba;
+  
+  xLead2 =xIron2 + 23.2/2.; 
+  yLead2 = 9.8/2.;
+  zLead2 = zpba;    
+  
+  gMC->Gspos("EFE1", 1, "EPM1", xIron1,  yIron1, zfea, 0, "ONLY");
+  gMC->Gspos("ELDA", 1, "EPM1", xLead1,  yLead1, zpba, 0, "ONLY"); 
+  gMC->Gspos("EFE2", 1, "EPM2", xIron2,  yIron2, zfea, 0, "ONLY");
+  gMC->Gspos("ELDA", 1, "EPM2", xLead2,  yLead2, zpba, jhrot12, "ONLY"); 
+  
+  
+  // FOR SHORT TYPE
+  Float_t xLead3,yLead3,zLead3, xLead4,yLead4,zLead4;
+  Float_t xIron3,yIron3,zIron3, xIron4,yIron4,zIron4;
+  
+  
+  xIron3 =  16.0/2.- 0.1/2.;  // half of 0.1cm is added as 1mm SS sheet is placed ; 
+  yIron3 = 0.;
+  zIron3 = zfea;
+  
+  xIron4 = - 16.0/2.+ 0.1/2.; // half of 0.1cm is added as 1mm SS sheet is placed; 
+  yIron4 = 0.;
+  zIron4 = zfea;    
+  
+  xLead3 = xIron3 + 23.2/2.; 
+  yLead3 = -5.2/2.;
+  zLead3 = zpba;
+  
+  xLead4 = xIron4 - 23.2/2.; 
+  yLead4 = 9.8/2.;
+  zLead4 = zpba;    
+  
+  gMC->Gspos("EFE3", 1,  "EPM3",  xIron3,  yIron3,  zfea, 0, "ONLY");
+  gMC->Gspos("ELDB", 1,  "EPM3",  xLead3,  yLead3,  zpba, 0, "ONLY"); 
+  gMC->Gspos("EFE4", 1,  "EPM4",  xIron4,  yIron4,  zfea, 0, "ONLY");
+  gMC->Gspos("ELDB", 1,  "EPM4",  xLead4,  yLead4,  zpba, jhrot12, "ONLY"); 
+  
+  //===================================================================//
+  // Placement of FR4 sheets as encloser of full profile of PMD
+
+  gMC->Gspos("ECC1", 1, "EPM1",  xIron1, yIron1, -8.45,  0, "ONLY");
+  gMC->Gspos("ECC2", 1, "EPM2",  xIron2, yIron2, -8.45,  0,"ONLY");
+  gMC->Gspos("ECC3", 1, "EPM3",  xIron3, yIron3, -8.45, 0,"ONLY");
+  gMC->Gspos("ECC4", 1, "EPM4",  xIron4, yIron4, -8.45, 0,"ONLY");
+
+  gMC->Gspos("ECC1", 2, "EPM1",  xIron1, yIron1,  8.45, 0, "ONLY");
+  gMC->Gspos("ECC2", 2, "EPM2",  xIron2, yIron2,  8.45, 0,"ONLY");
+  gMC->Gspos("ECC3", 2, "EPM3",  xIron3, yIron3,  8.45, 0,"ONLY");
+  gMC->Gspos("ECC4", 2, "EPM4",  xIron4, yIron4,  8.45, 0,"ONLY");
+
+  //----------------- NOW TO PLACE SS-CHANNELS -----------------------// 
+  
+  Float_t xchanepm11, ychanepm11,ychanepm12;
+  Float_t xchanepm21, ychanepm21,ychanepm22;
+  Float_t xchanepm31, ychanepm31,ychanepm32,ychanepm33,ychanepm34;
+  Float_t xchanepm41, ychanepm41,ychanepm42,ychanepm43,ychanepm44;
+  
+  xchanepm11 = xLead1;
+  ychanepm11 = ya1 + yLead1 + dboxSS1[1] + 0.1 + 0.1/2.;
+  ychanepm12 = ya1 + yLead1 - dboxSS1[1] - 0.1 - 0.1/2.;
+  
+  xchanepm21 = xLead2;
+  ychanepm21 = -ya1 + yLead2 - dboxSS1[1] - 0.1 - 0.1/2.;
+  ychanepm22 = -ya1 + yLead2 + dboxSS1[1] + 0.1 + 0.1/2.;
+  
+  gMC->Gspos("ECHA", 1, "EPM1", xchanepm11, ychanepm11, zchanPS,   0, "ONLY");
+  gMC->Gspos("ECHA", 2, "EPM1", xchanepm11, ychanepm12, zchanPS,   0, "ONLY"); 
+  gMC->Gspos("ECHA", 3, "EPM1", xchanepm11, ychanepm11, zchanVeto, 0, "ONLY");
+  gMC->Gspos("ECHA", 4, "EPM1", xchanepm11, ychanepm12, zchanVeto, 0, "ONLY"); 
+  gMC->Gspos("ECHA", 1, "EPM2", xchanepm21, ychanepm21, zchanPS,   0, "ONLY");
+  gMC->Gspos("ECHA", 2, "EPM2", xchanepm21, ychanepm22, zchanPS,   0, "ONLY"); 
+  gMC->Gspos("ECHA", 3, "EPM2", xchanepm21, ychanepm21, zchanVeto, 0, "ONLY");
+  gMC->Gspos("ECHA", 4, "EPM2", xchanepm21, ychanepm22, zchanVeto, 0, "ONLY"); 
+  
+  xchanepm31 = xLead3;
+  ychanepm31 = yb1 + yLead3 + dboxSS2[1] + 0.1 + 0.1/2.;
+  ychanepm32 = yb1 + yLead3 - dboxSS2[1] - 0.1 - 0.1/2.;
+  ychanepm33 = yb3 + yLead3 + dboxSS2[1] + 0.1 + 0.1/2.;
+  ychanepm34 = yb3 + yLead3 - dboxSS2[1] - 0.1 - 0.1/2.;
+  
+  xchanepm41 = xLead4;
+  ychanepm41 = -yb1 + yLead4 - dboxSS2[1] - 0.1 - 0.1/2.;
+  ychanepm42 = -yb1 + yLead4 + dboxSS2[1] + 0.1 + 0.1/2.;
+  ychanepm43 = -yb3 + yLead4 - dboxSS2[1] - 0.1 - 0.1/2.;
+  ychanepm44 = -yb3 + yLead4 + dboxSS2[1] + 0.1 + 0.1/2.;
+  
+  
+  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 + 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 + 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 - 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 -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                                    //
+
+  // Eight Al Boxes are created, four on Preshower side 
+  // and four on Veto side
+
+  // FOR PRESHOWER
+
+  // First to Create hollow Al Box
+  // there are two types of modules, therefore, two Al box of
+  // long type and two of short type are created
+
+  // For Long Type
+  // X-dimension = 16.5cm
+  // Y-dimension = same as EFE1
+  // Z-dimension = 7.4cm
+  // Integer assigned to Al medium is 603
+
+  Float_t esvdA1[3];
+  esvdA1[0]= 16.5/2.;
+  esvdA1[1]= dboxFea1[1];
+  esvdA1[2]= 7.4/2.;
+  
+  gMC->Gsvolu("ESV1", "BOX", idtmed[603], esvdA1, 3);
+  gMC->Gsvolu("ESV2", "BOX", idtmed[603], esvdA1, 3);
+  
+  // Create Air strip for Al Boxes type-A
+  // Al boxes are 3mm thick In X and Z on both sides
+  // X-dimension = 16.5cm - 0.3cm
+  // Y-dimension = same as EFE1
+  // Z-dimension = 7.4cm - 0.3cm
+
+  Float_t eairA1[3];
+  eairA1[0]= esvdA1[0] - 0.3;
+  eairA1[1]= esvdA1[1];
+  eairA1[2]= esvdA1[2] - 0.3;
+
+  gMC->Gsvolu("EIR1", "BOX", idtmed[698], eairA1, 3);
+  gMC->Gsvolu("EIR2", "BOX", idtmed[698], eairA1, 3);
+
+  // Put air strips EIR1 & EIR2 inside ESV1 & ESV2 respectively    
+  gMC->Gspos("EIR1", 1,  "ESV1", 0., 0., 0., 0, "ONLY");
+  gMC->Gspos("EIR2", 1,  "ESV2", 0., 0., 0., 0, "ONLY");
+  
+
+  // For Short Type
+  // X-dimension = 16.5cm
+  // Y-dimension = same as EFE3
+  // Z-dimension = 7.4cm
+  
+  Float_t esvdA2[3];
+  esvdA2[0]= esvdA1[0];
+  esvdA2[1]= dboxFea3[1];
+  esvdA2[2]= esvdA1[2];
+
+  gMC->Gsvolu("ESV3", "BOX", idtmed[603], esvdA2, 3);
+  gMC->Gsvolu("ESV4", "BOX", idtmed[603], esvdA2, 3);
+  
+  // Create Air strip for Al Boxes type-B
+  // Al boxes are 3mm thick In X and Z on both sides
+  // X-dimension = 16.5cm - 0.3cm
+  // Y-dimension = same as EFE3
+  // Z-dimension = 7.4cm - 0.3cm
+
+  Float_t eairA2[3];
+  eairA2[0]= esvdA2[0] - 0.3;
+  eairA2[1]= esvdA2[1];
+  eairA2[2]= esvdA2[2] - 0.3;
+
+  gMC->Gsvolu("EIR3", "BOX", idtmed[698], eairA2, 3);
+  gMC->Gsvolu("EIR4", "BOX", idtmed[698], eairA2, 3);
+  
+  // 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
+
+  // First to Create hollow Al Box
+  // there are two types of modules, therefore, two Al box of
+  // long type and two of short type are created
+
+  // For Long Type
+  // X-dimension = 16.5cm
+  // Y-dimension = same as EFE1
+  // Z-dimension = 8.9cm
+  // Integer assigned to Al medium is 603
+  
+  Float_t esvdB1[3];
+  esvdB1[0]= 16.5/2.;
+  esvdB1[1]= dboxFea1[1];
+  esvdB1[2]= 8.9/2.;
+
+  gMC->Gsvolu("EVV1", "BOX", idtmed[603], esvdB1, 3);
+  gMC->Gsvolu("EVV2", "BOX", idtmed[603], esvdB1, 3);
+
+  // Create Air strip for Al Boxes long type
+  // Al boxes are 3mm thick In X and Z on both sides
+  // X-dimension = 16.5cm - 0.3cm
+  // Y-dimension = same as EFE1
+  // Z-dimension = 8.9cm - 0.3cm
+
+  Float_t eairB1[3];
+  eairB1[0]= esvdB1[0] - 0.3;
+  eairB1[1]= esvdB1[1];
+  eairB1[2]= esvdB1[2] - 0.3;
+
+  gMC->Gsvolu("EIR5", "BOX", idtmed[698], eairB1, 3);
+  gMC->Gsvolu("EIR6", "BOX", idtmed[698], eairB1, 3);
+  // 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
+  // X-dimension = 16.5cm
+  // Y-dimension = same as EFE3
+  // Z-dimension = 8.9cm
+  // Integer assigned to Al medium is 603
+  
+  Float_t esvdB2[3];
+  esvdB2[0]= esvdB1[0];
+  esvdB2[1]= dboxFea3[1];
+  esvdB2[2]= esvdB1[2];
+
+  gMC->Gsvolu("EVV3", "BOX", idtmed[603], esvdB2, 3);
+  gMC->Gsvolu("EVV4", "BOX", idtmed[603], esvdB2, 3);
+
+  
+  // Create Air strip for Al Boxes short type
+  // Al boxes are 3mm thick In X and Z on both sides
+  // X-dimension = 16.5cm - 0.3cm
+  // Y-dimension = same as EFE3
+  // Z-dimension = 8.9cm - 0.3cm
+  
+  Float_t eairB2[3];
+  eairB2[0]= esvdB2[0] - 0.3;
+  eairB2[1]= esvdB2[1];
+  eairB2[2]= esvdB2[2] - 0.3;
+  
+  gMC->Gsvolu("EIR7", "BOX", idtmed[698], eairB2, 3);
+  gMC->Gsvolu("EIR8", "BOX", idtmed[698], eairB2, 3);
+  
+  // 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 ----------------------/
+  
+  //--------------Now Create LVDBs----------------------/
+  
+  // LVDBs are the volumes of G10
+  // X-dimension = 10.0cm
+  // Y-dimension = 8.0cm
+  // Z-dimension = 0.2cm
+  // Integer assigned to the G10 medium is 607
+  
+  Float_t elvdb[3];
+  elvdb[0]= 10.0/2.;
+  elvdb[1]= 8.0/2.;
+  elvdb[2]= 0.2/2.;
+  
+  gMC->Gsvolu("ELVD", "BOX", idtmed[607], elvdb, 3);
+  
+
+  // 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,  "EIR1", 0., yesvd, 0., 0, "ONLY");
+    gMC->Gspos("ELVD", jj,  "EIR2", 0., yesvd, 0., 0, "ONLY");
+
+    yesvd = yesvd -  4.0 - 0.5 - 4.0;
+    
+  }
+  
+  yesvd = dboxFea3[1] - 15.0 - 4.0;
+  
+  for(Int_t jj =1; jj<=6; jj++){
+    
+    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;
+  }
+  
+  yesvd = dboxFea1[1] - 25.0 - 4.0;
+  
+  for(Int_t jj =1; jj<=6; jj++){
+    
+    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;
+  }
+  
+  yesvd = dboxFea3[1] - 15.0 - 4.0;
+  
+  for(Int_t jj =1; jj<=6; jj++){
+    
+    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--------------//
+  
+  // ------------ Now Create Cables ------------------------//
+  
+  // There are a number of cables
+  // We have reduced the number of volumes to 4
+  // And these 4 Volumes of Cables are placed repeatedly
+  // in the four quadrants (EPM1,2,3,4)
+  // The placement of Cables are in good approximations 
+  // The material medium for Cables is a mixture of Plastic
+  // and Copper(Cu). Therefore, in a good approximation a mixture
+  // is created and Integer assigned to this medium is 631
+  
+  Float_t cable1[3];
+  cable1[0] = 2.5/2.;
+  cable1[1] = dboxFea1[1];
+  cable1[2] = 2.4/2.;
+  
+  gMC->Gsvolu("ECB1", "BOX", idtmed[631], cable1, 3);
+  
+  Float_t cable2[3];
+  cable2[0] = 2.5/2.;
+  cable2[1] = dboxFea3[1];
+  cable2[2] = 2.4/2.;
+  
+  gMC->Gsvolu("ECB2", "BOX", idtmed[631], cable2, 3);
+  
+  Float_t cable3[3];
+  cable3[0] = 2.5/2.;
+  cable3[1] = dboxFea3[1] - dboxUM2[1];
+  cable3[2] = 2.4/2.;
+  
+  gMC->Gsvolu("ECB3", "BOX", idtmed[631], cable3, 3);
+  
+  Float_t cable4[3];
+  cable4[0] = 2.5/2.;
+  cable4[1] = dboxUM2[1];
+  cable4[2] = 2.4/2.;
+  
+  gMC->Gsvolu("ECB4", "BOX", idtmed[631], cable4, 3);
+  
+  // Calculation of the co-ordinates of Cables
+
+  Float_t xcable11pm2, xcable12pm2, xcable2pm1, xcable2pm2,  xcable21pm4,  xcable22pm4;
+  Float_t xcable3pm1, xcable3pm3, xcable3pm4, xcable4pm3;
+
+  Float_t ycable2pm1, ycable2pm2;
+  Float_t ycable3pm1, ycable3pm3, ycable3pm4, ycable4pm3;
+  
+  Float_t zcablePS, zcableVeto;
+  
+  xcable2pm1 = esvdA1[0] - 3.0 - cable1[0];
+  xcable3pm1 = xcable2pm1 - cable1[0] - 0.5 -  cable1[0];
+  
+  xcable11pm2 = -esvdA1[0]+ 3.0 + cable1[0];
+  xcable12pm2 = xcable11pm2 + cable1[0] + 0.5 + cable1[0];
+  xcable2pm2  = xcable12pm2 + cable1[0] + 0.5 + cable1[0];
+  
+  xcable3pm3 = -esvdB1[0] + 3.0 + cable1[0];
+  xcable4pm3 = xcable3pm3 + cable1[0] + 0.5 + cable1[0];
+  
+  xcable21pm4 = esvdB1[0] - 3.0 - cable1[0];
+  xcable22pm4 = xcable21pm4 - cable1[0] -0.5 - cable1[0];
+  xcable3pm4  = xcable22pm4 - cable1[0] -0.5 -cable1[0];
+  
+  ycable2pm1 = -(esvdA1[1] - esvdA2[1]);
+  ycable3pm1 = -esvdA1[1] + cable3[1];
+  
+  ycable2pm2 =  -(esvdA1[1] - esvdA2[1]);
+  
+  ycable3pm3 = -dboxUM2[1];
+  ycable4pm3 = -esvdA2[1] + dboxUM2[1];
+  
+  ycable3pm4 = -dboxUM2[1];
+  
+  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");
+  
+  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================//
+  
+   
+  gMC->Gspos("ESV1", 1,  "EPM1",  dboxFea1[0]  - esvdA1[0] - 8.0,  0., zelvdbPS, 0, "ONLY");
+  gMC->Gspos("EVV1", 1,  "EPM1",  dboxFea1[0]  - esvdB1[0] - 8.0,  0., zelvdbVeto, 0, "ONLY");
+  
+  gMC->Gspos("ESV2", 1,  "EPM2", -dboxFea2[0]  + esvdA1[0] + 8.0, 2.3, zelvdbPS, 0, "ONLY");
+  gMC->Gspos("EVV2", 1,  "EPM2", -dboxFea2[0]  + esvdB1[0] + 8.0, 2.3, zelvdbVeto, 0, "ONLY");
+  
+  gMC->Gspos("ESV3", 1,  "EPM3", -dboxFea3[0]  + esvdA1[0] + 8.0,  0., zelvdbPS, 0, "ONLY");
+  gMC->Gspos("EVV3", 1,  "EPM3", -dboxFea3[0]  + esvdB1[0] + 8.0,  0., zelvdbVeto, 0, "ONLY");
+  
+  gMC->Gspos("ESV4", 1,  "EPM4",  dboxFea4[0]  - esvdA1[0] - 8.0, 2.3, zelvdbPS, 0, "ONLY");
+  gMC->Gspos("EVV4", 1,  "EPM4",  dboxFea4[0]  - esvdB1[0] - 8.0, 2.3, zelvdbVeto, 0, "ONLY");
+  
+  //==================================================================//
+  //====================== LAST THING IS TO INSTALL ELMB ================//
+  
+  // ELMB,s are the G10 Volumes
+
+  // First to create Air Volume to place ELMBs
+  Float_t xelmb[3];
+  xelmb[0] = 10.0;
+  xelmb[1] = 4.0;
+  xelmb[2] = 0.5;
+  
+  gMC->Gsvolu("ELMB", "BOX", idtmed[698], xelmb, 3);
+  
+  // There are more G10 Volumes
+  // But in approximation, we reduced them to two
+  // ELM1 & ELM2
+  
+  Float_t xelmb1[3];
+  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] = 6.0;
+  xelmb2[1] = 3.0;
+  xelmb2[2] = 0.1;
+  
+  gMC->Gsvolu("ELM2", "BOX", idtmed[607], xelmb2, 3);
+  
+  /******** NOW POSITIONING THE G10 VOLUMES ELM1 & ELM2 IN ELMB **********/
+  
+  gMC->Gspos("ELM1", 1,  "ELMB",  0., 0., -0.3, 0, "ONLY");
+  gMC->Gspos("ELM2", 1,  "ELMB",  0., 0.,  0.3, 0, "ONLY");
+  
+  // Position co-ordinates of ELMBs in EPM2 & EPM4 
+  
+  Float_t xelmbepm2, xelmbepm4, yelmbepm2, yelmbepm4, zelmbPS, zelmbVeto;
+  
+  xelmbepm2 = -gaspmd2[0] + 16.0 +23.2 + 2.5 + xelmb[0];
+  xelmbepm4 =  gaspmd4[0] - 16.0 -23.2 - 2.5 - xelmb[0];
+  
+  yelmbepm2 = -gaspmd2[1] + 1.0 + xelmb[1];
+  yelmbepm4 = -gaspmd4[1] + 1.0 + xelmb[1];
+  
+  zelmbPS   = zfea + fgkThSteel/2.+  xelmb[2];
+  zelmbVeto = zfea - fgkThSteel/2.-  xelmb[2];
+  
+  /************ NOW PLACE ELMB'S IN EPM2 & EPM4 *********************/
+  
+  // There are total of 14 ELMB volumes
+  // three on both sides of EPM2 (total of 6)
+  // and four on both sides of EPM4 (total of 8)
+  // The ELMBs are placed at the bottom of 
+  // SS support, which is the extended part
+  
+  // Placement of ELMBs on EPM2
+  for(Int_t kk=1;kk<=3;kk++){
+    gMC->Gspos("ELMB", kk,  "EPM2",  xelmbepm2, yelmbepm2, zelmbPS, 0, "ONLY");
+    xelmbepm2 = xelmbepm2 + xelmb[0] + 0.5 + xelmb[0];
+  }
+  
+  xelmbepm2 = -gaspmd2[0] + 16.0 +23.2 + 2.5 + xelmb[0];
+  
+  for(Int_t kk=4;kk<=6;kk++){
+    gMC->Gspos("ELMB", kk, "EPM2", xelmbepm2, yelmbepm2, zelmbVeto, 0, "ONLY");
+    xelmbepm2 = xelmbepm2 + xelmb[0] + 0.5 + xelmb[0];
+  }
+  
+  // Placement of ELMBs on EPM4
+  for(Int_t kk=1;kk<=4;kk++){
+    gMC->Gspos("ELMB", kk, "EPM4", xelmbepm4, yelmbepm4, zelmbPS, 0, "ONLY");
+    xelmbepm4 = xelmbepm4 - xelmb[0] - 0.5 - xelmb[0];
+  }
+  
+  xelmbepm4 =  gaspmd4[0] - 16.0 -23.2 - 2.5 - xelmb[0];
+  for(Int_t kk=5;kk<=8;kk++){
+    gMC->Gspos("ELMB", kk, "EPM4", xelmbepm4, yelmbepm4, zelmbVeto, 0, "ONLY");
+    xelmbepm4 = xelmbepm4 - xelmb[0] - 0.5 - xelmb[0];
+  }
+  
+  //========= Placement of ELMBs Completed ============================/
+  
+  // -------------  Now to Place Unit Modules in four quadrants 
+  //                EPM1, EPM2, EPM3 & EPM4 ---------------------//
+
+  // Position co-ordinates of Unit Modules
+  
+  Double_t xcord[24];
+  Double_t ycord[24];
+  
+  xcord[0]  = xa1;
+  xcord[1]  = xa2;
+  xcord[2]  = xa3;
+  xcord[3]  = xa1;
+  xcord[4]  = xa2;
+  xcord[5]  = xa3;
+  xcord[6]  = -xa1;
+  xcord[7]  = -xa2;
+  xcord[8]  = -xa3;
+  xcord[9]  = -xa1;
+  xcord[10] = -xa2;
+  xcord[11] = -xa3;
+  xcord[12] = xb1;
+  xcord[13] = xb2;
+  xcord[14] = xb1;
+  xcord[15] = xb2;
+  xcord[16] = xb1;
+  xcord[17] = xb2;
+  xcord[18] = -xb1;
+  xcord[19] = -xb2;
+  xcord[20] = -xb1;
+  xcord[21] = -xb2;
+  xcord[22] = -xb1;
+  xcord[23] = -xb2;
+
+  ycord[0]  = ya1;
+  ycord[1]  = ya1;
+  ycord[2]  = ya1;
+  ycord[3]  = ya2;
+  ycord[4]  = ya2;
+  ycord[5]  = ya2;
+  ycord[6]  = -ya1;
+  ycord[7]  = -ya1;
+  ycord[8]  = -ya1;
+  ycord[9]  = -ya2;
+  ycord[10] = -ya2;
+  ycord[11] = -ya2;
+  ycord[12] = yb1;
+  ycord[13] = yb1;
+  ycord[14] = yb2;
+  ycord[15] = yb2;
+  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-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)
+  // in the four quadrants EPM1, EPM2, EPM3 & EPM4
+  
+  for(Int_t ii=0;ii<=5;ii++){
+    if(fModStatus[ii]){
+      gMC->Gspos("EUM1", ii, "EPM1", xcord[ii]+xLead1,ycord[ii]+yLead1, zpsa, 0, "ONLY");
+    }  
+  }
+  
+  for(Int_t ii=6;ii<=11;ii++){
+    if(fModStatus[ii]) {
+      gMC->Gspos("EUM1", ii, "EPM2", xcord[ii]+xLead2, ycord[ii]+yLead2, zpsa, jhrot12, "ONLY");
+    }
+  }
+  
+  for(Int_t ii=12;ii<=17;ii++){
+    if(fModStatus[ii]) {
+      gMC->Gspos("EUM2", ii, "EPM3", xcord[ii]+xLead3, ycord[ii]+yLead3, zpsa, 0, "ONLY");
+    }
+  }
+  
+  for(Int_t ii=18;ii<=23;ii++){
+    if(fModStatus[ii]) {
+      gMC->Gspos("EUM2", ii, "EPM4", xcord[ii]+xLead4, ycord[ii]+yLead4, zpsa, jhrot12, "ONLY");
+    }
+  }
+  
+  for(Int_t ii=24;ii<=29;ii++){
+    if(fModStatus[ii]) {
+      gMC->Gspos("EUV1", ii, "EPM1", xcord[ii-24]+xLead1, ycord[ii-24]+yLead1, zcva, 0, "ONLY");
+    }
+  }
+  
+  for(Int_t ii=30;ii<=35;ii++){
+    if(fModStatus[ii]) {
+      gMC->Gspos("EUV1", ii, "EPM2", xcord[ii-24]+xLead2, ycord[ii-24]+yLead2, zcva, jhrot12, "ONLY");
+    }
+  }
+  
+  for(Int_t ii=36;ii<=41;ii++){
+    if(fModStatus[ii]) {
+      gMC->Gspos("EUV2", ii, "EPM3", xcord[ii-24]+xLead3, ycord[ii-24]+yLead3, zcva, 0, "ONLY");
+    }
+  }
+  
+  for(Int_t ii=42;ii<=47;ii++){
+    if(fModStatus[ii]) {
+      gMC->Gspos("EUV2", ii, "EPM4", xcord[ii-24]+xLead4, ycord[ii-24]+yLead4, zcva, jhrot12, "ONLY");
+    }
+  }
+  
+  //-------------- Placement of Unit Modules Completed ---------------// 
+  
+  // ========== PLACE THE EPMD IN ALICE ======================//  
+  
+  // Now the Job to assemble the five mother volumes of PMD in ALICE
+  
+  // Z-distance of PMD from Interaction Point
+
+  zp = fgkZdist;
+  
+  // X and Y-positions of the EPM1, EPM2, EPM3 & EPM4
+  Float_t xfinal,yfinal; 
+  Float_t xsm1,  xsm2,  xsm3,  xsm4;
+  Float_t ysm1,  ysm2,  ysm3,  ysm4;
+  
+  xfinal = (fSMLengthax + serviceX/2. + serviceXext/2. + 0.05) + 0.48/2. +
+    (fSMLengthbx + serviceX/2. + serviceXext/2.+ 0.05);
+
+  //Extra width of the SS plate on Support Structure on X-side and 1mm thick SS for cooling encloser 
+  //Extra width of the SS plate on Support Structure on X-side for B-Type
+  
+  yfinal = (fSMLengthay + serviceYa/2.)+ 0.20/2 + (fSMLengthby + serviceYb/2.);
+
+  //serviceYa is the Extra width of the SS plate on Support Structur on Y-side for EPM1 & EPM3 
+  //serviceYb is the Extra width of the SS plate on Support Structur on Y-side for EPM2 & EPM4
+  
+  
+  xsm1 =  xfinal  - (fSMLengthax + serviceX/2. + serviceXext/2. + 0.05);
+  ysm1 =  yfinal  - (fSMLengthay + serviceYa/2.) - 2.3;
+  
+  xsm2 =  -xfinal  + (fSMLengthax + serviceX/2. + serviceXext/2. + 0.05);
+  ysm2 =  -yfinal  + (fSMLengthay + serviceYb/2.) - 2.3;
+  
+  xsm3 =  -xfinal + (fSMLengthbx + serviceX/2. + serviceXext/2. + 0.05);
+  ysm3 =   yfinal - (fSMLengthby + serviceYa/2.) - 2.3;
+  
+  xsm4 =   xfinal - (fSMLengthbx + serviceX/2. + serviceXext/2. + 0.05);
+  ysm4 =  -yfinal + (fSMLengthby + serviceYb/2.) - 2.3;
+  
+  //Position Full PMD in ALICE   
   //
-  // ORIGIN    : Y. P. VIYOGI 
+  //       EPM1                EPM3
   //
+  //       EPM4                EPM2
+  //  (rotated EPM3)      (rotated EPM1)
+  //
+  //                EFGD
+  //        (Girders and its Carriage)
   
-  // --- The Argon- CO2 mixture --- 
-  Float_t ag[2] = { 39.95 };
-  Float_t zg[2] = { 18. };
-  Float_t wg[2] = { .7,.3 };
-  Float_t dar   = .001782;   // --- Ar density in g/cm3 --- 
-  // --- CO2 --- 
-  Float_t ac[2] = { 12.,16. };
-  Float_t zc[2] = { 6.,8. };
-  Float_t wc[2] = { 1.,2. };
-  Float_t dc    = .001977;
-  Float_t dco   = .002;  // --- CO2 density in g/cm3 ---
-  
-  Float_t absl, radl, a, d, z;
-  Float_t dg;
-  Float_t x0ar;
-  Float_t buf[1];
-  Int_t nbuf;
-  Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
-  Float_t zsteel[4] = { 26.,24.,28.,14. };
-  Float_t wsteel[4] = { .715,.18,.1,.005 };
+  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");
   
-  Int_t *idtmed = fIdtmed->GetArray()-599;
-  Int_t isxfld = gAlice->Field()->Integ();
-  Float_t sxmgmx = gAlice->Field()->Max();
+  gMC->Gspos("EFGD", 1, "ALIC", 0., yfinal + fulgrdr[1], zp, 0, "ONLY");  
+}
+
+//_____________________________________________________________________________
+
+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
+  //
+  // ORIGIN    : Y. P. VIYOGI 
+  //
+  //  cout << " Inside create materials " << endl;
+  
+  Int_t isxfld = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
+  Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
   
   // --- Define the various materials for GEANT --- 
+  
   AliMaterial(1, "Pb    $", 207.19, 82., 11.35, .56, 18.5);
-  x0ar = 19.55 / dar;
-  AliMaterial(2, "Argon$", 39.95, 18., dar, x0ar, 6.5e4);
-  AliMixture(3, "CO2  $", ac, zc, dc, -2, wc);
+  
+  // Argon
+  
+  Float_t dAr   = 0.001782;   // --- Ar density in g/cm3 --- 
+  Float_t x0Ar = 19.55 / dAr;
+  AliMaterial(2, "Argon$", 39.95, 18., dAr, x0Ar, 6.5e4);
+  
+  // --- CO2 --- 
+  
+  Float_t aCO2[2] = { 12.,16. };
+  Float_t zCO2[2] = { 6.,8. };
+  Float_t wCO2[2] = { 1.,2. };
+  Float_t dCO2    = 0.001977;
+  AliMixture(3, "CO2  $", aCO2, zCO2, dCO2, -2, wCO2);
+  
   AliMaterial(4, "Al   $", 26.98, 13., 2.7, 8.9, 18.5);
+  
+  // ArCO2
+  
+  Float_t aArCO2[3] = {39.948,12.0107,15.9994};
+  Float_t zArCO2[3] = {18.,6.,8.};
+  Float_t wArCO2[3] = {0.7,0.08,0.22};
+  Float_t dArCO2    = dAr * 0.7 + dCO2 * 0.3;
+  AliMixture(5, "ArCO2$", aArCO2, zArCO2, dArCO2, 3, wArCO2);
+  
   AliMaterial(6, "Fe   $", 55.85, 26., 7.87, 1.76, 18.5);
-  AliMaterial(7, "W    $", 183.85, 74., 19.3, .35, 10.3);
-  AliMaterial(8, "G10  $", 20., 10., 1.7, 19.4, 999.);
-  AliMaterial(9, "SILIC$", 28.09, 14., 2.33, 9.36, 45.);
-  AliMaterial(10, "Be   $", 9.01, 4., 1.848, 35.3, 36.7);
+  
+  // G10
+  
+  Float_t aG10[4]={1.,12.011,15.9994,28.086};
+  Float_t zG10[4]={1.,6.,8.,14.};
+  Float_t wG10[4]={0.15201,0.10641,0.49444,0.24714};
+  AliMixture(8,"G10",aG10,zG10,1.7,4,wG10);
+  
   AliMaterial(15, "Cu   $", 63.54, 29., 8.96, 1.43, 15.);
-  AliMaterial(16, "C    $", 12.01, 6., 2.265, 18.8, 49.9);
-  AliMaterial(17, "POLYCARBONATE    $", 20., 10., 1.2, 34.6, 999.);
-  AliMixture(19, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel); 
-  // AliMaterial(31, "Xenon$", 131.3, 54., dxe, x0xe, 6.5e4);
-  
-  AliMaterial(96, "MYLAR$", 8.73, 4.55, 1.39, 28.7, 62.);
-  AliMaterial(97, "CONCR$", 20., 10., 2.5, 10.7, 40.);
-  AliMaterial(98, "Vacum$", 1e-9, 1e-9, 1e-9, 1e16, 1e16);
-  AliMaterial(99, "Air  $", 14.61, 7.3, .0012, 30420., 67500.);
-  //   define gas-mixtures 
   
-  char namate[21];
-  gMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
-  ag[1] = a;
-  zg[1] = z;
-  dg = (dar * 4 + dco) / 5;
-  AliMixture(5, "ArCO2$", ag, zg, dg, 2, wg);
+  // Steel
+  Float_t aSteel[4] = { 55.847,51.9961,58.6934,28.0855 };
+  Float_t zSteel[4] = { 26.,24.,28.,14. };
+  Float_t wSteel[4] = { .715,.18,.1,.005 };
+  Float_t dSteel    = 7.88;
+  AliMixture(19, "STAINLESS STEEL$", aSteel, zSteel, dSteel, 4, wSteel); 
+  
+  
+  // --- CH2 : PLASTIC  --- 
+  
+  Float_t aCH2[2] = { 12.,1.};
+  Float_t zCH2[2] = { 6.,1.};
+  Float_t wCH2[2] = { 1.,2.};
+  Float_t dCH2    = 0.95;
+  AliMixture(31, "CH2  $", aCH2, zCH2, dCH2, -2, wCH2);
+  
+  // --- CABLES : 80% Plastic and 20% Copper  --- 
+  
+  Float_t aCABLE[3] = { 12.,1.,63.5 };
+  Float_t zCABLE[3] = { 6.,1.,29. };
+  Float_t wCABLE[3] = { 0.6857, 0.1143, 0.2};
+  Float_t dCABLE    = dCH2*0.8 + 8.96*0.2;
+  AliMixture(32, "CABLE  $", aCABLE, zCABLE, dCABLE, 3, wCABLE);
+
+  
+  
+  //Air
+  
+  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 dAir1 = 1.20479E-10;
+  Float_t dAir = 1.20479E-3;
+  AliMixture(98, "Vacum$", aAir,  zAir, dAir1, 4, wAir);
+  AliMixture(99, "Air  $", aAir,  zAir, dAir , 4, wAir);
   
   // Define tracking media 
-  AliMedium(1, "Pb conv.$", 1,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
-  AliMedium(7, "W  conv.$", 7,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
-  AliMedium(8, "G10plate$", 8,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
-  AliMedium(4, "Al      $", 4,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
-  AliMedium(6, "Fe      $", 6,  0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
-  AliMedium(5, "ArCO2   $", 5,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
-  AliMedium(9, "SILICON $", 9,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
-  AliMedium(10, "Be      $", 10, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
-  AliMedium(98, "Vacuum  $", 98, 0, 0, isxfld, sxmgmx, 1., .1, .1,  10);
-  AliMedium(99, "Air gaps$", 99, 0, 0, isxfld, sxmgmx, 1., .1, .1,  .1);
-  AliMedium(15, "Cu      $", 15, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
-  AliMedium(16, "C       $", 16, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
-  AliMedium(17, "PLOYCARB$", 17, 0, 0, isxfld, sxmgmx, .1,  .1, .01, .1);
-  AliMedium(19, " S steel$", 19, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
-  //  AliMedium(31, "Xenon   $", 31,  1, 0, isxfld, sxmgmx, .1,  .1, .1,  .1);
+  AliMedium(1,  "Pb conv.$", 1,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
+  AliMedium(4,  "Al      $", 4,  0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
+  AliMedium(5,  "ArCO2   $", 5,  1, 0, isxfld, sxmgmx, .1, .1, .10, .1);
+  AliMedium(6,  "Fe      $", 6,  0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
+  AliMedium(8,  "G10plate$", 8,  0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
+  AliMedium(15, "Cu      $", 15, 0, 0, isxfld, sxmgmx, .1, .1, .01, .1);
+  AliMedium(19, "S  steel$", 19, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
+  AliMedium(32, "CABLE   $", 32, 0, 0, isxfld, sxmgmx, 1., .1, .01, .1);
+  AliMedium(98, "Vacuum  $", 98, 0, 0, isxfld, sxmgmx, 1., .1, .10, 10);
+  AliMedium(99, "Air gaps$", 99, 0, 0, isxfld, sxmgmx, 1., .1, .10, .1);
+  
+  AliDebug(1,"Outside create materials");
+  
+}
+
+//_____________________________________________________________________________
+
+void AliPMDv1::Init()
+{
+  //
+  // Initialises PMD detector after it has been built
+  //
   
+  //
+  AliDebug(2,"Inside Init");
+  AliDebug(2,"PMD simulation package (v1) initialised");
+  AliDebug(2,"parameters of pmd");
+  AliDebug(2,Form("%10.2f %10.2f %10.2f %10.2f\n",
+                 fgkCellRadius,fgkCellWall,fgkCellDepth,fgkZdist));
+  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.);
@@ -741,9 +2184,6 @@ void AliPMDv1::CreateMaterials()
   gMC->Gstpar(idtmed[605], "LOSS", 3.);
   gMC->Gstpar(idtmed[605], "DRAY", 1.);
   
-  gMC->Gstpar(idtmed[606], "LOSS", 3.);
-  gMC->Gstpar(idtmed[606], "DRAY", 1.);
-  
   gMC->Gstpar(idtmed[607], "LOSS", 3.);
   gMC->Gstpar(idtmed[607], "DRAY", 1.);
   
@@ -753,22 +2193,21 @@ void AliPMDv1::CreateMaterials()
   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[606], "CUTGAM", 1e-4);
-  gMC->Gstpar(idtmed[606], "CUTELE", 1e-4);
-  gMC->Gstpar(idtmed[606], "CUTNEU", 1e-4);
-  gMC->Gstpar(idtmed[606], "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);
+
+  //   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);
@@ -777,143 +2216,263 @@ void AliPMDv1::CreateMaterials()
   gMC->Gstpar(idtmed[604], "CUTHAD", 1e-5);
   gMC->Gstpar(idtmed[604], "CUTMUO", 1e-5);
 
-  cout << " Outside create materials " << endl;
-
-}
-
-//_____________________________________________________________________________
-void AliPMDv1::Init()
-{
-  //
-  // Initialises PMD detector after it has been built
-  //
+  // 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);
 
-  Int_t i;
-  kdet=1;
-  //
-  cout << " Inside Init " << endl;
-  if(fDebug) {
-      printf("\n%s: ",ClassName());
-      for(i=0;i<35;i++) printf("*");
-      printf(" PMD_INIT ");
-      for(i=0;i<35;i++) printf("*");
-      printf("\n%s: ",ClassName());
-      printf("                 PMD simulation package (v1) initialised\n");
-      printf("%s: parameters of pmd\n",ClassName());
-      printf("%s: %10.2f %10.2f %10.2f \
-      %10.2f\n",ClassName(),cell_radius,cell_wall,cell_depth,zdist1 );
-      printf("%s: ",ClassName());
-      for(i=0;i<80;i++) printf("*");
-      printf("\n");
-  }
+  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);
   
-  Int_t *idtmed = fIdtmed->GetArray()-599;
-  fMedSens=idtmed[605-1];
+  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);
 }
 
 //_____________________________________________________________________________
+
 void AliPMDv1::StepManager()
 {
   //
   // Called at each step in the PMD
   //
-
+  
   Int_t   copy;
-  Float_t hits[4], destep;
+  Float_t hits[5], destep;
   Float_t center[3] = {0,0,0};
-  Int_t   vol[8]; //5
+  Int_t   vol[6];
   //const char *namep;
-  
-  if(gMC->GetMedium() == fMedSens && (destep = gMC->Edep())) {
-  
+  //    printf("Current vol  is ********  %s \n",namep);
+  if(gMC->CurrentMedium() == fMedSens && (destep = gMC->Edep())) {
+    
     gMC->CurrentVolID(copy);
     //namep=gMC->CurrentVolName();
-    //printf("Current vol  is %s \n",namep);
+    //  printf("Current vol  is %s \n",namep);
     vol[0]=copy;
-
+    
     gMC->CurrentVolOffID(1,copy);
     //namep=gMC->CurrentVolOffName(1);
-    //printf("Current vol 11 is %s \n",namep);
+    // printf("Current vol 11 is %s \n",namep);
     vol[1]=copy;
-
+    
     gMC->CurrentVolOffID(2,copy);
     //namep=gMC->CurrentVolOffName(2);
-    //printf("Current vol 22 is %s \n",namep);
+    // printf("Current vol 22 is %s \n",namep);
     vol[2]=copy;
-
-    // if(strncmp(namep,"EHC1",4))vol[2]=1;
-
+    
     gMC->CurrentVolOffID(3,copy);
     //namep=gMC->CurrentVolOffName(3);
-    //printf("Current vol 33 is %s \n",namep);
+    // printf("Current vol 33 is %s \n",namep);
     vol[3]=copy;
-
+    
     gMC->CurrentVolOffID(4,copy);
     //namep=gMC->CurrentVolOffName(4);
-    //printf("Current vol 44 is %s \n",namep);
+    // printf("Current vol 44 is %s \n",namep);
     vol[4]=copy;
-
+    
     gMC->CurrentVolOffID(5,copy);
     //namep=gMC->CurrentVolOffName(5);
     //printf("Current vol 55 is %s \n",namep);
     vol[5]=copy;
 
-    gMC->CurrentVolOffID(6,copy);
-    //namep=gMC->CurrentVolOffName(6);
-    //printf("Current vol 66 is %s \n",namep);
-    vol[6]=copy;
-
-    gMC->CurrentVolOffID(7,copy);
-    //namep=gMC->CurrentVolOffName(7);
-    //printf("Current vol 77 is %s \n",namep);
-    vol[7]=copy;
-
-
-    //printf("volume number %4d %4d %4d %4d %4d %4d %4d %4d %10.3f \n",vol[0],vol[1],vol[2],vol[3],vol[4],vol[5],vol[6],vol[7],destep*1000000);
+    
+    // printf("volume number %4d %4d %4d %4d %4d %4d %10.3f \n",vol[0],vol[1],vol[2],vol[3],vol[4],vol[5],destep*1000000);// edep in MeV
+    
     
     gMC->Gdtom(center,hits,1);
     hits[3] = destep*1e9; //Number in eV
-    AddHit(gAlice->GetCurrentTrackNumber(), vol, hits);
+
+    // this is for pile-up events
+    hits[4] = gMC->TrackTime();
+
+    AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
+
+    AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kPMD);
 
   }
 }
 
-  
+
 //------------------------------------------------------------------------
 // Get parameters
 
 void AliPMDv1::GetParameters()
 {
-  const Float_t root3 = TMath::Sqrt(3.); 
-  const Float_t root3_2 = TMath::Sqrt(3.) /2.; 
+  // This gives all the parameters of the detector
+  // such as Length of Supermodules, type A, type B,
+  // thickness of the Supermodule
   //
-  cell_radius=0.25;
-  cell_wall=0.02;
-  cell_depth=0.25 * 2.;
-  //
-  ncol_um1 = 48;
-  ncol_um2 = 96;
-  nrow_um1 = 96;//each strip has 1 row
-  nrow_um2 = 48;//each strip has 1 row
+  
+  fSMLengthax = 32.7434;
+  //The total length in X is due to the following components
+  // Factor 3 is because of 3 module length in X for this type
+  // fgkNcolUM1*fgkCellRadius (48 x 0.25): Total span of each module in X
+  // fgkCellRadius/2. : There is offset of 1/2 cell
+  // 0.05+0.05 : Insulation gaps etc
+  // fgkSSBoundary (0.3) : Boundary frame
+  // double XA = 3.0*((fgkCellRadius/fgkSqroot3by2*fgkNcolUM1)-(fgkCellRadius*fgkSqroot3*(fgkNcolUM1-1)/6.)+(2.0*fgkGap)+(2.0*fgkGap)+fgkSSBoundary) + (2.0*0.075);
+  
+  fSMLengthbx = 42.6136;
+  //The total length in X is due to the following components
+  // Factor 2 is because of 2 module length in X for this type
+  // fgkNcolUM2*fgkCellRadius (96 x 0.25): Total span of each module in X
+  // fgkCellRadius/2. : There is offset of 1/2 cell
+  // 0.05+0.05 : Insulation gaps etc
+  // fgkSSBoundary (0.3) : Boundary frame
+  //double XB = 2.0*((fgkCellRadius/fgkSqroot3by2*fgkNcolUM2)-(fgkCellRadius*fgkSqroot3*(fgkNcolUM2-1)/6.)+(2.0*fgkGap)+(2.0*fgkGap)+fgkSSBoundary) + 0.1; 
+  
+
+  
+  fSMLengthay = 49.35;
+  //The total length in Y is due to the following components
+  // Factor 2 is because of 2 module length in Y for this type
+  // fgkCellRadius/fgkSqroot3by2)*fgkNrowUM1 (0.25/sqrt3/2 * 96): Total span of each module in Y
+  //  of strips
+  // 0.05+0.05 : Insulation gaps etc
+  // fgkSSBoundary (0.3) : Boundary frame
+  // 0.6cm is the channel width plus tolerance
+  // double  YA = 2.0*(fgkNrowUM1*fgkCellRadius+fgkCellRadius/2.+(2.0*fgkGap)+(2.0*fgkGap)+fgkSSBoundary) +  0.6/2.;
+  
+  fSMLengthby =  37.925;
+  //The total length in Y is due to the following components
+  // Factor 3 is because of 3 module length in Y for this type
+  // fgkCellRadius/fgkSqroot3by2)*fgkNrowUM2 (0.25/sqrt3/2 * 48): Total span of each module in Y
+  //  of strips
+  // 0.05+0.05 : Insulation gaps etc
+  // fgkSSBoundary (0.3) : Boundary frame
+  // 10mm is the channel width plus tolerance
+  //double YB = 3.0*((fgkNrowUM2*fgkCellRadius + fgkCellRadius/2.)+(2.0*fgkGap)+(2.0*fgkGap)+fgkSSBoundary) + 1.0/2.;
+  
+  
+  //Thickness of a pre/veto plane 
+  fDthick     = fgkThSS/2. + 1.2;     // 1.2 added as FEE Board are now assembled with pre/veto
+  
+  //Thickness of the PMD ; 2.4 added for FEE boards 
+  fSMthickpmd    = 2.0*(fgkThSS/2.) +fgkThSteel/2.+fgkThLead/2.0 + 2.4/2.;
+  
+  fSMthick = 17.; //17 cm is the full profile of PMD
+  
+  
+}
+
+
+// ---------------------------------------------------------------
+void AliPMDv1::AddAlignableVolumes() const
+{
   //
-  sm_length_ax = (3.0*(ncol_um1*cell_radius+cell_radius/2.)+(2.0*0.025)) + 0.7;
-  sm_length_bx = 2.0*(ncol_um2*cell_radius+cell_radius/2.)+0.025+0.7; 
-
-  sm_length_ay = 2.0*(((cell_radius/root3_2)*nrow_um1)-(cell_radius*root3*(nrow_um1-1)/6.))+0.025+0.7;
-  sm_length_by = 3.0*(((cell_radius/root3_2)*nrow_um2)-(cell_radius*root3*(nrow_um2-1)/6.))+(2.0*0.025)+0.7;
-    //
-    boundary=0.7;
-    //
-    th_base=0.3;
-    th_air=0.1;
-    th_pcb=0.16;
-    //
-    sm_thick = th_base + th_air + th_pcb + cell_depth + th_pcb + th_air + th_pcb;
-    //
-    th_lead=1.5;
-    th_steel=0.5;
-    
-    zdist1 = 361.5;
+  // 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.
+  // 
+  SetSectorAlignable();
+  
+}
+// ----------------------------------------------------------------
+void AliPMDv1::SetSectorAlignable() const
+{
+  // 
+  
+  TString vpsector = "ALIC_1/EPM";
+  TString vpappend = "_1";
+
+  TString snsector="PMD/Sector";
+  
+  TString volpath, symname;
+  
+  for(Int_t cnt=1; cnt<=4; cnt++){
+    //for(Int_t cnt=1; cnt<=4; cnt++){
+    volpath = vpsector;
+    volpath += cnt;
+    volpath += vpappend;
+    symname = snsector;
+    symname += cnt;
+    if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data()))
+      {
+       AliFatal("Unable to set alignable entry!");
+      }
+  }
+}
+// ------------------------------------------------------------------
+void AliPMDv1::SetCpvOff()
+{
+  // Set the entire CPV plane off
+
+  for (Int_t imodule = 24; imodule < 48; imodule++)
+    fModStatus[imodule] = 0;
+}
+// ------------------------------------------------------------------
+void AliPMDv1::SetPreOff()
+{
+  // Set the entire Preshower plane off
+
+  for (Int_t imodule = 0; imodule < 24; imodule++)
+    fModStatus[imodule] = 0;
+
+}
+// ------------------------------------------------------------------
+void AliPMDv1::SetModuleOff(Int_t imodule)
+{
+  // Set the individual module off
+
+  fModStatus[imodule] = 0;
 
 }