musrfit 1.10.0
PRgeHandler Class Reference

Manager for TrimSP range distribution data. More...

#include <PRgeHandler.h>

Inheritance diagram for PRgeHandler:
Collaboration diagram for PRgeHandler:

Public Member Functions

 PRgeHandler (std::string fln="")
 Constructor that loads TrimSP data from XML configuration.
 
virtual ~PRgeHandler ()
 Destructor.
 
virtual bool IsValid ()
 Returns validity status.
 
virtual UInt_t GetNoOfRgeDataSets ()
 Returns number of loaded RGE data sets.
 
virtual PRgeDataList GetRgeData ()
 Returns all RGE data sets.
 
virtual Double_t GetZmax (const Double_t energy)
 Returns maximum penetration depth for a given energy.
 
virtual Double_t GetZmax (const Int_t idx)
 Returns maximum penetration depth for a data set index.
 
virtual Double_t Get_n (const Double_t energy, const Double_t z)
 Returns normalized particle distribution at given energy and depth.
 
virtual Double_t Get_n (const Int_t idx, const Double_t z)
 Returns normalized particle distribution at given index and depth.
 
virtual Int_t GetEnergyIndex (const Double_t energy)
 Finds the data set index for a given energy.
 

Private Member Functions

virtual bool ReadRgeFile (const std::string fln, PRgeData &data)
 Reads a single RGE file and populates a PRgeData structure.
 

Private Attributes

bool fValid {false}
 Validity flag (true if all RGE files loaded successfully)
 
PRgeDataList fData
 Collection of RGE data sets (one per energy)
 

Detailed Description

Manager for TrimSP range distribution data.

PRgeHandler reads and manages muon/particle implantation depth profiles calculated by TrimSP (Transport of Ions in Matter - Stopping and Range). It provides access to:

  • Particle implantation depth distributions n(E,z)
  • Normalized distributions nn(E,z) where ∫nn(z)dz = 1
  • Maximum penetration depths for different energies

The class loads RGE files specified in an XML configuration file, which can contain data for multiple implantation energies. RGE files contain depth (in Ångström) vs. particle count data from TrimSP simulations.

Typical Usage:
PRgeHandler rge("config.xml");
if (rge.IsValid()) {
Double_t zmax = rge.GetZmax(5000.0); // Max depth at 5 keV
Double_t n = rge.Get_n(5000.0, 10.0); // Distribution at 5 keV, 10 nm depth
}
PRgeHandler(std::string fln="")
Constructor that loads TrimSP data from XML configuration.
See also
PRgeData for the data structure holding individual distributions
PXmlRgeHandler for XML configuration parsing

Definition at line 218 of file PRgeHandler.h.

Constructor & Destructor Documentation

◆ PRgeHandler()

PRgeHandler::PRgeHandler ( std::string fln = "")

Constructor that loads TrimSP data from XML configuration.

Parameters
flnPath to XML configuration file (empty string for manual setup)

Parses the XML file to get RGE file locations and energies, then loads all specified RGE files. Sets fValid to false if any errors occur.

◆ ~PRgeHandler()

virtual PRgeHandler::~PRgeHandler ( )
inlinevirtual

Destructor.

Definition at line 231 of file PRgeHandler.h.

Member Function Documentation

◆ Get_n() [1/2]

Double_t PRgeHandler::Get_n ( const Double_t energy,
const Double_t z )
virtual

Returns normalized particle distribution at given energy and depth.

Parameters
energyImplantation energy in eV
zDepth in nm
Returns
Normalized distribution nn(E,z), or 0.0 if out of range

Uses linear interpolation between data points. The normalization ensures that ∫nn(z)dz = 1 over the entire depth range.

Searches for a data set matching the specified energy (within 0.9 keV tolerance) and returns the normalized distribution value at depth z.

Parameters
energyImplantation energy in eV
zDepth in nm
Returns
Normalized distribution nn(E,z), or 0.0 if energy not found or z out of range

Definition at line 671 of file PRgeHandler.cpp.

References fData, and Get_n().

Referenced by Get_n().

◆ Get_n() [2/2]

Double_t PRgeHandler::Get_n ( const Int_t idx,
const Double_t z )
virtual

Returns normalized particle distribution at given index and depth.

Parameters
idxData set index (0 to GetNoOfRgeDataSets()-1)
zDepth in nm
Returns
Normalized distribution nn(idx,z), or 0.0 if out of range

Uses linear interpolation between data points. The normalization ensures that ∫nn(z)dz = 1 over the entire depth range.

Uses linear interpolation between adjacent data points to compute the distribution value at the requested depth. The normalization ensures that ∫nn(z)dz = 1 over the entire depth range.

Special handling for z near zero: extrapolates linearly from first data point.

Parameters
idxData set index (0 to GetNoOfRgeDataSets()-1)
zDepth in nm
Returns
Normalized distribution nn(idx,z), or 0.0 if idx or z out of range

Definition at line 702 of file PRgeHandler.cpp.

References fData, and GetZmax().

◆ GetEnergyIndex()

Int_t PRgeHandler::GetEnergyIndex ( const Double_t energy)
virtual

Finds the data set index for a given energy.

Finds the data set index corresponding to a given implantation energy.

Parameters
energyImplantation energy in eV
Returns
Data set index, or -1 if energy not found

Uses tolerance of 0.9 keV for matching energies.

Searches through loaded data sets for a matching energy value using a tolerance of 0.9 keV (i.e., |E_data - E_query| < 0.9 keV).

Parameters
energyImplantation energy in eV
Returns
Data set index (0 to GetNoOfRgeDataSets()-1), or -1 if not found

Definition at line 742 of file PRgeHandler.cpp.

References fData.

◆ GetNoOfRgeDataSets()

virtual UInt_t PRgeHandler::GetNoOfRgeDataSets ( )
inlinevirtual

Returns number of loaded RGE data sets.

Returns
Number of energy data sets (one per energy value)

Definition at line 243 of file PRgeHandler.h.

References fData.

◆ GetRgeData()

virtual PRgeDataList PRgeHandler::GetRgeData ( )
inlinevirtual

Returns all RGE data sets.

Returns
Vector of all loaded PRgeData structures

Definition at line 249 of file PRgeHandler.h.

References fData.

◆ GetZmax() [1/2]

Double_t PRgeHandler::GetZmax ( const Double_t energy)
virtual

Returns maximum penetration depth for a given energy.

Returns maximum penetration depth for a given implantation energy.

Parameters
energyImplantation energy in eV
Returns
Maximum depth in nm, or -1 if energy not found

Searches for a data set matching the specified energy (within 0.9 keV tolerance) and returns its maximum depth value.

Parameters
energyImplantation energy in eV
Returns
Maximum depth in nm, or -1 if energy not found

Definition at line 622 of file PRgeHandler.cpp.

References fData, and GetZmax().

Referenced by Get_n(), and GetZmax().

◆ GetZmax() [2/2]

Double_t PRgeHandler::GetZmax ( const Int_t idx)
virtual

Returns maximum penetration depth for a data set index.

Returns maximum penetration depth for a given data set index.

Parameters
idxData set index (0 to GetNoOfRgeDataSets()-1)
Returns
Maximum depth in nm, or -1 if idx out of range

Returns the last depth value from the depth vector, which represents the maximum penetration depth for this energy.

Parameters
idxData set index (0 to GetNoOfRgeDataSets()-1)
Returns
Maximum depth in nm, or -1 if idx out of range

Definition at line 650 of file PRgeHandler.cpp.

References fData.

◆ IsValid()

virtual bool PRgeHandler::IsValid ( )
inlinevirtual

Returns validity status.

Returns
True if all RGE files loaded successfully, false if errors occurred

Definition at line 237 of file PRgeHandler.h.

References fValid.

◆ ReadRgeFile()

bool PRgeHandler::ReadRgeFile ( const std::string fln,
PRgeData & data )
privatevirtual

Reads a single RGE file and populates a PRgeData structure.

Reads a single TrimSP .rge file and populates a PRgeData structure.

Parameters
flnPath to the .rge file
dataPRgeData structure to populate
Returns
True on success, false on error

Parses the two-column format (depth amplitude) from TrimSP output. Converts depth from Ångström to nanometers.

Parses the two-column format from TrimSP output:

  • Column 1: Depth in Ångström (converted to nm by dividing by 10)
  • Column 2: Number of particles (amplitude)

Skips empty lines and non-numeric lines. Performs extensive validation on numeric values with detailed error messages.

Parameters
flnPath to the .rge file
dataPRgeData structure to populate with depth and amplitude vectors
Returns
True on success, false if file cannot be opened or contains invalid data

Definition at line 506 of file PRgeHandler.cpp.

References PRgeData::amplitude, PRgeData::depth, and fValid.

Referenced by ClassImp().

Member Data Documentation

◆ fData

PRgeDataList PRgeHandler::fData
private

Collection of RGE data sets (one per energy)

Definition at line 298 of file PRgeHandler.h.

Referenced by ClassImp(), Get_n(), Get_n(), GetEnergyIndex(), GetNoOfRgeDataSets(), GetRgeData(), GetZmax(), and GetZmax().

◆ fValid

bool PRgeHandler::fValid {false}
private

Validity flag (true if all RGE files loaded successfully)

Definition at line 297 of file PRgeHandler.h.

Referenced by ClassImp(), IsValid(), and ReadRgeFile().


The documentation for this class was generated from the following files: