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

#include <IORTAnalysisFileMessenger.hh>

Inheritance diagram for IORTAnalysisFileMessenger:
G4UImessenger

Public Member Functions

 IORTAnalysisFileMessenger ()
 
 ~IORTAnalysisFileMessenger ()
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- 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

A messenger object of this class is created by the AnalysisManager. The point of a messenger is to connect the G4UI with the simulation functionality. The messenger needs to contain a command object and to have SetValue method that is called once a command is set.

See also
IORTAnalysisManager

Definition at line 61 of file IORTAnalysisFileMessenger.hh.

Constructor & Destructor Documentation

IORTAnalysisFileMessenger::IORTAnalysisFileMessenger ( )

Definition at line 54 of file IORTAnalysisFileMessenger.cc.

References G4State_Idle, and G4State_PreInit.

56 {
57  secondaryCmd = new G4UIcmdWithABool("/analysis/secondary",this);
58  secondaryCmd -> SetParameterName("secondary", true);
59  secondaryCmd -> SetDefaultValue("true");
60  secondaryCmd -> SetGuidance("Set if dose/fluence for the secondary particles will be written"
61  "\n[usage]: /analysis/secondary [true/false]");
62  secondaryCmd -> AvailableForStates(G4State_Idle, G4State_PreInit);
63 
64  DoseMatrixCmd = new G4UIcmdWithAString("/analysis/writeDoseFile",this);
65  DoseMatrixCmd->SetGuidance("Write the dose/fluence to an ASCII file");
66  DoseMatrixCmd->SetDefaultValue("Dose.out");
67  DoseMatrixCmd->SetParameterName("choice",true);
68 
69  // With this messenger you can:
70  // give a name to the generated .root file
71  // One can use this messenger to define a different .root file name other then the default one
72 #ifdef G4ANALYSIS_USE_ROOT
73  FileNameCmd = new G4UIcmdWithAString("/analysis/setAnalysisFile",this);
74  FileNameCmd->SetGuidance("Set the .root filename for the root-output");
75  FileNameCmd->SetDefaultValue("default.root");
76  FileNameCmd->SetParameterName("choice",true); ///<doc did not say what second boolean really does
77  FileNameCmd->AvailableForStates(G4State_Idle,G4State_PreInit);
78 #endif
79 
80 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetDefaultValue(const char *defVal)
IORTAnalysisFileMessenger::~IORTAnalysisFileMessenger ( )

Definition at line 83 of file IORTAnalysisFileMessenger.cc.

84 {
85  delete secondaryCmd;
86  delete DoseMatrixCmd;
87 #ifdef G4ANALYSIS_USE_ROOT
88  delete FileNameCmd;
89 #endif
90 }

Member Function Documentation

void IORTAnalysisFileMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Called when new command given.

Parameters
commandis a pointer to the given command object
newValueholds the argument given as a G4String
Returns
is void

Reimplemented from G4UImessenger.

Definition at line 93 of file IORTAnalysisFileMessenger.cc.

References IORTAnalysisManager::GetInstance(), and IORTMatrix::GetInstance().

94 {
95  if (command == secondaryCmd)
96  {
98  {
99  IORTMatrix::GetInstance() -> secondary = secondaryCmd -> GetNewBoolValue(newValue);
100  }
101  }
102 
103  else if (command == DoseMatrixCmd) // Filename can be passed here TODO
104  {
105  if ( IORTMatrix * pMatrix = IORTMatrix::GetInstance() )
106  {
107  pMatrix -> TotalEnergyDeposit();
108  pMatrix -> StoreDoseFluenceAscii(newValue);
109 #ifdef G4ANALYSIS_USE_ROOT
110  pMatrix -> StoreDoseFluenceRoot();
111  IORTAnalysisManager::GetInstance() -> flush(); // Finalize & write the root file
112 #endif
113  }
114  }
115 #ifdef G4ANALYSIS_USE_ROOT
116  else if (command == FileNameCmd)
117  {
118  AnalysisManager->SetAnalysisFileName(newValue);
119  IORTAnalysisManager::GetInstance() -> book(); // Book for a new ROOT TFile
120  }
121 #endif
122 }
static IORTAnalysisManager * GetInstance()
static IORTMatrix * GetInstance()
Definition: IORTMatrix.cc:61

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