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

#include <IORTAnalysisFileMessenger.hh>

Inheritance diagram for IORTAnalysisFileMessenger:
Collaboration diagram for IORTAnalysisFileMessenger:

Public Member Functions

 IORTAnalysisFileMessenger (IORTAnalysisManager *amgr)
 
 ~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
 
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

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 ( IORTAnalysisManager amgr)

<doc did not say what second boolean really does

Definition at line 51 of file IORTAnalysisFileMessenger.cc.

51  :
52  AnalysisManager(amgr)
53 {
54  secondaryCmd = new G4UIcmdWithABool("/analysis/secondary",this);
55  secondaryCmd -> SetParameterName("secondary", true);
56  secondaryCmd -> SetDefaultValue("true");
57  secondaryCmd -> SetGuidance("Set if dose/fluence for the secondary particles will be written"
58  "\n[usage]: /analysis/secondary [true/false]");
59  secondaryCmd -> AvailableForStates(G4State_Idle, G4State_PreInit);
60 
61  DoseMatrixCmd = new G4UIcmdWithAString("/analysis/writeDoseFile",this);
62  DoseMatrixCmd->SetGuidance("Write the dose/fluence to an ASCII file");
63  DoseMatrixCmd->SetDefaultValue("Dose.out");
64  DoseMatrixCmd->SetParameterName("choice",true);
65 
66  // With this messenger you can:
67  // give a name to the generated .root file
68  // One can use this messenger to define a different .root file name other then the default one
69  FileNameCmd = new G4UIcmdWithAString("/analysis/setAnalysisFile",this);
70  FileNameCmd->SetGuidance("Set the .root filename for the root-output");
71  FileNameCmd->SetDefaultValue("default.root");
72  FileNameCmd->SetParameterName("choice",true);
74 
75 
76 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:240
void SetDefaultValue(const char *defVal)

Here is the call graph for this function:

IORTAnalysisFileMessenger::~IORTAnalysisFileMessenger ( )

Definition at line 79 of file IORTAnalysisFileMessenger.cc.

80 {
81  delete secondaryCmd;
82  delete DoseMatrixCmd;
83  delete FileNameCmd;
84 }

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 87 of file IORTAnalysisFileMessenger.cc.

88 {
89  if (command == secondaryCmd)
90  {
92  {
93  IORTMatrix::GetInstance() -> secondary = secondaryCmd -> GetNewBoolValue(newValue);
94  }
95  }
96 
97  else if (command == DoseMatrixCmd) // Filename can be passed here TODO
98  {
99  if ( IORTMatrix * pMatrix = IORTMatrix::GetInstance() )
100  {
101  pMatrix -> TotalEnergyDeposit();
102  pMatrix -> StoreDoseFluenceAscii(newValue);
103  pMatrix -> StoreDoseFluenceRoot();
104  // Finalize & write output file
105  IORTAnalysisManager::GetInstance() -> flush();
106  }
107  }
108  else if (command == FileNameCmd)
109  {
110  AnalysisManager->SetAnalysisFileName(newValue);
111  IORTAnalysisManager::GetInstance() -> book(); // Book for a new output file
112  }
113 }
static IORTAnalysisManager * GetInstance()
static IORTMatrix * GetInstance()
Definition: IORTMatrix.cc:61

Here is the call graph for this function:


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