From ae542d51bb7821f38461189c3360007c409ca0ee Mon Sep 17 00:00:00 2001 From: ivana Date: Tue, 13 Feb 2001 14:12:23 +0000 Subject: [PATCH] TG4FlagVector renamed to TG4G3ControlVector --- TGeant4/TG4FlagVector.cxx | 137 -------------------------------- TGeant4/TG4FlagVector.h | 43 ---------- TGeant4/TG4G3ControlVector.cxx | 138 +++++++++++++++++++++++++++++++++ TGeant4/TG4G3ControlVector.h | 43 ++++++++++ 4 files changed, 181 insertions(+), 180 deletions(-) delete mode 100644 TGeant4/TG4FlagVector.cxx delete mode 100644 TGeant4/TG4FlagVector.h create mode 100644 TGeant4/TG4G3ControlVector.cxx create mode 100644 TGeant4/TG4G3ControlVector.h diff --git a/TGeant4/TG4FlagVector.cxx b/TGeant4/TG4FlagVector.cxx deleted file mode 100644 index a9d62adc2bb..00000000000 --- a/TGeant4/TG4FlagVector.cxx +++ /dev/null @@ -1,137 +0,0 @@ -// $Id$ -// Category: physics -// -// See the class description in the header file. - -#include "TG4FlagVector.h" -#include "TG4CutVector.h" -#include "TG4G3Defaults.h" -#include "TG4Globals.h" - -#include - -#include - -TG4FlagVector::TG4FlagVector() -{ - // initialize fFlagVector - fFlagVector = new TG3FlagVector; - for (G4int i=0; iinsert(kUnset); -} - -TG4FlagVector::TG4FlagVector(const TG4FlagVector& right) -{ - // copy fFlagVector - fFlagVector = new TG3FlagVector; - for (G4int i=0; iinsert((*right.fFlagVector)[i]); - } -} - -TG4FlagVector::~TG4FlagVector() { -// - delete fFlagVector; -} - -// operators - -TG4FlagVector& TG4FlagVector::operator=(const TG4FlagVector& right) -{ - // check assignement to self - if (this == &right) return *this; - - // initialize fFlagVector - fFlagVector->clear(); - for (G4int i=0; iinsert((*right.fFlagVector)[i]); - } - - return *this; -} - -G4double TG4FlagVector::operator[](G4int index) const -{ -// - if (index < kNoG3Flags) - return (*fFlagVector)[index]; - else { - TG4Globals::Exception( - "TG4FlagVector::operator[]: index out of the vector scope"); - return 0.; - } -} - -// public methods - -void TG4FlagVector::SetG3Flag(TG3Flag g3Flag, G4double flagValue) -{ -// Sets the flagValue for the specified flag. -// --- - - if (g3Flag G3FlagValue - if (abs(flagValue - kUnset) < 0.01) { - (*fFlagVector)[g3Flag] = kUnset ; - } - else if (abs(flagValue - kInActivate) < 0.01) { - (*fFlagVector)[g3Flag] = kInActivate; - } - else if (abs(flagValue - kActivate) < 0.01) { - (*fFlagVector)[g3Flag] = kActivate; - } - else if (abs(flagValue - kActivate2) < 0.01) { - (*fFlagVector)[g3Flag] = kActivate2; - } - else { - G4String text = "TG4FlagVector::SetG3Flag:\n "; - text = text + "Inconsistent/Not-yet-implemented flag has been ignored."; - TG4Globals::Warning(text); - } - } -} - -void TG4FlagVector::SetG3Defaults() -{ -// Sets G3 default values for all flags. -// --- - - for (G4int i=0; iGetProcessName(); - if (name == "conv") return (*fFlagVector)(kPAIR); - else if (name == "compt") return (*fFlagVector)(kCOMP); - else if (name == "phot") return (*fFlagVector)(kPHOT); - // else if (name == "??") return (*fFlagVector)(kPFIS); - else if ((name == "eIoni") || - (name == "IeIoni") || - (name == "eIoni+") || - (name == "MuIoni") || - (name == "IMuIonisation") || - (name == "hIoni") || - (name == "IhIoni")) - return (*fFlagVector)(kDRAY); - else if (name == "annihil") return (*fFlagVector)(kANNI); - else if ((name == "eBrem") || - (name == "eBrem+") || - (name == "IeBrems") || - (name == "MuBrems") || - (name == "IMuBremsstrahlung")) - return (*fFlagVector)(kBREM); - // else if (name == "??") return (*fFlagVector)(kHADR); - else if (name == "MuNucl") return (*fFlagVector)(kMUNU); - else if (name == "Decay") return (*fFlagVector)(kDCAY); - // else if (name == "??") return (*fFlagVector)(kLOSS); - // !!! not yet implemented - else if ((name == "msc") || - (name == "Imsc")) return (*fFlagVector)(kMULS); - else return kUnset; -} diff --git a/TGeant4/TG4FlagVector.h b/TGeant4/TG4FlagVector.h deleted file mode 100644 index 44fea3c1df9..00000000000 --- a/TGeant4/TG4FlagVector.h +++ /dev/null @@ -1,43 +0,0 @@ -// $Id$ -// Category: physics -// -// Vector of control process flag values -// with convenient set/get methods - -#ifndef TG4_FLAG_VECTOR_H -#define TG4_FLAG_VECTOR_H - -#include "TG4Globals.h" -#include "TG3Flag.h" - -class G4VProcess; - -class TG4FlagVector -{ - typedef G4RWTValOrderedVector TG3FlagVector; - - public: - TG4FlagVector(); - TG4FlagVector(const TG4FlagVector& right); - virtual ~TG4FlagVector(); - - // operators - TG4FlagVector& operator=(const TG4FlagVector& right); - G4double operator[](G4int index) const; - - // set methods - void SetG3Flag(TG3Flag g3Flag, G4double flagValue); - void SetG3Defaults(); - - // get methods - G4int GetFlag(G4VProcess* process) const; - - private: - // data members - TG3FlagVector* fFlagVector; //vector of control process flag values -}; - -#endif //TG4_FLAG_VECTOR_H - - - diff --git a/TGeant4/TG4G3ControlVector.cxx b/TGeant4/TG4G3ControlVector.cxx new file mode 100644 index 00000000000..59c8bd3d942 --- /dev/null +++ b/TGeant4/TG4G3ControlVector.cxx @@ -0,0 +1,138 @@ +// $Id$ +// Category: global +// +// See the class description in the header file. + +#include "TG4G3ControlVector.h" +#include "TG4G3Defaults.h" +#include "TG4Globals.h" + +#include + +#include + +TG4G3ControlVector::TG4G3ControlVector() +{ + // initialize fControlVector + fControlVector = new TG4ControlValueVector; + for (G4int i=0; iinsert(kUnset); +} + +TG4G3ControlVector::TG4G3ControlVector(const TG4G3ControlVector& right) +{ + // copy fControlVector + fControlVector = new TG4ControlValueVector; + for (G4int i=0; iinsert((*right.fControlVector)[i]); + } +} + +TG4G3ControlVector::~TG4G3ControlVector() { +// + delete fControlVector; +} + +// operators + +TG4G3ControlVector& TG4G3ControlVector::operator=( + const TG4G3ControlVector& right) +{ + // check assignement to self + if (this == &right) return *this; + + // initialize fControlVector + fControlVector->clear(); + for (G4int i=0; iinsert((*right.fControlVector)[i]); + } + + return *this; +} + +G4double TG4G3ControlVector::operator[](G4int index) const +{ +// + if (index < kNoG3Controls) + return (*fControlVector)[index]; + else { + TG4Globals::Exception( + "TG4G3ControlVector::operator[]: index out of the vector scope"); + return 0.; + } +} + +// public methods + +void TG4G3ControlVector::SetG3Control(TG4G3Control control, + G4double controlValue) +{ +// Sets the controlValue for the specified process control. +// --- + + if (control G3ControlValue + if (abs(controlValue - kUnset) < 0.01) { + (*fControlVector)[control] = kUnset ; + } + else if (abs(controlValue - kInActivate) < 0.01) { + (*fControlVector)[control] = kInActivate; + } + else if (abs(controlValue - kActivate) < 0.01) { + (*fControlVector)[control] = kActivate; + } + else if (abs(controlValue - kActivate2) < 0.01) { + (*fControlVector)[control] = kActivate2; + } + else { + G4String text = "TG4G3ControlVector::SetG3Control:\n "; + text = text + "Inconsistent/Not-yet-implemented control has been ignored."; + TG4Globals::Warning(text); + } + } +} + +void TG4G3ControlVector::SetG3Defaults() +{ +// Sets G3 default values for all controls. +// --- + + for (G4int i=0; iGetProcessName(); + if (name == "conv") return (*fControlVector)(kPAIR); + else if (name == "compt") return (*fControlVector)(kCOMP); + else if (name == "phot") return (*fControlVector)(kPHOT); + // else if (name == "??") return (*fControlVector)(kPFIS); + else if ((name == "eIoni") || + (name == "IeIoni") || + (name == "eIoni+") || + (name == "MuIoni") || + (name == "IMuIonisation") || + (name == "hIoni") || + (name == "IhIoni")) + return (*fControlVector)(kDRAY); + else if (name == "annihil") return (*fControlVector)(kANNI); + else if ((name == "eBrem") || + (name == "eBrem+") || + (name == "IeBrems") || + (name == "MuBrems") || + (name == "IMuBremsstrahlung")) + return (*fControlVector)(kBREM); + // else if (name == "??") return (*fControlVector)(kHADR); + else if (name == "MuNucl") return (*fControlVector)(kMUNU); + else if (name == "Decay") return (*fControlVector)(kDCAY); + // else if (name == "??") return (*fControlVector)(kLOSS); + // !!! not yet implemented + else if ((name == "msc") || + (name == "Imsc")) return (*fControlVector)(kMULS); + else return kUnset; +} diff --git a/TGeant4/TG4G3ControlVector.h b/TGeant4/TG4G3ControlVector.h new file mode 100644 index 00000000000..86d86729242 --- /dev/null +++ b/TGeant4/TG4G3ControlVector.h @@ -0,0 +1,43 @@ +// $Id$ +// Category: global +// +// Vector of control process values +// with convenient set/get methods + +#ifndef TG4_G3_CONTROL_VECTOR_H +#define TG4_G3_CONTROL_VECTOR_H + +#include "TG4Globals.h" +#include "TG4G3Control.h" + +class G4VProcess; + +class TG4G3ControlVector +{ + typedef G4RWTValOrderedVector TG4ControlValueVector; + + public: + TG4G3ControlVector(); + TG4G3ControlVector(const TG4G3ControlVector& right); + virtual ~TG4G3ControlVector(); + + // operators + TG4G3ControlVector& operator=(const TG4G3ControlVector& right); + G4double operator[](G4int index) const; + + // set methods + void SetG3Control(TG4G3Control control, G4double controlValue); + void SetG3Defaults(); + + // get methods + G4int GetControl(G4VProcess* process) const; + + private: + // data members + TG4ControlValueVector* fControlVector; //vector of control process values +}; + +#endif //TG4_G3_CONTROL_VECTOR_H + + + -- 2.43.0