Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-02 07:42: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 RunActionMessenger.cc
0027 /// \brief Implementation of the RunActionMessenger class
0028 
0029 #include "RunActionMessenger.hh"
0030 
0031 #include "RunAction.hh"
0032 
0033 #include "G4UIcmdWithABool.hh"
0034 #include "G4UIcommand.hh"
0035 #include "G4UIdirectory.hh"
0036 #include "G4UIparameter.hh"
0037 
0038 #include <sstream>
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 
0042 RunActionMessenger::RunActionMessenger(RunAction* run) : fRunAction(run)
0043 {
0044   fRunDir = new G4UIdirectory("/testem/run/");
0045   fRunDir->SetGuidance("run commands");
0046 
0047   fAccCmd = new G4UIcommand("/testem/run/acceptance", this);
0048   fAccCmd->SetGuidance("Check Edep and RMS of energy deposition for given absorber");
0049   //
0050   G4UIparameter* AbsNbPrm = new G4UIparameter("AbsorNb", 'i', false);
0051   AbsNbPrm->SetGuidance("absorber number : from 1 to NbOfAbsor");
0052   AbsNbPrm->SetParameterRange("AbsorNb>0");
0053   fAccCmd->SetParameter(AbsNbPrm);
0054   //
0055   G4UIparameter* edep = new G4UIparameter("Edep", 'd', false);
0056   edep->SetGuidance("mean energy deposition (MeV)");
0057   edep->SetParameterRange("Edep>=0.");
0058   fAccCmd->SetParameter(edep);
0059   //
0060   G4UIparameter* rms = new G4UIparameter("RMS", 'd', false);
0061   rms->SetGuidance("RMS of energy deposition (MeV)");
0062   rms->SetParameterRange("RMS>=0.");
0063   fAccCmd->SetParameter(rms);
0064   //
0065   G4UIparameter* lim = new G4UIparameter("nRMS", 'd', false);
0066   lim->SetGuidance("Limit in number of RMS of energy deposition");
0067   lim->SetParameterRange("Limit>=0.");
0068   fAccCmd->SetParameter(lim);
0069   //
0070   fLimCmd = new G4UIcmdWithABool("/testem/run/limitEdep", this);
0071   fLimCmd->SetGuidance("remove energy outside acceptance limit");
0072   fLimCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0073 }
0074 
0075 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0076 
0077 RunActionMessenger::~RunActionMessenger()
0078 {
0079   delete fAccCmd;
0080   delete fRunDir;
0081   delete fLimCmd;
0082 }
0083 
0084 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0085 
0086 void RunActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0087 {
0088   if (command == fAccCmd) {
0089     G4int num;
0090     G4double edep, rms, lim;
0091     std::istringstream is(newValue);
0092     is >> num >> edep >> rms >> lim;
0093     fRunAction->SetEdepAndRMS(num, edep, rms, lim);
0094   }
0095 
0096   if (command == fLimCmd) {
0097     fRunAction->SetApplyLimit(fLimCmd->GetNewBoolValue(newValue));
0098   }
0099 }
0100 
0101 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......