File indexing completed on 2025-02-23 09:21:09
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 #include "HepMCG4AsciiReaderMessenger.hh"
0031
0032 #include "HepMCG4AsciiReader.hh"
0033
0034 #include "G4UIcmdWithAString.hh"
0035 #include "G4UIcmdWithAnInteger.hh"
0036 #include "G4UIcmdWithoutParameter.hh"
0037 #include "G4UIdirectory.hh"
0038
0039
0040 HepMCG4AsciiReaderMessenger::HepMCG4AsciiReaderMessenger(HepMCG4AsciiReader* agen) : gen(agen)
0041 {
0042 dir = new G4UIdirectory("/generator/hepmcAscii/");
0043 dir->SetGuidance("Reading HepMC event from an Ascii file");
0044
0045 verbose = new G4UIcmdWithAnInteger("/generator/hepmcAscii/verbose", this);
0046 verbose->SetGuidance("Set verbose level");
0047 verbose->SetParameterName("verboseLevel", false, false);
0048 verbose->SetRange("verboseLevel>=0 && verboseLevel<=1");
0049
0050 open = new G4UIcmdWithAString("/generator/hepmcAscii/open", this);
0051 open->SetGuidance("(re)open data file (HepMC Ascii format)");
0052 open->SetParameterName("input ascii file", true, true);
0053 }
0054
0055
0056 HepMCG4AsciiReaderMessenger::~HepMCG4AsciiReaderMessenger()
0057 {
0058 delete verbose;
0059 delete open;
0060
0061 delete dir;
0062 }
0063
0064
0065 void HepMCG4AsciiReaderMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
0066 {
0067 if (command == verbose) {
0068 int level = verbose->GetNewIntValue(newValues);
0069 gen->SetVerboseLevel(level);
0070 }
0071 else if (command == open) {
0072 gen->SetFileName(newValues);
0073 G4cout << "HepMC Ascii inputfile: " << gen->GetFileName() << G4endl;
0074 gen->Initialize();
0075 }
0076 }
0077
0078
0079 G4String HepMCG4AsciiReaderMessenger::GetCurrentValue(G4UIcommand* command)
0080 {
0081 G4String cv;
0082
0083 if (command == verbose) {
0084 cv = verbose->ConvertToString(gen->GetVerboseLevel());
0085 }
0086 else if (command == open) {
0087 cv = gen->GetFileName();
0088 }
0089 return cv;
0090 }