40 using namespace G4Analysis;
 
   48     fCreateP2Cmd(nullptr),
 
   53     fSetP2TitleCmd(nullptr), 
 
   54     fSetP2XAxisCmd(nullptr), 
 
   55     fSetP2YAxisCmd(nullptr)
 
   57   fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>(
"p2");
 
   59   fDirectory = fHelper->CreateHnDirectory();
 
   64   fSetP2XCmd = fHelper->CreateSetBinsCommand(
"x", 
this);
 
   65   fSetP2YCmd = fHelper->CreateSetBinsCommand(
"y", 
this);
 
   66   fSetP2ZCmd = fHelper->CreateSetValuesCommand(
"z", 
this);
 
   68   fSetP2TitleCmd = fHelper->CreateSetTitleCommand(
this);
 
   69   fSetP2XAxisCmd = fHelper->CreateSetAxisCommand(
"x", 
this);
 
   70   fSetP2YAxisCmd = fHelper->CreateSetAxisCommand(
"y", 
this);
 
   71   fSetP2ZAxisCmd = fHelper->CreateSetAxisCommand(
"z", 
this);
 
   83 void G4P2Messenger::CreateP2Cmd()
 
   86   p2Name->SetGuidance(
"Profile name (label)");
 
   89   p2Title->SetGuidance(
"Profile title");
 
   92   p2xNbins0->SetGuidance(
"Number of x-bins (default = 100)");
 
   93   p2xNbins0->SetGuidance(
"Can be reset with /analysis/p2/set command");
 
   94   p2xNbins0->SetDefaultValue(100);
 
   97   p2xValMin0->SetGuidance(
"Minimum x-value, expressed in unit (default = 0.)");
 
   98   p2xValMin0->SetGuidance(
"Can be reset with /analysis/p2/set command");
 
   99   p2xValMin0->SetDefaultValue(0.);
 
  102   p2xValMax0->SetGuidance(
"Maximum x-value, expressed in unit (default = 1.)");
 
  103   p2xValMax0->SetGuidance(
"Can be reset with /analysis/p2/set command");
 
  104   p2xValMax0->SetDefaultValue(1.);
 
  106   auto p2xValUnit0 = 
new G4UIparameter(
"xvalUnit0", 
's', 
true);
 
  107   p2xValUnit0->SetGuidance(
"The unit applied to filled x-values and xvalMin0, xvalMax0");
 
  108   p2xValUnit0->SetDefaultValue(
"none");
 
  111   G4String fcnxGuidance = 
"The function applied to filled x-values (log, log10, exp, none).";
 
  112   p2xValFcn0->SetGuidance(fcnxGuidance);
 
  113   p2xValFcn0->SetParameterCandidates(
"log log10 exp none");
 
  114   p2xValFcn0->SetDefaultValue(
"none");
 
  116   auto p2xValBinScheme0 = 
new G4UIparameter(
"xvalBinScheme0", 
's', 
true);
 
  117   G4String binSchemeGuidance = 
"The binning scheme (linear, log).";
 
  118   p2xValBinScheme0->SetParameterCandidates(
"linear log");
 
  119   p2xValBinScheme0->SetGuidance(binSchemeGuidance);
 
  120   p2xValBinScheme0->SetDefaultValue(
"linear");
 
  123   p2yNbins0->SetGuidance(
"Number of y-bins (default = 100)");
 
  124   p2yNbins0->SetGuidance(
"Can be reset with /analysis/p2/set command");
 
  125   p2yNbins0->SetDefaultValue(100);
 
  128   p2yValMin0->SetGuidance(
"Minimum y-value, expressed in unit (default = 0.)");
 
  129   p2yValMin0->SetGuidance(
"Can be reset with /analysis/p2/set command");
 
  130   p2yValMin0->SetDefaultValue(0.);
 
  133   p2yValMax0->SetGuidance(
"Maximum y-value, expressed in unit (default = 1.)");
 
  134   p2yValMax0->SetGuidance(
"Can be reset with /analysis/p2/set command");
 
  135   p2yValMax0->SetDefaultValue(1.);
 
  137   auto p2yValUnit0 = 
new G4UIparameter(
"yvalUnit0", 
's', 
true);
 
  138   p2yValUnit0->SetGuidance(
"The unit applied to filled y-values and yvalMin0, yvalMax0");
 
  139   p2yValUnit0->SetDefaultValue(
"none");
 
  142   G4String fcnyGuidance = 
"The function applied to filled y-values (log, log10, exp, none).";
 
  143   p2yValFcn0->SetGuidance(fcnyGuidance);
 
  144   p2yValFcn0->SetParameterCandidates(
"log log10 exp none");
 
  145   p2yValFcn0->SetDefaultValue(
"none");
 
  147   auto p2yValBinScheme0 = 
new G4UIparameter(
"yvalBinScheme0", 
's', 
true);
 
  148   p2yValBinScheme0->SetParameterCandidates(
"linear log");
 
  149   p2yValBinScheme0->SetGuidance(binSchemeGuidance);
 
  150   p2yValBinScheme0->SetDefaultValue(
"linear");
 
  153   p2zValMin0->SetGuidance(
"Minimum z-value, expressed in unit (default = 0.)");
 
  154   p2zValMin0->SetGuidance(
"Can be reset with /analysis/p2/set command");
 
  155   p2zValMin0->SetDefaultValue(0.);
 
  158   p2zValMax0->SetGuidance(
"Maximum z-value, expressed in unit (default = 1.)");
 
  159   p2zValMax0->SetGuidance(
"Can be reset with /analysis/p2/set command");
 
  160   p2zValMax0->SetDefaultValue(1.);
 
  162   auto p2zValUnit0 = 
new G4UIparameter(
"zvalUnit0", 
's', 
true);
 
  163   p2zValUnit0->SetGuidance(
"The unit applied to filled z-values and zvalMin0, zvalMax0");
 
  164   p2zValUnit0->SetDefaultValue(
"none");
 
  167   G4String fcnzGuidance = 
"The function applied to filled z-values (log, log10, exp, none).";
 
  168   p2zValFcn0->SetGuidance(fcnzGuidance);
 
  169   p2zValFcn0->SetParameterCandidates(
"log log10 exp none");
 
  170   p2zValFcn0->SetDefaultValue(
"none");
 
  172   fCreateP2Cmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/p2/create", 
this);
 
  173   fCreateP2Cmd->SetGuidance(
"Create 2D profile");
 
  174   fCreateP2Cmd->SetParameter(p2Name);
 
  175   fCreateP2Cmd->SetParameter(p2Title);
 
  176   fCreateP2Cmd->SetParameter(p2xNbins0);
 
  177   fCreateP2Cmd->SetParameter(p2xValMin0);
 
  178   fCreateP2Cmd->SetParameter(p2xValMax0);
 
  179   fCreateP2Cmd->SetParameter(p2xValUnit0);
 
  180   fCreateP2Cmd->SetParameter(p2xValFcn0);
 
  181   fCreateP2Cmd->SetParameter(p2xValBinScheme0);
 
  182   fCreateP2Cmd->SetParameter(p2yNbins0);
 
  183   fCreateP2Cmd->SetParameter(p2yValMin0);
 
  184   fCreateP2Cmd->SetParameter(p2yValMax0);
 
  185   fCreateP2Cmd->SetParameter(p2yValUnit0);
 
  186   fCreateP2Cmd->SetParameter(p2yValFcn0);
 
  187   fCreateP2Cmd->SetParameter(p2yValBinScheme0);
 
  188   fCreateP2Cmd->SetParameter(p2zValMin0);
 
  189   fCreateP2Cmd->SetParameter(p2zValMax0);
 
  190   fCreateP2Cmd->SetParameter(p2zValUnit0);
 
  191   fCreateP2Cmd->SetParameter(p2zValFcn0);
 
  197 void G4P2Messenger::SetP2Cmd()
 
  200   p2Id->SetGuidance(
"Profile id");
 
  201   p2Id->SetParameterRange(
"id>=0");
 
  204   p2xNbins->SetGuidance(
"Number of x-bins");
 
  207   p2xValMin->SetGuidance(
"Minimum x-value, expressed in unit");
 
  210   p2xValMax->SetGuidance(
"Maximum x-value, expressed in unit");
 
  213   p2xValUnit->SetGuidance(
"The unit applied to filled x-values and xvalMin0, xvalMax0");
 
  214   p2xValUnit->SetDefaultValue(
"none");
 
  217   p2xValFcn->SetParameterCandidates(
"log log10 exp none");
 
  218   G4String fcnxGuidance = 
"The function applied to filled x-values (log, log10, exp, none).";
 
  219   p2xValFcn->SetGuidance(fcnxGuidance);
 
  220   p2xValFcn->SetDefaultValue(
"none");
 
  222   auto p2xValBinScheme = 
new G4UIparameter(
"xvalBinScheme", 
's', 
true);
 
  223   G4String binSchemeGuidance = 
"The binning scheme (linear, log).";
 
  224   p2xValBinScheme->SetParameterCandidates(
"linear log");
 
  225   p2xValBinScheme->SetGuidance(binSchemeGuidance);
 
  226   p2xValBinScheme->SetDefaultValue(
"linear");
 
  229   p2yNbins->SetGuidance(
"Number of y-bins");
 
  232   p2yValMin->SetGuidance(
"Minimum y-value, expressed in unit");
 
  235   p2yValMax->SetGuidance(
"Maximum y-value, expressed in unit");
 
  238   p2yValUnit->SetGuidance(
"The unit applied to filled y-values and yvalMin0, yvalMax0");
 
  239   p2yValUnit->SetDefaultValue(
"none");
 
  242   p2yValFcn->SetParameterCandidates(
"log log10 exp none");
 
  243   G4String fcnyGuidance = 
"The function applied to filled y-values (log, log10, exp, none).";
 
  244   p2yValFcn->SetGuidance(fcnyGuidance);
 
  245   p2yValFcn->SetDefaultValue(
"none");
 
  247   auto p2yValBinScheme = 
new G4UIparameter(
"yvalBinScheme", 
's', 
true);
 
  248   p2yValBinScheme->SetParameterCandidates(
"linear log");
 
  249   p2yValBinScheme->SetGuidance(binSchemeGuidance);
 
  250   p2yValBinScheme->SetDefaultValue(
"linear");
 
  253   p2zValMin->SetGuidance(
"Minimum z-value, expressed in unit");
 
  256   p2zValMax->SetGuidance(
"Maximum z-value, expressed in unit");
 
  259   p2zValUnit->SetGuidance(
"The unit applied to filled z-values and zvalMin0, zvalMax0");
 
  260   p2zValUnit->SetDefaultValue(
"none");
 
  263   p2zValFcn->SetParameterCandidates(
"log log10 exp none");
 
  264   G4String fcnzGuidance = 
"The function applied to filled z-values (log, log10, exp, none).";
 
  265   p2zValFcn->SetGuidance(fcnzGuidance);
 
  266   p2zValFcn->SetDefaultValue(
"none");
 
  268   fSetP2Cmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/p2/set", 
this);
 
  269   fSetP2Cmd->SetGuidance(
"Set parameters for the 2D profile of given id:");
 
  270   fSetP2Cmd->SetGuidance(
"  nxbins; xvalMin; xvalMax; xunit; xbinScheme");
 
  271   fSetP2Cmd->SetGuidance(
"  nybins; yvalMin; yvalMax; yunit; ybinScheme");
 
  272   fSetP2Cmd->SetGuidance(
"  zvalMin; zvalMax; zunit; zfunction");
 
  273   fSetP2Cmd->SetParameter(p2Id);
 
  274   fSetP2Cmd->SetParameter(p2xNbins);
 
  275   fSetP2Cmd->SetParameter(p2xValMin);
 
  276   fSetP2Cmd->SetParameter(p2xValMax);
 
  277   fSetP2Cmd->SetParameter(p2xValUnit);
 
  278   fSetP2Cmd->SetParameter(p2xValFcn);
 
  279   fSetP2Cmd->SetParameter(p2xValBinScheme);
 
  280   fSetP2Cmd->SetParameter(p2yNbins);
 
  281   fSetP2Cmd->SetParameter(p2yValMin);
 
  282   fSetP2Cmd->SetParameter(p2yValMax);
 
  283   fSetP2Cmd->SetParameter(p2yValUnit);
 
  284   fSetP2Cmd->SetParameter(p2yValFcn);
 
  285   fSetP2Cmd->SetParameter(p2yValBinScheme);
 
  286   fSetP2Cmd->SetParameter(p2zValMin);
 
  287   fSetP2Cmd->SetParameter(p2zValMax);
 
  288   fSetP2Cmd->SetParameter(p2zValUnit);
 
  289   fSetP2Cmd->SetParameter(p2zValFcn);
 
  302   std::vector<G4String> parameters;
 
  307     fHelper->WarnAboutParameters(command, parameters.size());
 
  311   if ( command == fCreateP2Cmd.get() ) {  
 
  313     auto name = parameters[counter++];
 
  314     auto title = parameters[counter++];
 
  316     fHelper->GetBinData(xdata, parameters, counter);
 
  319     fHelper->GetBinData(ydata, parameters, counter);
 
  322     fHelper->GetValueData(zdata, parameters, counter);
 
  332   else if ( command == fSetP2Cmd.get() ) { 
 
  336     fHelper->GetBinData(xdata, parameters, counter);
 
  339     fHelper->GetBinData(ydata, parameters, counter);
 
  342     fHelper->GetValueData(zdata, parameters, counter);
 
  352   else if ( command == fSetP2XCmd.get() ) { 
 
  356     fHelper->GetBinData(fXData, parameters, counter);
 
  358   else if ( command == fSetP2YCmd.get() ) { 
 
  363     if ( fXId == -1 || fXId != fYId ) {
 
  364       fHelper->WarnAboutSetCommands();
 
  367     fHelper->GetBinData(fYData, parameters, counter);
 
  372     fManager->
SetP2(fYId, 
 
  380   else if ( command == fSetP2ZCmd.get() ) { 
 
  384     if ( fXId == -1 || fXId != 
id || 
 
  385          fYId == -1 || fYId != 
id ) {
 
  386       fHelper->WarnAboutSetCommands();
 
  392     fHelper->GetValueData(zdata, parameters, counter);
 
  404   else if ( command == fSetP2TitleCmd.get() ) { 
 
  407     auto title = parameters[counter++];
 
  410   else if ( command == fSetP2XAxisCmd.get() ) { 
 
  413     auto xaxis = parameters[counter++];
 
  416   else if ( command == fSetP2YAxisCmd.get() ) { 
 
  419     auto yaxis = parameters[counter++];
 
  422   else if ( command == fSetP2ZAxisCmd.get() ) { 
 
  425     auto zaxis = parameters[counter++];
 
G4bool SetP2ZAxisTitle(G4int id, const G4String &title)
 
G4bool SetP2Title(G4int id, const G4String &title)
 
G4bool SetP2XAxisTitle(G4int id, const G4String &title)
 
G4P2Messenger(G4VAnalysisManager *manager)
 
G4double GetUnitValue(const G4String &unit)
 
static G4int ConvertToInt(const char *st)
 
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 SetP2YAxisTitle(G4int id, const G4String &title)
 
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
 
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")
 
G4int GetParameterEntries() const 
 
virtual void SetNewValue(G4UIcommand *command, G4String value) final