musrfit 1.10.0
PStartupHandler Class Reference

Handles the musrfit XML startup configuration file (musrfit_startup.xml). More...

#include <PStartupHandler.h>

Inheritance diagram for PStartupHandler:
Collaboration diagram for PStartupHandler:

Public Member Functions

 PStartupHandler (bool reset_startup_file=false)
 Constructor that locates and parses the musrfit startup configuration file.
 
virtual ~PStartupHandler ()
 Destructor releasing allocated resources.
 
virtual void OnStartDocument ()
 SAX callback: Called when XML document parsing begins. Initializes all configuration variables to default values.
 
virtual void OnEndDocument ()
 SAX callback: Called when XML document parsing ends. Triggers CheckLists() to ensure all required settings have values.
 
virtual void OnStartElement (const Char_t *, const TList *)
 SAX callback: Called when an XML start element is encountered.
 
virtual void OnEndElement (const Char_t *)
 SAX callback: Called when an XML end element is encountered.
 
virtual void OnCharacters (const Char_t *)
 SAX callback: Called with element text content.
 
virtual void OnComment (const Char_t *)
 SAX callback: Called when XML comment is found (unused).
 
virtual void OnWarning (const Char_t *)
 SAX callback: Called when XML parser issues a warning.
 
virtual void OnError (const Char_t *)
 SAX callback: Called when XML parser encounters an error.
 
virtual void OnFatalError (const Char_t *)
 SAX callback: Called when XML parser encounters a fatal error.
 
virtual void OnCdataBlock (const Char_t *, Int_t)
 SAX callback: Called for CDATA blocks (unused).
 
virtual Bool_t StartupFileFound ()
 Checks if the startup configuration file was successfully located.
 
virtual TString GetStartupFilePath ()
 Returns the full path to the located startup configuration file.
 
virtual void CheckLists ()
 Validates configuration lists and fills missing entries with defaults.
 
virtual PMsrFourierStructure GetFourierDefaults ()
 Returns Fourier transform default settings.
 
virtual const PRunNameTemplateList GetRunNameTemplateList ()
 Returns the list of instrument-specific run name templates.
 
virtual const PStringVector GetDataPathList () const
 Returns the list of data file search paths.
 
virtual const PIntVector GetMarkerList () const
 Returns the list of ROOT marker codes for plotting.
 
virtual const PIntVector GetColorList () const
 Returns the list of ROOT color codes for plotting.
 

Private Types

enum  EKeyWords {
  eEmpty , eComment , eDataPath , eRunNameTemplate ,
  eOptions , eFourierSettings , eUnits , eFourierPower ,
  eApodization , ePlot , ePhase , ePhaseIncrement ,
  eRootSettings , eMarkerList , eMarker , eColorList ,
  eColor
}
 Enumeration of XML element types for SAX parser state machine. More...
 

Private Member Functions

Bool_t StartupFileExists (Char_t *fln)
 Checks if a file exists at the specified path.
 
Bool_t WriteDefaultStartupFile (bool reset_startup_file=false)
 Creates or overwrites a startup file with default configuration.
 

Private Attributes

EKeyWords fKey
 Current XML element type (SAX parser state)
 
Bool_t fStartupFileFound
 True if musrfit_startup.xml was located.
 
TString fStartupFilePath
 Full path to located startup file (empty if not found)
 
TString fCurrentInstrumentName
 Instrument name from run_name_template inst attribute.
 
PMsrFourierStructure fFourierDefaults
 Fourier transform default settings structure.
 
PStringVector fDataPathList
 List of directories to search for data files.
 
PRunNameTemplateList fRunNameTemplate
 List of instrument-specific run name patterns.
 
PIntVector fMarkerList
 List of ROOT TMarker style codes for plotting.
 
PIntVector fColorList
 List of ROOT TColor codes (from RGB) for plotting.
 

Detailed Description

Handles the musrfit XML startup configuration file (musrfit_startup.xml).

PStartupHandler is responsible for locating, parsing, and providing access to the musrfit startup configuration file. This XML file contains default settings that customize musrfit behavior across different installations and user preferences.

Configuration File Contents

The musrfit_startup.xml file stores:

  • Data search paths: Directories to search for μSR data files
  • Run name templates: Instrument-specific patterns for constructing data file paths
  • Fourier transform defaults: Units, apodization, plot type, phase settings
  • ROOT marker list: Marker styles for data point display
  • ROOT color list: RGB colors for multi-run plotting

File Search Order

The startup file is searched in the following locations (first found wins):

  1. Current working directory: ./musrfit_startup.xml
  2. User config directory: $HOME/.musrfit/musrfit_startup.xml
  3. MUSRFITPATH environment: $MUSRFITPATH/musrfit_startup.xml
  4. ROOT installation: $ROOTSYS/bin/musrfit_startup.xml (with warning)

If no file is found, a default configuration is automatically created in $HOME/.musrfit/musrfit_startup.xml.

XML File Structure

<?xml version="1.0" encoding="UTF-8"?>
<musrfit xmlns="http://lmu.web.psi.ch/musrfit/user/MUSR/WebHome.html">
<comment>Configuration description</comment>
<data_path>/path/to/data/directory</data_path>
<run_name_template inst="gps">d%yyyy%/tdc/root/deltat_tdc_gps_%yyyy%_%rrrr%.root</run_name_template>
<fourier_settings>
<units>Gauss</units>
<fourier_power>0</fourier_power>
<apodization>none</apodization>
<plot>real_and_imag</plot>
<phase>0.0</phase>
<phase_increment>1.0</phase_increment>
</fourier_settings>
<root_settings>
<marker_list>
<marker>24</marker>
</marker_list>
<color_list>
<color>255,0,0</color>
</color_list>
</root_settings>
</musrfit>

Run Name Templates

Run name templates use placeholders for automatic file path construction:

  • yyyy% : 4-digit year (e.g., 2024)
  • yy% : 2-digit year (e.g., 24)
  • rrrr% : 4-digit run number with leading zeros
  • rrrrr% : 5-digit run number with leading zeros

Example: dyyyy%/tdc/root/deltat_tdc_gps_yyyy_rrrr%.root → d2024/tdc/root/deltat_tdc_gps_2024_1234.root

SAX Parser Implementation

This class implements the TQObject signal/slot mechanism to handle SAX parser callbacks. The parser events trigger the following methods:

Usage Example

// Create handler (searches for and parses startup file)
PStartupHandler startupHandler;
// Check if configuration was loaded successfully
if (startupHandler.StartupFileFound()) {
// Get data search paths
PStringVector paths = startupHandler.GetDataPathList();
// Get Fourier transform defaults
PMsrFourierStructure fourier = startupHandler.GetFourierDefaults();
// Get plotting colors and markers
PIntVector colors = startupHandler.GetColorList();
PIntVector markers = startupHandler.GetMarkerList();
}
std::vector< Int_t > PIntVector
Definition PMusr.h:367
std::vector< TString > PStringVector
Definition PMusr.h:403
PStartupHandler(bool reset_startup_file=false)
Constructor that locates and parses the musrfit startup configuration file.
virtual Bool_t StartupFileFound()
Checks if the startup configuration file was successfully located.
virtual const PStringVector GetDataPathList() const
Returns the list of data file search paths.
virtual const PIntVector GetColorList() const
Returns the list of ROOT color codes for plotting.
virtual PMsrFourierStructure GetFourierDefaults()
Returns Fourier transform default settings.
virtual const PIntVector GetMarkerList() const
Returns the list of ROOT marker codes for plotting.
See also
PMsrHandler for MSR file parsing
PRunDataHandler for data file loading with path resolution

Definition at line 162 of file PStartupHandler.h.

Member Enumeration Documentation

◆ EKeyWords

Enumeration of XML element types for SAX parser state machine.

Used by OnStartElement() to set parsing context and by OnCharacters() to determine how to interpret element content.

Enumerator
eEmpty 

No active element (between elements or unknown)

eComment 

Inside <comment> element.

eDataPath 

Inside <data_path> element.

eRunNameTemplate 

Inside <run_name_template> element.

eOptions 

Inside <options> element (reserved)

eFourierSettings 

Inside <fourier_settings> container.

eUnits 

Inside <units> element (Gauss/Tesla/MHz/Mc/s)

eFourierPower 

Inside <fourier_power> element (0-20)

eApodization 

Inside <apodization> element (none/weak/medium/strong)

ePlot 

Inside <plot> element (real/imag/real_and_imag/power/phase)

ePhase 

Inside <phase> element (degrees)

ePhaseIncrement 

Inside <phase_increment> element (degrees per step)

eRootSettings 

Inside <root_settings> container.

eMarkerList 

Inside <marker_list> container.

eMarker 

Inside <marker> element (ROOT marker code)

eColorList 

Inside <color_list> container.

eColor 

Inside <color> element (RGB comma-separated)

Definition at line 301 of file PStartupHandler.h.

Constructor & Destructor Documentation

◆ PStartupHandler()

PStartupHandler::PStartupHandler ( bool reset_startup_file = false)

Constructor that locates and parses the musrfit startup configuration file.

Constructor that locates and optionally resets the musrfit startup configuration.

Searches for musrfit_startup.xml in standard locations and parses it if found. If no file is found, creates a default configuration in $HOME/.musrfit/.

Search order:

  1. ./musrfit_startup.xml (current directory)
  2. $HOME/.musrfit/musrfit_startup.xml
  3. $MUSRFITPATH/musrfit_startup.xml
  4. $ROOTSYS/bin/musrfit_startup.xml (with warning)
Parameters
reset_startup_fileIf true and file is found, rewrites it with default content. Useful for restoring corrupted or outdated configurations.
Note
The actual XML parsing is performed by connecting this handler to a TSAXParser and calling parseXmlFile() externally.
See also
StartupFileFound(), GetStartupFilePath()

Searches for the musrfit_startup.xml configuration file in standard locations and initializes the handler. If no file is found, creates a default configuration.

Search Order:

  1. Current working directory: ./musrfit_startup.xml
  2. User config directory: $HOME/.musrfit/musrfit_startup.xml
  3. MUSRFITPATH environment variable: $MUSRFITPATH/musrfit_startup.xml
  4. ROOT installation: $ROOTSYS/bin/musrfit_startup.xml (with warning)

File Creation: If no startup file is found in any location, a default configuration is automatically created at $HOME/.musrfit/musrfit_startup.xml. This includes:

  • Standard PSI facility data paths
  • Run name templates for all PSI instruments
  • Default Fourier transform settings
  • Standard marker and color lists

Reset Mode: When reset_startup_file=true and a file is found, the existing file is overwritten with default content. This is useful for:

  • Restoring corrupted configurations
  • Updating to new default settings after software updates
  • Resetting user customizations to defaults
Parameters
reset_startup_fileIf true, overwrites existing startup file with defaults. If false (default), uses existing file or creates new one.
Note
This constructor only locates the file. Actual XML parsing must be performed separately by connecting this handler to a TSAXParser and calling parseXmlFile().
See also
StartupFileFound(), GetStartupFilePath(), WriteDefaultStartupFile()

Definition at line 148 of file PStartupHandler.cpp.

References fStartupFileFound, fStartupFilePath, startup_path_name, StartupFileExists(), and WriteDefaultStartupFile().

◆ ~PStartupHandler()

PStartupHandler::~PStartupHandler ( )
virtual

Destructor releasing allocated resources.

Destructor that releases all allocated configuration data.

Clears all configuration vectors:

  • fDataPathList
  • fMarkerList
  • fColorList
  • fRunNameTemplate

Clears all configuration vectors to free memory:

  • fDataPathList: Data file search paths
  • fMarkerList: ROOT marker style codes
  • fColorList: ROOT color codes
  • fRunNameTemplate: Instrument run name patterns
Note
The Fourier defaults structure is a value type and is automatically cleaned up when the object is destroyed.

Definition at line 246 of file PStartupHandler.cpp.

References fColorList, fDataPathList, fMarkerList, and fRunNameTemplate.

Member Function Documentation

◆ CheckLists()

void PStartupHandler::CheckLists ( )
virtual

Validates configuration lists and fills missing entries with defaults.

Validates configuration lists and populates empty ones with defaults.

Called at end of XML parsing to ensure all required lists have values. If a list is empty, populates it with sensible defaults:

  • Data paths: PSI facility standard locations
  • Markers: ROOT marker codes (circles, squares, triangles, etc.)
  • Colors: Standard plotting colors (black, red, green, blue, etc.)

Called at the end of XML parsing (OnEndDocument) to ensure all required configuration lists have values. If any list is empty after parsing, it is populated with sensible defaults.

Default Data Paths: Standard PSI facility data directories:

  • /mnt/data/nemu/his
  • /psi.ch/group/lmu/public/data/XXX/his/, where XXX=lem, alc, dolly, flame, gpd, gps, hal, ltf, or vms

Default Markers: ROOT TMarker style codes for distinguishing multiple data sets:

  • 24 (open circle), 25 (open square), 26 (open triangle)
  • 27 (open diamond), 28 (open cross), 29 (full star)
  • 30 (open star), 20 (full circle), 21 (full square)
  • 22 (full triangle), 23 (full down triangle)
  • 2 (thin cross), 3 (thin star), 5 (thin x)

Default Colors: Standard plotting colors (RGB → ROOT color code):

  • Black (0,0,0), Red (255,0,0), Green (0,255,0)
  • Blue (0,0,255), Magenta (255,0,255), Cyan (0,255,255)
  • Violet (156,0,255), Yellow-ish (99,101,49)
  • Dark Green (49,101,49), Orange (156,48,0)
Note
This method only populates empty lists. If a list has any entries from the XML file, no defaults are added.

Definition at line 765 of file PStartupHandler.cpp.

References fColorList, fDataPathList, and fMarkerList.

Referenced by OnEndDocument().

◆ GetColorList()

virtual const PIntVector PStartupHandler::GetColorList ( ) const
inlinevirtual

Returns the list of ROOT color codes for plotting.

Returns
Vector of ROOT TColor codes (generated from RGB values)

Definition at line 292 of file PStartupHandler.h.

References fColorList.

◆ GetDataPathList()

virtual const PStringVector PStartupHandler::GetDataPathList ( ) const
inlinevirtual

Returns the list of data file search paths.

Returns
Vector of directory paths to search for μSR data files

Definition at line 280 of file PStartupHandler.h.

References fDataPathList.

◆ GetFourierDefaults()

virtual PMsrFourierStructure PStartupHandler::GetFourierDefaults ( )
inlinevirtual

Returns Fourier transform default settings.

Returns
PMsrFourierStructure containing units, apodization, plot type, phase settings

Definition at line 268 of file PStartupHandler.h.

References fFourierDefaults.

◆ GetMarkerList()

virtual const PIntVector PStartupHandler::GetMarkerList ( ) const
inlinevirtual

Returns the list of ROOT marker codes for plotting.

Returns
Vector of ROOT TMarker style codes (e.g., 24=open circle, 25=open square)

Definition at line 286 of file PStartupHandler.h.

References fMarkerList.

◆ GetRunNameTemplateList()

virtual const PRunNameTemplateList PStartupHandler::GetRunNameTemplateList ( )
inlinevirtual

Returns the list of instrument-specific run name templates.

Returns
Vector of PRunNameTemplate structures (instrument name + path pattern)

Definition at line 274 of file PStartupHandler.h.

References fRunNameTemplate.

◆ GetStartupFilePath()

virtual TString PStartupHandler::GetStartupFilePath ( )
inlinevirtual

Returns the full path to the located startup configuration file.

Returns
Full path including filename (e.g., "/home/user/.musrfit/musrfit_startup.xml"), or empty string if not found

Definition at line 251 of file PStartupHandler.h.

References fStartupFilePath.

◆ OnCdataBlock()

void PStartupHandler::OnCdataBlock ( const Char_t * str,
Int_t len )
virtual

SAX callback: Called for CDATA blocks (unused).

SAX callback invoked when a CDATA section is encountered.

Parameters
strCDATA content
lenLength of CDATA content

Currently does nothing. CDATA sections in the startup file are not used. CDATA sections would typically be used for content containing special characters that would otherwise need escaping.

Parameters
strCDATA content (without <![CDATA[ and ]]> delimiters)
lenLength of the CDATA content in characters
Note
The musrfit_startup.xml format does not require CDATA sections as all content uses standard XML escaping where needed.

Definition at line 727 of file PStartupHandler.cpp.

◆ OnCharacters()

void PStartupHandler::OnCharacters ( const Char_t * str)
virtual

SAX callback: Called with element text content.

SAX callback invoked with text content between XML element tags.

Parameters
strText content between XML tags (the actual configuration values)

Processes element content based on the current parsing state (fKey) set by OnStartElement(). Each element type has specific parsing logic and validation.

Element Processing:

  • eDataPath: Adds path string directly to fDataPathList
  • eRunNameTemplate: Creates PRunNameTemplate with current instrument name and template string, adds to fRunNameTemplate
  • eMarker: Validates numeric string, converts to int, adds to fMarkerList
  • eColor: Parses "R,G,B" format (comma-separated integers 0-255), converts to ROOT color code via TColor::GetColor(), adds to fColorList
  • eUnits: Maps string to FOURIER_UNIT_* constant:
    • "gauss" → FOURIER_UNIT_GAUSS
    • "tesla" → FOURIER_UNIT_TESLA
    • "mhz" → FOURIER_UNIT_FREQ
    • "mc/s" → FOURIER_UNIT_CYCLES
  • eFourierPower: Validates integer 0-20, sets fFourierDefaults.fFourierPower
  • eApodization: Maps string to FOURIER_APOD_* constant:
    • "none" → FOURIER_APOD_NONE
    • "weak" → FOURIER_APOD_WEAK
    • "medium" → FOURIER_APOD_MEDIUM
    • "strong" → FOURIER_APOD_STRONG
  • ePlot: Maps string to FOURIER_PLOT_* constant:
    • "real" → FOURIER_PLOT_REAL
    • "imag" → FOURIER_PLOT_IMAG
    • "real_and_imag" → FOURIER_PLOT_REAL_AND_IMAG
    • "power" → FOURIER_PLOT_POWER
    • "phase" → FOURIER_PLOT_PHASE
  • ePhase: Validates float, adds to fFourierDefaults.fPhase vector
  • ePhaseIncrement: Validates float, sets fFourierDefaults.fPhaseIncrement
Parameters
strText content between XML tags
Note
Invalid values generate warning messages to stderr but do not cause parsing to fail. The invalid value is simply ignored.

Definition at line 452 of file PStartupHandler.cpp.

References eApodization, eColor, eDataPath, eFourierPower, eMarker, ePhase, ePhaseIncrement, ePlot, eRunNameTemplate, eUnits, fColorList, fCurrentInstrumentName, fDataPathList, fFourierDefaults, fKey, fMarkerList, FOURIER_APOD_MEDIUM, FOURIER_APOD_NONE, FOURIER_APOD_STRONG, FOURIER_APOD_WEAK, FOURIER_PLOT_IMAG, FOURIER_PLOT_PHASE, FOURIER_PLOT_POWER, FOURIER_PLOT_REAL, FOURIER_PLOT_REAL_AND_IMAG, FOURIER_UNIT_CYCLES, FOURIER_UNIT_FREQ, FOURIER_UNIT_GAUSS, FOURIER_UNIT_TESLA, fRunNameTemplate, PRunNameTemplate::instrument, and PRunNameTemplate::runNameTemplate.

◆ OnComment()

void PStartupHandler::OnComment ( const Char_t * str)
virtual

SAX callback: Called when XML comment is found (unused).

SAX callback invoked when an XML comment is encountered.

Parameters
strComment text

Currently does nothing. XML comments in the startup file are ignored.

Parameters
strComment text content (without <!-- and –> delimiters)
Note
Comments in musrfit_startup.xml are for documentation purposes only and have no effect on configuration.

Definition at line 637 of file PStartupHandler.cpp.

◆ OnEndDocument()

void PStartupHandler::OnEndDocument ( )
virtual

SAX callback: Called when XML document parsing ends. Triggers CheckLists() to ensure all required settings have values.

SAX callback invoked at the end of XML document parsing.

Finalizes configuration by calling CheckLists() to ensure all required settings have values. If any list is empty after parsing, it will be populated with default values.

Note
This is a SAX parser callback connected via TQObject signals. It is automatically called by TSAXParser when parsing completes.
See also
CheckLists()

Definition at line 311 of file PStartupHandler.cpp.

References CheckLists().

◆ OnEndElement()

void PStartupHandler::OnEndElement ( const Char_t * str)
virtual

SAX callback: Called when an XML end element is encountered.

SAX callback invoked when an XML end element tag is encountered.

Parameters
strElement name (unused, resets parsing state)

Resets the parsing state (fKey) to eEmpty, indicating that any subsequent character data should be ignored until the next start element is found.

Parameters
strXML element name (unused, state is always reset to eEmpty)
Note
The element name parameter is not used because all elements reset to the same state. This simplifies handling of nested elements.

Definition at line 395 of file PStartupHandler.cpp.

References eEmpty, and fKey.

◆ OnError()

void PStartupHandler::OnError ( const Char_t * str)
virtual

SAX callback: Called when XML parser encounters an error.

SAX callback invoked when the XML parser encounters an error.

Parameters
strError message (output to stderr)

Outputs the error message to stderr with a "PStartupHandler **ERROR**" prefix. Errors indicate significant parsing problems such as:

  • Malformed XML syntax
  • Missing required elements
  • Invalid attribute values
Parameters
strError message from the XML parser
Note
Depending on error severity, parsing may or may not continue. The configuration may be incomplete after errors.

Definition at line 681 of file PStartupHandler.cpp.

◆ OnFatalError()

void PStartupHandler::OnFatalError ( const Char_t * str)
virtual

SAX callback: Called when XML parser encounters a fatal error.

SAX callback invoked when the XML parser encounters a fatal error.

Parameters
strFatal error message (output to stderr)

Outputs the error message to stderr with a "PStartupHandler **FATAL ERROR**" prefix. Fatal errors indicate unrecoverable parsing failures such as:

  • Document not well-formed (mismatched tags)
  • Invalid XML declaration
  • Character encoding that cannot be processed
Parameters
strFatal error message from the XML parser
Warning
After a fatal error, parsing stops immediately and the configuration will be incomplete. CheckLists() will provide default values for missing settings when OnEndDocument() is called.

Definition at line 705 of file PStartupHandler.cpp.

◆ OnStartDocument()

void PStartupHandler::OnStartDocument ( )
virtual

SAX callback: Called when XML document parsing begins. Initializes all configuration variables to default values.

SAX callback invoked at the start of XML document parsing.

Initializes all configuration variables to default values before parsing begins. This ensures a clean state even if the same handler is reused.

Initialization:

  • fKey = eEmpty (no active element)
  • Fourier defaults:
    • fFourierBlockPresent = false
    • fUnits = FOURIER_UNIT_GAUSS
    • fFourierPower = 0 (no zero-padding)
    • fApodization = FOURIER_APOD_NONE
    • fPlotTag = FOURIER_PLOT_REAL_AND_IMAG
    • fRangeForPhaseCorrection = [-1.0, -1.0] (auto)
    • fPlotRange = [-1.0, -1.0] (auto)
    • fPhaseIncrement = 1.0 degree
Note
This is a SAX parser callback connected via TQObject signals. It is automatically called by TSAXParser at document start.

Definition at line 279 of file PStartupHandler.cpp.

References eEmpty, fFourierDefaults, fKey, FOURIER_APOD_NONE, FOURIER_PLOT_REAL_AND_IMAG, and FOURIER_UNIT_GAUSS.

◆ OnStartElement()

void PStartupHandler::OnStartElement ( const Char_t * str,
const TList * attributes )
virtual

SAX callback: Called when an XML start element is encountered.

SAX callback invoked when an XML start element tag is encountered.

Parameters
strElement name (e.g., "data_path", "marker", "units")
attributesXML attributes (used for inst attribute in run_name_template)

Identifies the element type and sets the parsing state (fKey) accordingly. This state is used by OnCharacters() to determine how to process element content.

Recognized Elements:

  • data_path → eDataPath (data file search directory)
  • run_name_template → eRunNameTemplate (with inst attribute extraction)
  • marker → eMarker (ROOT marker style code)
  • color → eColor (RGB color specification)
  • units → eUnits (Fourier frequency units)
  • fourier_power → eFourierPower (zero-padding power)
  • apodization → eApodization (windowing function)
  • plot → ePlot (Fourier plot type)
  • phase → ePhase (Fourier phase value)
  • phase_increment → ePhaseIncrement (phase adjustment step)

Attribute Handling: For run_name_template elements, extracts the inst attribute value and stores it in fCurrentInstrumentName for use when processing the element content.

Parameters
strXML element name (tag name without angle brackets)
attributesTList of TXMLAttr objects containing element attributes
Note
Unrecognized elements leave fKey unchanged (typically eEmpty), causing their content to be ignored.

Definition at line 349 of file PStartupHandler.cpp.

References eApodization, eColor, eDataPath, eFourierPower, eMarker, ePhase, ePhaseIncrement, ePlot, eRunNameTemplate, eUnits, fCurrentInstrumentName, and fKey.

◆ OnWarning()

void PStartupHandler::OnWarning ( const Char_t * str)
virtual

SAX callback: Called when XML parser issues a warning.

SAX callback invoked when the XML parser generates a warning.

Parameters
strWarning message (output to stderr)

Outputs the warning message to stderr with a "PStartupHandler **WARNING**" prefix. Warnings typically indicate non-fatal issues such as:

  • Deprecated XML constructs
  • Minor schema violations
  • Character encoding issues
Parameters
strWarning message from the XML parser
Note
Parsing continues after warnings; they do not cause failure.

Definition at line 658 of file PStartupHandler.cpp.

◆ StartupFileExists()

Bool_t PStartupHandler::StartupFileExists ( Char_t * fln)
private

Checks if a file exists at the specified path.

Checks if a file exists and is readable at the specified path.

Parameters
flnFull path to check
Returns
true if file exists and is readable, false otherwise

Attempts to open the file for reading to verify its existence and accessibility. The file is immediately closed after the check.

Parameters
flnFull filesystem path to the file to check
Returns
true if file exists and can be opened for reading, false if file does not exist or cannot be accessed
Note
This method uses std::ifstream for portability across platforms. It only checks readability, not write permissions.

Definition at line 834 of file PStartupHandler.cpp.

Referenced by PStartupHandler().

◆ StartupFileFound()

virtual Bool_t PStartupHandler::StartupFileFound ( )
inlinevirtual

Checks if the startup configuration file was successfully located.

Returns
true if musrfit_startup.xml was found (in any search location), false otherwise

Definition at line 244 of file PStartupHandler.h.

References fStartupFileFound.

◆ WriteDefaultStartupFile()

Bool_t PStartupHandler::WriteDefaultStartupFile ( bool reset_startup_file = false)
private

Creates or overwrites a startup file with default configuration.

Creates or overwrites a startup configuration file with default content.

Writes a complete musrfit_startup.xml with:

  • Standard PSI data paths
  • Run name templates for all PSI instruments
  • Default Fourier settings
  • Standard marker and color lists
Parameters
reset_startup_fileIf true, overwrites existing file at fStartupFilePath. If false, creates new file at $HOME/.musrfit/musrfit_startup.xml.
Returns
true on success, false on write failure

Writes a complete musrfit_startup.xml file containing comprehensive default settings for the musrfit package. This method is called when:

  • No startup file is found in any search location
  • User requests reset of existing configuration (reset_startup_file=true)

File Location:

  • If reset_startup_file=true: Overwrites file at fStartupFilePath
  • If reset_startup_file=false: Creates new file at $HOME/.musrfit/musrfit_startup.xml (creates .musrfit directory if it doesn't exist)

Default Content Includes:

Data Paths:

  • PSI LEM, GPS, GPD, Dolly, Flame, HIFI, LTF, ALC data directories
  • Both local mount points and NFS paths

Run Name Templates:

  • Templates for all PSI μSR instruments (GPS, GPD, Dolly, Flame, etc.)
  • Templates for various data formats (ROOT, binary, MDU)
  • Year and run number placeholder patterns

Fourier Settings:

  • Units: Gauss
  • Fourier power: 0 (no zero-padding)
  • Apodization: none
  • Plot type: real_and_imag
  • Phase: 0.0 degrees
  • Phase increment: 1.0 degree

ROOT Settings:

  • Marker list: 14 distinct marker styles
  • Color list: 10 distinct colors (RGB format)
Parameters
reset_startup_fileIf true, overwrites existing file at fStartupFilePath. If false, creates new file at $HOME/.musrfit/musrfit_startup.xml.
Returns
true if file was successfully written, false on error:
  • $HOME environment variable not set
  • Cannot create .musrfit directory
  • Cannot open file for writing
See also
PStartupHandler() constructor, CheckLists()

Definition at line 899 of file PStartupHandler.cpp.

References fStartupFilePath, and startup_path_name.

Referenced by PStartupHandler().

Member Data Documentation

◆ fColorList

PIntVector PStartupHandler::fColorList
private

List of ROOT TColor codes (from RGB) for plotting.

Definition at line 329 of file PStartupHandler.h.

Referenced by CheckLists(), GetColorList(), OnCharacters(), and ~PStartupHandler().

◆ fCurrentInstrumentName

TString PStartupHandler::fCurrentInstrumentName
private

Instrument name from run_name_template inst attribute.

Definition at line 324 of file PStartupHandler.h.

Referenced by OnCharacters(), and OnStartElement().

◆ fDataPathList

PStringVector PStartupHandler::fDataPathList
private

List of directories to search for data files.

Definition at line 326 of file PStartupHandler.h.

Referenced by CheckLists(), GetDataPathList(), OnCharacters(), and ~PStartupHandler().

◆ fFourierDefaults

PMsrFourierStructure PStartupHandler::fFourierDefaults
private

Fourier transform default settings structure.

Definition at line 325 of file PStartupHandler.h.

Referenced by GetFourierDefaults(), OnCharacters(), and OnStartDocument().

◆ fKey

EKeyWords PStartupHandler::fKey
private

Current XML element type (SAX parser state)

Definition at line 321 of file PStartupHandler.h.

Referenced by OnCharacters(), OnEndElement(), OnStartDocument(), and OnStartElement().

◆ fMarkerList

PIntVector PStartupHandler::fMarkerList
private

List of ROOT TMarker style codes for plotting.

Definition at line 328 of file PStartupHandler.h.

Referenced by CheckLists(), GetMarkerList(), OnCharacters(), and ~PStartupHandler().

◆ fRunNameTemplate

PRunNameTemplateList PStartupHandler::fRunNameTemplate
private

List of instrument-specific run name patterns.

Definition at line 327 of file PStartupHandler.h.

Referenced by GetRunNameTemplateList(), OnCharacters(), and ~PStartupHandler().

◆ fStartupFileFound

Bool_t PStartupHandler::fStartupFileFound
private

True if musrfit_startup.xml was located.

Definition at line 322 of file PStartupHandler.h.

Referenced by PStartupHandler(), and StartupFileFound().

◆ fStartupFilePath

TString PStartupHandler::fStartupFilePath
private

Full path to located startup file (empty if not found)

Definition at line 323 of file PStartupHandler.h.

Referenced by GetStartupFilePath(), PStartupHandler(), and WriteDefaultStartupFile().


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