4#include "KVedaLossMaterial.h"
6#include "KVIonRangeTable.h"
9#include "KVedaLossInverseRangeFunction.h"
23 fEmin(ZMAX_VEDALOSS), fEmax(ZMAX_VEDALOSS), fCoeff(ZMAX_VEDALOSS, std::vector<
Double_t>(14))
26 for (
int i = 0; i < ZMAX_VEDALOSS; i++) {
41 fEmin(ZMAX_VEDALOSS), fEmax(ZMAX_VEDALOSS), fCoeff(ZMAX_VEDALOSS, std::vector<
Double_t>(14))
45 for (
int i = 0; i < ZMAX_VEDALOSS; i++) {
100 if (!fgets(
line, 132, fp)) {
101 Warning(
"ReadRangeTable",
"Problem reading energy limits in range table file for %s (%s)",
106 if (!strncmp(
line,
"COMPOUND", 8)) {
108 if (fgets(
line, 132, fp)) {}
109 int nel = atoi(
line);
110 for (
int el = 0; el < nel; el++) {
111 if (fgets(
line, 132, fp)) {}
113 sscanf(
line,
"%d %d %d", &z, &
a, &
w);
117 else if (!strncmp(
line,
"MIXTURE", 7)) {
119 if (fgets(
line, 132, fp)) {}
120 int nel = atoi(
line);
121 for (
int el = 0; el < nel; el++) {
122 if (fgets(
line, 132, fp)) {}
125 sscanf(
line,
"%d %d %d %f", &z, &
a, &nat, &
w);
130 if (!fgets(
line, 132, fp)) {
131 Warning(
"ReadRangeTable",
"Problem reading energy limits in range table file for %s (%s)",
136 while (
line[0] ==
'Z') {
139 if (sscanf(
line,
"Z = %d,%d %f < E/A < %f MeV", &z1,
140 &z2, &e1, &e2) != 4) {
141 Error(
"ReadRangeTable",
"Problem reading energy limits in range table file for %s (%s)",
146 if (!fgets(
line, 132, fp))
break;
147 for (
int i = z1; i <= z2; i++) {
152 if (
line[0] ==
'\0') {
153 Error(
"ReadRangeTable",
"Problem with range table file for %s (%s)",
163 0., 1.e+03, 0,
"KVedaLossMaterial",
"RangeFunc");
167 0., 1.e+03, 0,
"KVedaLossMaterial",
"StoppingFunc");
170 my_npx =
gEnv->
GetValue(
"KVedaLoss.EnergyLoss.Npx", 100);
172 0., 1.e+03, 0,
"KVedaLossMaterial",
"DeltaEFunc");
175 my_npx =
gEnv->
GetValue(
"KVedaLoss.ResidualEnergy.Npx", 100);
177 0., 1.e+03, 0,
"KVedaLossMaterial",
"EResFunc");
180 for (
int count = 0; count < ZMAX_VEDALOSS; count++) {
182 if (sscanf(
line,
"%lf %lf %lf %lf %lf %lf %lf %lf",
188 Error(
"ReadRangeTable",
"problem reading coeffs 0-7 in range table for %s (%s)",
GetName(),
GetType());
191 if (!fgets(
line, 132, fp)) {
196 if (sscanf(
line,
"%lf %lf %lf %lf %lf %lf",
201 Error(
"ReadRangeTable",
"problem reading coeffs 8-13 in range table for %s (%s)",
GetName(),
GetType());
225 if (fgets(
line, 132, fp)) {}
304 for (
int j = 2; j < 7; j++)
309 for (
int jj = 2; jj < 7; jj++)
316 if (isoAmat > 0.0)
riso *= (isoAmat /
fAmat);
353 for (
int j = 2; j < 7; j++)
358 for (
int jj = 2; jj < 7; jj++)
365 if (isoAmat > 0.0)
riso *= (isoAmat /
fAmat);
389 ran = (*par)[2] + (*par)[3] *
DLEP;
421 ran = (*par)[2] + (*par)[3] *
DLEP;
423 for (
int i = 4; i < 8; i++) {
484 if (Z == 0)
return 0.0;
504 if (Z == 0)
return 0.0;
525 if (Z == 0)
return 0.0;
545 if (Z == 0)
return 0.0;
564 if (Z == 0)
return 0.0;
590 rangepar = std::vector<Double_t>(
fCoeff[Zion - 1].begin() + 2,
fCoeff[Zion - 1].
end());
591 Aion =
fCoeff[Zion - 1][1];
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t TPoint TPoint const char y1
char * Form(const char *fmt,...)
virtual const Char_t * GetType() const
Material for use in energy loss & range calculations.
void AddCompoundElement(Int_t Z, Int_t A, Int_t Natoms)
TF1 * fDeltaE
function parameterising energy loss in material
void AddMixtureElement(Int_t Z, Int_t A, Int_t Natoms, Double_t Proportion)
Double_t fAmat
effective mass number of material
TF1 * fEres
function parameterising residual energy after crossing material
TF1 * fRange
function parameterising range of charged particles in material
TF1 * fStopping
function parameterising stopping power of charged particles in material
Double_t fRangeOfLastDE
range corresponding to last calculated DE
Abstract base class for calculation of range & energy loss of charged particles in matter.
Dedicated optimised inversion of range-energy function for KVedaLoss.
Description of material in the KVedaLoss range table.
Double_t EResFunc(Double_t *, Double_t *)
TObjArray fInvRange
KVedaLossInverseRangeFunction objects.
Float_t GetEminValid(Int_t Z, Int_t A) const
virtual Double_t GetEResOfIon(Int_t Z, Int_t A, Double_t E, Double_t e, Double_t isoAmat=0.)
static KVedaLoss * fgTable
Double_t thickness
in g/cm**2
virtual TF1 * GetDeltaEFunction(Double_t e, Int_t Z, Int_t A, Double_t isoAmat=0)
virtual Double_t GetDeltaEOfIon(Int_t Z, Int_t A, Double_t E, Double_t e, Double_t isoAmat=0.)
Double_t StoppingFunc(Double_t *, Double_t *)
Bool_t ReadRangeTable(FILE *fp)
Double_t RF_Z
internal variables used by RangeFunc/DeltaEFunc
std::vector< Double_t > fEmin
Z-dependent minimum energy/nucleon for calculation to be valid.
virtual TF1 * GetRangeFunction(Int_t Z, Int_t A, Double_t isoAmat=0)
virtual ~KVedaLossMaterial()
Destructor.
Double_t RangeFunc(Double_t *, Double_t *)
std::vector< Double_t > fEmax
Z-dependent maximum energy/nucleon for calculation to be valid.
virtual Double_t GetRangeOfIon(Int_t Z, Int_t A, Double_t E, Double_t isoAmat=0.)
static Bool_t fNoLimits
if kTRUE, ignore max E limit for validity of calculation
virtual Double_t GetPunchThroughEnergy(Int_t Z, Int_t A, Double_t e, Double_t isoAmat=0.)
void GetParameters(Int_t Zion, Int_t &Aion, std::vector< Double_t > &rangepar)
std::vector< Double_t > * par
Double_t DeltaEFunc(Double_t *, Double_t *)
KVedaLossMaterial()
Default constructor.
virtual TF1 * GetStoppingFunction(Int_t Z, Int_t A, Double_t isoAmat=0)
Float_t GetEmaxValid(Int_t Z, Int_t A) const
std::vector< std::vector< Double_t > > fCoeff
parameters for range tables
virtual Double_t GetEIncFromEResOfIon(Int_t Z, Int_t A, Double_t Eres, Double_t e, Double_t isoAmat=0.)
virtual TF1 * GetEResFunction(Double_t e, Int_t Z, Int_t A, Double_t isoAmat=0)
C++ implementation of VEDALOSS stopping power calculation.
static Bool_t IsUseNewRangeInversion()
virtual void SetOwner(Bool_t enable=kTRUE)
virtual const char * GetValue(const char *name, const char *dflt) const
virtual Double_t GetMinimumX(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
virtual void SetRange(Double_t xmin, Double_t xmax)
virtual void SetNpx(Int_t npx=100)
virtual Double_t GetX(Double_t y, Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
virtual Double_t GetMaximumX(Double_t xmin=0, Double_t xmax=0, Double_t epsilon=1.E-10, Int_t maxiter=100, Bool_t logx=false) const
const char * GetName() const override
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
Double_t Min(Double_t a, Double_t b)
Double_t Power(Double_t x, Double_t y)
Double_t Max(Double_t a, Double_t b)
#define R0(v, w, x, y, z, i)