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