Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
RMC01AnalysisManagerMessenger.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 // $Id: RMC01AnalysisManagerMessenger.cc 71233 2013-06-12 13:16:05Z gcosmo $
30 //
32 // Class Name: RMC01AnalysisManagerMessenger
33 // Author: L. Desorgher
34 // Organisation: SpaceIT GmbH
35 // Contract: ESA contract 21435/08/NL/AT
36 // Customer: ESA/ESTEC
38 
40 
41 #include "RMC01AnalysisManager.hh"
42 #include "G4UIdirectory.hh"
43 #include "G4UIcmdWithADouble.hh"
44 #include "G4UnitsTable.hh"
45 #include "G4SystemOfUnits.hh"
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
50  RMC01AnalysisManager* analysisManager)
51 : G4UImessenger(),
52  fAnalysisManager(analysisManager),
53  fAnalysisDir(0),
54  fSetPrecisionForConvergenceTestCmd(0),
55  fSetExpSpectrumToNormaliseAdjResCmd(0),
56  fSetPowerLawSpectrumToNormaliseAdjResCmd(0)
57 {
58  fAnalysisDir = new G4UIdirectory("/RMC01/analysis/");
59  fAnalysisDir->SetGuidance("Analysis commands");
60 
61  G4UIparameter* fluence_par = new G4UIparameter("Fluence",'d',true);
62  fluence_par->SetParameterRange("Fluence > 0");
63  fluence_par->SetGuidance("Omnidirectional fluence for primary spectrum");
64 
65  G4UIparameter* fluence_unit_par = new G4UIparameter("Fluence_unit",'s',true);
66  fluence_unit_par->SetParameterCandidates("1/cm2 1/m2 cm-2 m-2");
67 
68  G4UIparameter* alpha_par = new G4UIparameter("alpha",'d',true);
69 
70  G4UIparameter* e0_par = new G4UIparameter("E0",'d',true);
71  e0_par->SetParameterRange("E0 > 0");
72 
73  G4UIparameter* e1_par = new G4UIparameter("E1",'d',true);
74  e1_par->SetParameterRange("E1 > 0");
75 
76  G4UIparameter* e2_par = new G4UIparameter("E2",'d',true);
77  e2_par->SetParameterRange("E2 > 0");
78 
79  G4UIparameter* e_unit_par = new G4UIparameter("E_unit",'s',true);
80  e_unit_par->SetParameterCandidates("eV keV MeV GeV TeV");
81 
82  G4UIparameter* part_name_par = new G4UIparameter("particle_name",'s',true);
83  part_name_par->SetParameterCandidates("e- gamma proton ");
84 
86  new G4UIcommand("/RMC01/analysis/SetPowerLawPrimSpectrumForAdjointSim",this);
88  ->SetGuidance("Set the primary spectrum to which adjoint simulation "
89  "results will be normalised as a power law (Ekin^-alpha).");
99 
100 
101  fSetExpSpectrumToNormaliseAdjResCmd = new G4UIcommand("/RMC01/analysis/"
102  "SetExponentialSpectrumForAdjointSim",this);
104  ->SetGuidance("Set the primary spectrum to which adjoint simulation results"
105  "will be normalised as exponential (exp(-Ekin/E0)).");
107  ->SetParameter(new G4UIparameter(*part_name_par));
109  ->SetParameter(new G4UIparameter(*fluence_par));
111  ->SetParameter(new G4UIparameter(*fluence_unit_par));
113  ->SetParameter(new G4UIparameter(*e0_par));
115  ->SetParameter(new G4UIparameter(*e1_par));
117  ->SetParameter(new G4UIparameter(*e2_par));
119  ->SetParameter(new G4UIparameter(*e_unit_par));
122 
123 
125  "SetExpectedPrecisionOfResults",this);
127  ->SetGuidance("Set the precision in % that the computed energy deposited "
128  "in the sensitive volume should reached. If this precision is reached"
129  " before the end of the run, the run is aborted and the results are "
130  "registered.");
134 }
135 
136 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
137 
139 {
140  delete fAnalysisDir;
141 }
142 
143 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144 
146  G4UIcommand* command,G4String newValue)
147 {
149  G4double alpha,e1,e2,fluence;
150  G4String f_unit,e_unit,part_name;
151  const char* nv = (const char*)newValue;
152  std::istringstream is(nv);
153  is >> part_name>>fluence>>f_unit>>alpha>>e1>>e2>>e_unit;
154 
155  G4double factor_f_unit=1/cm2;
156  if (f_unit == "1/m2" || f_unit =="m-2") factor_f_unit=1/m2;
157  fluence*=factor_f_unit;
158  e1*= G4UnitDefinition::GetValueOf(e_unit);
159  e2*= G4UnitDefinition::GetValueOf(e_unit);
161  part_name, fluence, alpha, e1, e2);
162  }
163  else if( command == fSetExpSpectrumToNormaliseAdjResCmd){
164  G4double e0,e1,e2,fluence;
165  G4String f_unit,e_unit,part_name;
166  const char* nv = (const char*)newValue;
167  std::istringstream is(nv);
168  is >> part_name>>fluence>>f_unit>>e0>>e1>>e2>>e_unit;
169 
170  G4double factor_f_unit=1/cm2;
171  if (f_unit == "1/m2" || f_unit =="m-2") factor_f_unit=1/m2;
172 
173  fluence*=factor_f_unit;
174  e0*= G4UnitDefinition::GetValueOf(e_unit);
175  e1*= G4UnitDefinition::GetValueOf(e_unit);
176  e2*= G4UnitDefinition::GetValueOf(e_unit);
177 
179  fluence, e0, e1, e2);
180 
181  }
182  else if( command == fSetPrecisionForConvergenceTestCmd){
185  }
186 }
187 
188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
static constexpr double m2
Definition: G4SIunits.hh:130
static G4double GetNewDoubleValue(const char *paramString)
void SetGuidance(const char *theGuidance)
void SetParameterRange(const char *theRange)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
double G4double
Definition: G4Types.hh:76
static constexpr double cm2
Definition: G4SIunits.hh:120
RMC01AnalysisManagerMessenger(RMC01AnalysisManager *)
static const G4double alpha
static G4double GetValueOf(const G4String &)
void SetPrecision(G4double precision)
void SetPrimaryExpSpectrumForAdjointSim(const G4String &particle_name, G4double fluence, G4double E0, G4double Emin, G4double Emax)
void SetPrimaryPowerLawSpectrumForAdjointSim(const G4String &particle_name, G4double fluence, G4double alpha, G4double Emin, G4double Emax)
Definition of the RMC01AnalysisManager class.
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
virtual void SetNewValue(G4UIcommand *, G4String)
G4UIcmdWithADouble * fSetPrecisionForConvergenceTestCmd
Definition of the RMC01AnalysisManagerMessenger class.
void SetParameterCandidates(const char *theString)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:242