Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:18

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 // Hadrontherapy advanced example for Geant4
0027 // See more at: https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy
0028 
0029 #include "HadrontherapyParameterMessenger.hh"
0030 #include "HadrontherapyInteractionParameters.hh"
0031 #include "G4SystemOfUnits.hh"
0032 
0033 #include "G4UIdirectory.hh"
0034 #include "G4UIcmdWithAString.hh"
0035 
0036 HadrontherapyParameterMessenger::HadrontherapyParameterMessenger(HadrontherapyInteractionParameters* param)
0037 :pParam(param)
0038 {
0039     paramDir = new G4UIdirectory("/parameter/");
0040     paramDir -> SetGuidance("Commands to generate stopping power and range");
0041     
0042     dedxCmd = new G4UIcmdWithAString("/parameter/getstopping",this);  
0043     dedxCmd->SetGuidance("Get mass stopping powers"
0044             "\n[usage]: /parameter/getstopping Material [Emin] [Emax] [N] [Particle] [File]" 
0045             "\n         Material:(string) Material name, like G4_H, G4_WATER,..., look at /parameter/nist"
0046             "\n         Emin Emax:(double) minimum and maximum kinetic energy (MeV)"
0047             "\n         N:(double) [number of points]"
0048             "\n         Particle:(string) Particle name, look at /particle/list"
0049             "\n         File:(string) Name for the output file."
0050             "\nDefault values for parameters inside [] are respectively:"
0051             "\n \"1 MeV\", \"Emin\", \"1\", \"proton\", \"stdout\"");
0052     dedxCmd->SetParameterName("inputData",false);
0053     dedxCmd->AvailableForStates(G4State_Idle);  
0054 
0055     listCmd = new G4UIcmdWithAString("/parameter/nist",this);  
0056     listCmd -> SetGuidance("Print NIST elements/materials.\nParameters:"
0057                 "\n\t all: will print elements and compounds"
0058                 "\n\t simple: will print elements only"
0059                 "\n\t compound: will print compounds only"
0060                 "\n\t hep: will print hep compounds"
0061                 "\n\t list: will print a simple full list of all elements and compounds");
0062     listCmd -> SetParameterName("String",true);
0063     listCmd -> SetDefaultValue("list");
0064     listCmd -> SetCandidates("all simple compound hep list");
0065     listCmd ->AvailableForStates(G4State_Idle);  
0066     //Available G4 States (G4State_PreInit, G4State_Init, G4State_Idle,G4State_GeomClosed, G4State_EventProc);  
0067 }
0068 HadrontherapyParameterMessenger::~HadrontherapyParameterMessenger()
0069 {
0070     delete paramDir;
0071     delete dedxCmd;
0072     delete listCmd;
0073 }
0074 
0075 void HadrontherapyParameterMessenger::SetNewValue(G4UIcommand* command, G4String vararg)
0076 {
0077     if (command == dedxCmd)
0078     {
0079         pParam -> GetStoppingTable(vararg);
0080     }
0081     else if (command == listCmd)
0082     {
0083         pParam -> ListOfNistMaterials(vararg);
0084     }
0085 }
0086