HistoMessenger Class Reference

#include <HistoMessenger.hh>

Collaboration diagram for HistoMessenger:
Collaboration graph
[legend]

Public Member Functions

 HistoMessenger (Histo *)
virtual ~HistoMessenger ()
virtual void SetNewValue (G4UIcommand *, G4String)

Private Attributes

HistofHisto
G4UIdirectory * fHistoDir
G4UIcmdWithAString * fFactoryCmd
G4UIcmdWithAString * fFileCmd
G4UIcommand * fHistoCmd

Detailed Description

Definition at line 51 of file HistoMessenger.hh.


Constructor & Destructor Documentation

HistoMessenger::HistoMessenger ( Histo hist  ) 

Definition at line 47 of file HistoMessenger.cc.

References fFactoryCmd, fFileCmd, fHistoCmd, and fHistoDir.

00048   :fHisto(hist)
00049 {
00050   fHistoDir = new G4UIdirectory("/testhadr/histo/");
00051   fHistoDir->SetGuidance("histograms control");
00052 
00053   fFactoryCmd = new G4UIcmdWithAString("/testhadr/histo/fileName",this);
00054   fFactoryCmd->SetGuidance("set name for the histograms file");
00055 
00056   fFileCmd = new G4UIcmdWithAString("/testhadr/histo/fileType",this);
00057   fFileCmd->SetGuidance("set type (hbook, XML) for the histograms file");
00058 
00059   fHistoCmd = new G4UIcommand("/testhadr/histo/setHisto",this);
00060   fHistoCmd->SetGuidance("Set bining of the histo number ih :");
00061   fHistoCmd->SetGuidance("  nbBins; valMin; valMax; unit (of vmin and vmax)");
00062   //
00063   G4UIparameter* ih = new G4UIparameter("ih",'i',false);
00064   ih->SetGuidance("histo number : from 0 to MaxHisto-1");
00065   fHistoCmd->SetParameter(ih);
00066   //
00067   G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
00068   nbBins->SetGuidance("number of bins");
00069   nbBins->SetParameterRange("nbBins>0");
00070   fHistoCmd->SetParameter(nbBins);
00071   //
00072   G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
00073   valMin->SetGuidance("valMin, expressed in unit");
00074   fHistoCmd->SetParameter(valMin);
00075   //
00076   G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
00077   valMax->SetGuidance("valMax, expressed in unit");
00078   fHistoCmd->SetParameter(valMax);
00079   //
00080   G4UIparameter* unit = new G4UIparameter("unit",'s',true);
00081   unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
00082   unit->SetDefaultValue("none");
00083   fHistoCmd->SetParameter(unit);
00084 
00085 }

HistoMessenger::~HistoMessenger (  )  [virtual]

Definition at line 89 of file HistoMessenger.cc.

References fFactoryCmd, fFileCmd, fHistoCmd, and fHistoDir.

00090 {
00091   delete fFileCmd;
00092   delete fHistoCmd;
00093   delete fFactoryCmd;
00094   delete fHistoDir;
00095 }


Member Function Documentation

void HistoMessenger::SetNewValue ( G4UIcommand *  command,
G4String  newValues 
) [virtual]

Definition at line 99 of file HistoMessenger.cc.

References fFactoryCmd, fFileCmd, fHisto, fHistoCmd, Histo::SetFileName(), Histo::SetFileType(), and Histo::SetHisto1D().

00100 {
00101   if (command == fFactoryCmd) { fHisto->SetFileName(newValues); }
00102 
00103   if (command == fFileCmd)    { fHisto->SetFileType(newValues); }
00104     
00105   if (command == fHistoCmd) {
00106     G4int ih,nbBins; 
00107     G4double vmin,vmax;
00108     std::istringstream is(newValues);
00109     G4String unts;
00110     is >> ih >> nbBins >> vmin >> vmax >> unts;
00111     G4String unit = unts;
00112     G4double vUnit = 1. ;
00113     if(unit != "none") { vUnit = G4UIcommand::ValueOf(unit); }
00114     if(vUnit <= 0.0)   { vUnit = 1.; }
00115     fHisto->SetHisto1D(ih,nbBins,vmin,vmax,vUnit);
00116   }
00117 }

Here is the call graph for this function:


Field Documentation

G4UIcmdWithAString* HistoMessenger::fFactoryCmd [private]

Definition at line 65 of file HistoMessenger.hh.

Referenced by HistoMessenger(), SetNewValue(), and ~HistoMessenger().

G4UIcmdWithAString* HistoMessenger::fFileCmd [private]

Definition at line 66 of file HistoMessenger.hh.

Referenced by HistoMessenger(), SetNewValue(), and ~HistoMessenger().

Definition at line 62 of file HistoMessenger.hh.

Referenced by SetNewValue().

G4UIcommand* HistoMessenger::fHistoCmd [private]

Definition at line 67 of file HistoMessenger.hh.

Referenced by HistoMessenger(), SetNewValue(), and ~HistoMessenger().

G4UIdirectory* HistoMessenger::fHistoDir [private]

Definition at line 64 of file HistoMessenger.hh.

Referenced by HistoMessenger(), and ~HistoMessenger().


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

Generated on 19 Feb 2017 for QwGeant4 by  doxygen 1.6.1