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 // This is the *BASIC* version of Hadrontherapy, a Geant4-based application
0027 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy
0028 //
0029 // Visit the Hadrontherapy web site (http://www.lns.infn.it/link/Hadrontherapy) to request 
0030 // the *COMPLETE* version of this program, together with its documentation;
0031 // Hadrontherapy (both basic and full version) are supported by the Italian INFN
0032 // Institute in the framework of the MC-INFN Group
0033 //
0034 
0035 
0036 #include "HadrontherapyModulatorMessenger.hh"
0037 #include "HadrontherapyModulator.hh"
0038 #include "G4UIdirectory.hh"
0039 #include "G4UIcmdWithADoubleAndUnit.hh"
0040 #include "G4UIcmdWithAString.hh"
0041 #include "G4UIcmdWith3VectorAndUnit.hh"
0042 
0043 
0044     HadrontherapyModulatorMessenger::HadrontherapyModulatorMessenger(HadrontherapyModulator* Mod)
0045 :Modulator(Mod)
0046 
0047 {
0048     modulatorDir = new G4UIdirectory("/modulator/");
0049     modulatorDir -> SetGuidance("Command to change the modulator wheel proprties");
0050 
0051     modulatorMatCmd = new G4UIcmdWithAString("/modulator/RMWMat",this);
0052     modulatorMatCmd -> SetGuidance("Set material of modulatorWheel");
0053     modulatorMatCmd -> SetParameterName("Material",false);
0054     modulatorMatCmd -> AvailableForStates(G4State_Idle);
0055     
0056     modulatorExternalFile=new G4UIcmdWithAString("/modulator/ReadData",this);
0057     modulatorExternalFile -> SetGuidance("set properties of modulator steps via a external file");
0058     modulatorExternalFile -> SetParameterName("FileName",true,false);
0059     modulatorExternalFile -> SetDefaultValue ("default");
0060     modulatorExternalFile -> AvailableForStates(G4State_Idle);
0061 
0062     modulatorPositionCmd = new G4UIcmdWith3VectorAndUnit("/modulator/position",this);
0063     modulatorPositionCmd -> SetGuidance("Set position of modulato");
0064     modulatorPositionCmd -> SetParameterName("PositionAlongX", 
0065                             "PositionAlongY", 
0066                             "PositionAlongZ",false);
0067     modulatorPositionCmd -> SetDefaultUnit("mm");  
0068     modulatorPositionCmd -> SetUnitCandidates("mm cm m");  
0069     modulatorPositionCmd -> AvailableForStates(G4State_Idle);
0070 
0071  
0072     modulatorOuterRadiusCmd = new G4UIcmdWithADoubleAndUnit("/modulator/outRadius",this);
0073     modulatorOuterRadiusCmd -> SetGuidance("Set size of outer radius");
0074     modulatorOuterRadiusCmd-> SetParameterName("Size",false);
0075     modulatorOuterRadiusCmd -> SetDefaultUnit("mm");  
0076     modulatorOuterRadiusCmd-> SetUnitCandidates("mm cm m");  
0077     modulatorOuterRadiusCmd-> AvailableForStates(G4State_Idle);
0078 
0079     modulatorInnerRadiusCmd = new G4UIcmdWithADoubleAndUnit("/modulator/innerRadius",this);
0080     modulatorInnerRadiusCmd -> SetGuidance("Set size of inner radius");
0081     modulatorInnerRadiusCmd-> SetParameterName("Size",false);
0082     modulatorInnerRadiusCmd -> SetDefaultUnit("mm");  
0083     modulatorInnerRadiusCmd-> SetUnitCandidates("mm cm m");  
0084     modulatorInnerRadiusCmd-> AvailableForStates(G4State_Idle);
0085 
0086     modulatorAngleCmd = new G4UIcmdWithADoubleAndUnit("/modulator/angle",this);
0087     modulatorAngleCmd -> SetGuidance("Set Modulator Angle");
0088     modulatorAngleCmd -> SetParameterName("Size",false);
0089     modulatorAngleCmd -> SetRange("Size>=0.");
0090     modulatorAngleCmd -> SetUnitCategory("Angle");  
0091     modulatorAngleCmd -> AvailableForStates(G4State_Idle);
0092 }
0093 
0094  HadrontherapyModulatorMessenger::~ HadrontherapyModulatorMessenger()
0095 { 
0096     delete modulatorAngleCmd;  
0097     delete modulatorMatCmd;  
0098     delete modulatorPositionCmd; 
0099     delete modulatorInnerRadiusCmd; 
0100     delete modulatorOuterRadiusCmd;
0101     delete modulatorDir;   
0102 }
0103 
0104 
0105 
0106 
0107 void  HadrontherapyModulatorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0108 { 
0109     if( command == modulatorAngleCmd )
0110     {Modulator -> SetModulatorAngle
0111      (modulatorAngleCmd -> GetNewDoubleValue(newValue));}
0112 
0113    else if( command == modulatorMatCmd )
0114    {Modulator -> SetModulatorMaterial(newValue);}
0115    
0116     else if (command== modulatorExternalFile)
0117      {Modulator->GetDataFromFile(newValue);}
0118 
0119    else if( command == modulatorPositionCmd )
0120     { G4ThreeVector size = modulatorPositionCmd-> GetNew3VectorValue(newValue);
0121     Modulator -> SetModulatorPosition(size);}
0122 
0123    else if( command == modulatorOuterRadiusCmd )
0124    { Modulator -> SetModulatorOuterRadius(
0125     modulatorOuterRadiusCmd -> GetNewDoubleValue(newValue));}
0126 
0127     else if( command == modulatorInnerRadiusCmd )
0128     { Modulator -> SetModulatorInnerRadius(
0129      modulatorInnerRadiusCmd -> GetNewDoubleValue(newValue));}
0130 }
0131