Index: trunk/examples/advanced/hadrontherapy/src/HadrontherapyDetectorMessenger.cc
===================================================================
--- trunk/examples/advanced/hadrontherapy/src/HadrontherapyDetectorMessenger.cc	(revision 1230)
+++ trunk/examples/advanced/hadrontherapy/src/HadrontherapyDetectorMessenger.cc	(revision 1313)
@@ -31,7 +31,7 @@
 #include "HadrontherapyDetectorConstruction.hh"
 #include "G4UIdirectory.hh"
-#include "G4UIcmdWithADoubleAndUnit.hh"
+#include "G4UIcmdWith3VectorAndUnit.hh"
+#include "G4UIcmdWithoutParameter.hh"
 #include "G4UIcmdWithAString.hh"
-#include "G4UIcmdWith3VectorAndUnit.hh"
 
 /////////////////////////////////////////////////////////////////////////////
@@ -49,7 +49,14 @@
 						"PhantomSizeAlongZ", false);
     changeThePhantomSizeCmd -> SetDefaultUnit("mm");
-    changeThePhantomSizeCmd -> SetUnitCandidates("um mm cm"); 
+    changeThePhantomSizeCmd -> SetUnitCandidates("nm um mm cm"); 
     changeThePhantomSizeCmd -> AvailableForStates(G4State_Idle);
 
+
+    // Change Phantom material 
+    changeThePhantomMaterialCmd = new G4UIcmdWithAString("/changePhantom/material", this);
+    changeThePhantomMaterialCmd -> SetGuidance("Change the Phantom and the detector material"); 
+    changeThePhantomMaterialCmd -> SetParameterName("PhantomMaterial", false);
+    changeThePhantomMaterialCmd -> SetDefaultValue("G4_WATER");
+    changeThePhantomMaterialCmd -> AvailableForStates(G4State_Idle);
 
     // Change Phantom position
@@ -61,7 +68,13 @@
 						    "PositionAlongZ", false);
     changeThePhantomPositionCmd -> SetDefaultUnit("mm");
-    changeThePhantomPositionCmd -> SetUnitCandidates("mm cm m"); 
+    changeThePhantomPositionCmd -> SetUnitCandidates("um mm cm m"); 
     changeThePhantomPositionCmd -> AvailableForStates(G4State_Idle);
 
+
+    updateCmd = new G4UIcmdWithoutParameter("/changePhantom/update",this);
+    updateCmd->SetGuidance("Update Phantom/Detector geometry.");
+    updateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
+    updateCmd->SetGuidance("if you changed geometrical value(s).");
+    updateCmd->AvailableForStates(G4State_Idle);
 
     //  Change detector size
@@ -74,5 +87,5 @@
     changeTheDetectorSizeCmd -> SetParameterName("DetectorSizeAlongX", "DetectorSizeAlongY", "DetectorSizeAlongZ", false);
     changeTheDetectorSizeCmd -> SetDefaultUnit("mm");
-    changeTheDetectorSizeCmd -> SetUnitCandidates("um mm cm"); 
+    changeTheDetectorSizeCmd -> SetUnitCandidates("nm um mm cm"); 
     changeTheDetectorSizeCmd -> AvailableForStates(G4State_Idle);
 
@@ -85,5 +98,5 @@
 							      "DisplacementAlongZ", false);
     changeTheDetectorToPhantomPositionCmd -> SetDefaultUnit("mm");
-    changeTheDetectorToPhantomPositionCmd -> SetUnitCandidates("um mm cm"); 
+    changeTheDetectorToPhantomPositionCmd -> SetUnitCandidates("nm um mm cm"); 
     changeTheDetectorToPhantomPositionCmd -> AvailableForStates(G4State_Idle);
     
@@ -94,5 +107,5 @@
     changeTheDetectorVoxelCmd -> SetParameterName("VoxelSizeAlongX", "VoxelSizeAlongY", "VoxelSizeAlongZ", false);
     changeTheDetectorVoxelCmd -> SetDefaultUnit("mm");
-    changeTheDetectorVoxelCmd -> SetUnitCandidates("um mm cm");
+    changeTheDetectorVoxelCmd -> SetUnitCandidates("nm um mm cm");
     changeTheDetectorVoxelCmd -> AvailableForStates(G4State_Idle);
    }
@@ -104,4 +117,6 @@
     delete changeThePhantomSizeCmd; 
     delete changeThePhantomPositionCmd; 
+    delete changeThePhantomMaterialCmd; 
+    delete updateCmd;
     delete changeTheDetectorDir; 
     delete changeTheDetectorSizeCmd; 
@@ -124,4 +139,8 @@
          hadrontherapyDetector -> SetPhantomPosition(size);
   }
+  else if (command == changeThePhantomMaterialCmd)
+  {
+      hadrontherapyDetector -> SetPhantomMaterial(newValue);
+  }
   else if (command == changeTheDetectorSizeCmd)
   {
@@ -137,5 +156,9 @@
   {
 	G4ThreeVector size = changeTheDetectorVoxelCmd  -> GetNew3VectorValue(newValue);
-        hadrontherapyDetector -> SetNumberOfVoxelBySize(size.getX(),size.getY(),size.getZ());
+        hadrontherapyDetector -> SetVoxelSize(size.getX(),size.getY(),size.getZ());
+  }
+  else if (command == updateCmd)
+  {
+      hadrontherapyDetector -> UpdateGeometry();
   }
 }
