Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "GN_Messenger.h"
00019 #include "Generator.h"
00020
00021
00022
00023 #include "G4UImessenger.hh"
00024 #include "G4UIdirectory.hh"
00025
00026
00027
00028 GN_Messenger * GN_Messenger::m_pInstance = 0;
00029
00030
00031
00032 using namespace std;
00033
00034
00035
00036 GN_Messenger * GN_Messenger::Instance() {
00037 if( m_pInstance == 0 ) {
00038 m_pInstance = new GN_Messenger();
00039 }
00040 return m_pInstance;
00041 }
00042
00043
00044
00045 GN_Messenger::GN_Messenger() {
00046
00047 GNdir = new G4UIdirectory( "/Olympus/GN/" );
00048 GNdir->SetGuidance( "OLYMPUS Generator user commands." );
00049
00050 }
00051
00052 void GN_Messenger::setGNptr( Generator * ptr ) {
00053
00054 pGN = ptr;
00055
00056
00057
00058 GNsetEbeam = new
00059 G4UIcmdWithADoubleAndUnit( "/Olympus/GN/setEbeam", this );
00060 GNsetEbeam->SetDefaultUnit( "MeV" );
00061 GNsetEbeam->SetGuidance( "Set beam kinetic energy." );
00062 GNsetEbeam->SetParameterName( "energy", false );
00063 GNsetEbeam->SetRange( "energy > 0.0" );
00064 GNsetEbeam->AvailableForStates( G4State_Idle );
00065
00066 GNgetEbeam = new
00067 G4UIcmdWithoutParameter( "/Olympus/GN/getEbeam", this );
00068 GNgetEbeam->SetGuidance( "Get beam kinetic energy." );
00069
00070
00071
00072 GNsetBeamCharge = new
00073 G4UIcmdWithAnInteger( "/Olympus/GN/setBeamCharge", this );
00074 GNsetBeamCharge->SetGuidance( "Set beam charge." );
00075 GNsetBeamCharge->SetParameterName( "q", false );
00076 GNsetBeamCharge->SetRange( "q = 1 || q = -1" );
00077 GNsetBeamCharge->AvailableForStates( G4State_Idle );
00078
00079 GNgetBeamCharge = new
00080 G4UIcmdWithoutParameter( "/Olympus/GN/getBeamCharge", this );
00081 GNgetBeamCharge->SetGuidance( "Get beam charge." );
00082
00083
00084
00085 GNsetepThetaMin = new
00086 G4UIcmdWithADoubleAndUnit( "/Olympus/GN/setepThetaMin", this );
00087 GNsetepThetaMin->SetDefaultUnit( "degree" );
00088 GNsetepThetaMin->SetGuidance( "Set ep Theta min." );
00089 GNsetepThetaMin->SetParameterName( "theta", false );
00090 GNsetepThetaMin->SetRange( "theta >= 0.0 && theta <= 180.0" );
00091 GNsetepThetaMin->AvailableForStates( G4State_Idle );
00092
00093 GNgetepThetaMin = new
00094 G4UIcmdWithoutParameter( "/Olympus/GN/getepThetaMin", this );
00095 GNgetepThetaMin->SetGuidance( "Get ep Theta min." );
00096
00097
00098
00099 GNsetepThetaMax = new
00100 G4UIcmdWithADoubleAndUnit( "/Olympus/GN/setepThetaMax", this );
00101 GNsetepThetaMax->SetDefaultUnit( "degree" );
00102 GNsetepThetaMax->SetGuidance( "Set ep Theta min." );
00103 GNsetepThetaMax->SetParameterName( "theta", false );
00104 GNsetepThetaMax->SetRange( "theta >= 0.0 && theta <= 180.0" );
00105 GNsetepThetaMax->AvailableForStates( G4State_Idle );
00106
00107 GNgetepThetaMax = new
00108 G4UIcmdWithoutParameter( "/Olympus/GN/getepThetaMax", this );
00109 GNgetepThetaMax->SetGuidance( "Get ep Theta min." );
00110
00111
00112
00113 GNsetepPhiMin = new
00114 G4UIcmdWithADoubleAndUnit( "/Olympus/GN/setepPhiMin", this );
00115 GNsetepPhiMin->SetDefaultUnit( "degree" );
00116 GNsetepPhiMin->SetGuidance( "Set ep Phi min." );
00117 GNsetepPhiMin->SetParameterName( "phi", false );
00118 GNsetepPhiMin->SetRange( "phi >= -90.0 && phi < 90.0" );
00119 GNsetepPhiMin->AvailableForStates( G4State_Idle );
00120
00121 GNgetepPhiMin = new
00122 G4UIcmdWithoutParameter( "/Olympus/GN/getepPhiMin", this );
00123 GNgetepPhiMin->SetGuidance( "Get ep Phi min." );
00124
00125
00126
00127 GNsetepPhiMax = new
00128 G4UIcmdWithADoubleAndUnit( "/Olympus/GN/setepPhiMax", this );
00129 GNsetepPhiMax->SetDefaultUnit( "degree" );
00130 GNsetepPhiMax->SetGuidance( "Set ep Phi min." );
00131 GNsetepPhiMax->SetParameterName( "phi", false );
00132 GNsetepPhiMax->SetRange( "phi > -90.0 && phi <= 90.0" );
00133 GNsetepPhiMax->AvailableForStates( G4State_Idle );
00134
00135 GNgetepPhiMax = new
00136 G4UIcmdWithoutParameter( "/Olympus/GN/getepPhiMax", this );
00137 GNgetepPhiMax->SetGuidance( "Get ep Phi min." );
00138
00139 }
00140
00141
00142
00143 void GN_Messenger::SetNewValue( G4UIcommand * command, G4String newValue ) {
00144
00145
00146
00147 if( command == GNsetEbeam ) {
00148 pGN->setEbeam( GNsetEbeam->GetNewDoubleValue( newValue ) );
00149 G4cout << "Beam kinetic energy = " << newValue << G4endl;
00150 }
00151 else if( command == GNgetEbeam ) {
00152 G4cout << "Beam kinetic energy = " << pGN->getEbeam() / MeV
00153 << " [MeV]" << G4endl;
00154 }
00155
00156
00157
00158 else if( command == GNsetBeamCharge ) {
00159 pGN->setBeamCharge( GNsetBeamCharge->GetNewIntValue( newValue ) );
00160 G4cout << "Beam charge = " << newValue << G4endl;
00161 }
00162 else if( command == GNgetBeamCharge ) {
00163 G4cout << "Beam charge = " << pGN->getBeamCharge() << G4endl;
00164 }
00165
00166
00167
00168 else if( command == GNsetepThetaMin ) {
00169 pGN->setepThetaMin( GNsetepThetaMin->GetNewDoubleValue( newValue ) );
00170 G4cout << "ep Theta min = " << newValue << G4endl;
00171 }
00172 else if( command == GNgetepThetaMin ) {
00173 G4cout << "ep Theta min = " << pGN->getepThetaMin() / degree
00174 << " [degree]" << G4endl;
00175 }
00176
00177
00178
00179 else if( command == GNsetepThetaMax ) {
00180 pGN->setepThetaMax( GNsetepThetaMax->GetNewDoubleValue( newValue ) );
00181 G4cout << "ep Theta max = " << newValue << G4endl;
00182 }
00183 else if( command == GNgetepThetaMax ) {
00184 G4cout << "ep Theta max = " << pGN->getepThetaMax() / degree
00185 << " [degree]" << G4endl;
00186 }
00187
00188
00189
00190 else if( command == GNsetepPhiMin ) {
00191 pGN->setepPhiMin( GNsetepPhiMin->GetNewDoubleValue( newValue ) );
00192 G4cout << "ep Phi min = " << newValue << G4endl;
00193 }
00194 else if( command == GNgetepPhiMin ) {
00195 G4cout << "ep Phi min = " << pGN->getepPhiMin() / degree
00196 << " [degree]" << G4endl;
00197 }
00198
00199
00200
00201 else if( command == GNsetepPhiMax ) {
00202 pGN->setepPhiMax( GNsetepPhiMax->GetNewDoubleValue( newValue ) );
00203 G4cout << "ep Phi max = " << newValue << G4endl;
00204 }
00205 else if( command == GNgetepPhiMax ) {
00206 G4cout << "ep Phi max = " << pGN->getepPhiMax() / degree
00207 << " [degree]" << G4endl;
00208 }
00209
00210 }
00211
00212
00213
00214 G4String GN_Messenger::GetCurrentValue( G4UIcommand * command ) {
00215 G4String cv;
00216 return cv;
00217 }