15 #include "G4UImanager.hh" 16 #include "G4UIdirectory.hh" 17 #include "G4UIcmdWithAString.hh" 18 #include "G4UIcmdWithAnInteger.hh" 19 #include "G4UIcmdWithADoubleAndUnit.hh" 20 #include "G4UIcmdWithoutParameter.hh" 21 #include "G4GDMLParser.hh" 22 #include "G4UnitsTable.hh" 32 fEDepSimDir->SetGuidance(
"EDepSim detector control.");
34 fUpdateCmd =
new G4UIcmdWithoutParameter(
"/edep/update",
this);
35 fUpdateCmd->SetGuidance(
"Do the run manager initialization." 36 " This causes the geometry to be built." 37 " This MUST be applied before \"/run/beamOn\".");
38 fUpdateCmd->AvailableForStates(G4State_PreInit);
40 fPrintMassCmd =
new G4UIcmdWithAString(
"/edep/printMass",
this);
43 "Print the mass of the first physical volume containing the sub-string." 44 " (set before update)");
47 fValidateCmd =
new G4UIcmdWithoutParameter(
"/edep/validateGeometry",
this);
49 "Check the geometry for overlaps (set before update).");
52 fExportCmd =
new G4UIcmdWithAString(
"/edep/export",
this);
54 "Export the geometry to a file. This is not compatible with event\n" 55 "generation, or reading of kinematics files.");
56 fExportCmd->SetParameterName(
"RootFile",
false);
58 fGDMLDir =
new G4UIdirectory(
"/edep/gdml/");
59 fGDMLDir->SetGuidance(
"Control over the gdml file.");
61 fGDMLCmd =
new G4UIcmdWithAString(
"/edep/gdml/read",
this);
62 fGDMLCmd->SetGuidance(
"Define a GDML file to be used for the geometry.");
63 fGDMLCmd->AvailableForStates(G4State_PreInit);
65 fControlCmd =
new G4UIcommand(
"/edep/control",
this);
67 "Set the run conditions for this simulation. This takes the name\n" 68 "of a run condition and a version. This is translated into a G4\n" 69 "macro file which is executed. The run condition macros are saved\n" 70 "in the <package-root>/src directory (e.g. src/baseline-1.0.mac). " 74 par =
new G4UIparameter(
's');
75 par->SetParameterName(
"Name");
79 par =
new G4UIparameter(
's');
80 par->SetParameterName(
"Version");
85 "Set the maximum sagitta for hit segments.");
89 par =
new G4UIparameter(
"Sensitive",
's',
false);
93 par =
new G4UIparameter(
"Sagitta",
'd',
false);
97 par =
new G4UIparameter(
"Unit",
's',
false);
102 "Set the length for hit segments to stop growing.");
106 par =
new G4UIparameter(
"Sensitive",
's',
false);
110 par =
new G4UIparameter(
"Length",
'd',
false);
114 par =
new G4UIparameter(
"Unit",
's',
false);
119 "Exclude logical volumes from being sensitive.");
123 par =
new G4UIparameter(
"LogicalVolume",
's',
false);
161 EDepSimLog(
"Read a gdml geometry from |" << newValue <<
"|");
163 if (gdmlParser)
delete gdmlParser;
164 gdmlParser =
new G4GDMLParser;
168 gdmlParser->Read(newValue,
false);
171 std::istringstream
input((
const char*)newValue);
181 #define STRINGIFY(s) #s 182 #define STRINGIFY_DEFINITION(s) STRINGIFY(s) 186 =
std::remove(packageroot.begin(), packageroot.end(),
'"');
187 packageroot.erase(new_end, packageroot.end());
189 + name +
"-" + version +
".mac";
193 G4UImanager* UI = G4UImanager::GetUIpointer();
194 UI->ApplyCommand(
"/control/execute " + file);
197 std::istringstream
input((
const char*)newValue);
201 input >> sdName >> sagitta >> unitName;
202 sagitta *= G4UnitDefinition::GetValueOf(unitName);
209 std::cout <<
"Invalid sensitive detector" <<
std::endl;
213 std::istringstream
input((
const char*)newValue);
217 input >> sdName >> length >> unitName;
218 length *= G4UnitDefinition::GetValueOf(unitName);
225 std::cout <<
"Invalid sensitive detector" <<
std::endl;
229 std::istringstream
input((
const char*)newValue);
#define EDepSimLog(outStream)
virtual void ShouldPrintMass(std::string name)
A method to request that a volume mass should be printed;.
G4UIcmdWithoutParameter * fUpdateCmd
G4GDMLParser * GetGDMLParser()
Get the GDML parser that this class is using.
void AddExcludedSensitiveDetector(std::string exclude)
G4UIdirectory * fEDepSimDir
G4UIcommand * fControlCmd
void SetNewValue(G4UIcommand *, G4String)
void SetMaximumHitLength(double length)
void Export(const char *file)
Export the geometry to a file.
G4UIcmdWithAString * fExportCmd
G4UIcommand * fHitExcludedCmd
G4VSensitiveDetector * MakeSD(G4String name)
G4UIcmdWithAString * fPrintMassCmd
DetectorMessenger(EDepSim::UserDetectorConstruction *)
std::string getenv(std::string const &name)
G4UIcmdWithoutParameter * fValidateCmd
EDepSim::UserDetectorConstruction * fConstruction
G4UIcmdWithAString * fGDMLCmd
void SetGDMLParser(G4GDMLParser *parser)
Set the GDML parser that this class should use.
void ValidateGeometry()
Set ValidateGeomtry to true.
void SetMaximumHitSagitta(double sagitta)
virtual ~DetectorMessenger()
G4UIcommand * fHitSagittaCmd
#define STRINGIFY_DEFINITION(s)
QTextStream & endl(QTextStream &s)
G4UIcommand * fHitLengthCmd
static EDepSim::RootGeometryManager * Get(void)
If a persistency manager has not been created, create one.