75 isInitialized =
false;
77 theDensityFactor =
new std::vector<G4double>;
78 theDensityIdx =
new std::vector<G4int>;
79 theFlag =
new std::vector<G4bool>;
86 delete theDensityFactor;
95 const std::vector<G4PhysicsTable*>& list)
97 size_t n_processes = list.size();
99 if(1 >= n_processes) {
return; }
101 size_t nCouples = dedxTable->size();
102 if(0 >= nCouples) {
return; }
104 for (
size_t i=0; i<nCouples; ++i) {
116 for (
size_t j=0; j<npoints; ++j) {
118 for (
size_t k=0; k<n_processes; ++k) {
137 size_t nCouples = dedxTable->size();
138 if(0 >= nCouples) {
return; }
143 for (
size_t i=0; i<nCouples; ++i) {
145 if( !(*theFlag)[i] ) {
continue; }
158 for (
size_t k=1; k<npoints; ++k) {
162 if(dedx1 > 0.0) {
break; }
171 if(npoints < 2) { npoints = 2; }
173 delete (*rangeTable)[i];
193 for (
size_t j=1; j<npoints; ++j) {
196 G4double de = (energy2 - energy1) * del;
201 for (
size_t k=0; k<
n; ++k) {
203 dedx1 = pv->
Value(energy);
204 if(dedx1 > 0.0) { sum += de/dedx1; }
222 size_t nCouples = rangeTable->size();
223 if(0 >= nCouples) {
return; }
225 for (
size_t i=0; i<nCouples; ++i) {
228 if( !(*theFlag)[i] ) {
continue; }
235 delete (*invRangeTable)[i];
239 for (
size_t j=0; j<npoints; ++j) {
255 size_t nCouples = table->size();
256 size_t nFlags = theFlag->size();
258 if(nCouples == nFlags && isInitialized) {
return; }
260 isInitialized =
true;
279 if(nFlags < nCouples) {
280 for(
size_t i=nFlags; i<nCouples; ++i) { theDensityFactor->push_back(1.0); }
281 for(
size_t i=nFlags; i<nCouples; ++i) { theDensityIdx->push_back(-1); }
282 for(
size_t i=nFlags; i<nCouples; ++i) { theFlag->push_back(
true); }
284 for(
size_t i=0; i<nCouples; ++i) {
288 (*theFlag)[i] = table->
GetFlag(i);
289 if ((*theDensityIdx)[i] < 0) {
290 (*theDensityIdx)[i] = i;
299 for(
size_t j=0; j<nCouples; ++j) {
301 if(j == i) {
continue; }
309 (*theDensityIdx)[i] = j;
311 (*theFlag)[i] =
false;
314 (*theDensityIdx)[j] = j;
315 (*theDensityFactor)[j] = 1.0;
316 (*theFlag)[j] =
true;
337 void G4LossTableBuilder::InitialiseCouples()
339 isInitialized =
true;
348 theDensityFactor->resize(nCouples, 1.0);
349 theDensityIdx->resize(nCouples, -1);
350 theFlag->resize(nCouples,
true);
352 for(
size_t i=0; i<nCouples; ++i) {
356 if ((*theDensityIdx)[i] < 0) {
357 (*theDensityIdx)[i] = i;
366 for(
size_t j=0; j<nCouples; ++j) {
368 if(j == i) {
continue; }
376 (*theDensityIdx)[i] = j;
378 (*theFlag)[i] =
false;
381 (*theDensityIdx)[j] = j;
382 (*theDensityFactor)[j] = 1.0;
383 (*theFlag)[j] =
true;
412 if(!table) {
return table; }
431 for(
size_t i=0; i<numOfCouples; ++i) {
447 if(0.0 >= tmin) { tmin =
eV; }
453 n *=
G4int(std::log10(emax/tmin) + 0.5);
460 for(
G4int j=0; j<=
n; ++j) {
void BuildRangeTable(const G4PhysicsTable *dedxTable, G4PhysicsTable *rangeTable, G4bool isIonisation=false)
void PutValues(size_t binNumber, G4double binValue, G4double dataValue)
static void SetPhysicsVector(G4PhysicsTable *physTable, size_t idx, G4PhysicsVector *vec)
static G4LossTableManager * Instance()
G4PhysicsTable * BuildTableForModel(G4PhysicsTable *table, G4VEmModel *model, const G4ParticleDefinition *, G4double emin, G4double emax, G4bool spline)
virtual G4double MinPrimaryEnergy(const G4Material *, const G4ParticleDefinition *, G4double cut=0.0)
G4double GetDensity() const
G4bool GetFlag(size_t idx) const
size_t GetVectorLength() const
void FillSecondDerivatives()
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)
size_t GetTableSize() const
const G4ParticleDefinition const G4Material *G4double range
void PutValue(size_t index, G4double theValue)
const XML_Char XML_Content * model
virtual ~G4LossTableBuilder()
void BuildInverseRangeTable(const G4PhysicsTable *rangeTable, G4PhysicsTable *invRangeTable, G4bool isIonisation=false)
G4double Energy(size_t index) const
G4double Value(G4double theEnergy, size_t &lastidx) const
void BuildDEDXTable(G4PhysicsTable *dedxTable, const std::vector< G4PhysicsTable * > &)
static G4ProductionCutsTable * GetProductionCutsTable()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void InitialiseBaseMaterials(G4PhysicsTable *table)
G4int GetNumberOfBinsPerDecade() const
const G4Material * GetBaseMaterial() const
G4bool GetFlag(size_t i) const
G4ProductionCuts * GetProductionCuts() const
virtual G4double Value(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy)
const G4Material * GetMaterial() const