]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TGeant4/TG4FlagVector.cxx
Put back the two bellows in front of the absorber.
[u/mrichter/AliRoot.git] / TGeant4 / TG4FlagVector.cxx
CommitLineData
2817d3e2 1// $Id$
2// Category: physics
3//
4// See the class description in the header file.
5
6#include "TG4FlagVector.h"
7#include "TG4CutVector.h"
8#include "TG4G3Defaults.h"
9#include "TG4Globals.h"
10
11#include <G4ParticleDefinition.hh>
12#include <G4VProcess.hh>
13
14#include <math.h>
15
16TG4FlagVector::TG4FlagVector()
17{
18 // initialize fFlagVector
19 fFlagVector = new TG3FlagVector;
20 for (G4int i=0; i<kNoG3Flags; i++) fFlagVector->insert(kUnset);
21}
22
23TG4FlagVector::TG4FlagVector(const TG4FlagVector& right)
24{
25 // copy fFlagVector
26 fFlagVector = new TG3FlagVector;
27 for (G4int i=0; i<kNoG3Flags; i++) {
28 fFlagVector->insert((*right.fFlagVector)[i]);
29 }
30}
31
32TG4FlagVector::~TG4FlagVector() {
33//
34 delete fFlagVector;
35}
36
37// operators
38
39TG4FlagVector& TG4FlagVector::operator=(const TG4FlagVector& right)
40{
41 // check assignement to self
42 if (this == &right) return *this;
43
44 // initialize fFlagVector
45 fFlagVector->clear();
46 for (G4int i=0; i<kNoG3Flags; i++) {
47 fFlagVector->insert((*right.fFlagVector)[i]);
48 }
49
50 return *this;
51}
52
53G4double TG4FlagVector::operator[](G4int index) const
54{
55//
56 if (index < kNoG3Flags)
57 return (*fFlagVector)[index];
58 else {
59 TG4Globals::Exception(
60 "TG4FlagVector::operator[]: index out of the vector scope");
61 return 0.;
62 }
63}
64
65// public methods
66
67void TG4FlagVector::SetG3Flag(TG3Flag g3Flag, G4double flagValue)
68{
69// Sets the flagValue for the specified flag.
70// ---
71
72 if (g3Flag<kNoG3Flags) {
73 // conversion G4double -> G3FlagValue
74 if (abs(flagValue - kUnset) < 0.01) {
75 (*fFlagVector)[g3Flag] = kUnset ;
76 }
77 else if (abs(flagValue - kInActivate) < 0.01) {
78 (*fFlagVector)[g3Flag] = kInActivate;
79 }
80 else if (abs(flagValue - kActivate) < 0.01) {
81 (*fFlagVector)[g3Flag] = kActivate;
82 }
83 else if (abs(flagValue - kActivate2) < 0.01) {
84 (*fFlagVector)[g3Flag] = kActivate2;
85 }
86 else {
87 G4String text = "TG4FlagVector::SetG3Flag:\n ";
88 text = text + "Inconsistent/Not-yet-implemented flag has been ignored.";
89 TG4Globals::Warning(text);
90 }
91 }
92}
93
94void TG4FlagVector::SetG3Defaults()
95{
96// Sets G3 default values for all flags.
97// ---
98
99 for (G4int i=0; i<kNoG3Flags; i++) {
100 (*fFlagVector)[i] = TG4G3Defaults::FlagValue(i);
101 }
102}
103
104G4int TG4FlagVector::GetFlag(G4VProcess* process) const
105{
106// Returns the flag value for the particle associated with
107// the specified process.
108// ---
109
110 G4String name = process->GetProcessName();
111 if (name == "conv") return (*fFlagVector)(kPAIR);
112 else if (name == "compt") return (*fFlagVector)(kCOMP);
113 else if (name == "phot") return (*fFlagVector)(kPHOT);
114 // else if (name == "??") return (*fFlagVector)(kPFIS);
115 else if ((name == "eIoni") ||
116 (name == "IeIoni") ||
117 (name == "eIoni+") ||
118 (name == "MuIoni") ||
119 (name == "IMuIonisation") ||
120 (name == "hIoni") ||
121 (name == "IhIoni"))
122 return (*fFlagVector)(kDRAY);
123 else if (name == "annihil") return (*fFlagVector)(kANNI);
124 else if ((name == "eBrem") ||
125 (name == "eBrem+") ||
126 (name == "IeBrems") ||
127 (name == "MuBrems") ||
128 (name == "IMuBremsstrahlung"))
129 return (*fFlagVector)(kBREM);
130 // else if (name == "??") return (*fFlagVector)(kHADR);
131 else if (name == "MuNucl") return (*fFlagVector)(kMUNU);
132 else if (name == "Decay") return (*fFlagVector)(kDCAY);
133 // else if (name == "??") return (*fFlagVector)(kLOSS);
134 // !!! not yet implemented
135 else if ((name == "msc") ||
136 (name == "Imsc")) return (*fFlagVector)(kMULS);
137 else return kUnset;
138}