File indexing completed on 2025-01-31 09:22:02
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 "DetectorConstructionMessenger.hh"
0031
0032 #include "G4UImessenger.hh"
0033 #include "G4UIcmdWithAString.hh"
0034 #include "G4UIcmdWith3VectorAndUnit.hh"
0035
0036
0037
0038 DetectorConstructionMessenger::DetectorConstructionMessenger(DetectorConstruction* det)
0039 : G4UImessenger(), fDetector(det),fTheDetectorDir(nullptr)
0040 {
0041 fTheDetectorDir = std::make_unique<G4UIdirectory>("/dsbandrepair/det/");
0042 fTheDetectorDir->SetGuidance("Detector control");
0043
0044 fWorldDimensionscmd = std::make_unique<G4UIcmdWith3VectorAndUnit>
0045 ("/dsbandrepair/det/worldBoxSizes",this);
0046 fWorldDimensionscmd->SetGuidance("Set X, Y, Z sizes for world box");
0047 fWorldDimensionscmd->SetParameterName("fSizeX","fSizeY","fSizeZ",false);
0048 fWorldDimensionscmd->AvailableForStates(G4State_PreInit);
0049
0050 fTheCellDefinitionFilecmd = std::make_unique<G4UIcmdWithAString>
0051 ("/dsbandrepair/det/celldefinitionfile",this);
0052 fTheCellDefinitionFilecmd->SetGuidance("Set the path for nucleus definition file");
0053 fTheCellDefinitionFilecmd->SetParameterName("fTheNucleusDefinitionFile",false);
0054 fTheCellDefinitionFilecmd->AvailableForStates(G4State_PreInit);
0055
0056 fTheVoxelDefinitionFilecmd = std::make_unique<G4UIcmdWithAString>
0057 ("/dsbandrepair/det/voxeldefinitionfile",this);
0058 fTheVoxelDefinitionFilecmd->SetGuidance("Set the path for voxel type file");
0059 fTheVoxelDefinitionFilecmd->SetParameterName("fTheVoxelDefinitionFile",false);
0060 fTheVoxelDefinitionFilecmd->AvailableForStates(G4State_PreInit);
0061 }
0062
0063
0064
0065 void DetectorConstructionMessenger::SetNewValue(G4UIcommand* command, G4String value)
0066 {
0067 if (command == fTheCellDefinitionFilecmd.get()) {
0068 fDetector->SetCellDefFilePath(value);
0069 }
0070 if (command == fTheVoxelDefinitionFilecmd.get()) {
0071 fDetector->AddVoxelDefFile(value);
0072 }
0073 if (command == fWorldDimensionscmd.get()) {
0074 auto worldSizesV = fWorldDimensionscmd->GetNew3VectorValue(value);
0075 fDetector->SetWorldBoxSizes(worldSizesV);
0076 }
0077 }
0078
0079