Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4CrossSectionMessenger.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
14
17#include "TG4Globals.h"
19
20#include <G4UIcmdWithABool.hh>
21#include <G4UIcmdWithADoubleAndUnit.hh>
22#include <G4UIcmdWithAString.hh>
23#include <G4UIcmdWithAnInteger.hh>
24#include <G4UIcmdWithoutParameter.hh>
25#include <G4UIdirectory.hh>
26
27//_____________________________________________________________________________
29 TG4CrossSectionManager* crossSectionManager)
30 : G4UImessenger(),
31 fCrossSectionManager(crossSectionManager),
32 fDirectory(0),
33 fMakeHistogramsCmd(0),
34 fParticleCmd(0),
35 fElementCmd(0),
36 fNofBinsECmd(0),
37 fNofBinsPCmd(0),
38 fMinKinECmd(0),
39 fMaxKinECmd(0),
40 fKinECmd(0),
41 fMinMomentumCmd(0),
42 fMaxMomentumCmd(0),
43 fMomentumCmd(0),
44 fLabelCmd(0),
45 fPrintCmd(0)
46{
48
49 fDirectory = new G4UIdirectory("/mcCrossSection/");
50 fDirectory->SetGuidance("Cross section manager commands.");
51
53 new G4UIcmdWithABool("/mcCrossSection/makeHistograms", this);
54 fMakeHistogramsCmd->SetGuidance(
55 "Activate creating histograms with cross sections");
56 fMakeHistogramsCmd->SetParameterName("MakeHistograms", true);
57 fMakeHistogramsCmd->AvailableForStates(
58 G4State_PreInit, G4State_Init, G4State_Idle);
59
60 fParticleCmd = new G4UIcmdWithAString("/mcCrossSection/setParticle", this);
61 fParticleCmd->SetGuidance("Set particle name");
62 fParticleCmd->SetParameterName("particleName", true);
63 fParticleCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
64
65 fElementCmd = new G4UIcmdWithAString("/mcCrossSection/setElement", this);
66 fElementCmd->SetGuidance("Set chemical element name");
67 fElementCmd->SetParameterName("particleName", true);
68 fElementCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
69
70 fNofBinsECmd = new G4UIcmdWithAnInteger("/mcCrossSection/setNofBinsE", this);
71 fNofBinsECmd->SetGuidance("Set number of bins in E");
72 fNofBinsECmd->SetParameterName("nofBinsE", false);
73 fNofBinsECmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
74
75 fNofBinsPCmd = new G4UIcmdWithAnInteger("/mcCrossSection/setNofBinsP", this);
76 fNofBinsPCmd->SetGuidance("Set number of bins in P");
77 fNofBinsPCmd->SetParameterName("nofBinsE", false);
78 fNofBinsPCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
79
81 new G4UIcmdWithADoubleAndUnit("/mcCrossSection/setMinKinE", this);
82 fMinKinECmd->SetGuidance("Set minimum kinetic energy");
83 fMinKinECmd->SetParameterName("minKinE", false);
84 fMinKinECmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
85
87 new G4UIcmdWithADoubleAndUnit("/mcCrossSection/setMaxKinE", this);
88 fMaxKinECmd->SetGuidance("Set minimum kinetic energy");
89 fMaxKinECmd->SetParameterName("minKinE", false);
90 fMaxKinECmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
91
92 fKinECmd = new G4UIcmdWithADoubleAndUnit("/mcCrossSection/setKinE", this);
93 fKinECmd->SetGuidance("Set current kinetic energy");
94 fKinECmd->SetParameterName("minKinE", false);
95 fKinECmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
96
98 new G4UIcmdWithADoubleAndUnit("/mcCrossSection/setMinMomentum", this);
99 fMinMomentumCmd->SetGuidance("Set minimum momentum");
100 fMinMomentumCmd->SetParameterName("minMomentum", false);
101 fMinMomentumCmd->AvailableForStates(
102 G4State_PreInit, G4State_Init, G4State_Idle);
103
105 new G4UIcmdWithADoubleAndUnit("/mcCrossSection/setMaxMomentum", this);
106 fMaxMomentumCmd->SetGuidance("Set maximum momentum");
107 fMaxMomentumCmd->SetParameterName("maxMomentum", false);
108 fMaxMomentumCmd->AvailableForStates(
109 G4State_PreInit, G4State_Init, G4State_Idle);
110
112 new G4UIcmdWithADoubleAndUnit("/mcCrossSection/setMomentum", this);
113 fMomentumCmd->SetGuidance("Set current momentum");
114 fMomentumCmd->SetParameterName("Momentum", false);
115 fMomentumCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
116
117 fLabelCmd = new G4UIcmdWithAString("/mcCrossSection/setLabel", this);
118 fLabelCmd->SetGuidance(
119 "Set label which will be put at the beginning of histograms title");
120 fLabelCmd->SetParameterName("Label", true);
121 fLabelCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
122
123 fPrintCmd = new G4UIcmdWithAString("/mcCrossSection/printCrossSection", this);
124 fPrintCmd->SetGuidance(
125 "Print selected cross section for current kinetic energy");
126 fPrintCmd->SetParameterName("crossSectionType", false);
127 G4String candidates("All ");
128 for (G4int i = 0; i < kNoCrossSectionType; i++) {
129 candidates += TG4CrossSectionTypeName(i);
130 candidates += G4String(" ");
131 }
132 fPrintCmd->SetCandidates(candidates);
133 fPrintCmd->AvailableForStates(G4State_Idle);
134}
135
136//_____________________________________________________________________________
138{
140
141 delete fDirectory;
142 delete fMakeHistogramsCmd;
143 delete fParticleCmd;
144 delete fElementCmd;
145 delete fNofBinsECmd;
146 delete fNofBinsPCmd;
147 delete fMinKinECmd;
148 delete fMaxKinECmd;
149 delete fKinECmd;
150 delete fMinMomentumCmd;
151 delete fMaxMomentumCmd;
152 delete fLabelCmd;
153 delete fMomentumCmd;
154 delete fPrintCmd;
155}
156
157//
158// public methods
159//
160
161//_____________________________________________________________________________
163 G4UIcommand* command, G4String newValue)
164{
166
167 if (command == fMakeHistogramsCmd) {
169 fMakeHistogramsCmd->GetNewBoolValue(newValue));
170 }
171 else if (command == fParticleCmd) {
173 }
174 else if (command == fElementCmd) {
176 }
177 else if (command == fNofBinsECmd) {
179 fNofBinsECmd->GetNewIntValue(newValue));
180 }
181 else if (command == fNofBinsPCmd) {
183 fNofBinsPCmd->GetNewIntValue(newValue));
184 }
185 else if (command == fMinKinECmd) {
187 fMinKinECmd->GetNewDoubleValue(newValue));
188 }
189 else if (command == fMaxKinECmd) {
191 fMaxKinECmd->GetNewDoubleValue(newValue));
192 }
193 else if (command == fKinECmd) {
194 fCrossSectionManager->SetKinEnergy(fKinECmd->GetNewDoubleValue(newValue));
195 }
196 else if (command == fMinMomentumCmd) {
198 fMinMomentumCmd->GetNewDoubleValue(newValue));
199 }
200 else if (command == fMaxMomentumCmd) {
202 fMaxMomentumCmd->GetNewDoubleValue(newValue));
203 }
204 else if (command == fMomentumCmd) {
206 fMomentumCmd->GetNewDoubleValue(newValue));
207 }
208 else if (command == fLabelCmd) {
210 }
211 else if (command == fPrintCmd) {
212 if (newValue == "All")
214 else
216 }
217}
Definition of the TG4CrossSectionManager class.
Definition of the TG4CrossSectionMessenger class.
G4String TG4CrossSectionTypeName(G4int type)
Return name for given cross section type.
TG4CrossSectionType GetCrossSectionType(G4int type)
Convert G4int to TG4CrossSectionType (for loops)
Definition of the TG4Globals class and basic container types.
Definition of the TG4UICmdWithAComplexString class.
The manager class for accessing hadronic cross sections.
void SetLabel(const G4String &label)
void SetMakeHistograms(G4bool makeHistograms)
void SetMinMomentum(G4double val)
void PrintCrossSection(TG4CrossSectionType type) const
void SetParticleName(const G4String &name)
void SetMinKinEnergy(G4double val)
void SetMaxMomentum(G4double val)
void SetElementName(const G4String &name)
void SetMaxKinEnergy(G4double val)
G4UIcmdWithABool * fMakeHistogramsCmd
command: makeHistograms
G4UIdirectory * fDirectory
command directory
G4UIcmdWithADoubleAndUnit * fKinECmd
command: setMinKinE
G4UIcmdWithADoubleAndUnit * fMaxKinECmd
command: setMaxKinE
G4UIcmdWithADoubleAndUnit * fMomentumCmd
command: setMomentum
virtual void SetNewValue(G4UIcommand *command, G4String string)
G4UIcmdWithAString * fParticleCmd
command: setParticle
G4UIcmdWithAnInteger * fNofBinsECmd
command: setNofBinsE
G4UIcmdWithAnInteger * fNofBinsPCmd
command: setNofBinsP
TG4CrossSectionManager * fCrossSectionManager
associated class
TG4CrossSectionMessenger()
Not implemented.
G4UIcmdWithADoubleAndUnit * fMaxMomentumCmd
command: setMaxMomentum
G4UIcmdWithAString * fElementCmd
command: setElement
G4UIcmdWithAString * fLabelCmd
command: setLabel
G4UIcmdWithAString * fPrintCmd
command: printCrossSection
G4UIcmdWithADoubleAndUnit * fMinMomentumCmd
command: setMinMomentum
G4UIcmdWithADoubleAndUnit * fMinKinECmd
command: setMinKinE
@ kNoCrossSectionType
no cross section type