40 using namespace G4Analysis;
46 fSetActivationCmd(nullptr),
47 fSetActivationAllCmd(nullptr)
49 fNtupleDir = G4Analysis::make_unique<G4UIdirectory>(
"/analysis/ntuple/");
50 fNtupleDir->SetGuidance(
"ntuple control");
53 SetActivationToAllCmd();
66 void G4NtupleMessenger::SetActivationCmd()
69 ntupleId->SetGuidance(
"Ntuple id");
70 ntupleId->SetParameterRange(
"NtupleId>=0");
72 auto ntupleActivation =
new G4UIparameter(
"NtupleActivation",
's',
true);
73 ntupleActivation->SetGuidance(
"Ntuple activation");
74 ntupleActivation->SetDefaultValue(
"none");
76 fSetActivationCmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/ntuple/setActivation",
this);
77 G4String guidance(
"Set activation for the ntuple of given id");
79 fSetActivationCmd->SetGuidance(guidance);
80 fSetActivationCmd->SetParameter(ntupleId);
81 fSetActivationCmd->SetParameter(ntupleActivation);
86 void G4NtupleMessenger::SetActivationToAllCmd()
89 = G4Analysis::make_unique<G4UIcmdWithABool>(
"/analysis/ntuple/setActivationToAll",
this);
90 G4String guidance(
"Set activation to all ntuples");
91 fSetActivationAllCmd->SetGuidance(guidance);
92 fSetActivationAllCmd->SetParameterName(
"AllNtupleActivation",
false);
102 if ( command == fSetActivationCmd.get() ) {
104 std::vector<G4String> parameters;
118 <<
"\" parameters: " << parameters.size()
125 else if ( command == fSetActivationAllCmd.get() ) {
126 auto activation = fSetActivationAllCmd->GetNewBoolValue(newValues);
std::ostringstream G4ExceptionDescription
G4NtupleMessenger(G4VAnalysisManager *manager)
static G4bool ConvertToBool(const char *st)
static G4int ConvertToInt(const char *st)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const G4String & GetCommandName() const
virtual void SetNewValue(G4UIcommand *command, G4String value) final
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
virtual ~G4NtupleMessenger()
void SetNtupleActivation(G4bool activation)
G4int GetParameterEntries() const