Warning, file /geant4/examples/advanced/gammaray_telescope/src/GammaRayTelPrimaryGeneratorMessenger.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 #include "GammaRayTelPrimaryGeneratorMessenger.hh"
0038 #include "GammaRayTelPrimaryGeneratorAction.hh"
0039 
0040 #include "G4SystemOfUnits.hh"
0041 #include "G4UIcmdWithAnInteger.hh"
0042 #include "G4UIcmdWithAString.hh"
0043 #include "G4UIcmdWithADoubleAndUnit.hh"
0044 #include "G4UIcmdWithABool.hh"
0045 
0046 
0047 
0048 GammaRayTelPrimaryGeneratorMessenger::GammaRayTelPrimaryGeneratorMessenger(GammaRayTelPrimaryGeneratorAction *GammaRayTelGun) : GammaRayTelAction(GammaRayTelGun) {
0049     rndmCmd = new G4UIcmdWithAString("/gun/random", this);
0050     rndmCmd->SetGuidance("Shoot randomly the incident particle.");
0051     rndmCmd->SetGuidance("Choice : on(default), off");
0052     rndmCmd->SetParameterName("choice", true);
0053     rndmCmd->SetDefaultValue("on");
0054     rndmCmd->SetCandidates("on off");
0055     rndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0056 
0057     sourceTypeCmd = new G4UIcmdWithAnInteger("/gun/sourceType", this);
0058     sourceTypeCmd->SetGuidance("Select the type of incident flux.");
0059     sourceTypeCmd->SetGuidance("Choice : 0(default), 1(isotropic), 2(wide parallel beam)");
0060     sourceTypeCmd->SetParameterName("choice", true);
0061     sourceTypeCmd->SetDefaultValue((G4int) 0);
0062     sourceTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0063 
0064     vertexRadiusCmd = new G4UIcmdWithADoubleAndUnit("/gun/vertexRadius", this);
0065     vertexRadiusCmd->SetGuidance("Radius (and unit) of sphere for vertices of incident flux.");
0066     vertexRadiusCmd->SetParameterName("choice", true);
0067     vertexRadiusCmd->SetDefaultValue((G4double) 1. * cm);
0068     vertexRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0069 
0070     spectrumTypeCmd = new G4UIcmdWithAnInteger("/gun/spectrumType", this);
0071     spectrumTypeCmd->SetGuidance("Select the type of incident spectrum.");
0072     spectrumTypeCmd->SetGuidance("Choice : 0(default), 1(), 2(E^{-gamma}), 3()");
0073     spectrumTypeCmd->SetParameterName("choice", true);
0074     spectrumTypeCmd->SetDefaultValue((G4int) 0);
0075     spectrumTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0076 
0077     sourceGenCmd = new G4UIcmdWithABool("/gun/sourceGen", this);
0078     sourceGenCmd->SetGuidance("Select the native Generation");
0079     sourceGenCmd->SetGuidance("  Choice : true(native), false(GPS)");
0080     sourceGenCmd->SetParameterName("choice", true);
0081     sourceGenCmd->SetDefaultValue((G4bool) true);
0082     sourceGenCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0083 }
0084 
0085 
0086 
0087 GammaRayTelPrimaryGeneratorMessenger::~GammaRayTelPrimaryGeneratorMessenger() {
0088     delete rndmCmd;
0089     delete sourceTypeCmd;
0090     delete vertexRadiusCmd;
0091     delete spectrumTypeCmd;
0092     delete sourceGenCmd;
0093 }
0094 
0095 
0096 
0097 void GammaRayTelPrimaryGeneratorMessenger::SetNewValue(G4UIcommand *command, G4String newValue) {
0098     if (command == rndmCmd) {
0099         GammaRayTelAction->SetRndmFlag(newValue);
0100     } else if (command == sourceTypeCmd) {
0101         GammaRayTelAction->SetSourceType(sourceTypeCmd->GetNewIntValue(newValue));
0102     } else if (command == vertexRadiusCmd) {
0103         GammaRayTelAction->SetVertexRadius(vertexRadiusCmd->GetNewDoubleValue(newValue));
0104     } else if (command == spectrumTypeCmd) {
0105         GammaRayTelAction->SetSpectrumType(spectrumTypeCmd->GetNewIntValue(newValue));
0106     } else if (command == sourceGenCmd) {
0107         GammaRayTelAction->SetSourceGen(sourceGenCmd->GetNewBoolValue(newValue));
0108     }
0109 }