4 // See the class description in the header file.
6 #include "TG4FlagVector.h"
7 #include "TG4CutVector.h"
8 #include "TG4G3Defaults.h"
9 #include "TG4Globals.h"
11 #include <G4VProcess.hh>
15 TG4FlagVector::TG4FlagVector()
17 // initialize fFlagVector
18 fFlagVector = new TG3FlagVector;
19 for (G4int i=0; i<kNoG3Flags; i++) fFlagVector->insert(kUnset);
22 TG4FlagVector::TG4FlagVector(const TG4FlagVector& right)
25 fFlagVector = new TG3FlagVector;
26 for (G4int i=0; i<kNoG3Flags; i++) {
27 fFlagVector->insert((*right.fFlagVector)[i]);
31 TG4FlagVector::~TG4FlagVector() {
38 TG4FlagVector& TG4FlagVector::operator=(const TG4FlagVector& right)
40 // check assignement to self
41 if (this == &right) return *this;
43 // initialize fFlagVector
45 for (G4int i=0; i<kNoG3Flags; i++) {
46 fFlagVector->insert((*right.fFlagVector)[i]);
52 G4double TG4FlagVector::operator[](G4int index) const
55 if (index < kNoG3Flags)
56 return (*fFlagVector)[index];
58 TG4Globals::Exception(
59 "TG4FlagVector::operator[]: index out of the vector scope");
66 void TG4FlagVector::SetG3Flag(TG3Flag g3Flag, G4double flagValue)
68 // Sets the flagValue for the specified flag.
71 if (g3Flag<kNoG3Flags) {
72 // conversion G4double -> G3FlagValue
73 if (abs(flagValue - kUnset) < 0.01) {
74 (*fFlagVector)[g3Flag] = kUnset ;
76 else if (abs(flagValue - kInActivate) < 0.01) {
77 (*fFlagVector)[g3Flag] = kInActivate;
79 else if (abs(flagValue - kActivate) < 0.01) {
80 (*fFlagVector)[g3Flag] = kActivate;
82 else if (abs(flagValue - kActivate2) < 0.01) {
83 (*fFlagVector)[g3Flag] = kActivate2;
86 G4String text = "TG4FlagVector::SetG3Flag:\n ";
87 text = text + "Inconsistent/Not-yet-implemented flag has been ignored.";
88 TG4Globals::Warning(text);
93 void TG4FlagVector::SetG3Defaults()
95 // Sets G3 default values for all flags.
98 for (G4int i=0; i<kNoG3Flags; i++) {
99 (*fFlagVector)[i] = TG4G3Defaults::FlagValue(i);
103 G4int TG4FlagVector::GetFlag(G4VProcess* process) const
105 // Returns the flag value for the particle associated with
106 // the specified process.
109 G4String name = process->GetProcessName();
110 if (name == "conv") return (*fFlagVector)(kPAIR);
111 else if (name == "compt") return (*fFlagVector)(kCOMP);
112 else if (name == "phot") return (*fFlagVector)(kPHOT);
113 // else if (name == "??") return (*fFlagVector)(kPFIS);
114 else if ((name == "eIoni") ||
115 (name == "IeIoni") ||
116 (name == "eIoni+") ||
117 (name == "MuIoni") ||
118 (name == "IMuIonisation") ||
121 return (*fFlagVector)(kDRAY);
122 else if (name == "annihil") return (*fFlagVector)(kANNI);
123 else if ((name == "eBrem") ||
124 (name == "eBrem+") ||
125 (name == "IeBrems") ||
126 (name == "MuBrems") ||
127 (name == "IMuBremsstrahlung"))
128 return (*fFlagVector)(kBREM);
129 // else if (name == "??") return (*fFlagVector)(kHADR);
130 else if (name == "MuNucl") return (*fFlagVector)(kMUNU);
131 else if (name == "Decay") return (*fFlagVector)(kDCAY);
132 // else if (name == "??") return (*fFlagVector)(kLOSS);
133 // !!! not yet implemented
134 else if ((name == "msc") ||
135 (name == "Imsc")) return (*fFlagVector)(kMULS);