Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
G4H2Messenger Class Reference

#include <G4H2Messenger.hh>

Inheritance diagram for G4H2Messenger:
G4UImessenger

Public Member Functions

G4bool CommandsShouldBeInMaster () const
 
 G4H2Messenger ()=delete
 
 G4H2Messenger (G4VAnalysisManager *manager)
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool operator== (const G4UImessenger &messenger) const
 
virtual void SetNewValue (G4UIcommand *command, G4String value) final
 
virtual ~G4H2Messenger ()
 

Protected Member Functions

void AddUIcommand (G4UIcommand *newCommand)
 
G4String BtoS (G4bool b)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
G4String DtoS (G4double a)
 
G4String ItoS (G4int i)
 
G4bool StoB (G4String s)
 
G4double StoD (G4String s)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 

Protected Attributes

G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Private Member Functions

void CreateH2Cmd ()
 
void SetH2Cmd ()
 

Private Attributes

std::unique_ptr< G4UIcommandfCreateH2Cmd
 
std::unique_ptr< G4UIdirectoryfDirectory
 
std::unique_ptr< G4AnalysisMessengerHelperfHelper
 
G4VAnalysisManagerfManager { nullptr }
 Associated class. More...
 
std::unique_ptr< G4UIcommandfSetH2Cmd
 
std::unique_ptr< G4UIcommandfSetH2TitleCmd
 
std::unique_ptr< G4UIcommandfSetH2XAxisCmd
 
std::unique_ptr< G4UIcommandfSetH2XAxisLogCmd
 
std::unique_ptr< G4UIcommandfSetH2XCmd
 
std::unique_ptr< G4UIcommandfSetH2YAxisCmd
 
std::unique_ptr< G4UIcommandfSetH2YAxisLogCmd
 
std::unique_ptr< G4UIcommandfSetH2YCmd
 
std::unique_ptr< G4UIcommandfSetH2ZAxisCmd
 
std::unique_ptr< G4UIcommandfSetH2ZAxisLogCmd
 
G4AnalysisMessengerHelper::BinData fXData
 
G4int fXId { G4Analysis::kInvalidId }
 

Detailed Description

Definition at line 46 of file G4H2Messenger.hh.

Constructor & Destructor Documentation

◆ G4H2Messenger() [1/2]

G4H2Messenger::G4H2Messenger ( G4VAnalysisManager manager)
explicit

Definition at line 39 of file G4H2Messenger.cc.

40 : G4UImessenger(),
41 fManager(manager)
42{
43 fHelper = std::make_unique<G4AnalysisMessengerHelper>("h2");
44
45 fDirectory = fHelper->CreateHnDirectory();
46
48
49 SetH2Cmd();
50 fSetH2XCmd = fHelper->CreateSetBinsCommand("x", this);
51 fSetH2YCmd = fHelper->CreateSetBinsCommand("y", this);
52
53 fSetH2TitleCmd = fHelper->CreateSetTitleCommand(this);
54 fSetH2XAxisCmd = fHelper->CreateSetAxisCommand("x", this);
55 fSetH2YAxisCmd = fHelper->CreateSetAxisCommand("y", this);
56 fSetH2ZAxisCmd = fHelper->CreateSetAxisCommand("z", this);
57 fSetH2XAxisLogCmd = fHelper->CreateSetAxisLogCommand("x", this);
58 fSetH2YAxisLogCmd = fHelper->CreateSetAxisLogCommand("y", this);
59 fSetH2ZAxisLogCmd = fHelper->CreateSetAxisLogCommand("z", this);
60}
std::unique_ptr< G4UIcommand > fSetH2XAxisCmd
std::unique_ptr< G4UIcommand > fSetH2XAxisLogCmd
void CreateH2Cmd()
std::unique_ptr< G4UIcommand > fSetH2ZAxisCmd
std::unique_ptr< G4UIdirectory > fDirectory
std::unique_ptr< G4UIcommand > fSetH2XCmd
std::unique_ptr< G4UIcommand > fSetH2YAxisCmd
std::unique_ptr< G4UIcommand > fSetH2YAxisLogCmd
G4VAnalysisManager * fManager
Associated class.
std::unique_ptr< G4UIcommand > fSetH2YCmd
std::unique_ptr< G4UIcommand > fSetH2ZAxisLogCmd
std::unique_ptr< G4UIcommand > fSetH2TitleCmd
std::unique_ptr< G4AnalysisMessengerHelper > fHelper

References CreateH2Cmd(), fDirectory, fHelper, fSetH2TitleCmd, fSetH2XAxisCmd, fSetH2XAxisLogCmd, fSetH2XCmd, fSetH2YAxisCmd, fSetH2YAxisLogCmd, fSetH2YCmd, fSetH2ZAxisCmd, fSetH2ZAxisLogCmd, and SetH2Cmd().

◆ G4H2Messenger() [2/2]

G4H2Messenger::G4H2Messenger ( )
delete

◆ ~G4H2Messenger()

G4H2Messenger::~G4H2Messenger ( )
virtualdefault

Member Function Documentation

◆ AddUIcommand()

void G4UImessenger::AddUIcommand ( G4UIcommand newCommand)
protectedinherited

Definition at line 149 of file G4UImessenger.cc.

150{
151 G4cerr << "Warning : Old style definition of G4UIcommand <"
152 << newCommand->GetCommandPath() << ">." << G4endl;
153}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:136

References G4cerr, G4endl, and G4UIcommand::GetCommandPath().

◆ BtoS()

G4String G4UImessenger::BtoS ( G4bool  b)
protectedinherited

Definition at line 98 of file G4UImessenger.cc.

99{
100 G4String vl = "0";
101 if(b)
102 vl = "true";
103 return vl;
104}

◆ CommandsShouldBeInMaster()

G4bool G4UImessenger::CommandsShouldBeInMaster ( ) const
inlineinherited

Definition at line 77 of file G4UImessenger.hh.

78 {
80 }
G4bool commandsShouldBeInMaster

References G4UImessenger::commandsShouldBeInMaster.

Referenced by G4UIcommand::G4UIcommandCommonConstructorCode().

◆ CreateCommand()

template<typename T >
T * G4UImessenger::CreateCommand ( const G4String cname,
const G4String dsc 
)
protectedinherited

Definition at line 110 of file G4UImessenger.hh.

111{
112 G4String path;
113 if(cname[0] != '/')
114 {
115 path = baseDirName + cname;
116 if(path[0] != '/')
117 path = "/" + path;
118 }
119
120 T* command = new T(path.c_str(), this);
121 command->SetGuidance(dsc.c_str());
122
123 return command;
124}
G4String baseDirName

References G4UImessenger::baseDirName.

◆ CreateDirectory()

void G4UImessenger::CreateDirectory ( const G4String path,
const G4String dsc,
G4bool  commandsToBeBroadcasted = true 
)
protectedinherited

Definition at line 156 of file G4UImessenger.cc.

158{
160
161 G4String fullpath = path;
162 if(fullpath.back() != '/')
163 fullpath.append("/");
164
165 G4UIcommandTree* tree = ui->GetTree()->FindCommandTree(fullpath.c_str());
166 if(tree != nullptr)
167 {
168 baseDirName = tree->GetPathName();
169 }
170 else
171 {
172 baseDir = new G4UIdirectory(fullpath.c_str(), commandsToBeBroadcasted);
173 baseDirName = fullpath;
174 baseDir->SetGuidance(dsc.c_str());
175 }
176}
const G4String & GetPathName() const
G4UIcommandTree * FindCommandTree(const char *commandPath)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4UIdirectory * baseDir

References G4UImessenger::baseDir, G4UImessenger::baseDirName, G4UIcommandTree::FindCommandTree(), G4UIcommandTree::GetPathName(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), and G4UIcommand::SetGuidance().

Referenced by G4MoleculeShootMessenger::G4MoleculeShootMessenger(), and G4UImessenger::G4UImessenger().

◆ CreateH2Cmd()

void G4H2Messenger::CreateH2Cmd ( )
private

Definition at line 70 of file G4H2Messenger.cc.

71{
72 auto h2Name = new G4UIparameter("name", 's', false);
73 h2Name->SetGuidance("Histogram name (label)");
74
75 auto h2Title = new G4UIparameter("title", 's', false);
76 h2Title->SetGuidance("Histogram title");
77
78 auto h2xNbins0 = new G4UIparameter("xnbins0", 'i', true);
79 h2xNbins0->SetGuidance("Number of x-bins (default = 100)");
80 h2xNbins0->SetGuidance("Can be reset with /analysis/h2/set command");
81 h2xNbins0->SetDefaultValue(100);
82
83 auto h2xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
84 h2xValMin0->SetGuidance("Minimum x-value, expressed in unit (default = 0.)");
85 h2xValMin0->SetGuidance("Can be reset with /analysis/h2/set command");
86 h2xValMin0->SetDefaultValue(0.);
87
88 auto h2xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
89 h2xValMax0->SetGuidance("Maximum x-value, expressed in unit (default = 1.)");
90 h2xValMax0->SetGuidance("Can be reset with /analysis/h2/set command");
91 h2xValMax0->SetDefaultValue(1.);
92
93 auto h2xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
94 h2xValUnit0->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
95 h2xValUnit0->SetDefaultValue("none");
96
97 auto h2xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
98 G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
99 h2xValFcn0->SetGuidance(fcnxGuidance);
100 h2xValFcn0->SetParameterCandidates("log log10 exp none");
101 h2xValFcn0->SetDefaultValue("none");
102
103 auto h2xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
104 G4String xbinSchemeGuidance = "The binning scheme (linear, log).";
105 h2xValBinScheme0->SetParameterCandidates("linear log");
106 h2xValBinScheme0->SetGuidance(xbinSchemeGuidance);
107 h2xValBinScheme0->SetDefaultValue("linear");
108
109 auto h2yNbins0 = new G4UIparameter("ynbins0", 'i', true);
110 h2yNbins0->SetGuidance("Number of y-bins (default = 100)");
111 h2yNbins0->SetGuidance("Can be reset with /analysis/h2/set command");
112 h2yNbins0->SetDefaultValue(100);
113
114 auto h2yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
115 h2yValMin0->SetGuidance("Minimum y-value, expressed in unit (default = 0.)");
116 h2yValMin0->SetGuidance("Can be reset with /analysis/h2/set command");
117 h2yValMin0->SetDefaultValue(0.);
118
119 auto h2yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
120 h2yValMax0->SetGuidance("Maximum y-value, expressed in unit (default = 1.)");
121 h2yValMax0->SetGuidance("Can be reset with /analysis/h2/set command");
122 h2yValMax0->SetDefaultValue(1.);
123
124 auto h2yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
125 h2yValUnit0->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
126 h2yValUnit0->SetDefaultValue("none");
127
128 auto h2yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
129 G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
130 h2yValFcn0->SetGuidance(fcnyGuidance);
131 h2yValFcn0->SetParameterCandidates("log log10 exp none");
132 h2yValFcn0->SetDefaultValue("none");
133
134 auto h2yValBinScheme0 = new G4UIparameter("yvalBinScheme0", 's', true);
135 G4String ybinSchemeGuidance = "The binning scheme (linear, log).";
136 h2yValBinScheme0->SetParameterCandidates("linear log");
137 h2yValBinScheme0->SetGuidance(ybinSchemeGuidance);
138 h2yValBinScheme0->SetDefaultValue("linear");
139
140 fCreateH2Cmd = std::make_unique<G4UIcommand>("/analysis/h2/create", this);
141 fCreateH2Cmd->SetGuidance("Create 2D histogram");
142 fCreateH2Cmd->SetParameter(h2Name);
143 fCreateH2Cmd->SetParameter(h2Title);
144 fCreateH2Cmd->SetParameter(h2xNbins0);
145 fCreateH2Cmd->SetParameter(h2xValMin0);
146 fCreateH2Cmd->SetParameter(h2xValMax0);
147 fCreateH2Cmd->SetParameter(h2xValUnit0);
148 fCreateH2Cmd->SetParameter(h2xValFcn0);
149 fCreateH2Cmd->SetParameter(h2xValBinScheme0);
150 fCreateH2Cmd->SetParameter(h2yNbins0);
151 fCreateH2Cmd->SetParameter(h2yValMin0);
152 fCreateH2Cmd->SetParameter(h2yValMax0);
153 fCreateH2Cmd->SetParameter(h2yValUnit0);
154 fCreateH2Cmd->SetParameter(h2yValFcn0);
155 fCreateH2Cmd->SetParameter(h2yValBinScheme0);
156 fCreateH2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
157}
@ G4State_Idle
@ G4State_PreInit
std::unique_ptr< G4UIcommand > fCreateH2Cmd

References fCreateH2Cmd, G4State_Idle, and G4State_PreInit.

Referenced by G4H2Messenger().

◆ DtoS()

G4String G4UImessenger::DtoS ( G4double  a)
protectedinherited

Definition at line 90 of file G4UImessenger.cc.

91{
92 std::ostringstream os;
93 os << a;
94 return G4String(os.str());
95}

Referenced by G4ScoreQuantityMessenger::FilterCommands(), and G4UIcontrolMessenger::SetNewValue().

◆ GetCurrentValue()

G4String G4UImessenger::GetCurrentValue ( G4UIcommand command)
virtualinherited

Reimplemented in G4ScoreQuantityMessenger, G4VisCommandModelCreate< Factory >, G4VisCommandListManagerList< Manager >, G4VisCommandListManagerSelect< Manager >, G4VisCommandManagerMode< Manager >, G4ToolsAnalysisMessenger, G4ScoringMessenger, G4EvManMessenger, G4GeneralParticleSourceMessenger, G4ParticleGunMessenger, G4GeometryMessenger, G4GenericMessenger, G4UIcontrolMessenger, GFlashShowerModelMessenger, G4DecayTableMessenger, G4ParticleMessenger, G4ParticlePropertyMessenger, G4tgrMessenger, G4PersistencyCenterMessenger, G4ProductionCutsTableMessenger, G4SchedulerMessenger, G4VITSteppingVerbose, G4MoleculeShootMessenger, G4MoleculeGunMessenger, G4ProcessManagerMessenger, G4ProcessTableMessenger, G4MatScanMessenger, G4RunMessenger, G4UserPhysicsListMessenger, G4TrackingMessenger, G4GMocrenMessenger, G4HepRepMessenger, G4VisCommandAbortReviewKeptEvents, G4VisCommandDrawOnlyToBeKeptEvents, G4VisCommandEnable, G4VisCommandList, G4VisCommandReviewKeptEvents, G4VisCommandVerbose, G4VisCommandGeometryList, G4VisCommandGeometryRestore, G4VisCommandGeometrySetColour, G4VisCommandGeometrySetDaughtersInvisible, G4VisCommandGeometrySetForceAuxEdgeVisible, G4VisCommandGeometrySetForceCloud, G4VisCommandGeometrySetForceSolid, G4VisCommandGeometrySetForceLineSegmentsPerCircle, G4VisCommandGeometrySetForceWireframe, G4VisCommandGeometrySetLineStyle, G4VisCommandGeometrySetLineWidth, G4VisCommandGeometrySetVisibility, G4VisCommandSceneActivateModel, G4VisCommandSceneCreate, G4VisCommandSceneEndOfEventAction, G4VisCommandSceneEndOfRunAction, G4VisCommandSceneList, G4VisCommandSceneNotifyHandlers, G4VisCommandSceneRemoveModel, G4VisCommandSceneSelect, G4VisCommandSceneShowExtents, G4VisCommandSceneAddArrow, G4VisCommandSceneAddArrow2D, G4VisCommandSceneAddAxes, G4VisCommandSceneAddDate, G4VisCommandSceneAddDigis, G4VisCommandSceneAddEventID, G4VisCommandSceneAddExtent, G4VisCommandSceneAddElectricField, G4VisCommandSceneAddFrame, G4VisCommandSceneAddGPS, G4VisCommandSceneAddGhosts, G4VisCommandSceneAddHits, G4VisCommandSceneAddLine, G4VisCommandSceneAddLine2D, G4VisCommandSceneAddLocalAxes, G4VisCommandSceneAddLogicalVolume, G4VisCommandSceneAddLogo, G4VisCommandSceneAddLogo2D, G4VisCommandSceneAddMagneticField, G4VisCommandSceneAddPSHits, G4VisCommandSceneAddScale, G4VisCommandSceneAddText, G4VisCommandSceneAddText2D, G4VisCommandSceneAddTrajectories, G4VisCommandSceneAddUserAction, G4VisCommandSceneAddVolume, G4VisCommandSceneAddPlotter, G4VisCommandSceneHandlerAttach, G4VisCommandSceneHandlerCreate, G4VisCommandSceneHandlerList, G4VisCommandSceneHandlerSelect, G4VisCommandSetArrow3DLineSegmentsPerCircle, G4VisCommandSetColour, G4VisCommandSetExtentForField, G4VisCommandSetLineWidth, G4VisCommandSetTextColour, G4VisCommandSetTextLayout, G4VisCommandSetTextSize, G4VisCommandSetTouchable, G4VisCommandSetVolumeForField, G4VisCommandsTouchable, G4VisCommandsTouchableSet, G4VisCommandViewerAddCutawayPlane, G4VisCommandViewerCentreOn, G4VisCommandViewerChangeCutawayPlane, G4VisCommandViewerClear, G4VisCommandViewerClearCutawayPlanes, G4VisCommandViewerClearTransients, G4VisCommandViewerClearVisAttributesModifiers, G4VisCommandViewerClone, G4VisCommandViewerColourByDensity, G4VisCommandViewerCopyViewFrom, G4VisCommandViewerCreate, G4VisCommandViewerDolly, G4VisCommandViewerFlush, G4VisCommandViewerInterpolate, G4VisCommandViewerList, G4VisCommandViewerPan, G4VisCommandViewerReset, G4VisCommandViewerRefresh, G4VisCommandViewerRebuild, G4VisCommandViewerSave, G4VisCommandViewerScale, G4VisCommandViewerSelect, G4VisCommandViewerUpdate, G4VisCommandViewerZoom, G4VisCommandViewerDefaultHiddenEdge, G4VisCommandViewerDefaultStyle, G4VisCommandsViewerSet, G4VModelCommand< T >, G4VModelCommand< M >, G4RTMessenger, G4ASCIITreeMessenger, G4VtkMessenger, G4PolarizationMessenger, and G4DNAChemistryManager.

Definition at line 58 of file G4UImessenger.cc.

59{
60 G4String nullString;
61 return nullString;
62}

Referenced by G4UIcommand::DoIt(), and G4UIcommand::GetCurrentValue().

◆ ItoS()

G4String G4UImessenger::ItoS ( G4int  i)
protectedinherited

Definition at line 82 of file G4UImessenger.cc.

83{
84 std::ostringstream os;
85 os << i;
86 return G4String(os.str());
87}

Referenced by G4GenericMessenger::DeclareMethod(), and G4ParticleGunMessenger::GetCurrentValue().

◆ operator!=()

G4bool G4UImessenger::operator!= ( const G4UImessenger messenger) const
inherited

Definition at line 76 of file G4UImessenger.cc.

77{
78 return this != &messenger;
79}

◆ operator==()

G4bool G4UImessenger::operator== ( const G4UImessenger messenger) const
inherited

Definition at line 70 of file G4UImessenger.cc.

71{
72 return this == &messenger;
73}

◆ SetH2Cmd()

void G4H2Messenger::SetH2Cmd ( )
private

Definition at line 161 of file G4H2Messenger.cc.

162{
163 auto h2Id = new G4UIparameter("id", 'i', false);
164 h2Id->SetGuidance("Histogram id");
165 h2Id->SetParameterRange("id>=0");
166
167 auto h2xNbins = new G4UIparameter("xnbins", 'i', false);
168 h2xNbins->SetGuidance("Number of x-bins");
169
170 auto h2xValMin = new G4UIparameter("xvalMin", 'd', false);
171 h2xValMin->SetGuidance("Minimum x-value, expressed in unit");
172
173 auto h2xValMax = new G4UIparameter("xvalMax", 'd', false);
174 h2xValMax->SetGuidance("Maximum x-value, expressed in unit");
175
176 auto h2xValUnit = new G4UIparameter("xvalUnit", 's', false);
177 h2xValUnit->SetGuidance("The unit applied to filled x-values and xvalMin, xvalMax");
178 h2xValUnit->SetDefaultValue("none");
179
180 auto h2xValFcn = new G4UIparameter("xvalFcn", 's', false);
181 h2xValFcn->SetParameterCandidates("log log10 exp none");
182 G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
183 h2xValFcn->SetGuidance(fcnxGuidance);
184 h2xValFcn->SetDefaultValue("none");
185
186 auto h2xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
187 G4String xbinSchemeGuidance = "The binning scheme (linear, log).";
188 h2xValBinScheme->SetParameterCandidates("linear log");
189 h2xValBinScheme->SetGuidance(xbinSchemeGuidance);
190 h2xValBinScheme->SetDefaultValue("linear");
191
192 auto h2yNbins = new G4UIparameter("nybins", 'i', false);
193 h2yNbins->SetGuidance("Number of y-bins");
194
195 auto h2yValMin = new G4UIparameter("yvalMin", 'd', false);
196 h2yValMin->SetGuidance("Minimum y-value, expressed in unit");
197
198 auto h2yValMax = new G4UIparameter("yvalMax", 'd', false);
199 h2yValMax->SetGuidance("Maximum y-value, expressed in unit");
200
201 auto h2yValUnit = new G4UIparameter("yvalUnit", 's', true);
202 h2yValUnit->SetGuidance("The unit applied to filled y-values and yvalMin, yvalMax");
203 h2yValUnit->SetDefaultValue("none");
204
205 auto h2yValFcn = new G4UIparameter("yvalFcn", 's', false);
206 h2yValFcn->SetParameterCandidates("log log10 exp none");
207 G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
208 h2yValFcn->SetGuidance(fcnyGuidance);
209 h2yValFcn->SetDefaultValue("none");
210
211 auto h2yValBinScheme = new G4UIparameter("yvalBinScheme", 's', true);
212 G4String ybinSchemeGuidance = "The binning scheme (linear, log).";
213 h2yValBinScheme->SetParameterCandidates("linear log");
214 h2yValBinScheme->SetGuidance(ybinSchemeGuidance);
215 h2yValBinScheme->SetDefaultValue("linear");
216
217 fSetH2Cmd = std::make_unique<G4UIcommand>("/analysis/h2/set", this);
218 fSetH2Cmd->SetGuidance("Set parameters for the 2D histogram of given id:");
219 fSetH2Cmd->SetGuidance(" nxbins; xvalMin; xvalMax; xunit; xfunction; xbinScheme");
220 fSetH2Cmd->SetGuidance(" nybins; yvalMin; yvalMax; yunit; yfunction; ybinScheme");
221 fSetH2Cmd->SetParameter(h2Id);
222 fSetH2Cmd->SetParameter(h2xNbins);
223 fSetH2Cmd->SetParameter(h2xValMin);
224 fSetH2Cmd->SetParameter(h2xValMax);
225 fSetH2Cmd->SetParameter(h2xValUnit);
226 fSetH2Cmd->SetParameter(h2xValFcn);
227 fSetH2Cmd->SetParameter(h2xValBinScheme);
228 fSetH2Cmd->SetParameter(h2yNbins);
229 fSetH2Cmd->SetParameter(h2yValMin);
230 fSetH2Cmd->SetParameter(h2yValMax);
231 fSetH2Cmd->SetParameter(h2yValUnit);
232 fSetH2Cmd->SetParameter(h2yValFcn);
233 fSetH2Cmd->SetParameter(h2yValBinScheme);
234 fSetH2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
235}
std::unique_ptr< G4UIcommand > fSetH2Cmd

References fSetH2Cmd, G4State_Idle, and G4State_PreInit.

Referenced by G4H2Messenger().

◆ SetNewValue()

void G4H2Messenger::SetNewValue ( G4UIcommand command,
G4String  value 
)
finalvirtual

Reimplemented from G4UImessenger.

Definition at line 243 of file G4H2Messenger.cc.

244{
245 // tokenize parameters in a vector
246 std::vector<G4String> parameters;
247 G4Analysis::Tokenize(newValues, parameters);
248 // check consistency
249 if ( parameters.size() != command->GetParameterEntries() ) {
250 // Should never happen but let's check anyway for consistency
251 fHelper->WarnAboutParameters(command, parameters.size());
252 return;
253 }
254
255 if ( command == fCreateH2Cmd.get() ) {
256 auto counter = 0;
257 auto name = parameters[counter++];
258 auto title = parameters[counter++];
260 fHelper->GetBinData(xdata, parameters, counter);
261 auto xunit = GetUnitValue(xdata.fSunit);
263 fHelper->GetBinData(ydata, parameters, counter);
264 auto yunit = GetUnitValue(ydata.fSunit);
265 fManager->CreateH2(name, title,
266 xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
267 ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
268 xdata.fSunit, ydata.fSunit,
269 xdata.fSfcn, ydata.fSfcn,
270 xdata.fSbinScheme, ydata.fSbinScheme);
271 }
272 else if ( command == fSetH2Cmd.get() ) {
273 auto counter = 0;
274 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
276 fHelper->GetBinData(xdata, parameters, counter);
277 auto xunit = GetUnitValue(xdata.fSunit);
279 fHelper->GetBinData(ydata, parameters, counter);
280 auto yunit = GetUnitValue(ydata.fSunit);
281 fManager->SetH2(id,
282 xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
283 ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
284 xdata.fSunit, ydata.fSunit,
285 xdata.fSfcn, ydata.fSfcn,
286 xdata.fSbinScheme, ydata.fSbinScheme);
287 }
288 else if ( command == fSetH2XCmd.get() ) {
289 // Only save values
290 auto counter = 0;
291 fXId = G4UIcommand::ConvertToInt(parameters[counter++]);
292 fHelper->GetBinData(fXData, parameters, counter);
293 }
294 else if ( command == fSetH2YCmd.get() ) {
295 // Check if setX command was called
296 auto counter = 0;
297 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
298 if ( fXId == -1 || fXId != id ) {
299 fHelper->WarnAboutSetCommands();
300 return;
301 }
302 auto xunit = GetUnitValue(fXData.fSunit);
304 fHelper->GetBinData(ydata, parameters, counter);
305 auto yunit = GetUnitValue(ydata.fSunit);
306 fManager->SetH2(id,
307 fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
308 ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
309 fXData.fSunit, ydata.fSunit,
310 fXData.fSfcn, ydata.fSfcn,
312 fXId = -1;
313 }
314 else if ( command == fSetH2TitleCmd.get() ) {
315 auto counter = 0;
316 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
317 auto title = parameters[counter++];
318 fManager->SetH2Title(id, title);
319 }
320 else if ( command == fSetH2XAxisCmd.get() ) {
321 auto counter = 0;
322 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
323 auto xaxis = parameters[counter++];
324 fManager->SetH2XAxisTitle(id, xaxis);
325 }
326 else if ( command == fSetH2YAxisCmd.get() ) {
327 auto counter = 0;
328 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
329 auto yaxis = parameters[counter++];
330 fManager->SetH2YAxisTitle(id, yaxis);
331 }
332 else if ( command == fSetH2ZAxisCmd.get() ) {
333 auto counter = 0;
334 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
335 auto zaxis = parameters[counter++];
336 fManager->SetH2ZAxisTitle(id, zaxis);
337 }
338 else if ( command == fSetH2XAxisLogCmd.get() ) {
339 auto counter = 0;
340 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
341 auto xaxisLog = G4UIcommand::ConvertToBool(parameters[counter++]);
342 fManager->SetH2XAxisIsLog(id, xaxisLog);
343 }
344 else if ( command == fSetH2YAxisLogCmd.get() ) {
345 auto counter = 0;
346 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
347 auto yaxisLog = G4UIcommand::ConvertToBool(parameters[counter++]);
348 fManager->SetH2YAxisIsLog(id, yaxisLog);
349 }
350 else if ( command == fSetH2ZAxisLogCmd.get() ) {
351 auto counter = 0;
352 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
353 auto zaxisLog = G4UIcommand::ConvertToBool(parameters[counter++]);
354 fManager->SetH2ZAxisIsLog(id, zaxisLog);
355 }
356}
G4AnalysisMessengerHelper::BinData fXData
std::size_t GetParameterEntries() const
Definition: G4UIcommand.hh:138
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:557
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:545
G4bool SetH2XAxisIsLog(G4int id, G4bool isLog)
G4bool SetH2Title(G4int id, const G4String &title)
G4bool SetH2YAxisIsLog(G4int id, G4bool isLog)
G4bool SetH2XAxisTitle(G4int id, const G4String &title)
G4bool SetH2YAxisTitle(G4int id, const G4String &title)
G4bool SetH2(G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear")
G4bool SetH2ZAxisIsLog(G4int id, G4bool isLog)
G4int CreateH2(const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear")
G4bool SetH2ZAxisTitle(G4int id, const G4String &title)
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
G4double GetUnitValue(const G4String &unit)
const char * name(G4int ptype)

References G4UIcommand::ConvertToBool(), G4UIcommand::ConvertToInt(), G4VAnalysisManager::CreateH2(), fCreateH2Cmd, fHelper, fManager, G4AnalysisMessengerHelper::BinData::fNbins, G4AnalysisMessengerHelper::BinData::fSbinScheme, fSetH2Cmd, fSetH2TitleCmd, fSetH2XAxisCmd, fSetH2XAxisLogCmd, fSetH2XCmd, fSetH2YAxisCmd, fSetH2YAxisLogCmd, fSetH2YCmd, fSetH2ZAxisCmd, fSetH2ZAxisLogCmd, G4AnalysisMessengerHelper::BinData::fSfcn, G4AnalysisMessengerHelper::BinData::fSunit, G4AnalysisMessengerHelper::BinData::fVmax, G4AnalysisMessengerHelper::BinData::fVmin, fXData, fXId, G4UIcommand::GetParameterEntries(), G4Analysis::GetUnitValue(), G4InuclParticleNames::name(), G4VAnalysisManager::SetH2(), G4VAnalysisManager::SetH2Title(), G4VAnalysisManager::SetH2XAxisIsLog(), G4VAnalysisManager::SetH2XAxisTitle(), G4VAnalysisManager::SetH2YAxisIsLog(), G4VAnalysisManager::SetH2YAxisTitle(), G4VAnalysisManager::SetH2ZAxisIsLog(), G4VAnalysisManager::SetH2ZAxisTitle(), and G4Analysis::Tokenize().

◆ StoB()

G4bool G4UImessenger::StoB ( G4String  s)
protectedinherited

Definition at line 137 of file G4UImessenger.cc.

138{
140 G4bool vl = false;
141 if(v == "Y" || v == "YES" || v == "1" || v == "T" || v == "TRUE")
142 {
143 vl = true;
144 }
145 return vl;
146}
bool G4bool
Definition: G4Types.hh:86
G4String to_upper_copy(G4String str)
Return uppercase copy of string.

References G4StrUtil::to_upper_copy().

Referenced by G4LocalThreadCoutMessenger::SetNewValue(), G4CascadeParamMessenger::SetNewValue(), G4ScoreQuantityMessenger::SetNewValue(), and G4ScoringMessenger::SetNewValue().

◆ StoD()

G4double G4UImessenger::StoD ( G4String  s)
protectedinherited

◆ StoI()

G4int G4UImessenger::StoI ( G4String  s)
protectedinherited

◆ StoL()

G4long G4UImessenger::StoL ( G4String  s)
protectedinherited

Definition at line 117 of file G4UImessenger.cc.

118{
119 G4long vl;
120 const char* t = str;
121 std::istringstream is(t);
122 is >> vl;
123 return vl;
124}
long G4long
Definition: G4Types.hh:87

Referenced by G4RunMessenger::SetNewValue().

Field Documentation

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir = nullptr
protectedinherited

◆ baseDirName

G4String G4UImessenger::baseDirName = ""
protectedinherited

◆ commandsShouldBeInMaster

G4bool G4UImessenger::commandsShouldBeInMaster = false
protectedinherited

◆ fCreateH2Cmd

std::unique_ptr<G4UIcommand> G4H2Messenger::fCreateH2Cmd
private

Definition at line 64 of file G4H2Messenger.hh.

Referenced by CreateH2Cmd(), and SetNewValue().

◆ fDirectory

std::unique_ptr<G4UIdirectory> G4H2Messenger::fDirectory
private

Definition at line 62 of file G4H2Messenger.hh.

Referenced by G4H2Messenger().

◆ fHelper

std::unique_ptr<G4AnalysisMessengerHelper> G4H2Messenger::fHelper
private

Definition at line 61 of file G4H2Messenger.hh.

Referenced by G4H2Messenger(), and SetNewValue().

◆ fManager

G4VAnalysisManager* G4H2Messenger::fManager { nullptr }
private

Associated class.

Definition at line 60 of file G4H2Messenger.hh.

Referenced by SetNewValue().

◆ fSetH2Cmd

std::unique_ptr<G4UIcommand> G4H2Messenger::fSetH2Cmd
private

Definition at line 65 of file G4H2Messenger.hh.

Referenced by SetH2Cmd(), and SetNewValue().

◆ fSetH2TitleCmd

std::unique_ptr<G4UIcommand> G4H2Messenger::fSetH2TitleCmd
private

Definition at line 68 of file G4H2Messenger.hh.

Referenced by G4H2Messenger(), and SetNewValue().

◆ fSetH2XAxisCmd

std::unique_ptr<G4UIcommand> G4H2Messenger::fSetH2XAxisCmd
private

Definition at line 69 of file G4H2Messenger.hh.

Referenced by G4H2Messenger(), and SetNewValue().

◆ fSetH2XAxisLogCmd

std::unique_ptr<G4UIcommand> G4H2Messenger::fSetH2XAxisLogCmd
private

Definition at line 72 of file G4H2Messenger.hh.

Referenced by G4H2Messenger(), and SetNewValue().

◆ fSetH2XCmd

std::unique_ptr<G4UIcommand> G4H2Messenger::fSetH2XCmd
private

Definition at line 66 of file G4H2Messenger.hh.

Referenced by G4H2Messenger(), and SetNewValue().

◆ fSetH2YAxisCmd

std::unique_ptr<G4UIcommand> G4H2Messenger::fSetH2YAxisCmd
private

Definition at line 70 of file G4H2Messenger.hh.

Referenced by G4H2Messenger(), and SetNewValue().

◆ fSetH2YAxisLogCmd

std::unique_ptr<G4UIcommand> G4H2Messenger::fSetH2YAxisLogCmd
private

Definition at line 73 of file G4H2Messenger.hh.

Referenced by G4H2Messenger(), and SetNewValue().

◆ fSetH2YCmd

std::unique_ptr<G4UIcommand> G4H2Messenger::fSetH2YCmd
private

Definition at line 67 of file G4H2Messenger.hh.

Referenced by G4H2Messenger(), and SetNewValue().

◆ fSetH2ZAxisCmd

std::unique_ptr<G4UIcommand> G4H2Messenger::fSetH2ZAxisCmd
private

Definition at line 71 of file G4H2Messenger.hh.

Referenced by G4H2Messenger(), and SetNewValue().

◆ fSetH2ZAxisLogCmd

std::unique_ptr<G4UIcommand> G4H2Messenger::fSetH2ZAxisLogCmd
private

Definition at line 74 of file G4H2Messenger.hh.

Referenced by G4H2Messenger(), and SetNewValue().

◆ fXData

G4AnalysisMessengerHelper::BinData G4H2Messenger::fXData
private

Definition at line 77 of file G4H2Messenger.hh.

Referenced by SetNewValue().

◆ fXId

G4int G4H2Messenger::fXId { G4Analysis::kInvalidId }
private

Definition at line 76 of file G4H2Messenger.hh.

Referenced by SetNewValue().


The documentation for this class was generated from the following files: