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