Geant4.10
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
HadrontherapyDetectorMessenger Class Reference

#include <HadrontherapyDetectorMessenger.hh>

Inheritance diagram for HadrontherapyDetectorMessenger:
G4UImessenger

Public Member Functions

 HadrontherapyDetectorMessenger (HadrontherapyDetectorConstruction *)
 
 ~HadrontherapyDetectorMessenger ()
 
void SetNewValue (G4UIcommand *, G4String)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 

Detailed Description

Definition at line 47 of file HadrontherapyDetectorMessenger.hh.

Constructor & Destructor Documentation

HadrontherapyDetectorMessenger::HadrontherapyDetectorMessenger ( HadrontherapyDetectorConstruction detector)

Definition at line 44 of file HadrontherapyDetectorMessenger.cc.

References G4UIcommand::AvailableForStates(), G4State_Idle, and G4UIcommand::SetGuidance().

45  :hadrontherapyDetector(detector)
46 {
47  // Change Phantom size
48  changeThePhantomDir = new G4UIdirectory("/changePhantom/");
49  changeThePhantomDir -> SetGuidance("Command to change the Phantom Size/position");
50  changeThePhantomSizeCmd = new G4UIcmdWith3VectorAndUnit("/changePhantom/size", this);
51  changeThePhantomSizeCmd -> SetGuidance("Insert sizes X Y and Z"
52  "\n 0 or negative values mean <<Don't change it!>>");
53  changeThePhantomSizeCmd -> SetParameterName("PhantomSizeAlongX",
54  "PhantomSizeAlongY",
55  "PhantomSizeAlongZ", false);
56  changeThePhantomSizeCmd -> SetDefaultUnit("mm");
57  changeThePhantomSizeCmd -> SetUnitCandidates("nm um mm cm");
58  changeThePhantomSizeCmd -> AvailableForStates(G4State_Idle);
59 
60 
61  // Change Phantom material
62  changeThePhantomMaterialCmd = new G4UIcmdWithAString("/changePhantom/material", this);
63  changeThePhantomMaterialCmd -> SetGuidance("Change the Phantom and the detector material");
64  changeThePhantomMaterialCmd -> SetParameterName("PhantomMaterial", false);
65  changeThePhantomMaterialCmd -> SetDefaultValue("G4_WATER");
66  changeThePhantomMaterialCmd -> AvailableForStates(G4State_Idle);
67 
68  // Change Phantom position
69  changeThePhantomPositionCmd = new G4UIcmdWith3VectorAndUnit("/changePhantom/position", this);
70  changeThePhantomPositionCmd -> SetGuidance("Insert X Y and Z dimensions for the position of the center of the Phantom"
71  " respect to that of the \"World\"");
72  changeThePhantomPositionCmd -> SetParameterName("PositionAlongX",
73  "PositionAlongY",
74  "PositionAlongZ", false);
75  changeThePhantomPositionCmd -> SetDefaultUnit("mm");
76  changeThePhantomPositionCmd -> SetUnitCandidates("um mm cm m");
77  changeThePhantomPositionCmd -> AvailableForStates(G4State_Idle);
78 
79 
80  updateCmd = new G4UIcmdWithoutParameter("/changePhantom/update",this);
81  updateCmd->SetGuidance("Update Phantom/Detector geometry.");
82  updateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
83  updateCmd->SetGuidance("if you changed geometrical value(s).");
84  updateCmd->AvailableForStates(G4State_Idle);
85 
86  // Change detector size
87  changeTheDetectorDir = new G4UIdirectory("/changeDetector/");
88  changeTheDetectorDir -> SetGuidance("Command to change the Detector's Size/position/Voxels");
89 
90  changeTheDetectorSizeCmd = new G4UIcmdWith3VectorAndUnit("/changeDetector/size",this);
91  changeTheDetectorSizeCmd -> SetGuidance("Insert sizes for X Y and Z dimensions of the Detector"
92  "\n 0 or negative values mean <<Don't change it>>");
93  changeTheDetectorSizeCmd -> SetParameterName("DetectorSizeAlongX", "DetectorSizeAlongY", "DetectorSizeAlongZ", false);
94  changeTheDetectorSizeCmd -> SetDefaultUnit("mm");
95  changeTheDetectorSizeCmd -> SetUnitCandidates("nm um mm cm");
96  changeTheDetectorSizeCmd -> AvailableForStates(G4State_Idle);
97 
98  // Change the detector to phantom displacement
99  changeTheDetectorToPhantomPositionCmd = new G4UIcmdWith3VectorAndUnit("/changeDetector/displacement",this);
100  changeTheDetectorToPhantomPositionCmd -> SetGuidance("Insert X Y and Z displacements between Detector and Phantom"
101  "\nNegative values mean <<Don't change it!>>");
102  changeTheDetectorToPhantomPositionCmd -> SetParameterName("DisplacementAlongX",
103  "DisplacementAlongY",
104  "DisplacementAlongZ", false);
105  changeTheDetectorToPhantomPositionCmd -> SetDefaultUnit("mm");
106  changeTheDetectorToPhantomPositionCmd -> SetUnitCandidates("nm um mm cm");
107  changeTheDetectorToPhantomPositionCmd -> AvailableForStates(G4State_Idle);
108 
109  // Change voxels by its size
110  changeTheDetectorVoxelCmd = new G4UIcmdWith3VectorAndUnit("/changeDetector/voxelSize",this);
111  changeTheDetectorVoxelCmd -> SetGuidance("Insert Voxel sizes for X Y and Z dimensions"
112  "\n 0 or negative values mean <<Don't change it!>>");
113  changeTheDetectorVoxelCmd -> SetParameterName("VoxelSizeAlongX", "VoxelSizeAlongY", "VoxelSizeAlongZ", false);
114  changeTheDetectorVoxelCmd -> SetDefaultUnit("mm");
115  changeTheDetectorVoxelCmd -> SetUnitCandidates("nm um mm cm");
116  changeTheDetectorVoxelCmd -> AvailableForStates(G4State_Idle);
117  }
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
HadrontherapyDetectorMessenger::~HadrontherapyDetectorMessenger ( )

Definition at line 120 of file HadrontherapyDetectorMessenger.cc.

121 {
122  delete changeThePhantomDir;
123  delete changeThePhantomSizeCmd;
124  delete changeThePhantomPositionCmd;
125  delete changeThePhantomMaterialCmd;
126  delete updateCmd;
127  delete changeTheDetectorDir;
128  delete changeTheDetectorSizeCmd;
129  delete changeTheDetectorToPhantomPositionCmd;
130  delete changeTheDetectorVoxelCmd;
131 }

Member Function Documentation

void HadrontherapyDetectorMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 134 of file HadrontherapyDetectorMessenger.cc.

References CLHEP::Hep3Vector::getX(), CLHEP::Hep3Vector::getY(), and CLHEP::Hep3Vector::getZ().

135 {
136 
137  if( command == changeThePhantomSizeCmd)
138  {
139  G4ThreeVector size = changeThePhantomSizeCmd -> GetNew3VectorValue(newValue);
140  hadrontherapyDetector -> SetPhantomSize(size.getX(),size.getY(),size.getZ());
141  }
142  else if (command == changeThePhantomPositionCmd )
143  {
144  G4ThreeVector size = changeThePhantomPositionCmd -> GetNew3VectorValue(newValue);
145  hadrontherapyDetector -> SetPhantomPosition(size);
146  }
147  else if (command == changeThePhantomMaterialCmd)
148  {
149  hadrontherapyDetector -> SetPhantomMaterial(newValue);
150  }
151  else if (command == changeTheDetectorSizeCmd)
152  {
153  G4ThreeVector size = changeTheDetectorSizeCmd -> GetNew3VectorValue(newValue);
154  hadrontherapyDetector -> SetDetectorSize(size.getX(),size.getY(),size.getZ());
155  }
156  else if (command == changeTheDetectorToPhantomPositionCmd)
157  {
158  G4ThreeVector size = changeTheDetectorToPhantomPositionCmd-> GetNew3VectorValue(newValue);
159  hadrontherapyDetector -> SetDetectorToPhantomPosition(size);
160  }
161  else if (command == changeTheDetectorVoxelCmd)
162  {
163  G4ThreeVector size = changeTheDetectorVoxelCmd -> GetNew3VectorValue(newValue);
164  hadrontherapyDetector -> SetVoxelSize(size.getX(),size.getY(),size.getZ());
165  }
166  else if (command == updateCmd)
167  {
168  hadrontherapyDetector -> UpdateGeometry();
169  }
170 }
double getY() const
double getX() const
double getZ() const

The documentation for this class was generated from the following files: