Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
HistoMessenger Class Reference

#include <HistoMessenger.hh>

Inheritance diagram for HistoMessenger:
G4UImessenger G4UImessenger G4UImessenger G4UImessenger G4UImessenger G4UImessenger G4UImessenger G4UImessenger

Public Member Functions

 HistoMessenger (HistoManager *)
 
 ~HistoMessenger ()
 
void SetNewValue (G4UIcommand *, G4String)
 
 HistoMessenger (HistoManager *)
 
 ~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 *)
 
 ~HistoMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
 HistoMessenger (Histo *)
 
virtual ~HistoMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
 HistoMessenger (Histo *)
 
virtual ~HistoMessenger ()
 
virtual void SetNewValue (G4UIcommand *, G4String)
 
 HistoMessenger (HistoManager *)
 
 ~HistoMessenger ()
 
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
 

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
 

Detailed Description

Definition at line 47 of file advanced/amsEcal/include/HistoMessenger.hh.

Constructor & Destructor Documentation

HistoMessenger::HistoMessenger ( HistoManager manager)

Definition at line 44 of file advanced/amsEcal/src/HistoMessenger.cc.

References G4UIcmdWithAString::SetCandidates(), G4UIparameter::SetDefaultValue(), G4UIparameter::SetGuidance(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIcmdWithAnInteger::SetParameterName(), G4UIparameter::SetParameterRange(), and G4UIcommand::SetRange().

45 :histoManager (manager)
46 {
47  histoDir = new G4UIdirectory("/ams/histo/");
48  histoDir->SetGuidance("histograms control");
49 
50  factoryCmd = new G4UIcmdWithAString("/ams/histo/setFileName",this);
51  factoryCmd->SetGuidance("set name for the histograms file");
52 
53  typeCmd = new G4UIcmdWithAString("/ams/histo/setFileType",this);
54  typeCmd->SetGuidance("set histograms file type: hbook, root, XML");
55  typeCmd->SetCandidates("hbook root XML");
56 
57  optionCmd = new G4UIcmdWithAString("/ams/histo/setFileOption",this);
58  optionCmd->SetGuidance("set option for the histograms file");
59 
60  histoCmd = new G4UIcommand("/ams/histo/setHisto",this);
61  histoCmd->SetGuidance("Set bining of the histo number ih :");
62  histoCmd->SetGuidance(" nbBins; valMin; valMax; unit (of vmin and vmax)");
63  //
64  G4UIparameter* ih = new G4UIparameter("ih",'i',false);
65  ih->SetGuidance("histo number : from 1 to MaxHisto-1");
66  ih->SetParameterRange("ih>0");
67  histoCmd->SetParameter(ih);
68  //
69  G4UIparameter* nbBins = new G4UIparameter("nbBins",'i',false);
70  nbBins->SetGuidance("number of bins");
71  nbBins->SetParameterRange("nbBins>0");
72  histoCmd->SetParameter(nbBins);
73  //
74  G4UIparameter* valMin = new G4UIparameter("valMin",'d',false);
75  valMin->SetGuidance("valMin, expressed in choosen unit");
76  histoCmd->SetParameter(valMin);
77  //
78  G4UIparameter* valMax = new G4UIparameter("valMax",'d',false);
79  valMax->SetGuidance("valMax, expressed in choosen unit");
80  histoCmd->SetParameter(valMax);
81  //
82  G4UIparameter* unit = new G4UIparameter("unit",'s',true);
83  unit->SetGuidance("if omitted, vmin and vmax are assumed dimensionless");
84  unit->SetDefaultValue("none");
85  histoCmd->SetParameter(unit);
86 
87  prhistoCmd = new G4UIcmdWithAnInteger("/ams/histo/printHisto",this);
88  prhistoCmd->SetGuidance("print histo #id on ascii file");
89  prhistoCmd->SetParameterName("id",false);
90  prhistoCmd->SetRange("id>0");
91 
92  rmhistoCmd = new G4UIcmdWithAnInteger("/ams/histo/removeHisto",this);
93  rmhistoCmd->SetGuidance("desactivate histo #id");
94  rmhistoCmd->SetParameterName("id",false);
95  rmhistoCmd->SetRange("id>0");
96 
97  ntuplCmd = new G4UIcmdWithAnInteger("/ams/histo/setNtuple",this);
98  ntuplCmd->SetGuidance("set nTuple #id");
99  ntuplCmd->SetParameterName("id",false);
100  ntuplCmd->SetRange("id>0");
101 }
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 SetCandidates(const char *candidateList)
void SetGuidance(const char *theGuidance)
HistoMessenger::~HistoMessenger ( )

Definition at line 105 of file advanced/amsEcal/src/HistoMessenger.cc.

106 {
107  delete rmhistoCmd;
108  delete prhistoCmd;
109  delete histoCmd;
110  delete ntuplCmd;
111  delete optionCmd;
112  delete typeCmd;
113  delete factoryCmd;
114  delete histoDir;
115 }
HistoMessenger::HistoMessenger ( HistoManager )
HistoMessenger::~HistoMessenger ( )
HistoMessenger::HistoMessenger ( Histo hist)

Definition at line 47 of file extended/electromagnetic/TestEm8/src/HistoMessenger.cc.

References G4UIparameter::SetDefaultValue(), G4UIparameter::SetGuidance(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), and G4UIparameter::SetParameterRange().

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

Member Function Documentation

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

Reimplemented from G4UImessenger.

Definition at line 119 of file advanced/amsEcal/src/HistoMessenger.cc.

References G4UIcmdWithAnInteger::GetNewIntValue(), HistoManager::PrintHisto(), HistoManager::RemoveHisto(), HistoManager::SetFileName(), HistoManager::SetFileOption(), HistoManager::SetFileType(), HistoManager::SetHisto(), HistoManager::SetNtuple(), and G4UIcommand::ValueOf().

120 {
121  if (command == factoryCmd)
122  histoManager->SetFileName(newValues);
123 
124  if (command == typeCmd)
125  histoManager->SetFileType(newValues);
126 
127  if (command == optionCmd)
128  histoManager->SetFileOption(newValues);
129 
130  if (command == histoCmd)
131  { G4int ih,nbBins; G4double vmin,vmax;
132  std::istringstream is(newValues);
133  G4String unts;
134  is >> ih >> nbBins >> vmin >> vmax >> unts;
135  G4String unit = unts;
136  G4double vUnit = 1. ;
137  if (unit != "none") vUnit = G4UIcommand::ValueOf(unit);
138  histoManager->SetHisto (ih,nbBins,vmin*vUnit,vmax*vUnit,unit);
139  }
140 
141  if (command == prhistoCmd)
142  histoManager->PrintHisto(prhistoCmd->GetNewIntValue(newValues));
143 
144  if (command == rmhistoCmd)
145  { histoManager->RemoveHisto(rmhistoCmd->GetNewIntValue(newValues));}
146 
147  if (command == ntuplCmd)
148  { histoManager->SetNtuple(ntuplCmd->GetNewIntValue(newValues));}
149 }
static G4int GetNewIntValue(const char *paramString)
void SetFileType(const G4String &name)
int G4int
Definition: G4Types.hh:78
void SetHisto(G4int, G4int, G4double, G4double, const G4String &unit="none")
static G4double ValueOf(const char *unitName)
Definition: G4UIcommand.cc:294
void SetFileOption(const G4String &name)
void SetFileName(const G4String &name)
double G4double
Definition: G4Types.hh:76
virtual void HistoMessenger::SetNewValue ( G4UIcommand ,
G4String   
)
virtual

Reimplemented from G4UImessenger.

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.

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.


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