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) {
112 for (
size_t j=0; j<npoints; ++j) {
114 for (
size_t k=0; k<n_processes; ++k) {
133 size_t nCouples = dedxTable->size();
134 if(0 >= nCouples) {
return; }
139 for (
size_t i=0; i<nCouples; ++i) {
141 if( !(*theFlag)[i] ) {
continue; }
154 for (
size_t k=1; k<npoints; ++k) {
158 if(dedx1 > 0.0) {
break; }
167 if(npoints < 2) { npoints = 2; }
169 delete (*rangeTable)[i];
189 for (
size_t j=1; j<npoints; ++j) {
192 G4double de = (energy2 - energy1) * del;
197 for (
size_t k=0; k<
n; ++k) {
199 dedx1 = pv->
Value(energy);
200 if(dedx1 > 0.0) { sum += de/dedx1; }
218 size_t nCouples = rangeTable->size();
219 if(0 >= nCouples) {
return; }
221 for (
size_t i=0; i<nCouples; ++i) {
224 if( !(*theFlag)[i] ) {
continue; }
231 delete (*invRangeTable)[i];
235 for (
size_t j=0; j<npoints; ++j) {
251 size_t nCouples = table->size();
252 size_t nFlags = theFlag->size();
254 if(nCouples == nFlags && isInitialized) {
return; }
256 isInitialized =
true;
275 if(nFlags < nCouples) {
276 for(
size_t i=nFlags; i<nCouples; ++i) { theDensityFactor->push_back(1.0); }
277 for(
size_t i=nFlags; i<nCouples; ++i) { theDensityIdx->push_back(-1); }
278 for(
size_t i=nFlags; i<nCouples; ++i) { theFlag->push_back(
true); }
280 for(
size_t i=0; i<nCouples; ++i) {
284 (*theFlag)[i] = table->
GetFlag(i);
285 if ((*theDensityIdx)[i] < 0) {
286 (*theDensityIdx)[i] = i;
295 for(
size_t j=0; j<nCouples; ++j) {
297 if(j == i) {
continue; }
305 (*theDensityIdx)[i] = j;
307 (*theFlag)[i] =
false;
310 (*theDensityIdx)[j] = j;
311 (*theDensityFactor)[j] = 1.0;
312 (*theFlag)[j] =
true;
333 void G4LossTableBuilder::InitialiseCouples()
335 isInitialized =
true;
344 theDensityFactor->resize(nCouples, 1.0);
345 theDensityIdx->resize(nCouples, -1);
346 theFlag->resize(nCouples,
true);
348 for(
size_t i=0; i<nCouples; ++i) {
352 if ((*theDensityIdx)[i] < 0) {
353 (*theDensityIdx)[i] = i;
362 for(
size_t j=0; j<nCouples; ++j) {
364 if(j == i) {
continue; }
372 (*theDensityIdx)[i] = j;
374 (*theFlag)[i] =
false;
377 (*theDensityIdx)[j] = j;
378 (*theDensityFactor)[j] = 1.0;
379 (*theFlag)[j] =
true;
408 if(!table) {
return table; }
417 G4int nbins =
G4int(std::log10(emax/emin) + 0.5)
419 if(nbins < 3) { nbins = 3; }
429 for(
size_t i=0; i<numOfCouples; ++i) {
445 if(0.0 >= tmin) { tmin =
eV; }
450 }
else if(tmin > emin) {
452 if(bin < 3) { bin = 3; }
456 }
else if(!bVector) {
466 for(
G4int j=0; j<
n; ++j) {