Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-01 07:38:57

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file DetectorMessenger.cc
0027 /// \brief Implementation of the DetectorMessenger class
0028 
0029 // This example is provided by the Geant4-DNA collaboration
0030 // Any report or published results obtained using the Geant4-DNA software
0031 // shall cite the following Geant4-DNA collaboration publication:
0032 // Med. Phys. 37 (2010) 4692-4708
0033 // Delage et al. PDB4DNA: implementation of DNA geometry from the Protein Data
0034 //                  Bank (PDB) description for Geant4-DNA Monte-Carlo
0035 //                  simulations (submitted to Comput. Phys. Commun.)
0036 // The Geant4-DNA web site is available at http://geant4-dna.org
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 }