Back to home page

EIC code displayed by LXR

 
 

    


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

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 "PassiveCarbonBeamLineMessenger.hh"
0030 #include "PassiveCarbonBeamLine.hh"
0031 #include "G4UIdirectory.hh"
0032 #include "G4UIcmdWithADoubleAndUnit.hh"
0033 #include "G4UIcmdWithAString.hh"
0034 #include "G4SystemOfUnits.hh"
0035 
0036 PassiveCarbonBeamLineMessenger::PassiveCarbonBeamLineMessenger(PassiveCarbonBeamLine* beamLine)
0037 :passiveCarbon(beamLine)
0038 
0039 {
0040     beamLineDir = new G4UIdirectory("/beamLine/");
0041     beamLineDir -> SetGuidance("set specification of ripple filter");
0042 
0043     RippleFilterDir = new G4UIdirectory("/beamLine/RippleFilter/");
0044     RippleFilterDir -> SetGuidance("set specification of ripple filter");
0045 
0046     finalCollimatorDir = new G4UIdirectory("/beamLine/FinalCollimator/");
0047     finalCollimatorDir -> SetGuidance("set specification of final collimator");
0048 
0049     RippleFilterMatCmd = new G4UIcmdWithAString("/beamLine/RippleFilter/RFMat",this);
0050     RippleFilterMatCmd -> SetGuidance("Set material of ripple filter");
0051     RippleFilterMatCmd -> SetParameterName("choice",false);
0052     RippleFilterMatCmd -> AvailableForStates(G4State_Idle);
0053 
0054     RippleFilterXPositionCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RippleFilter/position",this);
0055     RippleFilterXPositionCmd -> SetGuidance("Set position of ripple filter");
0056     RippleFilterXPositionCmd -> SetParameterName("Size",false);
0057     RippleFilterXPositionCmd -> SetDefaultUnit("mm");  
0058     RippleFilterXPositionCmd -> SetUnitCandidates("mm cm m");  
0059     RippleFilterXPositionCmd -> AvailableForStates(G4State_Idle);
0060 
0061     innerRadiusFinalCollimatorCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimator/halfInnerRad",this);
0062     innerRadiusFinalCollimatorCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
0063     innerRadiusFinalCollimatorCmd -> SetParameterName("Size",false);
0064     innerRadiusFinalCollimatorCmd -> SetDefaultUnit("mm");  
0065     innerRadiusFinalCollimatorCmd -> SetUnitCandidates("mm cm m");  
0066     innerRadiusFinalCollimatorCmd -> AvailableForStates(G4State_Idle);
0067 
0068     }
0069 
0070 PassiveCarbonBeamLineMessenger::~PassiveCarbonBeamLineMessenger()
0071 { 
0072    
0073     delete innerRadiusFinalCollimatorCmd;
0074     delete RippleFilterXPositionCmd;
0075     delete RippleFilterMatCmd;
0076     delete finalCollimatorDir;
0077     delete RippleFilterDir;  
0078     delete beamLineDir;
0079     
0080 }
0081 
0082 
0083 void PassiveCarbonBeamLineMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0084 {
0085     if( command == RippleFilterMatCmd )
0086     { passiveCarbon -> SetRippleFilterMaterial(newValue);
0087     }
0088 
0089     else if( command == RippleFilterXPositionCmd )
0090     { passiveCarbon -> SetRippleFilterXPosition
0091     (RippleFilterXPositionCmd -> GetNewDoubleValue(newValue));
0092     }
0093 
0094     else if( command == innerRadiusFinalCollimatorCmd )
0095     { passiveCarbon -> SetInnerRadiusFinalCollimator
0096     (innerRadiusFinalCollimatorCmd -> GetNewDoubleValue(newValue));
0097     }
0098 
0099     
0100 }
0101