File indexing completed on 2025-01-18 09:59:14
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 #include "G4TScoreNtupleWriterMessenger.hh"
0030 #include "G4TScoreNtupleWriter.hh"
0031 #include "G4UImanager.hh"
0032 #include "G4UIcmdWithAString.hh"
0033 #include "G4UIcmdWithAnInteger.hh"
0034
0035
0036 template <typename T>
0037 G4TScoreNtupleWriterMessenger<T>::G4TScoreNtupleWriterMessenger(
0038 G4TScoreNtupleWriter<T>* scoreNtupleWriter)
0039 : G4UImessenger()
0040 , fScoreNtupleWriter(scoreNtupleWriter)
0041 , fWriterFileNameCmd(nullptr)
0042 , fWriterVerboseCmd(nullptr)
0043 {
0044 fDirectory = new G4UIdirectory("/score/ntuple/");
0045 fDirectory->SetGuidance("Interactive score ntuple writer commands.");
0046
0047 fWriterFileNameCmd =
0048 new G4UIcmdWithAString("/score/ntuple/writerFileName", this);
0049 fWriterFileNameCmd->SetGuidance("Set the ntuple writer output file name.");
0050 fWriterFileNameCmd->SetParameterName("outputFileName", false);
0051 fWriterFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0052
0053 fWriterVerboseCmd =
0054 new G4UIcmdWithAnInteger("/score/ntuple/writerVerbose", this);
0055 fWriterVerboseCmd->SetGuidance("Set the ntuple writer verbose level.");
0056 fWriterVerboseCmd->SetParameterName("writerVerbose", false);
0057 fWriterVerboseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0058 }
0059
0060
0061 template <typename T>
0062 G4TScoreNtupleWriterMessenger<T>::~G4TScoreNtupleWriterMessenger()
0063 {
0064 delete fWriterFileNameCmd;
0065 delete fWriterVerboseCmd;
0066 delete fDirectory;
0067 }
0068
0069
0070 template <typename T>
0071 void G4TScoreNtupleWriterMessenger<T>::SetNewValue(G4UIcommand* command,
0072 G4String newVal)
0073 {
0074 if(command == fWriterFileNameCmd)
0075 {
0076 fScoreNtupleWriter->SetFileName(newVal);
0077 }
0078 else if(command == fWriterVerboseCmd)
0079 {
0080 fScoreNtupleWriter->SetVerboseLevel(
0081 fWriterVerboseCmd->GetNewIntValue(newVal));
0082 }
0083 }