musrfit 1.10.0
PRgeHandler.h
Go to the documentation of this file.
1/***************************************************************************
2
3 PRgeHandler.h
4
5 Author: Andreas Suter
6 e-mail: andreas.suter@psi.ch
7
8***************************************************************************/
9
10/***************************************************************************
11 * Copyright (C) 2007-2026 by Andreas Suter *
12 * andreas.suter@psi.ch *
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 * This program is distributed in the hope that it will be useful, *
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
22 * GNU General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU General Public License *
25 * along with this program; if not, write to the *
26 * Free Software Foundation, Inc., *
27 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
28 ***************************************************************************/
29
30#ifndef _PRGEHANDLER_H_
31#define _PRGEHANDLER_H_
32
33#include <string>
34#include <vector>
35
36#include <TObject.h>
37#include <TQObject.h>
38#include <TSAXParser.h>
39
40#include "PMusr.h"
41
42//-----------------------------------------------------------------------------
61
62//-----------------------------------------------------------------------------
69typedef std::vector<PRgeData> PRgeDataList;
70
71//-----------------------------------------------------------------------------
97class PXmlRgeHandler : public TObject, public TQObject
98{
99 public:
103 virtual ~PXmlRgeHandler() {}
104
106 virtual void OnStartDocument(); // SLOT
108 virtual void OnEndDocument(); // SLOT
114 virtual void OnStartElement(const char* str, const TList* attributes); // SLOT
119 virtual void OnEndElement(const char* str); // SLOT
124 virtual void OnCharacters(const char* str); // SLOT
129 virtual void OnComment(const char* str); // SLOT
134 virtual void OnWarning(const char* str); // SLOT
139 virtual void OnError(const char* str); // SLOT
144 virtual void OnFatalError(const char* str); // SLOT
150 virtual void OnCdataBlock(const char* str, Int_t len); // SLOT
151
156 virtual bool IsValid() { return fIsValid; }
157
162 virtual std::string GetTrimSpDataPath() { return fTrimSpDataPath; }
163
168 virtual std::string GetTrimSpFlnPre() { return fTrimSpFlnPre; }
169
175
176 private:
180
181 bool isTrimSp{false};
182 bool fIsValid{true};
183
184 std::string fTrimSpDataPath{""};
185 std::string fTrimSpFlnPre{""};
187
188 ClassDef(PXmlRgeHandler, 1)
189};
190
191//-----------------------------------------------------------------------------
218class PRgeHandler : public TObject
219{
220 public:
228 PRgeHandler(std::string fln="");
229
231 virtual ~PRgeHandler() {}
232
237 virtual bool IsValid() { return fValid; }
238
243 virtual UInt_t GetNoOfRgeDataSets() { return (UInt_t)fData.size(); }
244
249 virtual PRgeDataList GetRgeData() { return fData; }
250
256 virtual Double_t GetZmax(const Double_t energy);
257
263 virtual Double_t GetZmax(const Int_t idx);
264
274 virtual Double_t Get_n(const Double_t energy, const Double_t z);
275
285 virtual Double_t Get_n(const Int_t idx, const Double_t z);
286
294 virtual Int_t GetEnergyIndex(const Double_t energy);
295
296 private:
297 bool fValid{false};
299
309 virtual bool ReadRgeFile(const std::string fln, PRgeData &data);
310
311 ClassDef(PRgeHandler, 1)
312};
313
314#endif // _PRGEHANDLER_H_
std::vector< Int_t > PIntVector
Definition PMusr.h:367
std::vector< Double_t > PDoubleVector
Definition PMusr.h:385
std::vector< PRgeData > PRgeDataList
Container for multiple TrimSP range distributions at different energies.
Definition PRgeHandler.h:69
virtual bool IsValid()
Returns validity status.
virtual Double_t Get_n(const Double_t energy, const Double_t z)
Returns normalized particle distribution at given energy and depth.
PRgeHandler(std::string fln="")
Constructor that loads TrimSP data from XML configuration.
virtual bool ReadRgeFile(const std::string fln, PRgeData &data)
Reads a single RGE file and populates a PRgeData structure.
bool fValid
Validity flag (true if all RGE files loaded successfully)
virtual Double_t GetZmax(const Double_t energy)
Returns maximum penetration depth for a given energy.
virtual Int_t GetEnergyIndex(const Double_t energy)
Finds the data set index for a given energy.
virtual ~PRgeHandler()
Destructor.
virtual PRgeDataList GetRgeData()
Returns all RGE data sets.
PRgeDataList fData
Collection of RGE data sets (one per energy)
virtual UInt_t GetNoOfRgeDataSets()
Returns number of loaded RGE data sets.
bool isTrimSp
True when inside <trim_sp> element.
virtual std::string GetTrimSpFlnPre()
Returns the RGE filename prefix.
virtual std::string GetTrimSpDataPath()
Returns the TrimSP data directory path.
std::string fTrimSpFlnPre
RGE filename prefix (e.g., "LCCO_E" for LCCO_E1000.rge)
virtual void OnCdataBlock(const char *str, Int_t len)
Called for CDATA blocks (SLOT)
PXmlRgeHandler()
Default constructor.
virtual void OnEndElement(const char *str)
Called when XML end tag is encountered (SLOT)
virtual void OnComment(const char *str)
Called for XML comments (SLOT)
std::string fTrimSpDataPath
Directory path to RGE files.
virtual void OnStartElement(const char *str, const TList *attributes)
Called when XML start tag is encountered (SLOT)
virtual void OnCharacters(const char *str)
Called for element content between tags (SLOT)
virtual void OnStartDocument()
Called at start of XML document parsing (SLOT)
virtual ~PXmlRgeHandler()
Destructor.
PIntVector fTrimSpDataEnergyList
List of implantation energies in eV.
virtual void OnFatalError(const char *str)
Called when parser encounters a fatal error (SLOT)
virtual const PIntVector GetTrimSpDataVectorList() const
Returns the list of implantation energies.
virtual bool IsValid()
Returns validity status of parsed configuration.
bool fIsValid
Validity flag (false if parsing errors occur)
virtual void OnEndDocument()
Called at end of XML document parsing, performs validation (SLOT)
virtual void OnWarning(const char *str)
Called when parser emits a warning (SLOT)
EKeyWords
Enum for tracking which XML element is currently being parsed.
virtual void OnError(const char *str)
Called when parser encounters an error (SLOT)
EKeyWords fKey
Current parsing context/state.
Data structure for a single TrimSP range distribution at a given energy.
Definition PRgeHandler.h:54
PDoubleVector amplitude
Number of particles at each depth (raw counts from TrimSP)
Definition PRgeHandler.h:57
Double_t noOfParticles
Total number of particles (sum of amplitudes)
Definition PRgeHandler.h:59
PDoubleVector nn
Normalized particle density where ∫nn(z)dz = 1.
Definition PRgeHandler.h:58
Double_t energy
Implantation energy in eV.
Definition PRgeHandler.h:55
PDoubleVector depth
Depth values in nanometers (nm)
Definition PRgeHandler.h:56