ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RunActionMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RunActionMessenger.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 
33 #include "RunActionMessenger.hh"
34 
35 #include "RunAction.hh"
36 #include "G4UIdirectory.hh"
37 #include "G4UIcommand.hh"
38 #include "G4UIparameter.hh"
39 #include "G4UIcmdWithABool.hh"
40 
41 #include <sstream>
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
46 :G4UImessenger(),fRunAction(run),
47  fRunDir(0),
48  fAccCmd(0),
49  fLimCmd(0)
50 {
51  fRunDir = new G4UIdirectory("/testem/run/");
52  fRunDir->SetGuidance("run commands");
53 
54  fAccCmd = new G4UIcommand("/testem/run/acceptance",this);
55  fAccCmd->SetGuidance("Check Edep and RMS of energy deposition for given absorber");
56  //
57  G4UIparameter* AbsNbPrm = new G4UIparameter("AbsorNb",'i',false);
58  AbsNbPrm->SetGuidance("absorber number : from 1 to NbOfAbsor");
59  AbsNbPrm->SetParameterRange("AbsorNb>0");
60  fAccCmd->SetParameter(AbsNbPrm);
61  //
62  G4UIparameter* edep = new G4UIparameter("Edep",'d',false);
63  edep->SetGuidance("mean energy deposition (MeV)");
64  edep->SetParameterRange("Edep>=0.");
65  fAccCmd->SetParameter(edep);
66  //
67  G4UIparameter* rms = new G4UIparameter("RMS",'d',false);
68  rms->SetGuidance("RMS of energy deposition (MeV)");
69  rms->SetParameterRange("RMS>=0.");
70  fAccCmd->SetParameter(rms);
71  //
72  G4UIparameter* lim = new G4UIparameter("nRMS",'d',false);
73  lim->SetGuidance("Limit in number of RMS of energy deposition");
74  lim->SetParameterRange("Limit>=0.");
75  fAccCmd->SetParameter(lim);
76  //
77  fLimCmd = new G4UIcmdWithABool("/testem/run/limitEdep",this);
78  fLimCmd->SetGuidance("remove energy outside acceptance limit");
80 }
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
85 {
86  delete fAccCmd;
87  delete fRunDir;
88  delete fLimCmd;
89 }
90 
91 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
92 
94 {
95  if( command == fAccCmd )
96  {
97  G4int num;
98  G4double edep, rms, lim;
99  std::istringstream is(newValue);
100  is >> num >> edep >> rms >> lim;
101  fRunAction->SetEdepAndRMS(num,edep,rms,lim);
102  }
103 
104  if( command == fLimCmd )
106 }
107 
108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......