28c3054061152126caa25cc66c69bf6c6c277fad
[u/mrichter/AliRoot.git] / AliGeant4 / AliSteppingActionMessenger.cxx
1 // $Id$
2 // Category: event
3 //
4 // Author: I. Hrivnacova
5 //
6 // Class AliSteppingActionMessenger
7 // --------------------------------
8 // See the class description in the header file.
9
10 #include "AliSteppingActionMessenger.h"
11 #include "AliSteppingAction.h"
12 #include "AliGlobals.h"
13
14 #include <G4UIcmdWithAnInteger.hh>
15
16 //_____________________________________________________________________________
17 AliSteppingActionMessenger::AliSteppingActionMessenger(
18                               AliSteppingAction* trackingAction)
19   :fSteppingAction(trackingAction)
20 {
21 // 
22   fLoopVerboseCmd = new G4UIcmdWithAnInteger("/aliTracking/loopVerbose", this);
23   fLoopVerboseCmd
24     ->SetGuidance("Set tracking verbose level for detected looping tracks.");
25   fLoopVerboseCmd->SetParameterName("LoopVerboseLevel", true);
26   fLoopVerboseCmd->SetDefaultValue(1);
27   fLoopVerboseCmd->SetRange("LoopVerboseLevel >= 0 && LoopVerboseLevel <= 5");
28   fLoopVerboseCmd->AvailableForStates(Idle);
29
30   fMaxNofStepsCmd = new G4UIcmdWithAnInteger("/aliTracking/maxNofSteps", this);
31   fMaxNofStepsCmd
32     ->SetGuidance("Set maximum number of steps allowed.");
33   fMaxNofStepsCmd->SetParameterName("MaxNofSteps", false);
34   fMaxNofStepsCmd->SetRange("MaxNofSteps >= 0");
35   fMaxNofStepsCmd->AvailableForStates(Idle);
36 }
37
38 //_____________________________________________________________________________
39 AliSteppingActionMessenger::AliSteppingActionMessenger() {
40 //
41 }
42
43 //_____________________________________________________________________________
44 AliSteppingActionMessenger::AliSteppingActionMessenger(
45                                  const AliSteppingActionMessenger& right) {
46 //                               
47   AliGlobals::Exception(
48     "AliSteppingActionMessenger is protected from copying.");
49 }
50
51 //_____________________________________________________________________________
52 AliSteppingActionMessenger::~AliSteppingActionMessenger() {
53 //
54   delete fLoopVerboseCmd;
55   delete fMaxNofStepsCmd;
56 }
57
58 // operators
59
60 //_____________________________________________________________________________
61 AliSteppingActionMessenger& 
62 AliSteppingActionMessenger::operator=(const AliSteppingActionMessenger &right)
63 {
64   // check assignement to self
65   if (this == &right) return *this;
66   
67   AliGlobals::Exception(
68     "AliSteppingActionMessenger is protected from assigning.");
69
70   return *this;
71 }
72
73 // public methods
74
75 //_____________________________________________________________________________
76 void AliSteppingActionMessenger::SetNewValue(G4UIcommand* command, 
77        G4String newValue)
78
79 // Applies command to the associated object.
80 // ---
81
82   if(command == fLoopVerboseCmd) { 
83     fSteppingAction
84       ->SetLoopVerboseLevel(fLoopVerboseCmd->GetNewIntValue(newValue)); 
85   }   
86   else if(command == fMaxNofStepsCmd) { 
87     fSteppingAction
88       ->SetMaxNofSteps(fMaxNofStepsCmd->GetNewIntValue(newValue)); 
89   }   
90 }