File indexing completed on 2025-01-31 09:21:47
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
0038
0039
0040
0041
0042
0043 #include <G4ios.hh>
0044 #include "G4GenericMessenger.hh"
0045
0046 #include "ConfigurationManager.hh"
0047
0048 #include <ostream>
0049 #include <string>
0050 ConfigurationManager* ConfigurationManager::fginstance = nullptr;
0051 std::once_flag ConfigurationManager::fginitInstanceFlag;
0052
0053 ConfigurationManager::ConfigurationManager() { DefineCommands(); }
0054
0055 ConfigurationManager::~ConfigurationManager() { delete fMessenger; }
0056
0057 void ConfigurationManager::Print()
0058 {
0059 G4cout << "--------------------------------------------------" << G4endl;
0060 G4cout << "CaTS configuration: " << G4endl;
0061 G4cout << "====================" << G4endl;
0062 G4cout << G4endl;
0063 G4cout << "fenable_verbose: " << fenable_verbose << G4endl;
0064 G4cout << "fdumpgdml: " << fdumpgdml << G4endl;
0065 G4cout << "fGDMLFileName: " << fGDMLFileName << G4endl;
0066 #ifdef WITH_ROOT
0067 G4cout << "fdoAnalysis: " << fdoAnalysis << G4endl;
0068 G4cout << "fHistoFileName: " << fHistoFileName << G4endl;
0069 G4cout << "fwriteHits: " << fwriteHits << G4endl;
0070 G4cout << "fname: " << fname << G4endl;
0071 #endif
0072 G4cout << "fenable_opticks: " << fenable_opticks << G4endl;
0073 G4cout << "fMaxPhotons: " << fMaxPhotons << G4endl;
0074 G4cout << "--------------------------------------------------" << G4endl;
0075 }
0076
0077 void ConfigurationManager::DefineCommands()
0078 {
0079 fMessenger = new G4GenericMessenger(this, "/CaTS/", "Configuring CaTS");
0080
0081
0082 #ifdef WITH_ROOT
0083 auto& HistoFileNameCmd =
0084 fMessenger->DeclareProperty("HistoFileName", fHistoFileName);
0085 HistoFileNameCmd.SetGuidance("Filename for Analysis Histograms");
0086 HistoFileNameCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
0087 HistoFileNameCmd.SetDefaultValue("histograms.root");
0088 auto& writeHitsCmd = fMessenger->DeclareProperty("writeHits", fwriteHits);
0089 writeHitsCmd.SetGuidance("Write out Hits collection");
0090 writeHitsCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
0091 writeHitsCmd.SetDefaultValue("false");
0092 auto& doAnalysisCmd = fMessenger->DeclareProperty("doAnalysis", fdoAnalysis);
0093 doAnalysisCmd.SetGuidance("Do Analysis");
0094 doAnalysisCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
0095 doAnalysisCmd.SetDefaultValue("false");
0096 auto& fnameCmd = fMessenger->DeclareProperty("fname", fname);
0097 fnameCmd.SetGuidance("set fname");
0098 fnameCmd.SetStates(G4State_PreInit);
0099 fnameCmd.SetDefaultValue("Hits");
0100 #endif
0101
0102
0103
0104 auto& enable_opticksCmd =
0105 fMessenger->DeclareProperty("enable_opticks", fenable_opticks);
0106 enable_opticksCmd.SetGuidance(
0107 "use opticks for generating and tracing of optical photons");
0108 enable_opticksCmd.SetDefaultValue("false");
0109 enable_opticksCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
0110 auto& MaxPhotonsCmd = fMessenger->DeclareProperty("MaxPhotons", fMaxPhotons);
0111 MaxPhotonsCmd.SetGuidance(
0112 "set number of photons to be collecetd befores invoking G4Opticks");
0113 MaxPhotonsCmd.SetDefaultValue("1000000");
0114 MaxPhotonsCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
0115
0116
0117
0118
0119 fMessenger->DeclareMethod("list", &ConfigurationManager::Print)
0120 .SetGuidance("Print all configuration parameters")
0121 .SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
0122 auto& verboseCmd = fMessenger->DeclareProperty("verbose", fenable_verbose);
0123 verboseCmd.SetGuidance("Set flag for enabling verbose diagnostic printout");
0124 verboseCmd.SetDefaultValue("false");
0125 verboseCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
0126 auto& GDMLFileNameCmd =
0127 fMessenger->DeclareProperty("GDMLFileName", fGDMLFileName);
0128 GDMLFileNameCmd.SetGuidance(
0129 "Set Filename to dump GDML representation of Geometry");
0130 GDMLFileNameCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
0131 GDMLFileNameCmd.SetDefaultValue("dump.gdml_G4");
0132 auto& dumpgdmlCmd = fMessenger->DeclareProperty("dumpgdml", fdumpgdml);
0133 dumpgdmlCmd.SetGuidance(
0134 "Set flag for enabling dumping the Geometry to a gdml file");
0135 dumpgdmlCmd.SetStates(G4State_PreInit, G4State_Init, G4State_Idle);
0136 dumpgdmlCmd.SetDefaultValue("false");
0137 }