Smaller changes
[u/mrichter/AliRoot.git] / AliGeant4 / AliTrackingActionMessenger.cxx
1 // $Id$
2 // Category: event
3 //
4 // Author: I. Hrivnacova
5 //
6 // Class AliTrackingActionMessenger
7 // --------------------------------
8 // See the class description in the header file.
9  
10 #include "AliTrackingActionMessenger.h"
11 #include "AliTrackingAction.h"
12 #include "AliGlobals.h"
13
14 #include <G4UIdirectory.hh>
15 #include <G4UIcmdWithAnInteger.hh>
16
17 //_____________________________________________________________________________
18 AliTrackingActionMessenger::AliTrackingActionMessenger(
19                               AliTrackingAction* trackingAction)
20   :fTrackingAction(trackingAction)
21 {
22 // 
23   fTrackingDirectory = new G4UIdirectory("/aliTracking/");
24   fTrackingDirectory->SetGuidance("AliTrackingAction control commands.");
25
26   fNewVerboseCmd = new G4UIcmdWithAnInteger("/aliTracking/newVerbose", this);
27   fNewVerboseCmd->SetGuidance("Set new verbose level (/tracking/verbose)");
28   fNewVerboseCmd->SetGuidance("when a track with specified track ID ");
29   fNewVerboseCmd->SetGuidance("(/aliTracking/newVerboseTrack)\n starts tracking");
30   fNewVerboseCmd->SetParameterName("NewVerboseLevel", false);
31   fNewVerboseCmd->SetRange("NewVerboseLevel >= 0 && NewVerboseLevel <= 5");
32   fNewVerboseCmd->AvailableForStates(PreInit, Init, Idle);
33
34   fNewVerboseTrackCmd = new G4UIcmdWithAnInteger("/aliTracking/newVerboseTrack", this);
35   fNewVerboseTrackCmd->SetGuidance("Set the track ID for which the new verbose level");
36   fNewVerboseTrackCmd->SetGuidance("(/aliTracking/newVerbose) will be applied.");
37   fNewVerboseTrackCmd->SetParameterName("NewVerboseLevelTrackID", false);
38   fNewVerboseTrackCmd->SetRange("NewVerboseLevelTrackID >= 0");
39   fNewVerboseTrackCmd->AvailableForStates(PreInit, Init, Idle);
40 }
41
42 //_____________________________________________________________________________
43 AliTrackingActionMessenger::AliTrackingActionMessenger() {
44 //
45 }
46
47 //_____________________________________________________________________________
48 AliTrackingActionMessenger::AliTrackingActionMessenger(
49                                  const AliTrackingActionMessenger& right) {
50 //                               
51   AliGlobals::Exception(
52     "AliTrackingActionMessenger is protected from copying.");
53 }
54
55 //_____________________________________________________________________________
56 AliTrackingActionMessenger::~AliTrackingActionMessenger() {
57 //
58   delete fTrackingDirectory;
59   delete fNewVerboseCmd;
60   delete fNewVerboseTrackCmd;
61 }
62
63 // operators
64
65 //_____________________________________________________________________________
66 AliTrackingActionMessenger& 
67 AliTrackingActionMessenger::operator=(const AliTrackingActionMessenger &right)
68 {
69   // check assignement to self
70   if (this == &right) return *this;
71   
72   AliGlobals::Exception(
73     "AliTrackingActionMessenger is protected from assigning.");
74
75   return *this;
76 }
77
78 // public methods
79
80 //_____________________________________________________________________________
81 void AliTrackingActionMessenger::SetNewValue(G4UIcommand* command, 
82        G4String newValue)
83
84 // Applies command to the associated object.
85 // ---
86
87   if(command == fNewVerboseCmd) { 
88     fTrackingAction
89       ->SetNewVerboseLevel(fNewVerboseCmd->GetNewIntValue(newValue)); 
90   }   
91   else if(command == fNewVerboseTrackCmd) { 
92     fTrackingAction
93       ->SetNewVerboseTrackID(fNewVerboseTrackCmd->GetNewIntValue(newValue)); 
94   }   
95 }