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 "MW_Messenger.h"
00021 #include "MW_SD.h"
00022
00023
00024
00025 #include "G4UIdirectory.hh"
00026
00027
00028
00029 MW_Messenger * MW_Messenger::m_pInstance = 0;
00030
00031
00032
00033 using namespace std;
00034
00035
00036
00037
00038
00039 MW_Messenger * MW_Messenger::Instance() {
00040 if( m_pInstance == 0 ) {
00041 m_pInstance = new MW_Messenger();
00042 }
00043 return m_pInstance;
00044 }
00045
00046
00047
00048 MW_Messenger::MW_Messenger() {
00049
00050 MWdir = new G4UIdirectory( "/Olympus/MW/" );
00051 MWdir->SetGuidance( "OLYMPUS MWPC user commands." );
00052
00053 }
00054
00055
00056
00057
00058 void MW_Messenger::setMW_SDptr( MW_SD * ptr ) {
00059
00060 pMW_SD = ptr;
00061
00062 MW_SDdir = new G4UIdirectory( "/Olympus/MW/SD/" );
00063 MW_SDdir->SetGuidance( "MWPC Sensitive Detector commands." );
00064
00065
00066
00067 MW_SDsetThreshold = new
00068 G4UIcmdWithADoubleAndUnit( "/Olympus/MW/SD/setThreshold", this );
00069 MW_SDsetThreshold->SetDefaultUnit( "eV" );
00070 MW_SDsetThreshold->SetGuidance( "Set hit threshold." );
00071 MW_SDsetThreshold->SetParameterName( "energy", false );
00072 MW_SDsetThreshold->SetRange( "energy >= 0.0" );
00073 MW_SDsetThreshold->AvailableForStates( G4State_Idle );
00074
00075 MW_SDgetThreshold = new
00076 G4UIcmdWithoutParameter( "/Olympus/MW/SD/getThreshold", this );
00077 MW_SDgetThreshold->SetGuidance( "Get hit threshold." );
00078
00079
00080
00081 MW_SDsetXresol = new
00082 G4UIcmdWithADoubleAndUnit( "/Olympus/MW/SD/setXresol", this );
00083 MW_SDsetXresol->SetDefaultUnit( "um" );
00084 MW_SDsetXresol->SetGuidance( "Set X resolution." );
00085 MW_SDsetXresol->SetParameterName( "x", false );
00086 MW_SDsetXresol->SetRange( "x >= 0.0" );
00087 MW_SDsetXresol->AvailableForStates( G4State_Idle );
00088
00089 MW_SDgetXresol = new
00090 G4UIcmdWithoutParameter( "/Olympus/MW/SD/getXresol", this );
00091 MW_SDgetXresol->SetGuidance( "Get X resolution." );
00092
00093
00094
00095 MW_SDsetYresol = new
00096 G4UIcmdWithADoubleAndUnit( "/Olympus/MW/SD/setYresol", this );
00097 MW_SDsetYresol->SetDefaultUnit( "um" );
00098 MW_SDsetYresol->SetGuidance( "Set Y resolution." );
00099 MW_SDsetYresol->SetParameterName( "y", false );
00100 MW_SDsetYresol->SetRange( "y >= 0.0" );
00101 MW_SDsetYresol->AvailableForStates( G4State_Idle );
00102
00103 MW_SDgetYresol = new
00104 G4UIcmdWithoutParameter( "/Olympus/MW/SD/getYresol", this );
00105 MW_SDgetYresol->SetGuidance( "Get Y resolution." );
00106
00107 }
00108
00109
00110
00111 void MW_Messenger::SetNewValue( G4UIcommand * command, G4String newValue ) {
00112
00113
00114
00115 if( command == MW_SDsetThreshold ) {
00116 pMW_SD->setThreshold( MW_SDsetThreshold->GetNewDoubleValue( newValue ) );
00117 G4cout << "MW_SD threshold = " << newValue << G4endl;
00118 }
00119 else if( command == MW_SDgetThreshold ) {
00120 G4cout << "MW_SD threshold = " << pMW_SD->getThreshold() / eV
00121 << " [eV]" << G4endl;
00122 }
00123
00124
00125
00126 else if( command == MW_SDsetXresol ) {
00127 pMW_SD->setXresol( MW_SDsetXresol->GetNewDoubleValue( newValue ) );
00128 G4cout << "MW_SD X resolution = " << newValue << G4endl;
00129 }
00130 else if( command == MW_SDgetXresol ) {
00131 G4cout << "MW_SD X resolution = " << pMW_SD->getXresol() / um
00132 << " [um]" << G4endl;
00133 }
00134
00135
00136
00137 else if( command == MW_SDsetYresol ) {
00138 pMW_SD->setYresol( MW_SDsetYresol->GetNewDoubleValue( newValue ) );
00139 G4cout << "MW_SD Y resolution = " << newValue << G4endl;
00140 }
00141 else if( command == MW_SDgetYresol ) {
00142 G4cout << "MW_SD Y resolution = " << pMW_SD->getYresol() / um
00143 << " [um]" << G4endl;
00144 }
00145
00146 }
00147
00148
00149
00150 G4String MW_Messenger::GetCurrentValue( G4UIcommand * command ) {
00151 G4String cv;
00152 return cv;
00153 }