Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-26 09:19: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 // Hadrontherapy advanced example for Geant4
0027 // See more at: https://twiki.cern.ch/twiki/bin/view/Geant4/AdvancedExamplesHadrontherapy
0028 
0029 
0030 #include "HadrontherapyTIFPAPassiveProtonBeamLine.hh"
0031 #include "HadrontherapyTIFPAPassiveProtonBeamLineMessenger.hh"
0032 #include "G4UIdirectory.hh"
0033 #include "G4UIcmdWithADoubleAndUnit.hh"
0034 #include "G4UIcmdWithAString.hh"
0035 #include "G4SystemOfUnits.hh"
0036 
0037    TrentoPassiveProtonBeamLineMessenger::TrentoPassiveProtonBeamLineMessenger(TrentoPassiveProtonBeamLine* TrentoLine)
0038 :TrentoPassiveProton(TrentoLine)
0039 
0040 {
0041     changeTheBeamLineDir = new G4UIdirectory("/ChangeBeamLine/");
0042     changeTheBeamLineDir -> SetGuidance("Command to change the transport beam line");
0043 
0044     changeTheBeamLineNameCmd = new G4UIcmdWithAString("/ChangeBeamLine/beamLineName",this);
0045     changeTheBeamLineNameCmd -> SetGuidance("Insert the name of the beam line you want simulate");
0046     changeTheBeamLineNameCmd -> SetParameterName("List",false);
0047     changeTheBeamLineNameCmd -> AvailableForStates(G4State_PreInit); 
0048 
0049     modulatorDir = new G4UIdirectory("/modulator/");
0050     modulatorDir -> SetGuidance("Command to rotate the modulator wheel");
0051 
0052     beamLineDir = new G4UIdirectory("/beamLine/");
0053     beamLineDir -> SetGuidance("set specification of range shifter");  
0054 
0055     ScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil/thickness",this);
0056     ScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of scattering foil");
0057     ScatteringFoilXSizeCmd -> SetParameterName("Size",false);
0058     ScatteringFoilXSizeCmd -> SetDefaultUnit("mm");  
0059     ScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");  
0060     ScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
0061 
0062     scatteringFoilMatCmd = new G4UIcmdWithAString("/beamLine/ScatteringFoil/material",this);
0063     scatteringFoilMatCmd -> SetGuidance("Set material of scatterer");
0064     scatteringFoilMatCmd -> SetParameterName("choice",false);
0065     scatteringFoilMatCmd -> AvailableForStates(G4State_Idle);
0066     
0067     preCollimatorXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/preCollimator/XSize",this);
0068     preCollimatorXSizeCmd -> SetGuidance("Set half x side of pre collimator");
0069     preCollimatorXSizeCmd -> SetParameterName("Size",false);
0070     preCollimatorXSizeCmd -> SetDefaultUnit("mm");  
0071     preCollimatorXSizeCmd -> SetUnitCandidates("mm cm m");  
0072     preCollimatorXSizeCmd -> AvailableForStates(G4State_Idle);
0073 
0074     preCollimatorXPositionCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/preCollimator/XPosition",this);
0075     preCollimatorXPositionCmd -> SetGuidance("Set the position along x ");
0076     preCollimatorXPositionCmd -> SetParameterName("Position",false);
0077     preCollimatorXPositionCmd -> SetDefaultUnit("mm");  
0078     preCollimatorXPositionCmd -> SetUnitCandidates("mm cm m");  
0079     preCollimatorXPositionCmd -> AvailableForStates(G4State_Idle);
0080 
0081     AirTubeYSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/airTube/YSide",this);
0082     AirTubeYSizeCmd -> SetGuidance("Set of pre collimator the outer radius of the hole in the collimator ");
0083     AirTubeYSizeCmd -> SetParameterName("Radius",false);
0084     AirTubeYSizeCmd -> SetDefaultUnit("mm");  
0085     AirTubeYSizeCmd -> SetUnitCandidates("mm cm m");  
0086     AirTubeYSizeCmd -> AvailableForStates(G4State_Idle);
0087 
0088     
0089     AirTubeZSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FirstCollimator/innerRadius",this);
0090     AirTubeZSizeCmd -> SetGuidance("Set the inner radius of the collimator ");
0091     AirTubeZSizeCmd -> SetParameterName("Radius",false);
0092     AirTubeZSizeCmd -> SetDefaultUnit("mm");  
0093     AirTubeZSizeCmd -> SetUnitCandidates("mm cm m");  
0094     AirTubeZSizeCmd -> AvailableForStates(G4State_Idle);
0095 
0096 }
0097 
0098 TrentoPassiveProtonBeamLineMessenger::~TrentoPassiveProtonBeamLineMessenger()
0099 { 
0100     delete AirTubeZSizeCmd;
0101     delete AirTubeYSizeCmd;
0102     delete ScatteringFoilXSizeCmd;
0103     delete scatteringFoilMatCmd;
0104     delete preCollimatorXSizeCmd;
0105     delete beamLineDir; 
0106     delete modulatorDir;   
0107 }
0108 
0109 
0110 
0111 
0112 void TrentoPassiveProtonBeamLineMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0113 { 
0114     if( command == ScatteringFoilXSizeCmd )
0115     {TrentoPassiveProton -> SetScatteringFoilXSize
0116     (ScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
0117 
0118      else if( command == scatteringFoilMatCmd )
0119     { TrentoPassiveProton -> SetScattererMaterial(newValue);}
0120 
0121     else if( command == preCollimatorXSizeCmd )
0122     { TrentoPassiveProton -> SetPreCollimatorXSize
0123     (preCollimatorXSizeCmd -> GetNewDoubleValue(newValue));}
0124 
0125     else if( command == preCollimatorXPositionCmd )
0126     { TrentoPassiveProton -> SetPreCollimatorXPosition
0127     (preCollimatorXPositionCmd -> GetNewDoubleValue(newValue));}
0128    
0129     else if( command == AirTubeYSizeCmd )
0130     { TrentoPassiveProton -> SetAirTubeYSize
0131     (AirTubeYSizeCmd -> GetNewDoubleValue(newValue));}
0132 
0133     else if( command == AirTubeZSizeCmd )
0134     { TrentoPassiveProton -> SetAirTubeZSize
0135     (AirTubeZSizeCmd -> GetNewDoubleValue(newValue));}
0136 
0137 }
0138