]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4Messenger.cxx
arguments in the constructor changed
[u/mrichter/AliRoot.git] / TGeant4 / TG4Messenger.cxx
1 // $Id$
2 // Category: run
3 //
4 // See the class description in the header file.
5
6 #include "TG4Messenger.h"
7 #include "TG4GeometryManager.h"
8 #include "TG4StepManager.h"
9 #include "TG4PhysicsManager.h"
10
11 #include <G4UIcmdWithoutParameter.hh>
12 #include <G4UIcmdWithABool.hh>
13
14 TG4Messenger::TG4Messenger(TG4GeometryManager* geometryManager, 
15                            TG4PhysicsManager* physicsManager, 
16                            TG4StepManager* stepManager)
17   : fGeometryManager(geometryManager),
18     fPhysicsManager(physicsManager),
19     fStepManager(stepManager)
20
21 //
22   fSetEMCmd
23      = new G4UIcmdWithABool("/g4mc/setEM", this);
24   fSetEMCmd->SetGuidance("Set electromagnetic processes.");
25   fSetEMCmd->SetParameterName("EMControl", false);
26   fSetEMCmd->AvailableForStates(PreInit);
27
28   fSetOpticalCmd
29      = new G4UIcmdWithABool("/g4mc/setOptical", this);
30   fSetOpticalCmd->SetGuidance("Set Cerenkov and optical processes.");
31   fSetOpticalCmd->SetParameterName("OpticalControl", false);
32   fSetOpticalCmd->AvailableForStates(PreInit);
33
34   fSetHadronCmd
35      = new G4UIcmdWithABool("/g4mc/setHadron", this);
36   fSetHadronCmd->SetGuidance("Set hadron processes.");
37   fSetHadronCmd->SetParameterName("HadronControl", false);
38   fSetHadronCmd->AvailableForStates(PreInit);
39
40   fSetSpecialCutsCmd
41      = new G4UIcmdWithABool("/g4mc/setSpecialCuts", this);
42   fSetSpecialCutsCmd->SetGuidance("Set special cuts process.");
43   fSetSpecialCutsCmd
44     ->SetGuidance("!! Support for this option is under development.");
45   fSetSpecialCutsCmd->SetParameterName("SpecialCutsControl", false);
46   fSetSpecialCutsCmd->AvailableForStates(PreInit);
47
48   fSetSpecialControlsCmd
49      = new G4UIcmdWithABool("/g4mc/setSpecialControls", this);
50   fSetSpecialControlsCmd->SetGuidance("Set special controls process.");
51   fSetSpecialControlsCmd
52     ->SetGuidance("!! Support for this option is under development.");
53   fSetSpecialControlsCmd->SetParameterName("SpecialFlagsControl", false);
54   fSetSpecialControlsCmd->AvailableForStates(PreInit);
55
56   fProcessActivationCmd
57      = new G4UIcmdWithoutParameter("/g4mc/setProcessActivation", this);
58   fProcessActivationCmd->SetGuidance("Activate/inactivate physics processes.");
59   fProcessActivationCmd->AvailableForStates(Idle);
60 }
61
62 TG4Messenger::TG4Messenger(){
63 //
64
65
66 TG4Messenger::TG4Messenger(const TG4Messenger& right) {
67 // 
68   TG4Globals::Exception("TG4Messenger is protected from copying.");
69 }
70
71 TG4Messenger::~TG4Messenger() {
72 //
73   delete fSetEMCmd;
74   delete fSetOpticalCmd;
75   delete fSetHadronCmd;
76   delete fSetSpecialCutsCmd;
77   delete fSetSpecialControlsCmd;
78   delete fProcessActivationCmd;
79 }
80
81 // operators
82
83 TG4Messenger& TG4Messenger::operator=(const TG4Messenger& right)
84 {
85   // check assignement to self
86   if (this == &right) return *this;
87
88   TG4Globals::Exception("TG4Messenger is protected from assigning.");
89     
90   return *this;  
91 }    
92           
93 // public methods
94
95 void TG4Messenger::SetNewValue(G4UIcommand* command, G4String newValue)
96
97 // Applies command to the associated object.
98 // ---
99
100   if (command == fSetEMCmd) {
101     fPhysicsManager
102       ->SetEMPhysics(fSetOpticalCmd->GetNewBoolValue(newValue)); 
103   }    
104   else if (command == fSetOpticalCmd) {
105     fPhysicsManager
106       ->SetOpticalPhysics(fSetOpticalCmd->GetNewBoolValue(newValue)); 
107   }    
108   else if (command == fSetHadronCmd) {
109     fPhysicsManager
110       ->SetHadronPhysics(fSetHadronCmd->GetNewBoolValue(newValue)); 
111   }    
112   else if (command == fSetSpecialCutsCmd) {
113     fPhysicsManager
114       ->SetSpecialCutsPhysics(fSetSpecialCutsCmd->GetNewBoolValue(newValue)); 
115   }    
116   else if (command == fSetSpecialControlsCmd) {
117     fPhysicsManager
118       ->SetSpecialControlsPhysics(
119           fSetSpecialControlsCmd->GetNewBoolValue(newValue)); 
120   }    
121   if (command == fProcessActivationCmd) {
122     fPhysicsManager->SetProcessActivation();
123   }  
124 }