Ignore:
Timestamp:
Jun 14, 2010, 3:54:58 PM (14 years ago)
Author:
garnier
Message:

geant4.9.4 beta rc0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/advanced/hadrontherapy/src/HadrontherapyDetectorMessenger.cc

    r1230 r1313  
    3131#include "HadrontherapyDetectorConstruction.hh"
    3232#include "G4UIdirectory.hh"
    33 #include "G4UIcmdWithADoubleAndUnit.hh"
     33#include "G4UIcmdWith3VectorAndUnit.hh"
     34#include "G4UIcmdWithoutParameter.hh"
    3435#include "G4UIcmdWithAString.hh"
    35 #include "G4UIcmdWith3VectorAndUnit.hh"
    3636
    3737/////////////////////////////////////////////////////////////////////////////
     
    4949                                                "PhantomSizeAlongZ", false);
    5050    changeThePhantomSizeCmd -> SetDefaultUnit("mm");
    51     changeThePhantomSizeCmd -> SetUnitCandidates("um mm cm");
     51    changeThePhantomSizeCmd -> SetUnitCandidates("nm um mm cm");
    5252    changeThePhantomSizeCmd -> AvailableForStates(G4State_Idle);
    5353
     54
     55    // Change Phantom material
     56    changeThePhantomMaterialCmd = new G4UIcmdWithAString("/changePhantom/material", this);
     57    changeThePhantomMaterialCmd -> SetGuidance("Change the Phantom and the detector material");
     58    changeThePhantomMaterialCmd -> SetParameterName("PhantomMaterial", false);
     59    changeThePhantomMaterialCmd -> SetDefaultValue("G4_WATER");
     60    changeThePhantomMaterialCmd -> AvailableForStates(G4State_Idle);
    5461
    5562    // Change Phantom position
     
    6168                                                    "PositionAlongZ", false);
    6269    changeThePhantomPositionCmd -> SetDefaultUnit("mm");
    63     changeThePhantomPositionCmd -> SetUnitCandidates("mm cm m");
     70    changeThePhantomPositionCmd -> SetUnitCandidates("um mm cm m");
    6471    changeThePhantomPositionCmd -> AvailableForStates(G4State_Idle);
    6572
     73
     74    updateCmd = new G4UIcmdWithoutParameter("/changePhantom/update",this);
     75    updateCmd->SetGuidance("Update Phantom/Detector geometry.");
     76    updateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
     77    updateCmd->SetGuidance("if you changed geometrical value(s).");
     78    updateCmd->AvailableForStates(G4State_Idle);
    6679
    6780    //  Change detector size
     
    7487    changeTheDetectorSizeCmd -> SetParameterName("DetectorSizeAlongX", "DetectorSizeAlongY", "DetectorSizeAlongZ", false);
    7588    changeTheDetectorSizeCmd -> SetDefaultUnit("mm");
    76     changeTheDetectorSizeCmd -> SetUnitCandidates("um mm cm");
     89    changeTheDetectorSizeCmd -> SetUnitCandidates("nm um mm cm");
    7790    changeTheDetectorSizeCmd -> AvailableForStates(G4State_Idle);
    7891
     
    8598                                                              "DisplacementAlongZ", false);
    8699    changeTheDetectorToPhantomPositionCmd -> SetDefaultUnit("mm");
    87     changeTheDetectorToPhantomPositionCmd -> SetUnitCandidates("um mm cm");
     100    changeTheDetectorToPhantomPositionCmd -> SetUnitCandidates("nm um mm cm");
    88101    changeTheDetectorToPhantomPositionCmd -> AvailableForStates(G4State_Idle);
    89102   
     
    94107    changeTheDetectorVoxelCmd -> SetParameterName("VoxelSizeAlongX", "VoxelSizeAlongY", "VoxelSizeAlongZ", false);
    95108    changeTheDetectorVoxelCmd -> SetDefaultUnit("mm");
    96     changeTheDetectorVoxelCmd -> SetUnitCandidates("um mm cm");
     109    changeTheDetectorVoxelCmd -> SetUnitCandidates("nm um mm cm");
    97110    changeTheDetectorVoxelCmd -> AvailableForStates(G4State_Idle);
    98111   }
     
    104117    delete changeThePhantomSizeCmd;
    105118    delete changeThePhantomPositionCmd;
     119    delete changeThePhantomMaterialCmd;
     120    delete updateCmd;
    106121    delete changeTheDetectorDir;
    107122    delete changeTheDetectorSizeCmd;
     
    124139         hadrontherapyDetector -> SetPhantomPosition(size);
    125140  }
     141  else if (command == changeThePhantomMaterialCmd)
     142  {
     143      hadrontherapyDetector -> SetPhantomMaterial(newValue);
     144  }
    126145  else if (command == changeTheDetectorSizeCmd)
    127146  {
     
    137156  {
    138157        G4ThreeVector size = changeTheDetectorVoxelCmd  -> GetNew3VectorValue(newValue);
    139         hadrontherapyDetector -> SetNumberOfVoxelBySize(size.getX(),size.getY(),size.getZ());
     158        hadrontherapyDetector -> SetVoxelSize(size.getX(),size.getY(),size.getZ());
     159  }
     160  else if (command == updateCmd)
     161  {
     162      hadrontherapyDetector -> UpdateGeometry();
    140163  }
    141164}
Note: See TracChangeset for help on using the changeset viewer.