// $Id: g4Config.C,v 1.0 2007/06/01  Exp $
//
// Configuration macro for Geant4 VirtualMC for PamG4VMC
// for geometry defined with Root and selected Geant4 native navigation

void Config()
{
  
  gSystem->Load("libG4phys_builders");
  gSystem->Load("libG4phys_lists");
  TString G4WD=gSystem->Getenv("G4WORKDIR");
  TString PLAT=gSystem->Getenv("PLATFORM");
  //gSystem->Load(G4WD+"/lib/tgt_"+PLAT+"/libPamG4RunConfiguration");
  //cout<<G4WD+"/lib/tgt_"+PLAT+"/libPamG4RunConfiguration";
    //PamG4RunConfiguration* runConfiguration 
    //= new PamG4RunConfiguration("geomRootToGeant4");
    TG4RunConfiguration* runConfiguration 
    = new TG4RunConfiguration("geomRootToGeant4","QGSP_BERT");
    //= new TG4RunConfiguration("geomRootToGeant4","QGSP_BIC_HP");
  
    //    TG4RunConfiguration* runConfiguration 
    //  = new TG4RunConfiguration("geomRootToGeant4");

   //set CUTS
//   TG4PhysicsListOptions options;
//   options.SetSpecialCutsPhysics(true);
//  options.SetEMPhysics(true);
//  options.SetMuonPhysics(true);
//    runConfiguration->SetPhysicsListOptions(options);


  // Switch on optical physics (not activated by default)
  /// TG4PhysicsListOptions options;
  ////runConfiguration->SetPhysicsListOptions(options);
  // TGeant4
  TGeant4* geant4
    = new TGeant4("TGeant4_PAMELA", "The Geant4 PAMELA Monte Carlo", runConfiguration);
//   gMC->SetCut("CUTGAM", 1.0e-6);
//   gMC->SetCut("BCUTE", 1.0e-6);
//   gMC->SetCut("CUTELE", 1.0e-6);
//   gMC->SetCut("DCUTE", 1.0e-6);
//   gMC->SetCut("CUTNEU", 1.0e-6);
//   gMC->SetCut("CUTHAD", 1.0e-6);
//   gMC->SetCut("CUTMUO", 1.0e-6);
//   gMC->SetCut("DCUTM", 1.0e-6);
//   gMC->SetCut("BCUTM", 1.0e-6);
//   gMC->SetCut("PPCUTM", 1.0e-6);
//   gMC->SetCut("TOFMAX", 1.0e-3);
  //  gMC->Gstpar(10,"LOSS",0.1);

  //  TVirtualMCGeometry *geo = TG4GeometryManager::Instance()->GetMCGeometry();  
  geant4->ProcessGeantMacro("g4config.in");
  // Customise Geant4 setting
  // (verbose level, global range cut, ..)


}
