]>
Commit | Line | Data |
---|---|---|
676fb573 | 1 | // $Id$ |
2 | // Category: event | |
3 | // | |
4 | // See the class description in the header file. | |
5 | ||
6 | #include "AliEventActionMessenger.h" | |
7 | #include "AliEventAction.h" | |
8 | #include "AliGlobals.h" | |
9 | ||
10 | #include <G4UIdirectory.hh> | |
11 | #include <G4UIcmdWithAString.hh> | |
12 | #include <G4UIcmdWithAnInteger.hh> | |
13 | ||
14 | AliEventActionMessenger::AliEventActionMessenger(AliEventAction* eventAction) | |
15 | :fEventAction(eventAction) | |
16 | { | |
17 | // | |
18 | fEventDirectory = new G4UIdirectory("/aliEvent/"); | |
19 | fEventDirectory->SetGuidance("AliEventAction control commands."); | |
20 | ||
21 | fDrawTracksCmd = new G4UIcmdWithAString("/aliEvent/drawTracks", this); | |
22 | fDrawTracksCmd->SetGuidance("Draw the tracks in the event"); | |
23 | fDrawTracksCmd->SetGuidance(" Choice : NONE, CHARGED(default), ALL"); | |
24 | fDrawTracksCmd->SetParameterName("Choice", true); | |
25 | fDrawTracksCmd->SetDefaultValue("CHARGED"); | |
26 | fDrawTracksCmd->SetCandidates("NONE CHARGED ALL"); | |
27 | fDrawTracksCmd->AvailableForStates(Idle); | |
28 | ||
29 | fVerboseCmd = new G4UIcmdWithAnInteger("/aliEvent/verbose", this); | |
30 | fVerboseCmd->SetGuidance("Set verbose level for AliEventAction"); | |
31 | fVerboseCmd->SetParameterName("VerboseLevel", true); | |
32 | fVerboseCmd->SetDefaultValue(0); | |
33 | fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 2"); | |
34 | fVerboseCmd->AvailableForStates(Idle); | |
35 | } | |
36 | ||
37 | AliEventActionMessenger::AliEventActionMessenger(){ | |
38 | // | |
39 | } | |
40 | ||
41 | AliEventActionMessenger::AliEventActionMessenger( | |
42 | const AliEventActionMessenger& right) { | |
43 | // | |
44 | AliGlobals::Exception("AliEventActionMessenger is protected from copying."); | |
45 | } | |
46 | ||
47 | AliEventActionMessenger::~AliEventActionMessenger() { | |
48 | // | |
49 | delete fEventDirectory; | |
50 | delete fDrawTracksCmd; | |
51 | delete fVerboseCmd; | |
52 | } | |
53 | ||
54 | // operators | |
55 | ||
56 | AliEventActionMessenger& | |
57 | AliEventActionMessenger::operator=(const AliEventActionMessenger &right) | |
58 | { | |
59 | // check assignement to self | |
60 | if (this == &right) return *this; | |
61 | ||
62 | AliGlobals::Exception("AliEventActionMessenger is protected from assigning."); | |
63 | ||
64 | return *this; | |
65 | } | |
66 | ||
67 | // public methods | |
68 | ||
69 | void AliEventActionMessenger::SetNewValue(G4UIcommand* command, | |
70 | G4String newValue) | |
71 | { | |
72 | // Applies command to the associated object. | |
73 | // --- | |
74 | ||
75 | if(command == fDrawTracksCmd) | |
76 | { | |
77 | fEventAction->SetDrawFlag(newValue); | |
78 | } | |
79 | else if(command == fVerboseCmd) | |
80 | { | |
81 | fEventAction | |
82 | ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue)); | |
83 | } | |
84 | } |