]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updates
authormorsch <andreas.morsch@cern.ch>
Mon, 5 Jan 2015 12:49:12 +0000 (13:49 +0100)
committermorsch <andreas.morsch@cern.ch>
Mon, 5 Jan 2015 14:34:39 +0000 (15:34 +0100)
Ernesto Calvo

AD/ADsim/AliAD.cxx
AD/ADsim/AliAD.h
AD/ADsim/AliADv1.cxx
AD/ADsim/AliADv1.h

index 3cfb138efe9cdb9dbe9c104b885fd3d402af95d5..02e3516bafcbac5c67f8087a75e317318cc3b490 100644 (file)
 #include "AliADhit.h"
 #include "AliADLoader.h"
 #include "AliADDigitizer.h"
-#include "AliADBuffer.h"
-#include "AliADConst.h"
 #include "AliDigitizationInput.h"
 #include "AliADdigit.h"
 #include "AliADSDigit.h"
-#include "AliADCalibData.h"
 #include "AliDAQ.h"
 #include "AliRawReader.h"
 #include "AliCDBManager.h"
@@ -68,8 +65,8 @@ ClassImp(AliAD)
  //__________________________________________________________________
 AliAD::AliAD()
    : AliDetector(),
-     fSetADAToInstalled(0),
-     fSetADCToInstalled(0)
+     fSetADATwoInstalled(0),
+     fSetADCTwoInstalled(0)
 {
        /// Default Constructor
     
@@ -79,8 +76,8 @@ AliAD::AliAD()
 //_____________________________________________________________________________
 AliAD::AliAD(const char *name, const char *title)
    : AliDetector(name,title),
-     fSetADAToInstalled(kTRUE),
-     fSetADCToInstalled(kTRUE)
+     fSetADATwoInstalled(kTRUE),
+     fSetADCTwoInstalled(kTRUE)
 
 {
   
@@ -101,22 +98,111 @@ AliAD::~AliAD()
 //_____________________________________________________________________________
 void AliAD::CreateMaterials()
 {
-   //
-   // MATERIALS FOR ADC AND ADA
-   //
-   
-   // Parameters for simulation scope for ADA and ADC (stolen from AliVZEROv7::CreateMaterials )
-   Int_t    fieldType       = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();     // Field type 
-   Double_t maxField        = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();       // Field max.
-   Double_t maxBending      = 10;    // Max Angle
-   Double_t maxStepSize     = 0.01;  // Max step size 
-   Double_t maxEnergyLoss   = 1;     // Max Delta E
-   Double_t precision       = 0.003; // Precision
-   Double_t minStepSize     = 0.003; // Minimum step size 
-   Float_t  density,  as[11], zs[11], ws[11];
-   Double_t radLength, absLength, a_ad, z_ad;
-   Int_t    id;
-   
+  //
+  // MATERIALS FOR ADC AND ADA
+  //
+  
+  // Parameters for simulation scope for ADA and ADC (stolen from AliVZEROv7::CreateMaterials )
+  Int_t    fieldType       = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();     // Field type 
+  Double_t maxField        = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();       // Field max.
+  // Int_t   isxfld1 = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
+  // Float_t sxmgmx  = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
+  Int_t    isxfld2         = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->PrecInteg();
+  Double_t maxBending      = 10;    // Max Angle
+  Double_t maxStepSize     = 0.01;  // Max step size 
+  Double_t maxEnergyLoss   = 1;     // Max Delta E
+  Double_t precision       = 0.003; // Precision
+  Double_t minStepSize     = 0.003; // Minimum step size 
+  Float_t  density,  as[11], zs[11], ws[11];
+  Double_t radLength, absLength, a_ad, z_ad;
+  Int_t    id;
+  
+  //
+  // 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 dAir = 1.20479E-3;
+  Float_t dAir1 = 1.20479E-10;
+  // 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    };
+  //
+  // Cast iron
+  //
+  Float_t acasti[4] = {55.847,12.011,28.085,54.938};
+  Float_t zcasti[4] = {26.,6.,14.,25.};
+  Float_t wcasti[4] = {0.929,0.035,0.031,0.005};
+  // --- Define the various materials for GEANT --- 
+  //     Aluminum 
+  AliMaterial(9,  "ALU1      ", 26.98, 13., 2.7, 8.9, 37.2);
+  AliMaterial(29, "ALU2      ", 26.98, 13., 2.7, 8.9, 37.2);
+  AliMaterial(49, "ALU3      ", 26.98, 13., 2.7, 8.9, 37.2);
+  
+  //     Iron 
+  AliMaterial(10, "IRON1     ", 55.85, 26., 7.87, 1.76, 17.1);
+  AliMaterial(30, "IRON2     ", 55.85, 26., 7.87, 1.76, 17.1);
+  AliMaterial(50, "IRON3     ", 55.85, 26., 7.87, 1.76, 17.1);
+
+  //
+  //     Copper
+  AliMaterial(11, "COPPER1   ", 63.55, 29., 8.96, 1.43, 15.1);
+  AliMaterial(31, "COPPER2   ", 63.55, 29., 8.96, 1.43, 15.1);
+  AliMaterial(51, "COPPER3   ", 63.55, 29., 8.96, 1.43, 15.1);
+  
+  //     Vacuum 
+  AliMixture(16, "VACUUM1 ", aAir, zAir, dAir1, 4, wAir);
+  AliMixture(36, "VACUUM2 ", aAir, zAir, dAir1, 4, wAir);
+  AliMixture(56, "VACUUM3 ", aAir, zAir, dAir1, 4, wAir);
+  
+  //     Stainless Steel 
+  AliMixture(19, "STAINLESS STEEL1", asteel, zsteel, 7.88, 4, wsteel);
+  AliMixture(39, "STAINLESS STEEL2", asteel, zsteel, 7.88, 4, wsteel);
+  AliMixture(59, "STAINLESS STEEL3", asteel, zsteel, 7.88, 4, wsteel);
+  
+  //     Cast iron
+  AliMixture(18, "CAST IRON1", acasti, zcasti, 7.2, 4, wcasti);
+  AliMixture(38, "CAST IRON2", acasti, zcasti, 7.2, 4, wcasti);
+  AliMixture(58, "CAST IRON3", acasti, zcasti, 7.2, 4, wcasti);
+  // **************** 
+  //     Defines tracking media parameters. 
+  //     Les valeurs sont commentees pour laisser le defaut 
+  //     a GEANT (version 3-21, page CONS200), f.m. 
+  Float_t epsil, stmin, tmaxfd, deemax, stemax;
+  epsil  = .001;  // Tracking precision, 
+  stemax = -1.;   // Maximum displacement for multiple scat 
+  tmaxfd = -20.;  // Maximum angle due to field deflection 
+  deemax = -.3;   // Maximum fractional energy loss, DLS 
+  stmin  = -.8;
+  // *************** 
+  
+  //    Aluminum 
+  AliMedium(9,  "ALU_C0          ", 9, 0,  fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(29, "ALU_C1          ", 29, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(49, "ALU_C2          ", 49, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  
+  //    Iron 
+  AliMedium(10, "FE_C0           ", 10, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(30, "FE_C1           ", 30, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(50, "FE_C2           ", 50, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+
+  //    Copper 
+  AliMedium(11, "Cu_C0           ", 11, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(31, "Cu_C1           ", 31, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(51, "Cu_C2           ", 51, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  
+  //    Vacuum 
+  AliMedium(16, "VA_C0           ", 16, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(36, "VA_C1           ", 36, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(56, "VA_C2           ", 56, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  
+  //    Steel 
+  AliMedium(19, "ST_C0           ", 19, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(39, "ST_C1           ", 39, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+  AliMedium(59, "ST_C3           ", 59, 0, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
+
    //
    // Parameters  for AD scintillator: NE-102 (BC400)
    //
@@ -257,130 +343,16 @@ AliDigitizer* AliAD::CreateDigitizer(AliDigitizationInput* digInput) const
 }
 
 //_____________________________________________________________________________
-void AliAD::Hits2Digits(){
-  //
-  // Converts hits to digits
-  //
-  // Creates the AD digitizer 
-  AliADDigitizer* dig = new AliADDigitizer(this,AliADDigitizer::kHits2Digits);
-
-  // Creates the digits
-  dig->Digitize("");
-
-  // deletes the digitizer
-  delete dig;
-}
-
-//_____________________________________________________________________________
-void AliAD::Hits2SDigits(){
-  //
-  // Converts hits to summable digits
-  //
-  // Creates the AD digitizer 
-  AliADDigitizer* dig = new AliADDigitizer(this,AliADDigitizer::kHits2SDigits);
-
-  // Creates the sdigits
-  dig->Digitize("");
 
-  // deletes the digitizer
-  delete dig;
-}
-
-
-//_____________________________________________________________________________
 void AliAD::Digits2Raw()
 {
-   //
-   //  Converts digits of the current event to raw data
-   //
-   AliAD *fAD = (AliAD*)gAlice->GetDetector("AD");
-   fLoader->LoadDigits();
-   TTree* digits = fLoader->TreeD();
-   if (!digits) {
-      Error("Digits2Raw", "no digits tree");
-      return;
-   }
-   TClonesArray * ADdigits = new TClonesArray("AliADdigit",1000);
-   fAD->SetTreeAddress();              
-   digits->GetBranch("ADDigit")->SetAddress(&ADdigits); 
-  
-   const char *fileName    = AliDAQ::DdlFileName("AD",0);
-   AliADBuffer* buffer  = new AliADBuffer(fileName);
-   //AliADBuffer* buffer  = new AliADBuffer("AD_0.ddl");
-   
-   // Get Trigger information first
-   // Read trigger inputs from trigger-detector object
-   AliDataLoader * dataLoader = fLoader->GetDigitsDataLoader();
-   if( !dataLoader->IsFileOpen() ) 
-        dataLoader->OpenFile( "READ" );
-   AliTriggerDetector* trgdet = (AliTriggerDetector*)dataLoader->GetDirectory()->Get( "Trigger" );
-   UInt_t triggerInfo = 0;
-   if(trgdet) {
-      triggerInfo = trgdet->GetMask() & 0xffff;
-   }
-   else {
-      AliError(Form("There is no trigger object for %s",fLoader->GetName()));
-   }
-
-   buffer->WriteTriggerInfo((UInt_t)triggerInfo); 
-   buffer->WriteTriggerScalers(); 
-   buffer->WriteBunchNumbers(); 
-  
-   // Now retrieve the channel information: charge smaples + time and 
-   // dump it into ADC and Time arrays
-   Int_t nEntries = Int_t(digits->GetEntries());
-   Short_t aADC[16][kNClocks];
-   Float_t aTime[16];
-   Float_t aWidth[16];
-   Bool_t  aIntegrator[16];
-  
-   for (Int_t i = 0; i < nEntries; i++) {
-     fAD->ResetDigits();
-     digits->GetEvent(i);
-     Int_t ndig = ADdigits->GetEntriesFast(); 
-   
-     if(ndig == 0) continue;
-     for(Int_t k=0; k<ndig; k++){
-         AliADdigit* fADDigit = (AliADdigit*) ADdigits->At(k);
-
-        Int_t iChannel       = fADDigit->PMNumber();
-        
-        for(Int_t iClock = 0; iClock < kNClocks; ++iClock) aADC[iChannel][iClock] = fADDigit->ChargeADC(iClock);
-        aTime[iChannel]      = fADDigit->Time(); //divide by resolution
-        aWidth[iChannel]     = fADDigit->Width(); //divide by resolution
-        aIntegrator[iChannel]= fADDigit->Integrator();
-        
-         //AliDebug(1,Form("DDL: %s\tdigit number: %d\tPM number: %d\tADC: %d\tTime: %f",
-                        //fileName,k,fADDigit->PMNumber(),aADC[iChannel][AliADdigit::kNClocks/2],aTime[iChannel])); 
-     }        
-   }
-
-   // Now fill raw data          
-   for (Int_t  iCIU = 0; iCIU < kNCIUBoards; iCIU++) { 
-   // decoding of one Channel Interface Unit numbered iCIU - there are 8 channels per CIU (and 2 CIUs) : 
-      for(Int_t iChannel_Offset = iCIU*8; iChannel_Offset < (iCIU*8)+8; iChannel_Offset=iChannel_Offset+4) { 
-         for(Int_t iChannel = iChannel_Offset; iChannel < iChannel_Offset+4; iChannel++) {
-             buffer->WriteChannel(iChannel, aADC[iChannel], aIntegrator[iChannel]);       
-         }
-         buffer->WriteBeamFlags(); 
-         buffer->WriteMBInfo(); 
-         buffer->WriteMBFlags();   
-         buffer->WriteBeamScalers(); 
-      } 
-
-      for(Int_t iChannel = iCIU*8 + 7; iChannel >= iCIU*8; iChannel--) {
-          buffer->WriteTiming(aTime[iChannel], aWidth[iChannel]); 
-      } // End of decoding of one CIU card    
-  } // end of decoding the eight CIUs
-
-     
-  delete buffer;
-  fLoader->UnloadDigits();  
-
+       // produces raw data from digits
+       // for AD not implemented yet (needs detailed hardware info)
 }
 
 //_____________________________________________________________________________
-Bool_t AliAD::Raw2SDigits(AliRawReader* /*rawReader*/)
+
+Bool_t AliAD::Raw2SDigits(AliRawReader* rawReader)
 {
        // reads raw data to produce digits
        // for AD not implemented yet (needs detailed hardware info)
index f13aa84a831abe18940d502c7c65a7040eba797a..9c97fd6b81faf447d538b1a57dee2da7e6634fce 100644 (file)
@@ -30,21 +30,19 @@ public:
   AliDigitizer*  CreateDigitizer(AliDigitizationInput* digInput) const;
   virtual AliTriggerDetector* CreateTriggerDetector() const { return new AliADTrigger();}
   
-  virtual    void      Hits2Digits();
-  virtual    void      Hits2SDigits();
-  virtual    void      Digits2Raw();
+  virtual      void     Digits2Raw();
   virtual    Bool_t     Raw2SDigits(AliRawReader*);
-  virtual    void      SetADAToInstalled(Bool_t b){fSetADAToInstalled = b;}
-  virtual    void      SetADCToInstalled(Bool_t b){fSetADCToInstalled = b;}
-  virtual    Bool_t    GetADAToInstalled() const {return fSetADAToInstalled;}
-  virtual    Bool_t    GetADCToInstalled() const {return fSetADCToInstalled;}
+  virtual    void      SetADATwoInstalled(Bool_t b){fSetADATwoInstalled = b;} // ecv
+  virtual    void      SetADCTwoInstalled(Bool_t b){fSetADCTwoInstalled = b;} // ecv
+  virtual    Bool_t    GetADATwoInstalled() const {return fSetADATwoInstalled;}  // ecv
+  virtual    Bool_t    GetADCTwoInstalled() const {return fSetADCTwoInstalled;}  // ecv
 
 
 private:
                        AliAD(const AliAD&); 
                        AliAD& operator = (const AliAD&); 
-  Bool_t       fSetADAToInstalled; 
-  Bool_t       fSetADCToInstalled; 
+  Bool_t       fSetADATwoInstalled; 
+  Bool_t       fSetADCTwoInstalled; 
 
 
   ClassDef(AliAD,1)  // Base Class for the AD detector
index d91dc72db85ee7a3ac0d20ef298cdb02b426d93a..5541e7fc3cf86e15c5da08614a3d8da9748ee88f 100644 (file)
 #include <TGeoManager.h>
 #include <TGeoMatrix.h>
 #include <TGeoTube.h>
+#include <TGeoPcon.h>
 #include <TGeoCone.h>
 #include <TGeoShape.h>
 #include <TTree.h>
 #include <TSystem.h>
-#include <TGeoCompositeShape.h>
+// #include <TGeoCompositeShape.h> // included in .h
 #include <TGeoGlobalMagField.h>
 #include <TGeoMaterial.h>
 #include <TGeoMedium.h>
 
 ClassImp(AliADv1)
 //__________________________________________________________________
-AliADv1::AliADv1()
-  : AliAD(),
+AliADv1::AliADv1() : 
+  AliAD(),
+  fADCstruct(kTRUE),
+  fADCPosition(kADCInTunnel),
   fADCLightYield(93.75),
   fADCPhotoCathodeEfficiency(0.18),
   fADALightYield(93.75),
   fADAPhotoCathodeEfficiency(0.18)
-
 {
    // Default Constructor
     fHits = 0;
@@ -83,6 +85,8 @@ AliADv1::AliADv1()
 //_____________________________________________________________________________
 AliADv1::AliADv1(const char *name, const char *title) : 
   AliAD(name,title),  
+  fADCstruct(kTRUE),
+  fADCPosition(kADCInTunnel),
   fADCLightYield(93.75),
   fADCPhotoCathodeEfficiency(0.18),
   fADALightYield(93.75),
@@ -126,252 +130,845 @@ void AliADv1::CreateGeometry()
   //
   // Create the geometry for the AD arrays
   //
-  
   CreateAD();
   
 }
+//_____________________________________________________________________________
+void AliADv1::ReadADCFromEnv() {
+  if (! gSystem->Getenv("CONFIG_ADC_POS"))
+    return;
 
+  TString str(gSystem->Getenv("CONFIG_ADC_POS"));
+
+  if (0==str.CompareTo ("kADCInTunnel")) {
+    fADCPosition = kADCInTunnel;
+    printf("fADCPosition set to kADCInTunnel\n");
+    //
+  } else if (0==str.CompareTo ("kADCInCavern")) {
+    fADCPosition = kADCInCavern;
+    printf("fADCPosition set to kADCInCavern\n");
+    //
+  } else if (0==str.CompareTo ("kADCInBoth")) {
+    fADCPosition = kADCInBoth;
+    printf("fADCPosition set to kADCInBoth\n");
+  }
+}
+//_____________________________________________________________________________
+TGeoCompositeShape * AliADv1::MakeShapeADCpadH(const Double_t W, const Double_t H, const Double_t dz) {
+  /////////////////////////////////////////////////////////////////////////////
+  ///                ADC pad in the cavern (H shapped hole)                 ///
+  /////////////////////////////////////////////////////////////////////////////
+  // const Double_t W = kADCCellSide; // Width  of Scintillator pad
+  // const Double_t H = kADCCellSide; // Height of Scintillator pad
+  // Coordinates of ADC pad vertexes
+  Double_t pad0_x [] = { 10., 10.,   W,  W  };
+  Double_t pad0_y [] = {  0., 11., 11.,  0. };
+  Double_t pad1_x [] = { 15., 15.,   W,  W  };
+  Double_t pad1_y [] = { 11., 15., 15., 11. };
+  Double_t pad2_x [] = {  0.,  0.,   W,  W  };
+  Double_t pad2_y [] = { 15.,  H ,   H, 15. };
+  TGeoArb8 * shADCpad0H = new TGeoArb8("shADCpad0H", dz/2.);
+  TGeoArb8 * shADCpad1H = new TGeoArb8("shADCpad1H", dz/2.);
+  TGeoArb8 * shADCpad2H = new TGeoArb8("shADCpad2H", dz/2.);
+  for (Int_t i=0; i<4; i++) {
+    // -dz
+    shADCpad0H -> SetVertex(i,   pad0_x[i], pad0_y[i]);
+    shADCpad1H -> SetVertex(i,   pad1_x[i], pad1_y[i]);
+    shADCpad2H -> SetVertex(i,   pad2_x[i], pad2_y[i]);
+    // +dz
+    shADCpad0H -> SetVertex(i+4, pad0_x[i], pad0_y[i]);
+    shADCpad1H -> SetVertex(i+4, pad1_x[i], pad1_y[i]);
+    shADCpad2H -> SetVertex(i+4, pad2_x[i], pad2_y[i]);
+  }
+  return new TGeoCompositeShape("shADCpadH","shADCpad0H + shADCpad1H + shADCpad2H");
+}
 
 //_____________________________________________________________________________
 void AliADv1::CreateAD()
 {
+  //
+  // Read fADCPosition from environment and assign it three possible values:
+  //   fADCPosition = kADCInTunnel;
+  //   fADCPosition = kADCInCavern;
+  //   fADCPosition = kADCInBoth;
+  //
+  // ReadADCFromEnv(); 
+  //
+  // Define Rotations used
+  //
+  TGeoRotation * Rx180, * Rz180, * Ry180, * Rx90, * Rx90m, * Ry90m;
+  Rx90m = new TGeoRotation("Rx90m",   0., -90.,   0.) ;
+  Rx90  = new TGeoRotation("Rx90" ,   0.,  90.,   0.) ;
+  Rx180 = new TGeoRotation("Rx180",   0., 180.,   0.) ;  //   4    |   1
+  Rz180 = new TGeoRotation("Rz180", 180.,   0.,   0.) ;  // --------------->  x  
+  Ry180 = new TGeoRotation("Ry180", 180., 180.,   0.) ;  //   3    |   2
+  Ry90m = new TGeoRotation("Ry90m",  90., -90., -90.) ;
+
+  TGeoMedium * kMedAlu       = gGeoManager->GetMedium("AD_Alum");   // Aluminium 
+  TGeoMedium * kMedSteelSh   = gGeoManager->GetMedium("AD_ST_C0");  // Stainless Steel 
+  TGeoMedium * kMedVacuum    = gGeoManager->GetMedium("AD_VA_C0");  // Stainless Steel 
+  //
+  // Private comunication by Arturo Tauro (2014, Apr 23)
+  // According to last survey measurement done this morning, 
+  // the C-side wall is at Z = - 18959mm.
+  //
+  const Double_t kZwall        = 1895.9 ;  // Aluminium plate z position 
+  const Double_t kZendAbs      = 1880.75;  // End of CC block absorber
+  const Double_t kZbegVMAOI    = 1919.2 ;  // Begining of Warm Module
+  const Double_t kZbegValve    = 1910.7 ;  // Begining of Valve
+  const Double_t kZbegFrontBar = 1949.1 ;  // Begining of Front Bar
+  const Double_t kZbegCoil     = 1959.4 ;  // Begining of compensator coil
 
-       // here we create AD: ADA & ADC
+  // Define Ion Pump ??
+  // Drawing LHCVBU__0052
+  // Vacuum - Bellows - U type
+  // BODY 1 PORTS
+  //
+  (new TGeoCombiTrans("ctPumpVB2", 0., -13./2., 6.8-11.5/2., Rx90))->RegisterYourself();
+  // Rx90->RegisterYourself();
+  new TGeoTube("shIonPumpVB1o",  0.0, 10.3 /2., 11.5/2.   );
+  new TGeoTube("shIonPumpVB2o",  0.0,  7.0 /2., 13.0/2.   );
+  new TGeoTube("shIonPumpVB1i",  0.0, 10.0 /2., 11.5/2.+2.);
+  new TGeoTube("shIonPumpVB2i",  0.0,  6.7 /2., 13.0/2.+2.);
+  new TGeoCompositeShape("shIonPumpVBo", "shIonPumpVB1o+shIonPumpVB2o:ctPumpVB2");
+  //
+  // Continue definition of LHCVBU__0052
+  //
+  new TGeoCompositeShape("shIonPumpVBi", "shIonPumpVB1i+shIonPumpVB2i:ctPumpVB2");
+  TGeoShape * sh3 = new TGeoCompositeShape("shIonPumpVB",  "shIonPumpVBo-shIonPumpVBi");
+  TGeoVolume * voIonPumpVB = new TGeoVolume("voIonPumpVB", sh3, kMedAlu);
+  // Variables 
+  Double_t alpha, beta, tga2, tga, sa, ca, ctgb, d, Ro, Ri, phi1, dphi, H, L, z;
+  // Drawing: LHCVSR__0054
+  // Vacuum Screen - RF
+  // transition flange
+  alpha = 15. * TMath::DegToRad();
+  beta  = 15. * TMath::DegToRad();
+  tga2  = TMath::Tan(alpha*0.5);
+  tga   = TMath::Tan(alpha);
+  ctgb  = 1./TMath::Tan(beta );
+  ca    = TMath::Cos(alpha    );
+  d     = 0.3; // thickness of transition flange
+  Double_t h = d/ca; // vertical distance between parallel surfaces tilted alpha degrees
+  TGeoPcon * shVSRflange = new TGeoPcon("shVSRflange", 0.0, 360.0, 7);
+  Ri = 9.71/2.; Ro = 11.16/2.;
+  shVSRflange->DefineSection(0,         0.  ,   Ri, Ro);
+  Ri = Ri - 0.25 * tga;
+  shVSRflange->DefineSection(1,         0.25,   Ri, Ro);
+  Ro = Ri + d*tga;
+  shVSRflange->DefineSection(2,         0.25,   Ri, Ro);
+  Ri = 6.3/2.; Ro = Ri + h;
+  z = (9.71/2. - Ri) / tga;
+  shVSRflange->DefineSection(3,            z,   Ri, Ro);
+  // 
+  Double_t   Dtga = 6.6*tga - 0.5*(9.71-6.3)    ;
+  Double_t x = (h - 0.11 - Dtga) / (ctgb - tga) ;
+  Double_t y = x * ctgb;
+  z  = 6.6 - x;
+  Ro = Ri + 0.11 + y;
+  shVSRflange->DefineSection(4,            z,   Ri, Ro);
+  z  = 6.6; 
+  Ro = Ri + 0.11;
+  shVSRflange->DefineSection(5,            z,   Ri, Ro);
+  z  = 7.1; 
+  shVSRflange->DefineSection(6,            z,   Ri, Ro);
+  TGeoVolume * voVSRflange = new TGeoVolume("voVSRflange", shVSRflange, kMedAlu);
+  //
+  // Drawing: LHCVSR__0053
+  // Vacuum Screen - RF
+  // transition tube
+  alpha = 10. * TMath::DegToRad();
+  tga2  = TMath::Tan(alpha*0.5);
+  tga   = TMath::Tan(alpha);
+  ca    = TMath::Cos(alpha    );
+  d     = 0.3; // thickness of Vacuum Screen RF
+  Ro    = 6.7/2.; //
+  Ri    = 0.;
+  phi1  = 90. - 15.;
+  dphi  = 30.;
+  TGeoPcon * shVSR0 = new TGeoPcon("shVSR0", phi1, dphi, 6);
+  shVSR0->DefineSection(0,         0.  ,   Ro-0.09, Ro);
+  shVSR0->DefineSection(1,         0.45,   Ro-0.09, Ro);
+  Ri=Ro-d;
+  shVSR0->DefineSection(2,         0.45,      Ri, Ro);
+  shVSR0->DefineSection(3, 13.37-d*tga2,      Ri, Ro);
+  Ro  = Ri + d/ca;
+  shVSR0->DefineSection(4,        13.37,      Ri, Ro);
+  Ri += 0.63*tga;
+  Ro  = Ri + d/ca;
+  shVSR0->DefineSection(5,        14.0 ,      Ri, Ro);
+  printf("  Ro: %8.2f\n", Ro);
+  // Make holes 
+  new TGeoBBox("shHoleBody"    , 0.15, 0.60, 0.3);
+  new TGeoTube("shHoleEnd", 0.  , 0.15, 0.3);
+  (new TGeoTranslation("trHoleBody", 0., -0.6, 0.))->RegisterYourself();
+  (new TGeoTranslation("trHoleEnd" , 0., -1.2, 0.))->RegisterYourself();
+  new TGeoCompositeShape("shHole","shHoleEnd + shHoleEnd:trHoleEnd + shHoleBody:trHoleBody");
+  // Single hole made. Now define some combitrans to position holes
+  z = 1.3; Ro = (6.7 - d)*0.5;
+  (new TGeoCombiTrans("ctHole1", 0., Ro , z, Rx90m))->RegisterYourself();
+  z = 1.3 + 1*2.5;
+  (new TGeoCombiTrans("ctHole2", 0., Ro , z, Rx90m))->RegisterYourself();
+  z = 1.3 + 2*2.5;
+  (new TGeoCombiTrans("ctHole3", 0., Ro , z, Rx90m))->RegisterYourself();
+  z = 1.3 + 3*2.5;
+  (new TGeoCombiTrans("ctHole4", 0., Ro , z, Rx90m))->RegisterYourself();
+  // Now make a sector of RF transition tube
+  new TGeoCompositeShape("shVSRsec",
+   "shVSR0 - (shHole:ctHole1 + shHole:ctHole2 + shHole:ctHole3 + shHole:ctHole4)");
+  // Now define rotations for each sector
+  TString strSh = "shVSRsec ";
+  for (Int_t i=1; i<=11; i++) {
+   (new TGeoRotation(Form("rSec%d",i), 30. * i, 0. , 0.))->RegisterYourself();
+   strSh+=Form("+ shVSRsec:rSec%d",i);
+  }
+  printf("%s\n", strSh.Data());
+  TGeoCompositeShape * shVSR = new TGeoCompositeShape("shVSR", strSh.Data());
+  // Now assembly the sector to form VSR RF transition tube !
+  TGeoVolume * voVSR = new TGeoVolume("voVSR", shVSR, kMedAlu);
+  // 
+  // Drawing: LHCVSR__0057
+  // RF CONTACT
+  // 
+  Ro = 0.5 * 6.3;
+  d  = 0.03;
+  Ri = Ro - d;
+  // alpha = TMath::ArcSin((7.35-1.75)/Ri);  <-- No!
+  H = 0.5 * 6.9 - Ri;
+  L = 28. - 7.1 + 0.45 -14. - 1.75;//7.35 - 1.75;
+  // Double_t Delta = TMath::Sqrt( L*L + 4.*(H-d)*H );
+  Double_t R = TMath::Sqrt((H-d)*(H-d) + L*L);
+  alpha = TMath::ASin(d/R) + TMath::ASin((H-d)/R);
+  printf("alpha: %8.2f \n", alpha * TMath::RadToDeg());
+  sa = TMath::Sin(alpha);
+  ca = TMath::Cos(alpha);
+  x = d*sa;
+  y = d*ca;
+  Double_t R0 =  1.75;
+  Double_t R1 = 10.48;
+  Double_t R2 =  0.81 + 0.28;
+  phi1 = 0.; dphi = 360.; 
 
-       // Get ALICE volume
+  TGeoPcon * shVSRcontact = new TGeoPcon("shVSRcont", phi1, dphi, 6);
+  z = 0.;
+  shVSRcontact->DefineSection(0, -z, Ri, Ro);
+  z = R0;
+  shVSRcontact->DefineSection(1, -z, Ri, Ro);
+  z  += x;
+  Ri += y;
+  Ro  = Ri + d;
+  shVSRcontact->DefineSection(2, -z, Ri, Ro);
+  z  += (R1 - R0) * ca;
+  Ri += (R1 - R0) * sa;
+  Ro  = Ri + d;
+  shVSRcontact->DefineSection(3, -z, Ri, Ro);
+  // Last sections (R2)
+  Double_t ab = alpha + 21. * TMath::DegToRad();
+  Double_t sab = TMath::Sin(ab);
+  Double_t cab = TMath::Cos(ab);
+  x   = d * sab;
+  y   = d/ca - d*cab;
+  z  += x;
+  Ri += y;
+  Ro  = Ri + d/cab;
+  shVSRcontact->DefineSection(4, -z, Ri, Ro);
+  z  += R2 * cab;
+  Ri += R2 * sab;
+  Ro  = Ri + d/cab;
+  shVSRcontact->DefineSection(5, -z, Ri, Ro);
+  TGeoVolume * voVSRcontD = new TGeoVolume("voVSRcontD", shVSRcontact, kMedAlu);
+  // Drawing: LHCVSR__0017
+  // Vacuum Screen - RF
+  // RF Contact flange
+  phi1 = 0.;
+  dphi = 360.;
 
-       TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
+  TGeoPcon * shVSRcontFlange = new TGeoPcon("shVSRcontFlange", phi1, dphi, 11);
+  Ri = 6.30 /2.; Ro = 11.16 /2.; z = 0;
+  shVSRcontFlange->DefineSection( 0, -z, Ri, Ro);
+  Ri = 6.30 /2.; Ro = 11.16 /2.; z = 0.1;
+  shVSRcontFlange->DefineSection( 1, -z, Ri, Ro);
+  Ri = 6.36 /2.; Ro = 11.16 /2.; z = 0.1;
+  shVSRcontFlange->DefineSection( 2, -z, Ri, Ro);
+  Ri = 6.36 /2.; Ro = 11.16 /2.; z = 0.25;
+  shVSRcontFlange->DefineSection( 3, -z, Ri, Ro);
+  Ri = 6.36 /2.; Ro =  9.30 /2.; z = 0.25;
+  shVSRcontFlange->DefineSection( 4, -z, Ri, Ro);
+  Ri = 6.36 /2.; Ro =  9.30 /2.; z = 0.30;
+  shVSRcontFlange->DefineSection( 5, -z, Ri, Ro);
+  Ri = 6.36 /2.; Ro =  6.90 /2.; z = 0.30;
+  shVSRcontFlange->DefineSection( 6, -z, Ri, Ro);
+  Ri = 6.36 /2.; Ro =  6.90 /2.; z = 1.10;
+  shVSRcontFlange->DefineSection( 7, -z, Ri, Ro);
+  Ri = 6.36 /2.; Ro =  6.85 /2.; z = 1.15;
+  shVSRcontFlange->DefineSection( 8, -z, Ri, Ro);
+  Ri = 6.36 /2.; Ro =  6.50 /2.; z = 1.15;
+  shVSRcontFlange->DefineSection( 9, -z, Ri, Ro);
+  Ri = 6.36 /2.; Ro =  6.50 /2.; z = 1.30;
+  shVSRcontFlange->DefineSection(10, -z, Ri, Ro);
+  TGeoVolume * voVSRcontF = new TGeoVolume("voVSRcontF", shVSRcontFlange, kMedAlu);
+  // Drawing: LHCVBU__0002
+  // Bellows + End Parts
+  // Vacuum - Bellows - U type
 
-       // Define the mother volume for AD
+  // First make end part
+  phi1 = 0. ; dphi = 360. ;
+  TGeoPcon * shVBUend = new TGeoPcon("shVBUend", phi1, dphi, 6);
+  Ri = 5.176; Ro = 5.4; z = 0;
+  shVBUend->DefineSection( 0, z, Ri, Ro);
+  Double_t dz  = 0.03;
+  Ri -= dz * TMath::Tan(45. * TMath::DegToRad());
+  z  += dz;
+  shVBUend->DefineSection( 1, z, Ri, Ro);
+  dz  = 0.04;
+  Ro -= dz * TMath::Tan(15. * TMath::DegToRad());
+  Ri -= dz * TMath::Tan(45. * TMath::DegToRad());
+  z  += dz;
+  shVBUend->DefineSection( 2, z, Ri, Ro);
+  Ro  = 5.250 ;
+  Ri  = 5.073;
+  z   = 0.103;
+  shVBUend->DefineSection( 3, z, Ri, Ro);
+  Ro  = 5.25;
+  Ri  = 5.02;
+  z   = 0.18;
+  shVBUend->DefineSection( 4, z, Ri, Ro);
+  Ro  = 5.15;
+  Ri  = 5.00;
+  z   = 0.28;
+  shVBUend->DefineSection( 5, z, Ri, Ro);
 
-       TGeoVolume *ad = new TGeoVolumeAssembly("AD");
+  TGeoPcon * shVBUtube26mm = new TGeoPcon("shVBUtube26mm", 0., 360., 2);
+  shVBUtube26mm->DefineSection( 0, 0.28, 5.0, 5.15);
+  shVBUtube26mm->DefineSection( 1, 2.60, 5.0, 5.15);
+  TGeoPcon * shVBUtube9mm  = new TGeoPcon("shVBUtube9mm" , 0., 360., 2);
+  shVBUtube9mm ->DefineSection( 0, 0.00, 5.0, 5.15);
+  shVBUtube9mm ->DefineSection( 1, 0.62, 5.0, 5.15);
+  // central part of bellow (TODO: Add plies)
+  TGeoPcon * shVBUcent  = new TGeoPcon("shVBUcent" , 0., 360., 6);
+  const Int_t nsec = 6;
+  Double_t az [nsec] = {0.9, 0.915, 0.915, 11.885, 11.885, 11.9};
+  Double_t aRi[nsec] = {5.0, 5.0  , 5.685,  5.685,  5.0  ,  5.0};
+  for (Int_t i=0; i<nsec; i++) {
+   z=az[i]; Ri = aRi[i]; Ro = 5.7;
+   printf("  i: %2d  z: %8.2f  Ri: %8.2f  Ro: %8.2f\n", i, z, Ri, Ro );
+   shVBUcent ->DefineSection( i, z, Ri, Ro);
+  }
 
-       // Get medium
+  ( new TGeoCombiTrans("ctEnd9mm", 0., 0., 0.9, Ry180)) -> RegisterYourself();
 
-       TGeoMedium *medADASci           = gGeoManager->GetMedium("AD_NE102"); // AD Scin. 
-       TGeoMedium *medADALG            = gGeoManager->GetMedium("AD_PMMA");  // lightGuide
-       TGeoMedium *medADAPMGlass       = gGeoManager->GetMedium("AD_Glass"); // Glass for Aluminium simulation
-       TGeoMedium *medADAPMAlum        = gGeoManager->GetMedium("AD_Alum");  // Aluminium 
+  TGeoCompositeShape * shVBU9mm  = new TGeoCompositeShape("shVBU9mm" , "shVBUend:ctEnd9mm + shVBUtube9mm");
+  TGeoCompositeShape * shVBU26mm = new TGeoCompositeShape("shVBU26mm", "shVBUend + shVBUtube26mm");
 
+  const Int_t nsec2 = 10;
+  Double_t az2 [nsec2] = {0.  , 0.43, 0.43, 0.58, 0.58 , 0.73 , 0.73, 1.05, 1.05, 1.31} ;
+  Double_t aRi2[nsec2] = {5.15, 5.15, 5.03, 5.03, 5.455, 5.455, 5.03, 5.03, 5.59, 5.59} ;
+  TGeoPcon * shVBUrotFlg  = new TGeoPcon("shVBUrotFlg" , 0., 360., nsec2);
+  for (Int_t i=0; i<nsec2; i++) {
+   z=az2[i]; Ri = aRi2[i]; Ro = 6.02;
+   printf("  i: %2d  z: %8.2f  Ri: %8.2f  Ro: %8.2f\n", i, z, Ri, Ro );
+   shVBUrotFlg ->DefineSection( i, z, Ri, Ro);
+  }
+  TGeoVolume * voVBUrotFlg = new TGeoVolume("voVBUrotFlg", shVBUrotFlg, kMedAlu);
 
-       ///  ADA Scintillator Pad Measures
-       const Double_t kADATriangleSide   = 7.8;   //
-       const Double_t kADACellSide       = 20.0;
-       const Double_t kADACellThickness  = 2.0;  // Half thickness
-       const int kColorADA = kGreen;
+  // Flange 
+  TGeoPcon * shVBUflg  = new TGeoPcon("shVBUflg" , 0., 360., 4);
+  z  = 0; 
+  Ri = 6.02; Ro = 7.6; 
+  shVBUflg->DefineSection(0, z, Ri, Ro);
+  z  = 1.31; 
+  shVBUflg->DefineSection(1, z, Ri, Ro);
+  z  = 1.31; 
+  Ri = 5.15; 
+  shVBUflg->DefineSection(2, z, Ri, Ro);
+  z  = 2.0;
+  shVBUflg->DefineSection(3, z, Ri, Ro);
+  TGeoVolume * voVBUflg = new TGeoVolume("voVBUflg", shVBUflg, kMedAlu);
 
-       // Creation of the Box's pad
-
-       new TGeoBBox( "ADAbox", kADACellSide/2.0-kADATriangleSide/2., kADACellSide/2.0, kADACellThickness );
-       const Double_t boxSide2 = kADACellSide/2.0-kADATriangleSide/2.;
-       new TGeoBBox( "ADAbox1", kADATriangleSide/2., boxSide2, kADACellThickness );
-       
-       // translation
-
-       TGeoTranslation *trada2 = new TGeoTranslation( -kADACellSide/2.0,  kADACellSide/2.0 - boxSide2, 0. );
-       trada2->SetName( "trada2" );
-       trada2->RegisterYourself();
-
-       TGeoArb8* sADAtriang = new TGeoArb8( "ADAtriang", kADACellThickness );
-       for ( int iz = 0; iz < 2; iz++ ) {
-               sADAtriang->SetVertex( 0+iz*4, kADACellSide/2.0, kADACellSide/2.0 );
-               sADAtriang->SetVertex( 1+iz*4, kADACellSide/2.0, (kADACellSide/2.0)-kADATriangleSide );
-               sADAtriang->SetVertex( 2+iz*4, kADACellSide/2.0, (kADACellSide/2.0)-kADATriangleSide );
-               sADAtriang->SetVertex( 3+iz*4, kADACellSide/2.0-kADATriangleSide, kADACellSide/2.0 );
-       }    
-       TGeoTranslation *trada1 = new TGeoTranslation( -kADACellSide+kADATriangleSide/2. , -kADACellSide+kADATriangleSide, 0. );
-       trada1->SetName( "trada1" );
-       trada1->RegisterYourself();
-
-       TGeoCompositeShape *sADA1 = new TGeoCompositeShape ( "sADA1s1", "ADAbox+(ADAbox1:trada2)+(ADAtriang:trada1)" );
-       TGeoVolume *vADA1 = new TGeoVolume( "ADApad", sADA1, medADASci );
-       vADA1->SetLineColor( kColorADA ); 
-
-       /// Light guide
-       Double_t kADALGThickness   = 2.0; // Half thickness
-       Double_t kADALGSideScint   = 20.0;
-       Double_t kADALGHeigth      = TMath::Sqrt( kADALGSideScint*kADALGSideScint - (10.5 * 10.5) );
-       Double_t kADALGSideCoupling = 3.0; 
-       const int kColorADALG = kYellow;
-         // Triangle
-       TGeoTrd2* sADALGtriang = new TGeoTrd2( kADALGThickness, kADALGThickness, kADALGSideScint/2., kADALGSideCoupling/2., kADALGHeigth/2.0);
-       TGeoVolume *vADALGtriang = new TGeoVolume( "ADALG", sADALGtriang, medADALG );
-       vADALGtriang->SetLineColor( kColorADALG ); 
-
-       // Coupling
-       Double_t kADALGCoupling = 5.0; 
-       TGeoTube* sADACouplTube = new TGeoTube( "ADACouplTube", 0, 1.4, kADALGCoupling/2. );
-       TGeoVolume * vADACoupling = new TGeoVolume( "ADACoupling", sADACouplTube, medADALG );
-       vADACoupling->SetLineColor( kColorADALG ); 
    
-       TGeoVolume * vADALG1  = new TGeoVolumeAssembly( "ADALG" );
-       vADALG1->AddNode( vADALGtriang, 1 );   
-       vADALG1->AddNode( vADACoupling, 1, new TGeoTranslation(0., 0., kADALGHeigth/2.+kADALGCoupling/2.) );   
-       vADALG1->SetLineColor( kColorADALG ); 
-      
-       /// PMT  Hamamatsu R5946
-       Double_t kADAPMR1 = 1.95;          // 3.9 cm diameter
-       Double_t kADAPMR2 = 2.15;          // + 2 mm?? aluminium case 
-       Double_t kADAPMlength = 6.4;      // 5 cm PMT + 1.4 socket 
-       const int kColorPMG   = kWhite;
-       const int kColorPMA   = kGray;
-       TGeoTube *sADAPMg1   = new TGeoTube( "sADAPMg", 0., kADAPMR1, kADAPMlength/2. );
-       TGeoVolume *vADAPMg1 = new TGeoVolume( "ADAPMg", sADAPMg1, medADAPMGlass );
-       vADAPMg1->SetLineColor( kColorPMG );
-       TGeoTube *sADAPMa1   = new TGeoTube( "ADAPMa", kADAPMR1, kADAPMR2, kADAPMlength/2. );
-       TGeoVolume *vADAPMa1 = new TGeoVolume( "ADAPMa", sADAPMa1, medADAPMAlum );
-       vADAPMa1->SetLineColor( kColorPMA );
-       TGeoVolume *vADAPM1  = new TGeoVolumeAssembly("ADAPM");
-       vADAPM1->AddNode( vADAPMg1, 1 );
-       vADAPM1->AddNode( vADAPMa1, 1 );
-       /// Sector (Assembly:  Scintillator Pad + Light guide + PM )
-       TGeoVolume *secADA  = new TGeoVolumeAssembly( "ADAsec" ); 
-       // Add PAD
-       secADA->AddNode( vADA1, 1, new TGeoTranslation( kADACellSide/2.0+kADATriangleSide/2. + 0.05, kADACellSide/2.0 + 0.05, 0. ) );
-       // Add Light Guide
-       TGeoCombiTrans *transrot = new TGeoCombiTrans( kADACellSide + kADALGHeigth/2.0 + 0.05, kADALGSideScint/2.0 + 0.05, 0., 
-                                                  new TGeoRotation("rot",90.,90.,90.) );
-       secADA->AddNode( vADALG1, 1, transrot );   
-       // Add PM
-       transrot = new TGeoCombiTrans( kADACellSide + kADALGHeigth  + kADALGCoupling + kADAPMlength/2. + 0.05, kADACellSide/2.0 + 0.05, 0, 
-                                  new TGeoRotation("rot",90.,90.,0.) );
-       secADA->AddNode(vADAPM1, 1, transrot);
-
-       // TODO: Add mechanical support
-   
-       /// Assembling ADA adding 4 sectors                                       //  Sectors
-       TGeoVolume *vADAarray = new TGeoVolumeAssembly( "ADA" );                  //        ^ y
-       vADAarray->AddNode( secADA, 1 );                                          //        |   
-       vADAarray->AddNode( secADA, 2, new TGeoRotation("rot",0.  , 180.,0.) );   //   4    |   1
-       vADAarray->AddNode( secADA, 3, new TGeoRotation("rot",180., 0.,  0.) );   // --------------->  x     
-       vADAarray->AddNode( secADA, 4, new TGeoRotation("rot",180., 180.,0.) );   //   3    |   2
-        TGeoRotation *rotADA90 = new TGeoRotation("adarot",90,0,0);
-       // here I add ADA to AD volume
-       const Float_t kPosADA = 1700.0;
-       ad->AddNode(vADAarray,1, new TGeoCombiTrans("ada",0,0,kPosADA,rotADA90));                                                                     //        |
-       if (GetADAToInstalled())
-       {
-               const Float_t kPosADA2 = 1695.0;
-               ad->AddNode(vADAarray,2, new TGeoCombiTrans("ada",0,0,kPosADA2,rotADA90));
-       }
+  // Add the metal plate at the end of Absorber
+  // Plate:  80 cm x 80 cm x 1.95 cm (Thickness is aproximatted) (ernesto.calvo@pucp.edu.pe)
+  // The End of the concrete abosorber is at kZendAbs = 1880.75
 
-       // Creation of ADC
+  new TGeoBBox("shBasePlate", 80./2., 80./2.,  1.95/2.);
+  new TGeoTube("shHolePlate",  0.   , 12.3  ,  1.95   );
+  TGeoVolume* voSaa3EndPlate  =  new TGeoVolume("voYSaa3EndPlate",
+      new TGeoCompositeShape("shYSaa3EndPlate","shBasePlate-shHolePlate"),
+      kMedSteelSh);
+  //
+  // Add Rods
+  //
+  // dimensions of rods
+  const Double_t dzRodL = 27.0;
+  const Double_t dzRodA =  4.3;
+  const Double_t dzRodB =  1.3;
+  new TGeoTube("shLargeRod", 0.,   1.6/2.,  dzRodL/2.);
+  new TGeoTube("shRodA",     0.,   3.0/2.,  dzRodA/2.);
+  new TGeoTube("shRodB",     0.,   2.3/2.,  dzRodB/2.);
+  //
+  ( new TGeoTranslation("trRod1", 0., 0., -dzRodL/2. + dzRodA/2.)          )->RegisterYourself();
+  ( new TGeoTranslation("trRod2", 0., 0., -dzRodL/2. + dzRodA + dzRodB/2.) )->RegisterYourself();
+  ( new TGeoTranslation("trRod3", 0., 0.,  dzRodL/2. - dzRodB/2.)          )->RegisterYourself();
+  TGeoVolume * voSaa3Rod = new TGeoVolume("YSAA3Rod",
+      new TGeoCompositeShape("shLargeRod+shRodA:trRod1 + shRodB:trRod2 + shRodB:trRod3"),
+      kMedSteelSh);
+  //
+  // Define Valve support (VS)  (ernesto.calvo@pucp.edu.pe) 
+  //
+  const Double_t dyVS =  5.5; 
+  const Double_t dxVS = 30.0; 
+  const Double_t dzVS =  1.0;
+  TGeoVolume * voVS = new TGeoVolume("voVS",
+      new TGeoBBox("shVS", dxVS/2., dyVS/2., dzVS/2.),
+      kMedSteelSh);
 
-       // Get Medium for ADC (in principle is the same as ADA, but I keep the previous variables)
+  // Add Valve (Valve is divided in parts VA,VB,VC and VD)  (ernesto.calvo@pucp.edu.pe) 
+  TGeoVolumeAssembly * voValve = new TGeoVolumeAssembly("voValve");
+  //
+  // Define volume VA  (ernesto.calvo@pucp.edu.pe) 
+  const Double_t dxVA  = 20.3; 
+  const Double_t dyVA  = 48.0; 
+  const Double_t dzVA  =  6.0; // Width 
+  const Double_t dz2VA =  8.5; // Full width including protuding boxes
+  // Valve position  (ernesto.calvo@pucp.edu.pe) 
+  const Double_t zPosValve =  kZbegValve + dz2VA/2.;
+  //
+  new TGeoBBox("shVAbox",       dxVA/2., dyVA/2.,     dzVA/2.);
+  new TGeoBBox("shVAHbox",  -1.+dxVA/2.,   3./2.,    dz2VA/2.);
+  new TGeoTube("shVAC",              0.,     7.9,    dz2VA/2.);
+  new TGeoTube("shVACh",             0.,     5.3,    dz2VA   );
+  // translation for shVAHbox (ernesto.calvo@pucp.edu.pe) 
+  ( new TGeoTranslation("trVAH1", 0.,  12.75, 0.) )->RegisterYourself();
+  ( new TGeoTranslation("trVAH2", 0., -12.75, 0.) )->RegisterYourself();
 
-       TGeoMedium *medADCSci     = gGeoManager->GetMedium("AD_NE102");
-       TGeoMedium *medADCLG      = gGeoManager->GetMedium("AD_PMMA");
-       TGeoMedium *medADCPMGlass = gGeoManager->GetMedium("AD_Glass");
-       TGeoMedium *medADCPMAlum  = gGeoManager->GetMedium("AD_Alum");
-       /// Creation of assembly of one ADC sector
+  TGeoVolume * voValveVA = new TGeoVolume("voValveVA",
+      new TGeoCompositeShape("(shVAbox + shVAHbox:trVAH1 + shVAHbox:trVAH2 + shVAC)-shVACh"),
+      kMedSteelSh);
+  voValve->AddNode(voValveVA, 1, 0);
+  // Define Vacuum Hole of Valve
+  TGeoTube   * shVACvach   = new TGeoTube("shVACvach", 0., 5.3, dz2VA/2.);
+  TGeoVolume * voValveVAvh = new TGeoVolume("voValveVAvacuum", shVACvach, kMedVacuum);
+  voValve->AddNode(voValveVAvh,1,0);
+  // Also add valve Support (ernesto.calvo@pucp.edu.pe) 
+  voValve->AddNode(voVS, 1, new TGeoTranslation(0.,  12.75, -dz2VA/2.-dzVS/2.));
+  voValve->AddNode(voVS, 2, new TGeoTranslation(0., -12.75, -dz2VA/2.-dzVS/2.));
+
+  // Define Volume VB (ernesto.calvo@pucp.edu.pe) 
+  const Double_t dxVB = 23.5; 
+  const Double_t dyVB =  5.0; 
+  const Double_t dzVB =  9.4; 
+  TGeoVolume * voValveVB = new TGeoVolume("voValveVB", 
+      new TGeoBBox("shVBbox", dxVB/2., dyVB/2., dzVB/2.),
+      kMedSteelSh);
+  voValve->AddNode(voValveVB, 1, new TGeoTranslation(  0., dyVA/2. +dyVB/2. , 0));
+  // Define Volume VC (ernesto.calvo@pucp.edu.pe) 
+  const Double_t R1VC  =  4.5 /2.;
+  const Double_t R2VC  =  8.1 /2.;
+  const Double_t dy1VC  = 10.0;
+  const Double_t dy2VC =  0.75;
+  new TGeoTube("shVC1",      0.,   R1VC, dy1VC/2.);
+  new TGeoTube("shVC2",      0.,   R2VC, dy2VC/2.);
+  ( new TGeoTranslation("trVC21", 0., 0.,  dy1VC/2. - dy2VC/2.) )->RegisterYourself();
+  ( new TGeoTranslation("trVC22", 0., 0., -dy1VC/2. + dy2VC/2.) )->RegisterYourself();
+  TGeoVolume * voValveVC = new TGeoVolume("voValveVC",
+      new TGeoCompositeShape("shVC1  + shVC2:trVC21 + shVC2:trVC22"),
+      kMedSteelSh);
+  voValve->AddNode(voValveVC, 1, new TGeoCombiTrans( 
+        0., dyVA/2. + dyVB + dy1VC/2. , 0, Rx90) );
+  // Define volume VD (ernesto.calvo@pucp.edu.pe) 
+  const Double_t dxVD = 15.9;
+  const Double_t dyVD = 23.0;
+  const Double_t dzVD = 14.0;
+  TGeoVolume * voValveVD = new TGeoVolume("voValveVD",
+      new TGeoBBox("shVD", dxVD/2., dyVD/2., dzVD/2.),
+      kMedSteelSh);
+  voValve->AddNode(voValveVD, 1, 
+      new TGeoTranslation( 1.25, dyVA/2. + dyVB + dy1VC + dyVD/2. , 0) );
+
+  //
+  // Define volume Front Bar (ernesto.calvo@pucp.edu.pe) 
+  //
+  const Double_t dxF  = 67.4; 
+  const Double_t dyF  =  4.0; 
+  const Double_t dzF  =  2.0; 
+  const Double_t R1FC =  8.1;
+  const Double_t R2FC = 11.5;
+  const Double_t dxFA  = (dxF-R1FC)/2.; 
  
-       /// ADC Scintillator Pad 
-       const Double_t kADCCellSide = 30.;
-       const Double_t kADCCellThickness = 4.0;
-       const int kColorADC = kGreen;
-   
-       new TGeoBBox( "ADCbox0", kADCCellSide/4.0, kADCCellSide/2.0, kADCCellThickness/2.0 );
-       new TGeoBBox( "ADCbox1", kADCCellSide/4.0, kADCCellSide/4.0, kADCCellThickness/2.0 );
-       new TGeoBBox( "ADCbox2", 2.5, 5.5, kADCCellThickness/2.0 );
-       TGeoTranslation *tradd1 = new TGeoTranslation( -kADCCellSide/2.0, kADCCellSide/4.0, 0. );
-       TGeoTranslation *tradd2 = new TGeoTranslation( -kADCCellSide/4.0 - 2.5, -kADCCellSide/2.0 + 5.5 , 0. );
-       tradd1->SetName( "tradd1" );
-       tradd2->SetName( "tradd2" );
-       tradd1->RegisterYourself();
-       tradd2->RegisterYourself();
-       TGeoCompositeShape *sADC1 = new TGeoCompositeShape ( "sADCpad", "ADCbox0+(ADCbox1:tradd1)+(ADCbox2:tradd2)" );
-       TGeoVolume *vADC = new TGeoVolume( "ADCpad", sADC1, medADCSci );      
-       vADC->SetLineColor( kColorADC );
-
-       /// Light guide
-       const Double_t kADCLGThickness    = 4.0;
-       const Double_t kADCLGHeigth       = 28.95;        // Dist from scint to coupling
-       const Double_t kADCLGSideScint    = kADCCellSide; // 30.0 
-       const Double_t kADCLGSideCoupling = 4.0; 
-       const int kColorADCLG = kYellow;
+  new TGeoBBox("shFA", dxFA/2., dyF/2., dzF/2.);
+  new TGeoTube("shFC",      0.,   R2FC, dzF/2.);
+  new TGeoTube("shFCH",     0.,   R1FC, 2.*dzF);
+  ( new TGeoTranslation("trFA1",  R1FC +dxFA/2., 0., 0.) )->RegisterYourself();
+  ( new TGeoTranslation("trFA2", -R1FC -dxFA/2., 0., 0.) )->RegisterYourself();
+  TGeoVolume * voFrontBar = new TGeoVolume("voFrontBar",
+      new TGeoCompositeShape("shFA:trFA1 + shFA:trFA2 + (shFC - shFCH)"),
+      kMedSteelSh);
+  // Make Lateral Bars
+  const Double_t kdzLatBar = 22.9;
+  TGeoVolume * voLatBar = new TGeoVolume("voLatBar", 
+    new TGeoTube("shLatBar",0., dyF/2., kdzLatBar/2.), kMedSteelSh);
+  //
+  // Define Compensator Magnet coils
+  //
+  dz = 12.5;
+  Ro = 15.0;
+  Ri = 1.9;
+  new TGeoTubeSeg("shCoilRo", 0., Ro, dz/2., 90., 180.);
+  new TGeoTubeSeg("shCoilRi", 0., Ri, dz   , 90., 185.);
+  (new TGeoTranslation("trCoilRo", Ro, 10.4, 0.)) -> RegisterYourself();
+  (new TGeoTranslation("trCoilRi", Ro,  9.6, 0.)) -> RegisterYourself();
+  new TGeoBBox("shBoxCoilRo", 15.0/2., 10.4/2., dz/2.);
+  new TGeoBBox("shBoxCoilRi",  1.9/2.,  9.6   , dz   );
+  (new TGeoTranslation("trBoxCoilRo",       15.0/2., 10.4/2., 0.)) -> RegisterYourself();
+  (new TGeoTranslation("trBoxCoilRi", 13.1 + 1.9/2.,  0.    , 0.)) -> RegisterYourself();
+  new TGeoBBox("shBoxCoil0", 10./2., 30., dz);
+  (new TGeoTranslation("trBoxCoil0",  14.6 + 10./2.,  0.    , 0.)) -> RegisterYourself();
+  strSh  = "";
+  strSh += "(shCoilRo:trCoilRo + shBoxCoilRo:trBoxCoilRo) - ";
+  strSh += "(shCoilRi:trCoilRi + shBoxCoilRi:trBoxCoilRi +"  ;
+  strSh += " shBoxCoil0:trBoxCoil0 )"  ;
+  TGeoCompositeShape * shCoil = new TGeoCompositeShape("shCoil0", strSh);
+  TGeoVolume * voCoil = new TGeoVolume("voCoil", shCoil, kMedSteelSh);
+
+  // 
+  // ALUMINIUM PLATES 
+  //
+
+  // Shape for aluminium Plate separating cavern and LHC tunnel
+  const Double_t dAlWallThick = 0.5; // thickness of aluminium plates (cm)
+  //
+  // RB24/26 Tunnel Floor 
+  R   = 220.;
+  // h   = 140.;
+  // phi = TMath::ACos(h / r);
+  // xl  = r * TMath::Sin(phi);
+  // dr  = 1600.;
+  // dh  = dr * TMath::Cos(phi);
+  // dl  = dr * TMath::Sin(phi);
+
+  new TGeoTube("shWallBase",    0.,    R, dAlWallThick*0.5);  // base shape for shWallBigPlate
+  new TGeoBBox("shWallCutBot",270., 110., dAlWallThick    );  // to be substracted from base
+  // Translation for cutting circular and square hole in the plates
+  (new TGeoTranslation("trAntiBeamAxis",   -70.,               40., 0.)) -> RegisterYourself();
+  (new TGeoTranslation("trHUWAT3",         -70., -110. - 140. +40., 0.)) -> RegisterYourself();
+
+  //
+  //  Wall Big Aluminium Plate with Squared Hole 
+  //
+  const Double_t dSqrHoleSide = 33.0; // Side
+  new TGeoBBox("shWallSqrHole", dSqrHoleSide*0.5, dSqrHoleSide*0.5, dAlWallThick);
+  strSh  = ""; 
+  strSh += "shWallBase:trAntiBeamAxis - ";
+  strSh += " ( shWallCutBot:trHUWAT3" ;
+  strSh += " + shWallSqrHole )";
+  TGeoVolume* voWallBigPlate = new TGeoVolume("voWallBigPlate", 
+    new TGeoCompositeShape("shWallBigPlate", strSh), kMedAlu );
+  //
+  // Wall Squared Aluminium Plate 
+  //
+  const Double_t dCircHoleRad = 9.5; // Radius
+  new TGeoTube("shCircHole", 0., dCircHoleRad, dAlWallThick);
+  // Make holes for bars
+  new TGeoTube("shRodHole", 0.,   1.7/2.,  2*dAlWallThick);
+  ( new TGeoTranslation("trWallRod1",  12.5, -12.75, 0.)) -> RegisterYourself();
+  ( new TGeoTranslation("trWallRod2",  12.5,  12.75, 0.)) -> RegisterYourself();
+  ( new TGeoTranslation("trWallRod3", -12.5, -12.75, 0.)) -> RegisterYourself();
+  ( new TGeoTranslation("trWallRod4", -12.5,  12.75, 0.)) -> RegisterYourself();
+  new TGeoBBox("shWallSqrPlateBase", dSqrHoleSide*0.5 + 5.0, dSqrHoleSide*0.5 + 5.0, dAlWallThick/2.);
+  strSh  = " ((((";
+  strSh += " ( shWallSqrPlateBase - shCircHole )"; 
+  strSh += " - shRodHole:trWallRod1)"  ;
+  strSh += " - shRodHole:trWallRod2)"  ;
+  strSh += " - shRodHole:trWallRod3)"  ;
+  strSh += " - shRodHole:trWallRod4)"  ;
+  TGeoVolume* voWallSqrPlate = new TGeoVolume("HUWAT_AlWall02", 
+    new TGeoCompositeShape("shWallSqrPlate", strSh ), kMedAlu);
+  // ==========================================================================
+  //
+  // Define Mother Vacuum volume of VMAOI  (need shIonPumpVBo)
+  //
+  // ==========================================================================
+  const Double_t kdzMoFlange   =  2.0;
+  const Double_t kdzMoBellow   = 15.6;
+  const Double_t kdzTTube = 11.5; // Bellow starts here
+  const Double_t kziTTube  =  1.0; // Ion Pum Tube starts here
+  new TGeoTube( "shMoFlange", 0., 15.2/2., kdzMoFlange/2.0);
+  new TGeoTube( "shMoBellow", 0., 11.4/2., kdzMoBellow/2.0);
+  (new TGeoTranslation("trMoFlange1", 0., 0.,        0.5*kdzMoFlange     )) -> RegisterYourself();
+  (new TGeoTranslation("trMoFlange2", 0., 0., 28.0 - 0.5*kdzMoFlange     )) -> RegisterYourself();
+  (new TGeoTranslation("trMoBellow" , 0., 0., 28.0 - 0.5*kdzMoBellow     )) -> RegisterYourself();
+  (new TGeoTranslation("trMoTTube"  , 0., 0., kziTTube +  0.5*kdzTTube   )) -> RegisterYourself();
+  
+  TGeoCompositeShape * shMoVMAOI =  
+      new TGeoCompositeShape("shMoVMAOI", 
+      "shMoFlange:trMoFlange1 + shMoBellow:trMoBellow + shMoFlange:trMoFlange2 + shIonPumpVBo:trMoTTube");
+  TGeoVolume * voMoVMAOI = new TGeoVolume("voMoVMAOI", shMoVMAOI, kMedVacuum);
+  voMoVMAOI->AddNode(voVSR      ,1, new TGeoTranslation(0., 0., 7.1 - 0.45));
+  voMoVMAOI->AddNode(voIonPumpVB,1, new TGeoTranslation(0., 0., 1 + 11.5/2.));
+  voMoVMAOI->AddNode(voVSRflange,1, new TGeoTranslation(0.,0.,0.));
+  voMoVMAOI->AddNode(voVSRcontD ,1, new TGeoTranslation(0.,0.,28.));
+  voMoVMAOI->AddNode(voVSRcontF ,1, new TGeoTranslation(0.,0.,28.));
+  z = 1.0 + 11.5;
+  voMoVMAOI->AddNode( new TGeoVolume("voVBU9mm", shVBU9mm, kMedAlu),
+               1, new TGeoTranslation(0.,0., z) );
+  voMoVMAOI->AddNode( new TGeoVolume("voVBU26mm", shVBU26mm, kMedAlu),
+               1, new TGeoTranslation(0.,0., z + 11.9) );
+  voMoVMAOI->AddNode( new TGeoVolume("voVBUcent", shVBUcent, kMedAlu),
+               1, new TGeoTranslation(0.,0., z) );
+  voMoVMAOI->AddNode( voVBUrotFlg, 1, 
+               new TGeoCombiTrans(0.,0.,1.31, Ry180) );
+  voMoVMAOI->AddNode( voVBUrotFlg, 2, 
+               new TGeoTranslation(0.,0.,28. - 1.31) );
+  voMoVMAOI->AddNode( voVBUflg, 1, 
+               new TGeoTranslation(0.,0.,0.) );
+  voMoVMAOI->AddNode( voVBUflg, 2, 
+               new TGeoCombiTrans(0.,0.,28., Ry180) );
+  
+  // ==========================================================================
+  //
+  // Define ADA
+  //
+  // ==========================================================================
+
+  TGeoVolume *ad = new TGeoVolumeAssembly("AD");
+  
+  // Get medium for ADA
+  TGeoMedium * medADASci     = gGeoManager->GetMedium("AD_NE102"); // AD Scin. 
+  // TGeoMedium * medADALG          = gGeoManager->GetMedium("AD_PMMA");  // lightGuide
+  // TGeoMedium * medADAPMGlass = gGeoManager->GetMedium("AD_Glass"); // Glass for Aluminium simulation
+  // TGeoMedium * medADAPMAlum  = gGeoManager->GetMedium("AD_Alum");
+  
+  // Get Medium for ADC 
+  TGeoMedium * medADCSci     = gGeoManager->GetMedium("AD_NE102");
+  // TGeoMedium * medADCLG      = gGeoManager->GetMedium("AD_PMMA");
+  // TGeoMedium * medADCPMGlass = gGeoManager->GetMedium("AD_Glass");
+  // TGeoMedium * medADCPMAlum  = gGeoManager->GetMedium("AD_Alum");
+  
+  // ADA Scintillator Pad 
+  const Double_t kADACellSideY = 21.7;
+  const Double_t kADACellSideX = 18.2;
+  // ADC Scintillator Pad 
+  const Double_t kADCCellSideY = 21.7;
+  const Double_t kADCCellSideX = 18.2;
+  // WLS bar          :  0.40 cm ( 4.0 mm )
+  // Wrapping         :  0.20 cm ( 2.0 mm )
+  // Aluminnized Mylar:  0.01 cm ( 0.1 mm )
+  // Fishing line     :  0.04 cm ( 0.4 mm )
+  // total shift on X :  0.65 cm
+  // total shift on Y :  0.21 cm
+  const Double_t kShiftX       =  0.65;
+  const Double_t kShiftY       =  0.20;
+  const Double_t kADACelldz    =  2.50;
+  const Double_t kADCCelldz    =  2.50;
+  const Double_t kADABeamPipeR =  6.20; // Radius of beam pipe hole for ADA (Diameter  7 cm)
+  const Double_t kADCBeamPipeR =  3.70; // Radius of beam pipe hole for ADC (Diameter 12 cm)
+  const Int_t    kColorADA     = kGreen;
+  const Int_t    kColorADC     = kGreen;
+  Double_t X = kShiftX + kADACellSideX * 0.5;
+  Double_t Y = kShiftY + kADACellSideY * 0.5;
+  Double_t WLS_dx =  0.4;
+  Double_t WLS_dz =  2.5;
+  Double_t WLS_SideA_Long_dy  = 24.20; // 24.2;
+  Double_t WLS_SideC_Long_dy  = 24.20; // 24.2;
+  Double_t WLS_SideA_Short_dy = 18.20; // 18.41; 
+  Double_t WLS_SideC_Short_dy = 20.70; // 20.91; 
+  // Creating ADA WLS bars
+  TGeoVolume * vADA_WLS_s = new TGeoVolume( "ADAWLSshort", 
+      new TGeoBBox( "shADAWLSbarShort" , WLS_dx/2.0, WLS_SideA_Short_dy/2.0, WLS_dz/2.0),
+      medADASci);      
+  TGeoVolume * vADA_WLS_l = new TGeoVolume( "ADAWLSlong" , 
+      new TGeoBBox( "shADAWLSbarLong"  , WLS_dx/2.0, WLS_SideA_Long_dy /2.0, WLS_dz/2.0),
+      medADASci);      
+  vADA_WLS_l->SetLineColor( kRed );
+  vADA_WLS_s->SetLineColor( kRed );
+  // Creating ADC WLS bars
+  TGeoVolume * vADC_WLS_s = new TGeoVolume( "ADCWLSshort", 
+      new TGeoBBox( "shADCWLSbarShort" , WLS_dx/2.0, WLS_SideC_Short_dy/2.0, WLS_dz/2.0),
+      medADCSci);      
+  TGeoVolume * vADC_WLS_l = new TGeoVolume( "ADCWLSlong" , 
+      new TGeoBBox( "shADCWLSbarLong"  , WLS_dx/2.0, WLS_SideC_Long_dy /2.0, WLS_dz/2.0),
+      medADCSci);      
+  vADC_WLS_l->SetLineColor(kRed);
+  vADC_WLS_s->SetLineColor(kRed);
+  // Make ADA scintillator pad
+  new TGeoBBox( "shADAbox" , kADACellSideX/2.0, kADACellSideY/2.0, kADACelldz/2.0 );
+  new TGeoTube( "shADAHole",               0. , kADABeamPipeR    , kADACelldz     );
+  ( new TGeoTranslation("trADAbox", X, Y, 0.)) -> RegisterYourself();
+  // 
+  TGeoVolume * vADA1 = new TGeoVolume( "ADApad", 
+    new TGeoCompositeShape("shADApad", "shADAbox:trADAbox-shADAHole"), medADASci );      
+  vADA1->SetLineColor( kColorADA );
+  
+  TGeoVolume *secADA  = new TGeoVolumeAssembly( "ADAsec" ); 
+  // Add PAD
+  secADA->AddNode( vADA1, 1, 0); 
+  secADA->AddNode( vADA_WLS_s, 1, 
+      new TGeoTranslation(0.21 + WLS_dx/2.0, kADABeamPipeR + WLS_SideA_Short_dy/2.0, 0.0) ); 
+      // new TGeoTranslation(0.21 + WLS_dx/2.0, kADABeamPipeR + kShiftY + WLS_SideA_Short_dy/2.0, 0.0) ); 
+  secADA->AddNode( vADA_WLS_l, 1, 
+      new TGeoTranslation(kShiftX + WLS_dx/2.0 + kADACellSideX + 0.04, kShiftY + WLS_SideA_Long_dy/2.0, 0.0) ); 
+
+  /// Assembling ADA adding 4 sectors                                       //  Sectors
+  TGeoVolume *vADAarray = new TGeoVolumeAssembly( "ADA" );                  //        ^ y
+  vADAarray->AddNode( secADA, 1 );                                          //        |   
+  vADAarray->AddNode( secADA, 2, Ry180 );                                   //   2    |   1
+  vADAarray->AddNode( secADA, 3, Rz180 );                                   // --------------->  x     
+  vADAarray->AddNode( secADA, 4, Rx180 );                                   //   3    |   4
+  //                                                                        //        |
+  // TGeoRotation *rotADA90 = new TGeoRotation("adarot",0,0,0); <--Delete this  
+  // Add ADA layer 2 and 3 to AD volume
+  const Float_t kPosAD2 = 1695.0;
+  const Float_t kPosAD3 = 1700.0;
+  ad->AddNode(vADAarray,1, new TGeoTranslation(0., 0., kPosAD2)); 
+  ad->AddNode(vADAarray,2, new TGeoTranslation(0., 0., kPosAD3));
+  
+  // if (GetADATwoInstalled())
+  // {
+  //   const Float_t kPosADA2 = kPosADA - 5.0;
+  //   ad->AddNode(vADAarray,2, new TGeoCombiTrans("ada",0,0,kPosADA2,rotADA90));
+  // }
+
+  // ==========================================================================
+  //
+  // Define ADC (2014, Aug 20)
+  //
+  // ==========================================================================
+
+  /// Creation of assembly of one ADC sector
+  
+  /////////////////////////////////////////////////////////////////////////////
+  /// ADC in the tunnel                                                     ///
+  /////////////////////////////////////////////////////////////////////////////
+  new TGeoBBox( "shADCbox" , kADCCellSideX/2.0, kADCCellSideY/2.0, kADCCelldz/2.0 );
+  new TGeoTube( "shADCHole",               0. , kADCBeamPipeR    , kADCCelldz     );
+  X = kShiftX + kADCCellSideX * 0.5;
+  Y = kShiftY + kADCCellSideY * 0.5;
+  ( new TGeoTranslation("trADCbox", X, Y, 0.) ) -> RegisterYourself();
+  // 
+  TGeoVolume * vADCpad = new TGeoVolume( "ADCpad", 
+    new TGeoCompositeShape("shADCpad", "shADCbox:trADCbox-shADCHole"), medADCSci );      
+  vADCpad->SetLineColor( kColorADC );
+  
+  /// Creating Sector for Tunnel (Asembly:  Scintillator Pad + Light guide + PM )
+  TGeoVolume *voADC  = new TGeoVolumeAssembly("ADCsec");
+  // Add PAD
+  voADC->AddNode( vADCpad, 1, 0);
+  // Add ADC WLS Short bar
+  voADC->AddNode( vADC_WLS_s, 1, 
+      new TGeoTranslation( 0.21 + WLS_dx/2.0, kADCBeamPipeR + WLS_SideC_Short_dy/2.0, 0.0) ); 
+      // new TGeoTranslation( 0.21 + WLS_dx/2.0, kADCBeamPipeR + kShiftY + WLS_SideC_Short_dy/2.0, 0.0) ); 
+  // Add ADC WLS Long  bar
+  voADC->AddNode( vADC_WLS_l, 1, 
+      new TGeoTranslation( 0.04 + WLS_dx/2.0 + kADCCellSideX + kShiftX, kShiftY + WLS_SideC_Long_dy/2.0, 0.0) ); 
+  
+  /// Assembling ADC adding the 4 sectors                 //  Sectors
+  TGeoVolume *vADCarray = new TGeoVolumeAssembly("ADC");  //        ^ y
+  vADCarray->AddNode( voADC, 1 );                         //        |   
+  vADCarray->AddNode( voADC, 2, Ry180 );                  //   2    |   1
+  vADCarray->AddNode( voADC, 3, Rz180 );                  // --------------->  x  
+  vADCarray->AddNode( voADC, 4, Rx180 );                  //   3    |   4
+                                                          //        |
+                                                                             
+
+  // ==========================================================================
+  //
+  // Add ADC to AD volume
+  //
+  // Note to future maintainers: 
+  // In previous AliRoot versions the position z = -1900.75 corresponded 
+  // to the end of the YSAA3_CC_BLOCK (concrete block shielding just before 
+  // the C-Side LHC wall). Now this has been fixed to agree with reality. 
+  // The YSAA3_CC_BLOCK starts at 1800.75 and ends at 1880.75 cm.
+  //
+  // Ernesto Calvo and Alberto Gago.
+  // - ecalvovi@cern.ch
+  // - agago@pucp.edu.pe
+  //
+  // ==========================================================================
+  
+  
+
+  switch (fADCPosition ) {
+    case kADCInTunnel:
+      {
+        const Float_t kZbegADC1 = -kZbegFrontBar-2.;  // (ecalvovi@cern.ch) 
+        const Float_t kZendADC2 = -1959.0;            // (ecalvovi@cern.ch) 
+        ad -> AddNode(vADCarray , 1, new TGeoTranslation(0., 0., kZendADC2 + kADCCelldz/2.)); // Tunnel
+        ad -> AddNode(vADCarray , 2, new TGeoTranslation(0., 0., kZbegADC1 - kADCCelldz/2.)); // Tunnel
+        break;
+      }
+    case kADCInCavern:
+      {
+        printf("FATAL: vADCInCavern is now obsolete!");
+        exit(1);
+        // const Float_t kZbegADC1 = -1890.0;  // (ecalvovi@cern.ch) 
+        // const Float_t kZbegADC2 = -1885.0;  // (ecalvovi@cern.ch) 
+        // ad -> AddNode(vADCarrayH, 1, new TGeoTranslation(0., 0., kZbegADC1 - kADCCelldz/2.)); // Cavern
+        // ad -> AddNode(vADCarrayH, 2, new TGeoTranslation(0., 0., kZbegADC2 - kADCCelldz/2.)); // Cavern
+        break;
+      }
+    case kADCInBoth:
+      {
+        printf("FATAL: vADCInBoth   is now obsolete!");
+        exit(1);
+        // const Float_t kZbegADC1 = -kZbegFrontBar-2.;  // (ecalvovi@cern.ch) 
+        // const Float_t kZbegADC2 = -1885.0;            // (ecalvovi@cern.ch) 
+        // ad -> AddNode(vADCarray , 1, new TGeoTranslation(0., 0., kZbegADC1 - kADCCelldz/2.)); // Tunnel
+        // ad -> AddNode(vADCarrayH, 2, new TGeoTranslation(0., 0., kZbegADC2 - kADCCelldz/2.)); // Cavern 
+        break;
+      }
+  }
+
+
+  // ==========================================================================
+  // 
+  // Add volumes to Top volume
+  //
+  // ==========================================================================
+
+  TGeoVolumeAssembly * top = new TGeoVolumeAssembly("voADStruct");
+  top->AddNode(voSaa3EndPlate, 1, new TGeoTranslation( 0., 0., kZendAbs + 1.95/2.));
+  z = kZwall;
+  top->AddNode(voWallBigPlate, 1, new TGeoTranslation(0., 0., z - 0.5 * dAlWallThick ));
+  top->AddNode(voWallSqrPlate, 1, new TGeoTranslation(0., 0., z + 0.5 * dAlWallThick ));
+  z = kZendAbs + 1.95 + dzRodL/2.; 
+  top->AddNode(voSaa3Rod,  1, new TGeoTranslation(  12.5, -12.75, z));
+  top->AddNode(voSaa3Rod,  2, new TGeoTranslation(  12.5,  12.75, z));
+  top->AddNode(voSaa3Rod,  3, new TGeoTranslation( -12.5, -12.75, z));
+  top->AddNode(voSaa3Rod,  4, new TGeoTranslation( -12.5,  12.75, z));
+  top->AddNode(voValve,    1, new TGeoTranslation( 0., 0., zPosValve));
+  //
+  top->AddNode(voMoVMAOI,  1, new TGeoTranslation( 0., 0., kZbegVMAOI));
+  //
+  top->AddNode(voFrontBar, 1, new TGeoTranslation( 0., 0., kZbegFrontBar + dzF/2.));
+  z = kZbegCoil;
+  top->AddNode(voCoil, 1, new TGeoCombiTrans(  3.6 + dz/2., 0., z, Ry90m));
+  top->AddNode(voCoil, 2, new TGeoCombiTrans(  3.6 + dz/2., 0., z, new TGeoRotation((*Ry90m)*(*Rx180))));
+  top->AddNode(voCoil, 3, new TGeoCombiTrans( -3.6 - dz/2., 0., z, Ry90m));
+  top->AddNode(voCoil, 4, new TGeoCombiTrans( -3.6 - dz/2., 0., z, new TGeoRotation((*Ry90m)*(*Rx180))));
+  z = kZbegFrontBar + dzF + kdzLatBar/2.;
+  top->AddNode(voLatBar, 1, new TGeoTranslation(  31.9, 0., z));
+  top->AddNode(voLatBar, 2, new TGeoTranslation( -31.9, 0., z));
+  //
+  // Add Everything to ALICE
+  //
+  TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
+  // Add structures to AD
+  if (fADCstruct) {
+    ad->AddNode(top,1, Ry180);
+  }
+
+  // Add AD to ALICE
+  alice->AddNode(ad, 1);
   
-       // Triangle
-       TGeoTrd2* sADCLGtriang = new TGeoTrd2( kADCLGThickness/2., kADCLGThickness/2., kADCLGSideScint/2., kADCLGSideCoupling/2., kADCLGHeigth/2.0);
-       TGeoVolume *vADCLGtriang = new TGeoVolume( "ADCLG", sADCLGtriang, medADCLG );
-       vADCLGtriang->SetLineColor( kColorADCLG ); 
-
-       // Coupling
-       Double_t kADCLGCoupling = 10.0; // Total lenght
-       new TGeoCone( "ADCCouplCone", kADCLGCoupling/4., 0, kADCLGSideCoupling/TMath::Sqrt(2.), 0, 1.4 );
-       new TGeoBBox( "ADCCouplBox", kADCLGSideCoupling/2., kADCLGSideCoupling/2., kADCLGCoupling/4. );
-       new TGeoTube( "ADCCouplTube", 0, 1.4, kADCLGCoupling/4. );
-       TGeoTranslation *tradd3 = new TGeoTranslation(0, 0, kADCLGCoupling/2. );
-       tradd3->SetName( "tradd3" );
-       tradd3->RegisterYourself();
-   
-       TGeoCompositeShape * sADCCoupling = new TGeoCompositeShape ( "sADCCoupling", "ADCCouplBox * ADCCouplCone + (ADCCouplTube:tradd3)" );
-       TGeoVolume * vADCCoupling = new TGeoVolume( "ADCCoupling", sADCCoupling, medADCLG );
-       vADCCoupling->SetLineColor( kColorADCLG ); 
-   
-       TGeoVolume * vADCLG  = new TGeoVolumeAssembly( "ADCLG" );
-       vADCLG->AddNode( vADCLGtriang, 1 );   
-       vADCLG->AddNode( vADCCoupling, 1, new TGeoTranslation(0., 0., kADCLGHeigth/2.+kADCLGCoupling/4.) );   
-       vADCLG->SetLineColor( kColorADCLG ); 
-   
-       /// PM  Hamamatsu R5946  
-       const Double_t kADCPMR1 = 1.95;          // 3.9 cm diameter
-       const Double_t kADCPMR2 = 2.15;          // + 2 mm?? aluminium case 
-       const Double_t kADCPMlength = 6.4;       // 5 cm PMT + 1.4 socket 
-       //const int kColorPMG   = kWhite;
-       ////const int kColorPMA   = kGray;
-       TGeoTube *sADCPMg   = new TGeoTube( "sADCPMg", 0., kADCPMR1, kADCPMlength/2. );
-       TGeoVolume *vADCPMg = new TGeoVolume( "ADCPMg", sADCPMg, medADCPMGlass );
-       vADCPMg->SetLineColor(kColorPMG);
-       TGeoTube *sADCPMa   = new TGeoTube( "ADCPMa", kADCPMR1, kADCPMR2, kADCPMlength/2. );
-       TGeoVolume *vADCPMa = new TGeoVolume( "ADCPMa", sADCPMa, medADCPMAlum );
-       vADCPMa->SetLineColor( kColorPMA );
-       TGeoVolume *vADCPM  = new TGeoVolumeAssembly( "ADCPM" );
-       vADCPM->AddNode( vADCPMg, 1 );
-       vADCPM->AddNode( vADCPMa, 1 );
-
-       /// Sector (Asembly:  Scintillator Pad + Light guide + PM )
-       TGeoVolume *secADC  = new TGeoVolumeAssembly("ADCsec");
-       // Add PAD
-       TGeoCombiTrans *transrot1 = new TGeoCombiTrans( 3*kADCCellSide/4.0, kADCCellSide/2.0, 0., new TGeoRotation("rot",0.,0.,0.) );
-       secADC->AddNode( vADC, 1, transrot1 );
-       // Add Light Guide
-       transrot1 = new TGeoCombiTrans( kADCCellSide + kADCLGHeigth/2.0, kADCLGSideScint/2.0, 0., new TGeoRotation("rot",90.,90.,90.) );
-       secADC->AddNode( vADCLG, 1, transrot1 );
-       // Add PM
-       transrot1 = new TGeoCombiTrans( kADCCellSide + kADCLGHeigth  + kADCLGCoupling + kADCPMlength/2., kADCCellSide/2.0, 0, new TGeoRotation("rot",90.,90.,0.) );
-       secADC->AddNode( vADCPM, 1, transrot1 );
-
-       // TODO: Add mechanical support
-
-       /// Assembling ADC adding the 4 sectors                                   //  Sectors
-       TGeoVolume *vADCarray = new TGeoVolumeAssembly("ADC");                    //        ^ y
-       vADCarray->AddNode( secADC, 1 );                                          //        |   
-       vADCarray->AddNode( secADC, 2, new TGeoRotation("rot", 0.  , 180., 0.) ); //   4    |   1
-       vADCarray->AddNode( secADC, 3, new TGeoRotation("rot", 180., 0.,   0.) ); // --------------->  x  
-       vADCarray->AddNode( secADC, 4, new TGeoRotation("rot", 180., 180., 0.) ); //   3    |   2
-                                                                             //        |
-       // here I add ADC to AD volume
-
-       //const Float_t kPosADC = -1902.75;  // -1902.75 (with 4cm thick) puts the ADC just next to the YSAA3_CC_BLOCK
-       const Float_t kPosADC = -1900.0;
-       ad->AddNode(vADCarray,3,new TGeoTranslation(0,0,kPosADC));
-       // add second array
-       if (GetADCToInstalled())
-       {
-               const Float_t kPosADC2 = -1895.0;
-               ad->AddNode(vADCarray,4,new TGeoTranslation(0,0,kPosADC2));
-       }
 
-       // at the end, I add "AD" volume into ALICE
+  // gGeoManager->DefaultColors();
+  // gGeoManager->CloseGeometry();
+  // gGeoManager->SetVisLevel(10);
+  // gGeoManager->SetVisOption(0);
+  // alice->Draw("ogl");
 
-       alice->AddNode(ad,1);
+  return; 
 }
 
 //_____________________________________________________________________________
@@ -383,26 +980,37 @@ void AliADv1::AddAlignableVolumes() const
    // eventual changes in the geometry.
    //
    // ADA and ADC 
+   TString volpath1, volpath2, volpath3, volpath4;
+   TString symname1, symname2, symname3, symname4;
 
+   symname1 = "AD/ADC1";
+   symname2 = "AD/ADC2"; 
+   symname3 = "AD/ADA1";
+   symname4 = "AD/ADA2"; 
+   switch (fADCPosition) {
+     case kADCInTunnel:
+       volpath1 = "/ALIC_1/AD_1/ADC_1";
+       volpath2 = "/ALIC_1/AD_1/ADC_2";
+       break;
+     case kADCInCavern:
+       volpath1 = "/ALIC_1/AD_1/ADCh_1";
+       volpath2 = "/ALIC_1/AD_1/ADCh_2";
+       break;
+     case kADCInBoth:
+       volpath1 = "/ALIC_1/AD_1/ADC_1";
+       volpath2 = "/ALIC_1/AD_1/ADCh_2";
+       break;
+   }
+   volpath3 = "/ALIC_1/AD_1/ADA_1";
+   volpath4 = "/ALIC_1/AD_1/ADA_2";
 
-   
-   TString volpath1 = "/ALIC_1/AD_1/ADC_3";
-   TString volpath2 = "/ALIC_1/AD_1/ADC_4";
-   TString volpath3 = "/ALIC_1/AD_1/ADA_1";
-   TString volpath4 = "/ALIC_1/AD_1/ADA_2";
-   TString symname1 = "AD/ADC3";
-   TString symname2 = "AD/ADC4"; 
-   TString symname3 = "AD/ADA1";
-   TString symname4 = "AD/ADA2"; 
-   
    if ( !gGeoManager->SetAlignableEntry(symname1.Data(), volpath1.Data()) )
       AliFatal(Form( "Alignable entry %s not created. Volume path %s not valid", symname1.Data(), volpath1.Data()) );
-   if ( GetADCToInstalled() && !gGeoManager->SetAlignableEntry(symname2.Data(), volpath2.Data()) )
+   if ( GetADCTwoInstalled() && !gGeoManager->SetAlignableEntry(symname2.Data(), volpath2.Data()) )
       AliFatal(Form( "Alignable entry %s not created. Volume path %s not valid", symname2.Data(), volpath2.Data()) );
    if ( !gGeoManager->SetAlignableEntry(symname3.Data(), volpath3.Data()) )
       AliFatal(Form( "Alignable entry %s not created. Volume path %s not valid", symname3.Data(), volpath3.Data()) );
-   if ( GetADAToInstalled() && !gGeoManager->SetAlignableEntry(symname4.Data(), volpath4.Data()) )
+   if ( GetADATwoInstalled() && !gGeoManager->SetAlignableEntry(symname4.Data(), volpath4.Data()) )
       AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname4.Data(), volpath4.Data()) );
    
 }
@@ -417,18 +1025,27 @@ void AliADv1::StepManager()
    //
 
    // ADA and ADC static Variables         //
-   //static  Int_t   numStep_ad = 0;         //
-//   static  Int_t   vol_ad[2];              //
+   // static  Int_t   numStep_ad = 0;      //
+   // static  Int_t   vol_ad[2];           //
   
    /////////////////////////////////////////////////////////////////////////
-   // ADA and ADC
+   //                            ADA and ADC                              //
    /////////////////////////////////////////////////////////////////////////
       
       
    // Get sensitive volumes id (scintillator pads)
-   static Int_t idADA = gMC->VolId( "ADApad" );
-   static Int_t idADC = gMC->VolId( "ADCpad" );
+   static Int_t idADA  = gMC->VolId( "ADApad" );
+   static Int_t idADC  = gMC->VolId( "ADCpad" );
+   // static Int_t idADCh = gMC->VolId( "ADCpadH" );
    
+   static Bool_t fOnlyOnce = kTRUE;
+   if (fOnlyOnce) {
+     printf("  gMC->VolId(\"ADApad\" ) = %3d\n", idADA);
+     printf("  gMC->VolId(\"ADCpad\" ) = %3d\n", idADC);
+     // printf("  gMC->VolId(\"ADCpadH\") = %3d\n", idADCh);
+     fOnlyOnce = kFALSE;
+   }
+
    // We keep only charged tracks : 
    // if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;   
    // We keep charged and non-charged tracks : 
@@ -438,38 +1055,46 @@ void AliADv1::StepManager()
    Int_t current_volid = gMC->CurrentVolID( copy );
 
    // check is the track is in a sensitive volume
+   // if( current_volid != idADA && current_volid != idADC && current_volid != idADCh ) {
    if( current_volid != idADA && current_volid != idADC ) {
       return; // not in the sensitive volume 
    }
    
-   // First read the position, otherwise weird reults! //ecv
+   // First read the position, otherwise weird results! //ecv
    Double_t s[3];
    Float_t  x[3];
    gMC->TrackPosition( s[0], s[1], s[2] );
    for ( Int_t j=0; j<3; j++ ) x[j] = s[j];
    
-   // Set detectro type: ADA or ADC
-   Int_t detType = (current_volid == idADA ) ? 0 : 1;
-   
    // Get sector copy (1,2,3,4) ( 1 level up from pad )
    Int_t sect;
    gMC->CurrentVolOffID( 1, sect );
-
+   
    // Get Detector copy (1,2) ( 2 levels up from pad )
    Int_t detc;
    gMC->CurrentVolOffID( 2, detc );
-   
-   // Sector number 
-   // ADA1 = 10-14
-   // ADA2 = 20-24
-   // ADC1 = 30-34
-   // ADC2 = 40-44
-   Int_t sectorNumber_AD = detType*20 + detc*10 + sect;
+
+   // Set detector type: ADA or ADC
+   Int_t ADlayer = (current_volid == idADC ) ? 0 : 2;
+
+   printf("CurVolID: %d | sect: %2d | detc: %2d\n", current_volid, sect, detc); 
+
+   sect--;          //     sector within layer [0-3]
+   detc--;          //     detector copy       [0-1]
+   ADlayer += detc; //     global layer number [0-3]
+
+   Int_t ADsector = ADlayer*4 + sect; // Global AD sector number [0-15]
+   // Layer    Sector Number 
+   // ADC 0  =   0- 3
+   // ADC 1  =   4- 7
+   // ADA 2  =   8-11
+   // ADA 3  =  12-15
+   printf("\n ADsector: %2d | ADlayer: %2d | sect: %2d | x: %8.2f | y: %8.2f | z: %8.2f\n", ADsector, ADlayer, sect, x[0], x[1], x[2]); // Debug ECV
    
    Double_t lightYield_ad;
    Double_t photoCathodeEfficiency;
   
-   if( detType == 1 )  {
+   if( ADlayer <2 )  {
       lightYield_ad          = fADCLightYield;
       photoCathodeEfficiency = fADCPhotoCathodeEfficiency;
    } else  {
@@ -531,32 +1156,7 @@ void AliADv1::StepManager()
 
       // Set integer values
       vol_ad[3]  = nPhotons_ad;
-       // brutal correction for ADA_1
-      if (sectorNumber_AD==11) sectorNumber_AD=0;
-      if (sectorNumber_AD==12) sectorNumber_AD=1;
-      if (sectorNumber_AD==13) sectorNumber_AD=2;
-      if (sectorNumber_AD==14) sectorNumber_AD=3;
-
-       // same for ADA_2
-      if (sectorNumber_AD==21) sectorNumber_AD=4;
-      if (sectorNumber_AD==22) sectorNumber_AD=5;
-      if (sectorNumber_AD==23) sectorNumber_AD=6;
-      if (sectorNumber_AD==24) sectorNumber_AD=7;
-
-       // brutal correction for ADC_3
-      if (sectorNumber_AD==51) sectorNumber_AD=8;
-      if (sectorNumber_AD==52) sectorNumber_AD=9;
-      if (sectorNumber_AD==53) sectorNumber_AD=10;
-      if (sectorNumber_AD==54) sectorNumber_AD=11;
-
-       // same for ADC_4
-      if (sectorNumber_AD==61) sectorNumber_AD=12;
-      if (sectorNumber_AD==62) sectorNumber_AD=13;
-      if (sectorNumber_AD==63) sectorNumber_AD=14;
-      if (sectorNumber_AD==64) sectorNumber_AD=15;
-
-
-      vol_ad[4]  = sectorNumber_AD;  // sector number (scintillator ID)
+      vol_ad[4]  = ADsector;  // sector number (scintillator ID)
       // Set float values
       hits_ad[9]  = tlength_ad;    // track lenght inside ADC or ADA
       hits_ad[10] = eloss_ad;      // energy loss
@@ -579,6 +1179,12 @@ void AliADv1::AddHit(Int_t track, Int_t *vol, Float_t *hits)
        new(lhits[fNhits++]) AliADhit(fIshunt,track,vol,hits);
 }
 //_________________________________________________________
+// void AliADv1::AddDigits(Int_t* track, Int_t module, Float_t time)
+// {
+//     TClonesArray &ldigits = *fDigits;
+//     new(ldigits[fNdigits++]) AliADdigit(track,module,time);
+// }
+//_________________________________________________________
 void AliADv1::MakeBranch(Option_t *option)
 {
 
index 509d6161ade8fa2fee0b1195a7dcdc40900da35b..be95e673b65b24590de1f07422d28d6aeb926023 100644 (file)
 //                  AD (ALICE Diffractive)  Detector                     //
 //                                                                       //
 //  This class contains the base procedures for the AD  detector         //
-//  Default geometry of 2013                                             //
+//  New geometry of 2014                                                 //
 //  All comments should be sent to :                                     //
 //                                                                       //
 //                                                                       //
 ///////////////////////////////////////////////////////////////////////////
 
 #include "AliAD.h"
-
+#include "TGeoCompositeShape.h"
 class AliADv1 : public AliAD {
 public:
    
                         AliADv1();
                         AliADv1(const char *name, const char *title);
-  virtual       void   AddAlignableVolumes() const;
+  virtual void   AddAlignableVolumes() const;
   virtual              ~AliADv1();
 
    
-  virtual      TString Version() { return TString("v1"); }
-  virtual       Int_t  IsVersion() const { return 1; }
-  virtual      void   AddHit(Int_t track, Int_t *vol, Float_t *hits);
-  virtual      void   MakeBranch(Option_t *option);
-  virtual       void   CreateGeometry();
-  virtual      void   Init();
-  virtual       void   StepManager();
+  virtual TString  Version() { return TString("v1"); }
+  virtual   Int_t  IsVersion() const { return 1; }
+  virtual    void  AddHit(Int_t track, Int_t *vol, Float_t *hits);
+  // virtual    void  AddDigits(Int_t* track, Int_t module, Float_t time);
+  virtual    void  MakeBranch(Option_t *option);
+  virtual    void  CreateGeometry();
+  virtual    void  Init();
+  virtual    void  StepManager();
+  virtual    void  DisableTunnelStruct() { fADCstruct = kFALSE; }
+
+  enum ADCPosition_t { kADCInTunnel, kADCInCavern, kADCInBoth};
 
 protected:
 
   // functions for ADA and ADC
-  virtual       void   CreateAD();
-
+  void ReadADCFromEnv(void);
+  TGeoCompositeShape * MakeShapeADCpadH(const Double_t W, const Double_t H, const Double_t dz);
+  virtual    void  CreateAD();
 private:
+  // Position of ADC: In the Tunnel, In the Cavern, or in Both
+  Bool_t      fADCstruct;
+  ADCPosition_t fADCPosition;
   //! ADC Geometrical & Optical parameters :
   
   Double_t    fADCLightYield;       //! Lightyield in NE102
@@ -55,8 +63,8 @@ private:
   Double_t    fADAPhotoCathodeEfficiency;  
 
 
-                       AliADv1(const AliAD&); 
-                       AliADv1& operator = (const AliADv1&); 
+  AliADv1(const AliAD&); 
+  AliADv1& operator = (const AliADv1&); 
   
   ClassDef(AliADv1, 1)  //!Class for the AD detector