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

#include <G4P1Messenger.hh>

Inheritance diagram for G4P1Messenger:
G4UImessenger

Public Member Functions

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

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 CreateP1Cmd ()
 
void SetP1Cmd ()
 

Private Attributes

std::unique_ptr< G4UIcommandfCreateP1Cmd
 
std::unique_ptr< G4UIdirectoryfDirectory
 
std::unique_ptr< G4AnalysisMessengerHelperfHelper
 
G4VAnalysisManagerfManager { nullptr }
 Associated class. More...
 
std::unique_ptr< G4UIcommandfSetP1Cmd
 
std::unique_ptr< G4UIcommandfSetP1TitleCmd
 
std::unique_ptr< G4UIcommandfSetP1XAxisCmd
 
std::unique_ptr< G4UIcommandfSetP1XAxisLogCmd
 
std::unique_ptr< G4UIcommandfSetP1XCmd
 
std::unique_ptr< G4UIcommandfSetP1YAxisCmd
 
std::unique_ptr< G4UIcommandfSetP1YAxisLogCmd
 
std::unique_ptr< G4UIcommandfSetP1YCmd
 
G4AnalysisMessengerHelper::BinData fXData
 
G4int fXId { G4Analysis::kInvalidId }
 

Detailed Description

Definition at line 46 of file G4P1Messenger.hh.

Constructor & Destructor Documentation

◆ G4P1Messenger() [1/2]

G4P1Messenger::G4P1Messenger ( G4VAnalysisManager manager)
explicit

Definition at line 39 of file G4P1Messenger.cc.

40 : G4UImessenger(),
41 fManager(manager)
42{
43 fHelper = std::make_unique<G4AnalysisMessengerHelper>("p1");
44
45 fDirectory = fHelper->CreateHnDirectory();
46
48
49 SetP1Cmd();
50 fSetP1XCmd = fHelper->CreateSetBinsCommand("x", this);
51 fSetP1YCmd = fHelper->CreateSetValuesCommand("y", this);
52
53 fSetP1TitleCmd = fHelper->CreateSetTitleCommand(this);
54 fSetP1XAxisCmd = fHelper->CreateSetAxisCommand("x", this);
55 fSetP1YAxisCmd = fHelper->CreateSetAxisCommand("y", this);
56 fSetP1XAxisLogCmd = fHelper->CreateSetAxisLogCommand("x", this);
57 fSetP1YAxisLogCmd = fHelper->CreateSetAxisLogCommand("y", this);
58}
std::unique_ptr< G4UIcommand > fSetP1XAxisLogCmd
G4VAnalysisManager * fManager
Associated class.
std::unique_ptr< G4UIcommand > fSetP1YAxisCmd
std::unique_ptr< G4UIcommand > fSetP1YCmd
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
std::unique_ptr< G4UIcommand > fSetP1TitleCmd
std::unique_ptr< G4UIcommand > fSetP1YAxisLogCmd
std::unique_ptr< G4UIcommand > fSetP1XAxisCmd
std::unique_ptr< G4UIcommand > fSetP1XCmd
void CreateP1Cmd()
std::unique_ptr< G4UIdirectory > fDirectory

References CreateP1Cmd(), fDirectory, fHelper, fSetP1TitleCmd, fSetP1XAxisCmd, fSetP1XAxisLogCmd, fSetP1XCmd, fSetP1YAxisCmd, fSetP1YAxisLogCmd, fSetP1YCmd, and SetP1Cmd().

◆ G4P1Messenger() [2/2]

G4P1Messenger::G4P1Messenger ( )
delete

◆ ~G4P1Messenger()

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

◆ CreateP1Cmd()

void G4P1Messenger::CreateP1Cmd ( )
private

Definition at line 68 of file G4P1Messenger.cc.

69{
70 auto p1Name = new G4UIparameter("name", 's', false);
71 p1Name->SetGuidance("Profile name (label)");
72
73 auto p1Title = new G4UIparameter("title", 's', false);
74 p1Title->SetGuidance("Profile title");
75
76 auto p1xNbins0 = new G4UIparameter("xnbins0", 'i', true);
77 p1xNbins0->SetGuidance("Number of x-bins (default = 100)");
78 p1xNbins0->SetGuidance("Can be reset with /analysis/p1/set command");
79 p1xNbins0->SetDefaultValue(100);
80
81 auto p1xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
82 p1xValMin0->SetGuidance("Minimum x-value, expressed in unit (default = 0.)");
83 p1xValMin0->SetGuidance("Can be reset with /analysis/p1/set command");
84 p1xValMin0->SetDefaultValue(0.);
85
86 auto p1xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
87 p1xValMax0->SetGuidance("Maximum x-value, expressed in unit (default = 1.)");
88 p1xValMax0->SetGuidance("Can be reset with /analysis/p1/set command");
89 p1xValMax0->SetDefaultValue(1.);
90
91 auto p1xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
92 p1xValUnit0->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
93 p1xValUnit0->SetDefaultValue("none");
94
95 auto p1xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
96 G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).\n";
97 fcnxGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
98 fcnxGuidance += "but none value should be used instead.";
99 p1xValFcn0->SetGuidance(fcnxGuidance);
100 p1xValFcn0->SetParameterCandidates("log log10 exp none");
101 p1xValFcn0->SetDefaultValue("none");
102
103 auto p1xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
104 G4String binSchemeGuidance = "The binning scheme (linear, log).\n";
105 p1xValBinScheme0->SetParameterCandidates("linear log");
106 binSchemeGuidance
107 += "Note that the unit and fcn parameters cannot be omitted in this case,\n";
108 binSchemeGuidance += "but none value should be used instead.";
109 p1xValBinScheme0->SetGuidance(binSchemeGuidance);
110 p1xValBinScheme0->SetDefaultValue("linear");
111
112 auto p1yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
113 p1yValMin0->SetGuidance("Minimum y-value, expressed in unit (default = 0.)");
114 p1yValMin0->SetGuidance("Can be reset with /analysis/p1/set command");
115 p1yValMin0->SetDefaultValue(0.);
116
117 auto p1yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
118 p1yValMax0->SetGuidance("Maximum y-value, expressed in unit (default = 1.)");
119 p1yValMax0->SetGuidance("Can be reset with /analysis/p1/set command");
120 p1yValMax0->SetDefaultValue(1.);
121
122 auto p1yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
123 p1yValUnit0->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
124 p1yValUnit0->SetDefaultValue("none");
125
126 auto p1yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
127 G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).\n";
128 fcnyGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
129 fcnyGuidance += "but none value should be used instead.";
130 p1yValFcn0->SetGuidance(fcnyGuidance);
131 p1yValFcn0->SetParameterCandidates("log log10 exp none");
132 p1yValFcn0->SetDefaultValue("none");
133
134 fCreateP1Cmd = std::make_unique<G4UIcommand>("/analysis/p1/create", this);
135 fCreateP1Cmd->SetGuidance("Create 1D profile");
136 fCreateP1Cmd->SetParameter(p1Name);
137 fCreateP1Cmd->SetParameter(p1Title);
138 fCreateP1Cmd->SetParameter(p1xNbins0);
139 fCreateP1Cmd->SetParameter(p1xValMin0);
140 fCreateP1Cmd->SetParameter(p1xValMax0);
141 fCreateP1Cmd->SetParameter(p1xValUnit0);
142 fCreateP1Cmd->SetParameter(p1xValFcn0);
143 fCreateP1Cmd->SetParameter(p1xValBinScheme0);
144 fCreateP1Cmd->SetParameter(p1yValMin0);
145 fCreateP1Cmd->SetParameter(p1yValMax0);
146 fCreateP1Cmd->SetParameter(p1yValUnit0);
147 fCreateP1Cmd->SetParameter(p1yValFcn0);
148 fCreateP1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
149}
@ G4State_Idle
@ G4State_PreInit
std::unique_ptr< G4UIcommand > fCreateP1Cmd

References fCreateP1Cmd, G4State_Idle, and G4State_PreInit.

Referenced by G4P1Messenger().

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

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 230 of file G4P1Messenger.cc.

231{
232 // tokenize parameters in a vector
233 std::vector<G4String> parameters;
234 G4Analysis::Tokenize(newValues, parameters);
235 // check consistency
236 if ( parameters.size() != command->GetParameterEntries() ) {
237 // Should never happen but let's check anyway for consistency
238 fHelper->WarnAboutParameters(command, parameters.size());
239 return;
240 }
241
242 if ( command == fCreateP1Cmd.get() ) {
243 auto counter = 0;
244 auto name = parameters[counter++];
245 auto title = parameters[counter++];
247 fHelper->GetBinData(xdata, parameters, counter);
248 auto xunit = GetUnitValue(xdata.fSunit);
250 fHelper->GetValueData(ydata, parameters, counter);
251 auto yunit = GetUnitValue(ydata.fSunit);
252 fManager->CreateP1(name, title,
253 xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
254 ydata.fVmin*yunit, ydata.fVmax*yunit,
255 xdata.fSunit, ydata.fSunit,
256 xdata.fSfcn, ydata.fSfcn,
257 xdata.fSbinScheme);
258 }
259 else if ( command == fSetP1Cmd.get() ) {
260 auto counter = 0;
261 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
263 fHelper->GetBinData(xdata, parameters, counter);
264 auto xunit = GetUnitValue(xdata.fSunit);
266 fHelper->GetValueData(ydata, parameters, counter);
267 auto yunit = GetUnitValue(ydata.fSunit);
268 fManager->SetP1(id,
269 xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
270 ydata.fVmin*yunit, ydata.fVmax*yunit,
271 xdata.fSunit, ydata.fSunit,
272 xdata.fSfcn, ydata.fSfcn,
273 xdata.fSbinScheme);
274 }
275 else if ( command == fSetP1XCmd.get() ) {
276 // Save values
277 auto counter = 0;
278 fXId = G4UIcommand::ConvertToInt(parameters[counter++]);
279 fHelper->GetBinData(fXData, parameters, counter);
280 // Set values
281 // (another set may follow if setY is also called)
282 auto xunit = GetUnitValue(fXData.fSunit);
284 fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
285 0., 0.,
286 fXData.fSunit, "none",
287 fXData.fSfcn, "none",
289 }
290 else if ( command == fSetP1YCmd.get() ) {
291 // Check if setX command was called
292 auto counter = 0;
293 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
294 if ( fXId == -1 || fXId != id ) {
295 fHelper->WarnAboutSetCommands();
296 return;
297 }
298 auto xunit = GetUnitValue(fXData.fSunit);
300 fHelper->GetValueData(ydata, parameters, counter);
301 auto yunit = GetUnitValue(ydata.fSunit);
302 fManager->SetP1(id,
303 fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
304 ydata.fVmin*yunit, ydata.fVmax*yunit,
305 fXData.fSunit, ydata.fSunit,
306 fXData.fSfcn, ydata.fSfcn,
308 fXId = -1;
309 }
310 else if ( command == fSetP1TitleCmd.get() ) {
311 auto counter = 0;
312 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
313 auto title = parameters[counter++];
314 fManager->SetP1Title(id, title);
315 }
316 else if ( command == fSetP1XAxisCmd.get() ) {
317 auto counter = 0;
318 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
319 auto xaxis = parameters[counter++];
320 fManager->SetP1XAxisTitle(id, xaxis);
321 }
322 else if ( command == fSetP1YAxisCmd.get() ) {
323 auto counter = 0;
324 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
325 auto yaxis = parameters[counter++];
326 fManager->SetP1YAxisTitle(id, yaxis);
327 }
328 else if ( command == fSetP1XAxisLogCmd.get() ) {
329 auto counter = 0;
330 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
331 auto xaxisLog = G4UIcommand::ConvertToBool(parameters[counter++]);
332 fManager->SetP1XAxisIsLog(id, xaxisLog);
333 }
334 else if ( command == fSetP1YAxisLogCmd.get() ) {
335 auto counter = 0;
336 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
337 auto yaxisLog = G4UIcommand::ConvertToBool(parameters[counter++]);
338 fManager->SetP1YAxisIsLog(id, yaxisLog);
339 }
340}
G4AnalysisMessengerHelper::BinData fXData
std::unique_ptr< G4UIcommand > fSetP1Cmd
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
G4int CreateP1(const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, G4double ymin=0, G4double ymax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear")
G4bool SetP1XAxisTitle(G4int id, const G4String &title)
G4bool SetP1(G4int id, G4int nbins, G4double xmin, G4double xmax, G4double ymin=0, G4double ymax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear")
G4bool SetP1YAxisIsLog(G4int id, G4bool isLog)
G4bool SetP1YAxisTitle(G4int id, const G4String &title)
G4bool SetP1XAxisIsLog(G4int id, G4bool isLog)
G4bool SetP1Title(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::CreateP1(), fCreateP1Cmd, fHelper, fManager, G4AnalysisMessengerHelper::BinData::fNbins, G4AnalysisMessengerHelper::BinData::fSbinScheme, fSetP1Cmd, fSetP1TitleCmd, fSetP1XAxisCmd, fSetP1XAxisLogCmd, fSetP1XCmd, fSetP1YAxisCmd, fSetP1YAxisLogCmd, fSetP1YCmd, G4AnalysisMessengerHelper::BinData::fSfcn, G4AnalysisMessengerHelper::ValueData::fSfcn, G4AnalysisMessengerHelper::BinData::fSunit, G4AnalysisMessengerHelper::ValueData::fSunit, G4AnalysisMessengerHelper::BinData::fVmax, G4AnalysisMessengerHelper::ValueData::fVmax, G4AnalysisMessengerHelper::BinData::fVmin, G4AnalysisMessengerHelper::ValueData::fVmin, fXData, fXId, G4UIcommand::GetParameterEntries(), G4Analysis::GetUnitValue(), G4InuclParticleNames::name(), G4VAnalysisManager::SetP1(), G4VAnalysisManager::SetP1Title(), G4VAnalysisManager::SetP1XAxisIsLog(), G4VAnalysisManager::SetP1XAxisTitle(), G4VAnalysisManager::SetP1YAxisIsLog(), G4VAnalysisManager::SetP1YAxisTitle(), and G4Analysis::Tokenize().

◆ SetP1Cmd()

void G4P1Messenger::SetP1Cmd ( )
private

Definition at line 153 of file G4P1Messenger.cc.

154{
155 auto p1Id = new G4UIparameter("id", 'i', false);
156 p1Id->SetGuidance("Profile id");
157 p1Id->SetParameterRange("id>=0");
158
159 auto p1xNbins = new G4UIparameter("xnbins", 'i', false);
160 p1xNbins->SetGuidance("Number of x-bins");
161
162 auto p1xValMin = new G4UIparameter("xvalMin", 'd', false);
163 p1xValMin->SetGuidance("Minimum x-value, expressed in unit");
164
165 auto p1xValMax = new G4UIparameter("xvalMax", 'd', false);
166 p1xValMax->SetGuidance("Maximum x-value, expressed in unit");
167
168 auto p1xValUnit = new G4UIparameter("xvalUnit", 's', true);
169 p1xValUnit->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
170 p1xValUnit->SetDefaultValue("none");
171
172 auto p1xValFcn = new G4UIparameter("xvalFcn", 's', true);
173 p1xValFcn->SetParameterCandidates("log log10 exp none");
174 G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).\n";
175 fcnxGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
176 fcnxGuidance += "but none value should be used instead.";
177 p1xValFcn->SetGuidance(fcnxGuidance);
178 p1xValFcn->SetDefaultValue("none");
179
180 auto p1xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
181 G4String binSchemeGuidance = "The binning scheme (linear, log).\n";
182 p1xValBinScheme->SetParameterCandidates("linear log");
183 binSchemeGuidance
184 += "Note that the unit and fcn parameters cannot be omitted in this case,\n";
185 binSchemeGuidance += "but none value should be used instead.";
186 p1xValBinScheme->SetGuidance(binSchemeGuidance);
187 p1xValBinScheme->SetDefaultValue("linear");
188
189 auto p1yValMin = new G4UIparameter("yvalMin", 'd', true);
190 p1yValMin->SetGuidance("Minimum y-value, expressed in unit");
191
192 auto p1yValMax = new G4UIparameter("yvalMax", 'd', true);
193 p1yValMax->SetGuidance("Maximum y-value, expressed in unit");
194
195 auto p1yValUnit = new G4UIparameter("yvalUnit", 's', true);
196 p1yValUnit->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
197 p1yValUnit->SetDefaultValue("none");
198
199 auto p1yValFcn = new G4UIparameter("yvalFcn", 's', true);
200 p1yValFcn->SetParameterCandidates("log log10 exp none");
201 G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).\n";
202 fcnyGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
203 fcnyGuidance += "but none value should be used instead.";
204 p1yValFcn->SetGuidance(fcnyGuidance);
205 p1yValFcn->SetDefaultValue("none");
206
207 fSetP1Cmd = std::make_unique<G4UIcommand>("/analysis/p1/set", this);
208 fSetP1Cmd->SetGuidance("Set parameters for the 1D profile of given id:");
209 fSetP1Cmd->SetGuidance(" nbins; xvalMin; xvalMax; xunit; xfunction; xbinScheme");
210 fSetP1Cmd->SetGuidance(" yvalMin; yvalMax; yunit; yfunction");
211 fSetP1Cmd->SetParameter(p1Id);
212 fSetP1Cmd->SetParameter(p1xNbins);
213 fSetP1Cmd->SetParameter(p1xValMin);
214 fSetP1Cmd->SetParameter(p1xValMax);
215 fSetP1Cmd->SetParameter(p1xValUnit);
216 fSetP1Cmd->SetParameter(p1xValFcn);
217 fSetP1Cmd->SetParameter(p1xValBinScheme);
218 fSetP1Cmd->SetParameter(p1yValMin);
219 fSetP1Cmd->SetParameter(p1yValMax);
220 fSetP1Cmd->SetParameter(p1yValUnit);
221 fSetP1Cmd->SetParameter(p1yValFcn);
222 fSetP1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
223}

References fSetP1Cmd, G4State_Idle, and G4State_PreInit.

Referenced by G4P1Messenger().

◆ 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

◆ fCreateP1Cmd

std::unique_ptr<G4UIcommand> G4P1Messenger::fCreateP1Cmd
private

Definition at line 64 of file G4P1Messenger.hh.

Referenced by CreateP1Cmd(), and SetNewValue().

◆ fDirectory

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

Definition at line 62 of file G4P1Messenger.hh.

Referenced by G4P1Messenger().

◆ fHelper

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

Definition at line 61 of file G4P1Messenger.hh.

Referenced by G4P1Messenger(), and SetNewValue().

◆ fManager

G4VAnalysisManager* G4P1Messenger::fManager { nullptr }
private

Associated class.

Definition at line 60 of file G4P1Messenger.hh.

Referenced by SetNewValue().

◆ fSetP1Cmd

std::unique_ptr<G4UIcommand> G4P1Messenger::fSetP1Cmd
private

Definition at line 65 of file G4P1Messenger.hh.

Referenced by SetNewValue(), and SetP1Cmd().

◆ fSetP1TitleCmd

std::unique_ptr<G4UIcommand> G4P1Messenger::fSetP1TitleCmd
private

Definition at line 68 of file G4P1Messenger.hh.

Referenced by G4P1Messenger(), and SetNewValue().

◆ fSetP1XAxisCmd

std::unique_ptr<G4UIcommand> G4P1Messenger::fSetP1XAxisCmd
private

Definition at line 69 of file G4P1Messenger.hh.

Referenced by G4P1Messenger(), and SetNewValue().

◆ fSetP1XAxisLogCmd

std::unique_ptr<G4UIcommand> G4P1Messenger::fSetP1XAxisLogCmd
private

Definition at line 71 of file G4P1Messenger.hh.

Referenced by G4P1Messenger(), and SetNewValue().

◆ fSetP1XCmd

std::unique_ptr<G4UIcommand> G4P1Messenger::fSetP1XCmd
private

Definition at line 66 of file G4P1Messenger.hh.

Referenced by G4P1Messenger(), and SetNewValue().

◆ fSetP1YAxisCmd

std::unique_ptr<G4UIcommand> G4P1Messenger::fSetP1YAxisCmd
private

Definition at line 70 of file G4P1Messenger.hh.

Referenced by G4P1Messenger(), and SetNewValue().

◆ fSetP1YAxisLogCmd

std::unique_ptr<G4UIcommand> G4P1Messenger::fSetP1YAxisLogCmd
private

Definition at line 72 of file G4P1Messenger.hh.

Referenced by G4P1Messenger(), and SetNewValue().

◆ fSetP1YCmd

std::unique_ptr<G4UIcommand> G4P1Messenger::fSetP1YCmd
private

Definition at line 67 of file G4P1Messenger.hh.

Referenced by G4P1Messenger(), and SetNewValue().

◆ fXData

G4AnalysisMessengerHelper::BinData G4P1Messenger::fXData
private

Definition at line 75 of file G4P1Messenger.hh.

Referenced by SetNewValue().

◆ fXId

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

Definition at line 74 of file G4P1Messenger.hh.

Referenced by SetNewValue().


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