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