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
00019
00020 #include "MF_Messenger.h"
00021 #include "Magnetic_Field.h"
00022
00023
00024
00025 #include "G4UIdirectory.hh"
00026
00027
00028
00029 MF_Messenger * MF_Messenger::m_pInstance = 0;
00030
00031
00032
00033 using namespace std;
00034
00035
00036
00037
00038
00039 MF_Messenger * MF_Messenger::Instance() {
00040 if( m_pInstance == 0 ) {
00041 m_pInstance = new MF_Messenger();
00042 }
00043 return m_pInstance;
00044 }
00045
00046
00047
00048 MF_Messenger::MF_Messenger() {
00049
00050 MFdir = new G4UIdirectory( "/Olympus/MF/" );
00051 MFdir->SetGuidance( "Magnetic Field user commands." );
00052
00053 }
00054
00055
00056
00057
00058 void MF_Messenger::setMFptr( Magnetic_Field * ptr ) {
00059
00060 pMF = ptr;
00061
00062
00063
00064 MFsetScale = new G4UIcmdWithADouble( "/Olympus/MF/setScale", this );
00065 MFsetScale->SetGuidance( "Set magnetic field scale factor." );
00066 MFsetScale->SetParameterName( "scale", false );
00067 MFsetScale->SetRange( "scale >= -2.0 && scale <= 2.0" );
00068 MFsetScale->AvailableForStates( G4State_Idle );
00069
00070 MFgetScale = new G4UIcmdWithoutParameter( "/Olympus/MF/getScale", this );
00071 MFgetScale->SetGuidance( "Get magnetic field scale factor." );
00072 }
00073
00074
00075
00076 void MF_Messenger::SetNewValue( G4UIcommand * command, G4String newValue ) {
00077
00078
00079
00080 if( command == MFsetScale ) {
00081 pMF->setScale( MFsetScale->GetNewDoubleValue( newValue ) );
00082 G4cout << "Magnetic Field scale = " << newValue << G4endl;
00083 }
00084 else if( command == MFgetScale ) {
00085 G4cout << "Magnetic Field scale = " << pMF->getScale() << G4endl;
00086 }
00087
00088 }
00089
00090
00091
00092 G4String MF_Messenger::GetCurrentValue( G4UIcommand * command ) {
00093 G4String cv;
00094 return cv;
00095 }