GGEMS  1.1
GPU GEant4-based Monte Carlo Simulations
GGEMSRangeCuts.cc
Go to the documentation of this file.
1 // ************************************************************************
2 // * This file is part of GGEMS. *
3 // * *
4 // * GGEMS is free software: you can redistribute it and/or modify *
5 // * it under the terms of the GNU General Public License as published by *
6 // * the Free Software Foundation, either version 3 of the License, or *
7 // * (at your option) any later version. *
8 // * *
9 // * GGEMS is distributed in the hope that it will be useful, *
10 // * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 // * GNU General Public License for more details. *
13 // * *
14 // * You should have received a copy of the GNU General Public License *
15 // * along with GGEMS. If not, see <https://www.gnu.org/licenses/>. *
16 // * *
17 // ************************************************************************
18 
32 
36 
40 
42 : min_energy_(0.0f),
43  max_energy_(10.0f*GeV),
44  number_of_bins_(300),
45  distance_cut_photon_(PHOTON_DISTANCE_CUT),
46  distance_cut_electron_(ELECTRON_DISTANCE_CUT),
47  distance_cut_positron_(POSITRON_DISTANCE_CUT),
48  number_of_tables_(0)
49 {
50  GGcout("GGEMSRangeCuts", "GGEMSRangeCuts", 3) << "GGEMSRangeCuts creating..." << GGendl;
51 
52  range_table_material_ = nullptr;
54 
55  GGcout("GGEMSRangeCuts", "GGEMSRangeCuts", 3) << "GGEMSRangeCuts created!!!" << GGendl;
56 }
57 
61 
63 {
64  GGcout("GGEMSRangeCuts", "~GGEMSRangeCuts", 3) << "GGEMSRangeCuts erasing..." << GGendl;
65 
67  delete range_table_material_;
68  range_table_material_ = nullptr;
69  }
70 
72  for (GGsize i = 0; i < number_of_tables_; ++i) {
75  }
78  }
79 
80  GGcout("GGEMSRangeCuts", "~GGEMSRangeCuts", 3) << "GGEMSRangeCuts erased!!!" << GGendl;
81 }
82 
86 
88 {
91  std::ostringstream oss(std::ostringstream::out);
92  oss << "Distance cut for photon " << cut << " mm is too small!!! Minimum value is " << PHOTON_DISTANCE_CUT << " mm!!!";
93  GGEMSMisc::ThrowException("GGEMSRangeCuts", "SetPhotonDistanceCut", oss.str());
94  }
95 }
96 
100 
102 {
105  std::ostringstream oss(std::ostringstream::out);
106  oss << "Distance cut for electron " << cut << " mm is too small!!! Minimum value is " << ELECTRON_DISTANCE_CUT << " mm!!!";
107  GGEMSMisc::ThrowException("GGEMSRangeCuts", "SetElectronLengthCut", oss.str());
108  }
109 }
110 
114 
116 {
119  std::ostringstream oss(std::ostringstream::out);
120  oss << "Cut distance for positron " << cut << " mm is too small!!! Minimum value is " << POSITRON_DISTANCE_CUT << " mm!!!";
121  GGEMSMisc::ThrowException("GGEMSRangeCuts", "SetPositronLengthCut", oss.str());
122  }
123 }
124 
128 
129 GGfloat GGEMSRangeCuts::ConvertToEnergy(GGEMSMaterialTables* material_table, GGushort const& index_mat, std::string const& particle_name)
130 {
131  // Checking the particle_name
132  if (particle_name != "gamma" && particle_name != "e+" && particle_name != "e-") {
133  std::ostringstream oss(std::ostringstream::out);
134  oss << "Wrong particle name, the particle can be only:" << std::endl;
135  oss << " - gamma" << std::endl;
136  oss << " - e+" << std::endl;
137  oss << " - e-" << std::endl;
138  GGEMSMisc::ThrowException("GGEMSRangeCuts", "ConvertToEnergy", oss.str());
139  }
140 
141  // Set cut depending on particle
142  GGfloat cut = 0.0f;
143  if (particle_name == "gamma") {
144  cut = distance_cut_photon_;
145  }
146  else if (particle_name == "e-") {
148  }
149  else if (particle_name == "e+") {
151  }
152 
153  // Reset tables
155  for (GGsize i = 0; i < number_of_tables_; ++i) {
157  loss_table_dedx_table_elements_[i] = nullptr;
158  }
161  }
162 
163  // init vars
164  GGfloat kinetic_energy_cut = 0.0f;
165 
166  // Build dE/dX loss table for each elements
167  BuildElementsLossTable(material_table, index_mat, particle_name);
168 
169  // Absorption table for photon and loss table for electron/positron
170  if (particle_name == "gamma") {
171  BuildAbsorptionLengthTable(material_table, index_mat);
172  }
173  else if (particle_name == "e+" || particle_name == "e-") {
174  BuildMaterialLossTable(material_table, index_mat);
175  }
176 
177  // Convert Range Cut ro Kinetic Energy Cut
178  //kinetic_energy_cut = ConvertLengthToEnergyCut(range_table_material_, cut);
179  kinetic_energy_cut = ConvertLengthToEnergyCut(cut);
180 
181  if (particle_name == "e-" || particle_name == "e+" ) {
182  GGfloat constexpr kTune = 0.025f * mm * g / cm3;
183  GGfloat constexpr kLowEnergy = 30.f * keV;
184  if (kinetic_energy_cut < kLowEnergy) {
185  kinetic_energy_cut /= ( 1.0f + (1.0f - kinetic_energy_cut/kLowEnergy) * kTune / (cut*material_table->density_of_material_[index_mat]));
186  }
187  }
188 
189  if (kinetic_energy_cut < min_energy_) {
190  kinetic_energy_cut = min_energy_;
191  }
192  else if (kinetic_energy_cut > max_energy_) {
193  kinetic_energy_cut = max_energy_;
194  }
195 
196  // Storing cut
197  if (particle_name == "gamma") {
198  material_table->photon_energy_cut_[index_mat] = kinetic_energy_cut;
199  }
200  else if (particle_name == "e-") {
201  material_table->electron_energy_cut_[index_mat] = kinetic_energy_cut;
202  }
203  else if (particle_name == "e+") {
204  material_table->positron_energy_cut_[index_mat] = kinetic_energy_cut;
205  }
206 
207  return kinetic_energy_cut;
208 }
209 
213 
215 {
216  // Allocation buffer for absorption length
219 
220  // Get the number of elements in material
221  GGsize number_of_elements = material_table->number_of_chemical_elements_[index_mat];
222 
223  // Get index offset to element
224  GGsize index_of_offset = material_table->index_of_chemical_elements_[index_mat];
225 
226  // Loop over the bins in the table
227  for (GGsize i = 0; i < number_of_bins_; ++i) {
228  GGfloat sigma = 0.0f;
229 
230  // Loop over the number of elements in material
231  for (GGsize j = 0; j < number_of_elements; ++j) {
232  sigma += material_table->atomic_number_density_[j+index_of_offset] * loss_table_dedx_table_elements_[j]->GetLossTableData(i);
233  }
234 
235  // Storing value
236  range_table_material_->SetValue(i, 5.0f/sigma);
237  }
238 }
239 
243 
245 {
246  // calculate parameters of the low energy part first
247  std::vector<GGfloat> loss;
248 
249  // Allocation buffer for absorption length
252 
253  // Get the number of elements in material
254  GGsize number_of_elements = static_cast<GGsize>(material_table->number_of_chemical_elements_[index_mat]);
255 
256  // Get index offset to element
257  GGsize index_of_offset = material_table->index_of_chemical_elements_[index_mat];
258 
259  for (GGsize i = 0; i <= number_of_bins_; ++i) {
260  GGfloat value = 0.0f;
261 
262  for (GGsize j = 0; j < number_of_elements; ++j) {
263  value += material_table->atomic_number_density_[j+index_of_offset] * loss_table_dedx_table_elements_[j]->GetLossTableData(i);
264  }
265  loss.push_back(value);
266  }
267 
268  // Integrate with Simpson formula with logarithmic binning
269  GGfloat dltau = 1.0f;
270  if (min_energy_ > 0.f) {
271  GGfloat ltt = logf(max_energy_/min_energy_);
272  dltau = ltt/static_cast<GGfloat>(number_of_bins_);
273  }
274 
275  GGfloat s0 = 0.0f;
276  GGfloat value = 0.0f;
277  for (GGsize i = 0; i <= number_of_bins_; ++i) {
279  GGfloat q = t / loss.at(i);
280 
281  if (i == 0) {
282  s0 += 0.5f*q;
283  }
284  else {
285  s0 += q;
286  }
287 
288  if (i == 0) {
289  value = (s0 + 0.5f*q) * dltau;
290  }
291  else {
292  value = (s0 - 0.5f*q) * dltau;
293  }
294  range_table_material_->SetValue(i, value);
295  }
296 }
297 
301 
302 void GGEMSRangeCuts::BuildElementsLossTable(GGEMSMaterialTables* material_table, GGushort const& index_mat, std::string const& particle_name)
303 {
304  // Getting number of elements in material
305  number_of_tables_ = static_cast<GGsize>(material_table->number_of_chemical_elements_[index_mat]);
306 
307  // Building cross section tables for each elements in material
309 
310  // Get index offset to element
311  GGsize index_of_offset = material_table->index_of_chemical_elements_[index_mat];
312 
313  // Filling cross section table
314  for (GGsize i = 0; i < number_of_tables_; ++i) {
315  GGfloat value = 0.0f;
317 
318  // Getting atomic number
319  GGuchar const kZ = material_table->atomic_number_Z_[i+index_of_offset];
320 
321  for (GGsize j = 0; j < number_of_bins_; ++j) {
322  if (particle_name == "gamma") {
323  value = ComputePhotonCrossSection(kZ, log_energy_table_element->GetEnergy(j));
324  }
325  else if (particle_name == "e-") {
326  value = ComputeLossElectron(kZ, log_energy_table_element->GetEnergy(j));
327  }
328  else if (particle_name == "e+") {
329  value = ComputeLossPositron(kZ, log_energy_table_element->GetEnergy(j));
330  }
331  log_energy_table_element->SetValue(j, value);
332  }
333 
334  // Storing the logf table
335  loss_table_dedx_table_elements_[i] = log_energy_table_element;
336  }
337 }
338 
342 
343 GGfloat GGEMSRangeCuts::ComputePhotonCrossSection(GGuchar const& atomic_number, GGfloat const& energy) const
344 {
345  // Compute the "absorption" cross section of the photon "absorption"
346  // cross section means here the sum of the cross sections of the
347  // pair production, Compton scattering and photoelectric processes
348  GGfloat t1keV = 1.0f*keV;
349  GGfloat t200keV = 200.f*keV;
350  GGfloat t100MeV = 100.f*MeV;
351 
352  GGfloat gZ = -1.0f;
353  GGfloat s200keV = 0.0f;
354  GGfloat s1keV = 0.0f;
355  GGfloat tmin = 0.0f;
356  GGfloat tlow = 0.0f;
357  GGfloat smin = 0.0f;
358  GGfloat slow = 0.0f;
359  GGfloat cmin = 0.0f;
360  GGfloat clow = 0.0f;
361  GGfloat chigh = 0.0f;
362 
363  // Compute Z dependent quantities in the case of a new AtomicNumber
364  if (std::abs(atomic_number - gZ) > 0.1f) {
365  gZ = atomic_number;
366  GGfloat const kZsquare = gZ*gZ;
367  GGfloat const kZlog = logf(gZ);
368  GGfloat const kZlogsquare = kZlog*kZlog;
369 
370  s200keV = (0.2651f - 0.1501f*kZlog + 0.02283f*kZlogsquare) * kZsquare;
371  tmin = (0.552f + 218.5f/gZ + 557.17f/kZsquare) * MeV;
372  smin = (0.01239f + 0.005585f*kZlog - 0.000923f*kZlogsquare) * expf(1.5f*kZlog);
373  cmin = logf(s200keV/smin) / (logf(tmin/t200keV) * logf(tmin/t200keV));
374  tlow = 0.2f * expf(-7.355f/sqrtf(gZ)) * MeV;
375  slow = s200keV * expf(0.042f*gZ*logf(t200keV/tlow)*logf(t200keV/tlow));
376  s1keV = 300.0f*kZsquare;
377  clow = logf(s1keV/slow) / logf(tlow/t1keV);
378 
379  chigh = (7.55e-5f - 0.0542e-5f*gZ ) * kZsquare * gZ/logf(t100MeV/tmin);
380  }
381 
382  // Calculate the cross section (using an approximate empirical formula)
383  GGfloat xs = 0.0f;
384  if (energy < tlow){
385  if (energy < t1keV) {
386  xs = slow * expf(clow*logf(tlow/t1keV));
387  }
388  else {
389  xs = slow * expf(clow*logf(tlow/energy));
390  }
391  }
392  else if (energy < t200keV) {
393  xs = s200keV * expf(0.042f*gZ*logf(t200keV/energy)*logf(t200keV/energy));
394  }
395  else if(energy < tmin) {
396  xs = smin * expf(cmin*logf(tmin/energy)*logf(tmin/energy));
397  }
398  else {
399  xs = smin + chigh*logf(energy/tmin);
400  }
401 
402  return xs * b;
403 }
404 
408 
409 GGfloat GGEMSRangeCuts::ComputeLossElectron(GGuchar const& atomic_number, GGfloat const& energy) const
410 {
411  GGfloat cbr1 = 0.02f;
412  GGfloat cbr2 = -5.7e-5f;
413  GGfloat cbr3 = 1.f;
414  GGfloat cbr4 = 0.072f;
415 
416  GGfloat Tlow = 10.f*keV;
417  GGfloat Thigh = 1.0f*GeV;
418 
419  GGfloat Mass = ELECTRON_MASS_C2;
420  GGfloat bremfactor = 0.1f;
421 
422  GGfloat eZ = -1.f;
423  GGfloat taul = 0.0f;
424  GGfloat ionpot = 0.0f;
425  GGfloat ionpotlog = -1.0e-10f;
426 
427  // calculate dE/dx for electrons
428  if (fabs(atomic_number - eZ) > 0.1f) {
429  eZ = atomic_number;
430  taul = Tlow/Mass;
431  ionpot = 1.6e-5f*MeV * expf(0.9f*logf(eZ)) / Mass;
432  ionpotlog = logf(ionpot);
433  }
434 
435  GGfloat tau = energy / Mass;
436  GGfloat dEdx = 0.0f;
437 
438  if (tau < taul) {
439  GGfloat t1 = taul + 1.0f;
440  GGfloat t2 = taul + 2.0f;
441  GGfloat tsq = taul*taul;
442  GGfloat beta2 = taul*t2 / (t1*t1);
443  GGfloat f = 1.f - beta2 + logf(tsq/2.0f) + (0.5f + 0.25f*tsq + (1.f+2.f*taul) * logf(0.5f)) / (t1*t1);
444  dEdx = (logf(2.f*taul + 4.f) - 2.f*ionpotlog + f) / beta2;
445  dEdx = TWO_PI_MC2_RCL2 * eZ * dEdx;
446  GGfloat clow = dEdx * sqrtf(taul);
447  dEdx = clow / sqrtf(energy / Mass);
448  }
449  else {
450  GGfloat t1 = tau + 1.f;
451  GGfloat t2 = tau + 2.f;
452  GGfloat tsq = tau*tau;
453  GGfloat beta2 = tau*t2 / ( t1*t1 );
454  GGfloat f = 1.f - beta2 + logf(tsq/2.f) + (0.5f + 0.25f*tsq + (1.f + 2.f*tau)*logf(0.5f)) / (t1*t1);
455  dEdx = (logf(2.f*tau + 4.f) - 2.f*ionpotlog + f) / beta2;
456  dEdx = TWO_PI_MC2_RCL2 * eZ * dEdx;
457 
458  // loss from bremsstrahlung follows
459  GGfloat cbrem = (cbr1 + cbr2*eZ) * (cbr3 + cbr4*logf(energy/Thigh));
460  cbrem = eZ * (eZ+1.f) * cbrem * tau / beta2;
461  cbrem *= bremfactor;
462  dEdx += TWO_PI_MC2_RCL2 * cbrem;
463  }
464 
465  return dEdx;
466 }
467 
471 
472 GGfloat GGEMSRangeCuts::ComputeLossPositron(GGuchar const& atomic_number, GGfloat const& energy) const
473 {
474  GGfloat cbr1 = 0.02f;
475  GGfloat cbr2 = -5.7e-5f;
476  GGfloat cbr3 = 1.f;
477  GGfloat cbr4 = 0.072f;
478 
479  GGfloat Tlow = 10.f*keV;
480  GGfloat Thigh = 1.0f*GeV;
481 
482  GGfloat Mass = POSITRON_MASS_C2;
483  GGfloat bremfactor = 0.1f;
484 
485  GGfloat Z = -1.f;
486  GGfloat taul = 0.0f;
487  GGfloat ionpot = 0.0f;
488  GGfloat ionpotlog = -1.0e-10f;
489 
490  // calculate dE/dx for electrons
491  if (fabs(atomic_number-Z) > 0.1f) {
492  Z = atomic_number;
493  taul = Tlow/Mass;
494  ionpot = 1.6e-5f*MeV * expf(0.9f*logf(Z))/Mass;
495  ionpotlog = logf(ionpot);
496  }
497 
498  GGfloat tau = energy / Mass;
499  GGfloat dEdx;
500 
501  if (tau < taul) {
502  GGfloat t1 = taul + 1.f;
503  GGfloat t2 = taul + 2.f;
504  GGfloat tsq = taul*taul;
505  GGfloat beta2 = taul*t2 / (t1*t1);
506  GGfloat f = 2.f * logf(taul) -(6.f*taul+1.5f*tsq-taul*(1.f-tsq/3.f)/t2-tsq*(0.5f-tsq/12.f)/(t2*t2))/(t1*t1);
507  dEdx = (logf(2.f*taul+4.f)-2.f*ionpotlog+f)/beta2;
508  dEdx = TWO_PI_MC2_RCL2 * Z * dEdx;
509  GGfloat clow = dEdx * sqrtf(taul);
510  dEdx = clow/sqrtf(energy/Mass);
511  }
512  else {
513  GGfloat t1 = tau + 1.f;
514  GGfloat t2 = tau + 2.f;
515  GGfloat tsq = tau*tau;
516  GGfloat beta2 = tau*t2/(t1*t1);
517  GGfloat f = 2.f*logf(tau)-(6.f*tau+1.5f*tsq-tau*(1.f-tsq/3.f)/t2-tsq*(0.5f-tsq/12.f)/(t2*t2))/(t1*t1);
518  dEdx = (logf(2.f*tau+4.f)-2.f*ionpotlog+f)/beta2;
519  dEdx = TWO_PI_MC2_RCL2 * Z * dEdx;
520 
521  // loss from bremsstrahlung follows
522  GGfloat cbrem = (cbr1+cbr2*Z)*(cbr3+cbr4*logf(energy/Thigh));
523  cbrem = Z*(Z+1.f)*cbrem*tau/beta2;
524  cbrem *= bremfactor;
525  dEdx += TWO_PI_MC2_RCL2 * cbrem;
526  }
527  return dEdx;
528 }
529 
533 
535 {
536  GGfloat epsilon = 0.01f;
537 
538  // Find max. range and the corresponding energy (rmax,Tmax)
539  GGfloat rmax = -1.e10f * mm;
540  GGfloat t1 = min_energy_;
542  GGfloat t2 = max_energy_;
543 
544  // Check length_cut < r1
545  if (length_cut < r1) return t1;
546 
547  // scan range vector to find nearest bin
548  // suppose that r(ti) > r(tj) if ti >tj
549  for (GGushort i = 0; i < number_of_bins_; ++i) {
552 
553  if (r > rmax) rmax = r;
554  if (r < length_cut) {
555  t1 = t;
556  r1 = r;
557  }
558  else if (r > length_cut) {
559  t2 = t;
560  break;
561  }
562  }
563 
564  // check cut in length is smaller than range max
565  if (length_cut >= rmax) return max_energy_;
566 
567  // convert range to energy
568  GGfloat t3 = sqrtf(t1*t2);
570 
571  while (fabs(1.0f - r3/length_cut) > epsilon) {
572  if (length_cut <= r3) {
573  t2 = t3;
574  }
575  else {
576  t1 = t3;
577  }
578 
579  t3 = sqrtf(t1*t2);
581  }
582 
583  return t3;
584 }
585 
589 
591 {
592  // Getting the minimum for the loss/cross section table in process manager
594  min_energy_ = process_manager.GetCrossSectionTableMinEnergy();
595 
596  // Get data from OpenCL device
598 
599  // Get number of activated device
600  GGsize number_activated_devices = opencl_manager.GetNumberOfActivatedDevice();
601 
602  for (GGsize j = 0; j < number_activated_devices; ++j) {
603  cl::Buffer* material_table = materials->GetMaterialTables(j);
604  GGEMSMaterialTables* material_table_device = opencl_manager.GetDeviceBuffer<GGEMSMaterialTables>(material_table, sizeof(GGEMSMaterialTables), j);
605 
606  // Loop over materials
607  for (GGushort i = 0; i < material_table_device->number_of_materials_; ++i) {
608  // Get the name of material
609 
610  // Convert photon cuts
611  GGfloat energy_cut_photon = ConvertToEnergy(material_table_device, i, "gamma");
612 
613  // Convert electron cuts
614  GGfloat energy_cut_electron = ConvertToEnergy(material_table_device, i, "e-");
615 
616  // Convert electron cuts
617  GGfloat energy_cut_positron = ConvertToEnergy(material_table_device, i, "e+");
618 
619  // Storing the cuts in map
620  energy_cuts_photon_.insert(std::make_pair(materials->GetMaterialName(i), energy_cut_photon));
621  energy_cuts_electron_.insert(std::make_pair(materials->GetMaterialName(i), energy_cut_electron));
622  energy_cuts_positron_.insert(std::make_pair(materials->GetMaterialName(i), energy_cut_positron));
623  }
624 
625  // Release pointer
626  opencl_manager.ReleaseDeviceBuffer(material_table, material_table_device, j);
627  }
628 }
GGEMSRangeCutsManager.hh
GGEMS class managing the range cuts in GGEMS simulation.
GGEMSMaterialTables_t::density_of_material_
GGfloat density_of_material_[255]
Definition: GGEMSMaterialTables.hh:49
GGEMSRangeCuts::ComputeLossElectron
GGfloat ComputeLossElectron(GGuchar const &atomic_number, GGfloat const &energy) const
compute the loss de/dx for electron
Definition: GGEMSRangeCuts.cc:409
GGEMSRangeCuts::SetElectronDistanceCut
void SetElectronDistanceCut(GGfloat const &cut)
set the electron length cut by the range cut manager
Definition: GGEMSRangeCuts.cc:101
GGEMSRangeCuts::~GGEMSRangeCuts
~GGEMSRangeCuts(void)
GGEMSRangeCuts destructor.
Definition: GGEMSRangeCuts.cc:62
GGEMSOpenCLManager::GetNumberOfActivatedDevice
GGsize GetNumberOfActivatedDevice(void) const
get the number of activated devices
Definition: GGEMSOpenCLManager.hh:167
PHOTON_DISTANCE_CUT
__constant GGfloat PHOTON_DISTANCE_CUT
Definition: GGEMSProcessConstants.hh:62
GGEMSLogEnergyTable::GetLowEdgeEnergy
GGfloat GetLowEdgeEnergy(GGsize const &index) const
get the energy at the bin index similar to GGEMSLogEnergyTable::GetEnergy
Definition: GGEMSLogEnergyTable.hh:125
GGEMSMaterialTables_t::atomic_number_density_
GGfloat atomic_number_density_[255 *32]
Definition: GGEMSMaterialTables.hh:75
GGEMSRangeCuts::distance_cut_photon_
GGfloat distance_cut_photon_
Definition: GGEMSRangeCuts.hh:237
GGEMSMaterials::GetMaterialTables
cl::Buffer * GetMaterialTables(GGsize const &thread_index) const
get the pointer on material tables on OpenCL device
Definition: GGEMSMaterials.hh:164
GGEMSMaterials
GGEMS class handling material(s) for a specific navigator.
Definition: GGEMSMaterials.hh:49
GGEMSRangeCuts::BuildAbsorptionLengthTable
void BuildAbsorptionLengthTable(GGEMSMaterialTables *material_table, GGushort const &index_mat)
Build absorption length table for photon.
Definition: GGEMSRangeCuts.cc:214
POSITRON_DISTANCE_CUT
__constant GGfloat POSITRON_DISTANCE_CUT
Definition: GGEMSProcessConstants.hh:64
GGEMSProcessesManager.hh
GGEMS class managing the processes in GGEMS simulation.
GGEMSRangeCuts::min_energy_
GGfloat min_energy_
Definition: GGEMSRangeCuts.hh:232
GGEMSRangeCuts::SetPhotonDistanceCut
void SetPhotonDistanceCut(GGfloat const &cut)
set the photon length cut by the range cut manager
Definition: GGEMSRangeCuts.cc:87
ELECTRON_DISTANCE_CUT
__constant GGfloat ELECTRON_DISTANCE_CUT
Definition: GGEMSProcessConstants.hh:63
GGushort
#define GGushort
Definition: GGEMSTypes.hh:217
GGEMSRangeCuts::energy_cuts_photon_
EnergyCutUMap energy_cuts_photon_
Definition: GGEMSRangeCuts.hh:238
MeV
__constant GGfloat MeV
Definition: GGEMSSystemOfUnits.hh:103
GGEMSMaterialTables_t::atomic_number_Z_
GGuchar atomic_number_Z_[255 *32]
Definition: GGEMSMaterialTables.hh:74
GGEMSLogEnergyTable::GetLossTableData
GGfloat GetLossTableData(GGsize const &index) const
get the loss table data value at the bin index
Definition: GGEMSLogEnergyTable.hh:117
GGEMSOpenCLManager::ReleaseDeviceBuffer
void ReleaseDeviceBuffer(cl::Buffer *const device_ptr, T *host_ptr, GGsize const &thread_index)
Get the device pointer on host to write on it. Mandatory after a GetDeviceBufferWrite ou GetDeviceBuf...
Definition: GGEMSOpenCLManager.hh:495
GGEMSRangeCuts::range_table_material_
GGEMSLogEnergyTable * range_table_material_
Definition: GGEMSRangeCuts.hh:248
GGEMSRangeCuts::number_of_bins_
GGsize number_of_bins_
Definition: GGEMSRangeCuts.hh:234
GGEMSMaterialTables_t::number_of_materials_
GGsize number_of_materials_
Definition: GGEMSMaterialTables.hh:44
mm
__constant GGfloat mm
Definition: GGEMSSystemOfUnits.hh:54
GGEMSProcessesManager::GetCrossSectionTableMinEnergy
GGfloat GetCrossSectionTableMinEnergy(void) const
get the minimum energy in the cross section table
Definition: GGEMSProcessesManager.hh:122
GGEMSRangeCuts::GGEMSRangeCuts
GGEMSRangeCuts(void)
GGEMSRangeCuts constructor.
Definition: GGEMSRangeCuts.cc:41
GGEMSRangeCuts.hh
GGEMS class storing and converting the cut in energy cut. The computations come from G4RToEConvForGam...
GGsize
#define GGsize
Definition: GGEMSTypes.hh:252
GGEMSRangeCuts::BuildElementsLossTable
void BuildElementsLossTable(GGEMSMaterialTables *material_table, GGushort const &index_mat, std::string const &particle_name)
Build loss table for elements in material.
Definition: GGEMSRangeCuts.cc:302
GGEMSRangeCuts::max_energy_
GGfloat max_energy_
Definition: GGEMSRangeCuts.hh:233
GGEMSRangeCuts::energy_cuts_electron_
EnergyCutUMap energy_cuts_electron_
Definition: GGEMSRangeCuts.hh:242
ELECTRON_MASS_C2
__constant GGfloat ELECTRON_MASS_C2
Definition: GGEMSConstants.hh:53
keV
__constant GGfloat keV
Definition: GGEMSSystemOfUnits.hh:102
GGEMSLogEnergyTable::GetLossTableValue
GGfloat GetLossTableValue(GGfloat const &energy) const
get the interpolated loss table value
Definition: GGEMSLogEnergyTable.cc:96
cm3
__constant GGfloat cm3
Definition: GGEMSSystemOfUnits.hh:59
GGEMSRangeCuts::ComputePhotonCrossSection
GGfloat ComputePhotonCrossSection(GGuchar const &atomic_number, GGfloat const &energy) const
compute cross secton value for photon depending on Z and energy
Definition: GGEMSRangeCuts.cc:343
GeV
__constant GGfloat GeV
Definition: GGEMSSystemOfUnits.hh:104
GGEMSMaterials::GetMaterialName
std::string GetMaterialName(GGsize i) const
get the name of the material at position i
Definition: GGEMSMaterials.hh:132
GGEMSMaterialTables_t::number_of_chemical_elements_
GGsize number_of_chemical_elements_[255]
Definition: GGEMSMaterialTables.hh:48
GGEMSRangeCuts::distance_cut_positron_
GGfloat distance_cut_positron_
Definition: GGEMSRangeCuts.hh:245
GGEMSMaterialTables_t::index_of_chemical_elements_
GGsize index_of_chemical_elements_[255]
Definition: GGEMSMaterialTables.hh:73
GGEMSRangeCuts::number_of_tables_
GGsize number_of_tables_
Definition: GGEMSRangeCuts.hh:250
GGEMSRangeCuts::ConvertToEnergy
GGfloat ConvertToEnergy(GGEMSMaterialTables *material_table, GGushort const &index_mat, std::string const &particle_name)
Convert length cut to energy cut for gamma, e- and e+.
Definition: GGEMSRangeCuts.cc:129
GGEMSRangeCuts::SetPositronDistanceCut
void SetPositronDistanceCut(GGfloat const &cut)
set the positron length cut by the range cut manager
Definition: GGEMSRangeCuts.cc:115
GGEMSMaterialTables_t::electron_energy_cut_
GGfloat electron_energy_cut_[255]
Definition: GGEMSMaterialTables.hh:69
GGcout
GGEMSStream GGcout
Definition: GGEMSPrint.cc:34
GGEMSMaterialTables_t::photon_energy_cut_
GGfloat photon_energy_cut_[255]
Definition: GGEMSMaterialTables.hh:68
GGEMSMaterialTables_t
Structure storing the material tables on OpenCL device.
Definition: GGEMSMaterialTables.hh:42
GGEMSProcessesManager
GGEMS class managing the processes in GGEMS simulation.
Definition: GGEMSProcessesManager.hh:42
POSITRON_MASS_C2
__constant GGfloat POSITRON_MASS_C2
Definition: GGEMSConstants.hh:54
g
__constant GGfloat g
Definition: GGEMSSystemOfUnits.hh:111
GGEMSOpenCLManager::GetDeviceBuffer
T * GetDeviceBuffer(cl::Buffer *device_ptr, GGsize const &size, GGsize const &thread_index)
Get the device pointer on host to write on it. ReleaseDeviceBuffer must be used after this method!...
Definition: GGEMSOpenCLManager.hh:480
GGEMSMaterialTables
struct GGEMSMaterialTables_t GGEMSMaterialTables
GGEMSRangeCuts::loss_table_dedx_table_elements_
GGEMSLogEnergyTable ** loss_table_dedx_table_elements_
Definition: GGEMSRangeCuts.hh:249
GGEMSRangeCuts::ConvertCutsFromDistanceToEnergy
void ConvertCutsFromDistanceToEnergy(GGEMSMaterials *materials)
Convert cut from length to energy.
Definition: GGEMSRangeCuts.cc:590
GGendl
#define GGendl
overload C++ std::endl
Definition: GGEMSPrint.hh:60
GGEMSLogEnergyTable::SetValue
void SetValue(GGsize const &index, GGfloat const &value)
Set the data vector at index.
Definition: GGEMSLogEnergyTable.cc:87
GGEMSOpenCLManager
Singleton class storing all informations about OpenCL and managing GPU/CPU devices,...
Definition: GGEMSOpenCLManager.hh:54
GGEMSLogEnergyTable
GGEMS class computing log table for cut convertion from length to energy.
Definition: GGEMSLogEnergyTable.hh:52
GGuchar
#define GGuchar
Definition: GGEMSTypes.hh:203
GGEMSRangeCuts::energy_cuts_positron_
EnergyCutUMap energy_cuts_positron_
Definition: GGEMSRangeCuts.hh:246
GGEMSRangeCuts::ConvertLengthToEnergyCut
GGfloat ConvertLengthToEnergyCut(GGfloat const &length_cut) const
convert length to energy cut
Definition: GGEMSRangeCuts.cc:534
GGEMSMaterialTables_t::positron_energy_cut_
GGfloat positron_energy_cut_[255]
Definition: GGEMSMaterialTables.hh:70
GGEMSRangeCuts::ComputeLossPositron
GGfloat ComputeLossPositron(GGuchar const &atomic_number, GGfloat const &energy) const
compute the loss de/dx for positron
Definition: GGEMSRangeCuts.cc:472
GGEMSRangeCuts::distance_cut_electron_
GGfloat distance_cut_electron_
Definition: GGEMSRangeCuts.hh:241
b
__constant GGfloat b
Definition: GGEMSSystemOfUnits.hh:69
TWO_PI_MC2_RCL2
__constant GGfloat TWO_PI_MC2_RCL2
Definition: GGEMSConstants.hh:79
GGEMSLogEnergyTable::GetEnergy
GGfloat GetEnergy(GGsize const &index) const
get the energy at the bin index
Definition: GGEMSLogEnergyTable.hh:109
GGEMSProcessesManager::GetInstance
static GGEMSProcessesManager & GetInstance(void)
Create at first time the Singleton.
Definition: GGEMSProcessesManager.hh:60
GGEMSMisc::ThrowException
void ThrowException(std::string const &class_name, std::string const &method_name, std::string const &message)
Throw a C++ exception.
Definition: GGEMSTools.cc:61
GGfloat
#define GGfloat
Definition: GGEMSTypes.hh:273
GGEMSOpenCLManager::GetInstance
static GGEMSOpenCLManager & GetInstance(void)
Create at first time the Singleton.
Definition: GGEMSOpenCLManager.hh:72
GGEMSRangeCuts::BuildMaterialLossTable
void BuildMaterialLossTable(GGEMSMaterialTables *material_table, GGushort const &index_mat)
Build loss table for material in case of electron and positron.
Definition: GGEMSRangeCuts.cc:244
GGEMSLogEnergyTable.hh
GGEMS class computing log table for cut convertion from length to energy.