4 // See the class description in the header file.
6 #include "TG4G3ControlVector.h"
7 #include "TG4G3Defaults.h"
8 #include "TG4Globals.h"
10 #include <G4VProcess.hh>
14 //_____________________________________________________________________________
15 TG4G3ControlVector::TG4G3ControlVector()
17 // initialize fControlVector
18 fControlVector = new TG4ControlValueVector;
19 for (G4int i=0; i<kNoG3Controls; i++) fControlVector->insert(kUnset);
22 //_____________________________________________________________________________
23 TG4G3ControlVector::TG4G3ControlVector(const TG4G3ControlVector& right)
26 fControlVector = new TG4ControlValueVector;
32 //_____________________________________________________________________________
33 TG4G3ControlVector::~TG4G3ControlVector() {
35 delete fControlVector;
40 //_____________________________________________________________________________
41 TG4G3ControlVector& TG4G3ControlVector::operator=(
42 const TG4G3ControlVector& right)
44 // check assignement to self
45 if (this == &right) return *this;
47 // initialize fControlVector
48 fControlVector->clear();;
49 for (G4int i=0; i<kNoG3Controls; i++) {
50 fControlVector->insert((*right.fControlVector)[i]);
56 //_____________________________________________________________________________
57 G4double TG4G3ControlVector::operator[](G4int index) const
60 if (index < kNoG3Controls)
61 return (*fControlVector)[index];
63 TG4Globals::Exception(
64 "TG4G3ControlVector::operator[]: index out of the vector scope");
71 //_____________________________________________________________________________
72 void TG4G3ControlVector::SetG3Control(TG4G3Control control,
73 G4double controlValue)
75 // Sets the controlValue for the specified process control.
78 if (control<kNoG3Controls) {
79 // conversion G4double -> G3ControlValue
80 if (abs(controlValue - kUnset) < 0.01) {
81 (*fControlVector)[control] = kUnset ;
83 else if (abs(controlValue - kInActivate) < 0.01) {
84 (*fControlVector)[control] = kInActivate;
86 else if (abs(controlValue - kActivate) < 0.01) {
87 (*fControlVector)[control] = kActivate;
89 else if (abs(controlValue - kActivate2) < 0.01) {
90 (*fControlVector)[control] = kActivate2;
93 G4String text = "TG4G3ControlVector::SetG3Control:\n ";
94 text = text + "Inconsistent/Not-yet-implemented control has been ignored.";
95 TG4Globals::Warning(text);
100 //_____________________________________________________________________________
101 void TG4G3ControlVector::SetG3Defaults()
103 // Sets G3 default values for all controls.
106 for (G4int i=0; i<kNoG3Controls; i++) {
107 (*fControlVector)[i] = TG4G3Defaults::ControlValue(i);
111 //_____________________________________________________________________________
112 G4int TG4G3ControlVector::GetControl(G4VProcess* process) const
114 // Returns the control value for the particle associated with
115 // the specified process.
118 G4String name = process->GetProcessName();
119 if (name == "conv") return (*fControlVector)(kPAIR);
120 else if (name == "compt") return (*fControlVector)(kCOMP);
121 else if (name == "phot") return (*fControlVector)(kPHOT);
122 // else if (name == "??") return (*fControlVector)(kPFIS);
123 else if ((name == "eIoni") ||
124 (name == "IeIoni") ||
125 (name == "eIoni+") ||
126 (name == "MuIoni") ||
127 (name == "IMuIonisation") ||
130 return (*fControlVector)(kDRAY);
131 else if (name == "annihil") return (*fControlVector)(kANNI);
132 else if ((name == "eBrem") ||
133 (name == "eBrem+") ||
134 (name == "IeBrems") ||
135 (name == "MuBrems") ||
136 (name == "IMuBremsstrahlung"))
137 return (*fControlVector)(kBREM);
138 // else if (name == "??") return (*fControlVector)(kHADR);
139 else if (name == "MuNucl") return (*fControlVector)(kMUNU);
140 else if (name == "Decay") return (*fControlVector)(kDCAY);
141 // else if (name == "??") return (*fControlVector)(kLOSS);
142 // !!! not yet implemented
143 else if ((name == "msc") ||
144 (name == "Imsc")) return (*fControlVector)(kMULS);