Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:59

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