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