This commit is contained in:
2016-12-14 13:52:44 +01:00
189 changed files with 4123 additions and 2024 deletions

View File

@ -1643,13 +1643,23 @@ bool PMsr2Data::PrepareNewSortedInputFile(unsigned int tempRun) const
* - -2 if a fit has not converged (and the data is not appended to the output file)
*
* \param outfile name of the DB/ASCII output file
* \param paramList parameter list which shall be written to the output file
* \param db DB or plain ASCII output
* \param withHeader write output file header or not
* \param global global mode or not
* \param counter counter used within the global mode to determine how many runs have been processed already
*/
int PMsr2Data::WriteOutput(const string &outfile, bool db, unsigned int withHeader, bool global, unsigned int counter) const
int PMsr2Data::WriteOutput(const string &outfile, const vector<unsigned int>& paramList, bool db,
unsigned int withHeader, bool global, unsigned int counter) const
{
// make sure that the parameter number of the parameter list stays within proper bounds
for (unsigned int i=0; i<paramList.size(); i++) {
if (paramList[i] > fMsrHandler->GetMsrParamList()->size()) {
cerr << "msr2data: **ERROR** found parameter " << paramList[i] << " which is out of bound (>" << fMsrHandler->GetMsrParamList()->size() << ")." << endl;
return -1;
}
}
if (!to_lower_copy(outfile).compare("none")) {
fRunVectorIter++;
return PMUSR_SUCCESS;
@ -2008,7 +2018,7 @@ int PMsr2Data::WriteOutput(const string &outfile, bool db, unsigned int withHead
if (fDataHandler) {
for (unsigned int i(0); i < dataParamLabels.size(); ++i) {
outFile << dataParamLabels[i] << endl;
outFile << dataParamLabels[i] << endl;
}
}
@ -2022,22 +2032,26 @@ int PMsr2Data::WriteOutput(const string &outfile, bool db, unsigned int withHead
if (global) {
string tempName;
for (unsigned int i(0); i < fNumGlobalParam; ++i) {
outFile << (*msrParamList)[i].fName.Data() << endl;
if (InParameterList(i, paramList))
outFile << (*msrParamList)[i].fName.Data() << endl;
}
for (unsigned int i(0); i < fNumSpecParam; ++i) {
tempName = (*msrParamList)[fNumGlobalParam + fNumSpecParam*counter + i].fName.Data();
string::size_type loc = tempName.rfind(curRunNumber.str());
if (loc == tempName.length() - fRunNumberDigits) {
outFile << tempName.substr(0, loc) << endl;
} else {
cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!";
cerr << endl << ">> msr2data: **ERROR** The output will be flawed!";
cerr << endl;
if (InParameterList(fNumGlobalParam + fNumSpecParam*counter + i, paramList)) {
tempName = (*msrParamList)[fNumGlobalParam + fNumSpecParam*counter + i].fName.Data();
string::size_type loc = tempName.rfind(curRunNumber.str());
if (loc == tempName.length() - fRunNumberDigits) {
outFile << tempName.substr(0, loc) << endl;
} else {
cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!";
cerr << endl << ">> msr2data: **ERROR** The output will be flawed!";
cerr << endl;
}
}
}
} else {
for (unsigned int i(0); i < msrNoOfParams; ++i) {
outFile << (*msrParamList)[i].fName.Data() << endl;
if (InParameterList(i, paramList))
outFile << (*msrParamList)[i].fName.Data() << endl;
}
}
@ -2073,22 +2087,26 @@ int PMsr2Data::WriteOutput(const string &outfile, bool db, unsigned int withHead
if (global) {
string tempName;
for (unsigned int i(0); i < fNumGlobalParam; ++i) {
outFile << " " << (*msrParamList)[i].fName.Data();
if (InParameterList(i, paramList))
outFile << " " << (*msrParamList)[i].fName.Data();
}
for (unsigned int i(0); i < fNumSpecParam; ++i) {
tempName = (*msrParamList)[fNumGlobalParam + fNumSpecParam*counter + i].fName.Data();
string::size_type loc = tempName.rfind(curRunNumber.str());
if (loc == tempName.length() - fRunNumberDigits) {
outFile << " " << tempName.substr(0, loc);
} else {
cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!";
cerr << endl << ">> msr2data: **ERROR** The output will be flawed!";
cerr << endl;
if (InParameterList(i, paramList)) {
tempName = (*msrParamList)[fNumGlobalParam + fNumSpecParam*counter + i].fName.Data();
string::size_type loc = tempName.rfind(curRunNumber.str());
if (loc == tempName.length() - fRunNumberDigits) {
outFile << " " << tempName.substr(0, loc);
} else {
cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!";
cerr << endl << ">> msr2data: **ERROR** The output will be flawed!";
cerr << endl;
}
}
}
} else {
for (unsigned int i(0); i < msrNoOfParams; ++i) {
outFile << " " << (*msrParamList)[i].fName.Data();
if (InParameterList(i, paramList))
outFile << " " << (*msrParamList)[i].fName.Data();
}
}
@ -2132,61 +2150,67 @@ int PMsr2Data::WriteOutput(const string &outfile, bool db, unsigned int withHead
string tempName;
unsigned int idx;
for (unsigned int i(0); i < fNumGlobalParam; ++i) {
outFile << (*msrParamList)[i].fName.Data() << " = ";
if ((*msrParamList)[i].fPosErrorPresent) {
WriteValue(outFile, (*msrParamList)[i].fValue, (*msrParamList)[i].fPosError, outFile.width(), db);
outFile << ", ";
} else {
outFile << (*msrParamList)[i].fValue << ", ";
}
if (InParameterList(i, paramList)) {
outFile << (*msrParamList)[i].fName.Data() << " = ";
if ((*msrParamList)[i].fPosErrorPresent) {
WriteValue(outFile, (*msrParamList)[i].fValue, (*msrParamList)[i].fPosError, outFile.width(), db);
outFile << ", ";
} else {
outFile << (*msrParamList)[i].fValue << ", ";
}
if ((*msrParamList)[i].fPosErrorPresent)
outFile << (*msrParamList)[i].fPosError << ", ";
else
outFile << fabs((*msrParamList)[i].fStep) << ", ";
outFile << fabs((*msrParamList)[i].fStep) << ",\\" << endl;
if ((*msrParamList)[i].fPosErrorPresent)
outFile << (*msrParamList)[i].fPosError << ", ";
else
outFile << fabs((*msrParamList)[i].fStep) << ", ";
outFile << fabs((*msrParamList)[i].fStep) << ",\\" << endl;
}
}
for (unsigned int i(0); i < fNumSpecParam; ++i) {
idx = fNumGlobalParam + fNumSpecParam*counter + i;
tempName = (*msrParamList)[idx].fName.Data();
string::size_type loc = tempName.rfind(curRunNumber.str());
if (loc == tempName.length() - fRunNumberDigits) {
outFile << tempName.substr(0, loc) << " = ";
if ((*msrParamList)[idx].fPosErrorPresent) {
WriteValue(outFile, (*msrParamList)[idx].fValue, (*msrParamList)[idx].fPosError, outFile.width(), db);
outFile << ", ";
} else {
outFile << (*msrParamList)[idx].fValue << ", ";
}
if ((*msrParamList)[idx].fPosErrorPresent) {
WriteValue(outFile, (*msrParamList)[idx].fPosError, (*msrParamList)[idx].fPosError, outFile.width(), db);
outFile << ", ";
} else {
if (InParameterList(idx, paramList)) {
tempName = (*msrParamList)[idx].fName.Data();
string::size_type loc = tempName.rfind(curRunNumber.str());
if (loc == tempName.length() - fRunNumberDigits) {
outFile << tempName.substr(0, loc) << " = ";
if ((*msrParamList)[idx].fPosErrorPresent) {
WriteValue(outFile, (*msrParamList)[idx].fValue, (*msrParamList)[idx].fPosError, outFile.width(), db);
outFile << ", ";
} else {
outFile << (*msrParamList)[idx].fValue << ", ";
}
if ((*msrParamList)[idx].fPosErrorPresent) {
WriteValue(outFile, (*msrParamList)[idx].fPosError, (*msrParamList)[idx].fPosError, outFile.width(), db);
outFile << ", ";
} else {
WriteValue(outFile, (*msrParamList)[idx].fStep, (*msrParamList)[idx].fStep, outFile.width(), db);
outFile << ", ";
}
WriteValue(outFile, (*msrParamList)[idx].fStep, (*msrParamList)[idx].fStep, outFile.width(), db);
outFile << ", ";
outFile << ",\\" << endl;
}
WriteValue(outFile, (*msrParamList)[idx].fStep, (*msrParamList)[idx].fStep, outFile.width(), db);
outFile << ",\\" << endl;
}
}
} else {
for (unsigned int i(0); i < msrNoOfParams; ++i) {
outFile << (*msrParamList)[i].fName.Data() << " = ";
if ((*msrParamList)[i].fPosErrorPresent) {
WriteValue(outFile, (*msrParamList)[i].fValue, (*msrParamList)[i].fPosError, outFile.width(), db);
outFile << ", ";
} else {
outFile << (*msrParamList)[i].fValue << ", ";
}
if ((*msrParamList)[i].fPosErrorPresent) {
WriteValue(outFile, (*msrParamList)[i].fPosError, (*msrParamList)[i].fPosError, outFile.width(), db);
outFile << ", ";
} else {
if (InParameterList(i, paramList)) {
outFile << (*msrParamList)[i].fName.Data() << " = ";
if ((*msrParamList)[i].fPosErrorPresent) {
WriteValue(outFile, (*msrParamList)[i].fValue, (*msrParamList)[i].fPosError, outFile.width(), db);
outFile << ", ";
} else {
outFile << (*msrParamList)[i].fValue << ", ";
}
if ((*msrParamList)[i].fPosErrorPresent) {
WriteValue(outFile, (*msrParamList)[i].fPosError, (*msrParamList)[i].fPosError, outFile.width(), db);
outFile << ", ";
} else {
WriteValue(outFile, (*msrParamList)[i].fStep, (*msrParamList)[i].fStep, outFile.width(), db);
outFile << ", ";
}
WriteValue(outFile, (*msrParamList)[i].fStep, (*msrParamList)[i].fStep, outFile.width(), db);
outFile << ", ";
outFile << ",\\" << endl;
}
WriteValue(outFile, (*msrParamList)[i].fStep, (*msrParamList)[i].fStep, outFile.width(), db);
outFile << ",\\" << endl;
}
}
@ -2221,30 +2245,38 @@ int PMsr2Data::WriteOutput(const string &outfile, bool db, unsigned int withHead
string s;
if (global) {
for (unsigned int i(0); i < fNumGlobalParam; ++i) {
s = (*msrParamList)[i].fName.Data();
length = s.length();
if (length > maxlength)
maxlength = length;
}
for (unsigned int i(0); i < fNumSpecParam; ++i) {
s = (*msrParamList)[fNumGlobalParam + fNumSpecParam*counter + i].fName.Data();
string::size_type loc = s.rfind(curRunNumber.str());
if (loc == s.length() - fRunNumberDigits) {
length = s.length() - fRunNumberDigits;
if (InParameterList(i, paramList)) {
s = (*msrParamList)[i].fName.Data();
length = s.length();
if (length > maxlength)
maxlength = length;
} else {
cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!";
cerr << endl << ">> msr2data: **ERROR** The output will be flawed!";
cerr << endl;
}
}
unsigned int idx;
for (unsigned int i(0); i < fNumSpecParam; ++i) {
idx = fNumGlobalParam + fNumSpecParam*counter + i;
if (InParameterList(idx, paramList)) {
s = (*msrParamList)[idx].fName.Data();
string::size_type loc = s.rfind(curRunNumber.str());
if (loc == s.length() - fRunNumberDigits) {
length = s.length() - fRunNumberDigits;
if (length > maxlength)
maxlength = length;
} else {
cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!";
cerr << endl << ">> msr2data: **ERROR** The output will be flawed!";
cerr << endl;
}
}
}
} else {
for (unsigned int i(0); i < msrNoOfParams; ++i) {
s = (*msrParamList)[i].fName.Data();
length = s.length();
if (length > maxlength)
maxlength = length;
if (InParameterList(i, paramList)) {
s = (*msrParamList)[i].fName.Data();
length = s.length();
if (length > maxlength)
maxlength = length;
}
}
}
if (maxlength < 13)
@ -2274,31 +2306,39 @@ int PMsr2Data::WriteOutput(const string &outfile, bool db, unsigned int withHead
// in the GLOBAL mode write only global parameters and those which belong to the actual run - in the NORMAL mode write all parameters
if (global) {
for (unsigned int i(0); i < fNumGlobalParam; ++i) {
s = (*msrParamList)[i].fName.Data();
outFile << setw(maxlength) << left << s \
<< setw(maxlength + 6) << left << s + "PosErr" \
<< setw(maxlength + 6) << left << s + "NegErr";
}
for (unsigned int i(0); i < fNumSpecParam; ++i) {
s = (*msrParamList)[fNumGlobalParam + fNumSpecParam*counter + i].fName.Data();
string::size_type loc = s.rfind(curRunNumber.str());
if (loc == s.length() - fRunNumberDigits) {
s = s.substr(0, loc);
if (InParameterList(i, paramList)) {
s = (*msrParamList)[i].fName.Data();
outFile << setw(maxlength) << left << s \
<< setw(maxlength + 6) << left << s + "PosErr" \
<< setw(maxlength + 6) << left << s + "NegErr";
} else {
cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!";
cerr << endl << ">> msr2data: **ERROR** The output will be flawed!";
cerr << endl;
}
}
unsigned int idx;
for (unsigned int i(0); i < fNumSpecParam; ++i) {
idx = fNumGlobalParam + fNumSpecParam*counter + i;
if (InParameterList(idx, paramList)) {
s = (*msrParamList)[idx].fName.Data();
string::size_type loc = s.rfind(curRunNumber.str());
if (loc == s.length() - fRunNumberDigits) {
s = s.substr(0, loc);
outFile << setw(maxlength) << left << s \
<< setw(maxlength + 6) << left << s + "PosErr" \
<< setw(maxlength + 6) << left << s + "NegErr";
} else {
cerr << endl << ">> msr2data: **ERROR** The run index of some parameter does not match the run number being processed!";
cerr << endl << ">> msr2data: **ERROR** The output will be flawed!";
cerr << endl;
}
}
}
} else {
for (unsigned int i(0); i < msrNoOfParams; ++i) {
s = (*msrParamList)[i].fName.Data();
outFile << setw(maxlength) << left << s \
<< setw(maxlength + 6) << left << s + "PosErr" \
<< setw(maxlength + 6) << left << s + "NegErr";
if (InParameterList(i, paramList)) {
s = (*msrParamList)[i].fName.Data();
outFile << setw(maxlength) << left << s \
<< setw(maxlength + 6) << left << s + "PosErr" \
<< setw(maxlength + 6) << left << s + "NegErr";
}
}
}
s.clear();
@ -2340,46 +2380,52 @@ int PMsr2Data::WriteOutput(const string &outfile, bool db, unsigned int withHead
// in the GLOBAL mode write only global parameters and those which belong to the actual run - in the NORMAL mode write all parameters
if (global) {
for (unsigned int i(0); i < fNumGlobalParam; ++i) {
if ((*msrParamList)[i].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[i].fValue, (*msrParamList)[i].fPosError, maxlength, db);
else
WriteValue(outFile, (*msrParamList)[i].fValue, maxlength);
if (InParameterList(i, paramList)) {
if ((*msrParamList)[i].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[i].fValue, (*msrParamList)[i].fPosError, maxlength, db);
else
WriteValue(outFile, (*msrParamList)[i].fValue, maxlength);
if ((*msrParamList)[i].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[i].fPosError, (*msrParamList)[i].fPosError, maxlength, db);
else
WriteValue(outFile, fabs((*msrParamList)[i].fStep), (*msrParamList)[i].fStep, maxlength, db);
if ((*msrParamList)[i].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[i].fPosError, (*msrParamList)[i].fPosError, maxlength, db);
else
WriteValue(outFile, fabs((*msrParamList)[i].fStep), (*msrParamList)[i].fStep, maxlength, db);
WriteValue(outFile, fabs((*msrParamList)[i].fStep), (*msrParamList)[i].fStep, maxlength, db);
}
}
unsigned int idx;
for (unsigned int i(0); i < fNumSpecParam; ++i) {
idx = fNumGlobalParam + fNumSpecParam*counter + i;
if ((*msrParamList)[idx].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[idx].fValue, (*msrParamList)[idx].fPosError, maxlength, db);
else
WriteValue(outFile, (*msrParamList)[idx].fValue, maxlength);
if (InParameterList(idx, paramList)) {
if ((*msrParamList)[idx].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[idx].fValue, (*msrParamList)[idx].fPosError, maxlength, db);
else
WriteValue(outFile, (*msrParamList)[idx].fValue, maxlength);
if ((*msrParamList)[idx].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[idx].fPosError, (*msrParamList)[idx].fPosError, maxlength, db);
else
WriteValue(outFile, (*msrParamList)[idx].fStep, (*msrParamList)[idx].fStep, maxlength, db);
if ((*msrParamList)[idx].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[idx].fPosError, (*msrParamList)[idx].fPosError, maxlength, db);
else
WriteValue(outFile, (*msrParamList)[idx].fStep, (*msrParamList)[idx].fStep, maxlength, db);
WriteValue(outFile, (*msrParamList)[idx].fStep, (*msrParamList)[idx].fStep, maxlength, db);
}
}
} else {
for (unsigned int i(0); i < msrNoOfParams; ++i) {
if ((*msrParamList)[i].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[i].fValue, (*msrParamList)[i].fPosError, maxlength, db);
else
WriteValue(outFile, (*msrParamList)[i].fValue, maxlength);
if (InParameterList(i, paramList)) {
if ((*msrParamList)[i].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[i].fValue, (*msrParamList)[i].fPosError, maxlength, db);
else
WriteValue(outFile, (*msrParamList)[i].fValue, maxlength);
if ((*msrParamList)[i].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[i].fPosError, (*msrParamList)[i].fPosError, maxlength, db);
else
WriteValue(outFile, fabs((*msrParamList)[i].fStep), fabs((*msrParamList)[i].fStep), maxlength, db);
if ((*msrParamList)[i].fPosErrorPresent)
WriteValue(outFile, (*msrParamList)[i].fPosError, (*msrParamList)[i].fPosError, maxlength, db);
else
WriteValue(outFile, fabs((*msrParamList)[i].fStep), fabs((*msrParamList)[i].fStep), maxlength, db);
WriteValue(outFile, fabs((*msrParamList)[i].fStep), fabs((*msrParamList)[i].fStep), maxlength, db);
}
}
}
@ -2505,6 +2551,24 @@ int PMsr2Data::GetFirstSignificantDigit(const double &value) const
return prec+1;
}
//-------------------------------------------------------------
/**
*
*/
bool PMsr2Data::InParameterList(const unsigned int &paramValue, const vector<unsigned int> &paramList) const
{
// if paramList.size() == 0, i.e. use ALL parameters
if (paramList.size() == 0)
return true;
for (unsigned int i=0; i<paramList.size(); i++) {
if (paramValue+1 == paramList[i])
return true;
}
return false;
}
//-------------------------------------------------------------------------------------------------------
// end
//-------------------------------------------------------------------------------------------------------

View File

@ -5866,9 +5866,10 @@ void PMsrHandler::CheckMaxLikelihood()
{
if (!fStatistic.fChisq) {
for (UInt_t i=0; i<fRuns.size(); i++) {
if ((fRuns[i].GetFitType() != MSR_FITTYPE_SINGLE_HISTO) && (fGlobal.GetFitType() != MSR_FITTYPE_SINGLE_HISTO)) {
if ((fRuns[i].GetFitType() != MSR_FITTYPE_SINGLE_HISTO) && (fGlobal.GetFitType() != MSR_FITTYPE_SINGLE_HISTO) &&
(fRuns[i].GetFitType() != MSR_FITTYPE_MU_MINUS) && (fGlobal.GetFitType() != MSR_FITTYPE_MU_MINUS)) {
cerr << endl << ">> PMsrHandler::CheckMaxLikelihood: **WARNING**: Maximum Log Likelihood Fit is only implemented";
cerr << endl << ">> for Single Histogram Fit. Will fall back to Chi Square Fit.";
cerr << endl << ">> for Single Histogram and Mu Minus Fits. Will fall back to Chi Square Fit.";
cerr << endl << endl;
fStatistic.fChisq = true;
break;

View File

@ -1140,6 +1140,13 @@ void PMusrCanvas::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
cout << "**INFO** averaging of a single data set doesn't make any sense, will ignore 'a' ..." << endl;
return;
}
} else if (x == 'c') {
Int_t state = fDataTheoryPad->GetCrosshair();
if (state == 0)
fDataTheoryPad->SetCrosshair(2);
else
fDataTheoryPad->SetCrosshair(0);
fMainCanvas->Update();
} else {
fMainCanvas->Update();
}
@ -1516,7 +1523,6 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
Int_t xmaxBin;
Double_t xmin;
Double_t xmax;
Double_t time, freq;
Double_t xval, yval;
switch (fPlotType) {
@ -1533,29 +1539,12 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fHistoFrame->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all difference data bins
for (Int_t j=1; j<fData[i].diff->GetNbinsX(); j++) {
// get time
time = fData[i].diff->GetBinCenter(j);
// check if time is in the current range
if ((time >= xmin) && (time <= xmax)) {
dump.dataX.push_back(time);
dump.data.push_back(fData[i].diff->GetBinContent(j));
dump.dataErr.push_back(fData[i].diff->GetBinError(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.diff, xmin, xmax, dumpVector);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
GetExportDataSet(fData[i].diff, xmin, xmax, dumpVector);
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
case PV_FOURIER_REAL:
@ -1566,28 +1555,12 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fData[0].diffFourierRe->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].diffFourierRe->GetNbinsX(); j++) {
// get frequency
freq = fData[i].diffFourierRe->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].diffFourierRe->GetBinContent(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.diffFourierRe, xmin, xmax, dumpVector, false);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
GetExportDataSet(fData[i].diffFourierRe, xmin, xmax, dumpVector, false);
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
case PV_FOURIER_IMAG:
@ -1598,28 +1571,12 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fData[0].diffFourierIm->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].diffFourierIm->GetNbinsX(); j++) {
// get frequency
freq = fData[i].diffFourierIm->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].diffFourierIm->GetBinContent(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.diffFourierIm, xmin, xmax, dumpVector, false);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
GetExportDataSet(fData[i].diffFourierIm, xmin, xmax, dumpVector, false);
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
case PV_FOURIER_REAL_AND_IMAG:
@ -1630,37 +1587,14 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fData[0].diffFourierRe->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].diffFourierRe->GetNbinsX(); j++) {
// get frequency
freq = fData[i].diffFourierRe->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].diffFourierRe->GetBinContent(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.diffFourierRe, xmin, xmax, dumpVector, false);
GetExportDataSet(fDataAvg.diffFourierIm, xmin, xmax, dumpVector, false);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
GetExportDataSet(fData[i].diffFourierRe, xmin, xmax, dumpVector, false);
GetExportDataSet(fData[i].diffFourierIm, xmin, xmax, dumpVector, false);
}
for (Int_t j=1; j<fData[i].diffFourierIm->GetNbinsX(); j++) {
// get frequency
freq = fData[i].diffFourierIm->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].diffFourierIm->GetBinContent(j));
}
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
case PV_FOURIER_PWR:
@ -1671,28 +1605,12 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fData[0].diffFourierPwr->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].diffFourierPwr->GetNbinsX(); j++) {
// get frequency
freq = fData[i].diffFourierPwr->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].diffFourierPwr->GetBinContent(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.diffFourierPwr, xmin, xmax, dumpVector, false);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) {
GetExportDataSet(fData[i].diffFourierPwr, xmin, xmax, dumpVector, false);
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
case PV_FOURIER_PHASE:
@ -1703,28 +1621,12 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fData[0].diffFourierPhase->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].diffFourierPhase->GetNbinsX(); j++) {
// get frequency
freq = fData[i].diffFourierPhase->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].diffFourierPhase->GetBinContent(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.diffFourierPhase, xmin, xmax, dumpVector, false);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) {
GetExportDataSet(fData[i].diffFourierPhase, xmin, xmax, dumpVector, false);
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
default:
@ -1740,40 +1642,14 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fHistoFrame->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].data->GetNbinsX(); j++) {
// get time
time = fData[i].data->GetBinCenter(j);
// check if time is in the current range
if ((time >= xmin) && (time <= xmax)) {
dump.dataX.push_back(time);
dump.data.push_back(fData[i].data->GetBinContent(j));
dump.dataErr.push_back(fData[i].data->GetBinError(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.data, xmin, xmax, dumpVector);
GetExportDataSet(fDataAvg.theory, xmin, xmax, dumpVector, false);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) {
GetExportDataSet(fData[i].data, xmin, xmax, dumpVector);
GetExportDataSet(fData[i].theory, xmin, xmax, dumpVector, false);
}
// go through all theory bins
for (Int_t j=1; j<fData[i].theory->GetNbinsX(); j++) {
// get time
time = fData[i].theory->GetBinCenter(j);
// check if time is in the current range
if ((time >= xmin) && (time <= xmax)) {
dump.theoryX.push_back(time);
dump.theory.push_back(fData[i].theory->GetBinContent(j));
}
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
@ -1785,39 +1661,14 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fData[0].dataFourierRe->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].dataFourierRe->GetNbinsX(); j++) {
// get frequency
freq = fData[i].dataFourierRe->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].dataFourierRe->GetBinContent(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.dataFourierRe, xmin, xmax, dumpVector, false);
GetExportDataSet(fDataAvg.theoryFourierRe, xmin, xmax, dumpVector, false);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) {
GetExportDataSet(fData[i].dataFourierRe, xmin, xmax, dumpVector, false);
GetExportDataSet(fData[i].theoryFourierRe, xmin, xmax, dumpVector, false);
}
// go through all theory bins
for (Int_t j=1; j<fData[i].theoryFourierRe->GetNbinsX(); j++) {
// get frequency
freq = fData[i].theoryFourierRe->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.theoryX.push_back(freq);
dump.theory.push_back(fData[i].theoryFourierRe->GetBinContent(j));
}
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
case PV_FOURIER_IMAG:
@ -1828,39 +1679,14 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fData[0].dataFourierIm->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].dataFourierIm->GetNbinsX(); j++) {
// get frequency
freq = fData[i].dataFourierIm->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].dataFourierIm->GetBinContent(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.dataFourierIm, xmin, xmax, dumpVector, false);
GetExportDataSet(fDataAvg.theoryFourierIm, xmin, xmax, dumpVector, false);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) {
GetExportDataSet(fData[i].dataFourierIm, xmin, xmax, dumpVector, false);
GetExportDataSet(fData[i].theoryFourierIm, xmin, xmax, dumpVector, false);
}
// go through all theory bins
for (Int_t j=1; j<fData[i].theoryFourierIm->GetNbinsX(); j++) {
// get frequency
freq = fData[i].theoryFourierIm->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.theoryX.push_back(freq);
dump.theory.push_back(fData[i].theoryFourierIm->GetBinContent(j));
}
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
case PV_FOURIER_REAL_AND_IMAG:
@ -1870,80 +1696,18 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmin = fData[0].dataFourierRe->GetXaxis()->GetBinCenter(xminBin);
xmax = fData[0].dataFourierRe->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
//-----------------------------
// Re
//-----------------------------
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].dataFourierRe->GetNbinsX(); j++) {
// get frequency
freq = fData[i].dataFourierRe->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].dataFourierRe->GetBinContent(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.dataFourierRe, xmin, xmax, dumpVector, false);
GetExportDataSet(fDataAvg.theoryFourierRe, xmin, xmax, dumpVector, false);
GetExportDataSet(fDataAvg.dataFourierIm, xmin, xmax, dumpVector, false);
GetExportDataSet(fDataAvg.theoryFourierIm, xmin, xmax, dumpVector, false);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) {
GetExportDataSet(fData[i].dataFourierRe, xmin, xmax, dumpVector, false);
GetExportDataSet(fData[i].theoryFourierRe, xmin, xmax, dumpVector, false);
GetExportDataSet(fData[i].dataFourierIm, xmin, xmax, dumpVector, false);
GetExportDataSet(fData[i].theoryFourierIm, xmin, xmax, dumpVector, false);
}
// go through all theory bins
for (Int_t j=1; j<fData[i].theoryFourierRe->GetNbinsX(); j++) {
// get frequency
freq = fData[i].theoryFourierRe->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.theoryX.push_back(freq);
dump.theory.push_back(fData[i].theoryFourierRe->GetBinContent(j));
}
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
//-----------------------------
// Im
//-----------------------------
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].dataFourierIm->GetNbinsX(); j++) {
// get frequency
freq = fData[i].dataFourierIm->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].dataFourierIm->GetBinContent(j));
}
}
// go through all theory bins
for (Int_t j=1; j<fData[i].theoryFourierIm->GetNbinsX(); j++) {
// get frequency
freq = fData[i].theoryFourierIm->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.theoryX.push_back(freq);
dump.theory.push_back(fData[i].theoryFourierIm->GetBinContent(j));
}
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
case PV_FOURIER_PWR:
@ -1954,39 +1718,14 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fData[0].dataFourierPwr->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].dataFourierPwr->GetNbinsX(); j++) {
// get frequency
freq = fData[i].dataFourierPwr->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].dataFourierPwr->GetBinContent(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.dataFourierPwr, xmin, xmax, dumpVector, false);
GetExportDataSet(fDataAvg.theoryFourierPwr, xmin, xmax, dumpVector, false);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) {
GetExportDataSet(fData[i].dataFourierPwr, xmin, xmax, dumpVector, false);
GetExportDataSet(fData[i].theoryFourierPwr, xmin, xmax, dumpVector, false);
}
// go through all theory bins
for (Int_t j=1; j<fData[i].theoryFourierPwr->GetNbinsX(); j++) {
// get frequency
freq = fData[i].theoryFourierPwr->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.theoryX.push_back(freq);
dump.theory.push_back(fData[i].theoryFourierPwr->GetBinContent(j));
}
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
case PV_FOURIER_PHASE:
@ -1997,39 +1736,14 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
xmax = fData[0].dataFourierPhase->GetXaxis()->GetBinCenter(xmaxBin);
// fill ascii dump data
for (UInt_t i=0; i<fData.size(); i++) { // go through all the histogramms
// clean up dump
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=1; j<fData[i].dataFourierPhase->GetNbinsX(); j++) {
// get frequency
freq = fData[i].dataFourierPhase->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.dataX.push_back(freq);
dump.data.push_back(fData[i].dataFourierPhase->GetBinContent(j));
}
if (fAveragedView) {
GetExportDataSet(fDataAvg.dataFourierPhase, xmin, xmax, dumpVector, false);
GetExportDataSet(fDataAvg.theoryFourierPhase, xmin, xmax, dumpVector, false);
} else { // go through all the histogramms
for (UInt_t i=0; i<fData.size(); i++) {
GetExportDataSet(fData[i].dataFourierPhase, xmin, xmax, dumpVector, false);
GetExportDataSet(fData[i].theoryFourierPhase, xmin, xmax, dumpVector, false);
}
// go through all theory bins
for (Int_t j=1; j<fData[i].theoryFourierPhase->GetNbinsX(); j++) {
// get frequency
freq = fData[i].theoryFourierPhase->GetBinCenter(j);
// check if time is in the current range
if ((freq >= xmin) && (freq <= xmax)) {
dump.theoryX.push_back(freq);
dump.theory.push_back(fData[i].theoryFourierPhase->GetBinContent(j));
}
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpVector.push_back(dump);
}
break;
default:
@ -2053,8 +1767,6 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=0; j<fNonMusrData[i].diff->GetN(); j++) {
@ -2102,8 +1814,6 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
dump.dataX.clear();
dump.data.clear();
dump.dataErr.clear();
dump.theoryX.clear();
dump.theory.clear();
// go through all data bins
for (Int_t j=0; j<fNonMusrData[i].data->GetN(); j++) {
@ -2123,8 +1833,8 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
fNonMusrData[i].theory->GetPoint(j,xval,yval);
// check if time is in the current range
if ((xval >= xmin) && (xval <= xmax)) {
dump.theoryX.push_back(xval);
dump.theory.push_back(yval);
dump.dataX.push_back(xval);
dump.data.push_back(yval);
}
}
@ -2164,72 +1874,95 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
}
// find out what is the longest data/theory vector
UInt_t maxDataLength = 0;
UInt_t maxTheoryLength = 0;
UInt_t maxLength = 0;
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (maxDataLength < dumpVector[i].dataX.size())
maxDataLength = dumpVector[i].dataX.size();
if (maxTheoryLength < dumpVector[i].theoryX.size())
maxTheoryLength = dumpVector[i].theoryX.size();
if (maxLength < dumpVector[i].dataX.size())
maxLength = dumpVector[i].dataX.size();
}
// write data to file
UInt_t maxLength = 0;
if (fDifferenceView) { // difference view
// write header
switch (fCurrentPlotView) {
case PV_DATA:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "x" << i << " , diff" << i << ", errDiff" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% x, diff, errDiff" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "x" << i << " , diff" << i << ", errDiff" << i << ", ";
}
fout << "x" << dumpVector.size()-1 << " , diff" << dumpVector.size()-1 << ", errDiff" << dumpVector.size()-1 << endl;
}
fout << "x" << dumpVector.size()-1 << " , diff" << dumpVector.size()-1 << ", errDiff" << dumpVector.size()-1 << endl;
break;
case PV_FOURIER_REAL:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffRe" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% x, F_diffRe" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffRe" << i << ", ";
}
fout << "freq" << dumpVector.size()-1 << ", F_diffRe" << dumpVector.size()-1 << endl;
}
fout << "freq" << dumpVector.size()-1 << ", F_diffRe" << dumpVector.size()-1 << endl;
break;
case PV_FOURIER_IMAG:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffIm" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% x, F_diffIm" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffIm" << i << ", ";
}
fout << "freq" << dumpVector.size()-1 << ", F_diffIm" << dumpVector.size()-1 << endl;
}
fout << "freq" << dumpVector.size()-1 << ", F_diffIm" << dumpVector.size()-1 << endl;
break;
case PV_FOURIER_REAL_AND_IMAG:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()/2; i++) {
fout << "freq" << i << ", F_diffRe" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% x, F_diffRe, F_diffIm" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()/2; i++) {
fout << "freq" << i << ", F_diffRe" << i << ", ";
}
for (UInt_t i=0; i<dumpVector.size()/2-1; i++) {
fout << "freq" << i << ", F_diffIm" << i << ", ";
}
fout << "freq" << dumpVector.size()/2-1 << ", F_diffIm" << dumpVector.size()/2-1 << endl;
}
for (UInt_t i=0; i<dumpVector.size()/2-1; i++) {
fout << "freq" << i << ", F_diffIm" << i << ", ";
}
fout << "freq" << dumpVector.size()/2-1 << ", F_diffIm" << dumpVector.size()/2-1 << endl;
break;
case PV_FOURIER_PWR:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffPwr" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% x, F_diffPwr" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffPwr" << i << ", ";
}
fout << "freq" << dumpVector.size()-1 << ", F_diffPwr" << dumpVector.size()-1 << endl;
}
fout << "freq" << dumpVector.size()-1 << ", F_diffPwr" << dumpVector.size()-1 << endl;
break;
case PV_FOURIER_PHASE:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffPhase" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% x, F_diffPhase" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freq" << i << ", F_diffPhase" << i << ", ";
}
fout << "freq" << dumpVector.size()-1 << ", F_diffPhase" << dumpVector.size()-1 << endl;
}
fout << "freq" << dumpVector.size()-1 << ", F_diffPhase" << dumpVector.size()-1 << endl;
break;
default:
break;
}
maxLength = maxDataLength;
// write difference data
for (UInt_t i=0; i<maxLength; i++) {
// write difference data
@ -2264,84 +1997,119 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
// write header
switch (fCurrentPlotView) {
case PV_DATA:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
fout << "xData" << i << " , data" << i << ", errData" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% xData, data, errData, xTheory, theory" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (i % 2 == 0)
fout << "xData" << i/2 << " , data" << i/2 << ", errData" << i/2 << ", ";
else
if (i == dumpVector.size()-1)
fout << "xTheory" << (i-1)/2 << " , theory" << (i-1)/2 << endl;
else
fout << "xTheory" << (i-1)/2 << " , theory" << (i-1)/2 << ", ";
}
}
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "xTheory" << i << " , theory" << i << ", ";
}
fout << "xTheory" << dumpVector.size()-1 << " , theory" << dumpVector.size()-1 << endl;
break;
case PV_FOURIER_REAL:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
fout << "freq" << i << ", F_Re" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% freq, F_Re, freqTheo, F_theoRe" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (i % 2 == 0)
fout << "freq" << i/2 << ", F_Re" << i/2 << ", ";
else
if (i == dumpVector.size()-1)
fout << "freqTheo" << (i-1)/2 << ", F_theoRe" << (i-1)/2 << endl;
else
fout << "freqTheo" << (i-1)/2 << ", F_theoRe" << (i-1)/2 << ", ";
}
}
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freqTheo" << i << ", F_theo" << i << ", ";
}
fout << "freqTheo" << dumpVector.size()-1 << ", F_theo" << dumpVector.size()-1 << endl;
break;
case PV_FOURIER_IMAG:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
fout << "freq" << i << ", F_Im" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% freq, F_Im, freqTheo, F_theoIm" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (i % 2 == 0)
fout << "freq" << i/2 << ", F_Im" << i/2 << ", ";
else
if (i == dumpVector.size()-1)
fout << "freqTheo" << (i-1)/2 << ", F_theoIm" << (i-1)/2 << endl;
else
fout << "freqTheo" << (i-1)/2 << ", F_theoIm" << (i-1)/2 << ", ";
}
}
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freqTheo" << i << ", F_theo" << i << ", ";
}
fout << "freqTheo" << dumpVector.size()-1 << ", F_theo" << dumpVector.size()-1 << endl;
break;
case PV_FOURIER_REAL_AND_IMAG:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size()/2; i++) {
fout << "freq" << i << ", F_Re" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% freq, F_Re, freqTheo, F_theoRe, freq, F_Im, freqTheo, F_theoIm" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (i % 4 == 0)
fout << "freq" << i/4 << ", F_Re" << i/4 << ", ";
else if (i % 4 == 1)
fout << "freqTheo" << (i-1)/4 << ", F_theoRe" << (i-1)/4 << ", ";
else if (i % 4 == 2)
fout << "freq" << (i-2)/4 << ", F_Im" << (i-2)/4 << ", ";
else
if (i == dumpVector.size()-1)
fout << "freqTheo" << (i-3)/4 << ", F_theoIm" << (i-3)/4 << endl;
else
fout << "freqTheo" << (i-3)/4 << ", F_theoIm" << (i-3)/4 << ", ";
}
}
for (UInt_t i=0; i<dumpVector.size()/2; i++) {
fout << "freq" << i << ", F_Im" << i << ", ";
}
for (UInt_t i=0; i<dumpVector.size()/2; i++) {
fout << "freqTheo" << i << ", F_theoRe" << i << ", ";
}
for (UInt_t i=0; i<(dumpVector.size()-1)/2; i++) {
fout << "freqTheo" << i << ", F_theoIm" << i << ", ";
}
fout << "freqTheo" << (dumpVector.size()-1)/2 << ", F_theoIm" << (dumpVector.size()-1)/2 << endl;
break;
case PV_FOURIER_PWR:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
fout << "freq" << i << ", F_Pwr" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% freq, F_Pwr, freqTheo, F_theoPwr" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (i % 2 == 0)
fout << "freq" << i/2 << ", F_Pwr" << i/2 << ", ";
else
if (i == dumpVector.size()-1)
fout << "freqTheo" << (i-1)/2 << ", F_theoPwr" << (i-1)/2 << endl;
else
fout << "freqTheo" << (i-1)/2 << ", F_theoPwr" << (i-1)/2 << ", ";
}
}
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freqTheo" << i << ", F_theo" << i << ", ";
}
fout << "freqTheo" << dumpVector.size()-1 << ", F_theo" << dumpVector.size()-1 << endl;
break;
case PV_FOURIER_PHASE:
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
fout << "freq" << i << ", F_Phase" << i << ", ";
if (fAveragedView) {
fout << "% from averaged view" << endl;
fout << "% freq, F_Phase, freqTheo, F_theoPhase" << endl;
} else {
fout << "% ";
for (UInt_t i=0; i<dumpVector.size(); i++) {
if (i % 2 == 0)
fout << "freq" << i/2 << ", F_Phase" << i/2 << ", ";
else
if (i == dumpVector.size()-1)
fout << "freqTheo" << (i-1)/2 << ", F_theoPhase" << (i-1)/2 << endl;
else
fout << "freqTheo" << (i-1)/2 << ", F_theoPhase" << (i-1)/2 << ", ";
}
}
for (UInt_t i=0; i<dumpVector.size()-1; i++) {
fout << "freqTheo" << i << ", F_theo" << i << ", ";
}
fout << "freqTheo" << dumpVector.size()-1 << ", F_theo" << dumpVector.size()-1 << endl;
break;
default:
break;
}
if (maxDataLength > maxTheoryLength)
maxLength = maxDataLength;
else
maxLength = maxTheoryLength;
// write data and theory
for (UInt_t i=0; i<maxLength; i++) {
// write data
for (UInt_t j=0; j<dumpVector.size(); j++) {
// write data/theory
for (UInt_t j=0; j<dumpVector.size()-1; j++) {
if (i<dumpVector[j].dataX.size()) {
fout << dumpVector[j].dataX[i] << ", ";
fout << dumpVector[j].data[i] << ", ";
@ -2354,19 +2122,10 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
fout << " , , ";
}
}
// write theory
for (UInt_t j=0; j<dumpVector.size()-1; j++) {
if (i<dumpVector[j].theoryX.size()) {
fout << dumpVector[j].theoryX[i] << ", ";
fout << dumpVector[j].theory[i] << ", ";
} else {
fout << " , , ";
}
}
// write last theory entry
if (i<dumpVector[dumpVector.size()-1].theoryX.size()) {
fout << dumpVector[dumpVector.size()-1].theoryX[i] << ", ";
fout << dumpVector[dumpVector.size()-1].theory[i];
// write last data/theory entry
if (i<dumpVector[dumpVector.size()-1].dataX.size()) {
fout << dumpVector[dumpVector.size()-1].dataX[i] << ", ";
fout << dumpVector[dumpVector.size()-1].data[i];
} else {
fout << " , ";
}
@ -2382,8 +2141,6 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
dumpVector[i].dataX.clear();
dumpVector[i].data.clear();
dumpVector[i].dataErr.clear();
dumpVector[i].theoryX.clear();
dumpVector[i].theory.clear();
}
dumpVector.clear();
@ -2394,6 +2151,42 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
// }
}
//--------------------------------------------------------------------------
// GetExportDataSet (private)
//--------------------------------------------------------------------------
/**
* <p> extract data for export.
*
* \param data
* \param xmin
* \param xmax
* \param dumpData
* \param hasError
*/
void PMusrCanvas::GetExportDataSet(const TH1F *data, const Double_t xmin, const Double_t xmax,
PMusrCanvasAsciiDumpVector &dumpData, const Bool_t hasError)
{
PMusrCanvasAsciiDump dump;
Double_t x=0.0;
// go through all difference data bins
for (Int_t j=1; j<data->GetNbinsX(); j++) {
// get time/freq
x = data->GetBinCenter(j);
// check if x is in the current range
if ((x >= xmin) && (x <= xmax)) {
dump.dataX.push_back(x);
dump.data.push_back(data->GetBinContent(j));
if (hasError)
dump.dataErr.push_back(data->GetBinError(j));
}
}
// if anything found keep it
if (dump.dataX.size() > 0)
dumpData.push_back(dump);
}
//--------------------------------------------------------------------------
// CreateStyle (private)
//--------------------------------------------------------------------------

View File

@ -62,6 +62,9 @@ PRunAsymmetry::PRunAsymmetry() : PRunBase()
// the fit range can be changed in the command block, these variables need to be accessible
fGoodBins[0] = -1;
fGoodBins[1] = -1;
fStartTimeBin = -1;
fEndTimeBin = -1;
}
//--------------------------------------------------------------------------
@ -82,6 +85,9 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn
fGoodBins[0] = -1;
fGoodBins[1] = -1;
fStartTimeBin = -1;
fEndTimeBin = -1;
fPacking = fRunInfo->GetPacking();
if (fPacking == -1) { // i.e. packing is NOT given in the RUN-block, it must be given in the GLOBAL-block
fPacking = fMsrInfo->GetMsrGlobal()->GetPacking();
@ -189,15 +195,7 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector<Double_t>& par)
// calculate chi square
Double_t time(1.0);
Int_t i, N(static_cast<Int_t>(fData.GetValue()->size()));
// In order not to have an IF in the next loop, determine the start and end bins for the fit range now
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > N)
endTimeBin = N;
Int_t i;
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
@ -206,12 +204,12 @@ Double_t PRunAsymmetry::CalcChiSquare(const std::vector<Double_t>& par)
asymFcnValue = fTheory->Func(time, par, fFuncValues);
#ifdef HAVE_GOMP
Int_t chunk = (endTimeBin - startTimeBin)/omp_get_num_procs();
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,a,b,f) schedule(dynamic,chunk) reduction(+:chisq)
#endif
for (i=startTimeBin; i < endTimeBin; ++i) {
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
switch (fAlphaBetaTag) {
case 1: // alpha == 1, beta == 1
@ -389,15 +387,15 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange)
void PRunAsymmetry::CalcNoOfFitBins()
{
// In order not having to loop over all bins and to stay consistent with the chisq method, calculate the start and end bins explicitly
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > static_cast<Int_t>(fData.GetValue()->size()))
endTimeBin = fData.GetValue()->size();
fStartTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (fStartTimeBin < 0)
fStartTimeBin = 0;
fEndTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (fEndTimeBin > static_cast<Int_t>(fData.GetValue()->size()))
fEndTimeBin = fData.GetValue()->size();
if (endTimeBin > startTimeBin)
fNoOfFitBins = endTimeBin - startTimeBin;
if (fEndTimeBin > fStartTimeBin)
fNoOfFitBins = fEndTimeBin - fStartTimeBin;
else
fNoOfFitBins = 0;
}

View File

@ -187,15 +187,7 @@ Double_t PRunAsymmetryRRF::CalcChiSquare(const std::vector<Double_t>& par)
// calculate chi square
Double_t time(1.0);
Int_t i, N(static_cast<Int_t>(fData.GetValue()->size()));
// In order not to have an IF in the next loop, determine the start and end bins for the fit range now
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > N)
endTimeBin = N;
Int_t i;
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
@ -204,12 +196,12 @@ Double_t PRunAsymmetryRRF::CalcChiSquare(const std::vector<Double_t>& par)
asymFcnValue = fTheory->Func(time, par, fFuncValues);
#ifdef HAVE_GOMP
Int_t chunk = (endTimeBin - startTimeBin)/omp_get_num_procs();
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,diff,asymFcnValue,a,b,f) schedule(dynamic,chunk) reduction(+:chisq)
#endif
for (i=startTimeBin; i<endTimeBin; ++i) {
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
switch (fAlphaBetaTag) {
case 1: // alpha == 1, beta == 1
@ -387,15 +379,15 @@ void PRunAsymmetryRRF::SetFitRangeBin(const TString fitRange)
void PRunAsymmetryRRF::CalcNoOfFitBins()
{
// In order not having to loop over all bins and to stay consistent with the chisq method, calculate the start and end bins explicitly
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > static_cast<Int_t>(fData.GetValue()->size()))
endTimeBin = fData.GetValue()->size();
fStartTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (fStartTimeBin < 0)
fStartTimeBin = 0;
fEndTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (fEndTimeBin > static_cast<Int_t>(fData.GetValue()->size()))
fEndTimeBin = fData.GetValue()->size();
if (endTimeBin > startTimeBin)
fNoOfFitBins = endTimeBin - startTimeBin;
if (fEndTimeBin > fStartTimeBin)
fNoOfFitBins = fEndTimeBin - fStartTimeBin;
else
fNoOfFitBins = 0;
}

View File

@ -52,6 +52,9 @@ PRunMuMinus::PRunMuMinus() : PRunBase()
fGoodBins[0] = -1;
fGoodBins[1] = -1;
fStartTimeBin = -1;
fEndTimeBin = -1;
fHandleTag = kEmpty;
}
@ -87,6 +90,9 @@ PRunMuMinus::PRunMuMinus(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t
fGoodBins[0] = -1;
fGoodBins[1] = -1;
fStartTimeBin = -1;
fEndTimeBin = -1;
if (!PrepareData()) {
cerr << endl << ">> PRunMuMinus::PRunMuMinus: **SEVERE ERROR**: Couldn't prepare data for fitting!";
cerr << endl << ">> This is very bad :-(, will quit ...";
@ -130,15 +136,7 @@ Double_t PRunMuMinus::CalcChiSquare(const std::vector<Double_t>& par)
// calculate chi square
Double_t time(1.0);
Int_t i, N(static_cast<Int_t>(fData.GetValue()->size()));
// In order not to have an IF in the next loop, determine the start and end bins for the fit range now
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > N)
endTimeBin = N;
Int_t i;
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
@ -147,12 +145,12 @@ Double_t PRunMuMinus::CalcChiSquare(const std::vector<Double_t>& par)
time = fTheory->Func(time, par, fFuncValues);
#ifdef HAVE_GOMP
Int_t chunk = (endTimeBin - startTimeBin)/omp_get_num_procs();
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
#endif
for (i=startTimeBin; i < endTimeBin; ++i) {
for (i=fStartTimeBin; i < fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
diff = fData.GetValue()->at(i) - fTheory->Func(time, par, fFuncValues);
chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i));
@ -186,15 +184,7 @@ Double_t PRunMuMinus::CalcChiSquareExpected(const std::vector<Double_t>& par)
// calculate chi square
Double_t time(1.0);
Int_t i, N(static_cast<Int_t>(fData.GetValue()->size()));
// In order not to have an IF in the next loop, determine the start and end bins for the fit range now
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > N)
endTimeBin = N;
Int_t i;
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
@ -203,12 +193,12 @@ Double_t PRunMuMinus::CalcChiSquareExpected(const std::vector<Double_t>& par)
time = fTheory->Func(time, par, fFuncValues);
#ifdef HAVE_GOMP
Int_t chunk = (endTimeBin - startTimeBin)/omp_get_num_procs();
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
#endif
for (i=startTimeBin; i < endTimeBin; ++i) {
for (i=fStartTimeBin; i < fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
theo = fTheory->Func(time, par, fFuncValues);
diff = fData.GetValue()->at(i) - theo;
@ -243,15 +233,7 @@ Double_t PRunMuMinus::CalcMaxLikelihood(const std::vector<Double_t>& par)
Double_t theo;
Double_t data;
Double_t time(1.0);
Int_t i, N(static_cast<Int_t>(fData.GetValue()->size()));
// In order not to have an IF in the next loop, determine the start and end bins for the fit range now
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > N)
endTimeBin = N;
Int_t i;
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
@ -260,12 +242,12 @@ Double_t PRunMuMinus::CalcMaxLikelihood(const std::vector<Double_t>& par)
time = fTheory->Func(time, par, fFuncValues);
#ifdef HAVE_GOMP
Int_t chunk = (endTimeBin - startTimeBin)/omp_get_num_procs();
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,theo,data) schedule(dynamic,chunk) reduction(-:mllh)
#endif
for (i=startTimeBin; i < endTimeBin; ++i) {
for (i=fStartTimeBin; i < fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
// calculate theory for the given parameter set
theo = fTheory->Func(time, par, fFuncValues);
@ -401,15 +383,15 @@ void PRunMuMinus::SetFitRangeBin(const TString fitRange)
void PRunMuMinus::CalcNoOfFitBins()
{
// In order not having to loop over all bins and to stay consistent with the chisq method, calculate the start and end bins explicitly
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > static_cast<Int_t>(fData.GetValue()->size()))
endTimeBin = fData.GetValue()->size();
fStartTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (fStartTimeBin < 0)
fStartTimeBin = 0;
fEndTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (fEndTimeBin > static_cast<Int_t>(fData.GetValue()->size()))
fEndTimeBin = fData.GetValue()->size();
if (endTimeBin > startTimeBin)
fNoOfFitBins = endTimeBin - startTimeBin;
if (fEndTimeBin > fStartTimeBin)
fNoOfFitBins = fEndTimeBin - fStartTimeBin;
else
fNoOfFitBins = 0;
}

View File

@ -64,6 +64,9 @@ PRunSingleHisto::PRunSingleHisto() : PRunBase()
// the fit range can be changed in the command block, these variables need to be accessible
fGoodBins[0] = -1;
fGoodBins[1] = -1;
fStartTimeBin = -1;
fEndTimeBin = -1;
}
//--------------------------------------------------------------------------
@ -81,6 +84,7 @@ PRunSingleHisto::PRunSingleHisto(PMsrHandler *msrInfo, PRunDataHandler *rawData,
{
fScaleN0AndBkg = IsScaleN0AndBkg();
fNoOfFitBins = 0;
fBackground = 0;
fPacking = fRunInfo->GetPacking();
if (fPacking == -1) { // i.e. packing is NOT given in the RUN-block, it must be given in the GLOBAL-block
@ -99,6 +103,9 @@ PRunSingleHisto::PRunSingleHisto(PMsrHandler *msrInfo, PRunDataHandler *rawData,
fGoodBins[0] = -1;
fGoodBins[1] = -1;
fStartTimeBin = -1;
fEndTimeBin = -1;
if (!PrepareData()) {
cerr << endl << ">> PRunSingleHisto::PRunSingleHisto: **SEVERE ERROR**: Couldn't prepare data for fitting!";
cerr << endl << ">> This is very bad :-(, will quit ...";
@ -173,15 +180,7 @@ Double_t PRunSingleHisto::CalcChiSquare(const std::vector<Double_t>& par)
// calculate chi square
Double_t time(1.0);
Int_t i, N(static_cast<Int_t>(fData.GetValue()->size()));
// In order not to have an IF in the next loop, determine the start and end bins for the fit range now
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > N)
endTimeBin = N;
Int_t i;
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
@ -190,12 +189,12 @@ Double_t PRunSingleHisto::CalcChiSquare(const std::vector<Double_t>& par)
time = fTheory->Func(time, par, fFuncValues);
#ifdef HAVE_GOMP
Int_t chunk = (endTimeBin - startTimeBin)/omp_get_num_procs();
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
#endif
for (i=startTimeBin; i < endTimeBin; ++i) {
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
diff = fData.GetValue()->at(i) -
(N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg);
@ -266,15 +265,7 @@ Double_t PRunSingleHisto::CalcChiSquareExpected(const std::vector<Double_t>& par
// calculate chi square
Double_t time(1.0);
Int_t i, N(static_cast<Int_t>(fData.GetValue()->size()));
// In order not to have an IF in the next loop, determine the start and end bins for the fit range now
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > N)
endTimeBin = N;
Int_t i;
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
@ -283,12 +274,12 @@ Double_t PRunSingleHisto::CalcChiSquareExpected(const std::vector<Double_t>& par
time = fTheory->Func(time, par, fFuncValues);
#ifdef HAVE_GOMP
Int_t chunk = (endTimeBin - startTimeBin)/omp_get_num_procs();
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
#endif
for (i=startTimeBin; i < endTimeBin; ++i) {
for (i=fStartTimeBin; i < fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
theo = N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg;
diff = fData.GetValue()->at(i) - theo;
@ -359,7 +350,7 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector<Double_t>& par)
Double_t theo;
Double_t data;
Double_t time(1.0);
Int_t i, N(static_cast<Int_t>(fData.GetValue()->size()));
Int_t i;
// norm is needed since there is no simple scaling like in chisq case to get the correct Max.Log.Likelihood value when normlizing N(t) to 1/ns
Double_t normalizer = 1.0;
@ -367,14 +358,6 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector<Double_t>& par)
if (fScaleN0AndBkg)
normalizer = fPacking * (fTimeResolution * 1.0e3);
// In order not to have an IF in the next loop, determine the start and end bins for the fit range now
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > N)
endTimeBin = N;
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
// for a given set of parameters---which should be done outside of the parallelized loop.
@ -382,12 +365,12 @@ Double_t PRunSingleHisto::CalcMaxLikelihood(const std::vector<Double_t>& par)
time = fTheory->Func(time, par, fFuncValues);
#ifdef HAVE_GOMP
Int_t chunk = (endTimeBin - startTimeBin)/omp_get_num_procs();
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,theo,data) schedule(dynamic,chunk) reduction(-:mllh)
#endif
for (i=startTimeBin; i<endTimeBin; ++i) {
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
// calculate theory for the given parameter set
theo = N0*TMath::Exp(-time/tau)*(1.0+fTheory->Func(time, par, fFuncValues))+bkg;
@ -588,15 +571,15 @@ void PRunSingleHisto::SetFitRangeBin(const TString fitRange)
void PRunSingleHisto::CalcNoOfFitBins()
{
// In order not having to loop over all bins and to stay consistent with the chisq method, calculate the start and end bins explicitly
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > static_cast<Int_t>(fData.GetValue()->size()))
endTimeBin = fData.GetValue()->size();
fStartTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (fStartTimeBin < 0)
fStartTimeBin = 0;
fEndTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (fEndTimeBin > static_cast<Int_t>(fData.GetValue()->size()))
fEndTimeBin = fData.GetValue()->size();
if (endTimeBin > startTimeBin)
fNoOfFitBins = endTimeBin - startTimeBin;
if (fEndTimeBin > fStartTimeBin)
fNoOfFitBins = fEndTimeBin - fStartTimeBin;
else
fNoOfFitBins = 0;
}
@ -1555,7 +1538,7 @@ void PRunSingleHisto::EstimateN0()
if (paramNo > 10000) // i.e. fun or map
return;
// still missing: set this value in the parameters
// get the parameters
PMsrParamList *param = fMsrInfo->GetMsrParamList();
assert(param);
@ -1564,6 +1547,11 @@ void PRunSingleHisto::EstimateN0()
return;
}
// check if N0 is fixed. If this is the case, do NOT estimate N0
if (param->at(paramNo-1).fStep == 0.0) // N0 parameter fixed
return;
// check that 'backgr.fit' in the msr-file run block is indeed a parameter number.
// in case it is a function, nothing will be done.
Int_t paramNoBkg = fRunInfo->GetBkgFitParamNo();

View File

@ -58,13 +58,16 @@ using namespace std;
PRunSingleHistoRRF::PRunSingleHistoRRF() : PRunBase()
{
fNoOfFitBins = 0;
fBackground = 0;
fBackground = 0.0;
fBkgErr = 1.0;
fRRFPacking = -1;
// the 2 following variables are need in case fit range is given in bins, and since
// the fit range can be changed in the command block, these variables need to be accessible
fGoodBins[0] = -1;
fGoodBins[1] = -1;
fN0EstimateEndTime = 1.0; // end time in (us) over which N0 is estimated.
}
//--------------------------------------------------------------------------
@ -112,6 +115,8 @@ PRunSingleHistoRRF::PRunSingleHistoRRF(PMsrHandler *msrInfo, PRunDataHandler *ra
fGoodBins[0] = -1;
fGoodBins[1] = -1;
fN0EstimateEndTime = 1.0; // end time in (us) over which N0 is estimated.
if (!PrepareData()) {
cerr << endl << ">> PRunSingleHistoRRF::PRunSingleHistoRRF(): **SEVERE ERROR**: Couldn't prepare data for fitting!";
cerr << endl << ">> This is very bad :-(, will quit ...";
@ -155,15 +160,7 @@ Double_t PRunSingleHistoRRF::CalcChiSquare(const std::vector<Double_t>& par)
// calculate chi square
Double_t time(1.0);
Int_t i, N(static_cast<Int_t>(fData.GetValue()->size()));
// In order not to have an IF in the next loop, determine the start and end bins for the fit range now
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > N)
endTimeBin = N;
Int_t i;
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
@ -172,12 +169,12 @@ Double_t PRunSingleHistoRRF::CalcChiSquare(const std::vector<Double_t>& par)
time = fTheory->Func(time, par, fFuncValues);
#ifdef HAVE_GOMP
Int_t chunk = (endTimeBin - startTimeBin)/omp_get_num_procs();
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
#endif
for (i=startTimeBin; i<endTimeBin; ++i) {
for (i=fStartTimeBin; i<fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
diff = fData.GetValue()->at(i) - fTheory->Func(time, par, fFuncValues);
chisq += diff*diff / (fData.GetError()->at(i)*fData.GetError()->at(i));
@ -211,15 +208,7 @@ Double_t PRunSingleHistoRRF::CalcChiSquareExpected(const std::vector<Double_t>&
// calculate chi square
Double_t time(1.0);
Int_t i, N(static_cast<Int_t>(fData.GetValue()->size()));
// In order not to have an IF in the next loop, determine the start and end bins for the fit range now
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > N)
endTimeBin = N;
Int_t i;
// Calculate the theory function once to ensure one function evaluation for the current set of parameters.
// This is needed for the LF and user functions where some non-thread-save calculations only need to be calculated once
@ -228,12 +217,12 @@ Double_t PRunSingleHistoRRF::CalcChiSquareExpected(const std::vector<Double_t>&
time = fTheory->Func(time, par, fFuncValues);
#ifdef HAVE_GOMP
Int_t chunk = (endTimeBin - startTimeBin)/omp_get_num_procs();
Int_t chunk = (fEndTimeBin - fStartTimeBin)/omp_get_num_procs();
if (chunk < 10)
chunk = 10;
#pragma omp parallel for default(shared) private(i,time,diff) schedule(dynamic,chunk) reduction(+:chisq)
#endif
for (i=startTimeBin; i < endTimeBin; ++i) {
for (i=fStartTimeBin; i < fEndTimeBin; ++i) {
time = fData.GetDataTimeStart() + (Double_t)i*fData.GetDataTimeStep();
theo = fTheory->Func(time, par, fFuncValues);
diff = fData.GetValue()->at(i) - theo;
@ -408,15 +397,15 @@ void PRunSingleHistoRRF::SetFitRangeBin(const TString fitRange)
void PRunSingleHistoRRF::CalcNoOfFitBins()
{
// In order not having to loop over all bins and to stay consistent with the chisq method, calculate the start and end bins explicitly
Int_t startTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (startTimeBin < 0)
startTimeBin = 0;
Int_t endTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (endTimeBin > static_cast<Int_t>(fData.GetValue()->size()))
endTimeBin = fData.GetValue()->size();
fStartTimeBin = static_cast<Int_t>(ceil((fFitStartTime - fData.GetDataTimeStart())/fData.GetDataTimeStep()));
if (fStartTimeBin < 0)
fStartTimeBin = 0;
fEndTimeBin = static_cast<Int_t>(floor((fFitEndTime - fData.GetDataTimeStart())/fData.GetDataTimeStep())) + 1;
if (fEndTimeBin > static_cast<Int_t>(fData.GetValue()->size()))
fEndTimeBin = fData.GetValue()->size();
if (endTimeBin > startTimeBin)
fNoOfFitBins = endTimeBin - startTimeBin;
if (fEndTimeBin > fStartTimeBin)
fNoOfFitBins = fEndTimeBin - fStartTimeBin;
else
fNoOfFitBins = 0;
}
@ -604,6 +593,9 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his
if (!EstimateBkg(histoNo))
return false;
}
// subtract background from fForward
for (UInt_t i=0; i<fForward.size(); i++)
fForward[i] -= fBackground;
} else { // fixed background given
for (UInt_t i=0; i<fForward.size(); i++) {
fForward[i] -= fRunInfo->GetBkgFix(0);
@ -624,7 +616,7 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his
exp_t_tau = exp(time_tau);
fForward[i] *= exp_t_tau;
fM.push_back(fForward[i]); // i.e. M(t) = [N(t)-Nbkg] exp(+t/tau); needed to estimate N0 later on
fMerr.push_back(exp_t_tau*sqrt(rawNt[i]-fBackground));
fMerr.push_back(exp_t_tau*sqrt(rawNt[i]+fBkgErr*fBkgErr));
}
// calculate weights
@ -632,7 +624,7 @@ Bool_t PRunSingleHistoRRF::PrepareFitData(PRawRunData* runData, const UInt_t his
if (fMerr[i] > 0.0)
fW.push_back(1.0/(fMerr[i]*fMerr[i]));
else
fW.push_back(0.0);
fW.push_back(1.0);
}
// now fForward = exp(+t/tau) [N(t)-Nbkg] = M(t)
@ -1071,6 +1063,9 @@ Double_t PRunSingleHistoRRF::GetMainFrequency(PDoubleVector &data)
if (power->GetBinContent(i)>power->GetBinContent(i+1))
continue;
}
// ignore everything below 10 MHz
if (power->GetBinCenter(i) < 10.0)
continue;
// check for maximum
if (power->GetBinContent(i) > maxFreqVal) {
maxFreqVal = power->GetBinContent(i);
@ -1101,15 +1096,17 @@ Double_t PRunSingleHistoRRF::EstimateN0(Double_t &errN0, Double_t freqMax)
{
// endBin is estimated such that the number of full cycles (according to the maximum frequency of the data)
// is approximately the time fN0EstimateEndTime.
Int_t endBin = (Int_t)round(fN0EstimateEndTime / fTimeResolution * ceil(freqMax)/freqMax);
Int_t endBin = (Int_t)round(ceil(fN0EstimateEndTime*freqMax/TMath::TwoPi()) * (TMath::TwoPi()/freqMax) / fTimeResolution);
Double_t n0 = 0.0;
Double_t wN = 0.0;
for (Int_t i=0; i<endBin; i++) {
n0 += fW[i]*fM[i];
// n0 += fW[i]*fM[i];
n0 += fM[i];
wN += fW[i];
}
n0 /= wN;
// n0 /= wN;
n0 /= endBin;
errN0 = 0.0;
for (Int_t i=0; i<endBin; i++) {
@ -1197,7 +1194,12 @@ Bool_t PRunSingleHistoRRF::EstimateBkg(UInt_t histoNo)
fBackground = bkg; // keep background (per bin)
cout << endl << "info> fBackground=" << fBackground << endl;
bkg = 0.0;
for (UInt_t i=start; i<end; i++)
bkg += pow(fForward[i]-fBackground, 2.0);
fBkgErr = sqrt(bkg/(static_cast<Double_t>(end - start)));
cout << endl << "info> fBackground=" << fBackground << "(" << fBkgErr << ")" << endl;
fRunInfo->SetBkgEstimated(fBackground, 0);

View File

@ -97,7 +97,6 @@ PStartupHandler::PStartupHandler()
Char_t *home=0;
Char_t musrpath[128];
Char_t startup_path_name[128];
Bool_t found = false;
strncpy(musrpath, "", sizeof(musrpath));
@ -106,32 +105,39 @@ PStartupHandler::PStartupHandler()
if (StartupFileExists(startup_path_name)) {
fStartupFileFound = true;
fStartupFilePath = TString(startup_path_name);
} else { // startup file is not found in the current directory
}
if (!fStartupFileFound) { // startup file not found in the current directory
// check if the startup file is found under $HOME/.musrfit
home = getenv("HOME");
if (home != 0) {
sprintf(musrpath, "%s/.musrfit", home);
found = true;
}
pmusrpath = getenv("MUSRFITPATH");
if (!found) {
// check if the MUSRFITPATH system variable is set
if (pmusrpath != 0) {
if (strcmp(pmusrpath, "")) { // MUSRFITPATH variable set but empty
found = true;
}
sprintf(startup_path_name, "%s/.musrfit/musrfit_startup.xml", home);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;
}
}
if (!found) { // MUSRFITPATH not set or empty, will try default one
home = getenv("ROOTSYS");
}
if (!fStartupFileFound) { // startup file not found in $HOME/.musrfit
// check if the MUSRFITPATH system variable is set
pmusrpath = getenv("MUSRFITPATH");
if (pmusrpath != 0) {
sprintf(startup_path_name, "%s/musrfit_startup.xml", pmusrpath);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;
}
}
}
if (!fStartupFileFound) { // MUSRFITPATH not set or empty, will try $ROOTSYS/bin
home = getenv("ROOTSYS");
if (home != 0) {
sprintf(musrpath, "%s/bin", home);
cerr << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
}
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
fStartupFilePath = TString(startup_path_name);
if (StartupFileExists(startup_path_name)) {
fStartupFileFound = true;
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;
}
}
}
}

View File

@ -301,6 +301,7 @@ PTheory::PTheory(PMsrHandler *msrInfo, UInt_t runNo, const Bool_t hasParent) : f
cerr << endl << ">> PTheory::PTheory: **ERROR** user function object could not be invoked. See line no " << line->fLineNo;
cerr << endl;
fValid = false;
return;
} else { // user function valid, hence expand the fUserParam vector to the proper size
fUserParam.resize(fParamNo.size());
}
@ -506,6 +507,10 @@ Double_t PTheory::Func(register Double_t t, const PDoubleVector& paramValues, co
return Polynom(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_MU_MINUS_EXP:
return MuMinusExpTF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_USER_FCN:
return UserFcn(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues) +
fAdd->Func(t, paramValues, funcValues);
@ -598,6 +603,9 @@ Double_t PTheory::Func(register Double_t t, const PDoubleVector& paramValues, co
case THEORY_DYNAMIC_TF_NK:
return DynamicNKTF (t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_MU_MINUS_EXP:
return MuMinusExpTF(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
case THEORY_POLYNOM:
return Polynom(t, paramValues, funcValues) * fMul->Func(t, paramValues, funcValues);
break;
@ -694,6 +702,9 @@ Double_t PTheory::Func(register Double_t t, const PDoubleVector& paramValues, co
case THEORY_DYNAMIC_TF_NK:
return DynamicNKTF (t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_MU_MINUS_EXP:
return MuMinusExpTF(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
case THEORY_POLYNOM:
return Polynom(t, paramValues, funcValues) + fAdd->Func(t, paramValues, funcValues);
break;
@ -788,6 +799,9 @@ Double_t PTheory::Func(register Double_t t, const PDoubleVector& paramValues, co
case THEORY_DYNAMIC_TF_NK:
return DynamicNKTF(t, paramValues, funcValues);
break;
case THEORY_MU_MINUS_EXP:
return MuMinusExpTF(t, paramValues, funcValues);
break;
case THEORY_POLYNOM:
return Polynom(t, paramValues, funcValues);
break;
@ -2941,6 +2955,46 @@ Double_t PTheory::GetDynKTLFValue(const Double_t t) const
return fDynLFFuncValue[idx]+df;
}
//--------------------------------------------------------------------------
/**
* <p> theory function: MuMinusExpTF
*
* \f[ = N_0 \exp(-t/tau) [1 + A \exp(-\lambda t) \cos(2\pi\nu t + \phi)] \f]
*
* <b>meaning of paramValues:</b> \f$t_{\rm shift}\f$, \f$N_0\f$, \f$\tau\f$, \f$A\f$, \f$\lambda\f$, \f$\phi\f$, \f$\nu\f$
*
* <b>return:</b> function value
*
* \param t time in \f$(\mu\mathrm{s})\f$, or x-axis value for non-muSR fit
* \param paramValues parameter values
* \param funcValues vector with the functions (i.e. functions of the parameters)
*/
Double_t PTheory::MuMinusExpTF(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const
{
// expected parameters: N0 tau A lambda phase frequency [tshift]
Double_t val[7];
assert(fParamNo.size() <= 7);
// check if FUNCTIONS are used
for (UInt_t i=0; i<fParamNo.size(); i++) {
if (fParamNo[i] < MSR_PARAM_FUN_OFFSET) { // parameter or resolved map
val[i] = paramValues[fParamNo[i]];
} else { // function
val[i] = funcValues[fParamNo[i]-MSR_PARAM_FUN_OFFSET];
}
}
Double_t tt;
if (fParamNo.size() == 6) // no tshift
tt = t;
else // tshift present
tt = t-val[6];
return val[0]*exp(-tt/val[1])*(1.0+val[2]*exp(-val[3]*tt)*cos(TWO_PI*val[5]*tt+DEG_TO_RAD*val[4]));
}
//--------------------------------------------------------------------------
// END
//--------------------------------------------------------------------------

View File

@ -3,7 +3,8 @@ if BUILD_ASLIBS
ASDIRS = Nonlocal \
MagProximity \
libSpinValve \
libPhotoMeissner
libPhotoMeissner \
libGbGLF
endif
if BUILD_CUBALIB

View File

@ -62,3 +62,13 @@ install-exec-hook:
uninstall-hook:
rm -f $(libdir)/libPNL_PippardFitter.so
endif
xmldir = $(HOME)/.musrfit/external
xml_DATA = nonlocal_startup.xml
install-xml_DATA: $(xml_DATA)
$(INSTALL_DATA) '$(xml_DATA)' '$xmldir'
uninstall-xml_DATA: $(xml_DATA)
$(RM) '$(xml_DATA)' '$xmldir'

View File

@ -5,8 +5,6 @@
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
***************************************************************************/
/***************************************************************************
@ -56,7 +54,8 @@ PNL_StartupHandler::PNL_StartupHandler()
fTrimSpDataPath = TString("");
// get default path (for the moment only linux like)
char startup_path_name[128];
char startup_path_name[512];
char *home_str=0;
// check if the startup file is found in the current directory
strcpy(startup_path_name, "./nonlocal_startup.xml");
@ -65,7 +64,8 @@ PNL_StartupHandler::PNL_StartupHandler()
fStartupFilePath = TString(startup_path_name);
} else { // startup file is not found in the current directory
cout << endl << "PNL_StartupHandler(): **WARNING** Couldn't find nonlocal_startup.xml in the current directory, will try default one." << endl;
strncpy(startup_path_name, "/home/nemu/analysis/musrfit/src/external/Nonlocal/nonlocal_startup.xml", sizeof(startup_path_name));
home_str = getenv("HOME");
snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/nonlocal_startup.xml", home_str);
if (StartupFileExists(startup_path_name)) {
fStartupFileFound = true;
fStartupFilePath = TString(startup_path_name);

56
src/external/libGbGLF/Makefile.am vendored Normal file
View File

@ -0,0 +1,56 @@
## Process this file with automake to create Makefile.in
h_sources = \
PGbGLF.h
h_linkdef = \
PGbGLFLinkDef.h
dict_h_sources = \
PGbGLFDict.h
cpp_sources = \
PGbGLF.cpp
dict_cpp_sources = \
PGbGLFDict.cpp
include_HEADERS = $(h_sources)
noinst_HEADERS = $(h_linkdef) $(dict_h_sources)
AM_CPPFLAGS = -I$(top_srcdir)/src/include $(PMUSR_CFLAGS) $(FFTW3_CFLAGS) -I$(ROOTINCDIR)
AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources)
AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
CLEANFILES = *Dict.cpp *Dict.h *~ core
%Dict.cpp %Dict.h: %.h %LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^
lib_LTLIBRARIES = libGbGLF.la
libGbGLF_la_SOURCES = $(h_sources) $(cpp_sources) $(dict_h_sources) $(dict_cpp_sources)
libGbGLF_la_LIBADD = $(USERFCN_LIBS)
libGbGLF_la_LDFLAGS = -version-info $(PLUGIN_LIBRARY_VERSION) -release $(PLUGIN_RELEASE) $(AM_LDFLAGS)
## For the moment do not build pkgconfig files for musrfit plug-ins...
## pkgconfigdir = $(libdir)/pkgconfig
## pkgconfig_DATA = LFRelaxation.pc
## However, create some symbolic links to the shared library
## in order to unify the function call on different operating systems
if IS_DARWIN
install-exec-hook:
$(LN_S) -f $(libdir)/libGbGLF.dylib $(libdir)/libGbGLF.so
uninstall-hook:
rm -f $(libdir)/libGbGLF.so
endif
if IS_CYGWIN
install-exec-hook:
$(LN_S) -f $(bindir)/cygGbGLF-$(PLUGIN_MAJOR_VERSION)-$(PLUGIN_MINOR_VERSION)-$(PLUGIN_MAJOR_VERSION).dll $(libdir)/libGbGLF.so
uninstall-hook:
rm -f $(libdir)/libGbGLF.so
endif

125
src/external/libGbGLF/PGbGLF.cpp vendored Normal file
View File

@ -0,0 +1,125 @@
/***************************************************************************
PGbGLF.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <cassert>
#include <iostream>
#include <cmath>
using namespace std;
#include "PMusr.h"
#include "PGbGLF.h"
#define TWO_PI 6.28318530717958647692528676656
ClassImp(PGbGLF)
//--------------------------------------------------------------------------
// operator()
//--------------------------------------------------------------------------
/**
* <p>Method returning the function value at a given time for a given set of parameters.
*
* \param t time
* \param par
*/
Double_t PGbGLF::operator()(Double_t t, const std::vector<Double_t> &par) const
{
// param: [0] Bext (G), [1] Delta0 (1/us), [2] Rb (1)
assert(par.size()==3);
if (t<0.0)
return 1.0;
Double_t dval = 0.0;
Double_t wExt = TWO_PI * GAMMA_BAR_MUON * par[0];
Double_t s0 = par[1];
Double_t s1 = s0*par[2]; // sigma0 * Rb
Double_t wExt2 = wExt*wExt;
Double_t s02 = s0*s0;
Double_t s12 = s1*s1;
Double_t t2 = t*t;
if (par[0] < 3.0) { // take ZF solution for Bext <= 3G. This is good enough
Double_t aa = 1.0 + s12*t2;
dval = 0.333333333333333333 + 0.666666666666667 / pow(aa, 1.5)*(1.0-s02*t2/aa)*exp(-0.5*s02*t2/aa);
} else {
// P_z^LF (GbG, 1st part)
Double_t aa = 1.0+t2*s12;
dval = 1.0 - 2.0*(s02+s12)/wExt2 + 2.0*(s02+s12*aa)/(wExt2*pow(aa,2.5))*cos(wExt*t)*exp(-0.5*s02*t2/aa);
// P_z^LF (GbG, 2nd part)
Double_t dt = t;
Int_t n=1;
Double_t sumT = dt * pz_GbG_2(t, par) * 0.5;
Double_t sumM = 0.0;
Double_t tt = 0.0;
do {
sumM = 0.0;
for (Int_t i=0; i<n-1; i++) {
tt = ((Double_t)i + 0.5) * dt;
sumM += pz_GbG_2(tt, par);
}
sumM *= dt;
sumT = (sumT + sumM)*0.5;
dt /= 2.0;
n *= 2;
} while ((fabs(sumT-sumM) > 1.0e-5) && (n < 8192));
dval += sumT;
}
return dval;
}
//--------------------------------------------------------------------------
// pz_GbG_2 (private)
//--------------------------------------------------------------------------
/**
* <p>Integrand of the non-analytic part
*
* \param t time
*/
Double_t PGbGLF::pz_GbG_2(Double_t t, const std::vector<Double_t> &par) const
{
Double_t wExt = TWO_PI * GAMMA_BAR_MUON * par[0];
Double_t s0 = par[1];
Double_t s1 = s0*par[2]; // sigma0 * Rb
Double_t s02 = s0*s0;
Double_t s12 = s1*s1;
Double_t t2 = t*t;
Double_t aa = 1.0+t2*s12;
return 2.0*(s02*s02+3.0*s12*s12*aa*aa+6.0*s02*s12*aa)/(pow(wExt,3.0)*pow(aa,4.5))*exp(-0.5*s02*t2/aa)*sin(wExt*t);
}

60
src/external/libGbGLF/PGbGLF.h vendored Normal file
View File

@ -0,0 +1,60 @@
/***************************************************************************
PGbGLF.h
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _PGBGLF_H_
#define _PGBGLF_H_
#include <vector>
using namespace std;
#include "PUserFcnBase.h"
//--------------------------------------------------------------------------------------------
/**
* <p>Interface class for the user function.
*/
class PGbGLF : public PUserFcnBase
{
public:
PGbGLF() {}
virtual ~PGbGLF() {}
virtual Bool_t NeedGlobalPart() const { return false; }
virtual void SetGlobalPart(vector<void *> &globalPart, UInt_t idx) {}
virtual Bool_t GlobalPartIsValid() const { return true; }
virtual Double_t operator()(Double_t t, const std::vector<Double_t> &param) const;
private:
Double_t pz_GbG_2(Double_t t, const std::vector<Double_t> &par) const;
ClassDef(PGbGLF, 1)
};
#endif // _PGBGLF_H_

40
src/external/libGbGLF/PGbGLFLinkDef.h vendored Normal file
View File

@ -0,0 +1,40 @@
/***************************************************************************
PGbGLFLinkDef.h
Author: Andreas Suter
***************************************************************************/
/***************************************************************************
* Copyright (C) 2016 by Andreas Suter *
* *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
// root dictionary stuff --------------------------------------------------
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class PGbGLF+;
#endif //__CINT__
// root dictionary stuff --------------------------------------------------

BIN
src/external/libGbGLF/doc/GbG-LF.pdf vendored Normal file

Binary file not shown.

184
src/external/libGbGLF/doc/GbG-LF.tex vendored Normal file
View File

@ -0,0 +1,184 @@
\documentclass[twoside]{article}
\usepackage[english]{babel}
%\usepackage{a4}
\usepackage{amssymb,amsmath,bm}
\usepackage{graphicx,tabularx}
\usepackage{fancyhdr}
\usepackage{array}
\usepackage{float}
\usepackage{hyperref}
\usepackage{xspace}
\usepackage{rotating}
\usepackage{dcolumn}
\usepackage{geometry}
\usepackage{color}
\geometry{a4paper,left=20mm,right=20mm,top=20mm,bottom=20mm}
% \setlength{\topmargin}{10mm}
% \setlength{\topmargin}{-13mm}
% % \setlength{\oddsidemargin}{0.5cm}
% % \setlength{\evensidemargin}{0cm}
% \setlength{\oddsidemargin}{1cm}
% \setlength{\evensidemargin}{1cm}
% \setlength{\textwidth}{15cm}
\setlength{\textheight}{23.8cm}
\pagestyle{fancyplain}
\addtolength{\headwidth}{0.6cm}
\fancyhead{}%
\fancyhead[RE,LO]{\bf \textsc{GapIntegrals}}%
\fancyhead[LE,RO]{\thepage}
\cfoot{--- A.~Suter -- \today~ ---}
\rfoot{\includegraphics[width=2cm]{PSI-Logo_narrow.jpg}}
\DeclareMathAlphabet{\bi}{OML}{cmm}{b}{it}
\newcommand{\mean}[1]{\langle #1 \rangle}
\newcommand{\ie}{\emph{i.e.}\xspace}
\newcommand{\musrfithead}{MUSRFIT\xspace}
\newcommand{\musrfit}{\textsc{musrfit}\xspace}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
% Header info --------------------------------------------------
\thispagestyle{empty}
\noindent
\begin{tabular}{@{\hspace{-0.2cm}}l@{\hspace{6cm}}r}
\noindent\includegraphics[width=3.4cm]{PSI-Logo_narrow.jpg} &
{\Huge\sf Memorandum}
\end{tabular}
%
\vskip 1cm
%
\begin{tabular}{@{\hspace{-0.5cm}}ll@{\hspace{4cm}}ll}
Date: & \today & & \\[3ex]
From: & A. Suter & & \\
E-Mail: & \verb?andreas.suter@psi.ch? &&
\end{tabular}
%
\vskip 0.3cm
\noindent\hrulefill
\vskip 1cm
%
\section*{Homogenous Disorder Model: GbG in Longitudinal Fields}%
Noakes and Kalvius \cite{noakes1997} derived a phenomenological model for
homogenous disorder: Gaussian-broadened Gaussian disorder (see also
Ref.\,\cite{yaouanc2011}). In both mentioned references only the zero field
case and the weak transverse field case are discussed. Here I briefly summarize
the longitudinal field (LF) case under the assumption that the applied field doesn't
polarize the impurties, \ie the applied field is ``innocent''.
The Gauss-Kubo-Toyabe LF polarization function is
\begin{eqnarray}\label{eq:GKT_LF}
P_{Z,{\rm GKT}}^{\rm LF} &=& 1 - 2 \frac{\sigma^2}{\omega_{\rm ext}^2}\left[ 1 - \cos(\omega_{\rm ext} t)\,\exp\left(-1/2 (\sigma t)^2\right) \right] + \label{eq:GKT_LF_1}\\
& & + 2 \frac{\sigma^2}{\omega_{\rm ext}^3} \int_0^t \sin(\omega_{\rm ext} \tau)\,\exp\left(-1/2 (\omega_{\rm ext} \tau)^2\right) d\tau. \label{eq:GKT_LF_2}
\end{eqnarray}
\noindent The Gaussian disorder is assumed to have the funtional form
\begin{equation}\label{eq:GaussianDisorder}
\varrho = \frac{1}{\sqrt{2\pi}}\,\frac{1}{\sigma_1} \exp\left( -\frac{1}{2} \, \left[ \frac{\sigma - \sigma_0}{\sigma_1} \right]^2 \right).
\end{equation}
\noindent In Ref.\cite{yaouanc2011} a slightly different notation is used: $\sigma \to \Delta_{\rm G}$, $\sigma_0 \to \Delta_{0}$, and
$\sigma_1 \to \Delta_{\rm GbG}$.
\noindent The GbG LF polarizatio function is given by
\begin{equation}
P_{Z,{\rm GbG}}^{\rm LF} = \int_0^\infty d\sigma \left\{ \varrho \cdot P_{Z,{\rm GKT}}^{\rm LF} \right\}.
\end{equation}
\noindent Assuming that $\sigma_0 \gg \sigma_1$ this can be approximated by
\begin{equation}
P_{Z,{\rm GbG}}^{\rm LF} \simeq \int_{-\infty}^\infty d\sigma \left\{ \varrho \cdot P_{Z,{\rm GKT}}^{\rm LF} \right\}.
\end{equation}
\noindent Integrating
\begin{equation*}
P_{Z,{\rm GbG}}^{\rm LF, (1)} = \int_{-\infty}^\infty d\sigma \left\{ \varrho \cdot P_{Z,{\rm GKT}}^{\rm LF, (1)} \right\},
\end{equation*}
\noindent where $P_{Z,{\rm GKT}}^{\rm LF, (1)}$ is given by Eq.(\ref{eq:GKT_LF_1}), leads to
\begin{equation}\label{eq:GbG_LF_1}
P_{Z,{\rm GbG}}^{\rm LF, (1)} = 1 - 2 \frac{\sigma_0^2+\sigma_1^2}{\omega_{\rm ext}^2} +
2 \frac{\sigma_0^2 + \sigma_1^2 (1 + \sigma_1^2 t^2)}{\omega_{\rm ext}^2 (1 + \sigma_1^2 t^2)^{5/2}}\, \cos(\omega_{\rm ext} t)\,
\exp\left[-\frac{1}{2} \frac{\sigma_0^2 t^2}{1+\sigma_1^2 t^2}\right],
\end{equation}
\noindent and Eq.(\ref{eq:GKT_LF_2}) leads to the non-analytic integral
\begin{eqnarray}
P_{Z,{\rm GbG}}^{\rm LF, (2)} &=& \int_{-\infty}^\infty d\sigma \left\{ \varrho \cdot P_{Z,{\rm GKT}}^{\rm LF, (2)} \right\} \nonumber \\
&=& \int_0^t d\tau \left\{ \frac{\sigma_0^4 + 3 \sigma_1^4 (1 + \sigma_1^2 \tau^2)^2 + 6 \sigma_0^2 \sigma_1^2 (1+\sigma_1^2 \tau^2)}{\omega_{\rm ext}^3 (1+\sigma_1^2 \tau^2)^{9/2}}
\sin(\omega_{\rm ext} \tau)\, \exp\left[-\frac{1}{2} \frac{\sigma_0^2 t^2}{1+\sigma_1^2 t^2}\right] \right\}. \label{eq:GbG_LF_2}
\end{eqnarray}
\noindent The full GbG LF polarization function is hence
\begin{equation}
P_{Z,{\rm GbG}}^{\rm LF} = P_{Z,{\rm GbG}}^{\rm LF, (1)} + P_{Z,{\rm GbG}}^{\rm LF, (2)}
\end{equation}
\subsection*{The GbG LF Polarization Function as a User Function in \musrfithead}
Eqs.(\ref{eq:GbG_LF_1})\&(\ref{eq:GbG_LF_2}) are implemented in \musrfit as user function. The current implementation is far from being efficient but stable.
The typical call from within the msr-file would be
\begin{verbatim}
###############################################################
FITPARAMETER
# Nr. Name Value Step Pos_Error Boundaries
1 PlusOne 1 0 none
2 MinusOne -1 0 none
3 Alpha 0.78699 -0.00036 0.00036 0 none
4 Asy 0.06682 0.00027 none 0 0.33
5 Sig0 0.3046 -0.0087 0.0093 0 100
6 Rb 1.0000 0.0027 none 0 1
7 Field0 0 0 none
8 Field1 20.03 0 none
9 Field2 99.32 0 none
###############################################################
THEORY
asymmetry fun1
userFcn libGbGLF PGbGLF map2 5 fun2 (field sigma0 Rb)
###############################################################
FUNCTIONS
fun1 = map1 * par4
fun2 = par5 * par6
\end{verbatim}
\noindent where \texttt{PGbGLF} takes 3 arguments:
\begin{enumerate}
\item field in Gauss
\item $\sigma_0$ in ($1/\mu s$)
\item $R_b = \sigma_1 / \sigma_0$
\end{enumerate}
\noindent \textbf{Be aware that we explicitly assumed $\sigma_1 \ll \sigma_0$, \ie $R_b < 1$.}
\bibliographystyle{plain}
\begin{thebibliography}{1}
\bibitem{noakes1997} D.~R.~Noakes, G.~M.~Kalvius, Phys.~Rev.~B, \textbf{56}, 2352
(1997).
\bibitem{yaouanc2011} A.~Yaouanc, P.~Dalmas~de~R\'{e}otier, ``Muon Spin
Rotation, Relaxation, and Resonance'', Oxford University Press (2011).
\end{thebibliography}
\end{document}

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -28,7 +28,7 @@ AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources)
AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
CLEANFILES = ../include/*Dict.cpp ../include/*Dict.h *~ core
CLEANFILES = ../classes/*Dict* ../include/*Dict.* *~ core
%Dict.cpp %Dict.h: ../include/%.h ../include/%LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^
@ -59,3 +59,14 @@ install-exec-hook:
uninstall-hook:
rm -f $(libdir)/libPPhotoMeissner.so
endif
# define default xml install
xmldir = $(HOME)/.musrfit/external
xml_DATA = ../test/photoMeissner_startup.xml
instal-xml_DATA: $(xml_DATA)
$(INSTALL_DATA) '$(xml_DATA)' '$(xmldir)'
uninstal-xml_DATA: $(xml_DATA)
$(RM) '$(xml_DATA)' '$(xmldir)'

View File

@ -231,7 +231,8 @@ PStartupHandler_PM::PStartupHandler_PM()
fStartupFilePath = "";
// get default path (for the moment only linux like)
char startup_path_name[128];
char startup_path_name[512];
char *home_path=0;
// check if the startup file is found in the current directory
strcpy(startup_path_name, "./photoMeissner_startup.xml");
@ -240,7 +241,8 @@ PStartupHandler_PM::PStartupHandler_PM()
fStartupFilePath = TString(startup_path_name);
} else { // startup file is not found in the current directory
cout << endl << ">> PStartupHandler_PM(): **WARNING** Couldn't find photoMeissner_startup.xml in the current directory, will try default one." << endl;
strncpy(startup_path_name, "/home/nemu/analysis/musrfit/src/external/libPhotoMeissner/test/photoMeissner_startup.xml", sizeof(startup_path_name));
home_path = getenv("HOME");
snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/external/photoMeissner_startup.xml", home_path);
if (StartupFileExists(startup_path_name)) {
fStartupFileFound = true;
fStartupFilePath = TString(startup_path_name);

View File

@ -28,7 +28,7 @@ AM_CXXFLAGS = $(LOCAL_LIB_CXXFLAGS)
BUILT_SOURCES = $(dict_cpp_sources) $(dict_h_sources)
AM_LDFLAGS = $(LOCAL_LIB_LDFLAGS) -L@ROOTLIBDIR@
CLEANFILES = ../include/*Dict.cpp ../include/*Dict.h *~ core
CLEANFILES = ../classes/*Dict.* ../include/*Dict.* *~ core
%Dict.cpp %Dict.h: ../include/%.h ../include/%LinkDef.h
@ROOTCINT@ -v -f $*Dict.cpp -c -p $(AM_CPPFLAGS) $^
@ -59,3 +59,14 @@ install-exec-hook:
uninstall-hook:
rm -f $(libdir)/libPSpinValve.so
endif
# define default xml install
xmldir = $(HOME)/.musrfit/external
xml_DATA = ../test/spinValve_startup.xml
instal-xml_DATA: $(xml_DATA)
$(INSTALL_DATA) '$(xml_DATA)' '$(xmldir)'
uninstal-xml_DATA: $(xml_DATA)
$(RM) '$(xml_DATA)' '$(xmldir)'

View File

@ -52,6 +52,7 @@ PStartupHandler_SV::PStartupHandler_SV()
// get default path (for the moment only linux like)
char startup_path_name[128];
char *home_path=0;
// check if the startup file is found in the current directory
strcpy(startup_path_name, "./spinValve_startup.xml");
@ -59,8 +60,9 @@ PStartupHandler_SV::PStartupHandler_SV()
fStartupFileFound = true;
fStartupFilePath = TString(startup_path_name);
} else { // startup file is not found in the current directory
cout << endl << ">> PStartupHandler_SV(): **WARNING** Couldn't find skewedLorentzian_startup.xml in the current directory, will try default one." << endl;
strncpy(startup_path_name, "/home/nemu/analysis/musrfit/src/external/libSpinValve/test/spinValve_startup.xml", sizeof(startup_path_name));
cout << endl << ">> PStartupHandler_SV(): **WARNING** Couldn't find spinValve_startup.xml in the current directory, will try default one." << endl;
home_path = getenv("HOME");
snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/external/spinValve_startup.xml", home_path);
if (StartupFileExists(startup_path_name)) {
fStartupFileFound = true;
fStartupFilePath = TString(startup_path_name);

View File

@ -71,7 +71,7 @@ class PMsr2Data
bool PrepareNewInputFile(unsigned int, bool) const; // template
bool PrepareGlobalInputFile(unsigned int, const string&, unsigned int) const; // generate msr-input file for a global fit
int WriteOutput(const string&, bool, unsigned int, bool global = false, unsigned int counter = 0) const;
int WriteOutput(const string&, const vector<unsigned int>&, bool, unsigned int, bool global = false, unsigned int counter = 0) const;
private:
bool PrepareNewSortedInputFile(unsigned int) const; // template
@ -80,6 +80,7 @@ class PMsr2Data
void WriteValue(fstream &outFile, const double &value, const unsigned int &width) const;
void WriteValue(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 &paramValue, const vector<unsigned int>&) const;
string fFileExtension;
vector<unsigned int> fRunVector;

View File

@ -181,8 +181,6 @@ typedef struct {
PDoubleVector dataX; ///< x-axis data set
PDoubleVector data; ///< y-axis data set
PDoubleVector dataErr; ///< error of the y-axis data set
PDoubleVector theoryX; ///< x-axis theory set
PDoubleVector theory; ///< y-axis theory set
} PMusrCanvasAsciiDump;
//------------------------------------------------------------------------
@ -333,6 +331,9 @@ class PMusrCanvas : public TObject, public TQObject
virtual Double_t GetInterpolatedValue(TH1F* histo, Double_t xVal);
virtual void GetExportDataSet(const TH1F *data, const Double_t xmin, const Double_t xmax,
PMusrCanvasAsciiDumpVector &dumpData, const Bool_t hasError=true);
ClassDef(PMusrCanvas, 1)
};

View File

@ -52,6 +52,10 @@ class PRunAsymmetry : public PRunBase
virtual void SetFitRangeBin(const TString fitRange);
virtual Int_t GetStartTimeBin() { return fStartTimeBin; }
virtual Int_t GetEndTimeBin() { return fEndTimeBin; }
virtual Int_t GetPacking() { return fPacking; }
protected:
virtual void CalcNoOfFitBins();
virtual Bool_t PrepareData();
@ -71,6 +75,9 @@ class PRunAsymmetry : public PRunBase
Int_t fGoodBins[4]; ///< keep first/last good bins. 0=fgb, 1=lgb (forward); 2=fgb, 3=lgb (backward)
Int_t fStartTimeBin; ///< bin at which the fit starts
Int_t fEndTimeBin; ///< bin at which the fit ends
Bool_t SubtractFixBkg();
Bool_t SubtractEstimatedBkg();

View File

@ -52,6 +52,9 @@ class PRunAsymmetryRRF : public PRunBase
virtual void SetFitRangeBin(const TString fitRange);
virtual Int_t GetStartTimeBin() { return fStartTimeBin; }
virtual Int_t GetEndTimeBin() { return fEndTimeBin; }
protected:
virtual void CalcNoOfFitBins();
virtual Bool_t PrepareData();
@ -70,6 +73,9 @@ class PRunAsymmetryRRF : public PRunBase
Int_t fGoodBins[4]; ///< keep first/last good bins. 0=fgb, 1=lgb (forward); 2=fgb, 3=lgb (backward)
Int_t fStartTimeBin; ///< bin at which the fit starts
Int_t fEndTimeBin; ///< bin at which the fit ends
Bool_t SubtractFixBkg();
Bool_t SubtractEstimatedBkg();

View File

@ -51,6 +51,10 @@ class PRunMuMinus : public PRunBase
virtual void SetFitRangeBin(const TString fitRange);
virtual Int_t GetStartTimeBin() { return fStartTimeBin; }
virtual Int_t GetEndTimeBin() { return fEndTimeBin; }
virtual Int_t GetPacking() { return fPacking; }
protected:
virtual void CalcNoOfFitBins();
virtual Bool_t PrepareData();
@ -65,6 +69,9 @@ class PRunMuMinus : public PRunBase
PDoubleVector fForward; ///< forward histo data
Int_t fStartTimeBin; ///< bin at which the fit starts
Int_t fEndTimeBin; ///< bin at which the fit ends
virtual Bool_t GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlock, PUIntVector &histoNo);
virtual Bool_t GetProperDataRange();
virtual void GetProperFitRange(PMsrGlobalBlock *globalBlock);

View File

@ -51,6 +51,13 @@ class PRunSingleHisto : public PRunBase
virtual void SetFitRangeBin(const TString fitRange);
virtual Double_t GetBackground() { return fBackground; }
virtual Int_t GetStartTimeBin() { return fStartTimeBin; }
virtual Int_t GetEndTimeBin() { return fEndTimeBin; }
virtual Int_t GetPacking() { return fPacking; }
virtual Bool_t GetScaleN0AndBkg() { return fScaleN0AndBkg; }
protected:
virtual void CalcNoOfFitBins();
virtual Bool_t PrepareData();
@ -64,9 +71,12 @@ class PRunSingleHisto : public PRunBase
Double_t fBackground; ///< needed if background range is given (units: 1/bin)
Int_t fPacking; ///< packing for this particular run. Either given in the RUN- or GLOBAL-block.
Int_t fGoodBins[2]; ///< keep first/last good bins. 0=fgb, 1=lgb
Int_t fGoodBins[2]; ///< keep first/last good bins. 0=fgb, 1=lgb
PDoubleVector fForward; ///< forward histo data
PDoubleVector fForward; ///< forward histo data
Int_t fStartTimeBin; ///< bin at which the fit starts
Int_t fEndTimeBin; ///< bin at which the fit ends
virtual Bool_t GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlock, PUIntVector &histoNo);
virtual Bool_t GetProperDataRange();

View File

@ -51,6 +51,9 @@ class PRunSingleHistoRRF : public PRunBase
virtual void SetFitRangeBin(const TString fitRange);
virtual Int_t GetStartTimeBin() { return fStartTimeBin; }
virtual Int_t GetEndTimeBin() { return fEndTimeBin; }
protected:
virtual void CalcNoOfFitBins();
virtual Bool_t PrepareData();
@ -58,14 +61,18 @@ class PRunSingleHistoRRF : public PRunBase
virtual Bool_t PrepareViewData(PRawRunData* runData, const UInt_t histoNo);
private:
static const Double_t fN0EstimateEndTime = 1.0; ///< end time in (us) over which N0 is estimated. Should eventually be estimated automatically ...
Double_t fN0EstimateEndTime; ///< end time in (us) over which N0 is estimated.
UInt_t fNoOfFitBins; ///< number of bins to be fitted
Double_t fBackground; ///< needed if background range is given (units: 1/bin)
Double_t fBkgErr; ///< estimate error on the estimated background
Int_t fRRFPacking; ///< RRF packing for this particular run. Given in the GLOBAL-block.
Int_t fGoodBins[2]; ///< keep first/last good bins. 0=fgb, 1=lgb
Int_t fStartTimeBin; ///< bin at which the fit starts
Int_t fEndTimeBin; ///< bin at which the fit ends
PDoubleVector fForward; ///< forward histo data
PDoubleVector fM; ///< vector holding M(t) = [N(t)-N_bkg] exp(+t/tau). Needed to estimate N0.
PDoubleVector fMerr; ///< vector holding the error of M(t): M_err = exp(+t/tau) sqrt(N(t)).

View File

@ -70,8 +70,9 @@
#define THEORY_STATIC_TF_NK 24
#define THEORY_DYNAMIC_ZF_NK 25
#define THEORY_DYNAMIC_TF_NK 26
#define THEORY_POLYNOM 27
#define THEORY_USER_FCN 28
#define THEORY_MU_MINUS_EXP 27
#define THEORY_POLYNOM 28
#define THEORY_USER_FCN 29
// function parameter tags, i.e. how many parameters has a specific function
// if there is a comment with a (tshift), the number of parameters is increased by one
@ -102,9 +103,10 @@
#define THEORY_PARAM_STATIC_TF_NK 4 // phase, frequency, damping D0, R_b=DGbG/D0 (tshift)
#define THEORY_PARAM_DYNAMIC_ZF_NK 3 // damping D0, R_b=DGbG/D0, nu_c (tshift)
#define THEORY_PARAM_DYNAMIC_TF_NK 5 // phase, frequency, damping D0, R_b=DGbG/D0, nu_c (tshift)
#define THEORY_PARAM_MU_MINUS_EXP 6 // N0, tau, A, damping, phase, frequency (tshift)
// number of available user functions
#define THEORY_MAX 29
#define THEORY_MAX 30
// maximal number of parameters. Needed in the contents of LF
#define THEORY_MAX_PARAM 10
@ -217,6 +219,9 @@ static PTheoDataBase fgTheoDataBase[THEORY_MAX] = {
{THEORY_DYNAMIC_TF_NK, THEORY_PARAM_DYNAMIC_TF_NK, false,
"dynamicNKTF", "dnktf", "(phase frequency damping_D0 R_b nu_c)", "(phase frequency damping_D0 R_b nu_c tshift)"},
{THEORY_MU_MINUS_EXP, THEORY_PARAM_MU_MINUS_EXP, false,
"muMinusExpTF", "mmsetf", "(N0 tau A lambda phase nu)", "(N0 tau A lambda phase nu tshift)"},
{THEORY_POLYNOM, 0, false,
"polynom", "p", "(tshift p0 p1 ... pn)", "(tshift p0 p1 ... pn)"},
@ -272,6 +277,7 @@ class PTheory
virtual Double_t StaticNKTF(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
virtual Double_t DynamicNKZF(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
virtual Double_t DynamicNKTF(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
virtual Double_t MuMinusExpTF(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
virtual Double_t Polynom(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;
virtual Double_t UserFcn(register Double_t t, const PDoubleVector& paramValues, const PDoubleVector& funcValues) const;

View File

@ -49,6 +49,7 @@
using namespace std;
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/case_conv.hpp> // for to_lower() in std::string
using namespace boost::algorithm;
@ -84,14 +85,10 @@ bool isNumber(const string &s)
void msr2data_syntax()
{
cout << endl << "usage 0: msr2data [--version] | [--help]";
cout << endl << "usage 1: msr2data <run> <extension> [-o<outputfile>] [new] [data] [[no]header] [nosummary] [global[+[!]]]";
cout << endl << " [fit [-k] [-t] | fit-<template>[!] [-k] [-t] | msr-<template>]";
cout << endl << "usage 2: msr2data <run1> <run2> <extension> [-o<outputfile>] [new] [data] [[no]header] [nosummary] [global[+[!]]]";
cout << endl << " [fit [-k] [-t] | fit-<template>[!] [-k] [-t] | msr-<template>]";
cout << endl << "usage 3: msr2data \\[<runList>\\] <extension> [-o<outputfile> ] [new] [data] [[no]header] [nosummary] [global[+[!]]]";
cout << endl << " [fit [-k] [-t] | fit-<template>[!] [-k] [-t] | msr-<template>]";
cout << endl << "usage 4: msr2data <runlist> <extension> [-o<outputfile>] [new] [data] [[no]header] [nosummary] [global[+[!]]]";
cout << endl << " [fit [-k] [-t] | fit-<template>[!] [-k] [-t] | msr-<template>]";
cout << endl << "usage 1: msr2data <run> <extension> options";
cout << endl << "usage 2: msr2data <run1> <run2> <extension> options";
cout << endl << "usage 3: msr2data \\[<runList>\\] <extension> options";
cout << endl << "usage 4: msr2data <runListFileName> <extension> options";
cout << endl;
cout << endl << " <runList> can be:";
cout << endl << " (i) <run0>, <run1>, <run2>, ... <runN> : run numbers, e.g. 123 124";
@ -99,7 +96,12 @@ void msr2data_syntax()
cout << endl << " (iii) <run0>:<runN>:<step> : a sequence, e.g. 123:127:2 -> 123 125 127";
cout << endl << " <step> will give the step width and has to be a positive number!";
cout << endl << " a <runList> can also combine (i)-(iii), e.g. 123 128-130 133, etc.";
cout << endl << " <runListFileName> : an ASCII file containing a list of run numbers and optional";
cout << endl << " external parameters is passed to msr2data. For details see";
cout << endl << " the online documentation: http://lmu.web.psi.ch/musrfit/user/MUSR/Msr2Data.html";
cout << endl << " <extension> : msr-file extension, e.g. _tf_h13 for the file name 8472_tf_h13.msr";
cout << endl;
cout << endl << "options:";
cout << endl << " -o<outputfile> : specify the name of the DB or column-data output file; default: out.db/out.dat";
cout << endl << " if the option '-o none' is used, no output file will be written.";
cout << endl << " new : before writing a new output file, delete the contents of any existing file with the same name";
@ -109,6 +111,10 @@ void msr2data_syntax()
cout << endl << " If either none or both of the header options are given, the file header will be written";
cout << endl << " if a new file is created, but not if the output file exists already!";
cout << endl << " nosummary : no additional data from the run data file is written to the output file";
cout << endl << " paramList <param> : option used to select the parameters which shall be exported.";
cout << endl << " <param> is a list of parameter numbers to be exported. Allowed lists are:";
cout << endl << " 1-16 will export parameters 1 to 16. 1 3 5 will export parameters 1 3 5.";
cout << endl << " A combination of both is possible, e.g. 1-16 19 31 62, and so on.";
cout << endl << " fit : invoke musrfit to fit the specified runs";
cout << endl << " All msr input files are assumed to be present, none is newly generated!";
cout << endl << " fit-<template>! : generate msr files for the runs to be processed from the <template> run";
@ -149,6 +155,10 @@ void msr2data_syntax()
cout << endl << " will use 2045_tf_histo.msr as templete, and subsequently generating msr-files from the run-list:";
cout << endl << " 2047 2049 2051 2053 2056 (2047_tf_histo.msr etc.) and fit them.";
cout << endl;
cout << endl << " msr2data 2046 2058 _tf_histo paramList 1-12 data -o fitParam.dat";
cout << endl << " will export the parameters number 1 trough 12 in a column like fashion of the runs 2046 to 2058,";
cout << endl << " collected form the msr-files 2046_tf_histo.msr and so on.";
cout << endl;
cout << endl << " For further information please refer to";
cout << endl << " http://lmu.web.psi.ch/musrfit/user/MUSR/Msr2Data.html";
cout << endl << " https://intranet.psi.ch/MUSR/Msr2Data";
@ -208,7 +218,8 @@ string msr2data_validArguments(const vector<string> &arg)
if ( (!iter->compare("header")) || (!iter->compare("noheader")) || (!iter->compare("nosummary")) \
|| (!iter->substr(0,3).compare("fit")) || (!iter->compare("-k")) || (!iter->compare("-t")) \
|| (!iter->compare("data")) || (!iter->substr(0,4).compare("msr-")) || (!iter->compare("global")) \
|| (!iter->compare("global+")) || (!iter->compare("global+!")) || (!iter->compare("new")) )
|| (!iter->compare("global+")) || (!iter->compare("global+!")) || (!iter->compare("new")) \
|| !iter->compare("paramList") )
word.clear();
else if (!iter->substr(0,2).compare("-o")) {
word.clear();
@ -393,6 +404,91 @@ int msr2data_doInputCreation(vector<string> &arg, bool &inputOnly)
return temp;
}
//--------------------------------------------------------------------------
/**
* <p>
*
*/
int msr2data_paramList(vector<string> &arg, vector<unsigned int> &paramList)
{
paramList.clear(); // make sure paramList is empty
unsigned int idx=0;
// check if paramList tag is present
for (unsigned int i=0; i<arg.size(); i++) {
if (!arg[i].compare("paramList")) {
idx = i+1;
break;
}
}
if (idx == 0) { // paramList tag NOT present
return 0;
}
// make sure there are parameter list elements to follow
if (idx == arg.size()) {
cerr << endl << "**ERROR** found paramList without any arguments!" << endl;
msr2data_syntax();
return -1;
}
// paramList tag present and further elements present: collect them
vector<string> str;
unsigned int idx_end=0;
size_t pos=string::npos;
for (unsigned int i=idx; i<arg.size(); i++) {
pos = arg[i].find("-");
if (pos == 0) { // likely something like -o, -k, etc.
idx_end = i;
break;
} else if (pos != string::npos) { // looks like a parameter list like n0-n1
boost::split(str, arg[i], boost::is_any_of("-"));
if (str.size() != 2) { // something is wrong, since the structure n0-n1 is expected
cerr << endl << "**ERROR** found token " << arg[i] << " in paramList command which cannot be handled." << endl;
msr2data_syntax();
return -1;
}
if (!str[0].compare("fit") || !str[0].compare("msr")) {
idx_end = i;
break;
}
if (!isNumber(str[0]) || !isNumber(str[1])) {
cerr << endl << "**ERROR** found token " << arg[i] << " in paramList command which cannot be handled." << endl;
msr2data_syntax();
return -1;
}
unsigned int start=boost::lexical_cast<unsigned int>(str[0]);
unsigned int end=boost::lexical_cast<unsigned int>(str[1]);
for (unsigned int j=start; j<=end; j++)
paramList.push_back(j);
} else if (isNumber(arg[i])) { // a single number
paramList.push_back(boost::lexical_cast<unsigned int>(arg[i]));
} else { // likely the next argument not related to paramList
idx_end = i;
break;
}
}
if (idx_end == 0)
idx_end = arg.size();
// remove all the paramList arguments for arg
arg.erase(arg.begin()+idx-1, arg.begin()+idx_end);
// go through the parameter list and make sure the values are unique
for (unsigned int i=0; i<paramList.size(); i++) {
for (unsigned int j=i+1; j<paramList.size(); j++) {
if (paramList[i] == paramList[j]) {
cerr << endl << "**ERROR** the parameter list numbers have to be unique. Found " << paramList[i] << " at least 2 times." << endl;
msr2data_syntax();
return -1;
}
}
}
return paramList.size();
}
//--------------------------------------------------------------------------
/**
* <p>msr2data is used to generate msr-files based on template msr-files, automatically fit these new msr-files,
@ -441,6 +537,7 @@ int main(int argc, char *argv[])
vector<unsigned int> run_vec;
string run_list;
string msrExtension;
vector<unsigned int> param_vec;
try {
if (arg[0].at(0) == '[') { // In case a list of runs is given by [...]
@ -557,7 +654,14 @@ int main(int argc, char *argv[])
return -1;
}
// check the validity of the command line given command line arguments
// check if parameter list is given
int noParamList(msr2data_paramList(arg, param_vec));
if (noParamList == -1) {
arg.clear();
return -1;
}
// check the validity of the command line given command line arguments
string wrongArgument(msr2data_validArguments(arg));
if (!wrongArgument.empty()) {
cerr << endl;
@ -567,18 +671,18 @@ int main(int argc, char *argv[])
return -1;
}
// check if the output format is DB or data
// check if the output format is DB or data
bool db(msr2data_useOption(arg, "data"));
// check the arguments for the "-o" option and set the output filename
// check the arguments for the "-o" option and set the output filename
string outputFile(msr2data_outputfile(arg, db));
// introduce check, if no output should be generated - in that case we do not need msrfile and rundata handlers later
// introduce check, if no output should be generated - in that case we do not need msrfile and rundata handlers later
bool realOutput(true);
if (!to_lower_copy(outputFile).compare("none"))
realOutput = false;
// create the msr2data-object and set the run numbers according to the runTAG above
// create the msr2data-object and set the run numbers according to the runTAG above
PMsr2Data *msr2dataHandler = new PMsr2Data(msrExtension);
int status;
@ -615,7 +719,7 @@ int main(int argc, char *argv[])
run_vec.clear();
// check if fitting should be done and in case, which template run number to use
// check if fitting should be done and in case, which template run number to use
int temp(0);
bool chainfit(true), onlyInputCreation(false);
string musrfitOptions;
@ -635,7 +739,7 @@ int main(int argc, char *argv[])
}
// check if any options should be passed to musrfit
// check if any options should be passed to musrfit
if (temp) {
if (!msr2data_useOption(arg, "-k"))
musrfitOptions.append("-k ");
@ -643,9 +747,8 @@ int main(int argc, char *argv[])
musrfitOptions.append("-t ");
}
// if no fitting should be done, check if only the input files should be created
if(!temp) {
// if no fitting should be done, check if only the input files should be created
if (!temp) {
temp = msr2data_doInputCreation(arg, onlyInputCreation);
if (onlyInputCreation) {
// if only input files should be created, do not write data to an output file (no matter, what has been determined earlier)
@ -672,8 +775,8 @@ int main(int argc, char *argv[])
globalMode = 2;
}
// At this point it should be clear if any template for input-file generation is given or not.
// Therefore, the number of digits in the run number format is determined only here.
// At this point it should be clear if any template for input-file generation is given or not.
// Therefore, the number of digits in the run number format is determined only here.
if(temp > 0) {
status = msr2dataHandler->DetermineRunNumberDigits(temp, setNormalMode);
} else {
@ -685,7 +788,7 @@ int main(int argc, char *argv[])
return status;
}
// Check if all given run numbers are covered by the formatting of the data file name
// Check if all given run numbers are covered by the formatting of the data file name
status = msr2dataHandler->CheckRunNumbersInRange();
if(status) {
cerr << endl;
@ -736,7 +839,7 @@ int main(int argc, char *argv[])
}
}
// GLOBAL MODE
// GLOBAL MODE
if (!setNormalMode) {
ostringstream strInfile;
strInfile << msr2dataHandler->GetPresentRun() << "+global" << msrExtension << ".msr";
@ -798,7 +901,7 @@ int main(int argc, char *argv[])
while (msr2dataHandler->GetPresentRun()) {
// write DB or dat file
status = msr2dataHandler->WriteOutput(outputFile, db, writeHeader, !setNormalMode, counter);
status = msr2dataHandler->WriteOutput(outputFile, param_vec, db, writeHeader, !setNormalMode, counter);
if (status == -1) {
msr2data_cleanup(msr2dataHandler, arg);
return status;
@ -842,7 +945,7 @@ int main(int argc, char *argv[])
}
}
// and do the fitting
// and do the fitting
if (!onlyInputCreation) {
// check if MUSRFITPATH is set, if not issue a warning
string path("");
@ -866,12 +969,12 @@ int main(int argc, char *argv[])
}
}
// read msr-file
// read msr-file
if (realOutput) {
status = msr2dataHandler->ReadMsrFile(strInfile.str());
if (status != PMUSR_SUCCESS) {
// if the msr-file cannot be read, write no output but proceed to the next run
status = msr2dataHandler->WriteOutput("none", db, writeHeader);
status = msr2dataHandler->WriteOutput("none", param_vec, db, writeHeader);
if (status == -1) {
msr2data_cleanup(msr2dataHandler, arg);
return status;
@ -881,12 +984,12 @@ int main(int argc, char *argv[])
}
}
// read data files
// read data files
if (writeSummary)
status = msr2dataHandler->ReadRunDataFile();
// write DB or dat file
status = msr2dataHandler->WriteOutput(outputFile, db, writeHeader);
// write DB or dat file
status = msr2dataHandler->WriteOutput(outputFile, param_vec, db, writeHeader);
if (status == -1) {
msr2data_cleanup(msr2dataHandler, arg);
return status;
@ -899,7 +1002,7 @@ int main(int argc, char *argv[])
// Unfortunately, this can be done in a coherent way only on that level
// Unfortunately, there are also problems with boost::filesystem::exists(outputFile)
// Therefore, first try to open the file for reading and if this works, write to it - not clean but it works
if(realOutput) {
if (realOutput) {
fileOutput = new fstream;
fileOutput->open(outputFile.c_str(), ios::in);
if (fileOutput->is_open()) {

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2012-2014 by Andreas Suter *
* Copyright (C) 2012-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2012-2014 by Andreas Suter *
* Copyright (C) 2012-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2015 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2015 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -88,6 +88,10 @@ PMsr2DataDialog::PMsr2DataDialog(PMsr2DataParam *msr2DataParam, const QString he
fDataOutputFileName_lineEdit->setText(fMsr2DataParam->dbOutputFileName);
}
if (!fMsr2DataParam->paramList.isEmpty()) {
fParamList_lineEdit->setText(fMsr2DataParam->paramList);
}
fWriteDataHeader_checkBox->setChecked(fMsr2DataParam->writeDbHeader);
fIgnoreDataHeaderInfo_checkBox->setChecked(fMsr2DataParam->ignoreDataHeaderInfo);
fKeepMinuit2Output_checkBox->setChecked(fMsr2DataParam->keepMinuit2Output);
@ -129,6 +133,7 @@ PMsr2DataParam* PMsr2DataDialog::getMsr2DataParam()
} else {
fMsr2DataParam->templateRunNo = fTemplateRunNumber_lineEdit->text().toInt();
}
fMsr2DataParam->paramList = fParamList_lineEdit->text();
fMsr2DataParam->dbOutputFileName = fDataOutputFileName_lineEdit->text();
fMsr2DataParam->writeDbHeader = fWriteDataHeader_checkBox->isChecked();
fMsr2DataParam->ignoreDataHeaderInfo = fIgnoreDataHeaderInfo_checkBox->isChecked();

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -1870,6 +1870,8 @@ void PTextEdit::musrMsr2Data()
QFileInfo fi;
QString str;
int i, end;
QStringList list;
bool ok;
fMsr2DataParam = dlg->getMsr2DataParam();
fAdmin->setKeepMinuit2OutputFlag(fMsr2DataParam->keepMinuit2Output);
@ -1963,6 +1965,14 @@ void PTextEdit::musrMsr2Data()
// options
// parameter export list
if (!fMsr2DataParam->paramList.isEmpty()) {
cmd.append("paramList");
QStringList list = fMsr2DataParam->paramList.split(' ');
for (int i=0; i<list.size(); i++)
cmd.append(list[i]);
}
// no header flag?
if (!fMsr2DataParam->writeDbHeader)
cmd.append("noheader");
@ -2061,12 +2071,11 @@ void PTextEdit::musrMsr2Data()
}
break;
case 1: // run list
end = 0;
while (!runList.section(' ', end, end, QString::SectionSkipEmpty).isEmpty()) {
end++;
}
for (int i=0; i<end; i++) {
fln = runList.section(' ', i, i, QString::SectionSkipEmpty);
list = getRunList(runList, ok);
if (!ok)
return;
for (int i=0; i<list.size(); i++) {
fln = list[i];
if (fMsr2DataParam->msrFileExtension.isEmpty())
fln += ".msr";
else
@ -2186,6 +2195,9 @@ void PTextEdit::musrView()
cmd = str + " \"";
str = *fFilenames.find( currentEditor() );
int pos = str.lastIndexOf("/");
if (pos != -1)
str.remove(0, pos+1);
QString numStr;
numStr.setNum(fAdmin->getTimeout());
cmd += str + "\" --timeout " + numStr;
@ -2194,6 +2206,10 @@ void PTextEdit::musrView()
cmd += " &";
int status=system(cmd.toLatin1());
if (status != 0) {
cerr << "**WARNING** musrView: something went wrong ..." << endl;
}
}
//----------------------------------------------------------------------------------------------------
@ -2629,6 +2645,58 @@ void PTextEdit::fillRecentFiles()
}
}
//----------------------------------------------------------------------------------------------------
/**
* <p> run list is split (space separated) and expanded (start-end -> start, start+1, ..., end) to a list
*
* \param runListStr list to be split and expanded
* \param ok true if everything is fine; false if an error has been encountered
*
* \return fully expanded run list
*/
QStringList PTextEdit::getRunList(QString runListStr, bool &ok)
{
QStringList result;
bool isInt;
QString str;
ok = true;
// first split space separated parts
QStringList tok = runListStr.split(' ', QString::SkipEmptyParts);
for (int i=0; i<tok.size(); i++) {
if (tok[i].contains('-')) { // list given, hence need to expand
QStringList runListTok = tok[i].split('-', QString::SkipEmptyParts);
if (runListTok.size() != 2) { // error
ok = false;
result.clear();
return result;
}
int start=0, end=0;
start = runListTok[0].toInt(&isInt);
if (!isInt) {
ok = false;
result.clear();
return result;
}
end = runListTok[1].toInt(&isInt);
if (!isInt) {
ok = false;
result.clear();
return result;
}
for (int i=start; i<=end; i++) {
str = QString("%1").arg(i);
result << str;
}
} else { // keep it
result << tok[i];
}
}
return result;
}
//----------------------------------------------------------------------------------------------------
// END
//----------------------------------------------------------------------------------------------------

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -31,6 +31,8 @@
#define _PTEXTEDIT_H_
#include <QMainWindow>
#include <QString>
#include <QStringList>
#include <QMap>
#include <QTimer>
#include <QString>
@ -175,6 +177,7 @@ private:
QAction *fRecentFilesAction[MAX_RECENT_FILES]; ///< array of the recent file actions
void fillRecentFiles();
QStringList getRunList(QString runListStr, bool &ok);
};

View File

@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>552</width>
<height>551</height>
<height>599</height>
</rect>
</property>
<property name="windowTitle">
@ -64,7 +64,14 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="fFirst_lineEdit"/>
<widget class="QLineEdit" name="fFirst_lineEdit">
<property name="toolTip">
<string>start run number</string>
</property>
<property name="whatsThis">
<string>start run number</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
@ -90,7 +97,14 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="fLast_lineEdit"/>
<widget class="QLineEdit" name="fLast_lineEdit">
<property name="toolTip">
<string>end run number</string>
</property>
<property name="whatsThis">
<string>end run number</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
@ -130,7 +144,19 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="fRunList_lineEdit"/>
<widget class="QLineEdit" name="fRunList_lineEdit">
<property name="whatsThis">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;The run list consists of a collection of run number. Accepted input formats are:&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;(i) &amp;lt;run0&amp;gt; &amp;lt;run1&amp;gt; ... &amp;lt;runN&amp;gt;, e.g. 124 126 129&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;(ii) &amp;lt;run0&amp;gt;-&amp;lt;runN&amp;gt;, e.g. 124-126, i.e. 124 125 126&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;(iii) &amp;lt;run0&amp;gt;:&amp;lt;runN&amp;gt;:&amp;lt;step&amp;gt;, e.g 124:128:2, i.e. 124 126 128&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;or combination of those three.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
@ -170,7 +196,16 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="fRunListFileName_lineEdit"/>
<widget class="QLineEdit" name="fRunListFileName_lineEdit">
<property name="whatsThis">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;an ASCII file containing a list of run numbers and optional external parameters is passed to msr2data. &lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;For details see the online documentation.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
@ -236,7 +271,11 @@
</spacer>
</item>
<item>
<widget class="QLineEdit" name="fMsrFileExtension_lineEdit"/>
<widget class="QLineEdit" name="fMsrFileExtension_lineEdit">
<property name="whatsThis">
<string>the extension will be used together with the run number to generate the msr-file name. For example: the run number being 123 and the extension _tf_h13, an msr-file name 123_tf_h13.msr will result.</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
@ -284,10 +323,22 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="fTemplateRunNumber_lineEdit"/>
<widget class="QLineEdit" name="fTemplateRunNumber_lineEdit">
<property name="whatsThis">
<string>the run number given here will be used as a msr-file template number to generate/fit the run's given in the 'Run List Input'.</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="fChainFit_checkBox">
<property name="whatsThis">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;unselected means: all msr-files generated and fitted will start from the given template.&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;selected means: the msr-files generated and fitted will use the previously fitted msr-file as an input. This makes sense if the run list given has continously changing parameters, e.g. as function of the temperature.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Chain Fit</string>
</property>
@ -339,7 +390,11 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="fDataOutputFileName_lineEdit"/>
<widget class="QLineEdit" name="fDataOutputFileName_lineEdit">
<property name="whatsThis">
<string>db- or dat-output file name for the parameter files.</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
@ -366,7 +421,7 @@
<x>0</x>
<y>360</y>
<width>551</width>
<height>141</height>
<height>172</height>
</rect>
</property>
<property name="title">
@ -386,6 +441,9 @@
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="fWriteDataHeader_checkBox">
<property name="whatsThis">
<string>For db-files, a Data Header will be written.</string>
</property>
<property name="text">
<string>Write Data Header</string>
</property>
@ -393,6 +451,13 @@
</item>
<item>
<widget class="QCheckBox" name="fIgnoreDataHeaderInfo_checkBox">
<property name="whatsThis">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;This tag is used in conjunction with LEM. If &lt;span style=&quot; font-weight:600;&quot;&gt;not&lt;/span&gt; selected, it will try to extract experiment specific parameters from the data file like implantation energy, transport HV settings, etc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Ignore Data Header Info</string>
</property>
@ -400,6 +465,9 @@
</item>
<item>
<widget class="QCheckBox" name="fKeepMinuit2Output_checkBox">
<property name="whatsThis">
<string>selected: for each run fitted, two additional files will be written, namely a &lt;msr-filename&gt;-mn2.output and &lt;msr-filename&gt;-mn2.root, which contain a richer set of information about fit, i.e. the covariance matrix, the correlation coefficients, etc.</string>
</property>
<property name="text">
<string>Keep Minuit2 Output</string>
</property>
@ -411,6 +479,14 @@
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QCheckBox" name="fWriteColumnData_checkBox">
<property name="whatsThis">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;unselected: the output parameter file is written in so called db-format.&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;selected: the output parameter file is written in column like ascii-format.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Write Column Data</string>
</property>
@ -418,6 +494,14 @@
</item>
<item>
<widget class="QCheckBox" name="fRecreateDataFile_checkBox">
<property name="whatsThis">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;unselected: if the parameter output file already exists, the parameters will be appended.&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;selected: if the parameter output file already exists: it will be deleted and a new one will be written.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Recreate Data File</string>
</property>
@ -425,6 +509,9 @@
</item>
<item>
<widget class="QCheckBox" name="fOpenFilesAfterFitting_checkBox">
<property name="whatsThis">
<string>selected: the newly generated msr-files will be opened in musredit after the fit took place.</string>
</property>
<property name="text">
<string>Open Files after Fitting</string>
</property>
@ -436,6 +523,9 @@
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="fTitleFromData_checkBox">
<property name="whatsThis">
<string>if selected: the run title of the generated msr-file will be the one given in the muSR data file.</string>
</property>
<property name="text">
<string>Take Data File Title</string>
</property>
@ -443,6 +533,13 @@
</item>
<item>
<widget class="QCheckBox" name="fCreateMsrFileOnly_checkBox">
<property name="whatsThis">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;if selected: the msr-files will be created, but &lt;span style=&quot; font-weight:600;&quot;&gt;no &lt;/span&gt;fitting will take place.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Create msr-File only</string>
</property>
@ -450,6 +547,9 @@
</item>
<item>
<widget class="QCheckBox" name="fFitOnly_checkBox">
<property name="whatsThis">
<string>selected: it is assumed that the msr-files already exist, and only musrfit is called.</string>
</property>
<property name="text">
<string>Fit Only</string>
</property>
@ -459,6 +559,9 @@
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QCheckBox" name="fGlobal_checkBox">
<property name="whatsThis">
<string>selected: will generate a msr-file for a global fit. Please check the online documentation for further details.</string>
</property>
<property name="text">
<string>Global</string>
</property>
@ -466,6 +569,9 @@
</item>
<item>
<widget class="QCheckBox" name="fGlobalPlus_checkBox">
<property name="whatsThis">
<string>selected: will generate a msr-file for a global fit. The difference between Global and Global+ is that for Global+ the input parameters of the msr-file are originating from the single run fits. Please check the online documentation for further details.</string>
</property>
<property name="text">
<string>Global+</string>
</property>
@ -477,12 +583,38 @@
</item>
</layout>
</widget>
<widget class="QLabel" name="fParamList_label">
<property name="geometry">
<rect>
<x>10</x>
<y>143</y>
<width>161</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Parameter Export List</string>
</property>
</widget>
<widget class="QLineEdit" name="fParamList_lineEdit">
<property name="geometry">
<rect>
<x>170</x>
<y>140</y>
<width>371</width>
<height>23</height>
</rect>
</property>
<property name="whatsThis">
<string>parameter numbers to be exported, e.g. 1-16, or 1 3-7, etc.</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>5</x>
<y>500</y>
<y>540</y>
<width>541</width>
<height>51</height>
</rect>

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -5,12 +5,10 @@
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
@ -49,6 +47,7 @@ typedef struct {
QString runListFileName; ///< run list filename (usage 4 of msr2data)
QString msrFileExtension; ///< msr filename extension, e.g. '0100_h13.msr' -> '_h13'
int templateRunNo; ///< fit template run number
QString paramList; ///< parameter list to be exported.
QString dbOutputFileName; ///< output file name for the generated (trumf-like) db-file.
bool writeDbHeader; ///< flag indicating if a db header shall be generated (== !noheader in msr2data)
bool ignoreDataHeaderInfo; ///< flag indicating if data header info (like temp.) shall be ignored (== nosummary in msr2data)

View File

@ -57,6 +57,12 @@ QMAKE_CC = $${CC}
QMAKE_CXX = $${CXX}
QMAKE_LINK = $${CXX}
# set proper permission for Mac OSX
macx {
QMAKE_INSTALL_FILE = install -m 6755 -p -o $$(USER) -g staff
QMAKE_INSTALL_PROGRAM = install -m 6755 -p -o root -g admin
}
# install path for the XML configuration file
unix:xml.path = $$(HOME)/.musrfit/musredit
macx:xml.path = $$(HOME)/.musrfit/musredit

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2012-2014 by Andreas Suter *
* Copyright (C) 2012-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2012-2014 by Andreas Suter *
* Copyright (C) 2012-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2010-2014 by Andreas Suter *
* Copyright (C) 2010-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2014 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

View File

@ -8,7 +8,7 @@
*****************************************************************************/
/***************************************************************************
* Copyright (C) 2009-2015 by Andreas Suter *
* Copyright (C) 2009-2016 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *

Some files were not shown because too many files have changed in this diff Show More