Back to home page

EIC code displayed by LXR

 
 

    


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

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