Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4GeneralParticleSourceData Class Reference

#include <G4GeneralParticleSourceData.hh>

Public Member Functions

void AddASource (G4double intensity)
 
void DeleteASource (G4int idx)
 
void ClearSources ()
 
void IntensityNormalise ()
 
G4bool Normalised () const
 
G4SingleParticleSourceGetCurrentSource (G4int idx)
 
G4SingleParticleSourceGetCurrentSource () const
 
G4int GetSourceVectorSize () const
 
G4int GetIntensityVectorSize () const
 
G4double GetIntensity (G4int idx) const
 
G4double GetSourceProbability (G4int idx) const
 
void SetCurrentSourceIntensity (G4double)
 
void SetFlatSampling (G4bool fSamp)
 
G4bool GetFlatSampling () const
 
void SetMultipleVertex (G4bool flag)
 
G4bool GetMultipleVertex () const
 
G4int GetCurrentSourceIdx () const
 
void SetVerbosityAllSources (G4int vl)
 
void Lock ()
 
void Unlock ()
 

Static Public Member Functions

static
G4GeneralParticleSourceData
Instance ()
 

Detailed Description

Definition at line 63 of file G4GeneralParticleSourceData.hh.

Member Function Documentation

void G4GeneralParticleSourceData::AddASource ( G4double  intensity)

Definition at line 142 of file G4GeneralParticleSourceData.cc.

143 {
144  currentSource = new G4SingleParticleSource();
145  sourceVector.push_back(currentSource);
146  sourceIntensity.push_back(intensity);
147  currentSourceIdx = sourceVector.size() - 1;
148  normalised = false;
149 }

Here is the caller graph for this function:

void G4GeneralParticleSourceData::ClearSources ( )

Definition at line 173 of file G4GeneralParticleSourceData.cc.

174 {
175  currentSourceIdx = -1;
176  currentSource = NULL;
177  for ( std::vector<G4SingleParticleSource*>::iterator it = sourceVector.begin();
178  it != sourceVector.end() ; ++it ) { delete *it; }
179  sourceVector.clear();
180  sourceIntensity.clear();
181  normalised = false;
182 }

Here is the caller graph for this function:

void G4GeneralParticleSourceData::DeleteASource ( G4int  idx)

Definition at line 151 of file G4GeneralParticleSourceData.cc.

152 {
153  delete sourceVector[idx];
154  sourceVector.erase(sourceVector.begin() + idx);
155  sourceIntensity.erase(sourceIntensity.begin()+idx);
156  normalised = false ;
157  if (currentSourceIdx == idx )
158  {
159  if ( this->GetIntensityVectorSize() > 0 )
160  {
161  currentSource = this->GetCurrentSource(0);
162  currentSourceIdx = 0;
163  }
164  else
165  {
166  currentSource = NULL;
167  currentSourceIdx = -1;
168  }
169  }
170 
171 }
G4SingleParticleSource * GetCurrentSource() const

Here is the call graph for this function:

Here is the caller graph for this function:

G4SingleParticleSource * G4GeneralParticleSourceData::GetCurrentSource ( G4int  idx)

Definition at line 194 of file G4GeneralParticleSourceData.cc.

195 {
196  currentSource = sourceVector[idx];
197  currentSourceIdx = idx;
198  return sourceVector[idx];
199 }

Here is the caller graph for this function:

G4SingleParticleSource* G4GeneralParticleSourceData::GetCurrentSource ( ) const
inline

Definition at line 77 of file G4GeneralParticleSourceData.hh.

77 {return currentSource;}

Here is the caller graph for this function:

G4int G4GeneralParticleSourceData::GetCurrentSourceIdx ( ) const
inline

Definition at line 92 of file G4GeneralParticleSourceData.hh.

92 { return currentSourceIdx; }

Here is the caller graph for this function:

G4bool G4GeneralParticleSourceData::GetFlatSampling ( ) const
inline

Definition at line 87 of file G4GeneralParticleSourceData.hh.

87 { return flat_sampling; }

Here is the caller graph for this function:

G4double G4GeneralParticleSourceData::GetIntensity ( G4int  idx) const
inline

Definition at line 81 of file G4GeneralParticleSourceData.hh.

81 {return sourceIntensity.at(idx);}

Here is the caller graph for this function:

G4int G4GeneralParticleSourceData::GetIntensityVectorSize ( ) const
inline

Definition at line 80 of file G4GeneralParticleSourceData.hh.

80 {return G4int(sourceIntensity.size());}
int G4int
Definition: G4Types.hh:78

Here is the caller graph for this function:

G4bool G4GeneralParticleSourceData::GetMultipleVertex ( ) const
inline

Definition at line 90 of file G4GeneralParticleSourceData.hh.

90 { return multiple_vertex; }

Here is the caller graph for this function:

G4double G4GeneralParticleSourceData::GetSourceProbability ( G4int  idx) const
inline

Definition at line 82 of file G4GeneralParticleSourceData.hh.

82 {return sourceProbability.at(idx);}

Here is the caller graph for this function:

G4int G4GeneralParticleSourceData::GetSourceVectorSize ( ) const
inline

Definition at line 79 of file G4GeneralParticleSourceData.hh.

79 {return G4int(sourceVector.size());}
int G4int
Definition: G4Types.hh:78

Here is the caller graph for this function:

G4GeneralParticleSourceData * G4GeneralParticleSourceData::Instance ( void  )
static

Definition at line 92 of file G4GeneralParticleSourceData.cc.

93 {
94  G4AutoLock lock(&singMutex);
96  return &instance;
97 }
static MCTruthManager * instance

Here is the caller graph for this function:

void G4GeneralParticleSourceData::IntensityNormalise ( )

Definition at line 99 of file G4GeneralParticleSourceData.cc.

100 {
101  G4double total = 0.;
102  size_t i = 0 ;
103  for (i = 0; i < sourceIntensity.size(); i++)
104  {
105  total += sourceIntensity[i] ;
106  }
107  sourceProbability.clear();
108  std::vector <G4double> sourceNormalizedIntensity;
109  sourceNormalizedIntensity.clear();
110 
111  sourceNormalizedIntensity.push_back(sourceIntensity[0]/total);
112  sourceProbability.push_back(sourceNormalizedIntensity[0]);
113 
114  for ( i = 1 ; i < sourceIntensity.size(); i++)
115  {
116  sourceNormalizedIntensity.push_back(sourceIntensity[i]/total);
117  sourceProbability.push_back(sourceNormalizedIntensity[i] + sourceProbability[i-1]);
118  }
119 
120  // set source weights here based on sampling scheme (analog/flat) and intensities
121  for ( i = 0 ; i < sourceIntensity.size(); i++)
122  {
123  if (!flat_sampling)
124  {
126  }
127  else
128  {
129  this->GetCurrentSource(i)->GetBiasRndm()->SetIntensityWeight(sourceNormalizedIntensity[i]*sourceIntensity.size());
130  }
131  }
132 
133  normalised = true;
134 }
G4SingleParticleSource * GetCurrentSource() const
G4SPSRandomGenerator * GetBiasRndm() const
G4double total(Particle const *const p1, Particle const *const p2)
void SetIntensityWeight(G4double weight)
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

void G4GeneralParticleSourceData::Lock ( )

Definition at line 201 of file G4GeneralParticleSourceData.cc.

202 {
203  G4MUTEXLOCK(&mutex);
204 }
#define G4MUTEXLOCK
Definition: G4Threading.hh:179

Here is the caller graph for this function:

G4bool G4GeneralParticleSourceData::Normalised ( ) const
inline

Definition at line 74 of file G4GeneralParticleSourceData.hh.

74 {return normalised;}

Here is the caller graph for this function:

void G4GeneralParticleSourceData::SetCurrentSourceIntensity ( G4double  intensity)

Definition at line 136 of file G4GeneralParticleSourceData.cc.

137 {
138  sourceIntensity.at(currentSourceIdx) = intensity;
139  normalised = false;
140 }

Here is the caller graph for this function:

void G4GeneralParticleSourceData::SetFlatSampling ( G4bool  fSamp)
inline

Definition at line 86 of file G4GeneralParticleSourceData.hh.

86 {flat_sampling = fSamp;}

Here is the caller graph for this function:

void G4GeneralParticleSourceData::SetMultipleVertex ( G4bool  flag)
inline

Definition at line 89 of file G4GeneralParticleSourceData.hh.

89 { multiple_vertex = flag; }

Here is the caller graph for this function:

void G4GeneralParticleSourceData::SetVerbosityAllSources ( G4int  vl)

Definition at line 184 of file G4GeneralParticleSourceData.cc.

185 {
186  for ( std::vector<G4SingleParticleSource*>::iterator it = sourceVector.begin();
187  it != sourceVector.end() ; ++it ) {
188  (*it)->SetVerbosity(vl);
189 
190  }
191 
192 }

Here is the caller graph for this function:

void G4GeneralParticleSourceData::Unlock ( )

Definition at line 206 of file G4GeneralParticleSourceData.cc.

207 {
209 }
#define G4MUTEXUNLOCK
Definition: G4Threading.hh:180

Here is the caller graph for this function:


The documentation for this class was generated from the following files: