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 "SM_Messenger.h"
00021 #include "SM_SD.h"
00022
00023
00024
00025 #include "G4UIdirectory.hh"
00026
00027
00028
00029 SM_Messenger * SM_Messenger::m_pInstance = 0;
00030
00031
00032
00033 using namespace std;
00034
00035
00036
00037
00038
00039 SM_Messenger * SM_Messenger::Instance() {
00040 if( m_pInstance == 0 ) {
00041 m_pInstance = new SM_Messenger();
00042 }
00043 return m_pInstance;
00044 }
00045
00046
00047
00048 SM_Messenger::SM_Messenger() {
00049
00050 SMdir = new G4UIdirectory( "/Olympus/SM/" );
00051 SMdir->SetGuidance( "OLYMPUS Symmetric Moeller user commands." );
00052
00053 }
00054
00055
00056
00057
00058 void SM_Messenger::setSM_SDptr( SM_SD * ptr ) {
00059
00060 pSM_SD = ptr;
00061
00062 SM_SDdir = new G4UIdirectory( "/Olympus/SM/SD/" );
00063 SM_SDdir->SetGuidance( "Symmetric Moeller Sensitive Detector commands." );
00064
00065
00066
00067 SM_SDsetThreshold = new
00068 G4UIcmdWithADoubleAndUnit( "/Olympus/SM/SD/setThreshold", this );
00069 SM_SDsetThreshold->SetDefaultUnit( "eV" );
00070 SM_SDsetThreshold->SetGuidance( "Set hit threshold." );
00071 SM_SDsetThreshold->SetParameterName( "energy", false );
00072 SM_SDsetThreshold->SetRange( "energy >= 0.0" );
00073 SM_SDsetThreshold->AvailableForStates( G4State_Idle );
00074
00075 SM_SDgetThreshold = new
00076 G4UIcmdWithoutParameter( "/Olympus/SM/SD/getThreshold", this );
00077 SM_SDgetThreshold->SetGuidance( "Get hit threshold." );
00078
00079
00080
00081 SM_SDsetEresol = new
00082 G4UIcmdWithADoubleAndUnit( "/Olympus/SM/SD/setEresol", this );
00083 SM_SDsetEresol->SetDefaultUnit( "eV" );
00084 SM_SDsetEresol->SetGuidance( "Set Energy resolution." );
00085 SM_SDsetEresol->SetParameterName( "E", false );
00086 SM_SDsetEresol->SetRange( "E >= 0.0" );
00087 SM_SDsetEresol->AvailableForStates( G4State_Idle );
00088
00089 SM_SDgetEresol = new
00090 G4UIcmdWithoutParameter( "/Olympus/SM/SD/getEresol", this );
00091 SM_SDgetEresol->SetGuidance( "Get E resolution." );
00092
00093 }
00094
00095
00096
00097 void SM_Messenger::SetNewValue( G4UIcommand * command, G4String newValue ) {
00098
00099
00100
00101 if( command == SM_SDsetThreshold ) {
00102 pSM_SD->setThreshold( SM_SDsetThreshold->GetNewDoubleValue( newValue ) );
00103 G4cout << "SM_SD threshold = " << newValue << G4endl;
00104 }
00105 else if( command == SM_SDgetThreshold ) {
00106 G4cout << "SM_SD threshold = " << pSM_SD->getThreshold() / eV
00107 << " [eV]" << G4endl;
00108 }
00109
00110
00111
00112 else if( command == SM_SDsetEresol ) {
00113 pSM_SD->setEresol( SM_SDsetEresol->GetNewDoubleValue( newValue ) );
00114 G4cout << "SM_SD E resolution = " << newValue << G4endl;
00115 }
00116 else if( command == SM_SDgetEresol ) {
00117 G4cout << "SM_SD E resolution = " << pSM_SD->getEresol() / um
00118 << " [eV]" << G4endl;
00119 }
00120
00121 }
00122
00123
00124
00125 G4String SM_Messenger::GetCurrentValue( G4UIcommand * command ) {
00126 G4String cv;
00127 return cv;
00128 }