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

#include <HadrontherapyAnalysisFileMessenger.hh>

Inheritance diagram for HadrontherapyAnalysisFileMessenger:
Collaboration diagram for HadrontherapyAnalysisFileMessenger:

Public Member Functions

 HadrontherapyAnalysisFileMessenger (HadrontherapyAnalysisManager *)
 
 ~HadrontherapyAnalysisFileMessenger ()
 
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
 

Public Attributes

HadrontherapyAnalysisManagerAnalysisManager
 handle to AnalysisManager More...
 

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
HadrontherapyAnalysisManager

Definition at line 49 of file HadrontherapyAnalysisFileMessenger.hh.

Constructor & Destructor Documentation

HadrontherapyAnalysisFileMessenger::HadrontherapyAnalysisFileMessenger ( HadrontherapyAnalysisManager amgr)

Definition at line 40 of file HadrontherapyAnalysisFileMessenger.cc.

41 :AnalysisManager(amgr)
42 {
43  secondaryCmd = new G4UIcmdWithABool("/analysis/secondary",this);
44  secondaryCmd -> SetParameterName("secondary", true);
45  secondaryCmd -> SetDefaultValue("true");
46  secondaryCmd -> SetGuidance("Set if dose/fluence for the secondary particles will be written"
47  "\n[usage]: /analysis/secondary [true/false]");
48  secondaryCmd -> AvailableForStates(G4State_Idle, G4State_PreInit);
49 
50  DoseMatrixCmd = new G4UIcmdWithAString("/analysis/writeDoseFile",this);
51  DoseMatrixCmd->SetGuidance("Write the dose/fluence to an ASCII file");
52  DoseMatrixCmd->SetDefaultValue("Dose.out");
53  DoseMatrixCmd->SetParameterName("choice",true);
54 
55  // With this messenger you can:
56  // give a name to the generated .root file
57  // One can use this messenger to define a different .root file name other then the default one
58 #ifdef G4ANALYSIS_USE_ROOT
59  FileNameCmd = new G4UIcmdWithAString("/analysis/setAnalysisFile",this);
60  FileNameCmd->SetGuidance("Set the .root filename for the root-output");
61  FileNameCmd->SetDefaultValue("default.root");
62  FileNameCmd->SetParameterName("choice",true);
63  FileNameCmd->AvailableForStates(G4State_Idle,G4State_PreInit);
64 #endif
65 
66 
67 LetCmd = new G4UIcmdWithABool("/analysis/computeLet",this);
68  LetCmd -> SetParameterName("choice",true);
69  LetCmd -> SetDefaultValue(true);
70  LetCmd -> SetGuidance("Set if Let must be computed and write the ASCII filename for the Let");
71  LetCmd -> AvailableForStates(G4State_Idle, G4State_PreInit);
72 
73 
74 
75 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
HadrontherapyAnalysisManager * AnalysisManager
handle to AnalysisManager
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetDefaultValue(const char *defVal)

Here is the call graph for this function:

HadrontherapyAnalysisFileMessenger::~HadrontherapyAnalysisFileMessenger ( )

Definition at line 78 of file HadrontherapyAnalysisFileMessenger.cc.

79 {
80  delete secondaryCmd;
81  delete DoseMatrixCmd;
82  delete LetCmd;
83 
84 #ifdef G4ANALYSIS_USE_ROOT
85  delete FileNameCmd;
86 #endif
87 }

Member Function Documentation

void HadrontherapyAnalysisFileMessenger::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 90 of file HadrontherapyAnalysisFileMessenger.cc.

91 {
92  if (command == secondaryCmd)
93  {
95  {
96  HadrontherapyMatrix::GetInstance() -> secondary = secondaryCmd -> GetNewBoolValue(newValue);
97  }
98  }
99 
100  else if (command == DoseMatrixCmd) // Filename can be passed here TODO
101  {
103  {
104  pMatrix -> TotalEnergyDeposit();
105  pMatrix -> StoreDoseFluenceAscii(newValue);
106 #ifdef G4ANALYSIS_USE_ROOT
107  pMatrix -> StoreDoseFluenceRoot();
108  HadrontherapyAnalysisManager::GetInstance() -> flush(); // Finalize & write the root file
109 #endif
110  }
111  }
112 
113  else if (command == LetCmd)
114  {
116  HadrontherapyLet::GetInstance() -> doCalculation = LetCmd -> GetNewBoolValue(newValue);
117  }
118 
119 #ifdef G4ANALYSIS_USE_ROOT
120  else if (command == FileNameCmd)
121  {
122  AnalysisManager->SetAnalysisFileName(newValue);
123  HadrontherapyAnalysisManager::GetInstance() -> book(); // Book for a new ROOT TFile
124  }
125 #endif
126 }
static HadrontherapyAnalysisManager * GetInstance()
static HadrontherapyLet * GetInstance()
static HadrontherapyMatrix * GetInstance()

Here is the call graph for this function:

Member Data Documentation

HadrontherapyAnalysisManager* HadrontherapyAnalysisFileMessenger::AnalysisManager

handle to AnalysisManager

Definition at line 62 of file HadrontherapyAnalysisFileMessenger.hh.


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