|
musrfit 1.10.0
|
PFindRun - Locates muSR data files using template-based path resolution. More...
#include <PFindRun.h>
Public Member Functions | |
| PFindRun (const PStringVector path, const PRunNameTemplateList runNameTemplateList) | |
| Default constructor - Creates instance without search parameters. | |
| PFindRun (const PStringVector path, const PRunNameTemplateList runNameTemplateList, const TString &instrument, const UInt_t year, const UInt_t run, const TString file_format="") | |
| Full constructor - Creates instance and prepares for file search. | |
| Bool_t | FoundPathName () |
| Searches for the run file using configured templates and paths. | |
| TString | GetPathName () |
| Returns the full path to the found run file. | |
| void | DumpTemplateList () |
| Debug utility - Prints current search configuration to stdout. | |
Private Member Functions | |
| TString | CreatePathName (const TString path, const TString runNameTemplate) |
| Generates full file path by substituting template placeholders. | |
Private Attributes | |
| const PStringVector | fPath |
| Search paths for data files. | |
| const PRunNameTemplateList | fRunNameTemplateList |
| Template patterns per instrument. | |
| TString | fInstrument {""} |
| Target instrument name (e.g., "GPS", "LEM") | |
| Int_t | fYear {-1} |
| Run year (-1 if not specified) | |
| Int_t | fRun {-1} |
| Run number (-1 if not specified) | |
| TString | fFileFormat {""} |
| Optional file format filter (empty = any) | |
| TString | fPathName {""} |
| Resolved full path (empty until found) | |
PFindRun - Locates muSR data files using template-based path resolution.
This class searches for muSR run data files across multiple paths using configurable templates that encode instrument naming conventions. It supports various file formats (ROOT, NeXus, PSI-BIN, PSI-MDU, MUD, WKM) and handles year/run number substitution in file paths.
The template system uses placeholders:
Definition at line 68 of file PFindRun.h.
| PFindRun::PFindRun | ( | const PStringVector | path, |
| const PRunNameTemplateList | runNameTemplateList ) |
Default constructor - Creates instance without search parameters.
Initializes the finder with paths and templates but no specific run to search. Use the full constructor to perform automatic searches.
| path | Vector of directory paths to search |
| runNameTemplateList | List of template patterns for different instruments |
| runNameTemplateList |
Definition at line 40 of file PFindRun.cpp.
References fPath, and fRunNameTemplateList.
| PFindRun::PFindRun | ( | const PStringVector | path, |
| const PRunNameTemplateList | runNameTemplateList, | ||
| const TString & | instrument, | ||
| const UInt_t | year, | ||
| const UInt_t | run, | ||
| const TString | file_format = "" ) |
Full constructor - Creates instance and prepares for file search.
Initializes the finder with all parameters needed to locate a specific run file. Call FoundPathName() after construction to perform the actual search.
| path | Vector of directory paths to search |
| runNameTemplateList | List of template patterns for different instruments |
| instrument | Instrument name (must match a template entry, e.g., "GPS", "LEM") |
| year | Run year (e.g., 2023) |
| run | Run number (e.g., 2425) |
| file_format | Optional file format filter: "MusrRoot"/"ROOT", "NeXus", "PSI-BIN", "PSI-MDU", "MUD", "WKM". Empty string matches any format. |
| path | |
| runNameTemplateList | |
| instrument | |
| year | |
| run |
Definition at line 56 of file PFindRun.cpp.
References fFileFormat, fInstrument, fPath, fRun, fRunNameTemplateList, and fYear.
|
private |
Generates full file path by substituting template placeholders.
Internal helper that replaces year and run number placeholders in a template with actual values. Supports variable-length run number formatting (2-9 digits).
| path | Base directory path |
| runNameTemplate | Template string with placeholders (yyyy%, yy%, rr...r%) |
| path | |
| runNameTemplate |
Definition at line 89 of file PFindRun.cpp.
Referenced by FoundPathName().
| void PFindRun::DumpTemplateList | ( | ) |
Debug utility - Prints current search configuration to stdout.
Outputs instrument name, year, run number, and all available templates with their patterns. Useful for troubleshooting path resolution issues.
Definition at line 69 of file PFindRun.cpp.
References fInstrument, fRun, fRunNameTemplateList, and fYear.
| Bool_t PFindRun::FoundPathName | ( | ) |
Searches for the run file using configured templates and paths.
Iterates through all paths containing the instrument name, applies matching templates, and checks filesystem for file existence. If a file format is specified, only files with matching extensions are considered.
Definition at line 133 of file PFindRun.cpp.
References CreatePathName(), fFileFormat, fInstrument, fPath, fPathName, and fRunNameTemplateList.
Referenced by main().
|
inline |
Returns the full path to the found run file.
Definition at line 128 of file PFindRun.h.
References fPathName.
Referenced by main().
|
private |
Optional file format filter (empty = any)
Definition at line 145 of file PFindRun.h.
Referenced by FoundPathName(), and PFindRun().
|
private |
Target instrument name (e.g., "GPS", "LEM")
Definition at line 142 of file PFindRun.h.
Referenced by DumpTemplateList(), FoundPathName(), and PFindRun().
|
private |
Search paths for data files.
Definition at line 140 of file PFindRun.h.
Referenced by FoundPathName(), PFindRun(), and PFindRun().
|
private |
Resolved full path (empty until found)
Definition at line 146 of file PFindRun.h.
Referenced by FoundPathName(), and GetPathName().
|
private |
Run number (-1 if not specified)
Definition at line 144 of file PFindRun.h.
Referenced by CreatePathName(), DumpTemplateList(), and PFindRun().
|
private |
Template patterns per instrument.
Definition at line 141 of file PFindRun.h.
Referenced by DumpTemplateList(), FoundPathName(), PFindRun(), and PFindRun().
|
private |
Run year (-1 if not specified)
Definition at line 143 of file PFindRun.h.
Referenced by CreatePathName(), DumpTemplateList(), and PFindRun().