40G4GeneralParticleSourceData::G4GeneralParticleSourceData()
45 sourceIntensity.clear();
46 sourceProbability.clear();
49 sourceVector.push_back(currentSource);
50 sourceIntensity.push_back(1.);
53G4GeneralParticleSourceData::~G4GeneralParticleSourceData()
56 for (
const auto it : sourceVector)
74 for (i = 0; i < sourceIntensity.size(); ++i)
76 total += sourceIntensity[i] ;
78 sourceProbability.clear();
79 std::vector <G4double> sourceNormalizedIntensity;
80 sourceNormalizedIntensity.clear();
82 sourceNormalizedIntensity.push_back(sourceIntensity[0]/total);
83 sourceProbability.push_back(sourceNormalizedIntensity[0]);
85 for (i = 1 ; i < sourceIntensity.size(); ++i)
87 sourceNormalizedIntensity.push_back(sourceIntensity[i]/total);
88 sourceProbability.push_back(sourceNormalizedIntensity[i]+sourceProbability[i-1]);
94 for (i = 0 ; i < sourceIntensity.size(); ++i)
111 sourceIntensity.at(currentSourceIdx) = intensity;
118 sourceVector.push_back(currentSource);
119 sourceIntensity.push_back(intensity);
120 currentSourceIdx =
G4int(sourceVector.size() - 1);
126 delete sourceVector[idx];
127 sourceVector.erase(sourceVector.begin() + idx);
128 sourceIntensity.erase(sourceIntensity.begin()+idx);
130 if (currentSourceIdx == idx )
135 currentSourceIdx = 0;
139 currentSource =
nullptr;
140 currentSourceIdx = -1;
147 currentSourceIdx = -1;
148 currentSource =
nullptr;
149 for (
const auto it : sourceVector)
153 sourceVector.clear();
154 sourceIntensity.clear();
160 for (
const auto it : sourceVector)
162 it->SetVerbosity(vl);
168 currentSource = sourceVector[idx];
169 currentSourceIdx = idx;
170 return sourceVector[idx];
#define G4MUTEXDESTROY(mutex)
#define G4MUTEX_INITIALIZER
#define G4MUTEXLOCK(mutex)
#define G4MUTEXUNLOCK(mutex)
#define G4MUTEXINIT(mutex)
void SetCurrentSourceIntensity(G4double)
G4SingleParticleSource * GetCurrentSource() const
G4int GetIntensityVectorSize() const
void AddASource(G4double intensity)
void DeleteASource(G4int idx)
void IntensityNormalise()
void SetVerbosityAllSources(G4int vl)
static G4GeneralParticleSourceData * Instance()
void SetIntensityWeight(G4double weight)
G4SPSRandomGenerator * GetBiasRndm() const