From ade2b3b9f5a6f5a0b8fc417f10353271b66b818d Mon Sep 17 00:00:00 2001 From: Yessica Dominguez <yessicadomin@gmail.com> Date: Tue, 6 Jun 2023 20:56:11 +0000 Subject: [PATCH] Upload New File --- CODE/PrimaryGeneratorMessenger.cc | 54 +++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 CODE/PrimaryGeneratorMessenger.cc diff --git a/CODE/PrimaryGeneratorMessenger.cc b/CODE/PrimaryGeneratorMessenger.cc new file mode 100644 index 0000000..9312fe8 --- /dev/null +++ b/CODE/PrimaryGeneratorMessenger.cc @@ -0,0 +1,54 @@ + +#include "PrimaryGeneratorMessenger.hh" + +#include "PrimaryGeneratorAction.hh" +#include "G4UIdirectory.hh" +#include "G4UIcmdWithADoubleAndUnit.hh" +#include "G4SystemOfUnits.hh" + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +PrimaryGeneratorMessenger:: + PrimaryGeneratorMessenger(PrimaryGeneratorAction* Gun) + : G4UImessenger(), + fAction(Gun) +{ + G4cout << "...PrimaryGeneratorMessenger..." << G4endl; + fGunDir = new G4UIdirectory("//gun/"); + fGunDir->SetGuidance("PrimaryGenerator control"); + + fPolarCmd = + new G4UIcmdWithADoubleAndUnit("//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...... + +PrimaryGeneratorMessenger::~PrimaryGeneratorMessenger() +{ + delete fPolarCmd; + delete fGunDir; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void PrimaryGeneratorMessenger::SetNewValue( + G4UIcommand* command, G4String newValue) +{ + if( command == fPolarCmd ) { + G4double angle = fPolarCmd->GetNewDoubleValue(newValue); + if ( angle == -360.0*deg ) { + fAction->SetOptPhotonPolar(); + } else { + fAction->SetOptPhotonPolar(angle); + } + } +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -- GitLab