#include "PrtPrimaryGeneratorMessenger.h" #include "PrtPrimaryGeneratorAction.h" #include "G4UIdirectory.hh" #include "G4UIcmdWithADoubleAndUnit.hh" #include "G4SystemOfUnits.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... PrtPrimaryGeneratorMessenger:: PrtPrimaryGeneratorMessenger(PrtPrimaryGeneratorAction* PrtGun) : G4UImessenger(), fPrtAction(PrtGun) { fGunDir = new G4UIdirectory("/Prt/gun/"); fGunDir->SetGuidance("PrimaryGenerator control"); fPolarCmd = new G4UIcmdWithADoubleAndUnit("/Prt/gun/optPhotonPolar",this); fPolarCmd->SetGuidance("Set linear polarization"); fPolarCmd->SetGuidance(" angle w.r.t. (k,n) plane"); fPolarCmd->SetParameterName("angle",true); fPolarCmd->SetUnitCategory("Angle"); fPolarCmd->SetDefaultValue(-360.0); fPolarCmd->SetDefaultUnit("deg"); fPolarCmd->AvailableForStates(G4State_Idle); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... PrtPrimaryGeneratorMessenger::~PrtPrimaryGeneratorMessenger() { delete fPolarCmd; delete fGunDir; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void PrtPrimaryGeneratorMessenger::SetNewValue( G4UIcommand* command, G4String newValue) { if( command == fPolarCmd ) { G4double angle = fPolarCmd->GetNewDoubleValue(newValue); if ( angle == -360.0*deg ) { fPrtAction->SetOptPhotonPolar(); } else { fPrtAction->SetOptPhotonPolar(angle); } } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......