musrfit
1.9.2
|
#include <PMsr2Data.h>
Public Member Functions | |
PMsr2Data (const std::string &) | |
~PMsr2Data () | |
int | SetRunNumbers (unsigned int) |
int | SetRunNumbers (unsigned int, unsigned int) |
int | SetRunNumbers (const std::string &) |
int | SetRunNumbers (const std::vector< unsigned int > &) |
unsigned int | GetPresentRun () const |
int | DetermineRunNumberDigits (unsigned int, bool) const |
int | CheckRunNumbersInRange () const |
int | ParseXmlStartupFile () |
int | ReadMsrFile (const std::string &) const |
int | ReadRunDataFile () |
bool | PrepareNewInputFile (unsigned int, bool) const |
bool | PrepareGlobalInputFile (unsigned int, const std::string &, unsigned int) const |
int | WriteOutput (const std::string &, const std::vector< unsigned int > &, bool, unsigned int, bool global=false, unsigned int counter=0) const |
Private Member Functions | |
bool | PrepareNewSortedInputFile (unsigned int) const |
PMsrHandler * | GetSingleRunMsrFile () const |
void | WriteValue (std::fstream &outFile, const double &value, const unsigned int &width) const |
void | WriteValue (std::fstream &outFile, const double &value, const double &errValue, const unsigned int &width, const bool &db) const |
int | GetFirstSignificantDigit (const double &value) const |
bool | InParameterList (const unsigned int ¶mValue, const std::vector< unsigned int > &) const |
Private Attributes | |
std::string | fFileExtension |
std::vector< unsigned int > | fRunVector |
std::vector< unsigned int >::const_iterator | fRunVectorIter |
bool | fRunListFile |
std::vector< std::string > | fIndVar |
std::unique_ptr< std::ifstream > | fRunListFileStream |
std::unique_ptr< TSAXParser > | fSaxParser |
std::unique_ptr< PStartupHandler > | fStartupHandler |
std::unique_ptr< PRunDataHandler > | fDataHandler |
std::unique_ptr< PMsrHandler > | fMsrHandler |
unsigned int | fNumGlobalParam |
unsigned int | fNumSpecParam |
unsigned int | fNumTempRunBlocks |
unsigned int | fRunNumberDigits |
bool | fHeaderWritten |
Class providing the necessary utilities for msr2data: generate new msr-files from a template, collect fit parameters from msr-files and write them to DB or plain ASCII files
Definition at line 51 of file PMsr2Data.h.
PMsr2Data::PMsr2Data | ( | const std::string & | ext | ) |
Constructor
ext | extension/suffix of the msr-files to be processed |
Definition at line 58 of file PMsr2Data.cpp.
References fDataHandler, fMsrHandler, fRunVector, fRunVectorIter, fSaxParser, and fStartupHandler.
PMsr2Data::~PMsr2Data | ( | ) |
Destructor
Definition at line 72 of file PMsr2Data.cpp.
References fIndVar, fRunVector, and fRunVectorIter.
int PMsr2Data::CheckRunNumbersInRange | ( | ) | const |
Checks if all given run numbers are in the range covered by the number of digits used in the data file name
return:
Definition at line 185 of file PMsr2Data.cpp.
References fRunNumberDigits, and fRunVector.
int PMsr2Data::DetermineRunNumberDigits | ( | unsigned int | runNo, |
bool | normalMode | ||
) | const |
Determines the number of digits used for the run number in the data file name from the first msr-file that is processed If the specified run number is the first one of the list of runs and it cannot be opened, then the rest of the given runs is checked until an existing msr-file is found
return:
runNo | run number of an msr-file |
normalMode | false for global mode |
Definition at line 95 of file PMsr2Data.cpp.
References fFileExtension, fRunNumberDigits, fRunVector, and fRunVectorIter.
|
private |
Determines the first significant digit of the provided number value. E.g. for value=2.03 it will return 1, for value=0.00023 it will return 4, etc.
value | for which the first significant digit needs to be determined. |
Definition at line 2496 of file PMsr2Data.cpp.
Referenced by WriteValue().
unsigned int PMsr2Data::GetPresentRun | ( | ) | const |
Determines the current run number
return:
Definition at line 209 of file PMsr2Data.cpp.
References fRunVector, and fRunVectorIter.
|
private |
Read in the single run msr-file corresponding to the position in the run-vector into a secondary msr-handler different from the class member
return:
Definition at line 432 of file PMsr2Data.cpp.
References fFileExtension, fRunVectorIter, PMUSR_MSR_FILE_NOT_FOUND, PMUSR_MSR_SYNTAX_ERROR, PMUSR_SUCCESS, PMsrHandler::ReadMsrFile(), and status.
Referenced by PrepareGlobalInputFile().
|
private |
Checks paramValue is found in the paramList. If paramList is empty, ALL paramValues will be accepted, i.e. return true.
paramValue | paramValue to be checked |
paramList | parameter list |
Definition at line 2526 of file PMsr2Data.cpp.
Referenced by WriteOutput().
int PMsr2Data::ParseXmlStartupFile | ( | ) |
Parse the musrfit startup xml file
return:
Definition at line 374 of file PMsr2Data.cpp.
References fSaxParser, fStartupHandler, parseXmlFile(), startup_path_name, and status.
bool PMsr2Data::PrepareGlobalInputFile | ( | unsigned int | tempRun, |
const std::string & | msrOutFile, | ||
unsigned int | globalPlus | ||
) | const |
Generate a new global msr-file from a template
return:
tempRun | template run number |
msrOutFile | name of the global msr-file to be written |
globalPlus | tag of the global mode to be used:
|
Definition at line 633 of file PMsr2Data.cpp.
References compare_parameters(), fFileExtension, fMsrHandler, fNumGlobalParam, fNumSpecParam, fNumTempRunBlocks, fRunNumberDigits, fRunVector, fRunVectorIter, PMsrHandler::GetMsrParamList(), GetSingleRunMsrFile(), MSR_PARAM_FUN_OFFSET, PMUSR_SUCCESS, PrepareNewInputFile(), PrepareNewSortedInputFile(), ReadMsrFile(), and status.
bool PMsr2Data::PrepareNewInputFile | ( | unsigned int | tempRun, |
bool | calledFromGlobalMode | ||
) | const |
Generate a new single-run msr file from a template
return:
tempRun | template run number |
calledFromGlobalMode | tag specifying if the routine is called as part of the global msr-file generation |
Definition at line 494 of file PMsr2Data.cpp.
References fFileExtension, fRunNumberDigits, fRunVector, and fRunVectorIter.
Referenced by PrepareGlobalInputFile().
|
private |
Generate a new msr-file for a single run in which the parameters are sorted for a global fit An internal sorted msr-file data structure has to be present.
return:
tempRun | template run number |
Definition at line 1516 of file PMsr2Data.cpp.
References fFileExtension, fMsrHandler, fNumGlobalParam, fNumTempRunBlocks, fRunNumberDigits, fRunVectorIter, PMUSR_SUCCESS, and status.
Referenced by PrepareGlobalInputFile().
int PMsr2Data::ReadMsrFile | ( | const std::string & | infile | ) | const |
Read in a msr-file into the default structure
return:
infile | name of the msr-file to be read |
Definition at line 402 of file PMsr2Data.cpp.
References fMsrHandler, PMUSR_MSR_FILE_NOT_FOUND, PMUSR_MSR_SYNTAX_ERROR, PMUSR_SUCCESS, and status.
Referenced by PrepareGlobalInputFile().
int PMsr2Data::ReadRunDataFile | ( | ) |
Read in a run data-file
return:
Definition at line 465 of file PMsr2Data.cpp.
References fDataHandler, fMsrHandler, and fStartupHandler.
int PMsr2Data::SetRunNumbers | ( | unsigned int | runNo | ) |
Initialization of the internal list of runs using a single run number
return:
runNo | run number |
Definition at line 227 of file PMsr2Data.cpp.
References fRunVector, and fRunVectorIter.
int PMsr2Data::SetRunNumbers | ( | unsigned int | runNoStart, |
unsigned int | runNoEnd | ||
) |
Initialization of the internal list of runs using first and last run numbers
return:
runNoStart | first run number |
runNoEnd | last run number |
Definition at line 250 of file PMsr2Data.cpp.
References fRunVector, and fRunVectorIter.
int PMsr2Data::SetRunNumbers | ( | const std::string & | runListFile | ) |
Initialization of the internal list of runs using a run list file
return:
runListFile | name of run list file |
Definition at line 306 of file PMsr2Data.cpp.
References fIndVar, fRunListFile, fRunListFileStream, fRunVector, and fRunVectorIter.
int PMsr2Data::SetRunNumbers | ( | const std::vector< unsigned int > & | runListVector | ) |
Initialization of the internal list of runs using explicitly specified run numbers
return:
runListVector | vector containing the run numbers to be processed |
Definition at line 279 of file PMsr2Data.cpp.
References fRunVector, and fRunVectorIter.
int PMsr2Data::WriteOutput | ( | const std::string & | outfile, |
const std::vector< unsigned int > & | paramList, | ||
bool | db, | ||
unsigned int | withHeader, | ||
bool | global = false , |
||
unsigned int | counter = 0 |
||
) | const |
Append fit parameters of a msr file to the DB or ASCII file
return:
outfile | name of the DB/ASCII output file |
paramList | parameter list which shall be written to the output file |
db | DB or plain ASCII output |
withHeader | write output file header or not |
global | global mode or not |
counter | counter used within the global mode to determine how many runs have been processed already |
Definition at line 1622 of file PMsr2Data.cpp.
References fDataHandler, fHeaderWritten, fIndVar, fMsrHandler, fNumGlobalParam, fNumSpecParam, fNumTempRunBlocks, fRunListFile, fRunListFileStream, fRunNumberDigits, fRunVector, fRunVectorIter, PRawRunData::GetEnergy(), PRawRunData::GetField(), PRawRunData::GetMuonSpinAngle(), PRawRunData::GetNoOfTemperatures(), PRawRunData::GetRingAnode(), PRawRunData::GetTemperature(), PRawRunData::GetTempError(), PRawRunData::GetTransport(), InParameterList(), PMUSR_SUCCESS, PMUSR_UNDEFINED, and WriteValue().
|
private |
Write formatted output to column-formatted ASCII output file
outFile | output file stream to the ASCII file |
value | number to be written to the ASCII file |
width | column width of the ASCII file |
Definition at line 2443 of file PMsr2Data.cpp.
Referenced by WriteOutput().
|
private |
Write a value to the outFile stream. The string length is determined on its error. E.g. 17.0023 +- 0.0018, or 73212.081 +- 0.033, etc.
outFile | output stream object |
value | to be written to stream outFile |
errValue | error of the value. needed to determine the needed accuracy |
width | field width for outFile for formatted output |
db | true for db-file output, false for dat-file output. Needed to have at least on space between numbers for dat-file output |
Definition at line 2463 of file PMsr2Data.cpp.
References GetFirstSignificantDigit().
|
mutableprivate |
Definition at line 92 of file PMsr2Data.h.
Referenced by PMsr2Data(), ReadRunDataFile(), and WriteOutput().
|
private |
Definition at line 84 of file PMsr2Data.h.
Referenced by DetermineRunNumberDigits(), GetSingleRunMsrFile(), PrepareGlobalInputFile(), PrepareNewInputFile(), and PrepareNewSortedInputFile().
|
mutableprivate |
Definition at line 98 of file PMsr2Data.h.
Referenced by WriteOutput().
|
private |
Definition at line 88 of file PMsr2Data.h.
Referenced by SetRunNumbers(), WriteOutput(), and ~PMsr2Data().
|
mutableprivate |
Definition at line 93 of file PMsr2Data.h.
Referenced by PMsr2Data(), PrepareGlobalInputFile(), PrepareNewSortedInputFile(), ReadMsrFile(), ReadRunDataFile(), and WriteOutput().
|
mutableprivate |
Definition at line 94 of file PMsr2Data.h.
Referenced by PrepareGlobalInputFile(), PrepareNewSortedInputFile(), and WriteOutput().
|
mutableprivate |
Definition at line 95 of file PMsr2Data.h.
Referenced by PrepareGlobalInputFile(), and WriteOutput().
|
mutableprivate |
Definition at line 96 of file PMsr2Data.h.
Referenced by PrepareGlobalInputFile(), PrepareNewSortedInputFile(), and WriteOutput().
|
private |
Definition at line 87 of file PMsr2Data.h.
Referenced by SetRunNumbers(), and WriteOutput().
|
private |
Definition at line 89 of file PMsr2Data.h.
Referenced by SetRunNumbers(), and WriteOutput().
|
mutableprivate |
Definition at line 97 of file PMsr2Data.h.
Referenced by CheckRunNumbersInRange(), DetermineRunNumberDigits(), PrepareGlobalInputFile(), PrepareNewInputFile(), PrepareNewSortedInputFile(), and WriteOutput().
|
private |
Definition at line 85 of file PMsr2Data.h.
Referenced by CheckRunNumbersInRange(), DetermineRunNumberDigits(), GetPresentRun(), PMsr2Data(), PrepareGlobalInputFile(), PrepareNewInputFile(), SetRunNumbers(), WriteOutput(), and ~PMsr2Data().
|
mutableprivate |
Definition at line 86 of file PMsr2Data.h.
Referenced by DetermineRunNumberDigits(), GetPresentRun(), GetSingleRunMsrFile(), PMsr2Data(), PrepareGlobalInputFile(), PrepareNewInputFile(), PrepareNewSortedInputFile(), SetRunNumbers(), WriteOutput(), and ~PMsr2Data().
|
private |
Definition at line 90 of file PMsr2Data.h.
Referenced by ParseXmlStartupFile(), and PMsr2Data().
|
private |
Definition at line 91 of file PMsr2Data.h.
Referenced by ParseXmlStartupFile(), PMsr2Data(), and ReadRunDataFile().