Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-09 08:28:34

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 HistoManagerMessenger.cc
0027 /// \brief Implementation of the HistoManagerMessenger class
0028 
0029 /////////////////////////////////////////////////////////////////////////
0030 //
0031 // HistoManagerMessenger
0032 //
0033 // Created: 20.06.08 V.Ivanchenko
0034 //
0035 // Modified:
0036 //
0037 ////////////////////////////////////////////////////////////////////////
0038 //
0039 
0040 #include "HistoManagerMessenger.hh"
0041 
0042 #include "HistoManager.hh"
0043 
0044 #include "G4UIcmdWith3Vector.hh"
0045 #include "G4UIcmdWithABool.hh"
0046 #include "G4UIcmdWithADoubleAndUnit.hh"
0047 #include "G4UIcmdWithAString.hh"
0048 #include "G4UIcmdWithAnInteger.hh"
0049 #include "G4UIcmdWithoutParameter.hh"
0050 #include "G4UIdirectory.hh"
0051 
0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0053 
0054 HistoManagerMessenger::HistoManagerMessenger(HistoManager* p) : G4UImessenger(), fHisto(p)
0055 {
0056   fbinCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsE", this);
0057   fbinCmd->SetGuidance("Set number of bins for energy");
0058   fbinCmd->SetParameterName("NEbins", false);
0059   fbinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0060 
0061   fnOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsP", this);
0062   fnOfAbsCmd->SetGuidance("Set number of bins for momentum");
0063   fnOfAbsCmd->SetParameterName("NPbins", false);
0064   fnOfAbsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0065 
0066   fpartCmd = new G4UIcmdWithAString("/testhadr/particle", this);
0067   fpartCmd->SetGuidance("Set particle name");
0068   fpartCmd->SetParameterName("Particle", false);
0069   fpartCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0070 
0071   fcsCmd = new G4UIcmdWithAString("/testhadr/targetElm", this);
0072   fcsCmd->SetGuidance("Set element name");
0073   fcsCmd->SetParameterName("Elm", false);
0074   fcsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0075 
0076   fe1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minEnergy", this);
0077   fe1Cmd->SetGuidance("Set min kinetic energy");
0078   fe1Cmd->SetParameterName("eMin", false);
0079   fe1Cmd->SetUnitCategory("Energy");
0080   fe1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0081 
0082   fe2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxEnergy", this);
0083   fe2Cmd->SetGuidance("Set max kinetic energy");
0084   fe2Cmd->SetParameterName("eMax", false);
0085   fe2Cmd->SetUnitCategory("Energy");
0086   fe2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0087 
0088   fp1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minMomentum", this);
0089   fp1Cmd->SetGuidance("Set min momentum");
0090   fp1Cmd->SetParameterName("pMin", false);
0091   fp1Cmd->SetUnitCategory("Energy");
0092   fp1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0093 
0094   fp2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxMomentum", this);
0095   fp2Cmd->SetGuidance("Set max momentum");
0096   fp2Cmd->SetParameterName("pMax", false);
0097   fp2Cmd->SetUnitCategory("Energy");
0098   fp2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0099 
0100   fverbCmd = new G4UIcmdWithAnInteger("/testhadr/verbose", this);
0101   fverbCmd->SetGuidance("Set verbose for ");
0102   fverbCmd->SetParameterName("verb", false);
0103   fverbCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0104 
0105   fFCmd = new G4UIcmdWithAString("/testhadr/fileName", this);
0106   fFCmd->SetGuidance("set name for the histograms file");
0107 }
0108 
0109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0110 
0111 HistoManagerMessenger::~HistoManagerMessenger()
0112 {
0113   delete fbinCmd;
0114   delete fnOfAbsCmd;
0115   delete fpartCmd;
0116   delete fcsCmd;
0117   delete fe1Cmd;
0118   delete fe2Cmd;
0119   delete fp1Cmd;
0120   delete fp2Cmd;
0121   delete fverbCmd;
0122   delete fFCmd;
0123 }
0124 
0125 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0126 
0127 void HistoManagerMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0128 {
0129   if (command == fbinCmd) {
0130     fHisto->SetNumberOfBinsE(fbinCmd->GetNewIntValue(newValue));
0131   }
0132   else if (command == fnOfAbsCmd) {
0133     fHisto->SetNumberOfBinsP(fnOfAbsCmd->GetNewIntValue(newValue));
0134   }
0135   else if (command == fverbCmd) {
0136     fHisto->SetVerbose(fverbCmd->GetNewIntValue(newValue));
0137   }
0138   else if (command == fpartCmd) {
0139     fHisto->SetParticleName(newValue);
0140   }
0141   else if (command == fcsCmd) {
0142     fHisto->SetElementName(newValue);
0143   }
0144   else if (command == fe1Cmd) {
0145     fHisto->SetMinKinEnergy(fe1Cmd->GetNewDoubleValue(newValue));
0146   }
0147   else if (command == fe2Cmd) {
0148     fHisto->SetMaxKinEnergy(fe2Cmd->GetNewDoubleValue(newValue));
0149   }
0150   else if (command == fp1Cmd) {
0151     fHisto->SetMinMomentum(fp1Cmd->GetNewDoubleValue(newValue));
0152   }
0153   else if (command == fp2Cmd) {
0154     fHisto->SetMaxMomentum(fp2Cmd->GetNewDoubleValue(newValue));
0155   }
0156   else if (command == fFCmd) {
0157     fHisto->SetHistoName(newValue);
0158   }
0159 }
0160 
0161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......