File indexing completed on 2025-01-31 09:21:53
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #include <G4UIcmdWithADouble.hh>
0045 #include <G4UIcmdWithADoubleAndUnit.hh>
0046 #include "CexmcPrimaryGeneratorAction.hh"
0047 #include "CexmcPrimaryGeneratorActionMessenger.hh"
0048 #include "CexmcMessenger.hh"
0049
0050
0051 CexmcPrimaryGeneratorActionMessenger::CexmcPrimaryGeneratorActionMessenger(
0052 CexmcPrimaryGeneratorAction * primaryGeneratorAction_ ) :
0053 primaryGeneratorAction( primaryGeneratorAction_ ),
0054 fwhmPosX( NULL ), fwhmPosY( NULL ), fwhmDirX( NULL ), fwhmDirY( NULL ),
0055 fwhmMomentumAmp( NULL )
0056 {
0057 fwhmPosX = new G4UIcmdWithADoubleAndUnit(
0058 ( CexmcMessenger::gunDirName + "fwhmPosX" ).c_str(), this );
0059 fwhmPosX->SetGuidance( "Set positional fwhm of the beam along X axis" );
0060 fwhmPosX->SetParameterName( "FwhmPosX", false );
0061 fwhmPosX->SetDefaultValue( 0 );
0062 fwhmPosX->SetUnitCandidates( "mm cm m" );
0063 fwhmPosX->SetDefaultUnit( "cm" );
0064 fwhmPosX->AvailableForStates( G4State_PreInit, G4State_Idle );
0065
0066 fwhmPosY = new G4UIcmdWithADoubleAndUnit(
0067 ( CexmcMessenger::gunDirName + "fwhmPosY" ).c_str(), this );
0068 fwhmPosY->SetGuidance( "Set positional fwhm of the beam along Y axis" );
0069 fwhmPosY->SetParameterName( "FwhmPosY", false );
0070 fwhmPosY->SetDefaultValue( 0 );
0071 fwhmPosY->SetUnitCandidates( "mm cm m" );
0072 fwhmPosY->SetDefaultUnit( "cm" );
0073 fwhmPosY->AvailableForStates( G4State_PreInit, G4State_Idle );
0074
0075 fwhmDirX = new G4UIcmdWithADoubleAndUnit(
0076 ( CexmcMessenger::gunDirName + "fwhmDirX" ).c_str(), this );
0077 fwhmDirX->SetGuidance( "Set directional fwhm of the beam along X axis" );
0078 fwhmDirX->SetParameterName( "FwhmDirX", false );
0079 fwhmDirX->SetDefaultValue( 0 );
0080 fwhmDirX->SetUnitCandidates( "deg rad" );
0081 fwhmDirX->SetDefaultUnit( "deg" );
0082 fwhmDirX->AvailableForStates( G4State_PreInit, G4State_Idle );
0083
0084 fwhmDirY = new G4UIcmdWithADoubleAndUnit(
0085 ( CexmcMessenger::gunDirName + "fwhmDirY" ).c_str(), this );
0086 fwhmDirY->SetGuidance( "Set directional fwhm of the beam along Y axis" );
0087 fwhmDirY->SetParameterName( "FwhmDirY", false );
0088 fwhmDirY->SetDefaultValue( 0 );
0089 fwhmDirY->SetUnitCandidates( "deg rad" );
0090 fwhmDirY->SetDefaultUnit( "deg" );
0091 fwhmDirY->AvailableForStates( G4State_PreInit, G4State_Idle );
0092
0093 fwhmMomentumAmp = new G4UIcmdWithADouble(
0094 ( CexmcMessenger::gunDirName + "fwhmMomentumAmp" ).c_str(), this );
0095 fwhmMomentumAmp->SetGuidance( "Set fwhm of the beam momentum as fraction "
0096 "of its value" );
0097 fwhmMomentumAmp->SetParameterName( "FwhmMomentumAmp", false );
0098 fwhmMomentumAmp->SetDefaultValue( 0 );
0099 fwhmMomentumAmp->AvailableForStates( G4State_PreInit, G4State_Idle );
0100 }
0101
0102
0103 CexmcPrimaryGeneratorActionMessenger::~CexmcPrimaryGeneratorActionMessenger()
0104 {
0105 delete fwhmPosX;
0106 delete fwhmPosY;
0107 delete fwhmDirX;
0108 delete fwhmDirY;
0109 delete fwhmMomentumAmp;
0110 }
0111
0112
0113 void CexmcPrimaryGeneratorActionMessenger::SetNewValue( G4UIcommand * cmd,
0114 G4String value )
0115 {
0116 do
0117 {
0118 if ( cmd == fwhmPosX )
0119 {
0120 primaryGeneratorAction->SetFwhmPosX(
0121 G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0122 break;
0123 }
0124 if ( cmd == fwhmPosY )
0125 {
0126 primaryGeneratorAction->SetFwhmPosY(
0127 G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0128 break;
0129 }
0130 if ( cmd == fwhmDirX )
0131 {
0132 primaryGeneratorAction->SetFwhmDirX(
0133 G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0134 break;
0135 }
0136 if ( cmd == fwhmDirY )
0137 {
0138 primaryGeneratorAction->SetFwhmDirY(
0139 G4UIcmdWithADoubleAndUnit::GetNewDoubleValue( value ) );
0140 break;
0141 }
0142 if ( cmd == fwhmMomentumAmp )
0143 {
0144 primaryGeneratorAction->SetFwhmMomentumAmp(
0145 G4UIcmdWithADouble::GetNewDoubleValue( value ) );
0146 break;
0147 }
0148 } while ( false );
0149 }
0150