Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-24 07:53:04

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 XSHistoManagerMessenger.cc
0027 /// \brief Implementation of the XSHistoManagerMessenger class
0028 
0029 //
0030 //  Author: G.Hugo, 06 January 2023
0031 //
0032 // ***************************************************************************
0033 //
0034 //      XSHistoManagerMessenger
0035 //
0036 ///  UI commands for XS study.
0037 //
0038 // ***************************************************************************
0039 
0040 #include "XSHistoManagerMessenger.hh"
0041 
0042 #include "XSHistoManager.hh"
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 XSHistoManagerMessenger::XSHistoManagerMessenger(XSHistoManager* const histoManager)
0047   : fHisto(histoManager),
0048     fOutputFileNameCmd(G4UIcmdWithAString("/allXS/outputFileName", this)),
0049     fParticleNameCmd(G4UIcmdWithAString("/allXS/particleName", this)),
0050     fElementNameCmd(G4UIcmdWithAString("/allXS/elementName", this)),
0051     fNonElementaryMaterialNameCmd(G4UIcmdWithAString("/allXS/nonElementaryMaterialName", this)),
0052     fNumBinsCmd(G4UIcmdWithAnInteger("/allXS/numBins", this)),
0053     fMinKineticEnergyCmd(G4UIcmdWithADoubleAndUnit("/allXS/minKineticEnergy", this)),
0054     fMaxKineticEnergyCmd(G4UIcmdWithADoubleAndUnit("/allXS/maxKineticEnergy", this))
0055 {
0056   fOutputFileNameCmd.SetGuidance("Set output file name (histograms).");
0057 
0058   fParticleNameCmd.SetGuidance("Set particle name.");
0059   fParticleNameCmd.SetParameterName("particleName", false);
0060   fParticleNameCmd.AvailableForStates(G4State_PreInit, G4State_Idle);
0061 
0062   fElementNameCmd.SetGuidance("Set target element name.");
0063   fElementNameCmd.SetParameterName("elementName", false);
0064   fElementNameCmd.AvailableForStates(G4State_PreInit, G4State_Idle);
0065 
0066   fNonElementaryMaterialNameCmd.SetGuidance("Set target material name (in case not elementary).");
0067   fNonElementaryMaterialNameCmd.SetParameterName("nonElementaryMaterialName", false);
0068   fNonElementaryMaterialNameCmd.AvailableForStates(G4State_PreInit, G4State_Idle);
0069 
0070   fNumBinsCmd.SetGuidance("Set number of bins in kinetic energy.");
0071   fNumBinsCmd.SetParameterName("numBins", false);
0072   fNumBinsCmd.AvailableForStates(G4State_PreInit, G4State_Idle);
0073 
0074   fMinKineticEnergyCmd.SetGuidance("Set min kinetic energy");
0075   fMinKineticEnergyCmd.SetParameterName("MinKineticEnergy", false);
0076   fMinKineticEnergyCmd.SetUnitCategory("Energy");
0077   fMinKineticEnergyCmd.AvailableForStates(G4State_PreInit, G4State_Idle);
0078 
0079   fMaxKineticEnergyCmd.SetGuidance("Set max kinetic energy");
0080   fMaxKineticEnergyCmd.SetParameterName("MaxKineticEnergy", false);
0081   fMaxKineticEnergyCmd.SetUnitCategory("Energy");
0082   fMaxKineticEnergyCmd.AvailableForStates(G4State_PreInit, G4State_Idle);
0083 }
0084 
0085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0086 
0087 void XSHistoManagerMessenger::SetNewValue(G4UIcommand* command, G4String value)
0088 {
0089   if (command == &fOutputFileNameCmd) {
0090     fHisto->SetOutputFileName(value);
0091   }
0092   else if (command == &fParticleNameCmd) {
0093     fHisto->SetParticle(value);
0094   }
0095   else if (command == &fElementNameCmd) {
0096     fHisto->SetElement(value);
0097   }
0098   else if (command == &fNonElementaryMaterialNameCmd) {
0099     fHisto->SetMaterial(value);
0100   }
0101   else if (command == &fNumBinsCmd) {
0102     fHisto->SetNumberOfBins(fNumBinsCmd.GetNewIntValue(value));
0103   }
0104   else if (command == &fMinKineticEnergyCmd) {
0105     fHisto->SetMinKinEnergy(fMinKineticEnergyCmd.GetNewDoubleValue(value));
0106   }
0107   else if (command == &fMaxKineticEnergyCmd) {
0108     fHisto->SetMaxKinEnergy(fMaxKineticEnergyCmd.GetNewDoubleValue(value));
0109   }
0110 }
0111 
0112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......