option "title from data file" added to musrfit
This commit is contained in:
parent
2114c1670c
commit
c8fc4a95fe
@ -87,7 +87,6 @@ PMsrHandler::PMsrHandler(char *fileName) : fFileName(fileName)
|
|||||||
*/
|
*/
|
||||||
PMsrHandler::~PMsrHandler()
|
PMsrHandler::~PMsrHandler()
|
||||||
{
|
{
|
||||||
fComments.clear();
|
|
||||||
fParam.clear();
|
fParam.clear();
|
||||||
fTheory.clear();
|
fTheory.clear();
|
||||||
fFunctions.clear();
|
fFunctions.clear();
|
||||||
@ -166,8 +165,7 @@ int PMsrHandler::ReadMsrFile()
|
|||||||
current.fLineNo = line_no;
|
current.fLineNo = line_no;
|
||||||
current.fLine = line;
|
current.fLine = line;
|
||||||
|
|
||||||
if (line.BeginsWith("#") || line.IsWhitespace()) { // if the line is a comment/empty line keep it
|
if (line.BeginsWith("#") || line.IsWhitespace()) { // if the line is a comment/empty go to the next one
|
||||||
fComments.push_back(current);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,12 +295,6 @@ int PMsrHandler::ReadMsrFile()
|
|||||||
plot.clear();
|
plot.clear();
|
||||||
statistic.clear();
|
statistic.clear();
|
||||||
|
|
||||||
// cout << endl << "# Comments: ";
|
|
||||||
// for (unsigned int i=0; i<fComments.size(); i++) {
|
|
||||||
// cout << endl << fComments[i].fLineNo << " " << fComments[i].fLine.Data();
|
|
||||||
// }
|
|
||||||
// cout << endl;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cout << endl << ">> FOURIER Block:";
|
cout << endl << ">> FOURIER Block:";
|
||||||
cout << endl << ">> Fourier Block Present : " << fFourier.fFourierBlockPresent;
|
cout << endl << ">> Fourier Block Present : " << fFourier.fFourierBlockPresent;
|
||||||
@ -410,6 +402,9 @@ int PMsrHandler::WriteMsrLogFile(const bool messages)
|
|||||||
// handle blocks
|
// handle blocks
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case MSR_TAG_TITLE:
|
case MSR_TAG_TITLE:
|
||||||
|
if (lineNo == 1)
|
||||||
|
fout << fTitle.Data() << endl;
|
||||||
|
else
|
||||||
fout << str.Data() << endl;
|
fout << str.Data() << endl;
|
||||||
break;
|
break;
|
||||||
case MSR_TAG_FITPARAMETER:
|
case MSR_TAG_FITPARAMETER:
|
||||||
|
@ -389,6 +389,10 @@ bool PRunDataHandler::ReadRootFile(bool notPostPileup)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get run title
|
||||||
|
TObjString ostr = runHeader->GetRunTitle();
|
||||||
|
runData.fRunTitle = ostr.GetString();
|
||||||
|
|
||||||
// get temperature
|
// get temperature
|
||||||
runData.fTemp = runHeader->GetSampleTemperature();
|
runData.fTemp = runHeader->GetSampleTemperature();
|
||||||
|
|
||||||
@ -490,7 +494,7 @@ bool PRunDataHandler::ReadRootFile(bool notPostPileup)
|
|||||||
*/
|
*/
|
||||||
bool PRunDataHandler::ReadNexusFile()
|
bool PRunDataHandler::ReadNexusFile()
|
||||||
{
|
{
|
||||||
cout << endl << "PRunDataHandler::ReadNexusFile(): Sorry, not yet implemented ...";
|
cout << endl << "PRunDataHandler::ReadNexusFile(): Sorry, not yet implemented, ask Alex Amato ...";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,8 @@ class PMsrHandler
|
|||||||
virtual unsigned int GetNoOfParams() { return fParam.size(); }
|
virtual unsigned int GetNoOfParams() { return fParam.size(); }
|
||||||
virtual const TString& GetFileName() const { return fFileName; }
|
virtual const TString& GetFileName() const { return fFileName; }
|
||||||
|
|
||||||
|
virtual void SetMsrTitle(const TString &title) { fTitle = title; }
|
||||||
|
|
||||||
virtual bool SetMsrParamValue(unsigned int i, double value);
|
virtual bool SetMsrParamValue(unsigned int i, double value);
|
||||||
virtual bool SetMsrParamStep(unsigned int i, double value);
|
virtual bool SetMsrParamStep(unsigned int i, double value);
|
||||||
virtual bool SetMsrParamPosErrorPresent(unsigned int i, bool value);
|
virtual bool SetMsrParamPosErrorPresent(unsigned int i, bool value);
|
||||||
@ -96,7 +98,6 @@ class PMsrHandler
|
|||||||
virtual bool CheckFuncs();
|
virtual bool CheckFuncs();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PMsrLines fComments; ///< holds the comments of the msr-file
|
|
||||||
TString fFileName; ///< file name of the msr-file
|
TString fFileName; ///< file name of the msr-file
|
||||||
TString fMsrFileDirectoryPath; ///< msr-file directory path
|
TString fMsrFileDirectoryPath; ///< msr-file directory path
|
||||||
TString fTitle; ///< holds the title string of the msr-file
|
TString fTitle; ///< holds the title string of the msr-file
|
||||||
|
@ -57,8 +57,8 @@ using namespace std;
|
|||||||
*/
|
*/
|
||||||
void musrfit_syntax()
|
void musrfit_syntax()
|
||||||
{
|
{
|
||||||
cout << endl << "usage: musrfit [<msr-file> [-k, --keep-mn2-ouput] [-c, --chisq-only] [--dump <type>] |";
|
cout << endl << "usage: musrfit [<msr-file> [-k, --keep-mn2-ouput] [-c, --chisq-only] [-t, --title-from-data-file]";
|
||||||
cout << endl << " --version | --help";
|
cout << endl << " [--dump <type>] | --version | --help";
|
||||||
cout << endl << " <msr-file>: msr input file";
|
cout << endl << " <msr-file>: msr input file";
|
||||||
cout << endl << " 'musrfit <msr-file>' will execute musrfit";
|
cout << endl << " 'musrfit <msr-file>' will execute musrfit";
|
||||||
cout << endl << " 'musrfit' or 'musrfit --help' will show this help";
|
cout << endl << " 'musrfit' or 'musrfit --help' will show this help";
|
||||||
@ -70,6 +70,9 @@ void musrfit_syntax()
|
|||||||
cout << endl << " -c, --chisq-only: instead of fitting the data, chisq is just calculated";
|
cout << endl << " -c, --chisq-only: instead of fitting the data, chisq is just calculated";
|
||||||
cout << endl << " once and the result is set to the stdout. This feature is useful";
|
cout << endl << " once and the result is set to the stdout. This feature is useful";
|
||||||
cout << endl << " to adjust initial parameters.";
|
cout << endl << " to adjust initial parameters.";
|
||||||
|
cout << endl << " -t, --title-from-data-file: will replace the <msr-file> run title by the";
|
||||||
|
cout << endl << " run title of the FIRST run of the <msr-file> run block, if a run title";
|
||||||
|
cout << endl << " is present in the data file.";
|
||||||
cout << endl << " --dump <type> is writing a data file with the fit data and the theory";
|
cout << endl << " --dump <type> is writing a data file with the fit data and the theory";
|
||||||
cout << endl << " <type> can be 'ascii', 'root'" << endl;
|
cout << endl << " <type> can be 'ascii', 'root'" << endl;
|
||||||
cout << endl << " At the end of a fit, musrfit writes the fit results into an <mlog-file> and";
|
cout << endl << " At the end of a fit, musrfit writes the fit results into an <mlog-file> and";
|
||||||
@ -325,6 +328,8 @@ int main(int argc, char *argv[])
|
|||||||
int status;
|
int status;
|
||||||
bool keep_mn2_output = false;
|
bool keep_mn2_output = false;
|
||||||
bool chisq_only = false;
|
bool chisq_only = false;
|
||||||
|
bool title_from_data_file = false;
|
||||||
|
|
||||||
TString dump("");
|
TString dump("");
|
||||||
char filename[1024];
|
char filename[1024];
|
||||||
|
|
||||||
@ -359,6 +364,8 @@ int main(int argc, char *argv[])
|
|||||||
keep_mn2_output = true;
|
keep_mn2_output = true;
|
||||||
} else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--chisq-only")) {
|
} else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--chisq-only")) {
|
||||||
chisq_only = true;
|
chisq_only = true;
|
||||||
|
} else if (!strcmp(argv[i], "-t") || !strcmp(argv[i], "--title-from-data-file")) {
|
||||||
|
title_from_data_file = true;
|
||||||
} else if (!strcmp(argv[i], "--dump")) {
|
} else if (!strcmp(argv[i], "--dump")) {
|
||||||
if (i<argc-1) {
|
if (i<argc-1) {
|
||||||
dump = TString(argv[i+1]);
|
dump = TString(argv[i+1]);
|
||||||
@ -446,6 +453,14 @@ int main(int argc, char *argv[])
|
|||||||
cout << endl << "**ERROR** Couldn't read all data files, will quit ..." << endl;
|
cout << endl << "**ERROR** Couldn't read all data files, will quit ..." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if present, replace the run title of the <msr-file> with the run title of the FIRST run in the run block of the msr-file
|
||||||
|
if (title_from_data_file) {
|
||||||
|
PMsrRunList *rl = msrHandler->GetMsrRunList();
|
||||||
|
PRawRunData *rrd = dataHandler->GetRunData(rl->at(0).fRunName[0]);
|
||||||
|
if (rrd->fRunTitle.Length() > 0)
|
||||||
|
msrHandler->SetMsrTitle(rrd->fRunTitle);
|
||||||
|
}
|
||||||
|
|
||||||
// generate the necessary fit histogramms for the fit
|
// generate the necessary fit histogramms for the fit
|
||||||
PRunListCollection *runListCollection = 0;
|
PRunListCollection *runListCollection = 0;
|
||||||
if (success) {
|
if (success) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user