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