QwGeant4
HistoMessenger Class Reference

#include <HistoMessenger.hh>

Inherits G4UImessenger.

+ Collaboration diagram for HistoMessenger:

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.

48  :fHisto(hist)
49 {
50  fHistoDir = new G4UIdirectory("/testhadr/histo/");
51  fHistoDir->SetGuidance("histograms control");
52 
53  fFactoryCmd = new G4UIcmdWithAString("/testhadr/histo/fileName",this);
54  fFactoryCmd->SetGuidance("set name for the histograms file");
55 
56  fFileCmd = new G4UIcmdWithAString("/testhadr/histo/fileType",this);
57  fFileCmd->SetGuidance("set type (hbook, XML) for the histograms file");
58 
59  fHistoCmd = new G4UIcommand("/testhadr/histo/setHisto",this);
60  fHistoCmd->SetGuidance("Set bining of the histo number ih :");
61  fHistoCmd->SetGuidance(" nbBins; valMin; valMax; unit (of vmin and vmax)");
62  //
63  G4UIparameter* ih = new G4UIparameter("ih",'i',false);
64  ih->SetGuidance("histo number : from 0 to MaxHisto-1");
65  fHistoCmd->SetParameter(ih);
66  //
67  G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
68  nbBins->SetGuidance("number of bins");
69  nbBins->SetParameterRange("nbBins>0");
70  fHistoCmd->SetParameter(nbBins);
71  //
72  G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
73  valMin->SetGuidance("valMin, expressed in unit");
74  fHistoCmd->SetParameter(valMin);
75  //
76  G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
77  valMax->SetGuidance("valMax, expressed in unit");
78  fHistoCmd->SetParameter(valMax);
79  //
80  G4UIparameter* unit = new G4UIparameter("unit",'s',true);
81  unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
82  unit->SetDefaultValue("none");
83  fHistoCmd->SetParameter(unit);
84 
85 }
G4UIcommand * fHistoCmd
G4UIdirectory * fHistoDir
G4UIcmdWithAString * fFileCmd
G4UIcmdWithAString * fFactoryCmd
HistoMessenger::~HistoMessenger ( )
virtual

Definition at line 89 of file HistoMessenger.cc.

References fFactoryCmd, fFileCmd, fHistoCmd, and fHistoDir.

90 {
91  delete fFileCmd;
92  delete fHistoCmd;
93  delete fFactoryCmd;
94  delete fHistoDir;
95 }
G4UIcommand * fHistoCmd
G4UIdirectory * fHistoDir
G4UIcmdWithAString * fFileCmd
G4UIcmdWithAString * fFactoryCmd

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().

100 {
101  if (command == fFactoryCmd) { fHisto->SetFileName(newValues); }
102 
103  if (command == fFileCmd) { fHisto->SetFileType(newValues); }
104 
105  if (command == fHistoCmd) {
106  G4int ih,nbBins;
107  G4double vmin,vmax;
108  std::istringstream is(newValues);
109  G4String unts;
110  is >> ih >> nbBins >> vmin >> vmax >> unts;
111  G4String unit = unts;
112  G4double vUnit = 1. ;
113  if(unit != "none") { vUnit = G4UIcommand::ValueOf(unit); }
114  if(vUnit <= 0.0) { vUnit = 1.; }
115  fHisto->SetHisto1D(ih,nbBins,vmin,vmax,vUnit);
116  }
117 }
G4UIcommand * fHistoCmd
G4UIcmdWithAString * fFileCmd
void SetFileType(const G4String &)
Definition: Histo.cc:344
G4UIcmdWithAString * fFactoryCmd
void SetHisto1D(G4int, G4int, G4double, G4double, G4double)
Definition: Histo.cc:176
void SetFileName(const G4String &)
Definition: Histo.cc:336

+ 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().

Histo* HistoMessenger::fHisto
private

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: