Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-25 09:22:35

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //  Gorad (Geant4 Open-source Radiation Analysis and Design)
0027 //
0028 //  Author : Makoto Asai (SLAC National Accelerator Laboratory)
0029 //
0030 //  Development of Gorad is funded by NASA Johnson Space Center (JSC)
0031 //  under the contract NNJ15HK11B.
0032 //
0033 // ********************************************************************
0034 //
0035 // GRRunActionMessenger.cc
0036 //   A messenger class that defines histograms and n-tuple in GRRunAction.
0037 //
0038 // History
0039 //   September 8th, 2020 : first implementation
0040 //
0041 // ********************************************************************
0042 
0043 #include "GRRunActionMessenger.hh"
0044 
0045 #include "GRRunAction.hh"
0046 #include "G4UIcommand.hh"
0047 #include "G4UIparameter.hh"
0048 #include "G4UIdirectory.hh"
0049 #include "G4UIcmdWithAString.hh"
0050 #include "G4UIcmdWithABool.hh"
0051 #include "G4UIcmdWithAnInteger.hh"
0052 #include "G4UIcmdWithoutParameter.hh"
0053 #include "G4UnitsTable.hh"
0054 
0055 GRRunActionMessenger::GRRunActionMessenger(GRRunAction* dc)
0056 : pRA(dc), currentID(-1)
0057 {
0058   G4UIparameter* para = nullptr;
0059 
0060   anaDir = new G4UIdirectory("/gorad/analysis/");
0061   anaDir->SetGuidance("GORAD analysis commands");
0062 
0063   verboseCmd = new G4UIcmdWithAnInteger("/gorad/analysis/verbose",this);
0064   verboseCmd->SetGuidance("Set verbose level");
0065   verboseCmd->SetParameterName("level",true);
0066   verboseCmd->SetDefaultValue(0);
0067   verboseCmd->SetRange("level>=0");
0068   verboseCmd->AvailableForStates(G4State_Idle);
0069 
0070   fileCmd = new G4UIcmdWithAString("/gorad/analysis/file",this);
0071   fileCmd->SetGuidance("Define the output file name.");
0072   fileCmd->SetParameterName("file",false);
0073   fileCmd->AvailableForStates(G4State_Idle);
0074 
0075   listCmd = new G4UIcmdWithoutParameter("/gorad/analysis/list",this);
0076   listCmd->SetGuidance("List defined histograms.");
0077   listCmd->AvailableForStates(G4State_Idle);
0078 
0079   openCmd = new G4UIcmdWithAnInteger("/gorad/analysis/open",this);
0080   openCmd->SetGuidance("Open a histogram that has already been created and closed.");
0081   openCmd->SetGuidance("\"create\" command open the new histogram so you don't need to open it.");
0082   openCmd->SetGuidance("A histogram is closed when another histogram is created. This \"open\" command is required only for reopening the closed histogram.");
0083   openCmd->SetParameterName("id",false);
0084   openCmd->AvailableForStates(G4State_Idle);
0085 
0086   plotCmd = new G4UIcmdWithAnInteger("/gorad/analysis/plot",this);
0087   plotCmd->SetGuidance("Create an additional postscript plot for specified histogram/profile.");
0088   plotCmd->SetGuidance("Regardless of this command, histogram is dumped to the output file.");
0089   plotCmd->SetGuidance("If id is not specified, currently open histogram/profile is plotted.");
0090   plotCmd->SetGuidance("If id = -1, all currently defined histograms/profiles are plotted.");
0091   plotCmd->SetParameterName("id",true,true);
0092   plotCmd->AvailableForStates(G4State_Idle);
0093 
0094   carryCmd = new G4UIcmdWithABool("/gorad/analysis/carry",this);
0095   carryCmd->SetGuidance("Carry histograms over more than one runs.");
0096   carryCmd->SetGuidance("Once this is set, histograms won't be output until /gorad/analysis/flush is explicitly issued.");
0097   carryCmd->SetGuidance("This command has to be issued before starting the run to be carried over.");
0098   carryCmd->SetParameterName("carry",true);
0099   carryCmd->SetDefaultValue(true);
0100   carryCmd->AvailableForStates(G4State_Idle);
0101 
0102   flushCmd = new G4UIcmdWithoutParameter("/gorad/analysis/flush",this);
0103   flushCmd->SetGuidance("Make output. This command is necessary if /gorad/analysis/carry is set.");
0104   flushCmd->AvailableForStates(G4State_Idle);
0105 
0106   resetCmd = new G4UIcmdWithoutParameter("/gorad/analysis/reset",this);
0107   resetCmd->SetGuidance("Reset histograms without making output.");
0108   resetCmd->AvailableForStates(G4State_Idle);
0109 
0110   idOffsetCmd = new G4UIcommand("/gorad/analysis/idOffset",this);
0111   idOffsetCmd->SetGuidance("Define offset numbers of the histogram ID.");
0112   idOffsetCmd->SetGuidance(" The hostogram ID is set as (scorer_id + <offset>) * <factor> + copy_number - 1");
0113   para = new G4UIparameter("offset",'i',true);
0114   para->SetParameterRange("offset>=0");
0115   para->SetDefaultValue(0);
0116   idOffsetCmd->SetParameter(para);
0117   para = new G4UIparameter("factor",'i',true);
0118   para->SetParameterRange("factor>0");
0119   para->SetDefaultValue(1000);
0120   idOffsetCmd->SetParameter(para);
0121   idOffsetCmd->AvailableForStates(G4State_Idle);
0122 
0123   oneDDir = new G4UIdirectory("/gorad/analysis/1D/");
0124   oneDDir->SetGuidance("1-dimentional histogram");
0125 
0126   create1DCmd = new G4UIcommand("/gorad/analysis/1D/create",this);
0127   create1DCmd->SetGuidance("Create a 1D histogram and fill it with event-by-event score.");
0128   create1DCmd->SetGuidance("Scoring mesh (logical volume for real-world volume scoring) and");
0129   create1DCmd->SetGuidance("primitive scorers must be defined prior to this command.");
0130   para = new G4UIparameter("meshName",'s',false);
0131   para->SetGuidance("Scoring mesh name. Logical volume name for real-world volume scoring.");
0132   create1DCmd->SetParameter(para);
0133   para = new G4UIparameter("primName",'s',false);
0134   create1DCmd->SetParameter(para);
0135   para = new G4UIparameter("idx",'i',true);
0136   para->SetGuidance("Index (i.e. copy number) of the cell to be scored. \"-1\" (defult) to score all cells.");
0137   para->SetDefaultValue(-1);
0138   para->SetParameterRange("idx>=-1");
0139   create1DCmd->SetParameter(para);
0140   create1DCmd->AvailableForStates(G4State_Idle);
0141 
0142   create1DPrimPCmd = new G4UIcommand("/gorad/analysis/1D/primary",this);
0143   create1DPrimPCmd->SetGuidance("Create a 1D energy spectrum histogram and fill it with kinetic energy of each primary particle.");
0144   create1DPrimPCmd->SetGuidance("Weight of each primary track is taken into account if the flag is set.");
0145   para = new G4UIparameter("histName",'s',false);
0146   para->SetGuidance("Histogram name");
0147   create1DPrimPCmd->SetParameter(para);
0148   para = new G4UIparameter("weightFlag",'b',true);
0149   para->SetGuidance("Weight of each primary track is taken into account");
0150   para->SetDefaultValue(true);
0151   create1DPrimPCmd->SetParameter(para);
0152   create1DPrimPCmd->AvailableForStates(G4State_Idle);
0153 
0154   create1DPlotPCmd = new G4UIcommand("/gorad/analysis/1D/spectrum",this);
0155   create1DPlotPCmd->SetGuidance("Create a 1D energy spectrum histogram and fill it with each individual track that gets into the volume.");
0156   create1DPlotPCmd->SetGuidance("Histogram is created for each physical volume separately.");
0157   create1DPlotPCmd->SetGuidance("So, this command should not be used for Box or Cylinder mesh type due to memory consumption concern.");
0158   create1DPlotPCmd->SetGuidance("Currently, this is supported only for volume flux scorer.");
0159   para = new G4UIparameter("meshName",'s',false);
0160   para->SetGuidance("Scoring mesh name. Logical volume name for real-world volume scoring.");
0161   create1DPlotPCmd->SetParameter(para);
0162   para = new G4UIparameter("primName",'s',false);
0163   para->SetGuidance("Scoring primitive name.");
0164   create1DPlotPCmd->SetParameter(para);
0165   create1DPlotPCmd->AvailableForStates(G4State_Idle);
0166 
0167   set1DCmd = new G4UIcmdWithoutParameter("/gorad/analysis/1D/set",this);
0168   set1DCmd->SetGuidance("This command is obsolete. Use /gorad/analysis/1D/config instead.");
0169 
0170   config1DCmd = new G4UIcommand("/gorad/analysis/1D/config",this);
0171   config1DCmd->SetGuidance("Set binning parameters of the current 1D histogram.");
0172   config1DCmd->SetGuidance("<unit> is applied to <minVal> and <maxVal> as well as filled value.");
0173   para = new G4UIparameter("nBin",'i',false);
0174   para->SetParameterRange("nBin>0");
0175   config1DCmd->SetParameter(para);
0176   para = new G4UIparameter("minVal",'d',false);
0177   config1DCmd->SetParameter(para);
0178   para = new G4UIparameter("maxVal",'d',false);
0179   config1DCmd->SetParameter(para);
0180   para = new G4UIparameter("unit",'s',true);
0181   para->SetDefaultValue("none");
0182   config1DCmd->SetParameter(para);
0183   para = new G4UIparameter("scale",'s',true);
0184   para->SetGuidance("Define the binning scale. (default: linear)");
0185   para->SetParameterCandidates("linear log");
0186   para->SetDefaultValue("linear");
0187   config1DCmd->SetParameter(para);
0188   para = new G4UIparameter("logVal",'b',true);
0189   para->SetDefaultValue(false);
0190   config1DCmd->SetParameter(para);
0191   config1DCmd->AvailableForStates(G4State_Idle);
0192 
0193   title1DCmd = new G4UIcommand("/gorad/analysis/1D/title",this);
0194   title1DCmd->SetGuidance("Define histogram title");
0195   para = new G4UIparameter("title",'s',false);
0196   title1DCmd->SetParameter(para);
0197   para = new G4UIparameter("x_axis",'s',false);
0198   title1DCmd->SetParameter(para);
0199   para = new G4UIparameter("y_axis",'s',false);
0200   title1DCmd->SetParameter(para);
0201   title1DCmd->AvailableForStates(G4State_Idle);
0202 
0203   set1DYaxisLogCmd = new G4UIcmdWithABool("/gorad/analysis/1D/yaxisLog",this);
0204   set1DYaxisLogCmd->SetGuidance("Set y-axis in log scale.");
0205   set1DYaxisLogCmd->SetParameterName("flag",true);
0206   set1DYaxisLogCmd->SetDefaultValue(true);
0207   set1DYaxisLogCmd->AvailableForStates(G4State_Idle);
0208 
0209   onePDir = new G4UIdirectory("/gorad/analysis/1P/");
0210   onePDir->SetGuidance("1-dimentional profile plot");
0211 
0212   create1PCmd = new G4UIcommand("/gorad/analysis/1P/create",this);
0213   create1PCmd->SetGuidance("Create a 1D profile plot and fill it with event-by-event score.");
0214   create1PCmd->SetGuidance("Scoring mesh (logical volume for real-world volume scoring) and");
0215   create1PCmd->SetGuidance("primitive scorers must be defined prior to this command.");
0216   create1PCmd->SetGuidance("Copy number of the scoring cell is used as the x-axis value.");
0217   para = new G4UIparameter("meshName",'s',false);
0218   para->SetGuidance("Scoring mesh name. Logical volume name for real-world volume scoring.");
0219   create1PCmd->SetParameter(para);
0220   para = new G4UIparameter("primName",'s',false);
0221   create1PCmd->SetParameter(para);
0222   para = new G4UIparameter("idx",'i',false);
0223   para->SetGuidance("Maximum index (i.e. copy number) of the cell to be scored.");
0224   para->SetParameterRange("idx>0");
0225   create1PCmd->SetParameter(para);
0226   create1PCmd->AvailableForStates(G4State_Idle);
0227 
0228   set1PCmd = new G4UIcommand("/gorad/analysis/1P/set",this);
0229   set1PCmd->SetGuidance("Set binning parameters of the current 1D profile plot.");
0230   set1PCmd->SetGuidance("<unit> is applied to <minYVal> and <maxYVal> as well as filled value.");
0231   para = new G4UIparameter("minYVal",'d',false);
0232   set1PCmd->SetParameter(para);
0233   para = new G4UIparameter("maxYVal",'d',false);
0234   set1PCmd->SetParameter(para);
0235   para = new G4UIparameter("unit",'s',true);
0236   para->SetDefaultValue("none");
0237   set1PCmd->SetParameter(para);
0238   para = new G4UIparameter("func-x",'s',true);
0239   para->SetGuidance("The function applied to the filled x-value (default: none).");
0240   para->SetParameterCandidates("log log10 exp none");
0241   para->SetDefaultValue("none");
0242   set1PCmd->SetParameter(para);
0243   para = new G4UIparameter("func-y",'s',true);
0244   para->SetGuidance("The function applied to the filled y-value (default: none).");
0245   para->SetParameterCandidates("log log10 exp none");
0246   para->SetDefaultValue("none");
0247   set1PCmd->SetParameter(para);
0248   para = new G4UIparameter("scale",'s',true);
0249   para->SetGuidance("Define the binning scale. (default: linear)");
0250   para->SetParameterCandidates("linear log");
0251   para->SetDefaultValue("linear");
0252   set1PCmd->SetParameter(para);
0253   set1PCmd->AvailableForStates(G4State_Idle);
0254 
0255   title1PCmd = new G4UIcommand("/gorad/analysis/1P/title",this);
0256   title1PCmd->SetGuidance("Define histogram title");
0257   para = new G4UIparameter("title",'s',false);
0258   title1PCmd->SetParameter(para);
0259   para = new G4UIparameter("x_axis",'s',false);
0260   title1PCmd->SetParameter(para);
0261   para = new G4UIparameter("y_axis",'s',false);
0262   title1PCmd->SetParameter(para);
0263   title1PCmd->AvailableForStates(G4State_Idle);
0264 
0265   ntupleDir = new G4UIdirectory("/gorad/analysis/ntuple/");
0266   onePDir->SetGuidance("Define an ntuple");
0267 
0268   addColumnCmd = new G4UIcommand("/gorad/analysis/ntuple/addColumn",this);
0269   addColumnCmd->SetGuidance("Define a column and fill it with event-by-event score.");
0270   addColumnCmd->SetGuidance("Scoring mesh (logical volume for real-world volume scoring) and");
0271   addColumnCmd->SetGuidance("primitive scorers must be defined prior to this command.");
0272   para = new G4UIparameter("meshName",'s',false);
0273   para->SetGuidance("Scoring mesh name. Logical volume name for real-world volume scoring.");
0274   addColumnCmd->SetParameter(para);
0275   para = new G4UIparameter("primName",'s',false);
0276   addColumnCmd->SetParameter(para);
0277   para = new G4UIparameter("unit",'s',true);
0278   para->SetDefaultValue("none");
0279   addColumnCmd->SetParameter(para);
0280   para = new G4UIparameter("idx",'i',true);
0281   para->SetGuidance("Index (i.e. copy number) of the cell to be scored. \"-1\" (defult) to score all cells.");
0282   para->SetDefaultValue(-1);
0283   para->SetParameterRange("idx>=-1");
0284   addColumnCmd->SetParameter(para);
0285   addColumnCmd->AvailableForStates(G4State_Idle);
0286 }
0287 
0288 GRRunActionMessenger::~GRRunActionMessenger()
0289 { 
0290   delete addColumnCmd;
0291   delete ntupleDir;
0292 
0293   delete create1PCmd;
0294   delete set1PCmd;
0295   delete title1PCmd;
0296   delete onePDir;
0297 
0298   delete create1DCmd;
0299   delete create1DPrimPCmd;
0300   delete create1DPlotPCmd;
0301   delete set1DCmd;
0302   delete config1DCmd;
0303   delete title1DCmd;
0304   delete set1DYaxisLogCmd;
0305   delete oneDDir;
0306 
0307   delete fileCmd;
0308   delete verboseCmd;
0309   delete listCmd;
0310   delete openCmd;
0311   delete plotCmd;
0312   delete carryCmd;
0313   delete flushCmd;
0314   delete resetCmd;
0315   delete idOffsetCmd;
0316   delete anaDir;
0317 }
0318 
0319 #include "G4Tokenizer.hh"
0320 
0321 void GRRunActionMessenger::SetNewValue(G4UIcommand* cmd, G4String val)
0322 {
0323   if(cmd==fileCmd)
0324   { pRA->SetFileName(val); }
0325   else if(cmd==verboseCmd)
0326   { pRA->SetVerbose(verboseCmd->GetNewIntValue(val)); }
0327   else if(cmd==listCmd)
0328   { pRA->ListHistograms(); }
0329   else if(cmd==openCmd)
0330   { 
0331     auto id = openCmd->GetNewIntValue(val);
0332     if(currentID!=id)
0333     {
0334       if(!CheckOpenID(cmd)) return;
0335       auto valid = pRA->Open(id);
0336       if(!valid)
0337       {
0338         G4ExceptionDescription ed;
0339         ed << "<" << id << "> is not a valid histogram ID.";
0340         cmd->CommandFailed(ed);
0341       }
0342       else
0343       { currentID = id; }
0344     }
0345   }
0346   else if(cmd==plotCmd)
0347   { 
0348     auto id = plotCmd->GetNewIntValue(val);
0349     G4bool valid = true;
0350     if(id==-1)
0351     { valid = pRA->SetAllPlotting(true); }
0352     else
0353     { valid = pRA->SetPlotting(id,true); }
0354     if(!valid)
0355     {
0356       G4ExceptionDescription ed;
0357       ed << "Histogram/profile id <" << id << "> is not valid.";
0358       cmd->CommandFailed(ed);
0359     }
0360   }
0361   else if(cmd==carryCmd)
0362   { pRA->SetCarry(carryCmd->GetNewBoolValue(val)); }
0363   else if(cmd==flushCmd)
0364   { pRA->Flush(); }
0365   else if(cmd==resetCmd)
0366   { /*pRA->ResetHistograms();*/ }
0367   else if(cmd==idOffsetCmd)
0368   {
0369     G4Tokenizer next(val);
0370     G4int offset = StoI(next());
0371     G4int factor = StoI(next());
0372     pRA->SetOffset(offset,factor);
0373   }
0374 
0375   // 1D histogram commands
0376 
0377   else if(cmd==create1DCmd)
0378   {
0379     if(!CheckOpenID(cmd)) return;
0380     G4Tokenizer next(val);
0381     G4String meshName = next();
0382     G4String primName = next();
0383     G4int idx = StoI(next());
0384     auto id = pRA->Create1D(meshName,primName,idx);
0385     if(id<0)
0386     {
0387       G4ExceptionDescription ed;
0388       ed << "1D histogram <" << val << "> cannot be created.";
0389       cmd->CommandFailed(ed);
0390     }
0391     else
0392     { currentID = id; }
0393   }
0394   else if(cmd==create1DPrimPCmd)
0395   {
0396     if(!CheckOpenID(cmd)) return;
0397     G4Tokenizer next(val);
0398     G4String meshName = next();
0399     G4bool wgt = StoB(next());
0400     auto id = pRA->Create1DForPrimary(meshName,wgt);
0401     if(id<0)
0402     {
0403       G4ExceptionDescription ed;
0404       ed << "1D histogram <" << val << "> cannot be created.";
0405       cmd->CommandFailed(ed);
0406     }
0407     else
0408     { currentID = id; }
0409   }
0410   else if(cmd==create1DPlotPCmd)
0411   {
0412     if(!CheckOpenID(cmd)) return;
0413     G4Tokenizer next(val);
0414     G4String meshName = next();
0415     G4String primName = next();
0416     G4bool wgt = true;
0417     auto id = pRA->Create1DForPlotter(meshName,primName,wgt);
0418     if(id<0)
0419     {
0420       G4ExceptionDescription ed;
0421       ed << "1D histogram <" << val << "> cannot be created.";
0422       cmd->CommandFailed(ed);
0423     }
0424     else
0425     { currentID = id; }
0426   }
0427   else if(cmd==set1DCmd)
0428   {
0429     G4ExceptionDescription ed;
0430     ed << "This command is OBSOLETE. Use /gorad/analysis/1D/config command!!";
0431     cmd->CommandFailed(ed);
0432   }
0433   else if(cmd==config1DCmd)
0434   {
0435     if(!CheckID(cmd)) return;
0436     G4Tokenizer next(val);
0437     G4int nBin = StoI(next());
0438     G4double minVal = StoD(next());
0439     G4double maxVal = StoD(next());
0440     G4String unit = next();
0441     G4String schem = next();
0442     G4bool logVal = StoB(next());
0443     if(unit!="none" && !(G4UnitDefinition::IsUnitDefined(unit)))
0444     { 
0445       G4ExceptionDescription ed;
0446       ed << "Unknown unit <" << unit << ">. Command failed.";
0447       cmd->CommandFailed(ed);
0448     }
0449     else
0450     { pRA->Set1D(currentID,nBin,minVal,maxVal,unit,schem,logVal); }
0451   }
0452   else if(cmd==title1DCmd)
0453   {
0454     if(!CheckID(cmd)) return;
0455     G4Tokenizer next(val);
0456     G4String title = next();
0457     G4String x_axis = next();
0458     G4String y_axis = next();
0459     pRA->Set1DTitle(currentID,title,x_axis,y_axis);
0460   }
0461   else if(cmd==set1DYaxisLogCmd)
0462   {
0463     if(!CheckID(cmd)) return;
0464     auto succ = pRA->Set1DYAxisLog(currentID,set1DYaxisLogCmd->GetNewBoolValue(val));
0465     if(!succ)
0466     {
0467       G4ExceptionDescription ed;
0468       ed << "This command is not available for this histogram.";
0469       cmd->CommandFailed(ed);
0470     }
0471   }
0472 
0473   // 1D profile commands
0474 
0475   else if(cmd==create1PCmd)
0476   {
0477     if(!CheckOpenID(cmd)) return;
0478     G4Tokenizer next(val);
0479     G4String meshName = next();
0480     G4String primName = next();
0481     G4int cn = StoI(next());
0482     auto id = pRA->Create1P(meshName,primName,cn);
0483     if(id<0)
0484     {
0485       G4ExceptionDescription ed;
0486       ed << "1D histogram <" << val << "> cannot be created.";
0487       cmd->CommandFailed(ed);
0488     }
0489     else
0490     { currentID = id; }
0491   }
0492   else if(cmd==set1PCmd)
0493   {
0494     if(!CheckID(cmd)) return;
0495     G4Tokenizer next(val);
0496     G4double minYVal = StoD(next());
0497     G4double maxYVal = StoD(next());
0498     G4String unit = next();
0499     G4String funcX = next();
0500     G4String funcY = next();
0501     G4String schem = next();
0502     if(unit!="none" && !(G4UnitDefinition::IsUnitDefined(unit)))
0503     { 
0504       G4ExceptionDescription ed;
0505       ed << "Unknown unit <" << unit << ">. Command failed.";
0506       cmd->CommandFailed(ed);
0507     }
0508     else
0509     { pRA->Set1P(currentID,minYVal,maxYVal,unit,funcX,funcY,schem); }
0510   }
0511   else if(cmd==title1PCmd)
0512   {
0513     if(!CheckID(cmd)) return;
0514     G4Tokenizer next(val);
0515     G4String title = next();
0516     G4String x_axis = next();
0517     G4String y_axis = next();
0518     pRA->Set1PTitle(currentID,title,x_axis,y_axis);
0519   }
0520 
0521   // ntuple commands
0522 
0523   else if(cmd==addColumnCmd)
0524   {
0525     G4Tokenizer next(val);
0526     G4String meshName = next();
0527     G4String primName = next();
0528     G4String unit = next();
0529     G4int idx = StoI(next());
0530     if(unit!="none" && !(G4UnitDefinition::IsUnitDefined(unit)))
0531     { 
0532       G4ExceptionDescription ed;
0533       ed << "Unknown unit <" << unit << ">. Command failed.";
0534       cmd->CommandFailed(ed);
0535     }
0536     else
0537     {
0538       auto id = pRA->NtupleColumn(meshName,primName,unit,idx);
0539       if(id<0)
0540       {
0541         G4ExceptionDescription ed;
0542         ed << "Ntuple column <" << val << "> cannot be created.";
0543         cmd->CommandFailed(ed);
0544       }
0545     }
0546   }
0547 }
0548 
0549 G4String GRRunActionMessenger::GetCurrentValue(G4UIcommand* cmd)
0550 {
0551   G4String val("");
0552   if(cmd==openCmd)
0553   { val = openCmd->ConvertToString(currentID); }
0554   if(cmd==fileCmd)
0555   { val = pRA->GetFileName(); }
0556   else if(cmd==verboseCmd)
0557   { val = verboseCmd->ConvertToString(pRA->GetVerbose()); }
0558   else if(cmd==plotCmd)
0559   { val = plotCmd->ConvertToString(currentID); }
0560   else if(cmd==carryCmd)
0561   { val = carryCmd->ConvertToString(pRA->GetCarry()); }
0562   else if(cmd==idOffsetCmd)
0563   {
0564     G4int offset = 0;
0565     G4int factor = 0;
0566     pRA->GetOffset(offset,factor);
0567     val = idOffsetCmd->ConvertToString(offset);
0568     val += " ";
0569     val += idOffsetCmd->ConvertToString(factor);
0570   }
0571 
0572   return val;
0573 }
0574 
0575