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 TG4G3ControlVector::TG4G3ControlVector()
16 // initialize fControlVector
17 fControlVector = new TG4ControlValueVector;
18 for (G4int i=0; i<kNoG3Controls; i++) fControlVector->insert(kUnset);
21 TG4G3ControlVector::TG4G3ControlVector(const TG4G3ControlVector& right)
23 // copy fControlVector
24 fControlVector = new TG4ControlValueVector;
25 for (G4int i=0; i<kNoG3Controls; i++) {
26 fControlVector->insert((*right.fControlVector)[i]);
30 TG4G3ControlVector::~TG4G3ControlVector() {
32 delete fControlVector;
37 TG4G3ControlVector& TG4G3ControlVector::operator=(
38 const TG4G3ControlVector& right)
40 // check assignement to self
41 if (this == &right) return *this;
43 // initialize fControlVector
44 fControlVector->clear();
45 for (G4int i=0; i<kNoG3Controls; i++) {
46 fControlVector->insert((*right.fControlVector)[i]);
52 G4double TG4G3ControlVector::operator[](G4int index) const
55 if (index < kNoG3Controls)
56 return (*fControlVector)[index];
58 TG4Globals::Exception(
59 "TG4G3ControlVector::operator[]: index out of the vector scope");
66 void TG4G3ControlVector::SetG3Control(TG4G3Control control,
67 G4double controlValue)
69 // Sets the controlValue for the specified process control.
72 if (control<kNoG3Controls) {
73 // conversion G4double -> G3ControlValue
74 if (abs(controlValue - kUnset) < 0.01) {
75 (*fControlVector)[control] = kUnset ;
77 else if (abs(controlValue - kInActivate) < 0.01) {
78 (*fControlVector)[control] = kInActivate;
80 else if (abs(controlValue - kActivate) < 0.01) {
81 (*fControlVector)[control] = kActivate;
83 else if (abs(controlValue - kActivate2) < 0.01) {
84 (*fControlVector)[control] = kActivate2;
87 G4String text = "TG4G3ControlVector::SetG3Control:\n ";
88 text = text + "Inconsistent/Not-yet-implemented control has been ignored.";
89 TG4Globals::Warning(text);
94 void TG4G3ControlVector::SetG3Defaults()
96 // Sets G3 default values for all controls.
99 for (G4int i=0; i<kNoG3Controls; i++) {
100 (*fControlVector)[i] = TG4G3Defaults::ControlValue(i);
104 G4int TG4G3ControlVector::GetControl(G4VProcess* process) const
106 // Returns the control value for the particle associated with
107 // the specified process.
110 G4String name = process->GetProcessName();
111 if (name == "conv") return (*fControlVector)(kPAIR);
112 else if (name == "compt") return (*fControlVector)(kCOMP);
113 else if (name == "phot") return (*fControlVector)(kPHOT);
114 // else if (name == "??") return (*fControlVector)(kPFIS);
115 else if ((name == "eIoni") ||
116 (name == "IeIoni") ||
117 (name == "eIoni+") ||
118 (name == "MuIoni") ||
119 (name == "IMuIonisation") ||
122 return (*fControlVector)(kDRAY);
123 else if (name == "annihil") return (*fControlVector)(kANNI);
124 else if ((name == "eBrem") ||
125 (name == "eBrem+") ||
126 (name == "IeBrems") ||
127 (name == "MuBrems") ||
128 (name == "IMuBremsstrahlung"))
129 return (*fControlVector)(kBREM);
130 // else if (name == "??") return (*fControlVector)(kHADR);
131 else if (name == "MuNucl") return (*fControlVector)(kMUNU);
132 else if (name == "Decay") return (*fControlVector)(kDCAY);
133 // else if (name == "??") return (*fControlVector)(kLOSS);
134 // !!! not yet implemented
135 else if ((name == "msc") ||
136 (name == "Imsc")) return (*fControlVector)(kMULS);