]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TGeant4/TG4RunMessenger.cxx
Changed to new clusterfinder
[u/mrichter/AliRoot.git] / TGeant4 / TG4RunMessenger.cxx
CommitLineData
2817d3e2 1// $Id$
2// Category: run
3//
4// See the class description in the header file.
5
6#include "TG4RunMessenger.h"
7#include "TG4RunManager.h"
8#include "TG4Globals.h"
9#include "TG4UICmdWithAComplexString.h"
10
11#include <G4UIdirectory.hh>
12#include <G4UIcmdWithoutParameter.hh>
13#include <G4UIcmdWithAString.hh>
14
72095f7c 15//_____________________________________________________________________________
2817d3e2 16TG4RunMessenger::TG4RunMessenger(TG4RunManager* runManager)
17 : fRunManager(runManager)
18{
19//
20 fDirectory = new G4UIdirectory("/g4mc/");
21 fDirectory->SetGuidance("TGeant4 control commands.");
22
23 fRootCmd = new G4UIcmdWithoutParameter("/g4mc/root", this);
24 fRootCmd->SetGuidance("Switch to Root interactive shell.");
25 fRootCmd->AvailableForStates(PreInit, Init, Idle, GeomClosed, EventProc);
26
27 fRootMacroCmd = new G4UIcmdWithAString("/g4mc/rootMacro", this);
28 fRootMacroCmd->SetGuidance("Process Root macro with given name (from file name.C)");
29 fRootMacroCmd->SetParameterName("macroName", true);
30 fRootMacroCmd->AvailableForStates(PreInit, Init, Idle, GeomClosed, EventProc);
31
32 fRootCommandCmd = new TG4UICmdWithAComplexString("/g4mc/rootCmd", this);
33 fRootCommandCmd->SetGuidance("Process Root command");
34 fRootCommandCmd->SetParameterName("command", false);
35 fRootCommandCmd->SetDefaultValue(" ");
36 fRootCommandCmd->AvailableForStates(PreInit, Init, Idle, GeomClosed, EventProc);
37
38 fG3DefaultsCmd = new G4UIcmdWithoutParameter("/g4mc/g3Defaults", this);
39 fG3DefaultsCmd->SetGuidance("Set G3 default parameters (cut values,");
40 fG3DefaultsCmd->SetGuidance("tracking media max step values, ...)");
41 fG3DefaultsCmd->AvailableForStates(PreInit);
42}
43
72095f7c 44//_____________________________________________________________________________
2817d3e2 45TG4RunMessenger::TG4RunMessenger(){
46//
47}
48
72095f7c 49//_____________________________________________________________________________
2817d3e2 50TG4RunMessenger::TG4RunMessenger(const TG4RunMessenger& right) {
51//
52 TG4Globals::Exception("TG4RunMessenger is protected from copying.");
53}
54
72095f7c 55//_____________________________________________________________________________
2817d3e2 56TG4RunMessenger::~TG4RunMessenger() {
57//
58 delete fDirectory;
59 delete fRootCmd;
60 delete fRootMacroCmd;
61 delete fRootCommandCmd;
62 delete fG3DefaultsCmd;
63}
64
65// operators
66
72095f7c 67//_____________________________________________________________________________
2817d3e2 68TG4RunMessenger& TG4RunMessenger::operator=(const TG4RunMessenger& right)
69{
70 // check assignement to self
71 if (this == &right) return *this;
72
73 TG4Globals::Exception("TG4RunMessenger is protected from assigning.");
74
75 return *this;
76}
77
78// public methods
79
72095f7c 80//_____________________________________________________________________________
2817d3e2 81void TG4RunMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
82{
83// Applies command to the associated object.
84// ---
85
86 if (command == fRootCmd) {
87 fRunManager->StartRootUI();
88 }
89 else if (command == fRootMacroCmd) {
90 fRunManager->ProcessRootMacro(newValue);
91 }
92 else if (command == fRootCommandCmd) {
93 fRunManager->ProcessRootCommand(newValue);
94 }
95 else if (command == fG3DefaultsCmd) {
96 fRunManager->UseG3Defaults();
97 }
98}