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