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

#include <HadrontherapyAnalysisFileMessenger.hh>

Inheritance diagram for HadrontherapyAnalysisFileMessenger:
G4UImessenger

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
 

Data Fields

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
 

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 55 of file HadrontherapyAnalysisFileMessenger.hh.

Constructor & Destructor Documentation

HadrontherapyAnalysisFileMessenger::HadrontherapyAnalysisFileMessenger ( HadrontherapyAnalysisManager amgr)

Definition at line 47 of file HadrontherapyAnalysisFileMessenger.cc.

References G4State_Idle, G4State_PreInit, G4UIcmdWithAString::SetDefaultValue(), G4UIcommand::SetGuidance(), and G4UIcmdWithAString::SetParameterName().

48 :AnalysisManager(amgr)
49 {
50  secondaryCmd = new G4UIcmdWithABool("/analysis/secondary",this);
51  secondaryCmd -> SetParameterName("secondary", true);
52  secondaryCmd -> SetDefaultValue("true");
53  secondaryCmd -> SetGuidance("Set if dose/fluence for the secondary particles will be written"
54  "\n[usage]: /analysis/secondary [true/false]");
55  secondaryCmd -> AvailableForStates(G4State_Idle, G4State_PreInit);
56 
57  DoseMatrixCmd = new G4UIcmdWithAString("/analysis/writeDoseFile",this);
58  DoseMatrixCmd->SetGuidance("Write the dose/fluence to an ASCII file");
59  DoseMatrixCmd->SetDefaultValue("Dose.out");
60  DoseMatrixCmd->SetParameterName("choice",true);
61 
62  // With this messenger you can:
63  // give a name to the generated .root file
64  // One can use this messenger to define a different .root file name other then the default one
65 #ifdef G4ANALYSIS_USE_ROOT
66  FileNameCmd = new G4UIcmdWithAString("/analysis/setAnalysisFile",this);
67  FileNameCmd->SetGuidance("Set the .root filename for the root-output");
68  FileNameCmd->SetDefaultValue("default.root");
69  FileNameCmd->SetParameterName("choice",true); ///<doc did not say what second boolean really does
70  FileNameCmd->AvailableForStates(G4State_Idle,G4State_PreInit);
71 #endif
72 
73 
74 LetCmd = new G4UIcmdWithABool("/analysis/computeLet",this);
75  LetCmd -> SetParameterName("choice",true);
76  LetCmd -> SetDefaultValue(true);
77  LetCmd -> SetGuidance("Set if Let must be computed and write the ASCII filename for the Let");
78  LetCmd -> AvailableForStates(G4State_Idle, G4State_PreInit);
79 
80 
81 
82 }
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)
HadrontherapyAnalysisFileMessenger::~HadrontherapyAnalysisFileMessenger ( )

Definition at line 85 of file HadrontherapyAnalysisFileMessenger.cc.

86 {
87  delete secondaryCmd;
88  delete DoseMatrixCmd;
89  delete LetCmd;
90 
91 #ifdef G4ANALYSIS_USE_ROOT
92  delete FileNameCmd;
93 #endif
94 }

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 97 of file HadrontherapyAnalysisFileMessenger.cc.

References HadrontherapyLet::GetInstance(), HadrontherapyAnalysisManager::GetInstance(), and HadrontherapyMatrix::GetInstance().

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

Field Documentation

HadrontherapyAnalysisManager* HadrontherapyAnalysisFileMessenger::AnalysisManager

handle to AnalysisManager

Definition at line 68 of file HadrontherapyAnalysisFileMessenger.hh.


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