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

#include <G4P2Messenger.hh>

Inheritance diagram for G4P2Messenger:
G4UImessenger

Public Member Functions

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

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 CreateP2Cmd ()
 
void SetP2Cmd ()
 

Private Attributes

std::unique_ptr< G4UIcommandfCreateP2Cmd
 
std::unique_ptr< G4UIdirectoryfDirectory
 
std::unique_ptr< G4AnalysisMessengerHelperfHelper
 
G4VAnalysisManagerfManager { nullptr }
 Associated class. More...
 
std::unique_ptr< G4UIcommandfSetP2Cmd
 
std::unique_ptr< G4UIcommandfSetP2TitleCmd
 
std::unique_ptr< G4UIcommandfSetP2XAxisCmd
 
std::unique_ptr< G4UIcommandfSetP2XAxisLogCmd
 
std::unique_ptr< G4UIcommandfSetP2XCmd
 
std::unique_ptr< G4UIcommandfSetP2YAxisCmd
 
std::unique_ptr< G4UIcommandfSetP2YAxisLogCmd
 
std::unique_ptr< G4UIcommandfSetP2YCmd
 
std::unique_ptr< G4UIcommandfSetP2ZAxisCmd
 
std::unique_ptr< G4UIcommandfSetP2ZAxisLogCmd
 
std::unique_ptr< G4UIcommandfSetP2ZCmd
 
G4AnalysisMessengerHelper::BinData fXData
 
G4int fXId { G4Analysis::kInvalidId }
 
G4AnalysisMessengerHelper::BinData fYData
 
G4int fYId { G4Analysis::kInvalidId }
 

Detailed Description

Definition at line 46 of file G4P2Messenger.hh.

Constructor & Destructor Documentation

◆ G4P2Messenger() [1/2]

G4P2Messenger::G4P2Messenger ( G4VAnalysisManager manager)
explicit

Definition at line 39 of file G4P2Messenger.cc.

40 : G4UImessenger(),
41 fManager(manager)
42{
43 fHelper = std::make_unique<G4AnalysisMessengerHelper>("p2");
44
45 fDirectory = fHelper->CreateHnDirectory();
46
48
49 SetP2Cmd();
50 fSetP2XCmd = fHelper->CreateSetBinsCommand("x", this);
51 fSetP2YCmd = fHelper->CreateSetBinsCommand("y", this);
52 fSetP2ZCmd = fHelper->CreateSetValuesCommand("z", this);
53
54 fSetP2TitleCmd = fHelper->CreateSetTitleCommand(this);
55 fSetP2XAxisCmd = fHelper->CreateSetAxisCommand("x", this);
56 fSetP2YAxisCmd = fHelper->CreateSetAxisCommand("y", this);
57 fSetP2ZAxisCmd = fHelper->CreateSetAxisCommand("z", this);
58 fSetP2XAxisLogCmd = fHelper->CreateSetAxisLogCommand("x", this);
59 fSetP2YAxisLogCmd = fHelper->CreateSetAxisLogCommand("y", this);
60 fSetP2ZAxisLogCmd = fHelper->CreateSetAxisLogCommand("z", this);
61}
std::unique_ptr< G4UIcommand > fSetP2XAxisLogCmd
std::unique_ptr< G4UIcommand > fSetP2TitleCmd
std::unique_ptr< G4UIdirectory > fDirectory
std::unique_ptr< G4UIcommand > fSetP2YCmd
std::unique_ptr< G4UIcommand > fSetP2XCmd
std::unique_ptr< G4UIcommand > fSetP2XAxisCmd
std::unique_ptr< G4UIcommand > fSetP2ZAxisCmd
std::unique_ptr< G4UIcommand > fSetP2ZCmd
G4VAnalysisManager * fManager
Associated class.
void CreateP2Cmd()
std::unique_ptr< G4UIcommand > fSetP2YAxisLogCmd
std::unique_ptr< G4UIcommand > fSetP2ZAxisLogCmd
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
std::unique_ptr< G4UIcommand > fSetP2YAxisCmd

References CreateP2Cmd(), fDirectory, fHelper, fSetP2TitleCmd, fSetP2XAxisCmd, fSetP2XAxisLogCmd, fSetP2XCmd, fSetP2YAxisCmd, fSetP2YAxisLogCmd, fSetP2YCmd, fSetP2ZAxisCmd, fSetP2ZAxisLogCmd, fSetP2ZCmd, and SetP2Cmd().

◆ G4P2Messenger() [2/2]

G4P2Messenger::G4P2Messenger ( )
delete

◆ ~G4P2Messenger()

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

◆ CreateP2Cmd()

void G4P2Messenger::CreateP2Cmd ( )
private

Definition at line 71 of file G4P2Messenger.cc.

72{
73 auto p2Name = new G4UIparameter("name", 's', false);
74 p2Name->SetGuidance("Profile name (label)");
75
76 auto p2Title = new G4UIparameter("title", 's', false);
77 p2Title->SetGuidance("Profile title");
78
79 auto p2xNbins0 = new G4UIparameter("xnbins0", 'i', true);
80 p2xNbins0->SetGuidance("Number of x-bins (default = 100)");
81 p2xNbins0->SetGuidance("Can be reset with /analysis/p2/set command");
82 p2xNbins0->SetDefaultValue(100);
83
84 auto p2xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
85 p2xValMin0->SetGuidance("Minimum x-value, expressed in unit (default = 0.)");
86 p2xValMin0->SetGuidance("Can be reset with /analysis/p2/set command");
87 p2xValMin0->SetDefaultValue(0.);
88
89 auto p2xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
90 p2xValMax0->SetGuidance("Maximum x-value, expressed in unit (default = 1.)");
91 p2xValMax0->SetGuidance("Can be reset with /analysis/p2/set command");
92 p2xValMax0->SetDefaultValue(1.);
93
94 auto p2xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
95 p2xValUnit0->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
96 p2xValUnit0->SetDefaultValue("none");
97
98 auto p2xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
99 G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
100 p2xValFcn0->SetGuidance(fcnxGuidance);
101 p2xValFcn0->SetParameterCandidates("log log10 exp none");
102 p2xValFcn0->SetDefaultValue("none");
103
104 auto p2xValBinScheme0 = new G4UIparameter("xvalBinScheme0", 's', true);
105 G4String binSchemeGuidance = "The binning scheme (linear, log).";
106 p2xValBinScheme0->SetParameterCandidates("linear log");
107 p2xValBinScheme0->SetGuidance(binSchemeGuidance);
108 p2xValBinScheme0->SetDefaultValue("linear");
109
110 auto p2yNbins0 = new G4UIparameter("ynbins0", 'i', true);
111 p2yNbins0->SetGuidance("Number of y-bins (default = 100)");
112 p2yNbins0->SetGuidance("Can be reset with /analysis/p2/set command");
113 p2yNbins0->SetDefaultValue(100);
114
115 auto p2yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
116 p2yValMin0->SetGuidance("Minimum y-value, expressed in unit (default = 0.)");
117 p2yValMin0->SetGuidance("Can be reset with /analysis/p2/set command");
118 p2yValMin0->SetDefaultValue(0.);
119
120 auto p2yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
121 p2yValMax0->SetGuidance("Maximum y-value, expressed in unit (default = 1.)");
122 p2yValMax0->SetGuidance("Can be reset with /analysis/p2/set command");
123 p2yValMax0->SetDefaultValue(1.);
124
125 auto p2yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
126 p2yValUnit0->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
127 p2yValUnit0->SetDefaultValue("none");
128
129 auto p2yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
130 G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
131 p2yValFcn0->SetGuidance(fcnyGuidance);
132 p2yValFcn0->SetParameterCandidates("log log10 exp none");
133 p2yValFcn0->SetDefaultValue("none");
134
135 auto p2yValBinScheme0 = new G4UIparameter("yvalBinScheme0", 's', true);
136 p2yValBinScheme0->SetParameterCandidates("linear log");
137 p2yValBinScheme0->SetGuidance(binSchemeGuidance);
138 p2yValBinScheme0->SetDefaultValue("linear");
139
140 auto p2zValMin0 = new G4UIparameter("zvalMin0", 'd', true);
141 p2zValMin0->SetGuidance("Minimum z-value, expressed in unit (default = 0.)");
142 p2zValMin0->SetGuidance("Can be reset with /analysis/p2/set command");
143 p2zValMin0->SetDefaultValue(0.);
144
145 auto p2zValMax0 = new G4UIparameter("zvalMax0", 'd', true);
146 p2zValMax0->SetGuidance("Maximum z-value, expressed in unit (default = 1.)");
147 p2zValMax0->SetGuidance("Can be reset with /analysis/p2/set command");
148 p2zValMax0->SetDefaultValue(1.);
149
150 auto p2zValUnit0 = new G4UIparameter("zvalUnit0", 's', true);
151 p2zValUnit0->SetGuidance("The unit applied to filled z-values and zvalMin0, zvalMax0");
152 p2zValUnit0->SetDefaultValue("none");
153
154 auto p2zValFcn0 = new G4UIparameter("zvalFcn0", 's', true);
155 G4String fcnzGuidance = "The function applied to filled z-values (log, log10, exp, none).";
156 p2zValFcn0->SetGuidance(fcnzGuidance);
157 p2zValFcn0->SetParameterCandidates("log log10 exp none");
158 p2zValFcn0->SetDefaultValue("none");
159
160 fCreateP2Cmd = std::make_unique<G4UIcommand>("/analysis/p2/create", this);
161 fCreateP2Cmd->SetGuidance("Create 2D profile");
162 fCreateP2Cmd->SetParameter(p2Name);
163 fCreateP2Cmd->SetParameter(p2Title);
164 fCreateP2Cmd->SetParameter(p2xNbins0);
165 fCreateP2Cmd->SetParameter(p2xValMin0);
166 fCreateP2Cmd->SetParameter(p2xValMax0);
167 fCreateP2Cmd->SetParameter(p2xValUnit0);
168 fCreateP2Cmd->SetParameter(p2xValFcn0);
169 fCreateP2Cmd->SetParameter(p2xValBinScheme0);
170 fCreateP2Cmd->SetParameter(p2yNbins0);
171 fCreateP2Cmd->SetParameter(p2yValMin0);
172 fCreateP2Cmd->SetParameter(p2yValMax0);
173 fCreateP2Cmd->SetParameter(p2yValUnit0);
174 fCreateP2Cmd->SetParameter(p2yValFcn0);
175 fCreateP2Cmd->SetParameter(p2yValBinScheme0);
176 fCreateP2Cmd->SetParameter(p2zValMin0);
177 fCreateP2Cmd->SetParameter(p2zValMax0);
178 fCreateP2Cmd->SetParameter(p2zValUnit0);
179 fCreateP2Cmd->SetParameter(p2zValFcn0);
180 fCreateP2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
181}
@ G4State_Idle
@ G4State_PreInit
std::unique_ptr< G4UIcommand > fCreateP2Cmd

References fCreateP2Cmd, G4State_Idle, and G4State_PreInit.

Referenced by G4P2Messenger().

◆ 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 G4P2Messenger::SetNewValue ( G4UIcommand command,
G4String  value 
)
finalvirtual

Reimplemented from G4UImessenger.

Definition at line 287 of file G4P2Messenger.cc.

288{
289 // tokenize parameters in a vector
290 std::vector<G4String> parameters;
291 G4Analysis::Tokenize(newValues, parameters);
292 // check consistency
293 if ( parameters.size() != command->GetParameterEntries() ) {
294 // Should never happen but let's check anyway for consistency
295 fHelper->WarnAboutParameters(command, parameters.size());
296 return;
297 }
298
299 if ( command == fCreateP2Cmd.get() ) {
300 auto counter = 0;
301 auto name = parameters[counter++];
302 auto title = parameters[counter++];
304 fHelper->GetBinData(xdata, parameters, counter);
305 auto xunit = GetUnitValue(xdata.fSunit);
307 fHelper->GetBinData(ydata, parameters, counter);
308 auto yunit = GetUnitValue(ydata.fSunit);
310 fHelper->GetValueData(zdata, parameters, counter);
311 auto zunit = GetUnitValue(zdata.fSunit);
312 fManager->CreateP2(name, title,
313 xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
314 ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
315 zdata.fVmin*zunit, zdata.fVmax*zunit,
316 xdata.fSunit, ydata.fSunit, zdata.fSunit,
317 xdata.fSfcn, ydata.fSfcn, zdata.fSfcn,
318 xdata.fSbinScheme, ydata.fSbinScheme);
319 }
320 else if ( command == fSetP2Cmd.get() ) {
321 auto counter = 0;
322 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
324 fHelper->GetBinData(xdata, parameters, counter);
325 auto xunit = GetUnitValue(xdata.fSunit);
327 fHelper->GetBinData(ydata, parameters, counter);
328 auto yunit = GetUnitValue(ydata.fSunit);
330 fHelper->GetValueData(zdata, parameters, counter);
331 auto zunit = GetUnitValue(zdata.fSunit);
332 fManager->SetP2(id,
333 xdata.fNbins, xdata.fVmin*xunit, xdata.fVmax*xunit,
334 ydata.fNbins, ydata.fVmin*yunit, ydata.fVmax*yunit,
335 zdata.fVmin*zunit, zdata.fVmax*zunit,
336 xdata.fSunit, ydata.fSunit, zdata.fSunit,
337 xdata.fSfcn, ydata.fSfcn, zdata.fSfcn,
338 xdata.fSbinScheme, ydata.fSbinScheme);
339 }
340 else if ( command == fSetP2XCmd.get() ) {
341 // Only save values
342 auto counter = 0;
343 fXId = G4UIcommand::ConvertToInt(parameters[counter++]);
344 fHelper->GetBinData(fXData, parameters, counter);
345 }
346 else if ( command == fSetP2YCmd.get() ) {
347 // Save values
348 auto counter = 0;
349 fYId = G4UIcommand::ConvertToInt(parameters[counter++]);
350 // Check if setX command was called
351 if ( fXId == -1 || fXId != fYId ) {
352 fHelper->WarnAboutSetCommands();
353 return;
354 }
355 fHelper->GetBinData(fYData, parameters, counter);
356 // Set values
357 // (another set may follow if setZ is also called)
358 auto xunit = GetUnitValue(fXData.fSunit);
359 auto yunit = GetUnitValue(fYData.fSunit);
361 fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
362 fYData.fNbins, fYData.fVmin*yunit, fYData.fVmax*yunit,
363 0., 0.,
364 fXData.fSunit, fYData.fSunit, "none",
365 fXData.fSfcn, fYData.fSfcn, "none",
367 }
368 else if ( command == fSetP2ZCmd.get() ) {
369 auto counter = 0;
370 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
371 // Check if setX and setY command was called
372 if ( fXId == -1 || fXId != id ||
373 fYId == -1 || fYId != id ) {
374 fHelper->WarnAboutSetCommands();
375 return;
376 }
377 auto xunit = GetUnitValue(fXData.fSunit);
378 auto yunit = GetUnitValue(fYData.fSunit);
380 fHelper->GetValueData(zdata, parameters, counter);
381 auto zunit = GetUnitValue(zdata.fSunit);
382 fManager->SetP2(id,
383 fXData.fNbins, fXData.fVmin*xunit, fXData.fVmax*xunit,
384 fYData.fNbins, fYData.fVmin*yunit, fYData.fVmax*yunit,
385 zdata.fVmin*zunit, zdata.fVmax*zunit,
387 fXData.fSfcn, fYData.fSfcn, zdata.fSfcn,
389 fXId = -1;
390 fYId = -1;
391 }
392 else if ( command == fSetP2TitleCmd.get() ) {
393 auto counter = 0;
394 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
395 auto title = parameters[counter++];
396 fManager->SetP2Title(id, title);
397 }
398 else if ( command == fSetP2XAxisCmd.get() ) {
399 auto counter = 0;
400 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
401 auto xaxis = parameters[counter++];
402 fManager->SetP2XAxisTitle(id, xaxis);
403 }
404 else if ( command == fSetP2YAxisCmd.get() ) {
405 auto counter = 0;
406 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
407 auto yaxis = parameters[counter++];
408 fManager->SetP2YAxisTitle(id, yaxis);
409 }
410 else if ( command == fSetP2ZAxisCmd.get() ) {
411 auto counter = 0;
412 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
413 auto zaxis = parameters[counter++];
414 fManager->SetP2ZAxisTitle(id, zaxis);
415 }
416 else if ( command == fSetP2XAxisLogCmd.get() ) {
417 auto counter = 0;
418 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
419 auto xaxisLog = G4UIcommand::ConvertToBool(parameters[counter++]);
420 fManager->SetP2XAxisIsLog(id, xaxisLog);
421 }
422 else if ( command == fSetP2YAxisLogCmd.get() ) {
423 auto counter = 0;
424 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
425 auto yaxisLog = G4UIcommand::ConvertToBool(parameters[counter++]);
426 fManager->SetP2YAxisIsLog(id, yaxisLog);
427 }
428 else if ( command == fSetP2ZAxisLogCmd.get() ) {
429 auto counter = 0;
430 auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
431 auto zaxisLog = G4UIcommand::ConvertToBool(parameters[counter++]);
432 fManager->SetP2ZAxisIsLog(id, zaxisLog);
433 }
434}
G4AnalysisMessengerHelper::BinData fXData
G4AnalysisMessengerHelper::BinData fYData
std::unique_ptr< G4UIcommand > fSetP2Cmd
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 SetP2YAxisTitle(G4int id, const G4String &title)
G4int CreateP2(const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4double zmin=0, G4double zmax=0, 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")
G4bool SetP2ZAxisIsLog(G4int id, G4bool isLog)
G4bool SetP2(G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4double zmin=0, G4double zmax=0, 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")
G4bool SetP2Title(G4int id, const G4String &title)
G4bool SetP2ZAxisTitle(G4int id, const G4String &title)
G4bool SetP2YAxisIsLog(G4int id, G4bool isLog)
G4bool SetP2XAxisIsLog(G4int id, G4bool isLog)
G4bool SetP2XAxisTitle(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::CreateP2(), fCreateP2Cmd, fHelper, fManager, G4AnalysisMessengerHelper::BinData::fNbins, G4AnalysisMessengerHelper::BinData::fSbinScheme, fSetP2Cmd, fSetP2TitleCmd, fSetP2XAxisCmd, fSetP2XAxisLogCmd, fSetP2XCmd, fSetP2YAxisCmd, fSetP2YAxisLogCmd, fSetP2YCmd, fSetP2ZAxisCmd, fSetP2ZAxisLogCmd, fSetP2ZCmd, 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, fYData, fYId, G4UIcommand::GetParameterEntries(), G4Analysis::GetUnitValue(), G4InuclParticleNames::name(), G4VAnalysisManager::SetP2(), G4VAnalysisManager::SetP2Title(), G4VAnalysisManager::SetP2XAxisIsLog(), G4VAnalysisManager::SetP2XAxisTitle(), G4VAnalysisManager::SetP2YAxisIsLog(), G4VAnalysisManager::SetP2YAxisTitle(), G4VAnalysisManager::SetP2ZAxisIsLog(), G4VAnalysisManager::SetP2ZAxisTitle(), and G4Analysis::Tokenize().

◆ SetP2Cmd()

void G4P2Messenger::SetP2Cmd ( )
private

Definition at line 185 of file G4P2Messenger.cc.

186{
187 auto p2Id = new G4UIparameter("id", 'i', false);
188 p2Id->SetGuidance("Profile id");
189 p2Id->SetParameterRange("id>=0");
190
191 auto p2xNbins = new G4UIparameter("xnbins", 'i', false);
192 p2xNbins->SetGuidance("Number of x-bins");
193
194 auto p2xValMin = new G4UIparameter("xvalMin", 'd', false);
195 p2xValMin->SetGuidance("Minimum x-value, expressed in unit");
196
197 auto p2xValMax = new G4UIparameter("xvalMax", 'd', false);
198 p2xValMax->SetGuidance("Maximum x-value, expressed in unit");
199
200 auto p2xValUnit = new G4UIparameter("xvalUnit", 's', true);
201 p2xValUnit->SetGuidance("The unit applied to filled x-values and xvalMin0, xvalMax0");
202 p2xValUnit->SetDefaultValue("none");
203
204 auto p2xValFcn = new G4UIparameter("xvalFcn", 's', true);
205 p2xValFcn->SetParameterCandidates("log log10 exp none");
206 G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).";
207 p2xValFcn->SetGuidance(fcnxGuidance);
208 p2xValFcn->SetDefaultValue("none");
209
210 auto p2xValBinScheme = new G4UIparameter("xvalBinScheme", 's', true);
211 G4String binSchemeGuidance = "The binning scheme (linear, log).";
212 p2xValBinScheme->SetParameterCandidates("linear log");
213 p2xValBinScheme->SetGuidance(binSchemeGuidance);
214 p2xValBinScheme->SetDefaultValue("linear");
215
216 auto p2yNbins = new G4UIparameter("nybins", 'i', true);
217 p2yNbins->SetGuidance("Number of y-bins");
218
219 auto p2yValMin = new G4UIparameter("yvalMin", 'd', true);
220 p2yValMin->SetGuidance("Minimum y-value, expressed in unit");
221
222 auto p2yValMax = new G4UIparameter("yvalMax", 'd', true);
223 p2yValMax->SetGuidance("Maximum y-value, expressed in unit");
224
225 auto p2yValUnit = new G4UIparameter("yvalUnit", 's', true);
226 p2yValUnit->SetGuidance("The unit applied to filled y-values and yvalMin0, yvalMax0");
227 p2yValUnit->SetDefaultValue("none");
228
229 auto p2yValFcn = new G4UIparameter("yvalFcn", 's', true);
230 p2yValFcn->SetParameterCandidates("log log10 exp none");
231 G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).";
232 p2yValFcn->SetGuidance(fcnyGuidance);
233 p2yValFcn->SetDefaultValue("none");
234
235 auto p2yValBinScheme = new G4UIparameter("yvalBinScheme", 's', true);
236 p2yValBinScheme->SetParameterCandidates("linear log");
237 p2yValBinScheme->SetGuidance(binSchemeGuidance);
238 p2yValBinScheme->SetDefaultValue("linear");
239
240 auto p2zValMin = new G4UIparameter("zvalMin", 'd', true);
241 p2zValMin->SetGuidance("Minimum z-value, expressed in unit");
242
243 auto p2zValMax = new G4UIparameter("zvalMax", 'd', true);
244 p2zValMax->SetGuidance("Maximum z-value, expressed in unit");
245
246 auto p2zValUnit = new G4UIparameter("zvalUnit", 's', true);
247 p2zValUnit->SetGuidance("The unit applied to filled z-values and zvalMin0, zvalMax0");
248 p2zValUnit->SetDefaultValue("none");
249
250 auto p2zValFcn = new G4UIparameter("zvalFcn", 's', true);
251 p2zValFcn->SetParameterCandidates("log log10 exp none");
252 G4String fcnzGuidance = "The function applied to filled z-values (log, log10, exp, none).";
253 p2zValFcn->SetGuidance(fcnzGuidance);
254 p2zValFcn->SetDefaultValue("none");
255
256 fSetP2Cmd = std::make_unique<G4UIcommand>("/analysis/p2/set", this);
257 fSetP2Cmd->SetGuidance("Set parameters for the 2D profile of given id:");
258 fSetP2Cmd->SetGuidance(" nxbins; xvalMin; xvalMax; xunit; xbinScheme");
259 fSetP2Cmd->SetGuidance(" nybins; yvalMin; yvalMax; yunit; ybinScheme");
260 fSetP2Cmd->SetGuidance(" zvalMin; zvalMax; zunit; zfunction");
261 fSetP2Cmd->SetParameter(p2Id);
262 fSetP2Cmd->SetParameter(p2xNbins);
263 fSetP2Cmd->SetParameter(p2xValMin);
264 fSetP2Cmd->SetParameter(p2xValMax);
265 fSetP2Cmd->SetParameter(p2xValUnit);
266 fSetP2Cmd->SetParameter(p2xValFcn);
267 fSetP2Cmd->SetParameter(p2xValBinScheme);
268 fSetP2Cmd->SetParameter(p2yNbins);
269 fSetP2Cmd->SetParameter(p2yValMin);
270 fSetP2Cmd->SetParameter(p2yValMax);
271 fSetP2Cmd->SetParameter(p2yValUnit);
272 fSetP2Cmd->SetParameter(p2yValFcn);
273 fSetP2Cmd->SetParameter(p2yValBinScheme);
274 fSetP2Cmd->SetParameter(p2zValMin);
275 fSetP2Cmd->SetParameter(p2zValMax);
276 fSetP2Cmd->SetParameter(p2zValUnit);
277 fSetP2Cmd->SetParameter(p2zValFcn);
278 fSetP2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
279}

References fSetP2Cmd, G4State_Idle, and G4State_PreInit.

Referenced by G4P2Messenger().

◆ 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

◆ fCreateP2Cmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fCreateP2Cmd
private

Definition at line 64 of file G4P2Messenger.hh.

Referenced by CreateP2Cmd(), and SetNewValue().

◆ fDirectory

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

Definition at line 62 of file G4P2Messenger.hh.

Referenced by G4P2Messenger().

◆ fHelper

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

Definition at line 61 of file G4P2Messenger.hh.

Referenced by G4P2Messenger(), and SetNewValue().

◆ fManager

G4VAnalysisManager* G4P2Messenger::fManager { nullptr }
private

Associated class.

Definition at line 60 of file G4P2Messenger.hh.

Referenced by SetNewValue().

◆ fSetP2Cmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fSetP2Cmd
private

Definition at line 65 of file G4P2Messenger.hh.

Referenced by SetNewValue(), and SetP2Cmd().

◆ fSetP2TitleCmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fSetP2TitleCmd
private

Definition at line 69 of file G4P2Messenger.hh.

Referenced by G4P2Messenger(), and SetNewValue().

◆ fSetP2XAxisCmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fSetP2XAxisCmd
private

Definition at line 70 of file G4P2Messenger.hh.

Referenced by G4P2Messenger(), and SetNewValue().

◆ fSetP2XAxisLogCmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fSetP2XAxisLogCmd
private

Definition at line 73 of file G4P2Messenger.hh.

Referenced by G4P2Messenger(), and SetNewValue().

◆ fSetP2XCmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fSetP2XCmd
private

Definition at line 66 of file G4P2Messenger.hh.

Referenced by G4P2Messenger(), and SetNewValue().

◆ fSetP2YAxisCmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fSetP2YAxisCmd
private

Definition at line 71 of file G4P2Messenger.hh.

Referenced by G4P2Messenger(), and SetNewValue().

◆ fSetP2YAxisLogCmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fSetP2YAxisLogCmd
private

Definition at line 74 of file G4P2Messenger.hh.

Referenced by G4P2Messenger(), and SetNewValue().

◆ fSetP2YCmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fSetP2YCmd
private

Definition at line 67 of file G4P2Messenger.hh.

Referenced by G4P2Messenger(), and SetNewValue().

◆ fSetP2ZAxisCmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fSetP2ZAxisCmd
private

Definition at line 72 of file G4P2Messenger.hh.

Referenced by G4P2Messenger(), and SetNewValue().

◆ fSetP2ZAxisLogCmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fSetP2ZAxisLogCmd
private

Definition at line 75 of file G4P2Messenger.hh.

Referenced by G4P2Messenger(), and SetNewValue().

◆ fSetP2ZCmd

std::unique_ptr<G4UIcommand> G4P2Messenger::fSetP2ZCmd
private

Definition at line 68 of file G4P2Messenger.hh.

Referenced by G4P2Messenger(), and SetNewValue().

◆ fXData

G4AnalysisMessengerHelper::BinData G4P2Messenger::fXData
private

Definition at line 79 of file G4P2Messenger.hh.

Referenced by SetNewValue().

◆ fXId

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

Definition at line 77 of file G4P2Messenger.hh.

Referenced by SetNewValue().

◆ fYData

G4AnalysisMessengerHelper::BinData G4P2Messenger::fYData
private

Definition at line 80 of file G4P2Messenger.hh.

Referenced by SetNewValue().

◆ fYId

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

Definition at line 78 of file G4P2Messenger.hh.

Referenced by SetNewValue().


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