Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HistoMessenger Class Reference

#include <HistoMessenger.hh>

Inheritance diagram for HistoMessenger:
Collaboration diagram for HistoMessenger:

Public Member Functions

 HistoMessenger (HistoManager *)
 
 ~HistoMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
 HistoMessenger (Histo *)
 
virtual ~HistoMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
 HistoMessenger (Histo *)
 
 ~HistoMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
 HistoMessenger (Histo *)
 
virtual ~HistoMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
 HistoMessenger (Histo *)
 
virtual ~HistoMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 51 of file HistoMessenger.hh.

Constructor & Destructor Documentation

HistoMessenger::HistoMessenger ( HistoManager manager)

Definition at line 48 of file HistoMessenger.cc.

49 :G4UImessenger(),fHistoManager (manager),
50  fHistoDir(0),
51  fFileNameCmd(0),
52  fHistoCmd(0),
53  fPrtHistoCmd(0)
54 {
55  fHistoDir = new G4UIdirectory("/testem/histo/");
56  fHistoDir->SetGuidance("histograms control");
57 
58  fFileNameCmd = new G4UIcmdWithAString("/testem/histo/setFileName",this);
59  fFileNameCmd->SetGuidance("set name for the histograms file");
60 
61  fHistoCmd = new G4UIcommand("/testem/histo/setHisto",this);
62  fHistoCmd->SetGuidance("Set bining of the histo number ih :");
63  fHistoCmd->SetGuidance(" nbBins; valMin; valMax; unit (of vmin and vmax)");
64  //
65  G4UIparameter* ih = new G4UIparameter("ih",'i',false);
66  ih->SetGuidance("histo number : from 1 to kMaxHisto");
67  ih->SetParameterRange("ih>0");
68  fHistoCmd->SetParameter(ih);
69  //
70  G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
71  nbBins->SetGuidance("number of bins");
72  nbBins->SetParameterRange("nbBins>0");
73  fHistoCmd->SetParameter(nbBins);
74  //
75  G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
76  valMin->SetGuidance("valMin, expressed in unit");
77  fHistoCmd->SetParameter(valMin);
78  //
79  G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
80  valMax->SetGuidance("valMax, expressed in unit");
81  fHistoCmd->SetParameter(valMax);
82  //
83  G4UIparameter* unit = new G4UIparameter("unit",'s',true);
84  unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
85  unit->SetDefaultValue("none");
86  fHistoCmd->SetParameter(unit);
87 
88  fPrtHistoCmd = new G4UIcmdWithAnInteger("/testem/histo/printHisto",this);
89  fPrtHistoCmd->SetGuidance("print histo #id on ascii file");
90  fPrtHistoCmd->SetParameterName("id",false);
91  fPrtHistoCmd->SetRange("id>0");
92 }
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterRange(const char *theRange)
void SetDefaultValue(const char *theDefaultValue)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetGuidance(const char *theGuidance)

Here is the call graph for this function:

HistoMessenger::~HistoMessenger ( )

Definition at line 96 of file HistoMessenger.cc.

97 {
98  delete fPrtHistoCmd;
99  delete fHistoCmd;
100  delete fFileNameCmd;
101  delete fHistoDir;
102 }
HistoMessenger::HistoMessenger ( Histo hist)

Definition at line 46 of file HistoMessenger.cc.

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

Here is the call graph for this function:

virtual HistoMessenger::~HistoMessenger ( )
virtual
HistoMessenger::HistoMessenger ( Histo )
HistoMessenger::~HistoMessenger ( )
HistoMessenger::HistoMessenger ( Histo )
virtual HistoMessenger::~HistoMessenger ( )
virtual
HistoMessenger::HistoMessenger ( Histo )
virtual HistoMessenger::~HistoMessenger ( )
virtual

Member Function Documentation

virtual void HistoMessenger::SetNewValue ( G4UIcommand ,
G4String   
)
virtual

Reimplemented from G4UImessenger.

virtual void HistoMessenger::SetNewValue ( G4UIcommand ,
G4String   
)
virtual

Reimplemented from G4UImessenger.

virtual void HistoMessenger::SetNewValue ( G4UIcommand ,
G4String   
)
virtual

Reimplemented from G4UImessenger.

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

Reimplemented from G4UImessenger.

Definition at line 106 of file HistoMessenger.cc.

107 {
108  if (command == fFileNameCmd)
109  fHistoManager->SetFileName(newValues);
110 
111  if (command == fHistoCmd)
112  { G4int ih,nbBins; G4double vmin,vmax; G4String unit;
113  const char* t = newValues;
114  std::istringstream is(t);
115  is >> ih >> nbBins >> vmin >> vmax >> unit;
116  fHistoManager->SetHisto (ih,nbBins,vmin,vmax,unit);
117  }
118 
119  if (command == fPrtHistoCmd)
120  fHistoManager->PrintHisto(fPrtHistoCmd->GetNewIntValue(newValues));
121 }
static G4int GetNewIntValue(const char *paramString)
int G4int
Definition: G4Types.hh:78
void SetHisto(G4int, G4int, G4double, G4double, const G4String &unit="none")
void SetFileName(const G4String &name)
Definition: HistoManager.hh:63
double G4double
Definition: G4Types.hh:76
void PrintHisto(G4int)

Here is the call graph for this function:

virtual void HistoMessenger::SetNewValue ( G4UIcommand ,
G4String   
)
virtual

Reimplemented from G4UImessenger.


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