62 lines
2.6 KiB
C++
62 lines
2.6 KiB
C++
#include "GeneDetectorConstructionMessenger.hh"
|
|
|
|
#include "G4UIcmdWithADouble.hh"
|
|
#include "G4UIcmdWithADoubleAndUnit.hh"
|
|
#include "G4UIcmdWithAString.hh"
|
|
#include "G4UIdirectory.hh"
|
|
#include "GeneDetectorConstruction.hh"
|
|
|
|
GeneDetectorConstructionMessenger::GeneDetectorConstructionMessenger(GeneDetectorConstruction* pDets)
|
|
: pDetectorConstruction(pDets) {
|
|
DetectorDir = new G4UIdirectory("/Gene/Detector/");
|
|
DetectorDir->SetGuidance("Command to set detector offset");
|
|
|
|
ZoffsetCmd = new G4UIcmdWithADoubleAndUnit("/Gene/Detector/SetZoffset", this);
|
|
ZoffsetCmd->SetGuidance("Set detector Z offset");
|
|
ZoffsetCmd->SetParameterName("Zoffset", false);
|
|
ZoffsetCmd->SetUnitCategory("Length");
|
|
// ZoffsetCmd->SetRange("Zoffset>0");
|
|
ZoffsetCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|
|
|
ZactiveshiftCmd = new G4UIcmdWithADoubleAndUnit("/Gene/Detector/SetZactiveshift", this);
|
|
ZactiveshiftCmd->SetGuidance("Set He3 active region Z shift");
|
|
ZactiveshiftCmd->SetParameterName("Zactiveshift", false);
|
|
ZactiveshiftCmd->SetUnitCategory("Length");
|
|
ZactiveshiftCmd->SetRange("Zactiveshift>-20 && Zactiveshift<20");
|
|
ZactiveshiftCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|
|
|
PE_BfractionCmd = new G4UIcmdWithADouble("/Gene/Detector/SetBfraction", this);
|
|
PE_BfractionCmd->SetGuidance("Set Boron fraction of PE moderator");
|
|
PE_BfractionCmd->SetParameterName("PE_Bfraction", false);
|
|
PE_BfractionCmd->SetRange("PE_Bfraction>=0");
|
|
PE_BfractionCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|
|
|
DetReactionCmd = new G4UIcmdWithAString("/Gene/Detector/SetDetReaction", this);
|
|
DetReactionCmd->SetGuidance("Set type of reaction for detector setup.");
|
|
DetReactionCmd->SetParameterName("DetReaction", false);
|
|
DetReactionCmd->AvailableForStates(G4State_PreInit);
|
|
}
|
|
|
|
GeneDetectorConstructionMessenger::~GeneDetectorConstructionMessenger() {
|
|
delete ZoffsetCmd;
|
|
delete ZactiveshiftCmd;
|
|
delete PE_BfractionCmd;
|
|
delete DetReactionCmd;
|
|
delete DetectorDir;
|
|
}
|
|
|
|
void GeneDetectorConstructionMessenger::SetNewValue(G4UIcommand* command, G4String newValue) {
|
|
if (command == ZoffsetCmd) {
|
|
pDetectorConstruction->SetZoffset(ZoffsetCmd->GetNewDoubleValue(newValue));
|
|
}
|
|
if (command == ZactiveshiftCmd) {
|
|
pDetectorConstruction->SetZactiveshift(ZactiveshiftCmd->GetNewDoubleValue(newValue));
|
|
}
|
|
if (command == PE_BfractionCmd) {
|
|
pDetectorConstruction->SetBfraction(PE_BfractionCmd->GetNewDoubleValue(newValue));
|
|
}
|
|
if (command == DetReactionCmd) {
|
|
pDetectorConstruction->SetDetReaction(newValue);
|
|
}
|
|
}
|