Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-11 08:04:39

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 // This example is provided by the Geant4-DNA collaboration
0027 // Any report or published results obtained using the Geant4-DNA software
0028 // shall cite the following Geant4-DNA collaboration publication:
0029 // Med. Phys. 37 (2010) 4692-4708
0030 // Delage et al. PDB4DNA: implementation of DNA geometry from the Protein Data
0031 //                  Bank (PDB) description for Geant4-DNA Monte-Carlo
0032 //                  simulations (submitted to Comput. Phys. Commun.)
0033 // The Geant4-DNA web site is available at http://geant4-dna.org
0034 //
0035 //
0036 /// \file DetectorMessenger.cc
0037 /// \brief Implementation of the DetectorMessenger class
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 }