use Claude ai to generate doxygen documentation.
All checks were successful
Build and Deploy Documentation / build-and-deploy (push) Successful in 17s

This commit is contained in:
2025-11-10 15:14:08 +01:00
parent 262b5a36aa
commit 3d07894b2d
8 changed files with 1749 additions and 129 deletions

View File

@@ -35,42 +35,188 @@
#include "PMusr.h"
#include "PMsrHandler.h"
//-------------------------------------------------------------
/**
* <p>Data file format identifiers for any2many converter.
*
* <p>These constants identify different μSR data file formats supported
* by musrfit for reading and conversion.
*/
/// Undefined or unknown format
#define A2M_UNDEFINED 0
/// Generic ROOT file
#define A2M_ROOT 1
/// MusrRoot format (PSI-specific ROOT structure)
#define A2M_MUSR_ROOT 2
/// MusrRoot with directory structure
#define A2M_MUSR_ROOT_DIR 3
/// PSI binary format
#define A2M_PSIBIN 4
/// PSI MDU ASCII format
#define A2M_PSIMDU 5
/// TRIUMF MUD (Muon Data) format
#define A2M_MUD 6
/// NeXus HDF5 format (ISIS, JPARC)
#define A2M_NEXUS 7
/// WKM format (older PSI format)
#define A2M_WKM 8
/// Generic ASCII format
#define A2M_ASCII 9
//-------------------------------------------------------------
/**
* <p>Handler class needed to read/handle raw data files.
* <p>Raw data file reader and format converter.
*
* <p>PRunDataHandler is the I/O layer for musrfit, responsible for:
* - Loading raw histogram data from multiple file formats
* - Converting between different μSR data formats
* - Searching multiple data paths for run files
* - Reading run metadata (field, temperature, time, etc.)
* - Managing collections of runs for simultaneous fits
*
* <p><b>Supported file formats:</b>
* - <b>MusrRoot:</b> PSI ROOT-based format with comprehensive metadata
* - <b>NeXus:</b> HDF5-based format (ISIS, JPARC)
* - <b>MUD:</b> TRIUMF's binary format
* - <b>PSI-BIN:</b> Legacy PSI binary format
* - <b>WKM:</b> Older PSI format
* - <b>ASCII:</b> Text-based formats (for non-μSR data)
* - <b>DB/DAT:</b> Database formats for general x-y data
*
* <p><b>Key features:</b>
* - Automatic format detection
* - Run name template expansion (e.g., "run%r.root" → "run2425.root")
* - Multi-path search (search common data directories)
* - Batch file conversion (any2many tool)
* - Metadata extraction and validation
*
* <p><b>Example usage:</b>
* @code
* PRunDataHandler handler(msrInfo, dataPaths);
* handler.ReadData(); // Reads all runs specified in MSR file
* PRawRunData *data = handler.GetRunData(0);
* @endcode
*/
class PRunDataHandler
{
public:
/// Default constructor
PRunDataHandler();
/**
* <p>Constructor for single file with explicit format.
*
* @param fileName Path to data file
* @param fileFormat Format string ("root", "nexus", "mud", etc.)
*/
PRunDataHandler(TString fileName, const TString fileFormat);
/**
* <p>Constructor with search paths.
*
* @param fileName File name or template
* @param fileFormat Format string
* @param dataPath Vector of directories to search for data files
*/
PRunDataHandler(TString fileName, const TString fileFormat, const PStringVector dataPath);
/**
* <p>Constructor for reading single file into provided structure.
*
* @param fileName File name
* @param fileFormat Format string
* @param dataPath Data search path
* @param runData Reference to PRawRunData to fill
*/
PRunDataHandler(TString fileName, const TString fileFormat, const TString dataPath, PRawRunData &runData);
/**
* <p>Constructor for format conversion (any2many).
*
* @param any2ManyInfo Conversion configuration structure
*/
PRunDataHandler(PAny2ManyInfo *any2ManyInfo);
/**
* <p>Constructor for format conversion with search paths.
*
* @param any2ManyInfo Conversion configuration
* @param dataPath Vector of search directories
*/
PRunDataHandler(PAny2ManyInfo *any2ManyInfo, const PStringVector dataPath);
/**
* <p>Constructor for MSR-based data loading.
*
* @param msrInfo MSR file handler (provides run list and paths)
*/
PRunDataHandler(PMsrHandler *msrInfo);
/**
* <p>Constructor for MSR-based loading with custom search paths.
*
* @param msrInfo MSR file handler
* @param dataPath Vector of directories to search
*/
PRunDataHandler(PMsrHandler *msrInfo, const PStringVector dataPath);
virtual ~PRunDataHandler();
/**
* <p>Reads all data files specified in MSR file or configuration.
*
* <p>Searches data paths, detects formats, loads histograms and
* metadata. Call this before attempting to access run data.
*/
virtual void ReadData();
/**
* <p>Performs format conversion (for any2many utility).
*
* <p>Converts loaded data to the target format specified in
* any2many configuration.
*/
virtual void ConvertData();
/**
* <p>Writes data to file in specified format.
*
* @param fileName Output file name (empty = use default)
* @return true on success, false on error
*/
virtual Bool_t WriteData(TString fileName="");
/// Returns true if all required data files were successfully loaded
/// @return Data availability status
virtual Bool_t IsAllDataAvailable() const { return fAllDataAvailable; }
/**
* <p>Gets run data by run name.
*
* @param runName Name of run to retrieve
* @return Pointer to PRawRunData, or nullptr if not found
*/
virtual PRawRunData* GetRunData(const TString &runName);
/**
* <p>Gets run data by index.
*
* @param idx Run index (0-based)
* @return Pointer to PRawRunData, or nullptr if out of range
*/
virtual PRawRunData* GetRunData(const UInt_t idx=0);
/// Returns the number of loaded run data sets
/// @return Number of runs
virtual Int_t GetNoOfRunData() {return fData.size(); }
/**
* <p>Sets or replaces run data at specified index.
*
* @param data Pointer to PRawRunData to store
* @param idx Index where to store data (default=0)
* @return true on success
*/
virtual Bool_t SetRunData(PRawRunData *data, UInt_t idx=0);
private: