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

#include <G4H3Messenger.hh>

Inheritance diagram for G4H3Messenger:
G4UImessenger

Public Member Functions

G4bool CommandsShouldBeInMaster () const
 
 G4H3Messenger ()=delete
 
 G4H3Messenger (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 ~G4H3Messenger ()
 

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 CreateH3Cmd ()
 
void SetH3Cmd ()
 

Private Attributes

std::unique_ptr< G4UIcommandfCreateH3Cmd
 
std::unique_ptr< G4UIdirectoryfDirectory
 
std::unique_ptr< G4AnalysisMessengerHelperfHelper
 
G4VAnalysisManagerfManager { nullptr }
 Associated class. More...
 
std::unique_ptr< G4UIcommandfSetH3Cmd
 
std::unique_ptr< G4UIcommandfSetH3TitleCmd
 
std::unique_ptr< G4UIcommandfSetH3XAxisCmd
 
std::unique_ptr< G4UIcommandfSetH3XAxisLogCmd
 
std::unique_ptr< G4UIcommandfSetH3XCmd
 
std::unique_ptr< G4UIcommandfSetH3YAxisCmd
 
std::unique_ptr< G4UIcommandfSetH3YAxisLogCmd
 
std::unique_ptr< G4UIcommandfSetH3YCmd
 
std::unique_ptr< G4UIcommandfSetH3ZAxisCmd
 
std::unique_ptr< G4UIcommandfSetH3ZAxisLogCmd
 
std::unique_ptr< G4UIcommandfSetH3ZCmd
 
G4AnalysisMessengerHelper::BinData fXData
 
G4int fXId { G4Analysis::kInvalidId }
 
G4AnalysisMessengerHelper::BinData fYData
 
G4int fYId { G4Analysis::kInvalidId }
 

Detailed Description

Definition at line 46 of file G4H3Messenger.hh.

Constructor & Destructor Documentation

◆ G4H3Messenger() [1/2]

G4H3Messenger::G4H3Messenger ( G4VAnalysisManager manager)
explicit

Definition at line 39 of file G4H3Messenger.cc.

40 : G4UImessenger(),
41 fManager(manager)
42{
43 fHelper = std::make_unique<G4AnalysisMessengerHelper>("h3");
44
45 fDirectory = fHelper->CreateHnDirectory();
46
48
49 SetH3Cmd();
50 fSetH3XCmd = fHelper->CreateSetBinsCommand("x", this);
51 fSetH3YCmd = fHelper->CreateSetBinsCommand("y", this);
52
53 fSetH3TitleCmd = fHelper->CreateSetTitleCommand(this);
54 fSetH3XAxisCmd = fHelper->CreateSetAxisCommand("x", this);
55 fSetH3YAxisCmd = fHelper->CreateSetAxisCommand("y", this);
56 fSetH3ZAxisCmd = fHelper->CreateSetAxisCommand("z", this);
57 fSetH3XAxisLogCmd = fHelper->CreateSetAxisLogCommand("x", this);
58 fSetH3YAxisLogCmd = fHelper->CreateSetAxisLogCommand("y", this);
59 fSetH3ZAxisLogCmd = fHelper->CreateSetAxisLogCommand("z", this);
60}
std::unique_ptr< G4UIcommand > fSetH3XAxisCmd
std::unique_ptr< G4UIdirectory > fDirectory
std::unique_ptr< G4UIcommand > fSetH3ZAxisCmd
std::unique_ptr< G4UIcommand > fSetH3XCmd
std::unique_ptr< G4UIcommand > fSetH3YCmd
std::unique_ptr< G4UIcommand > fSetH3YAxisCmd
std::unique_ptr< G4UIcommand > fSetH3YAxisLogCmd
std::unique_ptr< G4UIcommand > fSetH3XAxisLogCmd
G4VAnalysisManager * fManager
Associated class.
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
void CreateH3Cmd()
std::unique_ptr< G4UIcommand > fSetH3ZAxisLogCmd
std::unique_ptr< G4UIcommand > fSetH3TitleCmd

References CreateH3Cmd(), fDirectory, fHelper, fSetH3TitleCmd, fSetH3XAxisCmd, fSetH3XAxisLogCmd, fSetH3XCmd, fSetH3YAxisCmd, fSetH3YAxisLogCmd, fSetH3YCmd, fSetH3ZAxisCmd, fSetH3ZAxisLogCmd, and SetH3Cmd().

◆ G4H3Messenger() [2/2]

G4H3Messenger::G4H3Messenger ( )
delete

◆ ~G4H3Messenger()

G4H3Messenger::~G4H3Messenger ( )
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().

◆ CreateH3Cmd()

void G4H3Messenger::CreateH3Cmd ( )
private

Definition at line 70 of file G4H3Messenger.cc.

71{
72 auto h3Name = new G4UIparameter("name", 's', false);
73 h3Name->SetGuidance("Histogram name (label)");
74
75 auto h3Title = new G4UIparameter("title", 's', false);
76 h3Title->SetGuidance("Histogram title");
77
78 auto h3xNbins0 = new G4UIparameter("xnbins0", 'i', true);
79 h3xNbins0->SetGuidance("Number of x-bins (default = 100)");
80 h3xNbins0->SetGuidance("Can be reset with /analysis/h3/set command");
81 h3xNbins0->SetDefaultValue(100);
82
83 auto h3xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
84 h3xValMin0->SetGuidance("Minimum x-value, expressed in unit (default = 0.)");
85 h3xValMin0->SetGuidance("Can be reset with /analysis/h3/set command");
86 h3xValMin0->SetDefaultValue(0.);
87
88 auto h3xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
89 h3xValMax0->SetGuidance("Maximum x-value, expressed in unit (default = 1.)");
90 h3xValMax0->SetGuidance("Can be reset with /analysis/h3/set command");
91 h3xValMax0->SetDefaultValue(1.);
92
93 auto h3xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
94 h3xValUnit0->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
95 h3xValUnit0->SetDefaultValue("none");
96
97 auto h3xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
98 G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
99 h3xValFcn0->SetGuidance(fcnxGuidance);
100 h3xValFcn0->SetParameterCandidates("log log10 exp none");
101 h3xValFcn0->SetDefaultValue("none");
102
103 auto h3xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
104 G4String xbinSchemeGuidance = "The binning scheme (linear, log).";
105 h3xValBinScheme0->SetParameterCandidates("linear log");
106 h3xValBinScheme0->SetGuidance(xbinSchemeGuidance);
107 h3xValBinScheme0->SetDefaultValue("linear");
108
109 auto h3yNbins0 = new G4UIparameter("ynbins0", 'i', true);
110 h3yNbins0->SetGuidance("Number of y-bins (default = 100)");
111 h3yNbins0->SetGuidance("Can be reset with /analysis/h3/set command");
112 h3yNbins0->SetDefaultValue(100);
113
114 auto h3yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
115 h3yValMin0->SetGuidance("Minimum y-value, expressed in unit (default = 0.)");
116 h3yValMin0->SetGuidance("Can be reset with /analysis/h3/set command");
117 h3yValMin0->SetDefaultValue(0.);
118
119 auto h3yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
120 h3yValMax0->SetGuidance("Maximum y-value, expressed in unit (default = 1.)");
121 h3yValMax0->SetGuidance("Can be reset with /analysis/h3/set command");
122 h3yValMax0->SetDefaultValue(1.);
123
124 auto h3yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
125 h3yValUnit0->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
126 h3yValUnit0->SetDefaultValue("none");
127
128 auto h3yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
129 G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
130 h3yValFcn0->SetGuidance(fcnyGuidance);
131 h3yValFcn0->SetParameterCandidates("log log10 exp none");
132 h3yValFcn0->SetDefaultValue("none");
133
134 auto h3yValBinScheme0 = new G4UIparameter("yvalBinScheme0", 's', true);
135 G4String ybinSchemeGuidance = "The binning scheme (linear, log).";
136 h3yValBinScheme0->SetParameterCandidates("linear log");
137 h3yValBinScheme0->SetGuidance(ybinSchemeGuidance);
138 h3yValBinScheme0->SetDefaultValue("linear");
139
140 auto h3zNbins0 = new G4UIparameter("znbins0", 'i', true);
141 h3zNbins0->SetGuidance("Number of z-bins (default = 100)");
142 h3zNbins0->SetGuidance("Can be reset with /analysis/h3/set command");
143 h3zNbins0->SetDefaultValue(100);
144
145 auto h3zValMin0 = new G4UIparameter("zvalMin0", 'd', true);
146 h3zValMin0->SetGuidance("Minimum z-value, expressed in unit (default = 0.)");
147 h3zValMin0->SetGuidance("Can be reset with /analysis/h3/set command");
148 h3zValMin0->SetDefaultValue(0.);
149
150 auto h3zValMax0 = new G4UIparameter("zvalMax0", 'd', true);
151 h3zValMax0->SetGuidance("Maximum z-value, expressed in unit (default = 1.)");
152 h3zValMax0->SetGuidance("Can be reset with /analysis/h3/set command");
153 h3zValMax0->SetDefaultValue(1.);
154
155 auto h3zValUnit0 = new G4UIparameter("zvalUnit0", 's', true);
156 h3zValUnit0->SetGuidance("The unit applied to filled z-values and zvalMin0, zvalMax0");
157 h3zValUnit0->SetDefaultValue("none");
158
159 auto h3zValFcn0 = new G4UIparameter("zvalFcn0", 's', true);
160 G4String fcnzGuidance = "The function applied to filled z-values (log, log10, exp, none).";
161 h3zValFcn0->SetGuidance(fcnzGuidance);
162 h3zValFcn0->SetParameterCandidates("log log10 exp none");
163 h3zValFcn0->SetDefaultValue("none");
164
165 auto h3zValBinScheme0 = new G4UIparameter("zvalBinScheme0", 's', true);
166 G4String zbinSchemeGuidance = "The binning scheme (linear, log).";
167 h3zValBinScheme0->SetParameterCandidates("linear log");
168 h3zValBinScheme0->SetGuidance(zbinSchemeGuidance);
169 h3zValBinScheme0->SetDefaultValue("linear");
170
171 fCreateH3Cmd = std::make_unique<G4UIcommand>("/analysis/h3/create", this);
172 fCreateH3Cmd->SetGuidance("Create 3D histogram");
173 fCreateH3Cmd->SetParameter(h3Name);
174 fCreateH3Cmd->SetParameter(h3Title);
175 fCreateH3Cmd->SetParameter(h3xNbins0);
176 fCreateH3Cmd->SetParameter(h3xValMin0);
177 fCreateH3Cmd->SetParameter(h3xValMax0);
178 fCreateH3Cmd->SetParameter(h3xValUnit0);
179 fCreateH3Cmd->SetParameter(h3xValFcn0);
180 fCreateH3Cmd->SetParameter(h3xValBinScheme0);
181 fCreateH3Cmd->SetParameter(h3yNbins0);
182 fCreateH3Cmd->SetParameter(h3yValMin0);
183 fCreateH3Cmd->SetParameter(h3yValMax0);
184 fCreateH3Cmd->SetParameter(h3yValUnit0);
185 fCreateH3Cmd->SetParameter(h3yValFcn0);
186 fCreateH3Cmd->SetParameter(h3yValBinScheme0);
187 fCreateH3Cmd->SetParameter(h3zNbins0);
188 fCreateH3Cmd->SetParameter(h3zValMin0);
189 fCreateH3Cmd->SetParameter(h3zValMax0);
190 fCreateH3Cmd->SetParameter(h3zValUnit0);
191 fCreateH3Cmd->SetParameter(h3zValFcn0);
192 fCreateH3Cmd->SetParameter(h3zValBinScheme0);
193 fCreateH3Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
194}
@ G4State_Idle
@ G4State_PreInit
std::unique_ptr< G4UIcommand > fCreateH3Cmd

References fCreateH3Cmd, G4State_Idle, and G4State_PreInit.

Referenced by G4H3Messenger().

◆ 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}

◆ SetH3Cmd()

void G4H3Messenger::SetH3Cmd ( )
private

Definition at line 198 of file G4H3Messenger.cc.

199{
200 auto h3Id = new G4UIparameter("id", 'i', false);
201 h3Id->SetGuidance("Histogram id");
202 h3Id->SetParameterRange("id>=0");
203
204 auto h3xNbins = new G4UIparameter("xnbins", 'i', false);
205 h3xNbins->SetGuidance("Number of x-bins");
206
207 auto h3xValMin = new G4UIparameter("xvalMin", 'd', false);
208 h3xValMin->SetGuidance("Minimum x-value, expressed in unit");
209
210 auto h3xValMax = new G4UIparameter("xvalMax", 'd', false);
211 h3xValMax->SetGuidance("Maximum x-value, expressed in unit");
212
213 auto h3xValUnit = new G4UIparameter("xvalUnit", 's', false);
214 h3xValUnit->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
215 h3xValUnit->SetDefaultValue("none");
216
217 auto h3xValFcn = new G4UIparameter("xvalFcn", 's', false);
218 h3xValFcn->SetParameterCandidates("log log10 exp none");
219 G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
220 h3xValFcn->SetGuidance(fcnxGuidance);
221 h3xValFcn->SetDefaultValue("none");
222
223 auto h3xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
224 G4String xbinSchemeGuidance = "The binning scheme (linear, log).";
225 h3xValBinScheme->SetParameterCandidates("linear log");
226 h3xValBinScheme->SetGuidance(xbinSchemeGuidance);
227 h3xValBinScheme->SetDefaultValue("linear");
228
229 auto h3yNbins = new G4UIparameter("nybins", 'i', false);
230 h3yNbins->SetGuidance("Number of y-bins");
231
232 auto h3yValMin = new G4UIparameter("yvalMin", 'd', false);
233 h3yValMin->SetGuidance("Minimum y-value, expressed in unit");
234
235 auto h3yValMax = new G4UIparameter("yvalMax", 'd', false);
236 h3yValMax->SetGuidance("Maximum y-value, expressed in unit");
237
238 auto h3yValUnit = new G4UIparameter("yvalUnit", 's', true);
239 h3yValUnit->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
240 h3yValUnit->SetDefaultValue("none");
241
242 auto h3yValFcn = new G4UIparameter("yvalFcn", 's', false);
243 h3yValFcn->SetParameterCandidates("log log10 exp none");
244 G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
245 h3yValFcn->SetGuidance(fcnyGuidance);
246 h3yValFcn->SetDefaultValue("none");
247
248 auto h3yValBinScheme = new G4UIparameter("yvalBinScheme", 's', true);
249 G4String ybinSchemeGuidance = "The binning scheme (linear, log).";
250 h3yValBinScheme->SetParameterCandidates("linear log");
251 h3yValBinScheme->SetGuidance(ybinSchemeGuidance);
252 h3yValBinScheme->SetDefaultValue("linear");
253
254 auto h3zNbins = new G4UIparameter("nzbins", 'i', false);
255 h3zNbins->SetGuidance("Number of z-bins");
256
257 auto h3zValMin = new G4UIparameter("zvalMin", 'd', false);
258 h3zValMin->SetGuidance("Minimum z-value, expressed in unit");
259
260 auto h3zValMax = new G4UIparameter("zvalMax", 'd', false);
261 h3zValMax->SetGuidance("Maximum z-value, expressed in unit");
262
263 auto h3zValUnit = new G4UIparameter("zvalUnit", 's', true);
264 h3zValUnit->SetGuidance("The unit applied to filled z-values and zvalMin0, zvalMax0");
265 h3zValUnit->SetDefaultValue("none");
266
267 auto h3zValFcn = new G4UIparameter("zvalFcn", 's', false);
268 h3zValFcn->SetParameterCandidates("log log10 exp none");
269 G4String fcnzGuidance = "The function applied to filled z-values (log, log10, exp, none).";
270 h3zValFcn->SetGuidance(fcnzGuidance);
271 h3zValFcn->SetDefaultValue("none");
272
273 auto h3zValBinScheme = new G4UIparameter("zvalBinScheme", 's', true);
274 G4String zbinSchemeGuidance = "The binning scheme (linear, log).";
275 h3zValBinScheme->SetParameterCandidates("linear log");
276 h3zValBinScheme->SetGuidance(zbinSchemeGuidance);
277 h3zValBinScheme->SetDefaultValue("linear");
278
279 fSetH3Cmd = std::make_unique<G4UIcommand>("/analysis/h3/set", this);
280 fSetH3Cmd->SetGuidance("Set parameters for the 3D histogram of given id:");
281 fSetH3Cmd->SetGuidance(" nxbins; xvalMin; xvalMax; xunit; xfunction; xbinScheme");
282 fSetH3Cmd->SetGuidance(" nybins; yvalMin; yvalMax; yunit; yfunction; ybinScheme");
283 fSetH3Cmd->SetGuidance(" nzbins; zvalMin; zvalMax; zunit; zfunction; zbinScheme");
284 fSetH3Cmd->SetParameter(h3Id);
285 fSetH3Cmd->SetParameter(h3xNbins);
286 fSetH3Cmd->SetParameter(h3xValMin);
287 fSetH3Cmd->SetParameter(h3xValMax);
288 fSetH3Cmd->SetParameter(h3xValUnit);
289 fSetH3Cmd->SetParameter(h3xValFcn);
290 fSetH3Cmd->SetParameter(h3xValBinScheme);
291 fSetH3Cmd->SetParameter(h3yNbins);
292 fSetH3Cmd->SetParameter(h3yValMin);
293 fSetH3Cmd->SetParameter(h3yValMax);
294 fSetH3Cmd->SetParameter(h3yValUnit);
295 fSetH3Cmd->SetParameter(h3yValFcn);
296 fSetH3Cmd->SetParameter(h3yValBinScheme);
297 fSetH3Cmd->SetParameter(h3zNbins);
298 fSetH3Cmd->SetParameter(h3zValMin);
299 fSetH3Cmd->SetParameter(h3zValMax);
300 fSetH3Cmd->SetParameter(h3zValUnit);
301 fSetH3Cmd->SetParameter(h3zValFcn);
302 fSetH3Cmd->SetParameter(h3zValBinScheme);
303 fSetH3Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
304}
std::unique_ptr< G4UIcommand > fSetH3Cmd

References fSetH3Cmd, G4State_Idle, and G4State_PreInit.

Referenced by G4H3Messenger().

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 312 of file G4H3Messenger.cc.

313{
314 // tokenize parameters in a vector
315 std::vector<G4String> parameters;
316 G4Analysis::Tokenize(newValues, parameters);
317 // check consistency
318 if ( parameters.size() != command->GetParameterEntries() ) {
319 // Should never happen but let's check anyway for consistency
320 fHelper->WarnAboutParameters(command, parameters.size());
321 return;
322 }
323
324 if ( command == fCreateH3Cmd.get() ) {
325 auto counter = 0;
326 auto name = parameters[counter++];
327 auto title = parameters[counter++];
329 fHelper->GetBinData(xdata, parameters, counter);
330 auto xunit = GetUnitValue(xdata.fSunit);
332 fHelper->GetBinData(ydata, parameters, counter);
333 auto yunit = GetUnitValue(ydata.fSunit);
335 fHelper->GetBinData(zdata, parameters, counter);
336 auto zunit = GetUnitValue(zdata.fSunit);
337 fManager->CreateH3(name, title,
338 xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
339 ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
340 zdata.fNbins, zdata.fVmin*zunit, zdata.fVmax*zunit,
341 xdata.fSunit, ydata.fSunit, zdata.fSunit,
342 xdata.fSfcn, ydata.fSfcn, zdata.fSfcn,
343 xdata.fSbinScheme, ydata.fSbinScheme, zdata.fSbinScheme);
344 }
345 else if ( command == fSetH3Cmd.get() ) {
346 auto counter = 0;
347 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
349 fHelper->GetBinData(xdata, parameters, counter);
350 auto xunit = GetUnitValue(xdata.fSunit);
352 fHelper->GetBinData(ydata, parameters, counter);
353 auto yunit = GetUnitValue(ydata.fSunit);
355 fHelper->GetBinData(zdata, parameters, counter);
356 auto zunit = GetUnitValue(zdata.fSunit);
357 fManager->SetH3(id,
358 xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
359 ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
360 zdata.fNbins, zdata.fVmin*zunit, zdata.fVmax*zunit,
361 xdata.fSunit, ydata.fSunit, zdata.fSunit,
362 xdata.fSfcn, ydata.fSfcn, zdata.fSfcn,
363 xdata.fSbinScheme, ydata.fSbinScheme, zdata.fSbinScheme);
364 }
365 else if ( command == fSetH3XCmd.get() ) {
366 // Only save values
367 auto counter = 0;
368 fXId = G4UIcommand::ConvertToInt(parameters[counter++]);
369 fHelper->GetBinData(fXData, parameters, counter);
370 }
371 else if ( command == fSetH3YCmd.get() ) {
372 // Only save values
373 auto counter = 0;
374 fYId = G4UIcommand::ConvertToInt(parameters[counter++]);
375 fHelper->GetBinData(fYData, parameters, counter);
376 }
377 else if ( command == fSetH3ZCmd.get() ) {
378 auto counter = 0;
379 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
380 // Check if setX and setY command was called
381 if ( fXId == -1 || fXId != id ||
382 fYId == -1 || fYId != id ) {
383 fHelper->WarnAboutSetCommands();
384 return;
385 }
386 auto xunit = GetUnitValue(fXData.fSunit);
387 auto yunit = GetUnitValue(fYData.fSunit);
389 fHelper->GetBinData(zdata, parameters, counter);
390 auto zunit = GetUnitValue(zdata.fSunit);
391 fManager->SetH3(id,
392 fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
393 fYData.fNbins, fYData.fVmin*yunit, fYData.fVmax*yunit,
394 zdata.fNbins, zdata.fVmin*zunit, zdata.fVmax*zunit,
396 fXData.fSfcn, fYData.fSfcn, zdata.fSfcn,
398 fXId = -1;
399 fYId = -1;
400 }
401 else if ( command == fSetH3TitleCmd.get() ) {
402 auto counter = 0;
403 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
404 auto title = parameters[counter++];
405 fManager->SetH3Title(id, title);
406 }
407 else if ( command == fSetH3XAxisCmd.get() ) {
408 auto counter = 0;
409 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
410 auto xaxis = parameters[counter++];
411 fManager->SetH3XAxisTitle(id, xaxis);
412 }
413 else if ( command == fSetH3YAxisCmd.get() ) {
414 auto counter = 0;
415 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
416 auto yaxis = parameters[counter++];
417 fManager->SetH3YAxisTitle(id, yaxis);
418 }
419 else if ( command == fSetH3ZAxisCmd.get() ) {
420 auto counter = 0;
421 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
422 auto zaxis = parameters[counter++];
423 fManager->SetH3ZAxisTitle(id, zaxis);
424 }
425 else if ( command == fSetH3XAxisLogCmd.get() ) {
426 auto counter = 0;
427 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
428 auto xaxisLog = G4UIcommand::ConvertToBool(parameters[counter++]);
429 fManager->SetH3XAxisIsLog(id, xaxisLog);
430 }
431 else if ( command == fSetH3YAxisLogCmd.get() ) {
432 auto counter = 0;
433 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
434 auto yaxisLog = G4UIcommand::ConvertToBool(parameters[counter++]);
435 fManager->SetH3YAxisIsLog(id, yaxisLog);
436 }
437 else if ( command == fSetH3ZAxisLogCmd.get() ) {
438 auto counter = 0;
439 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
440 auto zaxisLog = G4UIcommand::ConvertToBool(parameters[counter++]);
441 fManager->SetH3ZAxisIsLog(id, zaxisLog);
442 }
443}
G4AnalysisMessengerHelper::BinData fXData
std::unique_ptr< G4UIcommand > fSetH3ZCmd
G4AnalysisMessengerHelper::BinData fYData
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 SetH3Title(G4int id, const G4String &title)
G4bool SetH3(G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nzbins, G4double zmin, G4double zmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &zunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &zfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear", const G4String &zbinSchemeName="linear")
G4bool SetH3YAxisTitle(G4int id, const G4String &title)
G4int CreateH3(const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4int nzbins, G4double zmin, G4double zmax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &zunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &zfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear", const G4String &zbinSchemeName="linear")
G4bool SetH3XAxisIsLog(G4int id, G4bool isLog)
G4bool SetH3XAxisTitle(G4int id, const G4String &title)
G4bool SetH3YAxisIsLog(G4int id, G4bool isLog)
G4bool SetH3ZAxisIsLog(G4int id, G4bool isLog)
G4bool SetH3ZAxisTitle(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::CreateH3(), fCreateH3Cmd, fHelper, fManager, G4AnalysisMessengerHelper::BinData::fNbins, G4AnalysisMessengerHelper::BinData::fSbinScheme, fSetH3Cmd, fSetH3TitleCmd, fSetH3XAxisCmd, fSetH3XAxisLogCmd, fSetH3XCmd, fSetH3YAxisCmd, fSetH3YAxisLogCmd, fSetH3YCmd, fSetH3ZAxisCmd, fSetH3ZAxisLogCmd, fSetH3ZCmd, G4AnalysisMessengerHelper::BinData::fSfcn, G4AnalysisMessengerHelper::BinData::fSunit, G4AnalysisMessengerHelper::BinData::fVmax, G4AnalysisMessengerHelper::BinData::fVmin, fXData, fXId, fYData, fYId, G4UIcommand::GetParameterEntries(), G4Analysis::GetUnitValue(), G4InuclParticleNames::name(), G4VAnalysisManager::SetH3(), G4VAnalysisManager::SetH3Title(), G4VAnalysisManager::SetH3XAxisIsLog(), G4VAnalysisManager::SetH3XAxisTitle(), G4VAnalysisManager::SetH3YAxisIsLog(), G4VAnalysisManager::SetH3YAxisTitle(), G4VAnalysisManager::SetH3ZAxisIsLog(), G4VAnalysisManager::SetH3ZAxisTitle(), 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

◆ fCreateH3Cmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fCreateH3Cmd
private

Definition at line 64 of file G4H3Messenger.hh.

Referenced by CreateH3Cmd(), and SetNewValue().

◆ fDirectory

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

Definition at line 62 of file G4H3Messenger.hh.

Referenced by G4H3Messenger().

◆ fHelper

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

Definition at line 61 of file G4H3Messenger.hh.

Referenced by G4H3Messenger(), and SetNewValue().

◆ fManager

G4VAnalysisManager* G4H3Messenger::fManager { nullptr }
private

Associated class.

Definition at line 60 of file G4H3Messenger.hh.

Referenced by SetNewValue().

◆ fSetH3Cmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fSetH3Cmd
private

Definition at line 65 of file G4H3Messenger.hh.

Referenced by SetH3Cmd(), and SetNewValue().

◆ fSetH3TitleCmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fSetH3TitleCmd
private

Definition at line 69 of file G4H3Messenger.hh.

Referenced by G4H3Messenger(), and SetNewValue().

◆ fSetH3XAxisCmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fSetH3XAxisCmd
private

Definition at line 70 of file G4H3Messenger.hh.

Referenced by G4H3Messenger(), and SetNewValue().

◆ fSetH3XAxisLogCmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fSetH3XAxisLogCmd
private

Definition at line 73 of file G4H3Messenger.hh.

Referenced by G4H3Messenger(), and SetNewValue().

◆ fSetH3XCmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fSetH3XCmd
private

Definition at line 66 of file G4H3Messenger.hh.

Referenced by G4H3Messenger(), and SetNewValue().

◆ fSetH3YAxisCmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fSetH3YAxisCmd
private

Definition at line 71 of file G4H3Messenger.hh.

Referenced by G4H3Messenger(), and SetNewValue().

◆ fSetH3YAxisLogCmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fSetH3YAxisLogCmd
private

Definition at line 74 of file G4H3Messenger.hh.

Referenced by G4H3Messenger(), and SetNewValue().

◆ fSetH3YCmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fSetH3YCmd
private

Definition at line 67 of file G4H3Messenger.hh.

Referenced by G4H3Messenger(), and SetNewValue().

◆ fSetH3ZAxisCmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fSetH3ZAxisCmd
private

Definition at line 72 of file G4H3Messenger.hh.

Referenced by G4H3Messenger(), and SetNewValue().

◆ fSetH3ZAxisLogCmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fSetH3ZAxisLogCmd
private

Definition at line 75 of file G4H3Messenger.hh.

Referenced by G4H3Messenger(), and SetNewValue().

◆ fSetH3ZCmd

std::unique_ptr<G4UIcommand> G4H3Messenger::fSetH3ZCmd
private

Definition at line 68 of file G4H3Messenger.hh.

Referenced by SetNewValue().

◆ fXData

G4AnalysisMessengerHelper::BinData G4H3Messenger::fXData
private

Definition at line 79 of file G4H3Messenger.hh.

Referenced by SetNewValue().

◆ fXId

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

Definition at line 77 of file G4H3Messenger.hh.

Referenced by SetNewValue().

◆ fYData

G4AnalysisMessengerHelper::BinData G4H3Messenger::fYData
private

Definition at line 80 of file G4H3Messenger.hh.

Referenced by SetNewValue().

◆ fYId

G4int G4H3Messenger::fYId { G4Analysis::kInvalidId }
private

Definition at line 78 of file G4H3Messenger.hh.

Referenced by SetNewValue().


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