Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HadrontherapyDetectorMessenger Class Reference

#include <HadrontherapyDetectorMessenger.hh>

Inheritance diagram for HadrontherapyDetectorMessenger:
Collaboration diagram for HadrontherapyDetectorMessenger:

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
 
G4bool CommandsShouldBeInMaster () 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
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 41 of file HadrontherapyDetectorMessenger.hh.

Constructor & Destructor Documentation

HadrontherapyDetectorMessenger::HadrontherapyDetectorMessenger ( HadrontherapyDetectorConstruction detector)

Definition at line 39 of file HadrontherapyDetectorMessenger.cc.

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

Here is the call graph for this function:

HadrontherapyDetectorMessenger::~HadrontherapyDetectorMessenger ( )

Definition at line 116 of file HadrontherapyDetectorMessenger.cc.

117 {
118  delete changeThePhantomDir;
119  delete changeThePhantomSizeCmd;
120  delete changeThePhantomPositionCmd;
121  delete changeThePhantomMaterialCmd;
122  delete updateCmd;
123  delete changeTheDetectorDir;
124  delete changeTheDetectorSizeCmd;
125  delete changeTheDetectorToPhantomPositionCmd;
126  delete changeTheDetectorVoxelCmd;
127 }

Member Function Documentation

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

Reimplemented from G4UImessenger.

Definition at line 130 of file HadrontherapyDetectorMessenger.cc.

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

Here is the call graph for this function:


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