G4AnalysisMessenger.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // $Id$
00027 
00028 // Author: Ivana Hrivnacova, 04/07/2012  (ivana@ipno.in2p3.fr)
00029 //
00030 // This messenger class is a generalization of the HistoMessenger class,
00031 // originally developed for the extended/electromagnetic examples
00032 // by Michel Maire (michel.maire@lapp.in2p3.fr)
00033 
00034 #include "G4AnalysisMessenger.hh"
00035 #include "G4VAnalysisManager.hh"
00036 #include "G4HnInformation.hh"
00037 
00038 #include "G4UIdirectory.hh"
00039 #include "G4UIcommand.hh"
00040 #include "G4UIparameter.hh"
00041 #include "G4UIcmdWithAString.hh"
00042 #include "G4UIcmdWithAnInteger.hh"
00043 #include "G4UIcmdWithABool.hh"
00044 
00045 #include <iostream>
00046 
00047 //_____________________________________________________________________________
00048 G4AnalysisMessenger::G4AnalysisMessenger(G4VAnalysisManager* manager)
00049   : G4UImessenger(),
00050     fManager(manager),
00051     fAnalysisDir(0),  
00052     fSetFileNameCmd(0),
00053     fSetHistoDirNameCmd(0),
00054     fSetNtupleDirNameCmd(0),
00055     fSetActivationCmd(0),
00056     fVerboseCmd(0),
00057     fH1Dir(0),  
00058     fCreateH1Cmd(0),
00059     fSetH1Cmd(0),
00060     fSetH1AsciiCmd(0), 
00061     fSetH1TitleCmd(0), 
00062     fSetH1XAxisCmd(0), 
00063     fSetH1YAxisCmd(0), 
00064     fSetH1ActivationCmd(0),
00065     fSetH1ActivationAllCmd(0),
00066     fH2Dir(0),  
00067     fCreateH2Cmd(0),
00068     fSetH2Cmd(0),
00069     fSetH2AsciiCmd(0), 
00070     fSetH2TitleCmd(0), 
00071     fSetH2XAxisCmd(0), 
00072     fSetH2YAxisCmd(0), 
00073     fSetH2ActivationCmd(0),
00074     fSetH2ActivationAllCmd(0)
00075 {  
00076   fAnalysisDir = new G4UIdirectory("/analysis/");
00077   fAnalysisDir->SetGuidance("analysis control");
00078 
00079   fSetFileNameCmd = new G4UIcmdWithAString("/analysis/setFileName",this);
00080   fSetFileNameCmd->SetGuidance("Set name for the histograms & ntuple file");
00081   fSetFileNameCmd->SetParameterName("Filename", false);
00082   fSetFileNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00083   
00084   fSetHistoDirNameCmd = new G4UIcmdWithAString("/analysis/setHistoDirName",this);
00085   fSetHistoDirNameCmd->SetGuidance("Set name for the histograms directory");
00086   fSetHistoDirNameCmd->SetParameterName("HistoDirName", false);
00087   fSetHistoDirNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00088   
00089   fSetNtupleDirNameCmd = new G4UIcmdWithAString("/analysis/setNtupleDirName",this);
00090   fSetNtupleDirNameCmd->SetGuidance("Set name for the ntuple directory");
00091   fSetNtupleDirNameCmd->SetParameterName("NtupleDirName", false);
00092   fSetNtupleDirNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00093   
00094   fSetActivationCmd = new G4UIcmdWithABool("/analysis/setActivation",this);
00095   G4String guidance = "Set activation. \n";
00096   guidance += "When this option is enabled, only the histograms marked as activated\n";
00097   guidance += "are returned, filled or saved on file.\n";
00098   guidance += "No warning is issued when Get or Fill is called on inactive histogram.";
00099   fSetActivationCmd->SetGuidance(guidance);
00100   fSetActivationCmd->SetParameterName("Activation",false);
00101 
00102   fVerboseCmd = new G4UIcmdWithAnInteger("/analysis/verbose",this);
00103   fVerboseCmd->SetGuidance("Set verbose level");
00104   fVerboseCmd->SetParameterName("VerboseLevel",false);
00105   fVerboseCmd->SetRange("VerboseLevel>=0 && VerboseLevel<=4");
00106 
00107   fH1Dir = new G4UIdirectory("/analysis/h1/");
00108   fH1Dir->SetGuidance("1D histograms control");
00109 
00110   CreateH1Cmd();
00111   SetH1Cmd();
00112   
00113   fSetH1AsciiCmd = new G4UIcmdWithAnInteger("/analysis/h1/setAscii",this);
00114   fSetH1AsciiCmd->SetGuidance("Print 1D histogram of #Id on ascii file.");
00115   fSetH1AsciiCmd->SetParameterName("Id",false);
00116   fSetH1AsciiCmd->SetRange("Id>=0");
00117   fSetH1AsciiCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00118   
00119   SetH1TitleCmd();
00120   SetH1XAxisCmd();
00121   SetH1YAxisCmd();
00122   SetH1ActivationCmd();
00123 
00124   fSetH1ActivationAllCmd = new G4UIcmdWithABool("/analysis/h1/setActivationToAll",this);
00125   fSetH1ActivationAllCmd->SetGuidance("Set activation to all 1D histograms.");
00126   fSetH1ActivationAllCmd->SetParameterName("Activation",false);
00127 
00128   fH2Dir = new G4UIdirectory("/analysis/h2/");
00129   fH2Dir->SetGuidance("2D histograms control");
00130 
00131   CreateH2Cmd();
00132   SetH2Cmd();
00133   
00134   fSetH2AsciiCmd = new G4UIcmdWithAnInteger("/analysis/h2/setAscii",this);
00135   fSetH2AsciiCmd->SetGuidance("Print 2D histogram of #Id on ascii file.");
00136   fSetH2AsciiCmd->SetParameterName("Id",false);
00137   fSetH2AsciiCmd->SetRange("Id>=0");
00138   fSetH2AsciiCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00139   
00140   SetH2TitleCmd();
00141   SetH2XAxisCmd();
00142   SetH2YAxisCmd();
00143   SetH2ZAxisCmd();
00144   SetH2ActivationCmd();
00145 
00146   fSetH2ActivationAllCmd = new G4UIcmdWithABool("/analysis/h2/setActivationToAll",this);
00147   fSetH2ActivationAllCmd->SetGuidance("Set activation to all 2D histograms.");
00148   fSetH2ActivationAllCmd->SetParameterName("Activation",false);
00149 
00150 }
00151 
00152 //_____________________________________________________________________________
00153 G4AnalysisMessenger::~G4AnalysisMessenger()
00154 {
00155   delete fSetFileNameCmd;
00156   delete fSetHistoDirNameCmd;
00157   delete fSetNtupleDirNameCmd;
00158   delete fSetActivationCmd;
00159   delete fVerboseCmd;
00160   delete fCreateH1Cmd;
00161   delete fSetH1Cmd;
00162   delete fSetH1AsciiCmd;  
00163   delete fSetH1TitleCmd;  
00164   delete fSetH1XAxisCmd;  
00165   delete fSetH1YAxisCmd;  
00166   delete fSetH1ActivationCmd;
00167   delete fSetH1ActivationAllCmd;
00168   delete fH1Dir;
00169   delete fCreateH2Cmd;
00170   delete fSetH2Cmd;
00171   delete fSetH2AsciiCmd;  
00172   delete fSetH2TitleCmd;  
00173   delete fSetH2XAxisCmd;  
00174   delete fSetH2YAxisCmd;  
00175   delete fSetH2ZAxisCmd;  
00176   delete fSetH2ActivationCmd;
00177   delete fSetH2ActivationAllCmd;
00178   delete fH2Dir;
00179   delete fAnalysisDir;
00180 }
00181 
00182 //
00183 // private functions
00184 //
00185 
00186 //_____________________________________________________________________________
00187 void G4AnalysisMessenger::CreateH1Cmd()
00188 {
00189   G4UIparameter* h1Name = new G4UIparameter("name", 's', false);
00190   h1Name->SetGuidance("Histogram name (label)");
00191   
00192   G4UIparameter* h1Title = new G4UIparameter("title", 's', false);
00193   h1Title->SetGuidance("Histogram title");
00194 
00195   G4UIparameter* h1Nbins0 = new G4UIparameter("nbins0", 'i', true);
00196   h1Nbins0->SetGuidance("Number of bins (default = 100)");
00197   h1Nbins0->SetGuidance("Can be reset with /analysis/h1/set command");
00198   h1Nbins0->SetDefaultValue(100);
00199   
00200   G4UIparameter* h1ValMin0 = new G4UIparameter("valMin0", 'd', true);
00201   h1ValMin0->SetGuidance("Minimum value, expressed in unit (default = 0.)");
00202   h1ValMin0->SetGuidance("Can be reset with /analysis/h1/set command");
00203   h1ValMin0->SetDefaultValue(0.);
00204   
00205   G4UIparameter* h1ValMax0 = new G4UIparameter("valMax0", 'd', true);
00206   h1ValMax0->SetGuidance("Maximum value, expressed in unit (default = 1.)");
00207   h1ValMax0->SetGuidance("Can be reset with /analysis/h1/set command");
00208   h1ValMax0->SetDefaultValue(1.);
00209 
00210   G4UIparameter* h1ValUnit0 = new G4UIparameter("valUnit0", 's', true);
00211   h1ValUnit0->SetGuidance("The unit of valMin0 and valMax0");
00212   h1ValUnit0->SetDefaultValue("none");
00213   
00214   G4UIparameter* h1ValFcn0 = new G4UIparameter("valFcn0", 's', true);
00215   G4String fcnGuidance = "The function applied to filled values (log, log10, exp).\n";
00216   fcnGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
00217   fcnGuidance += "but none value should be used insted.";
00218   h1ValFcn0->SetGuidance(fcnGuidance);
00219   h1ValFcn0->SetParameterCandidates("log log10 exp none");
00220   h1ValFcn0->SetDefaultValue("none");
00221   
00222   fCreateH1Cmd = new G4UIcommand("/analysis/h1/create", this);
00223   fCreateH1Cmd->SetGuidance("Create 1D histogram");
00224   fCreateH1Cmd->SetParameter(h1Name);
00225   fCreateH1Cmd->SetParameter(h1Title);
00226   fCreateH1Cmd->SetParameter(h1Nbins0);
00227   fCreateH1Cmd->SetParameter(h1ValMin0);
00228   fCreateH1Cmd->SetParameter(h1ValMax0);
00229   fCreateH1Cmd->SetParameter(h1ValUnit0);
00230   fCreateH1Cmd->SetParameter(h1ValFcn0);
00231   fCreateH1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00232 }  
00233 
00234 
00235 //_____________________________________________________________________________
00236 void G4AnalysisMessenger::SetH1Cmd()
00237 {
00238   G4UIparameter* h1Id = new G4UIparameter("id", 'i', false);
00239   h1Id->SetGuidance("Histogram id");
00240   h1Id->SetParameterRange("id>=0");
00241   
00242   G4UIparameter* h1Nbins = new G4UIparameter("nbins", 'i', false);
00243   h1Nbins->SetGuidance("Number of bins");
00244   
00245   G4UIparameter* h1ValMin = new G4UIparameter("valMin", 'd', false);
00246   h1ValMin->SetGuidance("Minimum value, expressed in unit");
00247   
00248   G4UIparameter* h1ValMax = new G4UIparameter("valMax", 'd', false);
00249   h1ValMax->SetGuidance("Maximum value, expressed in unit");
00250   
00251   G4UIparameter* h1ValUnit = new G4UIparameter("valUnit", 's', true);
00252   h1ValUnit->SetGuidance("The unit of valMin and valMax");
00253   h1ValUnit->SetDefaultValue("none");
00254  
00255   G4UIparameter* h1ValFcn = new G4UIparameter("valFcn", 's', true);
00256   h1ValFcn->SetParameterCandidates("log log10 exp none");
00257   G4String fcnGuidance = "The function applied to filled values (log, log10, exp, none).\n";
00258   fcnGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
00259   fcnGuidance += "but none value should be used insted.";
00260   h1ValFcn->SetGuidance(fcnGuidance);
00261   h1ValFcn->SetDefaultValue("none");
00262  
00263   fSetH1Cmd = new G4UIcommand("/analysis/h1/set", this);
00264   fSetH1Cmd->SetGuidance("Set parameters for the 1D histogram of #Id :");
00265   fSetH1Cmd->SetGuidance("  nbins; valMin; valMax; unit (of vmin and vmax)");
00266   fSetH1Cmd->SetParameter(h1Id);
00267   fSetH1Cmd->SetParameter(h1Nbins);
00268   fSetH1Cmd->SetParameter(h1ValMin);
00269   fSetH1Cmd->SetParameter(h1ValMax);
00270   fSetH1Cmd->SetParameter(h1ValUnit);
00271   fSetH1Cmd->SetParameter(h1ValFcn);
00272   fSetH1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00273 }  
00274 
00275 //_____________________________________________________________________________
00276 void G4AnalysisMessenger::SetH1TitleCmd()
00277 {
00278   G4UIparameter* h1Id = new G4UIparameter("idTitle", 'i', false);
00279   h1Id->SetGuidance("Histogram id");
00280   h1Id->SetParameterRange("idTitle>=0");
00281 
00282   G4UIparameter* h1Title = new G4UIparameter("h1Title", 's', true);
00283   h1Title->SetGuidance("Histogram title");
00284   h1Title->SetDefaultValue("none");
00285 
00286   fSetH1TitleCmd = new G4UIcommand("/analysis/h1/setTitle", this);
00287   fSetH1TitleCmd->SetGuidance("Set title for the 1D histogram of #Id");
00288   fSetH1TitleCmd->SetParameter(h1Id);
00289   fSetH1TitleCmd->SetParameter(h1Title);
00290   fSetH1TitleCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00291 }  
00292 
00293 //_____________________________________________________________________________
00294 void G4AnalysisMessenger::SetH1XAxisCmd()
00295 {
00296   G4UIparameter* h1Id = new G4UIparameter("idXaxis", 'i', false);
00297   h1Id->SetGuidance("Histogram id");
00298   h1Id->SetParameterRange("idXaxis>=0");
00299 
00300   G4UIparameter* h1XAxis = new G4UIparameter("h1Xaxis", 's', true);
00301   h1XAxis->SetGuidance("Histogram x-axis title");
00302   h1XAxis->SetDefaultValue("none");
00303 
00304   fSetH1XAxisCmd = new G4UIcommand("/analysis/h1/setXaxis", this);
00305   fSetH1XAxisCmd->SetGuidance("Set x-axis title for the 1D histogram of #Id");
00306   fSetH1XAxisCmd->SetParameter(h1Id);
00307   fSetH1XAxisCmd->SetParameter(h1XAxis);
00308   fSetH1XAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00309 }  
00310 
00311 //_____________________________________________________________________________
00312 void G4AnalysisMessenger::SetH1YAxisCmd()
00313 {
00314   G4UIparameter* h1Id = new G4UIparameter("idYaxis", 'i', false);
00315   h1Id->SetGuidance("Histogram id");
00316   h1Id->SetParameterRange("idYaxis>=0");
00317 
00318   G4UIparameter* h1YAxis = new G4UIparameter("h1Yaxis", 's', true);
00319   h1YAxis->SetGuidance("Histogram y-axis title");
00320   h1YAxis->SetDefaultValue("none");
00321 
00322   fSetH1YAxisCmd = new G4UIcommand("/analysis/h1/setYaxis", this);
00323   fSetH1YAxisCmd->SetGuidance("Set y-axis title for the 1D histogram of #Id");
00324   fSetH1YAxisCmd->SetParameter(h1Id);
00325   fSetH1YAxisCmd->SetParameter(h1YAxis);
00326   fSetH1YAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00327 }  
00328 
00329 //_____________________________________________________________________________
00330 void G4AnalysisMessenger::SetH1ActivationCmd()
00331 {
00332   G4UIparameter* h1Id = new G4UIparameter("idActivation", 'i', false);
00333   h1Id->SetGuidance("Histogram id");
00334   h1Id->SetParameterRange("idActivation>=0");
00335 
00336   G4UIparameter* h1Activation = new G4UIparameter("h1Activation", 's', true);
00337   h1Activation->SetGuidance("Histogram activation");
00338   h1Activation->SetDefaultValue("none");
00339 
00340   fSetH1ActivationCmd = new G4UIcommand("/analysis/h1/setActivation", this);
00341   fSetH1ActivationCmd->SetGuidance("Set activation for the 1D histogram of #Id");
00342   fSetH1ActivationCmd->SetParameter(h1Id);
00343   fSetH1ActivationCmd->SetParameter(h1Activation);
00344   fSetH1ActivationCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00345 }  
00346 
00347 //_____________________________________________________________________________
00348 void G4AnalysisMessenger::CreateH2Cmd()
00349 {
00350   G4UIparameter* h2Name = new G4UIparameter("name", 's', false);
00351   h2Name->SetGuidance("Histogram name (label)");
00352   
00353   G4UIparameter* h2Title = new G4UIparameter("title", 's', false);
00354   h2Title->SetGuidance("Histogram title");
00355 
00356   G4UIparameter* h2xNbins0 = new G4UIparameter("xnbins0", 'i', true);
00357   h2xNbins0->SetGuidance("Number of x-bins (default = 100)");
00358   h2xNbins0->SetGuidance("Can be reset with /analysis/h2/set command");
00359   h2xNbins0->SetDefaultValue(100);
00360   
00361   G4UIparameter* h2xValMin0 = new G4UIparameter("xvalMin0", 'd', true);
00362   h2xValMin0->SetGuidance("Minimum x-value, expressed in unit (default = 0.)");
00363   h2xValMin0->SetGuidance("Can be reset with /analysis/h2/set command");
00364   h2xValMin0->SetDefaultValue(0.);
00365   
00366   G4UIparameter* h2xValMax0 = new G4UIparameter("xvalMax0", 'd', true);
00367   h2xValMax0->SetGuidance("Maximum x-value, expressed in unit (default = 1.)");
00368   h2xValMax0->SetGuidance("Can be reset with /analysis/h2/set command");
00369   h2xValMax0->SetDefaultValue(1.);
00370 
00371   G4UIparameter* h2xValUnit0 = new G4UIparameter("xvalUnit0", 's', true);
00372   h2xValUnit0->SetGuidance("The unit of xvalMin0 and xvalMax0");
00373   h2xValUnit0->SetDefaultValue("none");
00374   
00375   G4UIparameter* h2xValFcn0 = new G4UIparameter("xvalFcn0", 's', true);
00376   G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).\n";
00377   fcnxGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
00378   fcnxGuidance += "but none value should be used insted.";
00379   h2xValFcn0->SetGuidance(fcnxGuidance);
00380   h2xValFcn0->SetParameterCandidates("log log10 exp none");
00381   h2xValFcn0->SetDefaultValue("none");
00382   
00383   G4UIparameter* h2yNbins0 = new G4UIparameter("ynbins0", 'i', true);
00384   h2yNbins0->SetGuidance("Number of y-bins (default = 100)");
00385   h2yNbins0->SetGuidance("Can be reset with /analysis/h2/set command");
00386   h2yNbins0->SetDefaultValue(100);
00387   
00388   G4UIparameter* h2yValMin0 = new G4UIparameter("yvalMin0", 'd', true);
00389   h2yValMin0->SetGuidance("Minimum y-value, expressed in unit (default = 0.)");
00390   h2yValMin0->SetGuidance("Can be reset with /analysis/h2/set command");
00391   h2yValMin0->SetDefaultValue(0.);
00392   
00393   G4UIparameter* h2yValMax0 = new G4UIparameter("yvalMax0", 'd', true);
00394   h2yValMax0->SetGuidance("Maximum y-value, expressed in unit (default = 1.)");
00395   h2yValMax0->SetGuidance("Can be reset with /analysis/h2/set command");
00396   h2yValMax0->SetDefaultValue(1.);
00397 
00398   G4UIparameter* h2yValUnit0 = new G4UIparameter("yvalUnit0", 's', true);
00399   h2yValUnit0->SetGuidance("The unit of xvalMin0 and yvalMax0");
00400   h2yValUnit0->SetDefaultValue("none");
00401   
00402   G4UIparameter* h2yValFcn0 = new G4UIparameter("yvalFcn0", 's', true);
00403   G4String fcnyGuidance = "The function applied to filled x-values (log, log10, exp, none).\n";
00404   fcnyGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
00405   fcnyGuidance += "but none value should be used insted.";
00406   h2yValFcn0->SetGuidance(fcnyGuidance);
00407   h2yValFcn0->SetParameterCandidates("log log10 exp none");
00408   h2yValFcn0->SetDefaultValue("none");
00409   
00410   fCreateH2Cmd = new G4UIcommand("/analysis/h2/create", this);
00411   fCreateH2Cmd->SetGuidance("Create 2D histogram");
00412   fCreateH2Cmd->SetParameter(h2Name);
00413   fCreateH2Cmd->SetParameter(h2Title);
00414   fCreateH2Cmd->SetParameter(h2xNbins0);
00415   fCreateH2Cmd->SetParameter(h2xValMin0);
00416   fCreateH2Cmd->SetParameter(h2xValMax0);
00417   fCreateH2Cmd->SetParameter(h2xValUnit0);
00418   fCreateH2Cmd->SetParameter(h2xValFcn0);
00419   fCreateH2Cmd->SetParameter(h2yNbins0);
00420   fCreateH2Cmd->SetParameter(h2yValMin0);
00421   fCreateH2Cmd->SetParameter(h2yValMax0);
00422   fCreateH2Cmd->SetParameter(h2yValUnit0);
00423   fCreateH2Cmd->SetParameter(h2yValFcn0);
00424   fCreateH2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00425 }  
00426 
00427 
00428 //_____________________________________________________________________________
00429 void G4AnalysisMessenger::SetH2Cmd()
00430 {
00431   G4UIparameter* h2Id = new G4UIparameter("id", 'i', false);
00432   h2Id->SetGuidance("Histogram id");
00433   h2Id->SetParameterRange("id>=0");
00434   
00435   G4UIparameter* h2xNbins = new G4UIparameter("xnbins", 'i', false);
00436   h2xNbins->SetGuidance("Number of x-bins");
00437   
00438   G4UIparameter* h2xValMin = new G4UIparameter("xvalMin", 'd', false);
00439   h2xValMin->SetGuidance("Minimum x-value, expressed in unit");
00440   
00441   G4UIparameter* h2xValMax = new G4UIparameter("xvalMax", 'd', false);
00442   h2xValMax->SetGuidance("Maximum x-value, expressed in unit");
00443   
00444   G4UIparameter* h2xValFcn = new G4UIparameter("xvalFcn", 's', false);
00445   h2xValFcn->SetParameterCandidates("log log10 exp none");
00446   G4String fcnxGuidance = "The function applied to filled x-values (log, log10, exp, none).\n";
00447   fcnxGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
00448   fcnxGuidance += "but none value should be used insted.";
00449   h2xValFcn->SetGuidance(fcnxGuidance);
00450   h2xValFcn->SetDefaultValue("none");
00451  
00452   G4UIparameter* h2yValUnit = new G4UIparameter("yvalUnit", 's', false);
00453   h2yValUnit->SetGuidance("The unit of yvalMin and yvalMax");
00454   h2yValUnit->SetDefaultValue("none");
00455  
00456   G4UIparameter* h2yNbins = new G4UIparameter("nybins", 'i', false);
00457   h2yNbins->SetGuidance("Number of y-bins");
00458   
00459   G4UIparameter* h2yValMin = new G4UIparameter("yvalMin", 'd', false);
00460   h2yValMin->SetGuidance("Minimum y-value, expressed in unit");
00461   
00462   G4UIparameter* h2yValMax = new G4UIparameter("yvalMax", 'd', false);
00463   h2yValMax->SetGuidance("Maximum y-value, expressed in unit");
00464   
00465   G4UIparameter* h2xValUnit = new G4UIparameter("xvalUnit", 's', true);
00466   h2xValUnit->SetGuidance("The unit of xvalMin and xvalMax");
00467   h2xValUnit->SetDefaultValue("none");
00468  
00469   G4UIparameter* h2yValFcn = new G4UIparameter("yvalFcn", 's', false);
00470   h2yValFcn->SetParameterCandidates("log log10 exp none");
00471   G4String fcnyGuidance = "The function applied to filled y-values (log, log10, exp, none).\n";
00472   fcnyGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
00473   fcnyGuidance += "but none value should be used insted.";
00474   h2yValFcn->SetGuidance(fcnyGuidance);
00475   h2yValFcn->SetDefaultValue("none");
00476  
00477   fSetH2Cmd = new G4UIcommand("/analysis/h2/set", this);
00478   fSetH2Cmd->SetGuidance("Set parameters for the 2D histogram of #Id :");
00479   fSetH2Cmd->SetGuidance("  nbins; valMin; valMax; unit (of vmin and vmax)");
00480   fSetH2Cmd->SetParameter(h2Id);
00481   fSetH2Cmd->SetParameter(h2xNbins);
00482   fSetH2Cmd->SetParameter(h2xValMin);
00483   fSetH2Cmd->SetParameter(h2xValMax);
00484   fSetH2Cmd->SetParameter(h2xValUnit);
00485   fSetH2Cmd->SetParameter(h2xValFcn);
00486   fSetH2Cmd->SetParameter(h2yNbins);
00487   fSetH2Cmd->SetParameter(h2yValMin);
00488   fSetH2Cmd->SetParameter(h2yValMax);
00489   fSetH2Cmd->SetParameter(h2yValUnit);
00490   fSetH2Cmd->SetParameter(h2yValFcn);
00491   fSetH2Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00492 }  
00493 
00494 //_____________________________________________________________________________
00495 void G4AnalysisMessenger::SetH2TitleCmd()
00496 {
00497   G4UIparameter* h2Id = new G4UIparameter("idTitle", 'i', false);
00498   h2Id->SetGuidance("Histogram id");
00499   h2Id->SetParameterRange("idTitle>=0");
00500 
00501   G4UIparameter* h2Title = new G4UIparameter("h2Title", 's', true);
00502   h2Title->SetGuidance("Histogram title");
00503   h2Title->SetDefaultValue("none");
00504 
00505   fSetH2TitleCmd = new G4UIcommand("/analysis/h2/setTitle", this);
00506   fSetH2TitleCmd->SetGuidance("Set title for the 2D histogram of #Id");
00507   fSetH2TitleCmd->SetParameter(h2Id);
00508   fSetH2TitleCmd->SetParameter(h2Title);
00509   fSetH2TitleCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00510 }  
00511 
00512 //_____________________________________________________________________________
00513 void G4AnalysisMessenger::SetH2XAxisCmd()
00514 {
00515   G4UIparameter* h2Id = new G4UIparameter("idXaxis", 'i', false);
00516   h2Id->SetGuidance("Histogram id");
00517   h2Id->SetParameterRange("idXaxis>=0");
00518 
00519   G4UIparameter* h2XAxis = new G4UIparameter("h2Xaxis", 's', true);
00520   h2XAxis->SetGuidance("Histogram x-axis title");
00521   h2XAxis->SetDefaultValue("none");
00522 
00523   fSetH2XAxisCmd = new G4UIcommand("/analysis/h2/setXaxis", this);
00524   fSetH2XAxisCmd->SetGuidance("Set x-axis title for the 2D histogram of #Id");
00525   fSetH2XAxisCmd->SetParameter(h2Id);
00526   fSetH2XAxisCmd->SetParameter(h2XAxis);
00527   fSetH2XAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00528 }  
00529 
00530 //_____________________________________________________________________________
00531 void G4AnalysisMessenger::SetH2YAxisCmd()
00532 {
00533   G4UIparameter* h2Id = new G4UIparameter("idYaxis", 'i', false);
00534   h2Id->SetGuidance("Histogram id");
00535   h2Id->SetParameterRange("idYaxis>=0");
00536 
00537   G4UIparameter* h2YAxis = new G4UIparameter("h2Yaxis", 's', true);
00538   h2YAxis->SetGuidance("Histogram y-axis title");
00539   h2YAxis->SetDefaultValue("none");
00540 
00541   fSetH2YAxisCmd = new G4UIcommand("/analysis/h2/setYaxis", this);
00542   fSetH2YAxisCmd->SetGuidance("Set y-axis title for the 2D histogram of #Id");
00543   fSetH2YAxisCmd->SetParameter(h2Id);
00544   fSetH2YAxisCmd->SetParameter(h2YAxis);
00545   fSetH2YAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00546 }  
00547 
00548 //_____________________________________________________________________________
00549 void G4AnalysisMessenger::SetH2ZAxisCmd()
00550 {
00551   G4UIparameter* h2Id = new G4UIparameter("idYaxis", 'i', false);
00552   h2Id->SetGuidance("Histogram id");
00553   h2Id->SetParameterRange("idYaxis>=0");
00554 
00555   G4UIparameter* h2YAxis = new G4UIparameter("h2Yaxis", 's', true);
00556   h2YAxis->SetGuidance("Histogram y-axis title");
00557   h2YAxis->SetDefaultValue("none");
00558 
00559   fSetH2ZAxisCmd = new G4UIcommand("/analysis/h2/setYaxis", this);
00560   fSetH2ZAxisCmd->SetGuidance("Set y-axis title for the 2D histogram of #Id");
00561   fSetH2ZAxisCmd->SetParameter(h2Id);
00562   fSetH2ZAxisCmd->SetParameter(h2YAxis);
00563   fSetH2ZAxisCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00564 }  
00565 
00566 //_____________________________________________________________________________
00567 void G4AnalysisMessenger::SetH2ActivationCmd()
00568 {
00569   G4UIparameter* h2Id = new G4UIparameter("idActivation", 'i', false);
00570   h2Id->SetGuidance("Histogram id");
00571   h2Id->SetParameterRange("idActivation>=0");
00572 
00573   G4UIparameter* h2Activation = new G4UIparameter("h2Activation", 's', true);
00574   h2Activation->SetGuidance("Histogram activation");
00575   h2Activation->SetDefaultValue("none");
00576 
00577   fSetH2ActivationCmd = new G4UIcommand("/analysis/h2/setActivation", this);
00578   fSetH2ActivationCmd->SetGuidance("Set activation for the 2D histogram of #Id");
00579   fSetH2ActivationCmd->SetParameter(h2Id);
00580   fSetH2ActivationCmd->SetParameter(h2Activation);
00581   fSetH2ActivationCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
00582 }  
00583 
00584 //_____________________________________________________________________________
00585 void G4AnalysisMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
00586 {
00587   if ( command == fSetFileNameCmd ) {
00588     G4cout << "Set file name: " << newValues << G4endl;
00589     fManager->SetFileName(newValues);
00590   }  
00591   else if ( command == fSetHistoDirNameCmd ) {
00592     fManager->SetHistoDirectoryName(newValues);
00593   }  
00594   else if ( command == fSetNtupleDirNameCmd ) {
00595     fManager->SetNtupleDirectoryName(newValues);
00596   }  
00597   else if ( command == fSetActivationCmd ) {
00598     fManager->SetActivation(fSetActivationCmd->GetNewBoolValue(newValues));
00599   }  
00600   else if ( command == fVerboseCmd ) {
00601     fManager->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValues));
00602   }  
00603   else if ( command == fCreateH1Cmd ) { 
00604     G4String name, title;
00605     G4int nbins; 
00606     G4double vmin,vmax; 
00607     G4String sunit;
00608     G4String sfcn;
00609     std::istringstream is(newValues.data());
00610     is >> name >> title >> nbins >> vmin >> vmax >> sunit >> sfcn;
00611     fManager->CreateH1(name, title, nbins, vmin, vmax, sunit, sfcn);     
00612   }
00613   else if ( command == fSetH1Cmd ) {
00614     G4int id; 
00615     G4int nbins; 
00616     G4double vmin, vmax; 
00617     G4String sunit;
00618     G4String sfcn;
00619     std::istringstream is(newValues.data());
00620     is >> id >> nbins >> vmin >> vmax >> sunit >> sfcn;
00621     fManager->SetH1(id, nbins, vmin, vmax, sunit, sfcn);     
00622   }
00623   else if ( command == fSetH1AsciiCmd ) {
00624     G4int id = fSetH1AsciiCmd->GetNewIntValue(newValues);
00625     fManager->SetAscii(G4VAnalysisManager::kH1, id, true); 
00626   }      
00627   else if ( command == fSetH1TitleCmd ) {
00628     G4int id; 
00629     G4String title;
00630     std::istringstream is(newValues.data());
00631     is >> id;
00632     getline(is, title);
00633     fManager->SetH1Title(id, title);     
00634   }
00635   else if ( command == fSetH1XAxisCmd ) {
00636     G4int id; 
00637     G4String xaxis;
00638     std::istringstream is(newValues.data());
00639     is >> id;
00640     getline(is, xaxis);
00641     fManager->SetH1XAxisTitle(id, xaxis);     
00642   }
00643   else if ( command == fSetH1YAxisCmd ) {
00644     G4int id; 
00645     G4String yaxis;
00646     std::istringstream is(newValues.data());
00647     is >> id;
00648     getline(is, yaxis);
00649     fManager->SetH1YAxisTitle(id, yaxis);     
00650   }
00651   else if ( command == fSetH1ActivationCmd ) {
00652     G4int id; 
00653     G4String sactivation;
00654     std::istringstream is(newValues.data());
00655     is >> id >> sactivation;
00656     G4bool activation = G4UIcommand::ConvertToBool(sactivation);
00657     fManager->SetActivation(G4VAnalysisManager::kH1, id, activation);     
00658   }
00659   else if ( command == fSetH1ActivationAllCmd ) {
00660     G4bool activation = fSetH1ActivationAllCmd->GetNewBoolValue(newValues);
00661     fManager->SetActivation(G4VAnalysisManager::kH1, activation);
00662   }  
00663   else if ( command == fCreateH2Cmd ) { 
00664     G4String name, title;
00665     G4int xnbins, ynbins; 
00666     G4double xvmin, xvmax, yvmin, yvmax; 
00667     G4String xsunit,xsfcn, ysunit, ysfcn;
00668     std::istringstream is(newValues.data());
00669     is >> name >> title 
00670        >> xnbins >> xvmin >> xvmax >> xsunit >> xsfcn
00671        >> ynbins >> yvmin >> yvmax >> ysunit >> ysfcn;
00672     fManager->CreateH2(name, title, 
00673                        xnbins, xvmin, xvmax, ynbins, yvmin, yvmax, 
00674                        ysunit, ysfcn, ysunit, ysfcn);     
00675   }
00676   else if ( command == fSetH2Cmd ) {
00677     G4int id; 
00678     G4int xnbins, ynbins; 
00679     G4double xvmin, xvmax, yvmin, yvmax; 
00680     G4String xsunit,xsfcn, ysunit, ysfcn;
00681     std::istringstream is(newValues.data());
00682     is >> id 
00683        >> xnbins >> xvmin >> xvmax >> xsunit >> xsfcn  
00684        >> ynbins >> yvmin >> yvmax >> ysunit >> ysfcn;
00685     fManager->SetH2(id, 
00686                     xnbins, xvmin, xvmax, ynbins, yvmin, yvmax, 
00687                     ysunit, ysfcn, ysunit, ysfcn);     
00688   }
00689   else if ( command == fSetH2AsciiCmd ) {
00690     G4int id = fSetH2AsciiCmd->GetNewIntValue(newValues);
00691     fManager->SetAscii(G4VAnalysisManager::kH2, id, true); 
00692   }      
00693   else if ( command == fSetH2TitleCmd ) {
00694     G4int id; 
00695     G4String title;
00696     std::istringstream is(newValues.data());
00697     is >> id;
00698     getline(is, title);
00699     fManager->SetH2Title(id, title);     
00700   }
00701   else if ( command == fSetH2XAxisCmd ) {
00702     G4int id; 
00703     G4String xaxis;
00704     std::istringstream is(newValues.data());
00705     is >> id;
00706     getline(is, xaxis);
00707     fManager->SetH2XAxisTitle(id, xaxis);     
00708   }
00709   else if ( command == fSetH2YAxisCmd ) {
00710     G4int id; 
00711     G4String yaxis;
00712     std::istringstream is(newValues.data());
00713     is >> id;
00714     getline(is, yaxis);
00715     fManager->SetH2YAxisTitle(id, yaxis);     
00716   }
00717   else if ( command == fSetH2ZAxisCmd ) {
00718     G4int id; 
00719     G4String zaxis;
00720     std::istringstream is(newValues.data());
00721     is >> id;
00722     getline(is, zaxis);
00723     fManager->SetH2ZAxisTitle(id, zaxis);     
00724   }
00725   else if ( command == fSetH2ActivationCmd ) {
00726     G4int id; 
00727     G4String sactivation;
00728     std::istringstream is(newValues.data());
00729     is >> id >> sactivation;
00730     G4bool activation = G4UIcommand::ConvertToBool(sactivation);
00731     fManager->SetActivation(G4VAnalysisManager::kH2, id, activation);     
00732   }
00733   else if ( command == fSetH2ActivationAllCmd ) {
00734     G4bool activation = fSetH2ActivationAllCmd->GetNewBoolValue(newValues);
00735     fManager->SetActivation(G4VAnalysisManager::kH2, activation);
00736   }  
00737 }  

Generated on Mon May 27 17:47:38 2013 for Geant4 by  doxygen 1.4.7