Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

libcpixe.h File Reference

#include "compilopt.h"

Go to the source code of this file.

Data Structures

struct  ELEMENT
struct  COMPOUND
struct  SPT
struct  absorber
struct  SIM_PARAM
struct  EXP_PARAM
struct  EXTRAINFO
struct  PeakArea
struct  CalibYld
struct  XrayYield
struct  FluorCKCoef
struct  SRType
struct  SecResType
struct  ESxType
struct  foil
struct  LYR
struct  AbsCoef
struct  FILTER
struct  CPIXERESULTS
struct  SFCListElem

Defines

#define LONGSTRINGLENGTH   256
#define FILENMLENGTH   LONGSTRINGLENGTH
#define DEG2RAD   (M_PI/180.0)
#define MEVAMU   931.52181
#define UATMASS   (1./1822.887)
#define BARNTOM2   1.0e-28

Typedefs

typedef char STATFILENAME [FILENMLENGTH]
 Fixed length string for use with filenames.
typedef char ChemSymb [3]
 Fixed length string for use with chem. symbols.
typedef int atomicnumber
 Convenient definition of atomic numbers as ints.
typedef double SecXL [4]
typedef ELEMENT ELEMENT
typedef COMPOUND COMPOUND
typedef SPT SPT
typedef absorber absorber
typedef SIM_PARAM SIM_PARAM
typedef EXP_PARAM EXP_PARAM
typedef EXTRAINFO EXTRAINFO
typedef PeakArea PeakArea
typedef CalibYld CalibYld
typedef XrayYield XrayYield
typedef FluorCKCoef FluorCKCoef
typedef SRType SRType
typedef SecResType SecResType
typedef ESxType ESxType
typedef foil foil
typedef AbsCoef AbsCoef
typedef FILTER FILTER
typedef CPIXERESULTS CPIXERESULTS
typedef SFCListElem SFCListElem

Enumerations

enum  FwTipo { K, L, M }

Functions

void testlib (int **testarray, int *n)
int symbol2Z (char *symbol)
int Z2mass (int Z, double *mass, char option)
int readCOMPOUND (FILE *f, int nelem, COMPOUND *c)
int readINPUT (const char *InputFileNm, EXP_PARAM *pexppar, EXTRAINFO *pExtraInfo)
int readEXP_PARAM (char *ExpParFileNm, EXP_PARAM *pexppar)
int readSIM_PARAM (char *SampleParamFileNm, SIM_PARAM *simpar, char *IniMatFileNm, char *FilterFileNm, char *XYldFileNm)
int readsample (char *SampleDefFileNm, int *MaxZ, int *NFoil, foil **Sample)
int readFilter (const char *FilterDefFileNm, FILTER *Filter)
int createPresentElems (int MaxZ, int NFoil, const foil *MatArray, int **PresentElems)
int readCalcFlags (const char *CalcFlagsFileNm, const int *PresentElems, int MaxZinsample, int AreasFormat, CPIXERESULTS **CalcFlags)
int readXYld (const char *XYldFileNm, const int *PresentElems, const CPIXERESULTS *CalcFlags, int MaxZinsample, double *CalEner, XrayYield **XYldArray)
int readFCK (char *FCKCoefFileNm, int MaxZinsample, FluorCKCoef **FCKCoefArray)
int readAbsCoef (char *TotAbsCoefFileNm, int MaxZinsample, const int *PresentElems, const FILTER *Filter, AbsCoef **TotAbsCoefArray)
int createSPTs (const char *path, const EXP_PARAM *pexp, int MaxZinsample, const int *PresentElems, double step, SPT **SPTArray)
double getSP (const COMPOUND *pcmp, const SPT *SPTArray, double E)
int initlyrarray (const EXP_PARAM *pexp, const foil *MatArray, const XrayYield *XYldArray, const AbsCoef *TotAbsCoefArray, const SPT *SPTArray, const int *PresentElems, int NFoil, int *NFoilUsed, LYR **plyrarray)
int initlyr (const EXP_PARAM *pexp, const XrayYield *XYldArray, const AbsCoef *TotAbsCoefArray, const int *PresentElems, LYR *plyr, double *MACoef)
int FilterTrans (const EXP_PARAM *pexp, const XrayYield *XYldArray, const AbsCoef *TotAbsCoefArray, const int *PresentElems, FILTER *Filter)
int Transmission (const XrayYield *XYldArray, const AbsCoef *TotAbsCoefArray, int Z, const foil *pFoil, double geomcorr, const CalibYld *pTransOld, CalibYld *pTrans)
double TotAbsor (const AbsCoef *TotAbsCoefArray, const COMPOUND *cmp, double Xray)
double TotAbsor_elemental (int iener, const AbsCoef *Absco, int Z, double Xray)
int createsublyrs (const EXP_PARAM *pexp, const foil *pMat, const SPT *SPTArray, double MajAbsCoef, LYR *plyr)
int SSThick (const EXP_PARAM *pexp, const foil *pMat, const SPT *SPTArray, double MajAbsCoef, double LayerThickness, ESxType ESxin, ESxType *ESxfin, int *pFpos, double *thick, ESxType **ESxA)
int integrate_Simpson (const EXP_PARAM *pexp, const AbsCoef *TotAbsCoefArray, const FluorCKCoef *FCKCoefArray, const XrayYield *XYldArray, int NFoilUsed, const FILTER *Filter, LYR *plyrarray, CalibYld *XYldSums)
int Xprod (const AbsCoef *AbsC, const FluorCKCoef *pFCK, atomicnumber Z1, atomicnumber Z2, double M2, double ener, CalibYld *XYld)
double PaulX (double ener, atomicnumber z)
double PaulX_y (double MeV, atomicnumber z)
double PaulX_lp (double x, long p)
int ReisX (const AbsCoef *AbsC, const FluorCKCoef *pFCK, double ener, atomicnumber z, double M2, double *sigmaXL)
double ReisX_gs (FwTipo T, int SS, double ksis)
double ReisX_hs (FwTipo T, int SS, double ksih, double thet)
double ReisX_En (double z, int niu)
double ReisX_polisec (int ssind, double kz, double tz)
double ReisX_g (int ss, atomicnumber Zg, double xi)
void PenInteg (atomicnumber atnumb, const CalibYld *absc, const ESxType *ESA, const CalibYld *YldA, const CalibYld *TrsA, const CalibYld *pTrs0, int FExlen, int NeedSFC, int AllowXEqCalc, double x0, double CosInc, CalibYld *XYld, CalibYld *XSFCr, CalibYld *XYldxmed)
double Simps (double a, double b, double fa, double fi, double fb)
void deNormalize (const EXP_PARAM *pexp, const AbsCoef *AbsC, const FluorCKCoef *pFCK, atomicnumber Z2, double M2, double attfraction, const CalibYld *pXYld, XrayYield *ResY, CalibYld *XYldSum)
void freeFilter (FILTER *Filter)
void freeReusable (int NFoils, LYR **plyrarray, foil **MatArray, CalibYld **XYldSums)
void safefree (void **ptr)
void fprintCALIBYLD (FILE *f, const CalibYld *pCYld)
int createSFCList (const EXP_PARAM *pexp, const int *PresentElems, const XrayYield *XYldArray, const AbsCoef *TotAbsCoefArray, int *dimList, SFCListElem **SFCList)
int needSFC (atomicnumber Za, atomicnumber Zb, const CalibYld *enerA, const AbsCoef *AbsC, int *dimList, SFCListElem **SFCList)
double sigmaphoto (int iabs, const AbsCoef *AbsC, atomicnumber Zb, double Xray)
int inrange (double value, double min, double max)

Variables

const atomicnumber minK = 11 maxK = 54 minL = 30 minM = 60
const CalibYld CYldNul
char LineNm [6][4][11]


Detailed Description

libcpixe.h is the header file for the LibCPIXE library. All constants, structs, and functions are declared here. This must be included by any program using libcpixe.c

Definition in file libcpixe.h.


Define Documentation

#define BARNTOM2   1.0e-28
 

Definition at line 42 of file libcpixe.h.

#define DEG2RAD   (M_PI/180.0)
 

Definition at line 36 of file libcpixe.h.

Referenced by cpixecalib(), and cpixemain().

#define FILENMLENGTH   LONGSTRINGLENGTH
 

Definition at line 33 of file libcpixe.h.

Referenced by cpixecalib(), cpixemain(), and createSPTs().

#define LONGSTRINGLENGTH   256
 

Todo:
Modify fscanf functions to check for length when reading filenames of fixed maximum length

Definition at line 32 of file libcpixe.h.

Referenced by readINPUT().

#define MEVAMU   931.52181
 

Definition at line 38 of file libcpixe.h.

#define UATMASS   (1./1822.887)
 

Definition at line 39 of file libcpixe.h.


Typedef Documentation

typedef struct AbsCoef AbsCoef
 

X-ray Absortion coefficients

typedef struct absorber absorber
 

Filter description

Todo:
document this structure

typedef int atomicnumber
 

Convenient definition of atomic numbers as ints.

Definition at line 49 of file libcpixe.h.

typedef struct CalibYld CalibYld
 

L,K & M lines intensities

Referenced by initlyr(), and integrate_Simpson().

typedef char ChemSymb[3]
 

Fixed length string for use with chem. symbols.

Definition at line 47 of file libcpixe.h.

Referenced by readAbsCoef(), readCalcFlags(), readFCK(), readXYld(), and symbol2Z().

typedef struct COMPOUND COMPOUND
 

Compound formed by various elements

typedef struct CPIXERESULTS CPIXERESULTS
 

Calculated areas for a given element.

typedef struct ELEMENT ELEMENT
 

Chemical element

typedef struct ESxType ESxType
 

Todo:
document this structure

typedef struct EXP_PARAM EXP_PARAM
 

Experimental parameters

typedef struct EXTRAINFO EXTRAINFO
 

Structure for passing info read during from input files

typedef struct FILTER FILTER
 

Definition of absorber filter. The filter can be defined in 2 alternative ways: 1.- Just like a you define a sample, layer by layer (the transmission being calculated for each relevant line). 2.- Defining its transmission function by giving a series of coefficients that fit T(E) (this was the default way in DATPIXE).

typedef struct FluorCKCoef FluorCKCoef
 

Fluorescence and Coster-Kronig coefficients

typedef struct foil foil
 

Basic sample foil description

typedef struct PeakArea PeakArea
 

Peak areas

typedef struct SecResType SecResType
 

Todo:
document this structure

typedef double SecXL[4]
 

Definition at line 61 of file libcpixe.h.

Referenced by ReisX(), and Xprod().

typedef struct SFCListElem SFCListElem
 

Each element which fluoresces knows which elements (and which lines) are the origin

typedef struct SIM_PARAM SIM_PARAM
 

Simulation parameters

typedef struct SPT SPT
 

Stopping Power Table. This is a modified version from that in hotstop.h

typedef struct SRType SRType
 

Todo:
document this structure

typedef char STATFILENAME[FILENMLENGTH]
 

Fixed length string for use with filenames.

Definition at line 45 of file libcpixe.h.

Referenced by cpixecalib(), cpixemain(), CPIXEMAIN(), and main().

typedef struct XrayYield XrayYield
 

Emission energies and other ...

Todo:
document this structure


Enumeration Type Documentation

enum FwTipo
 

Enumeration values:
K 
L 
M 

Definition at line 63 of file libcpixe.h.

Referenced by ReisX().


Function Documentation

int createPresentElems int  MaxZ,
int  NFoil,
const foil MatArray,
int **  PresentElems
 

Creates an array of integer flags indicating whether an element is present in the sample (1) or not (0). The dimension of the array is that of the maximum atomic number present in the sample. For example, if the sample contains only C and Si, the array will be: PresentElems[6]= PresentElems[14]=1 (and all the other=0)

Parameters:
MaxZ (I) Largest atomic number present in sample (Dimension of PresentElems).
NFoil (I) Number of target foils
MatArray (I) Array of foils defining the current sample
PresentElems (O) Pointer to array of flags indicating presence for each element
Returns:
Always 0

Definition at line 732 of file libcpixe.c.

References foil::comp, COMPOUND::elem, COMPOUND::nelem, and ELEMENT::Z.

Referenced by cpixecalib(), cpixemain(), CPIXEMAIN(), and readFilter().

int createSFCList const EXP_PARAM pexp,
const int *  PresentElems,
const XrayYield XYldArray,
const AbsCoef TotAbsCoefArray,
int *  dimList,
SFCListElem **  SFCList
 

Definition at line 36 of file sfc.c.

References SIM_PARAM::MaxZinsample, needSFC(), and EXP_PARAM::simpar.

Referenced by cpixemain().

int createSPTs const char *  path,
const EXP_PARAM pexp,
int  MaxZinsample,
const int *  PresentElems,
double  step,
SPT **  SPTArray
 

Generates the stopping force tables Returns an array of pointers referencing to one table for each element present in sample)

IMPORTANT: The tables are generated in the following units: keV/(1e15at/cm2) !!!

Parameters:
path (I) String containing the path to look for the data base files. (e.g. for SCOEF.95A and SCOEF95B in the case of ZBL96 stoppings) Note that the path MUST contain the last "directory separator"
pexp (I) Pointer to structure containing experimental parameters.
MaxZinsample (I) Largest atomic number present in sample.
PresentElems (I) Array of flags indicating presence for each element. See createPresentElems()
step (I) Energy step to be used (in keV) in the case of linear energy scale or the multiplicative factor in the case logarithmic energy scale.
SPTArray (O) Array of Stopping power table structs for each present element. IMPORTANT: The tables are generated in the following units: keV/(1e15at/cm2) !!!
Returns:
Always 0

Todo:
readstopcoef assumes that the files SCOEF.95A and SCOEF.95B are located where the program is called. This must be generalized (In fact, the coefficients could be hardcoded using an include file)

<For the moment, only linear Energy scale is implemented

Definition at line 1290 of file libcpixe.c.

References EXP_PARAM::BeamEner, SPT::dSdE, SPT::E, SPT::Emax, SPT::Estep, FILENMLENGTH, ELEMENT::IM, EXP_PARAM::ion, SPT::logmode, SPT::nrows, nuclearstopping_ZBL(), readstopcoef(), SPT::S, SPT::Smax, stop96d(), and ELEMENT::Z.

Referenced by cpixecalib(), cpixemain(), and CPIXEMAIN().

int createsublyrs const EXP_PARAM pexp,
const foil pMat,
const SPT SPTArray,
double  MajAbsCoef,
LYR plyr
 

Manages the creation of internal sublayers in each layer

Parameters:
pexp (I) Pointer to structure containing experimental parameters.
pMat (I) Pointer to current foil structure.
SPTArray (I) Pointer to precalculated tables of stoppings (see createSPT() )
MajAbsCoef (I) Maximum absorption coef for this layer.
plyr (I+O) Pointer to current layer struct.
Returns:
Always 0

Todo:
Discuss this initialization with M.R.

Definition at line 1807 of file libcpixe.c.

References foil::comp, EXP_PARAM::cosInc, COMPOUND::elem, ESxType::ep, LYR::ESxArray, LYR::FESxlen, EXP_PARAM::FinalEner, LYR::FoilInEner, LYR::FoilOutEner, getSP(), foil::nfoilelm, SPT::Smax, SSThick(), ESxType::stpp, foil::thick, LYR::ThickIn, ESxType::x, COMPOUND::xn, and ELEMENT::Z.

Referenced by initlyrarray().

void deNormalize const EXP_PARAM pexp,
const AbsCoef AbsC,
const FluorCKCoef pFCK,
atomicnumber  Z2,
double  M2,
double  attfraction,
const CalibYld pXYld,
XrayYield ResY,
CalibYld XYldSum
 

Calculates the yield values using the penetration integral results, i.e. Applies all the factors such as solid angle, atomic fraction, charge,... etc

See eq. (1) of "Reis et al. NIM B 109/110 (1996) 134-138"

Todo:
This function does not support M-lines

Note: This function is only valid for 10 Z2 in range [10,99]

Parameters:
pexp (I) Pointer to structure containing experimental parameters.
AbsC (I) Pointer to Absorption coef structure for element with Z2
pFCK (I) pointer to Fluorescence and Coster-Kronig coefficients for Z2
Z2 (I) atomic number of the target element
M2 (I) mass of the target element
attfraction (I) atomic fraction of the target element in the current layer
pXYld (I) Penetration integral values.
ResY (I+O) The calculated yields (in counts) for each layer will be returned in ResY->XYld
XYldSum (O) The total yield (sum for all layers processed up to this moment of ResY->XYld) is acumulated in XYldSum.
Note: deNormalize() returns both the partial and the total spectra through ResY->XYld and XYldSum, respectively.

Todo:
do this part when the filters are supported

Check hardcoded Z limits

Check hardcoded Z limits

Check hardcoded Z limits

Support also M lines here

Definition at line 2995 of file libcpixe.c.

References XrayYield::atnum, SIM_PARAM::CalEner, SIM_PARAM::ColCharge, EXP_PARAM::DetColFac, SIM_PARAM::DTCC, EXP_PARAM::ion, CalibYld::K_, CalibYld::L_, CalibYld::M_, EXP_PARAM::simpar, SIM_PARAM::useFilter, Xprod(), XrayYield::XYld, and ELEMENT::Z.

Referenced by integrate_Simpson().

int FilterTrans const EXP_PARAM pexp,
const XrayYield XYldArray,
const AbsCoef TotAbsCoefArray,
const int *  PresentElems,
FILTER Filter
 

Todo:
Document this function

Definition at line 1609 of file libcpixe.c.

References FILTER::dimTrans, FILTER::foil, FILTER::geomcorr, SIM_PARAM::MaxZinsample, FILTER::nlyr, EXP_PARAM::simpar, FILTER::Trans, and Transmission().

Referenced by cpixecalib(), cpixemain(), and CPIXEMAIN().

void fprintCALIBYLD FILE *  f,
const CalibYld pCYld
 

Prints a CalibYld structure on a given stream

Parameters:
f (I+O) Stream to which the structure is printed
pCYld (I) Structure to print

Definition at line 3203 of file libcpixe.c.

References CalibYld::K_, CalibYld::L_, and CalibYld::M_.

Referenced by cpixecalib().

void freeFilter FILTER Filter  ) 
 

Frees all memory allocated for the filter structure.

Parameters:
Filter (I+O) Pointer to filter structure.

Definition at line 3122 of file libcpixe.c.

References foil::comp, COMPOUND::elem, FILTER::FilterElems, FILTER::foil, FILTER::nlyr, safefree(), FILTER::Trans, COMPOUND::w, COMPOUND::X, and COMPOUND::xn.

Referenced by cpixecalib(), cpixemain(), and CPIXEMAIN().

void freeReusable int  NFoils,
LYR **  plyrarray,
foil **  MatArray,
CalibYld **  XYldSums
 

Frees the space allocated for arrays that are to be reused in subsequent iterations

Parameters:
NFoils (I) Number of target foils
plyrarray (I+O) Pointer to array of layers. Dim=NFoils+1
MatArray (I+O) Pointer to array of foils. Dim=NFoils
XYldSums (I+O) Pointer to the Output Array of summed X-Ray Yields

Definition at line 3148 of file libcpixe.c.

References foil::comp, COMPOUND::elem, LYR::ESxArray, LYR::NeedSFC, LYR::ResYldArray, safefree(), LYR::SecResArray, LYR::SSTrsArray, LYR::SSYldArray, LYR::Trans, LYR::TrcAtnum, LYR::TrcUse, COMPOUND::w, COMPOUND::X, and COMPOUND::xn.

Referenced by cpixecalib(), cpixemain(), and CPIXEMAIN().

double getSP const COMPOUND pcmp,
const SPT SPTArray,
double  E
 

Returns stopping Using previously calculated tables. Performs a linear interpolation and a Bragg adition.

Parameters:
pcmp (I) Pointer to target definition
SPTArray (I) Pointer to precalculated tables of stoppings (see createSPT() )
E (I) Energy of the ion, in keV
Returns:
Stopping Power, in keV/(1e15at/cm2) IMPORTANT!!! note that it's keV and ot eV

Definition at line 1361 of file libcpixe.c.

References SPT::dSdE, SPT::E, COMPOUND::elem, SPT::Estep, COMPOUND::nelem, SPT::S, COMPOUND::xn, and ELEMENT::Z.

Referenced by createsublyrs(), and SSThick().

int initlyr const EXP_PARAM pexp,
const XrayYield XYldArray,
const AbsCoef TotAbsCoefArray,
const int *  PresentElems,
LYR plyr,
double *  MACoef
 

Initializes ONE given layer. It allocates space for various arrays and sets initial values for TrcUse, ResYldArray,... It also calculates the absorption and returns the Maximum absorption coefficient (MACoef).

Note: it uses the global vars minK, maxK, minM, minL,...

Parameters:
pexp (I) Pointer to structure containing experimental parameters.
XYldArray (I) Array of Xray yield coefs. See readXYld()
TotAbsCoefArray (I) Array containing a tables of Absorption Coefs (see readAbsCoef() )
plyr (I+O) Pointer to current layer struct.
PresentElems (O) Pointer to array of flags indicating presence for each element
MACoef (I+O) Maximum absorption coefficient to be used in calcs (presently only cares about K&Lcoefs)
Returns:
Always 0

CAUTION: Change with respect to CDT: TrcUse now starts with index 0

CAUTION: Change with respect to CDT: NeedSFC now starts with index 0

Note:

Todo:
plyr->NeedSFC is just a convenience pointer to the Sample-general NeedSFC. This should be changed and not used, but for the moment it works.

TODO:Check why was the following line commented out (in the Pascal Code):

CAUTION: Change with respect to CDT: TrcAtnum now starts with index 0

Note: At this point in the CDT code, CalYld is defined, but it makes no sense since it is just a copy of XYldArray[].XYld (which is already there and never changing... So whenever CalYld[i] is needed, use XYldArray[i].XYld instead

Definition at line 1456 of file libcpixe.c.

References SRType::AbsFact, PeakArea::area, XrayYield::atnum, PeakArea::atnum, CalibYld, foil::comp, EXP_PARAM::cosDet, LYR::dimTrans, COMPOUND::elem, XrayYield::ener, CalibYld::K_, CalibYld::L_, CalibYld::M_, SIM_PARAM::MaxZinsample, LYR::NeedSFC, foil::nfoilelm, LYR::NumOfTrc, LYR::pFoil, SecResType::Pk, LYR::ResYldArray, LYR::SecResArray, EXP_PARAM::simpar, SecResType::SR, TotAbsor(), LYR::Trans, Transmission(), LYR::TrcAtnum, LYR::TrcUse, and ELEMENT::Z.

Referenced by initlyrarray().

int initlyrarray const EXP_PARAM pexp,
const foil MatArray,
const XrayYield XYldArray,
const AbsCoef TotAbsCoefArray,
const SPT SPTArray,
const int *  PresentElems,
int  NFoil,
int *  NFoilUsed,
LYR **  plyrarray
 

Initializes the lyr array

Parameters:
pexp (I) Pointer to structure containing experimental parameters.
MatArray (I) Array of foils defining the current sample
XYldArray (I) Array of Xray yield coefs. See readXYld()
TotAbsCoefArray (I) Array containing a tables of Absorption Coefs (see readAbsCoef() )
SPTArray (I) Pointer to precalculated tables of stoppings (see createSPT() )
NFoil (I) Number of target foils
PresentElems (O) Pointer to array of flags indicating presence for each element
NFoilUsed (O) Number of foils finally used in the calcs
plyrarray (O) Pointer to the layer array.
Returns:
Always 0

Definition at line 1391 of file libcpixe.c.

References LYR::absolutepos, EXP_PARAM::BeamEner, createsublyrs(), EXP_PARAM::FinalEner, LYR::FoilInEner, LYR::FoilOutEner, initlyr(), LYR::pFoil, and LYR::ThickIn.

Referenced by cpixecalib(), cpixemain(), and CPIXEMAIN().

int inrange double  value,
double  min,
double  max
 

Checks if a value is within limits

Parameters:
value (I) Value to check
min (I) minimum limit
max (I) maximum limit
Returns:
1 if value is inside range, 0 otherwise

Definition at line 244 of file sfc.c.

Referenced by needSFC().

int integrate_Simpson const EXP_PARAM pexp,
const AbsCoef TotAbsCoefArray,
const FluorCKCoef FCKCoefArray,
const XrayYield XYldArray,
int  NFoilUsed,
const FILTER Filter,
LYR plyrarray,
CalibYld XYldSums
 

Performs Calculation of Transmission and Yields and then calculates the Penetration Integral. Uses Simpson integration method.

TotAbsCoefArray XYldSums (O)is a matrix which contains, for each element, the total sum of XRayYlds for the whole sample.

Todo:
document this function
NOTE: This function uses the global vars maxK, minM & minL

Definition at line 1974 of file libcpixe.c.

References SRType::AbsFact, LYR::absolutepos, SIM_PARAM::AllowXEqCalc, CalibYld, foil::comp, EXP_PARAM::cosFac, EXP_PARAM::cosInc, deNormalize(), ESxType::ep, LYR::ESxArray, LYR::FESxlen, EXP_PARAM::ion, CalibYld::K_, CalibYld::L_, CalibYld::M_, LYR::NeedSFC, LYR::NumOfTrc, PenInteg(), LYR::pFoil, LYR::ResYldArray, LYR::SecResArray, SRType::SFCr, EXP_PARAM::simpar, SecResType::SR, LYR::SSTrsArray, LYR::SSYldArray, LYR::Trans, FILTER::Trans, LYR::TrcAtnum, LYR::TrcUse, ESxType::x, SRType::Xeq, COMPOUND::xn, Xprod(), XrayYield::XYld, ELEMENT::Z, and Z2mass().

Referenced by cpixecalib(), cpixemain(), and CPIXEMAIN().

int needSFC atomicnumber  Za,
atomicnumber  Zb,
const CalibYld enerA,
const AbsCoef AbsC,
int *  nSFCList,
SFCListElem **  SFCList
 

<

<

Todo:
135=9x15 (absorption lines x emission_lines). If more lines or absorptions are added, this should be raised. Note that a conditional compilation for the case in which M absorption lines are not used, could reduce it to 4x15 or even to 4x12 if M emission lines are neither considered.

Only K and L absorption lines are considered (since M lines are hard to quantify anyway, we don't waste time). If SFC is desired for M lines too, change nabs to 9 here. Also, a conditional compilation could be implemented depending on a preproc variable called ,i.e., QUANTIFYMLINES

In case M emission lines should not be considered for SFC, this for loop can be eliminated by a conditional compilation

Definition at line 58 of file sfc.c.

References SFCListElem::abs, SFCListElem::Ea, AbsCoef::enr, SFCListElem::epri, SFCListElem::esec, inrange(), CalibYld::K_, CalibYld::L_, CalibYld::M_, SFCListElem::sigmaphoto, sigmaphoto(), SFCListElem::Za, and SFCListElem::Zb.

Referenced by createSFCList().

double PaulX double  ener,
atomicnumber  z
 

Parameters:
ener 
z Atomic number of Target
Returns:
X-ray cross-section, in barn

Todo:
Document this function (description, units for ener & return and references)

This function only works for proton beams!!

Definition at line 2231 of file libcpixe.c.

References PaulX_lp(), and PaulX_y().

Referenced by Xprod().

double PaulX_lp double  x,
long  p
 

Parameters:
x 
p 
Returns:

Todo:
Document this function (description, units for ener & return and references)

Definition at line 2327 of file libcpixe.c.

Referenced by PaulX().

double PaulX_y double  MeV,
atomicnumber  z
 

Parameters:
MeV Energy of the ion, in MeV
z Atomic number of Target
Returns:

Todo:
Document this function (description, units for ener & return and references)

This function only works for proton beams!!

Definition at line 2305 of file libcpixe.c.

Referenced by PaulX().

void PenInteg atomicnumber  atnumb,
const CalibYld AbsFac,
const ESxType ESA,
const CalibYld YldA,
const CalibYld TrsA,
const CalibYld pTrs0,
int  FExlen,
int  NeedSFC,
int  AllowXEqCalc,
double  x0,
double  CosInc,
CalibYld XYld,
CalibYld XSFCr,
CalibYld XYldxmed
 

Calculates a normalized "Penetration Integral" for a given X-ray emission line of a given element. See "Reis et al. NIM B 109/110 (1996) 134-138" See section 1.4 of "Correccoes de Fluorescencia Secundaria em PIXE" Master Thesis by M.A. Reis

It calculates the integral of eq. (4) of the cited paper except that it does not include the normalization constant "sigmaX_ij(Ep)"

Parameters:
atnumb (I) Atomic number of the target element
AbsFac (I) Absorption coefficients structure for the target element
ESA (I) Pointer to Array of sublayers in the current layer.
YldA (I) Array of X-ray production cross section for the target element in each sublayer
TrsA (I) Array of Transmission coefs for the target element in each sublayer
pTrs0 (I) Array of Transmission factors due tolayers over the one we are considering.
FExlen (I) Number of sublayers in this layer
NeedSFC (I) Flag indicating whether secondary fluorescence should be calculated (1) or not (0)
AllowXEqCalc (I) Flag indicating whether "equivalent thickness" should be calculated (1) or not (0)
x0 (I) absolute in-going path length, in 1e15at/cm2, from sample surface (Only relevant if AllowXEqCalc=1)
CosInc Cosine of the incident angle (Only relevant if AllowXEqCalc=1)
XYld (O) Penetration integral results.
XSFCr (O) Correction factor applied due to secondary fluorescence (Only relevant if NeedSFC=1)
XYldxmed (O) Equivalent thickness results (Only relevant if AllowXEqCalc=1)

Todo:
IMPORTANT: check here the use of cosInc in relation with the definition of x0

Definition at line 2782 of file libcpixe.c.

References ESxType::ep, CalibYld::K_, CalibYld::L_, CalibYld::M_, Simps(), ESxType::stpp, and ESxType::x.

Referenced by integrate_Simpson().

int readAbsCoef char *  TotAbsCoefFileNm,
int  MaxZinsample,
const int *  PresentElems,
const FILTER Filter,
AbsCoef **  TotAbsCoefArray
 

Reads from an ascii file the X-ray Absorption coefficients. The File must have the following format: Note: the index of TotAbsCoefArray starts in 1.

----------------- (any header)

MAXZ [maxZ]

DATA (datablocks) -----------------

The datablock for each element has the following structure:

[atnum] [chemsymb]

(23 coefs each one for a given standard energy (see stdtable in TotAbsor() ) [stdcoef[0]]....[stdcoef[22]]

(9 triplets --1 for K, 3 for L and 5 for M-- describing absorp edges for K, L & M (1+3+5 triplets). First member of triplet is the transition ener, 2nd is abs coef for E below E_edge and 3rd is abs coef for E above E_edge ) [enr[1]] [coefenr[0][0]] [coefenr[0][1]] ... [enr[9]] [coefenr[8][0]] [coefenr[8][1]]

-----------------

Todo:
Note that enr indexing starts in 1 while the stdcoeffs & coefenr start in 0. A conversion from 1-->0 could be done with little work.
IMPORTANT: The Absorption coeffs are tabulated using cm2/mg as unit but they need to be converted to (cm2/1e15at)

Parameters:
TotAbsCoefFileNm (I) Name of the file to be read. Coefs are expected in (cm2/mg)
MaxZinsample (I) Largest atomic number present in sample.
PresentElems (I) Array of flags indicating presence for each element. See createPresentElems()
Filter (I) Pointer to filter structure.
TotAbsCoefArray (O) Pointer to array of structs containing the Absorption Coefs (in cm2/1e15at ) (see readAbsCoef() )
Returns:
Always 0

Definition at line 1197 of file libcpixe.c.

References AbsCoef::atnum, ChemSymb, AbsCoef::coefenr, AbsCoef::coefstd, AbsCoef::enr, FILTER::FilterElems, FILTER::MaxZ, symbol2Z(), and Z2mass().

Referenced by cpixecalib(), cpixemain(), and CPIXEMAIN().

int readCalcFlags const char *  CalcFlagsFileNm,
const int *  PresentElems,
int  MaxZinsample,
int  AreasFormat,
CPIXERESULTS **  CalcFlags
 

Reads files containing the Calculation Flags (i.e. which lines should be calculated) or, alternativelly reads areas files from a file in the DATTPIXE Areas format. The behaviour depends on the DTAreasFlag (see below)

The Format of the file is as follows: ----------------- (any header) DATA (datablocks) -----------------

if AreasFormat=1, The datablock for each element has the following structure:

[ChemSymb] [Kalpha1,2] [Kbeta1] [Kbeta2] [Lalpha1,2] [Lbeta2] [Ll] [Lbeta1] [Lgamma1] [Leta] [Lbeta3] [Lbeta4] [Lgamma3] [Malpha1,2] [Mbeta] [Mgamma]

Note: the flags are: 0 if not to be calculated, 1 (or >1) if should be calculated

If AreasFormat=2 the datablock format is: [ChemSymb] [Kalpha1,2] [err] [Kbeta1] [err] [Kbeta2] [err] [Lalpha1,2] [err] [Lbeta2] [err] [Ll] [err] [Lbeta1] [err] [Lgamma1] [err] [Leta] [err] [Lbeta3] [err] [Lbeta4] [err] [Lgamma3] [err] [Malpha1,2] [err] [Mbeta] [err] [Mgamma] [err]

Note: The information for elements not present in the sample is just ignored.

Parameters:
CalcFlagsFileNm (I) Name of the input file
PresentElems (I) Array of flags indicating presence for each element. See createPresentElems()
MaxZinsample (I) Largest atomic number present in sample (dimension of PresentElems).
AreasFormat (I) Defines the format of the Areas File. 1 for raw areas format, 2 for DATTPIXE Areas Format
CalcFlags (O) Array (dimension is allocated to MaxZinsample+1) of structures containing the flags.
Returns:
Always 0

Definition at line 792 of file libcpixe.c.

References CPIXERESULTS::atnum, ChemSymb, CPIXERESULTS::err, CalibYld::K_, CalibYld::L_, CalibYld::M_, CPIXERESULTS::simareas, and symbol2Z().

Referenced by cpixecalib(), and cpixemain().

int readCOMPOUND FILE *  f,
int  nelem,
COMPOUND c
 

Reads a compound of 'nelem' elements from the stream f and fills with this info the the compound c This is a slightly modified version from that of hstoplib.c It fills the normalized atomic and mass concentration. Mass of the elements is obtained by calling Z2mass()

The data from the stream must have the following format (repeated nelem times): [element] [atomic_concentration] ...

Parameters:
f (I) Pointer to a stream from which the compound definition is read.
nelem (I) Number of elements in the compound
c (O) Pointer to structure defining the compound
Returns:
Maximum Atomic number read

Definition at line 577 of file libcpixe.c.

References ELEMENT::A, COMPOUND::elem, ELEMENT::IM, ELEMENT::M, COMPOUND::name, COMPOUND::nelem, COMPOUND::sumX, ELEMENT::symbol, symbol2Z(), COMPOUND::w, COMPOUND::X, COMPOUND::xn, ELEMENT::Z, and Z2mass().

Referenced by readFilter(), and readsample().

int readEXP_PARAM char *  ExpParFileNm,
EXP_PARAM pexppar
 

Fills an EXP_PARAM struct with data from a file. The file must have the following format: ------------------ BeamEner BeamCol DetColFac IncAng DetAng ------------------

Parameters:
ExpParFileNm (I) Name of the file to be read.
pexppar (O) Pointer to struct containing the experimental parameters
Returns:
Always 0

Todo:
For the moment, only H ions are supported

Definition at line 336 of file libcpixe.c.

References ELEMENT::A, EXP_PARAM::BeamCol, EXP_PARAM::BeamCross, EXP_PARAM::BeamEner, EXP_PARAM::cosDet, EXP_PARAM::cosFac, EXP_PARAM::cosInc, EXP_PARAM::DetAng, EXP_PARAM::DetColFac, EXP_PARAM::FinalEner, ELEMENT::IM, EXP_PARAM::IncAng, EXP_PARAM::ion, ELEMENT::M, ELEMENT::symbol, symbol2Z(), ELEMENT::Z, and Z2mass().

int readFCK char *  FCKCoefFileNm,
int  MaxZinsample,
FluorCKCoef **  FCKCoefArray
 

Reads from an ascii file the Fluorescence and Coster-Kronig coefficients. Note: the index of FCKCoefArray starts in 1.

Todo:
Modify to read only the present elems.

Substitute the "..." by explicit labels

The File must have the following format:

----------------- (any header)

MAXZ [maxZ]

DATA (datablocks) -----------------

The datablock for each element has the following structure:

[atnum] [chemsymb]

(Fluorescence Coeficients) [K] [LI] [LII] [LIII] [MI]...

[f12] [f13] [f23]

(Line fractions for:) [Kalpha1,2] [Kbeta1] [Kbeta2] [Lalpha1,2] [Lbeta2] [Ll] [Lbeta1] [Lgamma1] [Leta] [Lbeta3] [Lbeta4] [Lgamma3] [Malpha1,2] [Mbeta] [Mgamma]

-----------------

Parameters:
FCKCoefFileNm (I) Name of the file to be read.
MaxZinsample (I) Largest atomic number present in sample.
FCKCoefArray (O) Pointer to array of structs containing Fluorescence and C-K Coefs
Returns:
Always 0

Definition at line 1092 of file libcpixe.c.

References FluorCKCoef::atnum, ChemSymb, FluorCKCoef::ck, FluorCKCoef::k, CalibYld::K_, CalibYld::L_, CalibYld::M_, symbol2Z(), and FluorCKCoef::w.

Referenced by cpixecalib(), cpixemain(), and CPIXEMAIN().

int readFilter const char *  FilterDefFileNm,
FILTER Filter
 

<

Todo:
For the moment, the geometric correction is just initialized to 1

Definition at line 1550 of file libcpixe.c.

References foil::comp, createPresentElems(), COMPOUND::elem, FILTER::FilterElems, FILTER::foil, FILTER::geomcorr, ELEMENT::M, FILTER::MaxZ, foil::nfoilelm, FILTER::nlyr, readCOMPOUND(), foil::thick, and COMPOUND::xn.

Referenced by cpixecalib(), and cpixemain().

int readINPUT const char *  InputFileNm,
EXP_PARAM pexppar,
EXTRAINFO pExtraInfo
 

Reads an input file consisting on a series of commands.

Parameters:
InputFileNm (I) Name of the input file (no more than LONGSTRINGLENGTH characters)
pexppar (O) pointer to the experimental parameter structure
pExtraInfo (O) pointer to structure containing misc data read from input file
Returns:
Always 0

Todo:
For the moment, only H ions are supported

: SXF not supported yet

: Xeq calculation not

Definition at line 77 of file libcpixe.c.

References ELEMENT::A, SIM_PARAM::AllowSXFCorr, SIM_PARAM::AllowXEqCalc, EXTRAINFO::AreasFileNm, EXTRAINFO::AreasFormat, EXP_PARAM::BeamCol, EXP_PARAM::BeamCross, EXP_PARAM::BeamEner, SIM_PARAM::ColCharge, EXP_PARAM::cosDet, EXP_PARAM::cosFac, EXP_PARAM::cosInc, EXTRAINFO::DBpath, EXP_PARAM::DetAng, EXP_PARAM::DetColFac, EXTRAINFO::DoCalibration, SIM_PARAM::DTCC, EXTRAINFO::FilterFileNm, EXP_PARAM::FinalEner, ELEMENT::IM, EXP_PARAM::IncAng, EXP_PARAM::ion, LONGSTRINGLENGTH, ELEMENT::M, EXTRAINFO::OutputFileNm, EXTRAINFO::SampleFileNm, EXP_PARAM::simpar, ELEMENT::symbol, symbol2Z(), EXTRAINFO::WantOutputfile, EXTRAINFO::XYldFileNm, ELEMENT::Z, and Z2mass().

Referenced by cpixecalib(), and cpixemain().

int readsample char *  SampleDefFileNm,
int *  MaxZ,
int *  NFoil,
foil **  Sample
 

Allocates and initializes the sample definition from a file. It also returns Number of foils and Maximum atomic number present in sample.

The File must have the following format: ----------------- NUMBER_OF_FOILS [nfoils] FOIL [thickness_in_ug/cm2] [numberofelems] [symbol] [concentration] [symbol] [concentration] ... FOIL CalEner [numberofelems] [symbol] [concentration] ... -----------------

Note:Any number of foils and any number of elements are allowed.

Parameters:
SampleDefFileNm (I) Name of the file to be read.
MaxZ (O) Largest atomic number present in sample (Dimension of PresentElems).
NFoil (O) Number of target foils
Sample (O) Pointer to Array of files (Dim=NFoil)
Returns:
Always 0

Definition at line 667 of file libcpixe.c.

References foil::comp, COMPOUND::elem, ELEMENT::M, foil::nfoilelm, readCOMPOUND(), foil::thick, and COMPOUND::xn.

Referenced by cpixecalib(), and cpixemain().

int readSIM_PARAM char *  SampleParamFileNm,
SIM_PARAM simpar,
char *  IniMatFileNm,
char *  FilterFileNm,
char *  XYldFileNm
 

Fills a SIM_PARAM struct with data from a file. The file must have the following format: ------------------ Samplefilename absorbertype AllowSXFCorr AllowXEqCalc GenPulNumb GenInteg ColCharge ------------------

Parameters:
SampleParamFileNm (I) Name of the file to be read.
simpar (O) Pointer to struct containing the simulation parameters
IniMatFileNm (O) Name of the file defining sample
FilterFileNm (O) Name of the filter definition file
XYldFileNm (O) Name of the calibration yield file
Returns:
Always 0

Todo:
complete here the initialization for the case when a filter is used. UPDATE: this should be managed elsewhere, probably in FilterTrans() or readFilter()

Definition at line 394 of file libcpixe.c.

References SIM_PARAM::AllowSXFCorr, SIM_PARAM::AllowXEqCalc, SIM_PARAM::ColCharge, SIM_PARAM::DTCC, and SIM_PARAM::useFilter.

int readXYld const char *  XYldFileNm,
const int *  PresentElems,
const CPIXERESULTS CalcFlags,
int  MaxZinsample,
double *  CalEner,
XrayYield **  XYldArray
 

Reads from an ascii file the calibration yields and also returns CalEner.

Todo:
Modify to read only the present elems.
Note: the index of XYldArray starts in 1. The File must have the following format: ----------------- (any header) CALENER [calener] MAXZ [maxZ]

DATA (datablocks) -----------------

The datablock for each element has the following structure:

[AtNum] [ChemSymb]

[Kalpha1,2] [Kbeta1] [Kbeta2] <----Energies [Kalpha1,2] [Kbeta1] [Kbeta2] <----Yields

[Lalpha1,2] [Lbeta2] [Ll] <---------Energies [Lalpha1,2] [Lbeta2] [Ll] <---------Yields [Lbeta1] [Lgamma1] [Leta] <--------Energies [Lbeta1] [Lgamma1] [Leta] <--------Yields [Lbeta3] [Lbeta4] [Lgamma3] <----Energies [Lbeta3] [Lbeta4] [Lgamma3] <----Yields

[Malpha1,2] [Mbeta] [Mgamma] <-----Energies [Malpha1,2] [Mbeta] [Mgamma] <-----Yields

-----------------

Parameters:
XYldFileNm (I) Name of the file to be read.
PresentElems (I) Array of flags indicating presence for each element. See createPresentElems()
CalcFlags (I) array of structures indicating which lines are to be calculated (simareas values>0) and which not (simareas values=-1). See readCalcFlags()
MaxZinsample (I) Largest atomic number present in sample (dimension of PresentElems).
CalEner (O) Energy at which the calibration was performed
XYldArray (O) Pointer to array of structs containing the efficiencies for each element
Returns:
Always 0
NOTE that the calib yield files from DT are in (cm2/ug)/uC and should be passed to (cm2/1e15at)/uC

Definition at line 934 of file libcpixe.c.

References CPIXERESULTS::atnum, XrayYield::atnum, ChemSymb, XrayYield::ener, CalibYld::K_, CalibYld::L_, CalibYld::M_, CPIXERESULTS::simareas, XrayYield::symb, symbol2Z(), XrayYield::XYld, and Z2mass().

Referenced by cpixecalib(), cpixemain(), and CPIXEMAIN().

int ReisX const AbsCoef AbsC,
const FluorCKCoef pFCK,
double  ener,
atomicnumber  z,
double  M2,
double *  sigmaXL
 

Returns X-ray fluorescence cross-sections for L lines. See paper ???

Todo:
(cite M.Reis paper named ???)

This function is only for proton beams!!

Parameters:
AbsC (I) Pointer to Absorption coef structure for element with Z2
pFCK (I) Pointer to structure containing the Fluorescence and Coster-Kronig coefs
ener (I) Proton energy, in keV
z (I) Atomic number of Target
M2 (I) Atomic mass of Target (in amu)
sigmaXL (O) X-ray cross sections, in barn
Returns:
Always 0

Todo:
What is Hr ???

What is cau ???

What is a02 ???

U.Atomicas de massa *

U.Atomicas *

parametro de correccao de polarizacao-ligacao *

correccao de defleccao Coulombiana *

Definition at line 2371 of file libcpixe.c.

References FluorCKCoef::ck, AbsCoef::enr, FwTipo, ReisX_En(), ReisX_g(), ReisX_gs(), ReisX_hs(), ReisX_polisec(), SecXL, and FluorCKCoef::w.

Referenced by Xprod().

double ReisX_En double  z,
int  niu
 

Auxiliar function to ReisX()

Parameters:
z 
niu 
Returns:

Todo:
check that the units of the hardcoded constants are appropriate

document this function

aproximation for niu>> *

vide Abramowitz & Stegun , Dover 1Ed. 1965 *

Definition at line 2599 of file libcpixe.c.

Referenced by ReisX().

double ReisX_g int  ss,
atomicnumber  Zg,
double  xi
 

Auxiliar function to ReisX()

Parameters:
ss 
Zg 
xi 
Returns:

Todo:
check that the units of the hardcoded constants are appropriate

document this function

Definition at line 2712 of file libcpixe.c.

Referenced by ReisX().

double ReisX_gs FwTipo  T,
int  SS,
double  ksis
 

Auxiliar function to ReisX()

Parameters:
T 
SS 
ksis 
Returns:

Todo:
check that the units of the hardcoded constants are appropriate

document this function

ref. Brandt and Lapicki,Phys.Rev.,A20(1979)465 *

Definition at line 2474 of file libcpixe.c.

References K, and L.

Referenced by ReisX().

double ReisX_hs FwTipo  T,
int  SS,
double  ksih,
double  thet
 

Auxiliar function to ReisX()

Parameters:
T 
SS 
ksih 
thet 
Returns:

Todo:
check that the units of the hardcoded constants are appropriate

document this function

Definition at line 2550 of file libcpixe.c.

References K, and L.

Referenced by ReisX().

double ReisX_polisec int  ssind,
double  kz,
double  tz
 

Auxiliar function to ReisX()

Parameters:
ssind 
kz 
tz 
Returns:

Todo:
check that the units of the hardcoded constants are appropriate

document this function

Definition at line 2631 of file libcpixe.c.

Referenced by ReisX().

void safefree void **  ptr  ) 
 

Frees memory only if *ptr is not NULL

Parameters:
ptr (I+O) Pointer to array to be freed

Definition at line 3188 of file libcpixe.c.

Referenced by CPIXEMAIN(), freeFilter(), and freeReusable().

double sigmaphoto int  iabs,
const AbsCoef AbsC,
atomicnumber  Zb,
double  Xray
 

Definition at line 139 of file sfc.c.

References AbsCoef::coefenr, AbsCoef::enr, and TotAbsor_elemental().

Referenced by needSFC().

double Simps double  a,
double  b,
double  fa,
double  fi,
double  fb
 

Returns area of trapezoid, useful for Simpson Integration.

See "Corrected Trapezoidal Rule" in Conte & de Boor "Elementar Numerical Analysis" 3rd Ed. McGraw-Hill,1980,,p309 ExpCTR:=(b-a)/2*(fa+fb)

Parameters:
a First point of the trapezoid base
b Second point of the Trapezoid base
fa 
fi 
fb 
Returns:

Todo:
IMPORTANT: Why the 6 and the 4??????? Has something to do with exponential function integration? If not, it should be rather: return( (b-a)/4 * (fa+2*fi+fb) ) UPDATE: This has to do with the line in SSthick where "thick" is calculated.

document this function

Definition at line 2964 of file libcpixe.c.

Referenced by PenInteg().

int SSThick const EXP_PARAM pexp,
const foil pMat,
const SPT SPTArray,
double  MajAbsCoef,
double  LayerThickness,
ESxType  ESxin,
ESxType ESxfin,
int *  pFpos,
double *  thick,
ESxType **  ESxA
 

Recursive function which divides a sublayer in two if either energy loss or absorption are too large

Parameters:
pexp (I) Pointer to structure containing experimental parameters.
pMat (I) Pointer to current foil structure.
SPTArray (I) Pointer to precalculated tables of stoppings (see createSPT() )
MajAbsCoef (I) Maximum absorption coef for this layer.
LayerThickness (I) Effective Thickness (in-going path) for the layer containing this sublayer.
ESxin (I) Struct of energy, stopping and depth (ESx) for first half of this sublayer
ESxfin (I+O) Pointer to struct of energy, stopping and depth (ESx) for 2nd half of this sublayer
pFpos (I+O) Pointer to index of sublayer position into the layer.
thick (O) Pointer to thickness of current sublayer.
ESxA (O) Pointer to Array of sublayers in the current layer.
Returns:
always 0.

Todo:
: check if the thressholds of these conditions are reasonable or should be more conservative.

The reallocation of ESxArray could be done inteligently in increments larger than 2, thus sacrificing some memory to speed up the process. Some extra variable would also be needed to remember the actual dimension of the matrix and comparing it with pFpos.

Definition at line 1884 of file libcpixe.c.

References EXP_PARAM::BeamEner, foil::comp, EXP_PARAM::cosFac, ESxType::ep, getSP(), ESxType::stpp, and ESxType::x.

Referenced by createsublyrs().

int symbol2Z char *  symbol  ) 
 

Returns the atomic number for a certain element (up to Z=109) This is a faster version than that of hstoplib.c because it does not access any file.

Parameters:
symbol (I) Chemical symbol of the element (case insensitive)
Returns:
Atomic Number

Array containing the chemical symbols from H(Z=1) to Mt(Z=109)

Definition at line 469 of file libcpixe.c.

References ChemSymb.

Referenced by readAbsCoef(), readCalcFlags(), readCOMPOUND(), readEXP_PARAM(), readFCK(), readINPUT(), and readXYld().

void testlib int **  testarray,
int *  n
 

double TotAbsor const AbsCoef TotAbsCoefArray,
const COMPOUND cmp,
double  Xray
 

Calculates the total absoption (it returns it as a double) for a given X-ray line in a given compound

Parameters:
TotAbsCoefArray (I) Array containing a tables of Absorption Coefs (see readAbsCoef() )
cmp (I) Definition of the absorber material.
Xray (I) Energy of the X-ray, in keV
Returns:
Total absorption coefficient

<

Todo:
This function returns 0 if the Xray energy is not in the range covered by stdener. Maybe an error (and exit) should be triggered instead. Moreover: Is this absolutely general? I think this limits the generality of the program since elements below Na cannot be treated (and this is not desirable from a generalistic point of view). Therefore, these limits should be coded as variables just as minK, maxK,... UPDATE 1: The limits can be expanded, but the X-absorption data table should be altered accordingly (and dimstdener too). UPDATE 2: Better to show a warning than to exit in case that the limits are violated (TODO).

Definition at line 1698 of file libcpixe.c.

References COMPOUND::elem, COMPOUND::nelem, TotAbsor_elemental(), COMPOUND::xn, and ELEMENT::Z.

Referenced by initlyr(), and Transmission().

double TotAbsor_elemental int  iener,
const AbsCoef Absco,
int  Z,
double  Xray
 

Calculates the total absoption coefficient (it returns it as a double) for a given X-ray line in a given element.

Parameters:
iener (I) Index of the absorption line to be considered
Absco (I) Pointer to structure of Absorption Coefs for the absorber element
Z (I) Atomic number of the absorber element
Xray (I) Energy of the X-ray, in keV
Returns:
Total absorption coefficient

Todo:
This function returns 0 if the Xray energy is not in the 1-30 range. Maybe an error (and exit) should be triggered instead. Moreover: Is this absolutely general? I think this limits the generality of the program since elements below Na cannot be treated (and this is not desirable from a generalistic point of view). Therefore, these limits should be coded as variables just as minK, maxK,... UPDATE 1: The limits can be expanded, but the X-absorption data table should be altered accordingly. UPDATE 2: Better to show a warning than to exit in case that the limits are violated (TODO).

Definition at line 1742 of file libcpixe.c.

References AbsCoef::coefenr, AbsCoef::coefstd, and AbsCoef::enr.

Referenced by sigmaphoto(), and TotAbsor().

int Transmission const XrayYield XYldArray,
const AbsCoef TotAbsCoefArray,
int  Z,
const foil pFoil,
double  geomcorr,
const CalibYld pTransOld,
CalibYld pTrans
 

Calculates the Transmission coefficients for a given foil (whith effective thickness calculated using a geometric correction).

Parameters:
XYldArray (I) Array of Xray yield coefs. See readXYld()
TotAbsCoefArray (I) Array containing a tables of Absorption Coefs (see readAbsCoef() )
Z (I) Atomic number of the element for whose lines the transmission is calculated
pFoil (I) pointer to the current foil definition
geomcorr (I) geometric correction to the foil thickness (allows tiltings)
pTransOld (I) If this pointer is not null, pTrans will be multiplied by it line-by-line.
pTrans (O) Structure where the transmission coefs for each line are returned.
Returns:
Always 0

Definition at line 1655 of file libcpixe.c.

References foil::comp, XrayYield::ener, CalibYld::K_, CalibYld::L_, CalibYld::M_, foil::thick, and TotAbsor().

Referenced by FilterTrans(), and initlyr().

int Xprod const AbsCoef AbsC,
const FluorCKCoef pFCK,
atomicnumber  Z1,
atomicnumber  Z2,
double  M2,
double  ener,
CalibYld XYld
 

Calculates X-Ray production efficiency for a given beam and target, in cm2/(1e15at).

Parameters:
AbsC (I) pointer to Absorption coef structure for Z2
pFCK (I) pointer to Fluorescence and Coster-Kronig coefficients for Z2
Z1 (I) atomic number of the ion (note: currently only Z1=1 is supported)
Z2 (I) atomic number of the target
M2 (I) mass of the target atom
ener (I) energy of the incident ion, in keV
XYld (O) Pointer to return the X-ray production efficiency, in cm2/(1e15at)
Returns:
Always 0

Todo:
This function only works for proton beams!!

Todo:
Check hardcoded Z limits

Check hardcoded Z limits

Check hardcoded Z limits

Definition at line 2151 of file libcpixe.c.

References FluorCKCoef::k, CalibYld::K_, CalibYld::L_, PaulX(), ReisX(), and SecXL.

Referenced by cpixecalib(), deNormalize(), and integrate_Simpson().

int Z2mass int  Z,
double *  mass,
char  option
 

Returns mass information for a given element (specified by its atomic number). Currently the range is limited from Z=1 (H) to Z=92 (U). It provides the Natural (average) weight, Most Abundant Isotope (MAI) weight and Most Abundant Isotope number of nucleons

Parameters:
Z (I) Atomic number
mass (O) mass in amu. See also the "option" argument.
option (I) Either 'n' or 'm' to select "Natural" or "MAI" mass, respectively
Returns:
Number of nucleons of the Most Abundant Isotope

Array containing the chemical symbols from H(Z=1) to Es(Z=99)

Definition at line 500 of file libcpixe.c.

Referenced by cpixecalib(), integrate_Simpson(), readAbsCoef(), readCOMPOUND(), readEXP_PARAM(), readINPUT(), readXYld(), translatesample(), and translatesample2().


Variable Documentation

const CalibYld CYldNul [static]
 

Initial value:

 { { 0.0, 0.0, 0.0, 0.0 },
                            { { 0.0, 0.0, 0.0, 0.0 },
                              { 0.0, 0.0, 0.0, 0.0 },
                              { 0.0, 0.0, 0.0, 0.0 },
                              { 0.0, 0.0, 0.0, 0.0 }},
                            { 0.0, 0.0, 0.0, 0.0 }}

Definition at line 304 of file libcpixe.h.

char LineNm[6][4][11] [static]
 

Initial value:

 {
  { "--", "  --      ", "  --      ", "  --      " },
  { "--", "K_alpha1,2", "K_beta_1  ", "K_beta_2  " },
  { "--", "L_alpha1,2", "L_beta_2  ", "L_l       " },
  { "--", "L_beta_1  ", "L_gamma_1 ", "L_eta     " },
  { "--", "L_beta_3  ", "L_beta_4  ", "L_gamma_3 " },
  { "--", "M_alpha1,2", "M_beta    ", "M_gamma   " }
}
Names for X-ray emmission lines

Definition at line 314 of file libcpixe.h.

const atomicnumber minK = 11 maxK = 54 minL = 30 minM = 60 [static]
 

Limits for atomic numbers to be used

Todo:
These values should be read instead of hardcoded. Maybe in SIMPARAM?

Definition at line 302 of file libcpixe.h.


Generated on Fri Jul 15 20:43:50 2005 for LibCPIXE API by  doxygen 1.3.9.1