source: trunk/examples/advanced/hadrontherapy/src/HadrontherapyDetectorMessenger.cc @ 1029

Last change on this file since 1029 was 807, checked in by garnier, 16 years ago

update

File size: 8.6 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26// $Id: HadrontherapyDetectorMessenger.cc; May 2005
27// ----------------------------------------------------------------------------
28//                 GEANT 4 - Hadrontherapy example
29// ----------------------------------------------------------------------------
30// Code developed by:
31//
32// G.A.P. Cirrone(a)*, F. Di Rosa(a), S. Guatelli(b), G. Russo(a)
33//
34// (a) Laboratori Nazionali del Sud
35//     of the INFN, Catania, Italy
36// (b) INFN Section of Genova, Genova, Italy
37//
38// * cirrone@lns.infn.it
39// ----------------------------------------------------------------------------
40#include "HadrontherapyDetectorMessenger.hh"
41#include "HadrontherapyDetectorConstruction.hh"
42#include "G4UIdirectory.hh"
43#include "G4UIcmdWithADoubleAndUnit.hh"
44#include "G4UIcmdWithAString.hh"
45
46HadrontherapyDetectorMessenger::HadrontherapyDetectorMessenger(
47                                                               HadrontherapyDetectorConstruction* detector)
48  :hadrontherapyDetector(detector)
49{ 
50  modulatorDir = new G4UIdirectory("/modulator/");
51  modulatorDir -> SetGuidance("Command to rotate the modulator wheel");
52 
53  beamLineDir = new G4UIdirectory("/beamLine/");
54  beamLineDir -> SetGuidance("set specification of range shifter"); 
55
56  rangeShifterDir = new G4UIdirectory("/beamLine/RangeShifter/");
57  rangeShifterDir -> SetGuidance("set specification of range shifter"); 
58
59  firstScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil1/");
60  firstScatteringFoilDir -> SetGuidance("set specification of first scattering foil"); 
61 
62  secondScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil2/");
63  secondScatteringFoilDir -> SetGuidance("set specification of second scattering foil"); 
64 
65  rangeStopperDir = new G4UIdirectory("/beamLine/Stopper/");
66  rangeStopperDir -> SetGuidance("set specification of stopper"); 
67
68  finalCollimatorDir = new G4UIdirectory("/beamLine/FinalCollimator/");
69  finalCollimatorDir -> SetGuidance("set specification of final collimator"); 
70
71  modulatorAngleCmd = new G4UIcmdWithADoubleAndUnit("/modulator/angle",this);
72  modulatorAngleCmd -> SetGuidance("Set Modulator Angle");
73  modulatorAngleCmd -> SetParameterName("Size",false);
74  modulatorAngleCmd -> SetRange("Size>=0.");
75  modulatorAngleCmd -> SetUnitCategory("Angle"); 
76  modulatorAngleCmd -> AvailableForStates(G4State_Idle);
77 
78  rangeShifterMatCmd = new G4UIcmdWithAString("/beamLine/RangeShifter/RSMat",this);
79  rangeShifterMatCmd -> SetGuidance("Set material of range shifter");
80  rangeShifterMatCmd -> SetParameterName("choice",false);
81  rangeShifterMatCmd -> AvailableForStates(G4State_Idle);
82 
83  rangeShifterXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/thickness",this);
84  rangeShifterXSizeCmd -> SetGuidance("Set half of the thickness of range shifter along X axis");
85  rangeShifterXSizeCmd -> SetParameterName("Size",false);
86  rangeShifterXSizeCmd -> SetDefaultUnit("mm"); 
87  rangeShifterXSizeCmd -> SetUnitCandidates("mm cm m"); 
88  rangeShifterXSizeCmd -> AvailableForStates(G4State_Idle);
89 
90  rangeShifterXPositionCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/position",this);
91  rangeShifterXPositionCmd -> SetGuidance("Set position of range shifter");
92  rangeShifterXPositionCmd -> SetParameterName("Size",false);
93  rangeShifterXPositionCmd -> SetDefaultUnit("mm"); 
94  rangeShifterXPositionCmd -> SetUnitCandidates("mm cm m"); 
95  rangeShifterXPositionCmd -> AvailableForStates(G4State_Idle);
96 
97  firstScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil1/thickness",this);
98  firstScatteringFoilXSizeCmd -> SetGuidance("Set hlaf thickness of first scattering foil");
99  firstScatteringFoilXSizeCmd -> SetParameterName("Size",false);
100  firstScatteringFoilXSizeCmd -> SetDefaultUnit("mm"); 
101  firstScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m"); 
102  firstScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
103 
104  secondScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil2/thickness",this);
105  secondScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of second scattering foil");
106  secondScatteringFoilXSizeCmd -> SetParameterName("Size",false);
107  secondScatteringFoilXSizeCmd -> SetDefaultUnit("mm"); 
108  secondScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m"); 
109  secondScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
110 
111  outerRadiusStopperCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/Stopper/outRadius",this);
112  outerRadiusStopperCmd -> SetGuidance("Set size of outer radius");
113  outerRadiusStopperCmd -> SetParameterName("Size",false);
114  outerRadiusStopperCmd -> SetDefaultUnit("mm"); 
115  outerRadiusStopperCmd -> SetUnitCandidates("mm cm m"); 
116  outerRadiusStopperCmd -> AvailableForStates(G4State_Idle);
117 
118  innerRadiusFinalCollimatorCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimator/halfInnerRad",this);
119  innerRadiusFinalCollimatorCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
120  innerRadiusFinalCollimatorCmd -> SetParameterName("Size",false);
121  innerRadiusFinalCollimatorCmd -> SetDefaultUnit("mm"); 
122  innerRadiusFinalCollimatorCmd -> SetUnitCandidates("mm cm m"); 
123  innerRadiusFinalCollimatorCmd -> AvailableForStates(G4State_Idle);
124}
125
126HadrontherapyDetectorMessenger::~HadrontherapyDetectorMessenger()
127{ 
128  delete innerRadiusFinalCollimatorCmd; 
129  delete outerRadiusStopperCmd; 
130  delete secondScatteringFoilXSizeCmd; 
131  delete firstScatteringFoilXSizeCmd; 
132  delete rangeShifterXPositionCmd;
133  delete rangeShifterXSizeCmd;
134  delete rangeShifterMatCmd;
135  delete modulatorAngleCmd;
136  delete finalCollimatorDir; 
137  delete rangeStopperDir;
138  delete secondScatteringFoilDir;
139  delete firstScatteringFoilDir; 
140  delete rangeShifterDir; 
141  delete beamLineDir; 
142  delete modulatorDir;   
143}
144
145void HadrontherapyDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
146{ 
147  if( command == modulatorAngleCmd )
148    { hadrontherapyDetector -> SetModulatorAngle
149           (modulatorAngleCmd -> GetNewDoubleValue(newValue));}
150
151  if( command == rangeShifterMatCmd )
152    { hadrontherapyDetector -> SetRSMaterial(newValue);}
153
154  if( command == rangeShifterXSizeCmd )
155    { hadrontherapyDetector -> SetRangeShifterXSize
156            (rangeShifterXSizeCmd -> GetNewDoubleValue(newValue));}
157
158  if( command == rangeShifterXPositionCmd )
159    { hadrontherapyDetector -> SetRangeShifterXPosition
160                  (rangeShifterXPositionCmd -> GetNewDoubleValue(newValue));}
161
162  if( command == firstScatteringFoilXSizeCmd )
163    { hadrontherapyDetector -> SetFirstScatteringFoilSize
164                  (firstScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
165
166  if( command == secondScatteringFoilXSizeCmd )
167    { hadrontherapyDetector -> SetSecondScatteringFoilSize
168                  (secondScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
169
170  if( command == outerRadiusStopperCmd )
171    { hadrontherapyDetector -> SetOuterRadiusStopper(
172                    outerRadiusStopperCmd -> GetNewDoubleValue(newValue));}
173
174  if( command == innerRadiusFinalCollimatorCmd )
175    { hadrontherapyDetector -> SetInnerRadiusFinalCollimator
176                  (innerRadiusFinalCollimatorCmd -> GetNewDoubleValue(newValue));}
177}
178
Note: See TracBrowser for help on using the repository browser.