File indexing completed on 2026-05-01 07:38:57
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 #include "DetectorMessenger.hh"
0041
0042 #include "DetectorConstruction.hh"
0043
0044 #include "G4UIcmdWithAString.hh"
0045 #include "G4UIcmdWithoutParameter.hh"
0046 #include "G4UIdirectory.hh"
0047
0048
0049
0050 DetectorMessenger::DetectorMessenger(DetectorConstruction* Det)
0051 : G4UImessenger(), fpDetectorConstruction(Det)
0052 {
0053 fpDirectory = new G4UIdirectory("/PDB4DNA/");
0054 fpDirectory->SetGuidance("UI commands of this example");
0055
0056 fpDetDirectory = new G4UIdirectory("/PDB4DNA/det/");
0057 fpDetDirectory->SetGuidance("Detector construction control");
0058
0059 fpLoadPdbCmd = new G4UIcmdWithAString("/PDB4DNA/det/loadPDB", this);
0060 fpLoadPdbCmd->SetGuidance("Load PDB file");
0061 fpLoadPdbCmd->SetParameterName("filename", false);
0062 fpLoadPdbCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0063
0064 fpDrawAtoms = new G4UIcmdWithoutParameter("/PDB4DNA/det/drawAtoms", this);
0065 fpDrawAtoms->SetGuidance("Draw atoms");
0066 fpDrawAtoms->AvailableForStates(G4State_PreInit, G4State_Idle);
0067
0068 fpDrawNucleotides = new G4UIcmdWithoutParameter("/PDB4DNA/det/drawNucleotides", this);
0069 fpDrawNucleotides->SetGuidance("Draw nucleotides with bounding sphere");
0070 fpDrawNucleotides->AvailableForStates(G4State_PreInit, G4State_Idle);
0071
0072 fpDrawResidues = new G4UIcmdWithoutParameter("/PDB4DNA/det/drawResidues", this);
0073 fpDrawResidues->SetGuidance(
0074 "Draw residues inside nucleotides with sphere "
0075 "linked by cylinders");
0076 fpDrawResidues->AvailableForStates(G4State_PreInit, G4State_Idle);
0077
0078 fpBuildBoundingV = new G4UIcmdWithoutParameter("/PDB4DNA/det/buildBoundingV", this);
0079 fpBuildBoundingV->SetGuidance("Build molecule bounding volume");
0080 fpBuildBoundingV->AvailableForStates(G4State_PreInit, G4State_Idle);
0081
0082 fpDrawAtomsWithBounding = new G4UIcmdWithoutParameter("/PDB4DNA/det/drawAtomsWithBounding", this);
0083 fpDrawAtomsWithBounding->SetGuidance("Draw atoms with bounding volume");
0084 fpDrawAtomsWithBounding->AvailableForStates(G4State_PreInit, G4State_Idle);
0085
0086 fpDrawNucleotidesWithBounding =
0087 new G4UIcmdWithoutParameter("/PDB4DNA/det/drawNucleotidesWithBounding", this);
0088 fpDrawNucleotidesWithBounding->SetGuidance(
0089 "Draw nucleotides with bounding sphere and bounding volume");
0090 fpDrawNucleotidesWithBounding->AvailableForStates(G4State_PreInit, G4State_Idle);
0091
0092 fpDrawResiduesWithBounding =
0093 new G4UIcmdWithoutParameter("/PDB4DNA/det/drawResiduesWithBounding", this);
0094 fpDrawResiduesWithBounding->SetGuidance(
0095 "Draw residues inside nucleotides"
0096 " with sphere linked by cylinders and with bounding volume");
0097 fpDrawResiduesWithBounding->AvailableForStates(G4State_PreInit, G4State_Idle);
0098 }
0099
0100
0101
0102 DetectorMessenger::~DetectorMessenger()
0103 {
0104 delete fpLoadPdbCmd;
0105 delete fpDrawAtoms;
0106 delete fpDrawNucleotides;
0107 delete fpDrawResidues;
0108 delete fpBuildBoundingV;
0109 delete fpDrawAtomsWithBounding;
0110 delete fpDrawNucleotidesWithBounding;
0111 delete fpDrawResiduesWithBounding;
0112
0113 delete fpDetDirectory;
0114 delete fpDirectory;
0115 }
0116
0117
0118
0119 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0120 {
0121 if (command == fpLoadPdbCmd) {
0122 fpDetectorConstruction->LoadPDBfile(newValue);
0123 }
0124 if (command == fpDrawAtoms) {
0125 fpDetectorConstruction->DrawAtoms_();
0126 }
0127 if (command == fpDrawNucleotides) {
0128 fpDetectorConstruction->DrawNucleotides_();
0129 }
0130 if (command == fpDrawResidues) {
0131 fpDetectorConstruction->DrawResidues_();
0132 }
0133 if (command == fpBuildBoundingV) {
0134 fpDetectorConstruction->BuildBoundingVolume();
0135 }
0136 if (command == fpDrawAtomsWithBounding) {
0137 fpDetectorConstruction->DrawAtomsWithBounding_();
0138 }
0139 if (command == fpDrawNucleotidesWithBounding) {
0140 fpDetectorConstruction->DrawNucleotidesWithBounding_();
0141 }
0142 if (command == fpDrawResiduesWithBounding) {
0143 fpDetectorConstruction->DrawResiduesWithBounding_();
0144 }
0145 }