]> git.uio.no Git - u/mrichter/AliRoot.git/blame - AliGeant4/AliStackingActionMessenger.cxx
Initial version
[u/mrichter/AliRoot.git] / AliGeant4 / AliStackingActionMessenger.cxx
CommitLineData
676fb573 1// $Id$
2// Category: event
3//
4// See the class description in the header file.
5
6#include "AliStackingActionMessenger.h"
7#include "AliStackingAction.h"
8#include "AliGlobals.h"
9
10#include <G4UIdirectory.hh>
11#include <G4UIcmdWithAnInteger.hh>
12#include <G4UIcmdWithoutParameter.hh>
13
14AliStackingActionMessenger::AliStackingActionMessenger(
15 AliStackingAction* stackingAction)
16 :fStackingAction(stackingAction)
17{
18//
19 fStackingDirectory = new G4UIdirectory("/aliStacking/");
20 fStackingDirectory->SetGuidance("AliStackingAction control commands.");
21
22 fClearStackCmd = new G4UIcmdWithoutParameter("/aliStacking/clearStack", this);
23 fClearStackCmd->SetGuidance("Clears the primary stack.");
24 fClearStackCmd->AvailableForStates(EventProc);
25
26 fVerboseCmd = new G4UIcmdWithAnInteger("/aliStacking/verbose", this);
27 fVerboseCmd->SetGuidance("Set verbose level for AliStackingAction");
28 fVerboseCmd->SetParameterName("VerboseLevel", true);
29 fVerboseCmd->SetDefaultValue(0);
30 fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 1");
31 fVerboseCmd->AvailableForStates(Idle);
32}
33
34AliStackingActionMessenger::AliStackingActionMessenger() {
35//
36}
37
38AliStackingActionMessenger::AliStackingActionMessenger(
39 const AliStackingActionMessenger& right) {
40//
41 AliGlobals::Exception("AliStackingActionMessenger is protected from copying.");
42}
43
44AliStackingActionMessenger::~AliStackingActionMessenger() {
45//
46 delete fStackingDirectory;
47 delete fClearStackCmd;
48 delete fVerboseCmd;
49}
50
51// operators
52
53AliStackingActionMessenger&
54AliStackingActionMessenger::operator=(const AliStackingActionMessenger &right)
55{
56 // check assignement to self
57 if (this == &right) return *this;
58
59 AliGlobals::Exception(
60 "AliStackingActionMessenger is protected from assigning.");
61
62 return *this;
63}
64
65// public methods
66
67void AliStackingActionMessenger::SetNewValue(G4UIcommand* command,
68 G4String newValue)
69{
70// Applies command to the associated object.
71// ---
72
73 if (command == fClearStackCmd) {
74 fStackingAction->ClearPrimaryStack();
75 }
76 else if (command == fVerboseCmd) {
77 fStackingAction
78 ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue));
79 }
80}