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