Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-23 07:54: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 /// \file PhysicsListMessenger.cc
0027 /// \brief Implementation of the PhysicsListMessenger class
0028 
0029 /////////////////////////////////////////////////////////////////////////
0030 //
0031 // PhysicsListMessenger
0032 //
0033 // Created: 31.01.2006 V.Ivanchenko
0034 //
0035 // Modified:
0036 // 04.06.2006 Adoptation of Hadr01 (V.Ivanchenko)
0037 //
0038 ////////////////////////////////////////////////////////////////////////
0039 //
0040 //
0041 
0042 #include "PhysicsListMessenger.hh"
0043 
0044 #include "PhysicsList.hh"
0045 
0046 #include "G4UIcmdWithAString.hh"
0047 #include "G4UIcmdWithoutParameter.hh"
0048 
0049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0050 
0051 PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
0052   : G4UImessenger(), fPhysicsList(pPhys)
0053 {
0054   fPListCmd = new G4UIcmdWithAString("/testhadr/Physics", this);
0055   fPListCmd->SetGuidance("Add modular physics list.");
0056   fPListCmd->SetParameterName("PList", false);
0057   fPListCmd->AvailableForStates(G4State_PreInit);
0058 
0059   fListCmd = new G4UIcmdWithoutParameter("/testhadr/ListPhysics", this);
0060   fListCmd->SetGuidance("Available Physics Lists");
0061   fListCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0062 }
0063 
0064 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0065 
0066 PhysicsListMessenger::~PhysicsListMessenger()
0067 {
0068   delete fPListCmd;
0069   delete fListCmd;
0070 }
0071 
0072 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0073 
0074 void PhysicsListMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0075 {
0076   if (command == fPListCmd) {
0077     if (fPhysicsList) {
0078       G4String name = newValue;
0079       if (name == "PHYSLIST") {
0080         char* path = std::getenv(name);
0081         if (path)
0082           name = G4String(path);
0083         else {
0084           G4cout << "### PhysicsListMessenger WARNING: "
0085                  << " environment variable PHYSLIST is not defined" << G4endl;
0086           return;
0087         }
0088       }
0089       fPhysicsList->AddPhysicsList(name);
0090     }
0091     else {
0092       G4cout << "### PhysicsListMessenger WARNING: "
0093              << " /testhadr/Physics UI command is not available "
0094              << "for reference Physics List" << G4endl;
0095     }
0096   }
0097   else if (command == fListCmd) {
0098     if (fPhysicsList) {
0099       fPhysicsList->List();
0100     }
0101     else {
0102       G4cout << "### PhysicsListMessenger WARNING: "
0103              << " /testhadr/ListPhysics UI command is not available "
0104              << "for reference Physics List" << G4endl;
0105     }
0106   }
0107 }
0108 
0109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......