Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Authors: Susanna Guatelli, susanna@uow.edu.au,
0027 // Authors: Jeremy Davis, jad028@uowmail.edu.au
0028 //
0029 // Code based on the hadrontherapy && radioprotection advanced example
0030 
0031 #include "GammaRayTelPhysicsListMessenger.hh"
0032 #include "GammaRayTelPhysicsList.hh"
0033 
0034 #include "G4UIdirectory.hh"
0035 #include "G4UIcmdWithADoubleAndUnit.hh"
0036 #include "G4UIcmdWithAString.hh"
0037 
0038 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0039 
0040 GammaRayTelPhysicsListMessenger::GammaRayTelPhysicsListMessenger(GammaRayTelPhysicsList *pPhys) : pPhysicsList(pPhys) {
0041     physDir = new G4UIdirectory("/physics/");
0042     physDir->SetGuidance("Commands to activate physics models and set cuts");
0043 
0044     gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/physics/setGCut", this);
0045     gammaCutCmd->SetGuidance("Set gamma cut.");
0046     gammaCutCmd->SetParameterName("Gcut", false);
0047     gammaCutCmd->SetUnitCategory("Length");
0048     gammaCutCmd->SetRange("Gcut>0.0");
0049     gammaCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0050 
0051     electronCutCmd = new G4UIcmdWithADoubleAndUnit("/physics/setECut", this);
0052     electronCutCmd->SetGuidance("Set electron cut.");
0053     electronCutCmd->SetParameterName("Ecut", false);
0054     electronCutCmd->SetUnitCategory("Length");
0055     electronCutCmd->SetRange("Ecut>0.0");
0056     electronCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0057 
0058     protonCutCmd = new G4UIcmdWithADoubleAndUnit("/physics/setPCut", this);
0059     protonCutCmd->SetGuidance("Set positron cut.");
0060     protonCutCmd->SetParameterName("Pcut", false);
0061     protonCutCmd->SetUnitCategory("Length");
0062     protonCutCmd->SetRange("Pcut>0.0");
0063     protonCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0064 
0065     allCutCmd = new G4UIcmdWithADoubleAndUnit("/physics/setCuts", this);
0066     allCutCmd->SetGuidance("Set cut for all.");
0067     allCutCmd->SetParameterName("cut", false);
0068     allCutCmd->SetUnitCategory("Length");
0069     allCutCmd->SetRange("cut>0.0");
0070     allCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0071 
0072     pListCmd = new G4UIcmdWithAString("/physics/addPhysics", this);
0073     pListCmd->SetGuidance("Add physics list.");
0074     pListCmd->SetParameterName("PList", false);
0075     pListCmd->AvailableForStates(G4State_PreInit);
0076 
0077     packageListCmd = new G4UIcmdWithAString("/physics/addPackage", this);
0078     packageListCmd->SetGuidance("Add physics package.");
0079     packageListCmd->SetParameterName("package", false);
0080     packageListCmd->AvailableForStates(G4State_PreInit);
0081 }
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0084 
0085 GammaRayTelPhysicsListMessenger::~GammaRayTelPhysicsListMessenger() {
0086     delete gammaCutCmd;
0087     delete electronCutCmd;
0088     delete protonCutCmd;
0089     delete allCutCmd;
0090     delete pListCmd;
0091     delete physDir;
0092     delete packageListCmd;
0093 }
0094 
0095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0096 
0097 void GammaRayTelPhysicsListMessenger::SetNewValue(G4UIcommand *command, G4String newValue) {
0098     if (command == gammaCutCmd) {
0099         pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));
0100     } else if (command == electronCutCmd) {
0101         pPhysicsList->SetCutForElectron(electronCutCmd->GetNewDoubleValue(newValue));
0102     } else if (command == protonCutCmd) {
0103         pPhysicsList->SetCutForPositron(protonCutCmd->GetNewDoubleValue(newValue));
0104     } else if (command == allCutCmd) {
0105         G4double cut = allCutCmd->GetNewDoubleValue(newValue);
0106         pPhysicsList->SetCutForGamma(cut);
0107         pPhysicsList->SetCutForElectron(cut);
0108         pPhysicsList->SetCutForPositron(cut);
0109     } else if (command == pListCmd) {
0110         pPhysicsList->AddPhysicsList(newValue);
0111     } else if (command == packageListCmd) {
0112         pPhysicsList->AddPackage(newValue);
0113     }
0114 }