merge into master
This commit is contained in:
@@ -16,6 +16,10 @@ if BUILD_MUSREDIT
|
||||
EDITORDIR = musredit
|
||||
endif
|
||||
|
||||
if BUILD_MUSREDIT_QT5
|
||||
EDITORDIR = musredit_qt5
|
||||
endif
|
||||
|
||||
SUBDIRS = external/MusrRoot \
|
||||
external/TLemRunHeader \
|
||||
external/MuSR_software \
|
||||
@@ -23,6 +27,7 @@ SUBDIRS = external/MusrRoot \
|
||||
$(PNEXUSDIRS) \
|
||||
classes \
|
||||
external \
|
||||
musredit_qt5 \
|
||||
musredit \
|
||||
musrgui
|
||||
|
||||
@@ -36,6 +41,10 @@ if BUILD_MUSREDIT
|
||||
EXTRA_DIST = $(EDITORDIR)/Makefile
|
||||
endif
|
||||
|
||||
if BUILD_MUSREDIT_QT5
|
||||
EXTRA_DIST = $(EDITORDIR)/Makefile
|
||||
endif
|
||||
|
||||
bin_PROGRAMS = musrfit musrview musrt0 musrFT msr2msr msr2data any2many
|
||||
bin_PROGRAMS += write_musrRoot_runHeader musrRootValidation
|
||||
bin_PROGRAMS += dump_header
|
||||
@@ -51,7 +60,7 @@ write_musrRoot_runHeader_SOURCES = write_musrRoot_runHeader.cpp
|
||||
musrRootValidation_SOURCES = musrRootValidation.cpp
|
||||
dump_header_SOURCES = dump_header.cpp
|
||||
|
||||
xmldir = $(bindir)
|
||||
xmldir = $(HOME)/.musrfit
|
||||
xml_DATA = musrfit_startup.xml
|
||||
|
||||
LIBADD = $(PMUSR_LIBS) $(MUSR_ROOT_LIBS) $(LEM_LIBS) $(PSIBIN_LIBS) $(MUD_LIBS) $(PNEXUS_LIBS) $(DKS_LIB)
|
||||
@@ -73,7 +82,7 @@ install-xmlDATA: $(xml_DATA)
|
||||
DIFF="$$(diff "$(DESTDIR)$(xmldir)/$(xml_DATA)" "$(xml_DATA)" 2>&1)"; \
|
||||
if test "x$$DIFF" != "x"; then \
|
||||
echo " " && \
|
||||
echo " musrfit_startup.xml in $(bindir)" && \
|
||||
echo " musrfit_startup.xml in $(xmldir)" && \
|
||||
echo " is different from the distribution's version." && \
|
||||
echo " Do you want to overwrite it? [y/N]" && \
|
||||
read OVERWRITE && \
|
||||
@@ -92,7 +101,7 @@ uninstall-xmlDATA:
|
||||
DIFF="$$(diff "$(DESTDIR)$(xmldir)/$(xml_DATA)" "$(xml_DATA)" 2>&1)"; \
|
||||
if test "x$$DIFF" != "x"; then \
|
||||
echo " " && \
|
||||
echo " musrfit_startup.xml in $(bindir)" && \
|
||||
echo " musrfit_startup.xml in $(xmldir)" && \
|
||||
echo " is different from the distribution's version." && \
|
||||
echo " Do you want to remove it? [y/N]" && \
|
||||
read REMOVE && \
|
||||
|
||||
@@ -54,7 +54,7 @@ using namespace std;
|
||||
void any2many_syntax()
|
||||
{
|
||||
cout << endl << "usage: any2many [--help] : will show this help.";
|
||||
cout << endl << " any2many --version : will show the svn version.";
|
||||
cout << endl << " any2many --version : will show the git version.";
|
||||
cout << endl << " any2many -f <filenameList-input> | -r <runList-input>";
|
||||
cout << endl << " -c <convert-options> [-p <output-path>] [-y <year>]";
|
||||
cout << endl << " [-o <outputFileName> | -t <in-template> <out-template>] [-s]";
|
||||
@@ -83,6 +83,10 @@ void any2many_syntax()
|
||||
cout << endl << " NeXus2-HDF4, NeXus2-HDF5, NeXus2-XML, WKM, ASCII";
|
||||
cout << endl << " Comment: ROOT is superseeded by MusrRoot. If there is not a very good";
|
||||
cout << endl << " reason, avoid it!";
|
||||
cout << endl << " -h <histo-group-list> : This option is for MusrRoot input files only!";
|
||||
cout << endl << " Select the the histo groups to be exported. <histo-group-list> is a space";
|
||||
cout << endl << " separated list of the histo group, e.g. -h 0, 20 will try to export the histo";
|
||||
cout << endl << " 0 (NPP) and 20 (PPC).";
|
||||
cout << endl << " -p <output-path> : where <output-path> is the output path for the";
|
||||
cout << endl << " converted files. If nothing is given, the current directory";
|
||||
cout << endl << " will be used, unless the option '-s' is used.";
|
||||
@@ -190,7 +194,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// call any2many --help or any2many --version
|
||||
if (argc == 2) {
|
||||
if (strstr(argv[1], "--h"))
|
||||
if (!strncmp(argv[1], "--help", 128))
|
||||
any2many_syntax();
|
||||
else if (strstr(argv[1], "--v")) {
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -344,6 +348,21 @@ int main(int argc, char *argv[])
|
||||
show_syntax = true;
|
||||
break;
|
||||
}
|
||||
} else if (!strcmp(argv[i], "-h")) { // filter histo group list (for MusrRoot and ROOT (LEM) only!)
|
||||
bool done = false;
|
||||
int j = i+1;
|
||||
do {
|
||||
status = sscanf(argv[j], "%d", &ival);
|
||||
if (status == 1) {
|
||||
info.groupHistoList.push_back(ival);
|
||||
j++;
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
} while (!done && (j<argc));
|
||||
i = j-1;
|
||||
if (j >= argc) // make sure that counter is still in range
|
||||
break;
|
||||
} else if (!strcmp(argv[i], "-p")) { // filter output path name flag
|
||||
if (i+1 < argc) {
|
||||
info.outPath = argv[i+1];
|
||||
|
||||
@@ -15,12 +15,14 @@ h_sources = \
|
||||
../include/PMusrT0.h \
|
||||
../include/PPrepFourier.h \
|
||||
../include/PRunAsymmetry.h \
|
||||
../include/PRunAsymmetryRRF.h \
|
||||
../include/PRunBase.h \
|
||||
../include/PRunDataHandler.h \
|
||||
../include/PRunListCollection.h \
|
||||
../include/PRunNonMusr.h \
|
||||
../include/PRunMuMinus.h \
|
||||
../include/PRunSingleHisto.h \
|
||||
../include/PRunSingleHistoRRF.h \
|
||||
../include/PStartupHandler.h \
|
||||
../include/PTheory.h
|
||||
|
||||
@@ -59,12 +61,14 @@ cpp_sources = \
|
||||
PMusrT0.cpp \
|
||||
PPrepFourier.cpp \
|
||||
PRunAsymmetry.cpp \
|
||||
PRunAsymmetryRRF.cpp \
|
||||
PRunBase.cpp \
|
||||
PRunDataHandler.cpp \
|
||||
PRunListCollection.cpp \
|
||||
PRunNonMusr.cpp \
|
||||
PRunMuMinus.cpp \
|
||||
PRunSingleHisto.cpp \
|
||||
PRunSingleHistoRRF.cpp \
|
||||
PStartupHandler.cpp \
|
||||
PTheory.cpp
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -77,12 +77,16 @@ Double_t PFitterFcn::operator()(const std::vector<Double_t>& par) const
|
||||
|
||||
if (fUseChi2) { // chi square
|
||||
value += fRunListCollection->GetSingleHistoChisq(par);
|
||||
value += fRunListCollection->GetSingleHistoRRFChisq(par);
|
||||
value += fRunListCollection->GetAsymmetryChisq(par);
|
||||
value += fRunListCollection->GetAsymmetryRRFChisq(par);
|
||||
value += fRunListCollection->GetMuMinusChisq(par);
|
||||
value += fRunListCollection->GetNonMusrChisq(par);
|
||||
} else { // max likelihood
|
||||
value += fRunListCollection->GetSingleHistoMaximumLikelihood(par);
|
||||
value += fRunListCollection->GetSingleHistoRRFMaximumLikelihood(par);
|
||||
value += fRunListCollection->GetAsymmetryMaximumLikelihood(par);
|
||||
value += fRunListCollection->GetAsymmetryRRFMaximumLikelihood(par);
|
||||
value += fRunListCollection->GetMuMinusMaximumLikelihood(par);
|
||||
value += fRunListCollection->GetNonMusrMaximumLikelihood(par);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2015 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -231,7 +231,7 @@ PFourier::~PFourier()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Transform
|
||||
// Transform (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Carries out the Fourier transform. It is assumed that fStartTime is the time zero
|
||||
@@ -316,7 +316,7 @@ void PFourier::SetUseFFTW(const Bool_t flag)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetMaxFreq
|
||||
// GetMaxFreq (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the maximal frequency in units choosen, i.e. Gauss, Tesla, MHz, Mc/s
|
||||
@@ -329,7 +329,7 @@ Double_t PFourier::GetMaxFreq()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetRealFourier
|
||||
// GetRealFourier (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the real part Fourier as a histogram.
|
||||
@@ -377,7 +377,112 @@ TH1F* PFourier::GetRealFourier(const Double_t scale)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetImaginaryFourier
|
||||
// GetPhaseOptRealFourier (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the phase corrected real Fourier transform. The correction angle is
|
||||
* past back as well.
|
||||
* <p>Currently it simply does the following thing: (i) rotate the complex Fourier
|
||||
* transform through all angles in 1/2° steps, i.e.
|
||||
* \f$ f_{\rm rot} = (f_{\rm real} + i f_{\rm imag}) \exp(- \alpha)\f$,
|
||||
* hence \f$ f_{\rm rot} = f_{\rm real} \cos(\alpha) + f_{\rm imag} \sin(\alpha)\f$.
|
||||
* (ii) search the maximum of \f$ sum_{\alpha} {\cal R}\{f_{\rm rot}\}\f$ for all
|
||||
* \f$\alpha\f$. From this one gets \f$\alpha_{\rm opt}\f$. (iii) The 'optimal'
|
||||
* real Fourier transform is \f$f_{\rm opt} = (f_{\rm real} + i f_{\rm imag})
|
||||
* \exp(- \alpha_{\rm opt})\f$.
|
||||
*
|
||||
* \return the TH1F histo of the phase 'optimzed' real Fourier transform.
|
||||
*
|
||||
* \param phase return value of the optimal phase
|
||||
* \param scale normalisation factor
|
||||
* \param min minimal freq / field from which to optimise. Given in the choosen unit.
|
||||
* \param max maximal freq / field up to which to optimise. Given in the choosen unit.
|
||||
*/
|
||||
TH1F* PFourier::GetPhaseOptRealFourier(Double_t &phase, const Double_t scale, const Double_t min, const Double_t max)
|
||||
{
|
||||
UInt_t noOfFourierBins = 0;
|
||||
if (fNoOfBins % 2 == 0)
|
||||
noOfFourierBins = fNoOfBins/2;
|
||||
else
|
||||
noOfFourierBins = (fNoOfBins+1)/2;
|
||||
|
||||
UInt_t minBin = 0;
|
||||
UInt_t maxBin = noOfFourierBins;
|
||||
|
||||
// check if minimum frequency is given. If yes, get the proper minBin
|
||||
if (min != -1.0) {
|
||||
minBin = (UInt_t)(min/fResolution);
|
||||
}
|
||||
|
||||
// check if maximum frequency is given. If yes, get the proper maxBin
|
||||
if (max != -1.0) {
|
||||
maxBin = (UInt_t)(max/fResolution);
|
||||
if (maxBin >= noOfFourierBins) {
|
||||
maxBin = noOfFourierBins;
|
||||
cerr << "**WARNING** maximum frequency/field out of range. Will adopted it." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// copy the real/imag Fourier from min to max
|
||||
vector<Double_t> realF, imagF;
|
||||
for (UInt_t i=minBin; i<=maxBin; i++) {
|
||||
realF.push_back(fOut[i][0]);
|
||||
imagF.push_back(fOut[i][1]);
|
||||
}
|
||||
|
||||
// rotate trough real/imag Fourier through 360° with a 1/2° resolution and keep the integral
|
||||
Double_t rotRealIntegral[720];
|
||||
Double_t sum = 0.0;
|
||||
Double_t da = 8.72664625997164774e-03; // pi / 360
|
||||
for (UInt_t i=0; i<720; i++) {
|
||||
sum = 0.0;
|
||||
for (UInt_t j=0; j<realF.size(); j++) {
|
||||
sum += realF[j]*cos(da*i) + imagF[j]*sin(da*i);
|
||||
}
|
||||
rotRealIntegral[i] = sum;
|
||||
}
|
||||
|
||||
// find the maximum in rotRealIntegral
|
||||
Double_t maxRot = 0.0;
|
||||
UInt_t maxRotBin = 0;
|
||||
for (UInt_t i=0; i<720; i++) {
|
||||
if (maxRot < rotRealIntegral[i]) {
|
||||
maxRot = rotRealIntegral[i];
|
||||
maxRotBin = i;
|
||||
}
|
||||
}
|
||||
|
||||
// keep the optimal phase
|
||||
phase = maxRotBin*da;
|
||||
|
||||
// clean up
|
||||
realF.clear();
|
||||
imagF.clear();
|
||||
|
||||
// invoke the real phase optimised histo to be filled. Caller is the owner!
|
||||
Char_t name[256];
|
||||
Char_t title[256];
|
||||
snprintf(name, sizeof(name), "%s_Fourier_PhOptRe", fData->GetName());
|
||||
snprintf(title, sizeof(title), "%s_Fourier_PhOptRe", fData->GetTitle());
|
||||
|
||||
TH1F *realPhaseOptFourier = new TH1F(name, title, noOfFourierBins, -fResolution/2.0, (Double_t)(noOfFourierBins-1)*fResolution+fResolution/2.0);
|
||||
if (realPhaseOptFourier == 0) {
|
||||
fValid = false;
|
||||
cerr << endl << "**SEVERE ERROR** couldn't allocate memory for the real part of the Fourier transform." << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// fill realFourier vector
|
||||
for (UInt_t i=0; i<noOfFourierBins; i++) {
|
||||
realPhaseOptFourier->SetBinContent(i+1, scale*(fOut[i][0]*cos(phase) + fOut[i][1]*sin(phase)));
|
||||
realPhaseOptFourier->SetBinError(i+1, 0.0);
|
||||
}
|
||||
|
||||
return realPhaseOptFourier;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetImaginaryFourier (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the imaginary part Fourier as a histogram.
|
||||
@@ -425,7 +530,7 @@ TH1F* PFourier::GetImaginaryFourier(const Double_t scale)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetPowerFourier
|
||||
// GetPowerFourier (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the Fourier power spectrum as a histogram.
|
||||
@@ -473,7 +578,7 @@ TH1F* PFourier::GetPowerFourier(const Double_t scale)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetPhaseFourier
|
||||
// GetPhaseFourier (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the Fourier phase spectrum as a histogram.
|
||||
@@ -541,7 +646,7 @@ TH1F* PFourier::GetPhaseFourier(const Double_t scale)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// PrepareFFTwInputData
|
||||
// PrepareFFTwInputData (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Feeds the Fourier data and apply the apodization.
|
||||
@@ -604,7 +709,7 @@ void PFourier::PrepareFFTwInputData(UInt_t apodizationTag)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ApodizeData
|
||||
// ApodizeData (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Carries out the appodization of the data.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2015 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -227,6 +227,7 @@ PFourierCanvas::~PFourierCanvas()
|
||||
delete fFourierHistos[i].dataFourierIm;
|
||||
delete fFourierHistos[i].dataFourierPwr;
|
||||
delete fFourierHistos[i].dataFourierPhase;
|
||||
delete fFourierHistos[i].dataFourierPhaseOptReal;
|
||||
}
|
||||
fFourierHistos.clear();
|
||||
}
|
||||
@@ -386,6 +387,11 @@ void PFourierCanvas::HandleMenuPopup(Int_t id)
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PHASE);
|
||||
fCurrentPlotView = FOURIER_PLOT_PHASE;
|
||||
PlotFourier();
|
||||
} else if (id == P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PHASE_OPT_REAL) {
|
||||
fPopupFourier->UnCheckEntries();
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PHASE_OPT_REAL);
|
||||
fCurrentPlotView = FOURIER_PLOT_PHASE_OPT_REAL;
|
||||
PlotFourier();
|
||||
} else if (id == P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PHASE_PLUS) {
|
||||
IncrementFourierPhase();
|
||||
} else if (id == P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PHASE_MINUS) {
|
||||
@@ -590,6 +596,12 @@ void PFourierCanvas::ExportData(const Char_t *pathFileName)
|
||||
yAxis = TString("<Phase>");
|
||||
xMinBin = fFourierHistos[0].dataFourierPhase->GetXaxis()->GetFirst();
|
||||
xMaxBin = fFourierHistos[0].dataFourierPhase->GetXaxis()->GetLast();
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE_OPT_REAL:
|
||||
xAxis = fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->GetTitle();
|
||||
yAxis = TString("<Phase>");
|
||||
xMinBin = fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->GetFirst();
|
||||
xMaxBin = fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->GetLast();
|
||||
break;
|
||||
default:
|
||||
xAxis = TString("??");
|
||||
@@ -624,6 +636,12 @@ void PFourierCanvas::ExportData(const Char_t *pathFileName)
|
||||
xMinBin = fFourierHistos[0].dataFourierPhase->GetXaxis()->GetFirst();
|
||||
xMaxBin = fFourierHistos[0].dataFourierPhase->GetXaxis()->GetLast();
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE_OPT_REAL:
|
||||
xAxis = fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->GetTitle();
|
||||
yAxis = TString("Phase");
|
||||
xMinBin = fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->GetFirst();
|
||||
xMaxBin = fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->GetLast();
|
||||
break;
|
||||
default:
|
||||
xAxis = TString("??");
|
||||
yAxis = TString("??");
|
||||
@@ -659,6 +677,9 @@ void PFourierCanvas::ExportData(const Char_t *pathFileName)
|
||||
case FOURIER_PLOT_PHASE:
|
||||
fout << fFourierAverage[0].dataFourierPhase->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierPhase->GetBinContent(i) << endl;
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE_OPT_REAL:
|
||||
fout << fFourierAverage[0].dataFourierPhaseOptReal->GetBinCenter(i) << ", " << fFourierAverage[0].dataFourierPhaseOptReal->GetBinContent(i) << endl;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -693,6 +714,9 @@ void PFourierCanvas::ExportData(const Char_t *pathFileName)
|
||||
case FOURIER_PLOT_PHASE:
|
||||
fout << fFourierHistos[j].dataFourierPhase->GetBinCenter(i) << ", " << fFourierHistos[j].dataFourierPhase->GetBinContent(i) << ", ";
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE_OPT_REAL:
|
||||
fout << fFourierHistos[j].dataFourierPhaseOptReal->GetBinCenter(i) << ", " << fFourierHistos[j].dataFourierPhaseOptReal->GetBinContent(i) << ", ";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -710,6 +734,9 @@ void PFourierCanvas::ExportData(const Char_t *pathFileName)
|
||||
case FOURIER_PLOT_PHASE:
|
||||
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierPhase->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierPhase->GetBinContent(i) << endl;
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE_OPT_REAL:
|
||||
fout << fFourierHistos[fFourierHistos.size()-1].dataFourierPhaseOptReal->GetBinCenter(i) << ", " << fFourierHistos[fFourierHistos.size()-1].dataFourierPhaseOptReal->GetBinContent(i) << endl;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -777,6 +804,8 @@ void PFourierCanvas::InitFourierDataSets()
|
||||
fFourierHistos[i].dataFourierIm = fFourier[i]->GetImaginaryFourier();
|
||||
fFourierHistos[i].dataFourierPwr = fFourier[i]->GetPowerFourier();
|
||||
fFourierHistos[i].dataFourierPhase = fFourier[i]->GetPhaseFourier();
|
||||
fFourierHistos[i].dataFourierPhaseOptReal = fFourier[i]->GetPhaseOptRealFourier(fFourierHistos[i].optPhase, 1.0, fInitialXRange[0], fInitialXRange[1]);
|
||||
cout << "debug> histo[" << i << "]: opt. phase = " << fFourierHistos[i].optPhase * 180.0 / TMath::Pi() << "°" << endl;
|
||||
}
|
||||
|
||||
// rescale histo to abs(maximum) == 1
|
||||
@@ -796,6 +825,7 @@ void PFourierCanvas::InitFourierDataSets()
|
||||
fFourierHistos[i].dataFourierRe->SetBinContent(j, fFourierHistos[i].dataFourierRe->GetBinContent(j)/fabs(max));
|
||||
}
|
||||
}
|
||||
|
||||
// imaginary
|
||||
for (UInt_t i=0; i<fFourierHistos.size(); i++) {
|
||||
for (Int_t j=start; j<=end; j++) {
|
||||
@@ -809,6 +839,7 @@ void PFourierCanvas::InitFourierDataSets()
|
||||
fFourierHistos[i].dataFourierIm->SetBinContent(j, fFourierHistos[i].dataFourierIm->GetBinContent(j)/fabs(max));
|
||||
}
|
||||
}
|
||||
|
||||
// power
|
||||
max = 0.0;
|
||||
for (UInt_t i=0; i<fFourierHistos.size(); i++) {
|
||||
@@ -823,6 +854,7 @@ void PFourierCanvas::InitFourierDataSets()
|
||||
fFourierHistos[i].dataFourierPwr->SetBinContent(j, fFourierHistos[i].dataFourierPwr->GetBinContent(j)/fabs(max));
|
||||
}
|
||||
}
|
||||
|
||||
// phase
|
||||
max = 0.0;
|
||||
for (UInt_t i=0; i<fFourierHistos.size(); i++) {
|
||||
@@ -838,6 +870,20 @@ void PFourierCanvas::InitFourierDataSets()
|
||||
}
|
||||
}
|
||||
|
||||
// phase opt real
|
||||
for (UInt_t i=0; i<fFourierHistos.size(); i++) {
|
||||
for (Int_t j=start; j<=end; j++) {
|
||||
dval = fFourierHistos[i].dataFourierPhaseOptReal->GetBinContent(j);
|
||||
if (fabs(dval) > max)
|
||||
max = dval;
|
||||
}
|
||||
}
|
||||
for (UInt_t i=0; i<fFourierHistos.size(); i++) {
|
||||
for (Int_t j=1; j<fFourierHistos[i].dataFourierPhaseOptReal->GetNbinsX(); j++) {
|
||||
fFourierHistos[i].dataFourierPhaseOptReal->SetBinContent(j, fFourierHistos[i].dataFourierPhaseOptReal->GetBinContent(j)/fabs(max));
|
||||
}
|
||||
}
|
||||
|
||||
// set the marker and line color
|
||||
for (UInt_t i=0; i<fFourierHistos.size(); i++) {
|
||||
fFourierHistos[i].dataFourierRe->SetMarkerColor(fColorList[i]);
|
||||
@@ -848,6 +894,8 @@ void PFourierCanvas::InitFourierDataSets()
|
||||
fFourierHistos[i].dataFourierPwr->SetLineColor(fColorList[i]);
|
||||
fFourierHistos[i].dataFourierPhase->SetMarkerColor(fColorList[i]);
|
||||
fFourierHistos[i].dataFourierPhase->SetLineColor(fColorList[i]);
|
||||
fFourierHistos[i].dataFourierPhaseOptReal->SetMarkerColor(fColorList[i]);
|
||||
fFourierHistos[i].dataFourierPhaseOptReal->SetLineColor(fColorList[i]);
|
||||
}
|
||||
|
||||
// set the marker symbol and size
|
||||
@@ -860,6 +908,8 @@ void PFourierCanvas::InitFourierDataSets()
|
||||
fFourierHistos[i].dataFourierPwr->SetMarkerSize(0.7);
|
||||
fFourierHistos[i].dataFourierPhase->SetMarkerStyle(fMarkerList[i]);
|
||||
fFourierHistos[i].dataFourierPhase->SetMarkerSize(0.7);
|
||||
fFourierHistos[i].dataFourierPhaseOptReal->SetMarkerStyle(fMarkerList[i]);
|
||||
fFourierHistos[i].dataFourierPhaseOptReal->SetMarkerSize(0.7);
|
||||
}
|
||||
|
||||
// initialize average histos
|
||||
@@ -913,6 +963,7 @@ void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t w
|
||||
fPopupFourier->AddEntry("Show Real+Imag", P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_REAL_AND_IMAG);
|
||||
fPopupFourier->AddEntry("Show Power", P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PWR);
|
||||
fPopupFourier->AddEntry("Show Phase", P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PHASE);
|
||||
fPopupFourier->AddEntry("Show Phase Opt Fourier", P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PHASE_OPT_REAL);
|
||||
fPopupFourier->AddSeparator();
|
||||
fPopupFourier->AddEntry("Phase +", P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PHASE_PLUS);
|
||||
fPopupFourier->AddEntry("Phase -", P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PHASE_MINUS);
|
||||
@@ -935,6 +986,9 @@ void PFourierCanvas::InitFourierCanvas(const Char_t* title, Int_t wtopx, Int_t w
|
||||
case FOURIER_PLOT_PHASE:
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PHASE);
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE_OPT_REAL:
|
||||
fPopupFourier->CheckEntry(P_MENU_ID_FOURIER+P_MENU_ID_FOURIER_PHASE_OPT_REAL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1029,6 +1083,10 @@ void PFourierCanvas::CleanupAverage()
|
||||
delete fFourierAverage[i].dataFourierPhase;
|
||||
fFourierAverage[i].dataFourierPhase = 0;
|
||||
}
|
||||
if (fFourierAverage[i].dataFourierPhaseOptReal) {
|
||||
delete fFourierAverage[i].dataFourierPhaseOptReal;
|
||||
fFourierAverage[i].dataFourierPhaseOptReal = 0;
|
||||
}
|
||||
}
|
||||
fFourierAverage.clear();
|
||||
}
|
||||
@@ -1074,6 +1132,11 @@ void PFourierCanvas::HandleAverage()
|
||||
fFourierHistos[0].dataFourierPhase->GetXaxis()->GetXmin(),
|
||||
fFourierHistos[0].dataFourierPhase->GetXaxis()->GetXmax());
|
||||
|
||||
name = TString(fFourierHistos[0].dataFourierPhaseOptReal->GetTitle()) + "_avg";
|
||||
fFourierAverage[0].dataFourierPhaseOptReal = new TH1F(name, name, fFourierHistos[0].dataFourierPhaseOptReal->GetNbinsX(),
|
||||
fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->GetXmin(),
|
||||
fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->GetXmax());
|
||||
|
||||
// real average
|
||||
for (Int_t j=0; j<fFourierHistos[0].dataFourierRe->GetNbinsX(); j++) {
|
||||
dval = 0.0;
|
||||
@@ -1133,6 +1196,21 @@ void PFourierCanvas::HandleAverage()
|
||||
fFourierAverage[0].dataFourierPhase->SetLineColor(kBlack);
|
||||
fFourierAverage[0].dataFourierPhase->SetMarkerSize(0.8);
|
||||
fFourierAverage[0].dataFourierPhase->SetMarkerStyle(22);
|
||||
|
||||
// phase optimised real average
|
||||
for (Int_t j=0; j<fFourierHistos[0].dataFourierPhaseOptReal->GetNbinsX(); j++) {
|
||||
dval = 0.0;
|
||||
for (UInt_t i=0; i<fFourierHistos.size(); i++) {
|
||||
if (j < fFourierHistos[i].dataFourierPhaseOptReal->GetNbinsX())
|
||||
dval += GetInterpolatedValue(fFourierHistos[i].dataFourierPhaseOptReal, fFourierHistos[0].dataFourierPhaseOptReal->GetBinCenter(j));
|
||||
}
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->SetBinContent(j, dval/fFourierHistos.size());
|
||||
}
|
||||
// set marker color, line color, maker size, marker type
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->SetMarkerColor(kBlack);
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->SetLineColor(kBlack);
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->SetMarkerSize(0.8);
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->SetMarkerStyle(22);
|
||||
}
|
||||
|
||||
// check if per data set shall be averaged
|
||||
@@ -1196,6 +1274,11 @@ void PFourierCanvas::HandleAverage()
|
||||
fFourierHistos[0].dataFourierPhase->GetXaxis()->GetXmin(),
|
||||
fFourierHistos[0].dataFourierPhase->GetXaxis()->GetXmax());
|
||||
|
||||
name = TString(fFourierHistos[start].dataFourierPhaseOptReal->GetTitle()) + "_avg";
|
||||
fFourierAverage[i].dataFourierPhaseOptReal = new TH1F(name, name, fFourierHistos[0].dataFourierPhaseOptReal->GetNbinsX(),
|
||||
fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->GetXmin(),
|
||||
fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->GetXmax());
|
||||
|
||||
// real average
|
||||
for (Int_t j=0; j<fFourierHistos[0].dataFourierRe->GetNbinsX(); j++) {
|
||||
dval = 0.0;
|
||||
@@ -1255,6 +1338,21 @@ void PFourierCanvas::HandleAverage()
|
||||
fFourierAverage[i].dataFourierPhase->SetLineColor(fColorList[i]);
|
||||
fFourierAverage[i].dataFourierPhase->SetMarkerSize(0.8);
|
||||
fFourierAverage[i].dataFourierPhase->SetMarkerStyle(22); // closed up triangle
|
||||
|
||||
// phase optimised real average
|
||||
for (Int_t j=0; j<fFourierHistos[0].dataFourierPhaseOptReal->GetNbinsX(); j++) {
|
||||
dval = 0.0;
|
||||
for (Int_t k=start; k<=end; k++) {
|
||||
if (j < fFourierHistos[k].dataFourierPhaseOptReal->GetNbinsX())
|
||||
dval += GetInterpolatedValue(fFourierHistos[k].dataFourierPhaseOptReal, fFourierHistos[0].dataFourierPhaseOptReal->GetBinCenter(j));
|
||||
}
|
||||
fFourierAverage[i].dataFourierPhaseOptReal->SetBinContent(j, dval/(end-start+1));
|
||||
}
|
||||
// set marker color, line color, maker size, marker type
|
||||
fFourierAverage[i].dataFourierPhaseOptReal->SetMarkerColor(fColorList[i]);
|
||||
fFourierAverage[i].dataFourierPhaseOptReal->SetLineColor(fColorList[i]);
|
||||
fFourierAverage[i].dataFourierPhaseOptReal->SetMarkerSize(0.8);
|
||||
fFourierAverage[i].dataFourierPhaseOptReal->SetMarkerStyle(22); // closed up triangle
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1381,6 +1479,26 @@ void PFourierCanvas::PlotFourier()
|
||||
fFourierHistos[i].dataFourierPhase->Draw("psame");
|
||||
}
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE_OPT_REAL:
|
||||
fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->SetRangeUser(xmin, xmax);
|
||||
ymin = GetMinimum(fFourierHistos[0].dataFourierPhaseOptReal, xmin, xmax);
|
||||
ymax = GetMaximum(fFourierHistos[0].dataFourierPhaseOptReal, xmin, xmax);
|
||||
for (UInt_t i=1; i<fFourierHistos.size(); i++) {
|
||||
if (GetMaximum(fFourierHistos[i].dataFourierPhaseOptReal, xmin, xmax) > ymax)
|
||||
ymax = GetMaximum(fFourierHistos[i].dataFourierPhaseOptReal, xmin, xmax);
|
||||
if (GetMinimum(fFourierHistos[i].dataFourierPhaseOptReal, xmin, xmax) < ymin)
|
||||
ymin = GetMinimum(fFourierHistos[i].dataFourierPhaseOptReal, xmin, xmax);
|
||||
}
|
||||
fFourierHistos[0].dataFourierPhaseOptReal->GetYaxis()->SetRangeUser(ymin, 1.05*ymax);
|
||||
fFourierHistos[0].dataFourierPhaseOptReal->GetYaxis()->SetTitleOffset(1.3);
|
||||
fFourierHistos[0].dataFourierPhaseOptReal->GetYaxis()->SetDecimals(kTRUE);
|
||||
fFourierHistos[0].dataFourierPhaseOptReal->GetYaxis()->SetTitle("Phase Opt. Real");
|
||||
fFourierHistos[0].dataFourierPhaseOptReal->GetXaxis()->SetTitle(fXaxisTitle.Data());
|
||||
fFourierHistos[0].dataFourierPhaseOptReal->Draw("p");
|
||||
for (UInt_t i=1; i<fFourierHistos.size(); i++) {
|
||||
fFourierHistos[i].dataFourierPhaseOptReal->Draw("psame");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1541,6 +1659,24 @@ void PFourierCanvas::PlotAverage()
|
||||
fFourierAverage[0].dataFourierPhase->GetXaxis()->SetRangeUser(xmin, xmax);
|
||||
fFourierAverage[0].dataFourierPhase->Draw("p");
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE_OPT_REAL:
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->GetXaxis()->SetRangeUser(xmin, xmax);
|
||||
ymin = GetMinimum(fFourierAverage[0].dataFourierPhaseOptReal, xmin, xmax);
|
||||
ymax = GetMaximum(fFourierAverage[0].dataFourierPhaseOptReal, xmin, xmax);
|
||||
for (UInt_t i=1; i<fFourierAverage.size(); i++) {
|
||||
if (GetMaximum(fFourierAverage[i].dataFourierPhaseOptReal, xmin, xmax) > ymax)
|
||||
ymax = GetMaximum(fFourierAverage[i].dataFourierPhaseOptReal, xmin, xmax);
|
||||
if (GetMinimum(fFourierAverage[i].dataFourierPhaseOptReal, xmin, xmax) < ymin)
|
||||
ymin = GetMinimum(fFourierAverage[i].dataFourierPhaseOptReal, xmin, xmax);
|
||||
}
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->GetYaxis()->SetRangeUser(ymin, 1.03*ymax);
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->GetYaxis()->SetTitleOffset(1.3);
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->GetYaxis()->SetDecimals(kTRUE);
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->GetYaxis()->SetTitle("<Phase Opt. Real>");
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->GetXaxis()->SetTitle(fXaxisTitle.Data());
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->GetXaxis()->SetRangeUser(xmin, xmax);
|
||||
fFourierAverage[0].dataFourierPhaseOptReal->Draw("p");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1568,6 +1704,9 @@ void PFourierCanvas::PlotAverage()
|
||||
case FOURIER_PLOT_PHASE:
|
||||
fFourierAverage[i].dataFourierPhase->Draw("psame");
|
||||
break;
|
||||
case FOURIER_PLOT_PHASE_OPT_REAL:
|
||||
fFourierAverage[i].dataFourierPhaseOptReal->Draw("psame");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2014 by Bastian M. Wojek / Andreas Suter *
|
||||
* Copyright (C) 2009-2016 by Bastian M. Wojek / Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -170,7 +170,7 @@ int PMsr2Data::DetermineRunNumberDigits(unsigned int runNo, bool normalMode) con
|
||||
string::size_type loc = firstOnLine.rfind(tempRunNumber.str());
|
||||
if ( loc != string::npos ) {
|
||||
while ( loc > 0 ) {
|
||||
if(isdigit(firstOnLine.at(--loc))) {
|
||||
if (isdigit(firstOnLine.at(--loc))) {
|
||||
++fRunNumberDigits;
|
||||
} else {
|
||||
break;
|
||||
@@ -731,7 +731,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu
|
||||
msrParamList->at(i).fIsGlobal = true;
|
||||
++fNumGlobalParam;
|
||||
}
|
||||
//cout << msrParamList->at(i).fNo << " is global: " << msrParamList->at(i).fIsGlobal << endl;
|
||||
// cout << "debug> " << msrParamList->at(i).fNo << ": " << msrParamList->at(i).fName.Data() << " is global: " << msrParamList->at(i).fIsGlobal << endl;
|
||||
}
|
||||
|
||||
// check if parameters have been sorted correctly from the beginning
|
||||
@@ -760,7 +760,7 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu
|
||||
bool mapExists(false);
|
||||
for (unsigned int i(0); i < tempLines->size(); ++i) {
|
||||
line = (*tempLines)[i].fLine.Data();
|
||||
split( tempVec, line, is_any_of(" \t") ); // split the theory line at spaces
|
||||
split( tempVec, line, is_any_of(" \t"), token_compress_on ); // split the theory line at spaces
|
||||
for (unsigned int j(1); j < tempVec.size(); ++j) {
|
||||
try {
|
||||
tempPar = boost::lexical_cast<unsigned int>(tempVec[j]);
|
||||
@@ -1060,12 +1060,11 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu
|
||||
tempLines = fMsrHandler->GetMsrTheory();
|
||||
for (unsigned int i(0); i < tempLines->size(); ++i) {
|
||||
line = (*tempLines)[i].fLine.Data();
|
||||
split( tempVec, line, is_any_of(" \t") ); // split the theory line at spaces
|
||||
split( tempVec, line, is_any_of(" \t"), token_compress_on ); // split the theory line at spaces
|
||||
|
||||
for (unsigned int j(1); j < tempVec.size(); ++j) {
|
||||
try {
|
||||
tempPar = boost::lexical_cast<unsigned int>(tempVec[j]);
|
||||
|
||||
if (!msrParamList->at(tempPar - 1).fIsGlobal) {
|
||||
cerr << endl << ">> msr2data: **WARNING** The parameter " << msrParamList->at(tempPar - 1).fName.Data() \
|
||||
<< " is recognized as run specific!";
|
||||
@@ -1112,7 +1111,6 @@ bool PMsr2Data::PrepareGlobalInputFile(unsigned int tempRun, const string &msrOu
|
||||
lineChanged = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch(boost::bad_lexical_cast &) {
|
||||
// in case the cast does not work: do nothing - this means the entry is not a simple parameter
|
||||
@@ -2444,7 +2442,7 @@ void PMsr2Data::WriteValue(fstream &outFile, const double &value, const unsigned
|
||||
if ((fabs(value) >= 1.0e6) || ((fabs(value) < 1.0e-4) && (fabs(value) > 0.0)))
|
||||
outFile << scientific << setprecision(width - 8);
|
||||
else
|
||||
outFile.setf(ios::floatfield);
|
||||
outFile.unsetf(ios::floatfield);
|
||||
outFile << setw(width) << left << value;
|
||||
}
|
||||
|
||||
@@ -2469,7 +2467,7 @@ void PMsr2Data::WriteValue(fstream &outFile, const double &value, const double &
|
||||
if ((fabs(value) >= 1.0e6) || ((fabs(value) < 1.0e-4) && (fabs(value) > 0)))
|
||||
outFile << scientific;
|
||||
else
|
||||
outFile.setf(ios::floatfield);
|
||||
outFile.unsetf(ios::floatfield);
|
||||
|
||||
outFile.precision(prec);
|
||||
outFile << setw(width) << left << value;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -242,7 +242,7 @@ Int_t PMsrHandler::ReadMsrFile()
|
||||
if (result == PMUSR_SUCCESS)
|
||||
if (!HandleFunctionsEntry(functions))
|
||||
result = PMUSR_MSR_SYNTAX_ERROR;
|
||||
if (result == PMUSR_SUCCESS)
|
||||
if ((result == PMUSR_SUCCESS) && (global.size()>0))
|
||||
if (!HandleGlobalEntry(global))
|
||||
result = PMUSR_MSR_SYNTAX_ERROR;
|
||||
if (result == PMUSR_SUCCESS)
|
||||
@@ -311,6 +311,11 @@ Int_t PMsrHandler::ReadMsrFile()
|
||||
if (!CheckAddRunParameters())
|
||||
result = PMUSR_MSR_SYNTAX_ERROR;
|
||||
|
||||
// check that if RRF settings are present, the RUN block settings do correspond
|
||||
if (result == PMUSR_SUCCESS)
|
||||
if (!CheckRRFSettings())
|
||||
result = PMUSR_MSR_SYNTAX_ERROR;
|
||||
|
||||
if (result == PMUSR_SUCCESS) {
|
||||
CheckMaxLikelihood(); // check if the user wants to use max likelihood with asymmetry/non-muSR fit (which is not implemented)
|
||||
CheckLegacyLifetimecorrection(); // check if lifetimecorrection is found in RUN blocks, if yes transfer it to PLOT blocks
|
||||
@@ -348,7 +353,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
{
|
||||
const UInt_t prec = 6; // default output precision for float/doubles
|
||||
UInt_t neededPrec = 0;
|
||||
UInt_t neededWidth = 9;
|
||||
UInt_t neededWidth = 9;
|
||||
|
||||
Int_t tag, lineNo = 0, number;
|
||||
Int_t runNo = -1, addRunNo = 0;
|
||||
@@ -612,9 +617,15 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
case MSR_FITTYPE_SINGLE_HISTO:
|
||||
fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl;
|
||||
break;
|
||||
case MSR_FITTYPE_SINGLE_HISTO_RRF:
|
||||
fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << endl;
|
||||
break;
|
||||
case MSR_FITTYPE_ASYM:
|
||||
fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_ASYM_RRF:
|
||||
fout << left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_MU_MINUS:
|
||||
fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ;
|
||||
break;
|
||||
@@ -624,6 +635,27 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (sstr.BeginsWith("rrf_freq", TString::kIgnoreCase) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) {
|
||||
fout.width(16);
|
||||
fout << left << "rrf_freq ";
|
||||
fout.width(8);
|
||||
neededPrec = LastSignificant(fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()),10);
|
||||
fout.precision(neededPrec);
|
||||
fout << left << fixed << fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data());
|
||||
fout << " " << fGlobal.GetRRFUnit();
|
||||
fout << endl;
|
||||
} else if (sstr.BeginsWith("rrf_phase", TString::kIgnoreCase) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) {
|
||||
fout.width(16);
|
||||
fout << "rrf_phase ";
|
||||
fout.width(8);
|
||||
fout << left << fGlobal.GetRRFPhase();
|
||||
fout << endl;
|
||||
} else if (sstr.BeginsWith("rrf_packing", TString::kIgnoreCase) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) {
|
||||
fout.width(16);
|
||||
fout << "rrf_packing ";
|
||||
fout.width(8);
|
||||
fout << left << fGlobal.GetRRFPacking();
|
||||
fout << endl;
|
||||
} else if (sstr.BeginsWith("data")) {
|
||||
fout.width(16);
|
||||
fout << left << "data";
|
||||
@@ -749,9 +781,15 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
case MSR_FITTYPE_SINGLE_HISTO:
|
||||
fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl;
|
||||
break;
|
||||
case MSR_FITTYPE_SINGLE_HISTO_RRF:
|
||||
fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << endl;
|
||||
break;
|
||||
case MSR_FITTYPE_ASYM:
|
||||
fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_ASYM_RRF:
|
||||
fout << left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_MU_MINUS:
|
||||
fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ;
|
||||
break;
|
||||
@@ -1089,6 +1127,11 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
} else if (sstr.BeginsWith("range_for_phase_correction")) {
|
||||
fout << "range_for_phase_correction " << fFourier.fRangeForPhaseCorrection[0] << " " << fFourier.fRangeForPhaseCorrection[1] << endl;
|
||||
} else if (sstr.BeginsWith("range ")) {
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
neededPrec = LastSignificant(fFourier.fPlotRange[0]);
|
||||
if (LastSignificant(fFourier.fPlotRange[1]) > neededPrec)
|
||||
neededPrec = LastSignificant(fFourier.fPlotRange[1]);
|
||||
fout.precision(neededPrec);
|
||||
fout << "range " << fFourier.fPlotRange[0] << " " << fFourier.fPlotRange[1] << endl;
|
||||
} else {
|
||||
fout << str.Data() << endl;
|
||||
@@ -1102,9 +1145,15 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
case MSR_PLOT_SINGLE_HISTO:
|
||||
fout << "PLOT " << fPlots[plotNo].fPlotType << " (single histo plot)" << endl;
|
||||
break;
|
||||
case MSR_PLOT_SINGLE_HISTO_RRF:
|
||||
fout << "PLOT " << fPlots[plotNo].fPlotType << " (single histo RRF plot)" << endl;
|
||||
break;
|
||||
case MSR_PLOT_ASYM:
|
||||
fout << "PLOT " << fPlots[plotNo].fPlotType << " (asymmetry plot)" << endl;
|
||||
break;
|
||||
case MSR_PLOT_ASYM_RRF:
|
||||
fout << "PLOT " << fPlots[plotNo].fPlotType << " (asymmetry RRF plot)" << endl;
|
||||
break;
|
||||
case MSR_PLOT_MU_MINUS:
|
||||
fout << "PLOT " << fPlots[plotNo].fPlotType << " (mu minus plot)" << endl;
|
||||
break;
|
||||
@@ -1590,7 +1639,136 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
|
||||
|
||||
// write GLOBAL block
|
||||
if (fGlobal.IsPresent()) {
|
||||
// not sure that anything needs to be done here ...
|
||||
fout << "GLOBAL" << endl;
|
||||
|
||||
// fittype
|
||||
if (fGlobal.GetFitType() != -1) {
|
||||
fout.width(16);
|
||||
switch (fGlobal.GetFitType()) {
|
||||
case MSR_FITTYPE_SINGLE_HISTO:
|
||||
fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl;
|
||||
break;
|
||||
case MSR_FITTYPE_SINGLE_HISTO_RRF:
|
||||
fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << endl;
|
||||
break;
|
||||
case MSR_FITTYPE_ASYM:
|
||||
fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_ASYM_RRF:
|
||||
fout << left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_MU_MINUS:
|
||||
fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_NON_MUSR:
|
||||
fout << left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << endl ;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// RRF related stuff
|
||||
if ((fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) > 0.0) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) {
|
||||
fout.width(16);
|
||||
fout << left << "rrf_freq ";
|
||||
fout.width(8);
|
||||
fout << left << fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data());
|
||||
fout << " " << fGlobal.GetRRFUnit();
|
||||
fout << endl;
|
||||
}
|
||||
if ((fGlobal.GetRRFPhase() != 0.0) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) {
|
||||
fout.width(16);
|
||||
fout << "rrf_phase ";
|
||||
fout.width(8);
|
||||
fout << left << fGlobal.GetRRFPhase();
|
||||
fout << endl;
|
||||
}
|
||||
if ((fGlobal.GetRRFPacking() != -1) && (fGlobal.GetFitType() == MSR_FITTYPE_SINGLE_HISTO_RRF)) {
|
||||
fout.width(16);
|
||||
fout << "rrf_packing ";
|
||||
fout.width(8);
|
||||
fout << left << fGlobal.GetRRFPacking();
|
||||
fout << endl;
|
||||
}
|
||||
|
||||
// data range
|
||||
if ((fGlobal.GetDataRange(0) != -1) || (fGlobal.GetDataRange(1) != -1) || (fGlobal.GetDataRange(2) != -1) || (fGlobal.GetDataRange(3) != -1)) {
|
||||
fout.width(16);
|
||||
fout << left << "data";
|
||||
for (UInt_t j=0; j<4; ++j) {
|
||||
if (fGlobal.GetDataRange(j) > 0) {
|
||||
fout.width(8);
|
||||
fout << left << fGlobal.GetDataRange(j);
|
||||
}
|
||||
}
|
||||
fout << endl;
|
||||
}
|
||||
|
||||
// t0
|
||||
if (fGlobal.GetT0BinSize() > 0) {
|
||||
fout.width(16);
|
||||
fout << left << "t0";
|
||||
for (UInt_t j=0; j<fGlobal.GetT0BinSize(); ++j) {
|
||||
fout.width(8);
|
||||
fout.precision(1);
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
fout << left << fGlobal.GetT0Bin(j);
|
||||
}
|
||||
fout << endl;
|
||||
}
|
||||
|
||||
// addt0
|
||||
for (UInt_t j = 0; j < fGlobal.GetAddT0BinEntries(); ++j) {
|
||||
if (fGlobal.GetAddT0BinSize(j) > 0) {
|
||||
fout.width(16);
|
||||
fout << left << "addt0";
|
||||
for (Int_t k=0; k<fGlobal.GetAddT0BinSize(j); ++k) {
|
||||
fout.width(8);
|
||||
fout.precision(1);
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
fout << left << fGlobal.GetAddT0Bin(j, k);
|
||||
}
|
||||
fout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// fit range
|
||||
if ( (fGlobal.IsFitRangeInBin() && fGlobal.GetFitRangeOffset(0) != -1) ||
|
||||
(fGlobal.GetFitRange(0) != PMUSR_UNDEFINED) ) {
|
||||
fout.width(16);
|
||||
fout << left << "fit";
|
||||
if (fGlobal.IsFitRangeInBin()) { // fit range given in bins
|
||||
fout << "fgb";
|
||||
if (fGlobal.GetFitRangeOffset(0) > 0)
|
||||
fout << "+" << fGlobal.GetFitRangeOffset(0);
|
||||
fout << " lgb";
|
||||
if (fGlobal.GetFitRangeOffset(1) > 0)
|
||||
fout << "-" << fGlobal.GetFitRangeOffset(1);
|
||||
} else { // fit range given in time
|
||||
for (UInt_t j=0; j<2; j++) {
|
||||
if (fGlobal.GetFitRange(j) == -1)
|
||||
break;
|
||||
UInt_t neededWidth = 7;
|
||||
UInt_t neededPrec = LastSignificant(fRuns[i].GetFitRange(j));
|
||||
fout.width(neededWidth);
|
||||
fout.precision(neededPrec);
|
||||
fout << left << fixed << fGlobal.GetFitRange(j);
|
||||
if (j==0)
|
||||
fout << " ";
|
||||
}
|
||||
}
|
||||
fout << endl;
|
||||
}
|
||||
|
||||
// packing
|
||||
if (fGlobal.GetPacking() != -1) {
|
||||
fout.width(16);
|
||||
fout << left << "packing";
|
||||
fout << fGlobal.GetPacking() << endl;
|
||||
}
|
||||
|
||||
fout << endl << hline.Data() << endl;
|
||||
}
|
||||
|
||||
// write RUN blocks
|
||||
@@ -1655,22 +1833,30 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
|
||||
}
|
||||
|
||||
// fittype
|
||||
fout.width(16);
|
||||
switch (fRuns[i].GetFitType()) {
|
||||
case MSR_FITTYPE_SINGLE_HISTO:
|
||||
fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl;
|
||||
break;
|
||||
case MSR_FITTYPE_ASYM:
|
||||
fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_MU_MINUS:
|
||||
fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_NON_MUSR:
|
||||
fout << left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << endl ;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (fRuns[i].GetFitType() != -1) {
|
||||
fout.width(16);
|
||||
switch (fRuns[i].GetFitType()) {
|
||||
case MSR_FITTYPE_SINGLE_HISTO:
|
||||
fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO << " (single histogram fit)" << endl;
|
||||
break;
|
||||
case MSR_FITTYPE_SINGLE_HISTO_RRF:
|
||||
fout << left << "fittype" << MSR_FITTYPE_SINGLE_HISTO_RRF << " (single histogram RRF fit)" << endl;
|
||||
break;
|
||||
case MSR_FITTYPE_ASYM:
|
||||
fout << left << "fittype" << MSR_FITTYPE_ASYM << " (asymmetry fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_ASYM_RRF:
|
||||
fout << left << "fittype" << MSR_FITTYPE_ASYM_RRF << " (asymmetry RRF fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_MU_MINUS:
|
||||
fout << left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_NON_MUSR:
|
||||
fout << left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << endl ;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// alpha
|
||||
@@ -1810,17 +1996,19 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
|
||||
}
|
||||
|
||||
// addt0
|
||||
for (UInt_t j = 0; j < fRuns[i].GetRunNameSize() - 1; ++j) {
|
||||
if (fRuns[i].GetAddT0BinSize(j) > 0) {
|
||||
fout.width(16);
|
||||
fout << left << "addt0";
|
||||
for (Int_t k=0; k<fRuns[i].GetAddT0BinSize(j); ++k) {
|
||||
fout.width(8);
|
||||
fout.precision(1);
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
fout << left << fRuns[i].GetAddT0Bin(j, k);
|
||||
if (fRuns[i].GetAddT0BinEntries() > 0) {
|
||||
for (UInt_t j = 0; j < fRuns[i].GetRunNameSize() - 1; ++j) {
|
||||
if (fRuns[i].GetAddT0BinSize(j) > 0) {
|
||||
fout.width(16);
|
||||
fout << left << "addt0";
|
||||
for (Int_t k=0; k<fRuns[i].GetAddT0BinSize(j); ++k) {
|
||||
fout.width(8);
|
||||
fout.precision(1);
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
fout << left << fRuns[i].GetAddT0Bin(j, k);
|
||||
}
|
||||
fout << endl;
|
||||
}
|
||||
fout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1847,34 +2035,40 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
|
||||
}
|
||||
|
||||
// fit
|
||||
fout.width(16);
|
||||
fout << left << "fit";
|
||||
if (fRuns[i].IsFitRangeInBin()) { // fit range given in bins
|
||||
fout << "fgb";
|
||||
if (fRuns[i].GetFitRangeOffset(0) > 0)
|
||||
fout << "+" << fRuns[i].GetFitRangeOffset(0);
|
||||
fout << " lgb";
|
||||
if (fRuns[i].GetFitRangeOffset(1) > 0)
|
||||
fout << "-" << fRuns[i].GetFitRangeOffset(1);
|
||||
} else { // fit range given in time
|
||||
for (UInt_t j=0; j<2; j++) {
|
||||
if (fRuns[i].GetFitRange(j) == -1)
|
||||
break;
|
||||
UInt_t neededWidth = 7;
|
||||
UInt_t neededPrec = LastSignificant(fRuns[i].GetFitRange(j));
|
||||
fout.width(neededWidth);
|
||||
fout.precision(neededPrec);
|
||||
fout << left << fixed << fRuns[i].GetFitRange(j);
|
||||
if (j==0)
|
||||
fout << " ";
|
||||
if ( (fRuns[i].IsFitRangeInBin() && fRuns[i].GetFitRangeOffset(0) != -1) ||
|
||||
(fRuns[i].GetFitRange(0) != PMUSR_UNDEFINED) ) {
|
||||
fout.width(16);
|
||||
fout << left << "fit";
|
||||
if (fRuns[i].IsFitRangeInBin()) { // fit range given in bins
|
||||
fout << "fgb";
|
||||
if (fRuns[i].GetFitRangeOffset(0) > 0)
|
||||
fout << "+" << fRuns[i].GetFitRangeOffset(0);
|
||||
fout << " lgb";
|
||||
if (fRuns[i].GetFitRangeOffset(1) > 0)
|
||||
fout << "-" << fRuns[i].GetFitRangeOffset(1);
|
||||
} else { // fit range given in time
|
||||
for (UInt_t j=0; j<2; j++) {
|
||||
if (fRuns[i].GetFitRange(j) == -1)
|
||||
break;
|
||||
UInt_t neededWidth = 7;
|
||||
UInt_t neededPrec = LastSignificant(fRuns[i].GetFitRange(j));
|
||||
fout.width(neededWidth);
|
||||
fout.precision(neededPrec);
|
||||
fout << left << fixed << fRuns[i].GetFitRange(j);
|
||||
if (j==0)
|
||||
fout << " ";
|
||||
}
|
||||
}
|
||||
fout << endl;
|
||||
}
|
||||
fout << endl;
|
||||
|
||||
// packing
|
||||
fout.width(16);
|
||||
fout << left << "packing";
|
||||
fout << fRuns[i].GetPacking() << endl;
|
||||
if (fRuns[i].GetPacking() != -1) {
|
||||
fout.width(16);
|
||||
fout << left << "packing";
|
||||
fout << fRuns[i].GetPacking() << endl;
|
||||
}
|
||||
|
||||
fout << endl;
|
||||
}
|
||||
|
||||
@@ -1971,6 +2165,11 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
|
||||
|
||||
// range
|
||||
if ((fFourier.fPlotRange[0] != -1.0) || (fFourier.fPlotRange[1] != -1.0)) {
|
||||
fout.setf(ios::fixed,ios::floatfield);
|
||||
UInt_t neededPrec = LastSignificant(fFourier.fPlotRange[0]);
|
||||
if (LastSignificant(fFourier.fPlotRange[1]) > neededPrec)
|
||||
neededPrec = LastSignificant(fFourier.fPlotRange[1]);
|
||||
fout.precision(neededPrec);
|
||||
fout << "range " << fFourier.fPlotRange[0] << " " << fFourier.fPlotRange[1] << endl;
|
||||
}
|
||||
|
||||
@@ -1989,9 +2188,15 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, map<UInt_t, TString> *co
|
||||
case MSR_PLOT_SINGLE_HISTO:
|
||||
fout << "PLOT " << fPlots[i].fPlotType << " (single histo plot)" << endl;
|
||||
break;
|
||||
case MSR_PLOT_SINGLE_HISTO_RRF:
|
||||
fout << "PLOT " << fPlots[i].fPlotType << " (single histo RRF plot)" << endl;
|
||||
break;
|
||||
case MSR_PLOT_ASYM:
|
||||
fout << "PLOT " << fPlots[i].fPlotType << " (asymmetry plot)" << endl;
|
||||
break;
|
||||
case MSR_PLOT_ASYM_RRF:
|
||||
fout << "PLOT " << fPlots[i].fPlotType << " (asymmetry RRF plot)" << endl;
|
||||
break;
|
||||
case MSR_PLOT_MU_MINUS:
|
||||
fout << "PLOT " << fPlots[i].fPlotType << " (mu minus plot)" << endl;
|
||||
break;
|
||||
@@ -2677,8 +2882,8 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines)
|
||||
TString str;
|
||||
TObjArray *tokens = 0;
|
||||
TObjString *ostr = 0;
|
||||
Int_t ival;
|
||||
Double_t dval;
|
||||
Int_t ival = 0;
|
||||
Double_t dval = 0.0;
|
||||
UInt_t addT0Counter = 0;
|
||||
|
||||
// since this routine is called, a GLOBAL block is present
|
||||
@@ -2709,7 +2914,9 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines)
|
||||
if (str.IsDigit()) {
|
||||
Int_t fittype = str.Atoi();
|
||||
if ((fittype == MSR_FITTYPE_SINGLE_HISTO) ||
|
||||
(fittype == MSR_FITTYPE_SINGLE_HISTO_RRF) ||
|
||||
(fittype == MSR_FITTYPE_ASYM) ||
|
||||
(fittype == MSR_FITTYPE_ASYM_RRF) ||
|
||||
(fittype == MSR_FITTYPE_MU_MINUS) ||
|
||||
(fittype == MSR_FITTYPE_NON_MUSR)) {
|
||||
global.SetFitType(fittype);
|
||||
@@ -2720,6 +2927,55 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines)
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
} else if (iter->fLine.BeginsWith("rrf_freq", TString::kIgnoreCase)) {
|
||||
if (tokens->GetEntries() < 3) {
|
||||
error = true;
|
||||
} else {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(1));
|
||||
str = ostr->GetString();
|
||||
if (str.IsFloat()) {
|
||||
dval = str.Atof();
|
||||
if (dval <= 0.0)
|
||||
error = true;
|
||||
}
|
||||
if (!error) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(2));
|
||||
str = ostr->GetString();
|
||||
global.SetRRFFreq(dval, str.Data());
|
||||
if (global.GetRRFFreq(str.Data()) == RRF_FREQ_UNDEF)
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
} else if (iter->fLine.BeginsWith("rrf_packing", TString::kIgnoreCase)) {
|
||||
if (tokens->GetEntries() < 2) {
|
||||
error = true;
|
||||
} else {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(1));
|
||||
str = ostr->GetString();
|
||||
if (str.IsDigit()) {
|
||||
ival = str.Atoi();
|
||||
if (ival > 0) {
|
||||
global.SetRRFPacking(ival);
|
||||
} else {
|
||||
error = true;
|
||||
}
|
||||
} else {
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
} else if (iter->fLine.BeginsWith("rrf_phase", TString::kIgnoreCase)) {
|
||||
if (tokens->GetEntries() < 2) {
|
||||
error = true;
|
||||
} else {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(1));
|
||||
str = ostr->GetString();
|
||||
if (str.IsFloat()) {
|
||||
dval = str.Atof();
|
||||
global.SetRRFPhase(dval);
|
||||
} else {
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
} else if (iter->fLine.BeginsWith("data", TString::kIgnoreCase)) { // data
|
||||
if (tokens->GetEntries() < 3) {
|
||||
error = true;
|
||||
@@ -2994,7 +3250,9 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
if (str.IsDigit()) {
|
||||
Int_t fittype = str.Atoi();
|
||||
if ((fittype == MSR_FITTYPE_SINGLE_HISTO) ||
|
||||
(fittype == MSR_FITTYPE_SINGLE_HISTO_RRF) ||
|
||||
(fittype == MSR_FITTYPE_ASYM) ||
|
||||
(fittype == MSR_FITTYPE_ASYM_RRF) ||
|
||||
(fittype == MSR_FITTYPE_MU_MINUS) ||
|
||||
(fittype == MSR_FITTYPE_NON_MUSR)) {
|
||||
param.SetFitType(fittype);
|
||||
@@ -3165,15 +3423,19 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
if (tokens->GetEntries() < 2) {
|
||||
error = true;
|
||||
} else {
|
||||
PIntVector group;
|
||||
PUIntVector group;
|
||||
str = iter->fLine;
|
||||
if (ParseDetectorGrouping(str, group)) {
|
||||
PStringNumberList *rl = new PStringNumberList(str.Data());
|
||||
string errorMsg("");
|
||||
if (rl->Parse(errorMsg, true)) {
|
||||
group = rl->GetList();
|
||||
for (UInt_t i=0; i<group.size(); i++) {
|
||||
param.SetForwardHistoNo(group[i]);
|
||||
}
|
||||
} else {
|
||||
error = true;
|
||||
}
|
||||
delete rl;
|
||||
group.clear();
|
||||
}
|
||||
}
|
||||
@@ -3186,15 +3448,19 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
if (tokens->GetEntries() < 2) {
|
||||
error = true;
|
||||
} else {
|
||||
PIntVector group;
|
||||
PUIntVector group;
|
||||
str = iter->fLine;
|
||||
if (ParseDetectorGrouping(str, group)) {
|
||||
PStringNumberList *rl = new PStringNumberList(str.Data());
|
||||
string errorMsg("");
|
||||
if (rl->Parse(errorMsg, true)) {
|
||||
group = rl->GetList();
|
||||
for (UInt_t i=0; i<group.size(); i++) {
|
||||
param.SetBackwardHistoNo(group[i]);
|
||||
}
|
||||
} else {
|
||||
error = true;
|
||||
}
|
||||
delete rl;
|
||||
group.clear();
|
||||
}
|
||||
}
|
||||
@@ -3892,39 +4158,34 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
|
||||
param.fLifeTimeCorrection = true;
|
||||
} else if (iter1->fLine.Contains("runs", TString::kIgnoreCase)) { // handle plot runs
|
||||
TComplex run;
|
||||
PStringNumberList *rl;
|
||||
string errorMsg;
|
||||
PUIntVector runList;
|
||||
switch (param.fPlotType) {
|
||||
case -1:
|
||||
error = true;
|
||||
break;
|
||||
case MSR_PLOT_SINGLE_HISTO: // like: runs 1 5 13
|
||||
case MSR_PLOT_SINGLE_HISTO_RRF:
|
||||
case MSR_PLOT_ASYM:
|
||||
case MSR_PLOT_ASYM_RRF:
|
||||
case MSR_PLOT_NON_MUSR:
|
||||
case MSR_PLOT_MU_MINUS:
|
||||
tokens = iter1->fLine.Tokenize(" \t");
|
||||
if (!tokens) {
|
||||
rl = new PStringNumberList(iter1->fLine.Data());
|
||||
if (!rl->Parse(errorMsg, true)) {
|
||||
cerr << endl << ">> PMsrHandler::HandlePlotEntry: **SEVERE ERROR** Couldn't tokenize PLOT in line " << iter1->fLineNo;
|
||||
cerr << endl << ">> Error Message: " << errorMsg;
|
||||
cerr << endl << endl;
|
||||
return false;
|
||||
}
|
||||
if (tokens->GetEntries() < 2) { // runs missing
|
||||
error = true;
|
||||
} else {
|
||||
for (Int_t i=1; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString();
|
||||
if (str.IsDigit()) {
|
||||
run = TComplex(str.Atoi(),-1.0);
|
||||
param.fRuns.push_back(run);
|
||||
} else {
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
runList = rl->GetList();
|
||||
for (UInt_t i=0; i<runList.size(); i++) {
|
||||
run = TComplex(runList[i], -1.0);
|
||||
param.fRuns.push_back(run);
|
||||
}
|
||||
// clean up
|
||||
if (tokens) {
|
||||
delete tokens;
|
||||
tokens = 0;
|
||||
}
|
||||
runList.clear();
|
||||
delete rl;
|
||||
break;
|
||||
default:
|
||||
error = true;
|
||||
@@ -4319,8 +4580,10 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
|
||||
cerr << endl << ">> [use_fit_ranges [ymin ymax]]";
|
||||
cerr << endl << ">> [view_packing n]";
|
||||
cerr << endl;
|
||||
cerr << endl << ">> where <plot_type> is: 0=single histo asym,";
|
||||
cerr << endl << ">> where <plot_type> is: 0=single histo,";
|
||||
cerr << endl << ">> 1=RRF single histo,";
|
||||
cerr << endl << ">> 2=forward-backward asym,";
|
||||
cerr << endl << ">> 3=forward-backward RRF asym,";
|
||||
cerr << endl << ">> 4=mu minus single histo,";
|
||||
cerr << endl << ">> 8=non muSR.";
|
||||
cerr << endl << ">> <run_list> is the list of runs, e.g. runs 1 3";
|
||||
@@ -5073,6 +5336,53 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity()
|
||||
fRuns[i].SetPacking(1);
|
||||
}
|
||||
break;
|
||||
case PRUN_SINGLE_HISTO_RRF:
|
||||
// check that there is a forward parameter number
|
||||
if (fRuns[i].GetForwardHistoNo() == -1) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
cerr << endl << ">> forward parameter number not defined. Necessary for single histogram RRF fits." << endl;
|
||||
return false;
|
||||
}
|
||||
if ((fRuns[i].GetNormParamNo() > static_cast<Int_t>(fParam.size())) && !fFourierOnly) {
|
||||
// check if forward histogram number is a function
|
||||
if (fRuns[i].GetNormParamNo() - MSR_PARAM_FUN_OFFSET > static_cast<Int_t>(fParam.size())) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
cerr << endl << ">> forward histogram number " << fRuns[i].GetNormParamNo() << " is larger than the number of fit parameters (" << fParam.size() << ").";
|
||||
cerr << endl << ">> Consider to check the manual ;-)" << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// check fit range
|
||||
if (!fRuns[i].IsFitRangeInBin() && !fFourierOnly) { // fit range given as times in usec (RUN block)
|
||||
if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) { // check fit range in RUN block
|
||||
if (!fGlobal.IsFitRangeInBin()) { // fit range given as times in usec (GLOBAL block)
|
||||
if ((fGlobal.GetFitRange(0) == PMUSR_UNDEFINED) || (fGlobal.GetFitRange(1) == PMUSR_UNDEFINED)) { // check fit range in GLOBAL block
|
||||
cerr << endl << "PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
cerr << endl << " Fit range is not defined. Necessary for single histogram fits." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// check number of T0's provided
|
||||
if ((fRuns[i].GetT0BinSize() > fRuns[i].GetForwardHistoNoSize()) &&
|
||||
(fGlobal.GetT0BinSize() > fRuns[i].GetForwardHistoNoSize())) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl;
|
||||
cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl;
|
||||
return false;
|
||||
}
|
||||
// check that RRF frequency is given
|
||||
if (fGlobal.GetRRFUnitTag() == RRF_UNIT_UNDEF) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF frequency found in the GLOBAL block." << endl;
|
||||
return false;
|
||||
}
|
||||
// check that RRF packing is given
|
||||
if (fGlobal.GetRRFPacking() == -1) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF packing found in the GLOBAL block." << endl;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case PRUN_ASYMMETRY:
|
||||
// check alpha
|
||||
if ((fRuns[i].GetAlphaParamNo() == -1) && !fFourierOnly) {
|
||||
@@ -5125,6 +5435,62 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity()
|
||||
fRuns[i].SetPacking(1);
|
||||
}
|
||||
break;
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
// check alpha
|
||||
if ((fRuns[i].GetAlphaParamNo() == -1) && !fFourierOnly) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
cerr << endl << ">> alpha parameter number missing which is needed for an asymmetry RRF fit.";
|
||||
cerr << endl << ">> Consider to check the manual ;-)" << endl;
|
||||
return false;
|
||||
}
|
||||
// check that there is a forward parameter number
|
||||
if (fRuns[i].GetForwardHistoNo() == -1) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
cerr << endl << ">> forward histogram number not defined. Necessary for asymmetry RRF fits." << endl;
|
||||
return false;
|
||||
}
|
||||
// check that there is a backward parameter number
|
||||
if (fRuns[i].GetBackwardHistoNo() == -1) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
cerr << endl << ">> backward histogram number not defined. Necessary for asymmetry RRF fits." << endl;
|
||||
return false;
|
||||
}
|
||||
// check fit range
|
||||
if (!fRuns[i].IsFitRangeInBin()) { // fit range given as times in usec
|
||||
if ((fRuns[i].GetFitRange(0) == PMUSR_UNDEFINED) || (fRuns[i].GetFitRange(1) == PMUSR_UNDEFINED)) {
|
||||
if ((fGlobal.GetFitRange(0) == PMUSR_UNDEFINED) || (fGlobal.GetFitRange(1) == PMUSR_UNDEFINED)) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
cerr << endl << ">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry RRF fits." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// check number of T0's provided
|
||||
if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize()) &&
|
||||
(fGlobal.GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize())) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << " in forward. Needs to be fixed." << endl;
|
||||
cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << endl;
|
||||
return false;
|
||||
}
|
||||
if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize()) &&
|
||||
(fGlobal.GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize())) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
cerr << endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << " in backward. Needs to be fixed." << endl;
|
||||
cerr << endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << ". Needs to be fixed." << endl;
|
||||
return false;
|
||||
}
|
||||
// check that RRF frequency is given
|
||||
if (fGlobal.GetRRFUnitTag() == RRF_UNIT_UNDEF) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF frequency found in the GLOBAL block." << endl;
|
||||
return false;
|
||||
}
|
||||
// check that RRF packing is given
|
||||
if (fGlobal.GetRRFPacking() == -1) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** no RRF packing found in the GLOBAL block." << endl;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
// needs eventually to be implemented
|
||||
break;
|
||||
@@ -5511,6 +5877,103 @@ void PMsrHandler::CheckMaxLikelihood()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// CheckRRFSettings (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Make sure that if RRF settings are found in the GLOBAL section, the fit types
|
||||
* in the RUN blocks correspond.
|
||||
*/
|
||||
Bool_t PMsrHandler::CheckRRFSettings()
|
||||
{
|
||||
Bool_t result = true;
|
||||
Int_t fittype = fGlobal.GetFitType();
|
||||
|
||||
// first set of tests: if RRF parameters are set, check if RRF fit is chosen.
|
||||
if (fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) != RRF_FREQ_UNDEF) {
|
||||
if (fittype != -1) { // check if GLOBAL fittype is set
|
||||
if ((fittype != MSR_FITTYPE_SINGLE_HISTO_RRF) &&
|
||||
(fittype != MSR_FITTYPE_ASYM_RRF)) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** found GLOBAL fittype " << fittype << " and";
|
||||
cerr << endl << ">> RRF settings in the GLOBAL section. This is NOT compatible. Fix it first.";
|
||||
result = false;
|
||||
}
|
||||
} else { // GLOBAL fittype is NOT set
|
||||
for (UInt_t i=0; i<fRuns.size(); i++) {
|
||||
fittype = fRuns[i].GetFitType();
|
||||
if ((fittype != MSR_FITTYPE_SINGLE_HISTO_RRF) &&
|
||||
(fittype != MSR_FITTYPE_ASYM_RRF)) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** found RUN with fittype " << fittype << " and";
|
||||
cerr << endl << ">> RRF settings in the GLOBAL section. This is NOT compatible. Fix it first.";
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (fGlobal.GetRRFPacking() != -1) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRRFSettings: **WARNING** found in the GLOBAL section rrf_packing, without";
|
||||
cerr << endl << ">> rrf_freq. Doesn't make any sense. Will drop rrf_packing";
|
||||
cerr << endl << endl;
|
||||
fGlobal.SetRRFPacking(-1);
|
||||
}
|
||||
if (fGlobal.GetRRFPhase() != 0.0) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRRFSettings: **WARNING** found in the GLOBAL section rrf_phase, without";
|
||||
cerr << endl << ">> rrf_freq. Doesn't make any sense. Will drop rrf_phase";
|
||||
cerr << endl << endl;
|
||||
fGlobal.SetRRFPhase(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
// if not a RRF fit, done at this point
|
||||
if ((fittype != MSR_FITTYPE_SINGLE_HISTO_RRF) &&
|
||||
(fittype != MSR_FITTYPE_ASYM_RRF)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// second set of tests: if RRF fit is chosen, do I find the necessary RRF parameters?
|
||||
fittype = fGlobal.GetFitType();
|
||||
if ((fittype == MSR_FITTYPE_SINGLE_HISTO_RRF) ||
|
||||
(fittype == MSR_FITTYPE_ASYM_RRF)) { // make sure RRF freq and RRF packing are set
|
||||
if (fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) == RRF_FREQ_UNDEF) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
|
||||
cerr << endl << ">> no RRF frequency found in the GLOBAL section! Fix it.";
|
||||
return false;
|
||||
}
|
||||
if (fGlobal.GetRRFPacking() == -1) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
|
||||
cerr << endl << ">> no RRF packing found in the GLOBAL section! Fix it.";
|
||||
return false;
|
||||
}
|
||||
} else { // check single runs for RRF
|
||||
UInt_t rrfFitCounter = 0;
|
||||
for (UInt_t i=0; i<fRuns.size(); i++) {
|
||||
fittype = fRuns[i].GetFitType();
|
||||
if ((fittype == MSR_FITTYPE_SINGLE_HISTO_RRF) ||
|
||||
(fittype == MSR_FITTYPE_ASYM_RRF)) { // make sure RRF freq and RRF packing are set
|
||||
rrfFitCounter++;
|
||||
}
|
||||
}
|
||||
if (rrfFitCounter != fRuns.size()) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** #Runs (" << fRuns.size() << ") != # RRF fits found (" << rrfFitCounter << ")";
|
||||
cerr << endl << ">> This is currently not supported.";
|
||||
return false;
|
||||
}
|
||||
if (fGlobal.GetRRFFreq(fGlobal.GetRRFUnit().Data()) == RRF_FREQ_UNDEF) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
|
||||
cerr << endl << ">> no RRF frequency found in the GLOBAL section! Fix it.";
|
||||
return false;
|
||||
}
|
||||
if (fGlobal.GetRRFPacking() == -1) {
|
||||
cerr << endl << ">> PMsrHandler::CheckRRFSettings: **ERROR** RRF fit chosen, but";
|
||||
cerr << endl << ">> no RRF packing found in the GLOBAL section! Fix it.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetGroupingString (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -5644,86 +6107,6 @@ UInt_t PMsrHandler::LastSignificant(Double_t dval, UInt_t precLimit)
|
||||
return lastSignificant;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ParseDetectorGrouping (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param str forward/backward string to be decoded
|
||||
* \param group decoded detector grouping vector
|
||||
*
|
||||
* <b>return:</b> true if parsing was successful, false otherwise.
|
||||
*/
|
||||
Bool_t PMsrHandler::ParseDetectorGrouping(TString str, PIntVector &group)
|
||||
{
|
||||
TObjArray *tok=0, *tok1=0;
|
||||
TObjString *ostr=0;
|
||||
Int_t first=0, last=0;
|
||||
|
||||
// change cn - cm to cn-cm. Will *NOT* handle cn - cm etc
|
||||
str = str.ReplaceAll(" - ", "-");
|
||||
|
||||
group.clear();
|
||||
tok = str.Tokenize(" \t");
|
||||
|
||||
// check that there are indeed enough tokens
|
||||
if (tok->GetEntries() < 2) {
|
||||
delete tok;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Int_t i=1; i<tok->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tok->At(i));
|
||||
if (ostr->GetString().Contains("-")) { // hopefully a cn-cm token
|
||||
tok1 = ostr->GetString().Tokenize("-");
|
||||
if (tok1->GetEntries() == 2) {
|
||||
ostr = dynamic_cast<TObjString*>(tok1->At(0));
|
||||
if (ostr->GetString().IsDigit()) {
|
||||
first = ostr->GetString().Atoi();
|
||||
} else {
|
||||
if (tok) delete tok;
|
||||
if (tok1) delete tok1;
|
||||
return false;
|
||||
}
|
||||
ostr = dynamic_cast<TObjString*>(tok1->At(1));
|
||||
if (ostr->GetString().IsDigit()) {
|
||||
last = ostr->GetString().Atoi();
|
||||
} else {
|
||||
if (tok) delete tok;
|
||||
if (tok1) delete tok1;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (last < first) {
|
||||
if (tok) delete tok;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Int_t i=first; i<=last; i++)
|
||||
group.push_back(i);
|
||||
} else {
|
||||
if (tok) delete tok;
|
||||
if (tok1) delete tok1;
|
||||
return false;
|
||||
}
|
||||
} else { // hopefully a number
|
||||
if (ostr->GetString().IsDigit()) {
|
||||
group.push_back(ostr->GetString().Atoi());
|
||||
} else {
|
||||
if (tok) delete tok;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// clean up
|
||||
if (tok) delete tok;
|
||||
if (tok1) delete tok1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// MakeDetectorGroupingString (private)
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -28,10 +28,14 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
using namespace boost;
|
||||
|
||||
#include "TMath.h"
|
||||
|
||||
#include "PMusr.h"
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
@@ -706,6 +710,10 @@ void PRawRunData::SetTempError(const UInt_t idx, const Double_t errTemp)
|
||||
PMsrGlobalBlock::PMsrGlobalBlock()
|
||||
{
|
||||
fGlobalPresent = false;
|
||||
fRRFFreq = RRF_FREQ_UNDEF; // rotating reference frequency in units given by fRRFUnitTag. Only needed for fittype 1
|
||||
fRRFUnitTag = RRF_UNIT_UNDEF; // RRF unit tag. Default: undefined
|
||||
fRRFPhase = 0.0;
|
||||
fRRFPacking = -1; // undefined RRF packing/rebinning
|
||||
fFitType = -1; // undefined fit type
|
||||
for (UInt_t i=0; i<4; i++) {
|
||||
fDataRange[i] = -1; // undefined data bin range
|
||||
@@ -718,6 +726,135 @@ PMsrGlobalBlock::PMsrGlobalBlock()
|
||||
fPacking = -1; // undefined packing/rebinning
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetRRFFreq (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> get RRF frequency value in specific units. If units is unknown, RRF_UNDEF_FREQ will be returned.
|
||||
*
|
||||
* \param unit unit string in which the units shall be given
|
||||
*/
|
||||
Double_t PMsrGlobalBlock::GetRRFFreq(const char *unit)
|
||||
{
|
||||
Double_t freq = 0.0;
|
||||
|
||||
// check that the units given make sense
|
||||
TString unitStr = unit;
|
||||
Int_t unitTag = RRF_UNIT_UNDEF;
|
||||
if (!unitStr.CompareTo("MHz", TString::kIgnoreCase))
|
||||
unitTag = RRF_UNIT_MHz;
|
||||
else if (!unitStr.CompareTo("Mc", TString::kIgnoreCase))
|
||||
unitTag = RRF_UNIT_Mcs;
|
||||
else if (!unitStr.CompareTo("T", TString::kIgnoreCase))
|
||||
unitTag = RRF_UNIT_T;
|
||||
else
|
||||
return RRF_FREQ_UNDEF;
|
||||
|
||||
// calc the conversion factor
|
||||
if (unitTag == fRRFUnitTag)
|
||||
freq = fRRFFreq;
|
||||
else if ((unitTag == RRF_UNIT_MHz) && (fRRFUnitTag == RRF_UNIT_Mcs))
|
||||
freq = fRRFFreq/TMath::TwoPi();
|
||||
else if ((unitTag == RRF_UNIT_MHz) && (fRRFUnitTag == RRF_UNIT_T))
|
||||
freq = fRRFFreq*1e4*GAMMA_BAR_MUON; // 1e4 need for T -> G since GAMMA_BAR_MUON is given in MHz/G
|
||||
else if ((unitTag == RRF_UNIT_Mcs) && (fRRFUnitTag == RRF_UNIT_MHz))
|
||||
freq = fRRFFreq*TMath::TwoPi();
|
||||
else if ((unitTag == RRF_UNIT_Mcs) && (fRRFUnitTag == RRF_UNIT_T))
|
||||
freq = fRRFFreq*1e4*TMath::TwoPi()*GAMMA_BAR_MUON; // 1e4 need for T -> G since GAMMA_BAR_MUON is given in MHz/G
|
||||
else if ((unitTag == RRF_UNIT_T) && (fRRFUnitTag == RRF_UNIT_MHz))
|
||||
freq = fRRFFreq/GAMMA_BAR_MUON*1e-4; // 1e-4 need for G -> T since GAMMA_BAR_MUON is given in MHz/G
|
||||
else if ((unitTag == RRF_UNIT_T) && (fRRFUnitTag == RRF_UNIT_Mcs))
|
||||
freq = fRRFFreq/(TMath::TwoPi()*GAMMA_BAR_MUON)*1e-4; // 1e-4 need for G -> T since GAMMA_BAR_MUON is given in MHz/G
|
||||
|
||||
return freq;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetRRFFreq (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> set RRF frequency value in specific units. If units is unknown, 0.0 will be set.
|
||||
*
|
||||
* \param RRF frequency value
|
||||
* \param unit unit string in which the units shall be given
|
||||
*/
|
||||
void PMsrGlobalBlock::SetRRFFreq(Double_t freq, const char *unit)
|
||||
{
|
||||
// check that the units given make sense
|
||||
TString unitStr = unit;
|
||||
Int_t unitTag = RRF_UNIT_UNDEF;
|
||||
if (!unitStr.CompareTo("MHz", TString::kIgnoreCase))
|
||||
unitTag = RRF_UNIT_MHz;
|
||||
else if (!unitStr.CompareTo("Mc", TString::kIgnoreCase))
|
||||
unitTag = RRF_UNIT_Mcs;
|
||||
else if (!unitStr.CompareTo("T", TString::kIgnoreCase))
|
||||
unitTag = RRF_UNIT_T;
|
||||
else {
|
||||
cerr << endl << ">> PMsrGlobalBlock::SetRRFFreq: **ERROR** found undefined RRF unit '" << unit << "'!";
|
||||
cerr << endl << ">> Will set RRF frequency to 0.0." << endl;
|
||||
fRRFFreq = 0.0;
|
||||
fRRFUnitTag = RRF_UNIT_UNDEF;
|
||||
}
|
||||
|
||||
fRRFFreq = freq;
|
||||
fRRFUnitTag = unitTag;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetRRFUnit (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> returns RRF frequency unit.
|
||||
*/
|
||||
TString PMsrGlobalBlock::GetRRFUnit()
|
||||
{
|
||||
TString unit;
|
||||
|
||||
switch (fRRFUnitTag) {
|
||||
case RRF_UNIT_UNDEF:
|
||||
unit = TString("??");
|
||||
break;
|
||||
case RRF_UNIT_kHz:
|
||||
unit = TString("kHz");
|
||||
break;
|
||||
case RRF_UNIT_MHz:
|
||||
unit = TString("MHz");
|
||||
break;
|
||||
case RRF_UNIT_Mcs:
|
||||
unit = TString("Mc");
|
||||
break;
|
||||
case RRF_UNIT_G:
|
||||
unit = TString("G");
|
||||
break;
|
||||
case RRF_UNIT_T:
|
||||
unit = TString("T");
|
||||
break;
|
||||
default:
|
||||
unit = TString("??");
|
||||
break;
|
||||
}
|
||||
|
||||
return unit;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetRRFPacking (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> set RRF packing.
|
||||
*
|
||||
* \param RRF packing
|
||||
*/
|
||||
void PMsrGlobalBlock::SetRRFPacking(Int_t pack)
|
||||
{
|
||||
if (pack <= 0) {
|
||||
cerr << endl << "PMsrGlobalBlock::SetRRFPacking: **WARNING** found RRF packing <= 0. Likely doesn't make any sense." << endl;
|
||||
fRRFPacking = -1; // set to undefined
|
||||
}
|
||||
|
||||
fRRFPacking = pack;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetDataRange (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -1741,3 +1878,167 @@ void PMsrRunBlock::SetMapGlobal(UInt_t idx, Int_t ival)
|
||||
// else do nothing at the moment
|
||||
return;
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// implementation PStringNumberList
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Parse (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Helper class which parses list of numbers of the following 3 forms and its combination.
|
||||
* (i) list of integers separted by spaces, e.g. 1 3 7 14
|
||||
* (ii) a range of integers of the form nS-nE, e.g. 13-27 which will generate 13, 14, 15, .., 26, 27
|
||||
* (iii) a sequence of integers of the form nS:nE:nStep, e.g. 10:20:2 which will generate 10, 12, 14, .., 18, 20
|
||||
*
|
||||
* \param errorMsg error message
|
||||
* \param ignoreFirstToken if true, the first parse token will be ignored
|
||||
*
|
||||
* @return true if parse has been successful, otherwise false
|
||||
*/
|
||||
bool PStringNumberList::Parse(string &errorMsg, bool ignoreFirstToken)
|
||||
{
|
||||
bool result=true;
|
||||
vector<string> splitVec;
|
||||
int ival;
|
||||
|
||||
// before checking tokens, remove 'forbidden' " - " and " : "
|
||||
StripSpaces();
|
||||
|
||||
// split string into space separated tokens
|
||||
split(splitVec, fString, is_any_of(" "), token_compress_on);
|
||||
|
||||
unsigned int start=0;
|
||||
if (ignoreFirstToken)
|
||||
start=1;
|
||||
|
||||
for (unsigned int i=start; i<splitVec.size(); i++) {
|
||||
if (splitVec[i].length() != 0) { // ignore empty tokens
|
||||
if (splitVec[i].find("-") != string::npos) { // check for potential range
|
||||
vector<string> subSplitVec;
|
||||
// split potential nS-nE token
|
||||
split(subSplitVec, splitVec[i], is_any_of("-"), token_compress_on);
|
||||
|
||||
int start=-1, end=-1;
|
||||
unsigned int count=0;
|
||||
for (unsigned int j=0; j<subSplitVec.size(); j++) {
|
||||
if (subSplitVec[j].length() != 0) { // ignore empty tokens
|
||||
if (!IsNumber(subSplitVec[j])) {
|
||||
result = false;
|
||||
} else {
|
||||
count++;
|
||||
if (count == 1)
|
||||
start = atoi(subSplitVec[j].c_str());
|
||||
else if (count == 2)
|
||||
end = atoi(subSplitVec[j].c_str());
|
||||
else
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((start < 0) || (end < 0)) { // check that there is a vaild start and end
|
||||
errorMsg = "**ERROR** start or end of a range is not valid";
|
||||
result = false;
|
||||
}
|
||||
if (result) { // no error, hence check start and end
|
||||
if (start > end) {
|
||||
int swap = end;
|
||||
cerr << "**WARNING** start=" << start << " > end=" << end << ", hence I will swap them" << endl;
|
||||
end = start;
|
||||
start = swap;
|
||||
}
|
||||
for (int j=start; j<=end; j++)
|
||||
fList.push_back(j);
|
||||
}
|
||||
} else if (splitVec[i].find(":") != string::npos) { // check for potential sequence
|
||||
vector<string> subSplitVec;
|
||||
// split potential rStart:rEnd:rStep token
|
||||
split(subSplitVec, splitVec[i], is_any_of(":"), token_compress_on);
|
||||
|
||||
int start=-1, end=-1, step=-1;
|
||||
unsigned int count=0;
|
||||
for (unsigned int j=0; j<subSplitVec.size(); j++) {
|
||||
if (subSplitVec[j].length() != 0) { // ignore empty tokens
|
||||
if (!IsNumber(subSplitVec[j])) {
|
||||
result = false;
|
||||
} else {
|
||||
count++;
|
||||
if (count == 1)
|
||||
start = atoi(subSplitVec[j].c_str());
|
||||
else if (count == 2)
|
||||
end = atoi(subSplitVec[j].c_str());
|
||||
else if (count == 3)
|
||||
step = atoi(subSplitVec[j].c_str());
|
||||
else
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((start < 0) || (end < 0) || (step < 0)) { // check that there is a vaild start and end
|
||||
errorMsg = "**ERROR** start, end, or step of a sequence is not valid";
|
||||
result = false;
|
||||
}
|
||||
if (result) { // no error, hence check start and end
|
||||
if (start > end) {
|
||||
int swap = end;
|
||||
cerr << "**WARNING** start=" << start << " > end=" << end << ", hence I will swap them" << endl;
|
||||
end = start;
|
||||
start = swap;
|
||||
}
|
||||
for (int j=start; j<=end; j+=step)
|
||||
fList.push_back(j);
|
||||
}
|
||||
} else if (IsNumber(splitVec[i])) {
|
||||
ival = atoi(splitVec[i].c_str());
|
||||
fList.push_back(ival);
|
||||
} else {
|
||||
errorMsg = "**ERROR** invalid token: " + splitVec[i];
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// StripSpaces (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>This routine removes arbitray number of spaces between '-' and ':',
|
||||
* e.g. 123 - 125 will be converted to 123-125, etc.
|
||||
*/
|
||||
void PStringNumberList::StripSpaces()
|
||||
{
|
||||
string str=fString;
|
||||
int pos=-1;
|
||||
|
||||
// backward scan
|
||||
for (int i=str.size(); i>=0; --i) { // check if first space is found
|
||||
if ((str[i] == ' ') && (pos == -1)) {
|
||||
pos = i;
|
||||
} else if ((str[i] == '-') || (str[i] == ':')) { // check for '-' or ':'
|
||||
if (pos != -1) {
|
||||
str.erase(i+1, pos-i);
|
||||
}
|
||||
} else if (str[i] != ' ') { // anything but different than a space leads to a reset of the pos counter
|
||||
pos = -1;
|
||||
}
|
||||
}
|
||||
// forward scan
|
||||
for (unsigned int i=0; i<str.size(); i++) { // check if first space is found
|
||||
if ((str[i] == ' ') && (pos == -1)) {
|
||||
pos = i;
|
||||
} else if ((str[i] == '-') || (str[i] == ':')) { // check for '-' or ':'
|
||||
if (pos != -1) {
|
||||
str.erase(pos, i-pos);
|
||||
i = pos;
|
||||
}
|
||||
} else if (str[i] != ' ') { // anything but different than a space leads to a reset of the pos counter
|
||||
pos = -1;
|
||||
}
|
||||
}
|
||||
|
||||
fString = str;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2015 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -181,7 +181,7 @@ void PPrepFourier::DoBkgCorrection()
|
||||
if ((fBkgRange[0] != -1) && (fBkgRange[1] != -1)) { // background range is given
|
||||
// make sure that the bkg range is ok
|
||||
for (UInt_t i=0; i<fRawData.size(); i++) {
|
||||
if ((fBkgRange[0] >= fRawData[i].rawData.size()) || (fBkgRange[1] >= fRawData[i].rawData.size())) {
|
||||
if ((fBkgRange[0] >= (Int_t)fRawData[i].rawData.size()) || (fBkgRange[1] >= (Int_t)fRawData[i].rawData.size())) {
|
||||
cerr << endl << "PPrepFourier::DoBkgCorrection() **ERROR** bkg-range out of data-range!";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -87,7 +87,7 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, UIn
|
||||
fPacking = fMsrInfo->GetMsrGlobal()->GetPacking();
|
||||
}
|
||||
if (fPacking == -1) { // this should NOT happen, somethin is severely wrong
|
||||
cerr << endl << ">> PRunAsymmetry::PRunAsymmetry: **SEVERE ERROR**: Couldn't find any packing information!";
|
||||
cerr << endl << ">> PRunAsymmetry::PRunAsymmetry(): **SEVERE ERROR**: Couldn't find any packing information!";
|
||||
cerr << endl << ">> This is very bad :-(, will quit ...";
|
||||
cerr << endl;
|
||||
fValid = false;
|
||||
@@ -342,7 +342,7 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange)
|
||||
Int_t pos = 2*(fRunNo+1)-1;
|
||||
|
||||
if (pos + 1 >= tok->GetEntries()) {
|
||||
cerr << endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
} else {
|
||||
// handle fgb+n0 entry
|
||||
@@ -370,7 +370,7 @@ void PRunAsymmetry::SetFitRangeBin(const TString fitRange)
|
||||
fFitEndTime = (fGoodBins[1] - offset - fT0s[0]) * fTimeResolution;
|
||||
}
|
||||
} else { // error
|
||||
cerr << endl << ">> PRunSingleHisto::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> PRunAsymmetry::SetFitRangeBin(): **ERROR** invalid FIT_RANGE command found: '" << fitRange << "'";
|
||||
cerr << endl << ">> will ignore it. Sorry ..." << endl;
|
||||
}
|
||||
|
||||
|
||||
1511
src/classes/PRunAsymmetryRRF.cpp
Normal file
1511
src/classes/PRunAsymmetryRRF.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -365,6 +365,10 @@ Bool_t PRunDataHandler::ReadFilesMsr()
|
||||
return false;
|
||||
}
|
||||
|
||||
char str[1024], *p_str=0;
|
||||
UInt_t year=0;
|
||||
TString musrRoot("musr-root");
|
||||
|
||||
for (UInt_t i=0; i<runList->size(); i++) {
|
||||
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) {
|
||||
fRunName = *(runList->at(i).GetRunName(j));
|
||||
@@ -372,8 +376,17 @@ Bool_t PRunDataHandler::ReadFilesMsr()
|
||||
if (!FileExistsCheck(runList->at(i), j))
|
||||
return false;
|
||||
|
||||
// get year from string if LEM data file
|
||||
strcpy(str, fRunName.Data());
|
||||
p_str = strstr(str, "lem");
|
||||
if (p_str != 0)
|
||||
sscanf(p_str, "lem%d_his", &year);
|
||||
|
||||
// check special case for ROOT-NPP/ROOT-PPC (LEM)
|
||||
if (!runList->at(i).GetFileFormat(j)->CompareTo("root-npp")) { // not post pile up corrected histos
|
||||
// if LEM file header is already TMusrRoot, change the data-file-format
|
||||
if (year >= 12)
|
||||
runList->at(i).SetFileFormat(musrRoot, j);
|
||||
// check if forward/backward histoNo are within proper bounds, i.e. < PRH_PPC_OFFSET
|
||||
for (UInt_t k=0; k<runList->at(i).GetForwardHistoNoSize(); k++) {
|
||||
if (runList->at(i).GetForwardHistoNo(k) > PRH_PPC_OFFSET)
|
||||
@@ -384,6 +397,9 @@ Bool_t PRunDataHandler::ReadFilesMsr()
|
||||
runList->at(i).SetBackwardHistoNo(runList->at(i).GetBackwardHistoNo(k)-PRH_PPC_OFFSET, k);
|
||||
}
|
||||
} else if (!runList->at(i).GetFileFormat(j)->CompareTo("root-ppc")) { // post pile up corrected histos
|
||||
// if LEM file header is already TMusrRoot, change the data-file-format
|
||||
if (year >= 12)
|
||||
runList->at(i).SetFileFormat(musrRoot, j);
|
||||
// check if forward/backward histoNo are within proper bounds, i.e. > PRH_PPC_OFFSET
|
||||
for (UInt_t k=0; k<runList->at(i).GetForwardHistoNoSize(); k++) {
|
||||
if (runList->at(i).GetForwardHistoNo(k) < PRH_PPC_OFFSET)
|
||||
@@ -1734,8 +1750,33 @@ Bool_t PRunDataHandler::ReadRootFile()
|
||||
|
||||
header->Get("RunInfo/RedGreen Offsets", ivec, ok);
|
||||
if (ok) {
|
||||
redGreenOffsets = ivec;
|
||||
runData.SetRedGreenOffset(ivec);
|
||||
// check if any2many is used and a group histo list is defined, if NOT, only take the 0-offset data!
|
||||
if (fAny2ManyInfo) { // i.e. any2many is called
|
||||
if (fAny2ManyInfo->groupHistoList.size() == 0) { // NO group list defined -> use only the 0-offset data
|
||||
redGreenOffsets.push_back(0);
|
||||
} else { // group list defined
|
||||
// make sure that the group list elements is a subset of present RedGreen offsets
|
||||
Bool_t found = false;
|
||||
for (UInt_t i=0; i<fAny2ManyInfo->groupHistoList.size(); i++) {
|
||||
found = false;
|
||||
for (UInt_t j=0; j<ivec.size(); j++) {
|
||||
if (fAny2ManyInfo->groupHistoList[i] == ivec[j])
|
||||
found = true;
|
||||
}
|
||||
if (!found) {
|
||||
cerr << endl << ">> PRunDataHandler::ReadRootFile: **ERROR** requested histo group " << fAny2ManyInfo->groupHistoList[i];
|
||||
cerr << endl << ">> which is NOT present in the data file." << endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// found all requested histo groups, hence stuff it to the right places
|
||||
redGreenOffsets = fAny2ManyInfo->groupHistoList;
|
||||
runData.SetRedGreenOffset(fAny2ManyInfo->groupHistoList);
|
||||
}
|
||||
} else { // not any2many, i.e. musrfit, musrview, ...
|
||||
redGreenOffsets = ivec;
|
||||
runData.SetRedGreenOffset(ivec);
|
||||
}
|
||||
}
|
||||
|
||||
// check further for LEM specific stuff in RunInfo
|
||||
@@ -5059,7 +5100,11 @@ Bool_t PRunDataHandler::WriteWkmFile(TString fln)
|
||||
if (lem_wkm_style)
|
||||
cout << endl << "TOF(M3S1): nocut";
|
||||
cout << endl << "Groups: " << fData[0].GetNoOfHistos();
|
||||
cout << endl << "Channels: " << static_cast<UInt_t>(fData[0].GetDataBin(1)->size()/fAny2ManyInfo->rebin);
|
||||
UInt_t histo0 = 1;
|
||||
if (fAny2ManyInfo->groupHistoList.size() != 0) { // red/green list found
|
||||
histo0 = fAny2ManyInfo->groupHistoList[0]+1; // take the first available red/green entry
|
||||
}
|
||||
cout << endl << "Channels: " << static_cast<UInt_t>(fData[0].GetDataBin(histo0)->size()/fAny2ManyInfo->rebin);
|
||||
cout.precision(10);
|
||||
cout << endl << "Resolution: " << fData[0].GetTimeResolution()*fAny2ManyInfo->rebin/1.0e3; // ns->us
|
||||
cout.setf(ios::fixed,ios::floatfield); // floatfield set to fixed
|
||||
@@ -5148,7 +5193,11 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln)
|
||||
// run number
|
||||
psibin.put_runNumber_int(fData[0].GetRunNumber());
|
||||
// length of histograms
|
||||
psibin.put_histoLength_bin((int)(fData[0].GetDataBin(1)->size()/fAny2ManyInfo->rebin));
|
||||
UInt_t histo0 = 1;
|
||||
if (fAny2ManyInfo->groupHistoList.size() != 0) { // red/green list found
|
||||
histo0 = fAny2ManyInfo->groupHistoList[0]+1; // take the first available red/green entry
|
||||
}
|
||||
psibin.put_histoLength_bin((int)(fData[0].GetDataBin(histo0)->size()/fAny2ManyInfo->rebin));
|
||||
// number of histograms
|
||||
psibin.put_numberHisto_int((int)fData[0].GetNoOfHistos());
|
||||
// run title = sample (10 char) / temp (10 char) / field (10 char) / orientation (10 char)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -58,12 +58,24 @@ PRunListCollection::~PRunListCollection()
|
||||
}
|
||||
fRunSingleHistoList.clear();
|
||||
|
||||
for (UInt_t i=0; i<fRunSingleHistoRRFList.size(); i++) {
|
||||
fRunSingleHistoRRFList[i]->CleanUp();
|
||||
fRunSingleHistoRRFList[i]->~PRunSingleHistoRRF();
|
||||
}
|
||||
fRunSingleHistoRRFList.clear();
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++) {
|
||||
fRunAsymmetryList[i]->CleanUp();
|
||||
fRunAsymmetryList[i]->~PRunAsymmetry();
|
||||
}
|
||||
fRunAsymmetryList.clear();
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++) {
|
||||
fRunAsymmetryRRFList[i]->CleanUp();
|
||||
fRunAsymmetryRRFList[i]->~PRunAsymmetryRRF();
|
||||
}
|
||||
fRunAsymmetryRRFList.clear();
|
||||
|
||||
for (UInt_t i=0; i<fRunMuMinusList.size(); i++) {
|
||||
fRunMuMinusList[i]->CleanUp();
|
||||
fRunMuMinusList[i]->~PRunMuMinus();
|
||||
@@ -106,11 +118,21 @@ Bool_t PRunListCollection::Add(Int_t runNo, EPMusrHandleTag tag)
|
||||
if (!fRunSingleHistoList[fRunSingleHistoList.size()-1]->IsValid())
|
||||
success = false;
|
||||
break;
|
||||
case PRUN_SINGLE_HISTO_RRF:
|
||||
fRunSingleHistoRRFList.push_back(new PRunSingleHistoRRF(fMsrInfo, fData, runNo, tag));
|
||||
if (!fRunSingleHistoRRFList[fRunSingleHistoRRFList.size()-1]->IsValid())
|
||||
success = false;
|
||||
break;
|
||||
case PRUN_ASYMMETRY:
|
||||
fRunAsymmetryList.push_back(new PRunAsymmetry(fMsrInfo, fData, runNo, tag));
|
||||
if (!fRunAsymmetryList[fRunAsymmetryList.size()-1]->IsValid())
|
||||
success = false;
|
||||
break;
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
fRunAsymmetryRRFList.push_back(new PRunAsymmetryRRF(fMsrInfo, fData, runNo, tag));
|
||||
if (!fRunAsymmetryRRFList[fRunAsymmetryRRFList.size()-1]->IsValid())
|
||||
success = false;
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
fRunMuMinusList.push_back(new PRunMuMinus(fMsrInfo, fData, runNo, tag));
|
||||
if (!fRunMuMinusList[fRunMuMinusList.size()-1]->IsValid())
|
||||
@@ -147,8 +169,12 @@ void PRunListCollection::SetFitRange(const TString fitRange)
|
||||
{
|
||||
for (UInt_t i=0; i<fRunSingleHistoList.size(); i++)
|
||||
fRunSingleHistoList[i]->SetFitRangeBin(fitRange);
|
||||
for (UInt_t i=0; i<fRunSingleHistoRRFList.size(); i++)
|
||||
fRunSingleHistoRRFList[i]->SetFitRangeBin(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++)
|
||||
fRunAsymmetryList[i]->SetFitRangeBin(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
fRunAsymmetryRRFList[i]->SetFitRangeBin(fitRange);
|
||||
for (UInt_t i=0; i<fRunMuMinusList.size(); i++)
|
||||
fRunMuMinusList[i]->SetFitRangeBin(fitRange);
|
||||
for (UInt_t i=0; i<fRunNonMusrList.size(); i++)
|
||||
@@ -169,8 +195,12 @@ void PRunListCollection::SetFitRange(const PDoublePairVector fitRange)
|
||||
{
|
||||
for (UInt_t i=0; i<fRunSingleHistoList.size(); i++)
|
||||
fRunSingleHistoList[i]->SetFitRange(fitRange);
|
||||
for (UInt_t i=0; i<fRunSingleHistoRRFList.size(); i++)
|
||||
fRunSingleHistoRRFList[i]->SetFitRange(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++)
|
||||
fRunAsymmetryList[i]->SetFitRange(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
fRunAsymmetryRRFList[i]->SetFitRange(fitRange);
|
||||
for (UInt_t i=0; i<fRunMuMinusList.size(); i++)
|
||||
fRunMuMinusList[i]->SetFitRange(fitRange);
|
||||
for (UInt_t i=0; i<fRunNonMusrList.size(); i++)
|
||||
@@ -198,6 +228,27 @@ Double_t PRunListCollection::GetSingleHistoChisq(const std::vector<Double_t>& pa
|
||||
return chisq;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetSingleHistoRRFChisq (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Calculates chi-square of <em>all</em> single histogram RRF runs of a msr-file.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - chi-square of all single histogram RRF runs of the msr-file
|
||||
*
|
||||
* \param par fit parameter vector
|
||||
*/
|
||||
Double_t PRunListCollection::GetSingleHistoRRFChisq(const std::vector<Double_t>& par) const
|
||||
{
|
||||
Double_t chisq = 0.0;
|
||||
|
||||
for (UInt_t i=0; i<fRunSingleHistoRRFList.size(); i++)
|
||||
chisq += fRunSingleHistoRRFList[i]->CalcChiSquare(par);
|
||||
|
||||
return chisq;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryChisq (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -219,6 +270,27 @@ Double_t PRunListCollection::GetAsymmetryChisq(const std::vector<Double_t>& par)
|
||||
return chisq;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryRRFChisq (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Calculates chi-square of <em>all</em> asymmetry RRF runs of a msr-file.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - chi-square of all asymmetry RRF runs of the msr-file
|
||||
*
|
||||
* \param par fit parameter vector
|
||||
*/
|
||||
Double_t PRunListCollection::GetAsymmetryRRFChisq(const std::vector<Double_t>& par) const
|
||||
{
|
||||
Double_t chisq = 0.0;
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
chisq += fRunAsymmetryRRFList[i]->CalcChiSquare(par);
|
||||
|
||||
return chisq;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetMuMinusChisq (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -299,9 +371,15 @@ Double_t PRunListCollection::GetSingleHistoChisqExpected(const std::vector<Doubl
|
||||
case PRUN_SINGLE_HISTO:
|
||||
expectedChisq = fRunSingleHistoList[subIdx]->CalcChiSquareExpected(par);
|
||||
break;
|
||||
case PRUN_SINGLE_HISTO_RRF:
|
||||
expectedChisq = fRunSingleHistoRRFList[subIdx]->CalcChiSquareExpected(par);
|
||||
break;
|
||||
case PRUN_ASYMMETRY:
|
||||
expectedChisq = fRunAsymmetryList[subIdx]->CalcChiSquareExpected(par);
|
||||
break;
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
expectedChisq = fRunAsymmetryRRFList[subIdx]->CalcChiSquareExpected(par);
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
expectedChisq = fRunMuMinusList[subIdx]->CalcChiSquareExpected(par);
|
||||
break;
|
||||
@@ -336,16 +414,17 @@ Double_t PRunListCollection::GetSingleRunChisq(const std::vector<Double_t>& par,
|
||||
return chisq;
|
||||
}
|
||||
|
||||
Int_t subIdx = 0;
|
||||
Int_t type = fMsrInfo->GetMsrRunList()->at(idx).GetFitType();
|
||||
if (type == -1) { // i.e. not forun in the RUN block, try the GLOBAL block
|
||||
if (type == -1) { // i.e. not found in the RUN block, try the GLOBAL block
|
||||
type = fMsrInfo->GetMsrGlobal()->GetFitType();
|
||||
}
|
||||
|
||||
// count how many entries of this fit-type are present up to idx
|
||||
UInt_t subIdx = 0;
|
||||
for (UInt_t i=0; i<idx; i++) {
|
||||
if (fMsrInfo->GetMsrRunList()->at(i).GetFitType() == type)
|
||||
subIdx++;
|
||||
subIdx = idx;
|
||||
} else { // found in the RUN block
|
||||
// count how many entries of this fit-type are present up to idx
|
||||
for (UInt_t i=0; i<idx; i++) {
|
||||
if (fMsrInfo->GetMsrRunList()->at(i).GetFitType() == type)
|
||||
subIdx++;
|
||||
}
|
||||
}
|
||||
|
||||
// return the chisq of the single run
|
||||
@@ -353,9 +432,15 @@ Double_t PRunListCollection::GetSingleRunChisq(const std::vector<Double_t>& par,
|
||||
case PRUN_SINGLE_HISTO:
|
||||
chisq = fRunSingleHistoList[subIdx]->CalcChiSquare(par);
|
||||
break;
|
||||
case PRUN_SINGLE_HISTO_RRF:
|
||||
chisq = fRunSingleHistoRRFList[subIdx]->CalcChiSquare(par);
|
||||
break;
|
||||
case PRUN_ASYMMETRY:
|
||||
chisq = fRunAsymmetryList[subIdx]->CalcChiSquare(par);
|
||||
break;
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
chisq = fRunAsymmetryRRFList[subIdx]->CalcChiSquare(par);
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
chisq = fRunMuMinusList[subIdx]->CalcChiSquare(par);
|
||||
break;
|
||||
@@ -376,7 +461,7 @@ Double_t PRunListCollection::GetSingleRunChisq(const std::vector<Double_t>& par,
|
||||
* <p>Calculates log max-likelihood of <em>all</em> single histogram runs of a msr-file.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - chi-square of all single histogram runs of the msr-file
|
||||
* - log max-likelihood of all single histogram runs of the msr-file
|
||||
*
|
||||
* \param par fit parameter vector
|
||||
*/
|
||||
@@ -390,6 +475,27 @@ Double_t PRunListCollection::GetSingleHistoMaximumLikelihood(const std::vector<D
|
||||
return mlh;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetSingleHistoRRFMaximumLikelihood (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Calculates log max-likelihood of <em>all</em> single histogram RRF runs of a msr-file.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - log max-likelihood of all single histogram runs of the msr-file
|
||||
*
|
||||
* \param par fit parameter vector
|
||||
*/
|
||||
Double_t PRunListCollection::GetSingleHistoRRFMaximumLikelihood(const std::vector<Double_t>& par) const
|
||||
{
|
||||
Double_t mlh = 0.0;
|
||||
|
||||
for (UInt_t i=0; i<fRunSingleHistoRRFList.size(); i++)
|
||||
mlh += fRunSingleHistoRRFList[i]->CalcMaxLikelihood(par);
|
||||
|
||||
return mlh;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryMaximumLikelihood (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -412,6 +518,28 @@ Double_t PRunListCollection::GetAsymmetryMaximumLikelihood(const std::vector<Dou
|
||||
return mlh;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryRRFMaximumLikelihood (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> Since it is not clear yet how to handle asymmetry fits with max likelihood
|
||||
* the chi square will be used!
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - chi-square of all asymmetry RRF runs of the msr-file
|
||||
*
|
||||
* \param par fit parameter vector
|
||||
*/
|
||||
Double_t PRunListCollection::GetAsymmetryRRFMaximumLikelihood(const std::vector<Double_t>& par) const
|
||||
{
|
||||
Double_t mlh = 0.0;
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
mlh += fRunAsymmetryRRFList[i]->CalcChiSquare(par);
|
||||
|
||||
return mlh;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetMuMinusMaximumLikelihood (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -419,7 +547,7 @@ Double_t PRunListCollection::GetAsymmetryMaximumLikelihood(const std::vector<Dou
|
||||
* <p>Calculates log max-likelihood of <em>all</em> mu minus runs of a msr-file.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - chi-square of all mu minus runs of the msr-file
|
||||
* - log max-likelihood of all mu minus runs of the msr-file
|
||||
*
|
||||
* \param par fit parameter vector
|
||||
*/
|
||||
@@ -493,9 +621,15 @@ UInt_t PRunListCollection::GetNoOfBinsFitted(const UInt_t idx) const
|
||||
case PRUN_SINGLE_HISTO:
|
||||
result = fRunSingleHistoList[subIdx]->GetNoOfFitBins();
|
||||
break;
|
||||
case PRUN_SINGLE_HISTO_RRF:
|
||||
result = fRunSingleHistoRRFList[subIdx]->GetNoOfFitBins();
|
||||
break;
|
||||
case PRUN_ASYMMETRY:
|
||||
result = fRunAsymmetryList[subIdx]->GetNoOfFitBins();
|
||||
break;
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
result = fRunAsymmetryRRFList[subIdx]->GetNoOfFitBins();
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
result = fRunMuMinusList[subIdx]->GetNoOfFitBins();
|
||||
break;
|
||||
@@ -526,9 +660,15 @@ UInt_t PRunListCollection::GetTotalNoOfBinsFitted() const
|
||||
for (UInt_t i=0; i<fRunSingleHistoList.size(); i++)
|
||||
counts += fRunSingleHistoList[i]->GetNoOfFitBins();
|
||||
|
||||
for (UInt_t i=0; i<fRunSingleHistoRRFList.size(); i++)
|
||||
counts += fRunSingleHistoRRFList[i]->GetNoOfFitBins();
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryList.size(); i++)
|
||||
counts += fRunAsymmetryList[i]->GetNoOfFitBins();
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
counts += fRunAsymmetryRRFList[i]->GetNoOfFitBins();
|
||||
|
||||
for (UInt_t i=0; i<fRunMuMinusList.size(); i++)
|
||||
counts += fRunMuMinusList[i]->GetNoOfFitBins();
|
||||
|
||||
@@ -558,7 +698,7 @@ PRunData* PRunListCollection::GetSingleHisto(UInt_t index, EDataSwitch tag)
|
||||
switch (tag) {
|
||||
case kIndex:
|
||||
if ((index < 0) || (index >= fRunSingleHistoList.size())) {
|
||||
cerr << endl << "PRunListCollection::GetSingleHisto: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl << ">> PRunListCollection::GetSingleHisto(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -581,6 +721,49 @@ PRunData* PRunListCollection::GetSingleHisto(UInt_t index, EDataSwitch tag)
|
||||
return data;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetSingleHistoRRF (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get a processed single histogram RRF data set.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - pointer to the run data set (processed data) if data set is found
|
||||
* - null pointer otherwise
|
||||
*
|
||||
* \param index msr-file run index
|
||||
* \param tag kIndex -> data at index, kRunNo -> data of given run no
|
||||
*/
|
||||
PRunData* PRunListCollection::GetSingleHistoRRF(UInt_t index, EDataSwitch tag)
|
||||
{
|
||||
PRunData *data = 0;
|
||||
|
||||
switch (tag) {
|
||||
case kIndex:
|
||||
if ((index < 0) || (index >= fRunSingleHistoRRFList.size())) {
|
||||
cerr << endl << ">> PRunListCollection::GetSingleHistoRRF(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
fRunSingleHistoRRFList[index]->CalcTheory();
|
||||
data = fRunSingleHistoRRFList[index]->GetData();
|
||||
break;
|
||||
case kRunNo:
|
||||
for (UInt_t i=0; i<fRunSingleHistoRRFList.size(); i++) {
|
||||
if (fRunSingleHistoRRFList[i]->GetRunNo() == index) {
|
||||
data = fRunSingleHistoRRFList[i]->GetData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: // error
|
||||
break;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetry (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -601,7 +784,7 @@ PRunData* PRunListCollection::GetAsymmetry(UInt_t index, EDataSwitch tag)
|
||||
switch (tag) {
|
||||
case kIndex: // called from musrfit when dumping the data
|
||||
if ((index < 0) || (index > fRunAsymmetryList.size())) {
|
||||
cerr << endl << "PRunListCollection::GetAsymmetry: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl << ">> PRunListCollection::GetAsymmetry(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -624,6 +807,49 @@ PRunData* PRunListCollection::GetAsymmetry(UInt_t index, EDataSwitch tag)
|
||||
return data;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryRRF (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get a processed asymmetry RRF data set.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - pointer to the run data set (processed data) if data set is found
|
||||
* - null pointer otherwise
|
||||
*
|
||||
* \param index msr-file run index
|
||||
* \param tag kIndex -> data at index, kRunNo -> data of given run no
|
||||
*/
|
||||
PRunData* PRunListCollection::GetAsymmetryRRF(UInt_t index, EDataSwitch tag)
|
||||
{
|
||||
PRunData *data = 0;
|
||||
|
||||
switch (tag) {
|
||||
case kIndex: // called from musrfit when dumping the data
|
||||
if ((index < 0) || (index > fRunAsymmetryRRFList.size())) {
|
||||
cerr << endl << ">> PRunListCollection::GetAsymmetryRRF(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
fRunAsymmetryRRFList[index]->CalcTheory();
|
||||
data = fRunAsymmetryRRFList[index]->GetData();
|
||||
break;
|
||||
case kRunNo: // called from PMusrCanvas
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++) {
|
||||
if (fRunAsymmetryRRFList[i]->GetRunNo() == index) {
|
||||
data = fRunAsymmetryRRFList[i]->GetData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: // error
|
||||
break;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetMuMinus (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -644,7 +870,7 @@ PRunData* PRunListCollection::GetMuMinus(UInt_t index, EDataSwitch tag)
|
||||
switch (tag) {
|
||||
case kIndex:
|
||||
if ((index < 0) || (index > fRunMuMinusList.size())) {
|
||||
cerr << endl << "PRunListCollection::GetMuMinus: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl << ">> PRunListCollection::GetMuMinus(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
@@ -686,7 +912,7 @@ PRunData* PRunListCollection::GetNonMusr(UInt_t index, EDataSwitch tag)
|
||||
switch (tag) {
|
||||
case kIndex:
|
||||
if ((index < 0) || (index > fRunNonMusrList.size())) {
|
||||
cerr << endl << "PRunListCollection::GetNonMusr: **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl << ">> PRunListCollection::GetNonMusr(): **ERROR** index = " << index << " out of bounds";
|
||||
cerr << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -861,7 +861,7 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi
|
||||
if (fScaleN0AndBkg) {
|
||||
dataNorm = 1.0/ (packing * (fTimeResolution * 1.0e3)); // fTimeResolution us->ns
|
||||
} else if (!fScaleN0AndBkg && (fMsrInfo->GetMsrPlotList()->at(0).fViewPacking > 0)) {
|
||||
theoryNorm = (Double_t)fMsrInfo->GetMsrPlotList()->at(0).fViewPacking/(Double_t)packing;
|
||||
theoryNorm = (Double_t)fMsrInfo->GetMsrPlotList()->at(0).fViewPacking/(Double_t)fPacking;
|
||||
}
|
||||
|
||||
// raw data, since PMusrCanvas is doing ranging etc.
|
||||
@@ -1052,7 +1052,7 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
|
||||
if (fScaleN0AndBkg) {
|
||||
dataNorm = 1.0/ (packing * (fTimeResolution * 1.0e3)); // fTimeResolution us->ns
|
||||
} else if (!fScaleN0AndBkg && (fMsrInfo->GetMsrPlotList()->at(0).fViewPacking > 0)) {
|
||||
theoryNorm = (Double_t)fMsrInfo->GetMsrPlotList()->at(0).fViewPacking/(Double_t)packing;
|
||||
theoryNorm = (Double_t)fMsrInfo->GetMsrPlotList()->at(0).fViewPacking/(Double_t)fPacking;
|
||||
}
|
||||
|
||||
// transform raw histo data. This is done the following way (for details see the manual):
|
||||
|
||||
1205
src/classes/PRunSingleHistoRRF.cpp
Normal file
1205
src/classes/PRunSingleHistoRRF.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -93,11 +93,13 @@ PStartupHandler::PStartupHandler()
|
||||
fStartupFilePath = "";
|
||||
|
||||
// get default path (for the moment only linux like)
|
||||
Char_t *pmusrpath;
|
||||
Char_t *home;
|
||||
Char_t *pmusrpath=0;
|
||||
Char_t *home=0;
|
||||
Char_t musrpath[128];
|
||||
Char_t startup_path_name[128];
|
||||
Bool_t pmusrpathfound = false;
|
||||
Bool_t found = false;
|
||||
|
||||
strncpy(musrpath, "", sizeof(musrpath));
|
||||
|
||||
// check if the startup file is found in the current directory
|
||||
strcpy(startup_path_name, "./musrfit_startup.xml");
|
||||
@@ -105,20 +107,27 @@ PStartupHandler::PStartupHandler()
|
||||
fStartupFileFound = true;
|
||||
fStartupFilePath = TString(startup_path_name);
|
||||
} else { // startup file is not found in the current directory
|
||||
// check if the MUSRFITPATH system variable is set
|
||||
// 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 (pmusrpath != 0) {
|
||||
if (strcmp(pmusrpath, "")) { // MUSRFITPATH variable set but empty
|
||||
pmusrpathfound = true;
|
||||
if (!found) {
|
||||
// check if the MUSRFITPATH system variable is set
|
||||
if (pmusrpath != 0) {
|
||||
if (strcmp(pmusrpath, "")) { // MUSRFITPATH variable set but empty
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!pmusrpathfound) { // MUSRFITPATH not set or empty, will try default one
|
||||
if (!found) { // MUSRFITPATH not set or empty, will try default one
|
||||
home = getenv("ROOTSYS");
|
||||
sprintf(musrpath, "%s/bin", home);
|
||||
cerr << endl << "**WARNING** MUSRFITPATH environment variable not set will try " << musrpath << endl;
|
||||
} else {
|
||||
strncpy(musrpath, pmusrpath, sizeof(musrpath));
|
||||
}
|
||||
|
||||
sprintf(startup_path_name, "%s/musrfit_startup.xml", musrpath);
|
||||
fStartupFilePath = TString(startup_path_name);
|
||||
if (StartupFileExists(startup_path_name)) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -2307,7 +2307,7 @@ Double_t PTheory::SkewedGauss(register Double_t t, const PDoubleVector& paramVal
|
||||
Double_t freq = TWO_PI*val[1];
|
||||
|
||||
if ((zp >= 25.0) || (zm >= 25.0)) // needed to prevent crash of 1F1
|
||||
skg = 2.0e300;
|
||||
skg = 2.0e6;
|
||||
else if (fabs(val[2]) == fabs(val[3])) // sigma+ == sigma- -> Gaussian
|
||||
skg = TMath::Cos(phase+freq*tt) * gp;
|
||||
else
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
139
src/external/MuSRFitGUI/MSR.pm
vendored
139
src/external/MuSRFitGUI/MSR.pm
vendored
@@ -11,13 +11,14 @@ my %DATADIRS = (
|
||||
"GPS", "/afs/psi.ch/project/bulkmusr/data/gps",
|
||||
"LTF", "/afs/psi.ch/project/bulkmusr/data/ltf",
|
||||
"Dolly", "/afs/psi.ch/project/bulkmusr/data/dolly",
|
||||
"GPD", "/afs/psi.ch/project/bulkmusr/data/gpd"
|
||||
"GPD", "/afs/psi.ch/project/bulkmusr/data/gpd",
|
||||
"HAL", "/afs/psi.ch/project/bulkmusr/data/hifi"
|
||||
);
|
||||
|
||||
my %BeamLines = ( "LEM", "MUE4", "LEM (PPC)", "MUE4", "GPS", "PIM3", "LTF", "PIM3", "Dolly", "PIE1", "GPD", "PIE1" );
|
||||
my %BeamLines = ( "LEM", "MUE4", "LEM (PPC)", "MUE4", "GPS", "PIM3", "LTF", "PIM3", "Dolly", "PIE1", "GPD", "PIE1" , "HAL", "PIE3");
|
||||
|
||||
my %Def_Format =
|
||||
( "LEM", "ROOT-NPP", "LEM (PPC)", "ROOT-PPC", "GPS", "PSI-BIN", "LTF", "PSI-BIN", "Dolly", "PSI-BIN" , "GPD", "PSI-BIN");
|
||||
( "LEM", "MUSR-ROOT", "LEM (PPC)", "ROOT-PPC", "GPS", "PSI-BIN", "LTF", "PSI-BIN", "Dolly", "PSI-BIN" , "GPD", "PSI-BIN", "HAL", "PSI-MDU");
|
||||
|
||||
# Additional information to extract run properties from database
|
||||
# For LEM use summary files
|
||||
@@ -28,6 +29,7 @@ $SUMM_DIR="/afs/psi.ch/project/nemu/data/summ/";
|
||||
"Dolly","/afs/psi.ch/project/bulkmusr/olddata/list/",
|
||||
"GPD","/afs/psi.ch/project/bulkmusr/olddata/list/",
|
||||
"ALC","/afs/psi.ch/project/bulkmusr/olddata/list/",
|
||||
"HAL","/afs/psi.ch/project/bulkmusr/olddata/list/",
|
||||
"LTF","/afs/psi.ch/project/bulkmusr/olddata/list/");
|
||||
|
||||
# Information available since
|
||||
@@ -36,6 +38,7 @@ $SUMM_DIR="/afs/psi.ch/project/nemu/data/summ/";
|
||||
"Dolly","1998",
|
||||
"GPD","1993",
|
||||
"ALC","1993",
|
||||
"HAL","2012",
|
||||
"LTF","1995");
|
||||
|
||||
# And to deal with old names of bulk muons
|
||||
@@ -160,6 +163,9 @@ FUNCTIONS
|
||||
my $RUNSType = 0;
|
||||
my @RUNS=();
|
||||
if ($All{"RunNumbers"} ne $EMPTY) {
|
||||
# Remove spaces and other illegal characters
|
||||
$All{"RunNumbers"} =~ s/ //g;
|
||||
$All{"RunNumbers"} =~ s/[a-zA-Z]//g;
|
||||
@RUNS=split( /,/, $All{"RunNumbers"});
|
||||
$RUNSType = 0;
|
||||
}
|
||||
@@ -415,13 +421,11 @@ SAVE
|
||||
# Check if a plot range is defined (i.e. different from fit)
|
||||
$PRANGE_Line = "use_fit_ranges";
|
||||
if ( $All{"Xi"} != $All{"Xf"} ) {
|
||||
|
||||
# if ($Yi != $Yf) {
|
||||
$PRANGE_Line = "range ".$All{"Xi"}." ".$All{"Xf"}." ".$All{"Yi"}." ".$All{"Yf"};
|
||||
|
||||
# } else {
|
||||
# $PRANGE_Line = "range $Xi $Xf";
|
||||
# }
|
||||
if ($All{"Yi"} != $All{"Yf"}) {
|
||||
$PRANGE_Line = "range ".$All{"Xi"}." ".$All{"Xf"}." ".$All{"Yi"}." ".$All{"Yf"};
|
||||
} else {
|
||||
$PRANGE_Line = "range ".$All{"Xi"}." ".$All{"Xf"};
|
||||
}
|
||||
}
|
||||
|
||||
$VIEWBIN_Line ="";
|
||||
@@ -441,7 +445,10 @@ $logxy";
|
||||
if ($All{"FAPODIZATION"} eq $EMPTY) {$All{"FAPODIZATION"}="STRONG";}
|
||||
if ($All{"FPLOT"} eq $EMPTY) {$All{"FPLOT"}="POWER";}
|
||||
if ($All{"FPHASE"} eq $EMPTY) {$All{"FPHASE"}="8.5";}
|
||||
|
||||
my $FrqRange = "#range ".$All{"FRQMIN"}." ".$All{"FRQMAX"};
|
||||
if ($All{"FRQMAX"} ne $EMPTY && $All{"FRQMIN"} ne $EMPTY) {
|
||||
$FrqRange = "range ".$All{"FRQMIN"}." ".$All{"FRQMAX"};
|
||||
}
|
||||
|
||||
$FOURIER_Block=
|
||||
"###############################################################
|
||||
@@ -451,12 +458,13 @@ fourier_power 12
|
||||
apodization FAPODIZATION # NONE, WEAK, MEDIUM, STRONG
|
||||
plot FPLOT # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
|
||||
phase FPHASE
|
||||
#range FRQMIN FRQMAX";
|
||||
FRQRANGE";
|
||||
|
||||
$FOURIER_Block=~ s/FUNITS/$All{"FUNITS"}/g;
|
||||
$FOURIER_Block=~ s/FAPODIZATION/$All{"FAPODIZATION"}/g;
|
||||
$FOURIER_Block=~ s/FPLOT/$All{"FPLOT"}/g;
|
||||
$FOURIER_Block=~ s/FPHASE/$All{"FPHASE"}/g;
|
||||
$FOURIER_Block=~ s/FRQRANGE/$FrqRange/g;
|
||||
|
||||
# Don't know why but it is needed initially
|
||||
$STAT_Block =
|
||||
@@ -519,8 +527,6 @@ sub CreateMSRSingleHist {
|
||||
my ($Full_T_Block,$Paramcomp_ref)=MSR::CreateTheory(@FitTypes);
|
||||
my @Paramcomp = @$Paramcomp_ref;
|
||||
|
||||
print "Paramcomp= $Paramcomp[0]";
|
||||
|
||||
# If we have a FUNCTIONS Block the Full_T_Block should be
|
||||
# replaced by Func_T_Block
|
||||
$FUNCTIONS_Block = $EMPTY;
|
||||
@@ -664,6 +670,7 @@ FUNCTIONS
|
||||
$NoBg_Line = $NoBg_Line . "backgr.fit $PCount\n";
|
||||
}
|
||||
}
|
||||
|
||||
# End of No and NBg Lines
|
||||
# Now deal with physical parameters and phases
|
||||
elsif ( $Param_ORG ne "Phi" && $Param_ORG ne "No" && $Param_ORG ne "NBg") {
|
||||
@@ -817,13 +824,11 @@ SAVE
|
||||
# Check if a plot range is defined (i.e. different from fit)
|
||||
$PRANGE_Line = "use_fit_ranges";
|
||||
if ( $All{"Xi"} != $All{"Xf"} ) {
|
||||
|
||||
# if ($Yi != $Yf) {
|
||||
$PRANGE_Line = "range ".$All{"Xi"}." ".$All{"Xf"}." ".$All{"Yi"}." ".$All{"Yf"};
|
||||
|
||||
# } else {
|
||||
# $PRANGE_Line = "range $Xi $Xf";
|
||||
# }
|
||||
if ($All{"Yi"} != $All{"Yf"}) {
|
||||
$PRANGE_Line = "range ".$All{"Xi"}." ".$All{"Xf"}." ".$All{"Yi"}." ".$All{"Yf"};
|
||||
} else {
|
||||
$PRANGE_Line = "range ".$All{"Xi"}." ".$All{"Xf"};
|
||||
}
|
||||
}
|
||||
|
||||
my $RRFBlock=MSR::CreateRRFBlock(\%All);
|
||||
@@ -1057,11 +1062,18 @@ sub CreateTheory {
|
||||
$Parameters = join( $SPACE, $Parameters, $THEORY{'dynGssKTLF'} );
|
||||
}
|
||||
|
||||
# Static Lorentzian or Gaussian KF ZF
|
||||
elsif ( $FitType eq "LGKT" ) {
|
||||
$T_Block = $T_Block . "\n" . "combiLGKT " . $THEORY{'combiLGKT'};
|
||||
$Parameters = join( $SPACE, $Parameters, $THEORY{'combiLGKT'} );
|
||||
}
|
||||
|
||||
# Static Stretched KF ZF
|
||||
elsif ( $FitType eq "STRKT" ) {
|
||||
$T_Block = $T_Block . "\n" . "strKT " . $THEORY{'strKT'};
|
||||
$Parameters = join( $SPACE, $Parameters, $THEORY{'strKT'} );
|
||||
}
|
||||
|
||||
# Now some more combined functions (multiplication).
|
||||
|
||||
# Lorentzian KT LF multiplied by exponential
|
||||
@@ -1109,6 +1121,15 @@ sub CreateTheory {
|
||||
$Parameters = join( $SPACE, $Parameters, $THEORY{'combiLGKT'} );
|
||||
}
|
||||
|
||||
# Stretched KT ZF multiplied by exponential
|
||||
elsif ( $FitType eq "STRKTExp" ) {
|
||||
$T_Block = $T_Block . "\n" . "simplExpo " . $THEORY{'simplExpo'};
|
||||
$Parameters = join( $SPACE, $Parameters, $THEORY{'simplExpo'} );
|
||||
$T_Block =
|
||||
$T_Block . "\n" . "strKT " . $THEORY{'strKT'};
|
||||
$Parameters = join( $SPACE, $Parameters, $THEORY{'strKT'} );
|
||||
}
|
||||
|
||||
# Lorentzian or Gaussian KT ZF multiplied by stretched exponential
|
||||
elsif ( $FitType eq "LGKTSExp" ) {
|
||||
$T_Block = $T_Block . "\n" . "generExpo " . $THEORY{'generExpo'};
|
||||
@@ -1118,6 +1139,15 @@ sub CreateTheory {
|
||||
$Parameters = join( $SPACE, $Parameters, $THEORY{'combiLGKT'} );
|
||||
}
|
||||
|
||||
# Stretched KT ZF multiplied by stretched exponential
|
||||
elsif ( $FitType eq "STRKTSExp" ) {
|
||||
$T_Block = $T_Block . "\n" . "generExpo " . $THEORY{'generExpo'};
|
||||
$Parameters = join( $SPACE, $Parameters, $THEORY{'generExpo'} );
|
||||
$T_Block =
|
||||
$T_Block . "\n" . "strKT " . $THEORY{'strKT'};
|
||||
$Parameters = join( $SPACE, $Parameters, $THEORY{'strKT'} );
|
||||
}
|
||||
|
||||
# Lorentzian or Gaussian KT LF multiplied by stretched exponential
|
||||
elsif ( $FitType eq "MolMag" ) {
|
||||
$T_Block = $T_Block . "\n" . "generExpo " . $THEORY{'generExpo'};
|
||||
@@ -1717,7 +1747,7 @@ sub RUNFileNameAuto {
|
||||
my $RUN_Line=$EMPTY;
|
||||
# if BeamLine is empty assume manual name
|
||||
if ($BeamLine eq $EMPTY) {
|
||||
my %EXTs = ("root","ROOT-NPP",
|
||||
my %EXTs = ("root","MUSR-ROOT",
|
||||
"bin","PSI-BIN",
|
||||
"msr","MUD");
|
||||
|
||||
@@ -1764,6 +1794,11 @@ sub RUNFileNameAuto {
|
||||
elsif ( $BeamLine eq "GPD" ) {
|
||||
$RUN_File_Name = "deltat_tdc_gpd_" . $RUNtmp;
|
||||
$RUNFILE = "$DATADIR/d$YEAR/tdc/$RUN_File_Name";
|
||||
}
|
||||
elsif ( $BeamLine eq "HAL" ) {
|
||||
$RUNtmp=sprintf("%05d",$RUNtmp);
|
||||
$RUN_File_Name = "tdc_hifi_" . $YEAR . "_" . $RUNtmp;
|
||||
$RUNFILE = "$DATADIR/d$YEAR/tdc/$RUN_File_Name";
|
||||
}
|
||||
$RUN_Line = join( $SPACE,
|
||||
"RUN", $RUNFILE, $BeamLines{$BeamLine}, "PSI",
|
||||
@@ -1792,6 +1827,52 @@ sub CreateRRFBlock {
|
||||
}
|
||||
|
||||
|
||||
########################
|
||||
# ExtractInfo
|
||||
########################
|
||||
# Used to extract information from data file header. The header (using
|
||||
# "dump_header" is sent to this function from musrfit.cgi or MuSRFit
|
||||
sub ExtractInfo {
|
||||
my ($header,$Arg) = @_;
|
||||
|
||||
my @lines = split(/\n/,$header);
|
||||
|
||||
if ( $Arg eq "TITLE" ) {
|
||||
$RTRN_Val = $lines[3];
|
||||
$RTRN_Val =~ s/\n//g;
|
||||
}
|
||||
elsif ( $Arg eq "Temp" ) {
|
||||
foreach my $line (@lines) {
|
||||
if ( $line =~ /Mean Sample_CF1/ ) {
|
||||
( my $tmp, my $T ) = split( /=/, $line );
|
||||
( $T, $tmp ) = split( /\(/, $T );
|
||||
$RTRN_Val = $T;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
elsif ( $Arg eq "Field" ) {
|
||||
foreach my $line (@lines) {
|
||||
if ( $line =~ /Mean B field/ ) {
|
||||
( $tmp, my $B ) = split( /=/, $line );
|
||||
( $B, $tmp ) = split( /\(/, $B );
|
||||
$RTRN_Val = $B;
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $Arg eq "Energy" ) {
|
||||
foreach my $line (@lines) {
|
||||
if ( $line =~ /implantation energy/ ) {
|
||||
( my $tmp1, my $tmp2, my $E ) = split( /=/, $line );
|
||||
( $E, $tmp ) = split( /keV/, $E );
|
||||
$RTRN_Val = $E;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
# $RTRN_Val =~ s/[\.\~\/\&\*\[\;\>\<\^\$\(\)\`\|\]\'\@]//g;
|
||||
return $RTRN_Val;
|
||||
}
|
||||
|
||||
|
||||
########################
|
||||
@@ -2224,7 +2305,7 @@ FUNCTIONS
|
||||
FITPARAMETER
|
||||
###############################################################
|
||||
# No Name Value Err Min Max ";
|
||||
my %PTable=MSR::PrepParamTableSh(\%All);
|
||||
my %PTable=MSR::PrepParamTable(\%All);
|
||||
my $NParam=scalar keys( %PTable );
|
||||
# Fill the table with labels and values of parametr
|
||||
for (my $iP=0;$iP<$NParam;$iP++) {
|
||||
@@ -2266,13 +2347,11 @@ SAVE
|
||||
# Check if a plot range is defined (i.e. different from fit)
|
||||
$PRANGE_Line = "use_fit_ranges";
|
||||
if ( $All{"Xi"} != $All{"Xf"} ) {
|
||||
|
||||
# if ($Yi != $Yf) {
|
||||
$PRANGE_Line = "range ".$All{"Xi"}." ".$All{"Xf"}." ".$All{"Yi"}." ".$All{"Yf"};
|
||||
|
||||
# } else {
|
||||
# $PRANGE_Line = "range $Xi $Xf";
|
||||
# }
|
||||
if ($All{"Yi"} != $All{"Yf"}) {
|
||||
$PRANGE_Line = "range ".$All{"Xi"}." ".$All{"Xf"}." ".$All{"Yi"}." ".$All{"Yf"};
|
||||
} else {
|
||||
$PRANGE_Line = "range ".$All{"Xi"}." ".$All{"Xf"};
|
||||
}
|
||||
}
|
||||
|
||||
$VIEWBIN_Line ="";
|
||||
|
||||
6
src/external/MusrRoot/TMusrRunHeader.cpp
vendored
6
src/external/MusrRoot/TMusrRunHeader.cpp
vendored
@@ -1437,14 +1437,14 @@ bool TMusrRunHeader::UpdateFolder(TObject *treeObj, TString path)
|
||||
|
||||
// remove the first path element
|
||||
if (!RemoveFirst(path, '/')) {
|
||||
cerr << endl << ">> TMusrRunHeader::FillFolder(): **ERROR** couldn't tokenize path!!" << endl;
|
||||
cerr << endl << ">> TMusrRunHeader::UpdateFolder(): **ERROR** couldn't tokenize path!!" << endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!obj) { // required object not present, create it
|
||||
TObjArray *oarray = new TObjArray();
|
||||
if (!oarray) {
|
||||
cerr << endl << ">> TMusrRunHeader::FillFolder(): **ERROR** couldn't create header structure!!" << endl;
|
||||
cerr << endl << ">> TMusrRunHeader::UpdateFolder(): **ERROR** couldn't create header structure!!" << endl;
|
||||
return false;
|
||||
}
|
||||
// set the name of the new TObjArray
|
||||
@@ -1636,7 +1636,7 @@ TObjString TMusrRunHeader::GetHeaderString(UInt_t idx)
|
||||
str += subStr;
|
||||
str += "; ";
|
||||
}
|
||||
subStr.Form(fmt, dvec.size()-1);
|
||||
subStr.Form(fmt, dvec[dvec.size()-1]);
|
||||
str += subStr;
|
||||
str += " -@";
|
||||
str += MRH_DOUBLE_VECTOR;
|
||||
|
||||
10
src/external/Nonlocal/Makefile.am
vendored
10
src/external/Nonlocal/Makefile.am
vendored
@@ -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'
|
||||
|
||||
|
||||
8
src/external/Nonlocal/PNL_StartupHandler.cpp
vendored
8
src/external/Nonlocal/PNL_StartupHandler.cpp
vendored
@@ -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);
|
||||
|
||||
41
src/external/libBNMR/ExpRlx-MUD.msr
vendored
41
src/external/libBNMR/ExpRlx-MUD.msr
vendored
@@ -4,23 +4,23 @@
|
||||
FITPARAMETER
|
||||
###############################################################
|
||||
# No Name Value Err Min Max
|
||||
1 Alphap 1.11662 0.00020 none
|
||||
2 Asyp 0 0.00038 none
|
||||
3 T 1e6 0 none
|
||||
4 Rlx 0.969e6 0.020 none
|
||||
5 Pos 1 0 none
|
||||
6 Neg -1 0 none
|
||||
1 Alpha 1.11587 0.00038 none
|
||||
2 Asy 0.0570 0.0011 none
|
||||
3 T 1 0 none
|
||||
4 Rlx 1.015 0.023 none
|
||||
5 One 1 0 none
|
||||
6 Bet -1.052 0.027 none
|
||||
|
||||
###############################################################
|
||||
THEORY
|
||||
###############################################################
|
||||
asymmetry fun1
|
||||
userFcn libBNMR.so ExpRlx 3 4
|
||||
userFcn .libs/libBNMR.so ExpRlx 3 4
|
||||
|
||||
###############################################################
|
||||
FUNCTIONS
|
||||
###############################################################
|
||||
fun1 = map1 * map2
|
||||
fun1 = 0.5 * map1 * map2
|
||||
|
||||
###############################################################
|
||||
RUN 045674 BNMR TRIUMF MUD (name beamline institute data-file-format)
|
||||
@@ -28,11 +28,12 @@ fittype 2 (asymmetry fit)
|
||||
alpha 1
|
||||
forward 3
|
||||
backward 4
|
||||
data 11 799 11 799
|
||||
background 800 900 800 900 # estimated bkg: 416.9700 / 465.7600
|
||||
t0 0.0 0.0
|
||||
data 11 800 11 800
|
||||
#backgr.fix 0
|
||||
background 1 9 1 9 # estimated bkg: 8.0000 / 9.6250
|
||||
t0 10.0 10.0
|
||||
map 2 5 0 0 0 0 0 0 0 0
|
||||
fit 5e5 8e6
|
||||
fit 0.5 8
|
||||
packing 5
|
||||
|
||||
RUN 045674 BNMR TRIUMF MUD (name beamline institute data-file-format)
|
||||
@@ -40,11 +41,12 @@ fittype 2 (asymmetry fit)
|
||||
alpha 1
|
||||
forward 5
|
||||
backward 6
|
||||
data 11 799 11 799
|
||||
background 800 900 800 900 # estimated bkg: 430.9200 / 479.4500
|
||||
t0 0.0 0.0
|
||||
data 11 800 11 800
|
||||
#backgr.fix 0
|
||||
background 1 9 1 9 # estimated bkg: 11.6250 / 15.6250
|
||||
t0 10.0 10.0
|
||||
map 2 6 0 0 0 0 0 0 0 0
|
||||
fit 5e5 8e6
|
||||
fit 0.5 8
|
||||
packing 5
|
||||
|
||||
|
||||
@@ -58,16 +60,17 @@ SAVE
|
||||
PLOT 2 (asymmetry plot)
|
||||
runs 1 2
|
||||
use_fit_ranges
|
||||
view_packing 10
|
||||
|
||||
|
||||
###############################################################
|
||||
FOURIER
|
||||
units MHz # units either 'Gauss', 'MHz', or 'Mc/s'
|
||||
units MHz # units either 'Gauss', 'Tesla', 'MHz', or 'Mc/s'
|
||||
fourier_power 12
|
||||
apodization STRONG # NONE, WEAK, MEDIUM, STRONG
|
||||
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE
|
||||
phase 8
|
||||
#range FRQMIN FRQMAX
|
||||
###############################################################
|
||||
STATISTIC --- 2014-11-14 16:37:41
|
||||
chisq = 372.2, NDF = 295, chisq/NDF = 1.261744
|
||||
STATISTIC --- 2015-04-14 11:00:19
|
||||
chisq = 399.5, NDF = 290, chisq/NDF = 1.377736
|
||||
|
||||
2
src/external/libBNMR/ExpRlx.msr
vendored
2
src/external/libBNMR/ExpRlx.msr
vendored
@@ -9,7 +9,7 @@ FITPARAMETER
|
||||
###############################################################
|
||||
THEORY
|
||||
asymmetry 1
|
||||
userFcn /home/l_salman/LEM/musrfit/src/external/libBNMR/libBNMR.so ExpRlx 2 3
|
||||
userFcn /usr/local/lib/libBNMR.so ExpRlx 2 3
|
||||
|
||||
###############################################################
|
||||
RUN 45377 MUE4 PSI ASCII (name beamline institute data-file-format)
|
||||
|
||||
2
src/external/libBNMR/SExpRlx.msr
vendored
2
src/external/libBNMR/SExpRlx.msr
vendored
@@ -10,7 +10,7 @@ FITPARAMETER
|
||||
###############################################################
|
||||
THEORY
|
||||
asymmetry 1
|
||||
userFcn /home/l_salman/LEM/musrfit/src/external/libBNMR/libBNMR.so SExpRlx 2 3 4
|
||||
userFcn /usr/local/lib/libBNMR.so SExpRlx 2 3 4
|
||||
|
||||
###############################################################
|
||||
RUN 45377 MUE4 PSI ASCII (name beamline institute data-file-format)
|
||||
|
||||
BIN
src/external/libGapIntegrals/GapIntegrals.pdf
vendored
BIN
src/external/libGapIntegrals/GapIntegrals.pdf
vendored
Binary file not shown.
69
src/external/libGapIntegrals/GapIntegrals.tex
vendored
69
src/external/libGapIntegrals/GapIntegrals.tex
vendored
@@ -12,6 +12,7 @@
|
||||
\usepackage{rotating}
|
||||
\usepackage{dcolumn}
|
||||
\usepackage{geometry}
|
||||
\usepackage{color}
|
||||
|
||||
\geometry{a4paper,left=20mm,right=20mm,top=20mm,bottom=20mm}
|
||||
|
||||
@@ -72,7 +73,7 @@ E-Mail: & \verb?andreas.suter@psi.ch? &&
|
||||
%
|
||||
\section*{\musrfithead plug-in for the calculation of the temperature dependence of $\bm{1/\lambda^2}$ for various gap symmetries}%
|
||||
|
||||
This memo is intended to give a short summary of the background on which the \gapint plug-in for \musrfit \cite{musrfit} has been developped. The aim of this implementation is the efficient calculation of integrals of the form
|
||||
This memo is intended to give a short summary of the background on which the \gapint plug-in for \musrfit \cite{musrfit} has been developed. The aim of this implementation is the efficient calculation of integrals of the form
|
||||
\begin{equation}\label{int}
|
||||
I(T) = 1 + \frac{1}{\pi}\int_0^{2\pi}\int_{\Delta(\varphi,T)}^{\infty}\left(\frac{\partial f}{\partial E}\right) \frac{E}{\sqrt{E^2-\Delta^2(\varphi,T)}}\mathrm{d}E\mathrm{d}\varphi\,,
|
||||
\end{equation}
|
||||
@@ -104,18 +105,27 @@ For the numerical integration we use algorithms of the \textsc{Cuba} library \ci
|
||||
\subsection*{Implemented gap functions and function calls from MUSRFIT}
|
||||
Currently the calculation of $\tilde{I}(T)$ is implemented for various gap functions.
|
||||
The temperature dependence of the gap functions is either given by Eq.(\ref{eq:gapT_Prozorov}) \cite{Prozorov}, or by Eq.(\ref{eq:gapT_Manzano}) \cite{Manzano}.
|
||||
|
||||
\vspace{2mm}
|
||||
|
||||
\noindent \color{red}\textbf{A few words of warning:~}\color{black} The temperature dependence of the gap function is typically derived from within the BCS framework,
|
||||
and strongly links $T_c$ and $\Delta_0$ (e.g.\xspace $\Delta_0 = 1.76\, k_{\rm B} T_c$ for an s-wave superconductor). In a self-consistent
|
||||
description this would mean that $\Delta_0$ of $\Delta(\varphi)$ is locked to $T_c$ as well. In the implementation provided, this limitation
|
||||
is lifted, and therefore the \emph{user} should judge and question the result if the ratio $\Delta_0/(k_{\rm B}T_c)$ is strongly deviating from
|
||||
BCS values!
|
||||
|
||||
\begin{equation}\label{eq:gapT_Prozorov}
|
||||
\Delta(\varphi,T) \simeq \Delta(\varphi,0)\,\tanh\left[\frac{\pi k_{\rm B} T_{\rm c}}{\Delta_0}\sqrt{a_{\rm G} \left(\frac{T_{\rm c}}{T}-1\right)}\right]
|
||||
\Delta(\varphi,T) \simeq \Delta(\varphi)\,\tanh\left[c_0\,\sqrt{a_{\rm G} \left(\frac{T_{\rm c}}{T}-1\right)}\right]
|
||||
\end{equation}
|
||||
\noindent with $\Delta_0$ as given below, and $a_{\rm G}$ depends on the pairing state:
|
||||
\noindent with $\Delta(\varphi)$ as given below, and $c_0$ and $a_{\rm G}$ depends on the pairing state:
|
||||
|
||||
\begin{description}
|
||||
\item [\textit{s}-wave:] $a_{\rm G}=1$ \qquad with $\Delta_0 = 1.76\, k_{\rm B} T_c$
|
||||
\item [\textit{d}-wave:] $a_{\rm G}=4/3$ \quad with $\Delta_0 = 2.14\, k_{\rm B} T_c$
|
||||
\item [\textit{s}-wave:] $a_{\rm G}=1$ \qquad with $c_0 = \frac{\displaystyle\pi k_{\rm B} T_{\rm c}}{\displaystyle\Delta_0} = \pi/1.76 = 1.785$
|
||||
\item [\textit{d}-wave:] $a_{\rm G}=4/3$ \quad with $c_0 = \frac{\displaystyle\pi k_{\rm B} T_{\rm c}}{\displaystyle\Delta_0} = \pi/2.14 = 1.468$
|
||||
\end{description}
|
||||
|
||||
\begin{equation}\label{eq:gapT_Manzano}
|
||||
\Delta(\varphi,T) \simeq \Delta(\varphi)\tanh\left(1.82\left(1.018\left(\frac{T_{\mathrm c}}{T}-1\right)\right)^{0.51}\right)\,.
|
||||
\Delta(\varphi,T) \simeq \Delta(\varphi)\tanh\left[1.82\left(1.018\left(\frac{T_{\mathrm c}}{T}-1\right)\right)^{0.51}\right]\,.
|
||||
\end{equation}
|
||||
The \gapint plug-in calculates $\tilde{I}(T)$ for the following $\Delta(\varphi)$:
|
||||
|
||||
@@ -124,37 +134,39 @@ The \gapint plug-in calculates $\tilde{I}(T)$ for the following $\Delta(\varphi)
|
||||
\begin{equation}
|
||||
\Delta(\varphi) = \Delta_0
|
||||
\end{equation}
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapSWave 1 2 [3]?\\
|
||||
(Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $[a_{\rm G}~(1)]$. If $a_{\rm G}$ is given, the temperature dependence
|
||||
according to Eq.(\ref{eq:gapT_Prozorov}) will be used, otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.)
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapSWave 1 2 [3 4]?\\[1.5ex]
|
||||
Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $[c_0~(1),~ a_{\rm G}~(1)]$. If $c_0$ and $a_{\rm G}$ are provided,
|
||||
the temperature dependence according to Eq.(\ref{eq:gapT_Prozorov}) will be used, otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.
|
||||
\item[\textit{d}-wave gap \cite{Deutscher}:]
|
||||
\begin{equation}
|
||||
\Delta(\varphi) = \Delta_0\cos\left(2\varphi\right)
|
||||
\end{equation}
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapDWave 1 2 [3]?\\
|
||||
(Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $[a_{\rm G}~(1)]$. If $a_{\rm G}$ is given, the temperature dependence
|
||||
according to Eq.(\ref{eq:gapT_Prozorov}) will be used, otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.)
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapDWave 1 2 [3 4]?\\[1.5ex]
|
||||
Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $[c_0~(1),~a_{\rm G}~(1)]$. If $c_0$ and $a_{\rm G}$ are provided,
|
||||
the temperature dependence according to Eq.(\ref{eq:gapT_Prozorov}) will be used, otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.
|
||||
\item[non-monotonic \textit{d}-wave gap \cite{Matsui}:]
|
||||
\begin{equation}
|
||||
\Delta(\varphi) = \Delta_0\left[a \cos\left(2\varphi\right) + (1-a)\cos\left(6\varphi\right)\right]
|
||||
\end{equation}
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapNonMonDWave1 1 2 3 [4]?\\
|
||||
(Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $a~(1)$, $[a_{\rm G}~(1)]$. If $a_{\rm G}$ is given, the temperature dependence
|
||||
according to Eq.(\ref{eq:gapT_Prozorov}) will be used, otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.)
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapNonMonDWave1 1 2 3 [4 5]?\\[1.5ex]
|
||||
Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $a~(1)$, $[c_0~(1),~a_{\rm G}~(1)]$. If $c_0$ and $a_{\rm G}$ are provided,
|
||||
the temperature dependence according to Eq.(\ref{eq:gapT_Prozorov}) will be used, otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.
|
||||
\item[non-monotonic \textit{d}-wave gap \cite{Eremin}:]
|
||||
\begin{equation}
|
||||
\Delta(\varphi) = \Delta_0\left[\frac{2}{3} \sqrt{\frac{a}{3}}\cos\left(2\varphi\right) / \left( 1 + a\cos^2\left(2\varphi\right)\right)^{\frac{3}{2}}\right],\,a>1/2
|
||||
\end{equation}
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapNonMonDWave2 1 2 3 [4]?\\
|
||||
(Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $a~(1)$, $a~(1)$, $[a_{\rm G}~(1)]$. If $a_{\rm G}$ is given, the temperature dependence
|
||||
according to Eq.(\ref{eq:gapT_Prozorov}) will be used, otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.)
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapNonMonDWave2 1 2 3 [4 5]?\\[1.5ex]
|
||||
Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $a~(1)$, $a~(1)$, $[c_0~(1),~a_{\rm G}~(1)]$.
|
||||
If $c_0$ and $a_{\rm G}$ are provided, the temperature dependence according to Eq.(\ref{eq:gapT_Prozorov}) will be used,
|
||||
otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.
|
||||
\item[anisotropic \textit{s}-wave gap \cite{AnisotropicSWave}:]
|
||||
\begin{equation}
|
||||
\Delta(\varphi) = \Delta_0\left[1+a\cos\left(4\varphi\right)\right]\,,\,0\leqslant a\leqslant1
|
||||
\end{equation}
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapAnSWave 1 2 3 [4]?\\
|
||||
(Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $a~(1)$, $[a_{\rm G}~(1)]$. If $a_{\rm G}$ is given, the temperature dependence
|
||||
according to Eq.(\ref{eq:gapT_Prozorov}) will be used, otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.)
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapAnSWave 1 2 3 [4 5]?\\[1.5ex]
|
||||
Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $a~(1)$, $[c_0~(1),~a_{\rm G}~(1)]$.
|
||||
If $c_0$ and $a_{\rm G}$ are provided, the temperature dependence according to Eq.(\ref{eq:gapT_Prozorov}) will be used,
|
||||
otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.
|
||||
\end{description}
|
||||
|
||||
\noindent It is also possible to calculate a power law temperature dependence (in the two fluid approximation $n=4$) and the dirty \textit{s}-wave expression.
|
||||
@@ -164,16 +176,16 @@ Obviously for this no integration is needed.
|
||||
\begin{equation}
|
||||
\frac{\lambda(0)^2}{\lambda(T)^2} = 1-\left(\frac{T}{T_{\mathrm c}}\right)^n
|
||||
\end{equation}
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapPowerLaw 1 2?\\
|
||||
(Parameters: $T_{\mathrm c}~(\mathrm{K})$, $n~(1)$)
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapPowerLaw 1 2?\\[1.5ex]
|
||||
Parameters: $T_{\mathrm c}~(\mathrm{K})$, $n~(1)$
|
||||
\item[dirty \textit{s}-wave \cite{Tinkham}:]
|
||||
\begin{equation}
|
||||
\frac{\lambda(0)^2}{\lambda(T)^2} = \frac{\Delta(T)}{\Delta_0}\,\tanh\left[\frac{\Delta(T)}{2 k_{\rm B} T}\right]
|
||||
\end{equation}
|
||||
with $\Delta(T)$ given by Eq.(\ref{eq:gapT}).\\
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapDirtySWave 1 2 [3]?\\
|
||||
(Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $[a_{\rm G}~(1)]$. If $a_{\rm G}$ is given, the temperature dependence
|
||||
according to Eq.(\ref{eq:gapT_Prozorov}) will be used, otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.)
|
||||
\musrfit theory line: \verb?userFcn libGapIntegrals TGapDirtySWave 1 2 [3 4]?\\[1.5ex]
|
||||
Parameters: $T_{\mathrm c}~(\mathrm{K})$, $\Delta_0~(\mathrm{meV})$, $[c_0~(1),~a_{\rm G}~(1)]$.
|
||||
If $c_0$ and $a_{\rm G}$ are provided, the temperature dependence according to Eq.(\ref{eq:gapT_Prozorov}) will be used,
|
||||
otherwise Eq.(\ref{eq:gapT_Manzano}) will be utilized.
|
||||
\end{description}
|
||||
|
||||
\noindent Currently there are two gap functions to be found in the code which are \emph{not} documented here:
|
||||
@@ -187,7 +199,8 @@ The \gapint library is free software; you can redistribute it and/or modify it u
|
||||
\bibliographystyle{plain}
|
||||
\begin{thebibliography}{1}
|
||||
|
||||
\bibitem{musrfit} A.~Suter, \textit{\musrfit User Manual}, https://wiki.intranet.psi.ch/MUSR/MusrFit
|
||||
\bibitem{musrfit} A. Suter, and B.M. Wojek, Physics Procedia \textbf{30}, 69 (2012).
|
||||
A.~Suter, \textit{\musrfit User Manual}, http://lmu.web.psi.ch/musrfit/user/MUSR/WebHome.html
|
||||
\bibitem{cuba} T.~Hahn, \textit{Cuba -- a library for multidimensional numerical integration}, Comput.~Phys.~Commun.~\textbf{168}~(2005)~78-95, http://www.feynarts.de/cuba/
|
||||
\bibitem{Prozorov} R.~Prozorov and R.W.~Giannetta, \textit{Magnetic penetration depth in unconventional superconductors}, Supercond.\ Sci.\ Technol.\ \textbf{19}~(2006)~R41-R67, and Erratum in Supercond.\ Sci.\ Technol.\ \textbf{21}~(2008)~082003.
|
||||
\bibitem{Manzano} A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
|
||||
83
src/external/libGapIntegrals/TGapIntegrals.cpp
vendored
83
src/external/libGapIntegrals/TGapIntegrals.cpp
vendored
@@ -459,10 +459,12 @@ TLambdaInvNonMonDWave2::~TLambdaInvNonMonDWave2() {
|
||||
*/
|
||||
double TGapSWave::operator()(double t, const vector<double> &par) const {
|
||||
|
||||
assert((par.size() == 2) || (par.size() == 3)); // two or three parameters: Tc (K), Delta(0) (meV), [a (1)]
|
||||
// 2 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 3 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// parameters: [0] Tc (K), [1] Delta0 (meV), [[2] c0 (1), [3] aG (1)]
|
||||
|
||||
assert((par.size() == 2) || (par.size() == 4)); // 2 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 4 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// and Erratum Supercond. Sci. Technol. 21 (2008) 082003
|
||||
// c0 in the original context is c0 = (pi kB Tc) / Delta0
|
||||
if (t<=0.0)
|
||||
return 1.0;
|
||||
else if (t >= par[0])
|
||||
@@ -509,7 +511,7 @@ double TGapSWave::operator()(double t, const vector<double> &par) const {
|
||||
if (par.size() == 2) { // Carrington/Manzano
|
||||
intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51)));
|
||||
} else { // Prozorov/Giannetta
|
||||
intPar.push_back(par[1]*tanh(0.2707214816*par[0]/par[1]*sqrt(par[2]*(par[0]/t-1.0)))); // tanh(pi kB Tc / Delta(0) * sqrt()), pi kB = 0.2707214816 meV/K
|
||||
intPar.push_back(par[1]*tanh(par[2]*sqrt(par[3]*(par[0]/t-1.0)))); // Delta0*tanh(c0*sqrt(aG*(Tc/T-1)))
|
||||
}
|
||||
|
||||
fGapIntegral->SetParameters(intPar);
|
||||
@@ -536,10 +538,12 @@ double TGapSWave::operator()(double t, const vector<double> &par) const {
|
||||
*/
|
||||
double TGapDWave::operator()(double t, const vector<double> &par) const {
|
||||
|
||||
assert((par.size() == 2) || (par.size() == 3)); // two or three parameters: Tc (K), Delta(0) (meV), [a (1)]
|
||||
// 2 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 3 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// parameters: [0] Tc (K), [1] Delta0 (meV), [[2] c0 (1), [3] aG (1)]
|
||||
|
||||
assert((par.size() == 2) || (par.size() == 4)); // 2 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 4 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// and Erratum Supercond. Sci. Technol. 21 (2008) 082003
|
||||
// c0 in the original context is c0 = (pi kB Tc) / Delta0
|
||||
if (t<=0.0)
|
||||
return 1.0;
|
||||
else if (t >= par[0])
|
||||
@@ -585,7 +589,7 @@ double TGapDWave::operator()(double t, const vector<double> &par) const {
|
||||
if (par.size() == 2) { // Carrington/Manzano
|
||||
intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51)));
|
||||
} else { // Prozorov/Giannetta
|
||||
intPar.push_back(par[1]*tanh(0.2707214816*par[0]/par[1]*sqrt(par[2]*(par[0]/t-1.0)))); // tanh(pi kB Tc / Delta(0) * sqrt()), pi kB = 0.2707214816 meV/K
|
||||
intPar.push_back(par[1]*tanh(par[2]*sqrt(par[3]*(par[0]/t-1.0)))); // Delta0*tanh(c0*sqrt(aG*(Tc/T-1)))
|
||||
}
|
||||
intPar.push_back(4.0*(t+intPar[1])); // upper limit of energy-integration: cutoff energy
|
||||
intPar.push_back(TMath::PiOver2()); // upper limit of phi-integration
|
||||
@@ -618,9 +622,10 @@ double TGapDWave::operator()(double t, const vector<double> &par) const {
|
||||
*/
|
||||
double TGapCosSqDWave::operator()(double t, const vector<double> &par) const {
|
||||
|
||||
assert((par.size() == 3) || (par.size() == 5)); // three or five parameters: Tc (K), DeltaD(0) (meV), DeltaS(0) (meV), [aD (1), aS (1)]
|
||||
// 3 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 5 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// parameters: [0] Tc (K), [1] Delta0_D (meV), [2] Delta0_S (meV) [[3] c0_D (1), [4] aG_D (1), [5] c0_S (1), [6] aG_S (1)]
|
||||
|
||||
assert((par.size() == 3) || (par.size() == 7)); // 3 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 7 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// and Erratum Supercond. Sci. Technol. 21 (2008) 082003
|
||||
if (t<=0.0)
|
||||
return 1.0;
|
||||
@@ -667,14 +672,14 @@ double TGapCosSqDWave::operator()(double t, const vector<double> &par) const {
|
||||
if (par.size() == 3) { // Carrington/Manzano
|
||||
intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51)));
|
||||
} else { // Prozorov/Giannetta
|
||||
intPar.push_back(par[1]*tanh(0.2707214816*par[0]/par[1]*sqrt(par[3]*(par[0]/t-1.0)))); // DeltaD(T) : tanh(pi kB Tc / Delta(0) * sqrt()), pi kB = 0.2707214816 meV/K
|
||||
intPar.push_back(par[1]*tanh(par[3]*sqrt(par[4]*(par[0]/t-1.0)))); // Delta0_D*tanh(c0_D*sqrt(aG_D*(Tc/T-1)))
|
||||
}
|
||||
intPar.push_back(1.0*(t+intPar[1])); // upper limit of energy-integration: cutoff energy
|
||||
intPar.push_back(TMath::Pi()); // upper limit of phi-integration
|
||||
if (par.size() == 3) { // Carrington/Manzano
|
||||
intPar.push_back(par[2]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51)));
|
||||
} else { // Prozorov/Giannetta
|
||||
intPar.push_back(par[2]*tanh(0.2707214816*par[0]/par[2]*sqrt(par[4]*(par[0]/t-1.0)))); // DeltaS(T) : tanh(pi kB Tc / Delta(0) * sqrt()), pi kB = 0.2707214816 meV/K
|
||||
intPar.push_back(par[2]*tanh(par[5]*sqrt(par[6]*(par[0]/t-1.0)))); // Delta0_S*tanh(c0_S*sqrt(aG_S*(Tc/T-1)))
|
||||
}
|
||||
|
||||
// double xl[] = {0.0, 0.0}; // lower bound E, phi
|
||||
@@ -705,10 +710,12 @@ double TGapCosSqDWave::operator()(double t, const vector<double> &par) const {
|
||||
*/
|
||||
double TGapSinSqDWave::operator()(double t, const vector<double> &par) const {
|
||||
|
||||
assert((par.size() == 3) || (par.size() == 5)); // three or five parameters: Tc (K), DeltaD(0) (meV), DeltaS(0) (meV), [aD (1), aS (1)]
|
||||
// 3 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 5 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// parameters: [0] Tc (K), [1] Delta0_D (meV), [2] Delta0_S (meV) [[3] c0_D (1), [4] aG_D (1), [5] c0_S (1), [6] aG_S (1)]
|
||||
|
||||
assert((par.size() == 3) || (par.size() == 7)); // 3 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 7 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// and Erratum Supercond. Sci. Technol. 21 (2008) 082003
|
||||
// c0 in the original context is c0 = (pi kB Tc) / Delta0
|
||||
if (t<=0.0)
|
||||
return 1.0;
|
||||
else if (t >= par[0])
|
||||
@@ -754,14 +761,14 @@ double TGapSinSqDWave::operator()(double t, const vector<double> &par) const {
|
||||
if (par.size() == 3) { // Carrington/Manzano
|
||||
intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51)));
|
||||
} else { // Prozorov/Giannetta
|
||||
intPar.push_back(par[1]*tanh(0.2707214816*par[0]/par[1]*sqrt(par[3]*(par[0]/t-1.0)))); // DeltaD(T) : tanh(pi kB Tc / Delta(0) * sqrt()), pi kB = 0.2707214816 meV/K
|
||||
intPar.push_back(par[1]*tanh(par[3]*sqrt(par[4]*(par[0]/t-1.0)))); // Delta0_D*tanh(c0_D*sqrt(aG_D*(Tc/T-1)))
|
||||
}
|
||||
intPar.push_back(1.0*(t+intPar[1])); // upper limit of energy-integration: cutoff energy
|
||||
intPar.push_back(TMath::Pi()); // upper limit of phi-integration
|
||||
if (par.size() == 3) { // Carrington/Manzano
|
||||
intPar.push_back(par[2]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51)));
|
||||
} else { // Prozorov/Giannetta
|
||||
intPar.push_back(par[2]*tanh(0.2707214816*par[0]/par[2]*sqrt(par[4]*(par[0]/t-1.0)))); // DeltaS(T) : tanh(pi kB Tc / Delta(0) * sqrt()), pi kB = 0.2707214816 meV/K
|
||||
intPar.push_back(par[2]*tanh(par[5]*sqrt(par[6]*(par[0]/t-1.0)))); // Delta0_S*tanh(c0_S*sqrt(aG_S*(Tc/T-1)))
|
||||
}
|
||||
|
||||
// double xl[] = {0.0, 0.0}; // lower bound E, phi
|
||||
@@ -792,10 +799,13 @@ double TGapSinSqDWave::operator()(double t, const vector<double> &par) const {
|
||||
*/
|
||||
double TGapAnSWave::operator()(double t, const vector<double> &par) const {
|
||||
|
||||
assert((par.size() == 3) || (par.size() == 4)); // three or four parameters: Tc (K), Delta(0) (meV), a (1), [aS_Gap (1)]
|
||||
// 3 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 4 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// parameters: [0] Tc (K), [1] Delta0 (meV), [2] a (1), [[3] c0 (1), [4] aG (1)]
|
||||
|
||||
assert((par.size() == 3) || (par.size() == 5)); // 3 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 5 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// and Erratum Supercond. Sci. Technol. 21 (2008) 082003
|
||||
// c0 in the original context is c0 = (pi kB Tc) / Delta0
|
||||
|
||||
if (t<=0.0)
|
||||
return 1.0;
|
||||
else if (t >= par[0])
|
||||
@@ -841,7 +851,7 @@ double TGapAnSWave::operator()(double t, const vector<double> &par) const {
|
||||
if (par.size() == 3) { // Carrington/Manzano
|
||||
intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51)));
|
||||
} else { // Prozorov/Giannetta
|
||||
intPar.push_back(par[1]*tanh(0.2707214816*par[0]/par[1]*sqrt(par[3]*(par[0]/t-1.0)))); // DeltaS(T) : tanh(pi kB Tc / Delta(0) * sqrt()), pi kB = 0.2707214816 meV/K
|
||||
intPar.push_back(par[1]*tanh(par[3]*sqrt(par[4]*(par[0]/t-1.0)))); // Delta0*tanh(c0*sqrt(aG*(Tc/T-1)))
|
||||
}
|
||||
intPar.push_back(par[2]);
|
||||
intPar.push_back(4.0*(t+(1.0+par[2])*intPar[1])); // upper limit of energy-integration: cutoff energy
|
||||
@@ -875,10 +885,12 @@ double TGapAnSWave::operator()(double t, const vector<double> &par) const {
|
||||
*/
|
||||
double TGapNonMonDWave1::operator()(double t, const vector<double> &par) const {
|
||||
|
||||
assert((par.size() == 3) || (par.size() == 4)); // three or four parameters: Tc (K), Delta(0) (meV), a (1), [aD_Gap (1)]
|
||||
// 3 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 4 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// parameters: [0] Tc (K), [1] Delta0 (meV), [2] a (1), [[3] c0 (1), [4] aG (1)]
|
||||
|
||||
assert((par.size() == 3) || (par.size() == 5)); // 3 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 5 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// and Erratum Supercond. Sci. Technol. 21 (2008) 082003
|
||||
// c0 in the original context is c0 = (pi kB Tc) / Delta0
|
||||
if (t<=0.0)
|
||||
return 1.0;
|
||||
else if (t >= par[0])
|
||||
@@ -924,7 +936,7 @@ double TGapNonMonDWave1::operator()(double t, const vector<double> &par) const {
|
||||
if (par.size() == 3) { // Carrington/Manzano
|
||||
intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51)));
|
||||
} else { // Prozorov/Giannetta
|
||||
intPar.push_back(par[1]*tanh(0.2707214816*par[0]/par[1]*sqrt(par[3]*(par[0]/t-1.0)))); // DeltaD(T) : tanh(pi kB Tc / Delta(0) * sqrt()), pi kB = 0.2707214816 meV/K
|
||||
intPar.push_back(par[1]*tanh(par[3]*sqrt(par[4]*(par[0]/t-1.0)))); // Delta0*tanh(c0*sqrt(aG*(Tc/T-1)))
|
||||
}
|
||||
intPar.push_back(par[2]);
|
||||
intPar.push_back(4.0*(t+intPar[1])); // upper limit of energy-integration: cutoff energy
|
||||
@@ -955,10 +967,12 @@ double TGapNonMonDWave1::operator()(double t, const vector<double> &par) const {
|
||||
*/
|
||||
double TGapNonMonDWave2::operator()(double t, const vector<double> &par) const {
|
||||
|
||||
assert((par.size() == 3) || (par.size() == 4)); // three parameters: Tc (K), Delta(0) (meV), a (1), [aD_Gap (1)]
|
||||
// 3 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 4 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// parameters: [0] Tc (K), [1] Delta0 (meV), [2] a (1), [[3] c0 (1), [4] aG (1)]
|
||||
|
||||
assert((par.size() == 3) || (par.size() == 5)); // 3 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 5 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// and Erratum Supercond. Sci. Technol. 21 (2008) 082003
|
||||
// c0 in the original context is c0 = (pi kB Tc) / Delta0
|
||||
if (t<=0.0)
|
||||
return 1.0;
|
||||
else if (t >= par[0])
|
||||
@@ -1004,7 +1018,7 @@ double TGapNonMonDWave2::operator()(double t, const vector<double> &par) const {
|
||||
if (par.size() == 3) { // Carrington/Manzano
|
||||
intPar.push_back(par[1]*tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51)));
|
||||
} else { // Prozorov/Giannetta
|
||||
intPar.push_back(par[1]*tanh(0.2707214816*par[0]/par[1]*sqrt(par[3]*(par[0]/t-1.0)))); // DeltaD(T) : tanh(pi kB Tc / Delta(0) * sqrt()), pi kB = 0.2707214816 meV/K
|
||||
intPar.push_back(par[1]*tanh(par[3]*sqrt(par[4]*(par[0]/t-1.0)))); // Delta0*tanh(c0*sqrt(aG*(Tc/T-1)))
|
||||
}
|
||||
intPar.push_back(par[2]);
|
||||
intPar.push_back(4.0*(t+intPar[1])); // upper limit of energy-integration: cutoff energy
|
||||
@@ -1056,9 +1070,10 @@ double TGapPowerLaw::operator()(double t, const vector<double> &par) const {
|
||||
*/
|
||||
double TGapDirtySWave::operator()(double t, const vector<double> &par) const {
|
||||
|
||||
assert((par.size() == 2) || (par.size() == 3)); // two or three parameters: Tc (K), Delta(0) (meV) [a (1)]
|
||||
// 2 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 3 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// parameters: [0] Tc (K), [1] Delta0 (meV), [[2] c0 (1), [3] aG (1)]
|
||||
|
||||
assert((par.size() == 2) || (par.size() == 4)); // 2 parameters: see A.~Carrington and F.~Manzano, Physica~C~\textbf{385}~(2003)~205
|
||||
// 4 parameters: see R. Prozorov and R. Giannetta, Supercond. Sci. Technol. 19 (2006) R41-R67
|
||||
// and Erratum Supercond. Sci. Technol. 21 (2008) 082003
|
||||
if (t<=0.0)
|
||||
return 1.0;
|
||||
@@ -1069,7 +1084,7 @@ double TGapDirtySWave::operator()(double t, const vector<double> &par) const {
|
||||
if (par.size() == 2) { // Carrington/Manzano
|
||||
deltaT = tanh(1.82*pow(1.018*(par[0]/t-1.0),0.51));
|
||||
} else { // Prozorov/Giannetta
|
||||
deltaT = tanh(0.2707214816*par[0]/par[1]*sqrt(par[2]*(par[0]/t-1.0))); // tanh(pi kB Tc / Delta(0) * sqrt()), pi kB = 0.2707214816 meV/K
|
||||
deltaT = tanh(par[2]*sqrt(par[3]*(par[0]/t-1.0))); // tanh(c0*sqrt(aG*(Tc/T-1)))
|
||||
}
|
||||
|
||||
return deltaT*tanh(par[1]*deltaT/(0.172346648*t)); // Delta(T)/Delta(0)*tanh(Delta(T)/2 kB T), kB in meV/K
|
||||
|
||||
@@ -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)'
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
13
src/external/libSpinValve/classes/Makefile.am
vendored
13
src/external/libSpinValve/classes/Makefile.am
vendored
@@ -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)'
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2015 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -70,6 +70,7 @@ class PFourier
|
||||
virtual Double_t GetResolution() { return fResolution; }
|
||||
virtual Double_t GetMaxFreq();
|
||||
virtual TH1F* GetRealFourier(const Double_t scale = 1.0);
|
||||
virtual TH1F* GetPhaseOptRealFourier(Double_t &phase, const Double_t scale = 1.0, const Double_t min = -1.0, const Double_t max = -1.0);
|
||||
virtual TH1F* GetImaginaryFourier(const Double_t scale = 1.0);
|
||||
virtual TH1F* GetPowerFourier(const Double_t scale = 1.0);
|
||||
virtual TH1F* GetPhaseFourier(const Double_t scale = 1.0);
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2015 by Andreas Suter *
|
||||
|
||||
PFourierCanvas.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 *
|
||||
@@ -43,23 +52,26 @@
|
||||
#define P_MENU_ID_AVERAGE_PER_DATA_SET 10003
|
||||
#define P_MENU_ID_EXPORT_DATA 10004
|
||||
|
||||
#define P_MENU_ID_FOURIER_REAL 100
|
||||
#define P_MENU_ID_FOURIER_IMAG 101
|
||||
#define P_MENU_ID_FOURIER_REAL_AND_IMAG 102
|
||||
#define P_MENU_ID_FOURIER_PWR 103
|
||||
#define P_MENU_ID_FOURIER_PHASE 104
|
||||
#define P_MENU_ID_FOURIER_PHASE_PLUS 105
|
||||
#define P_MENU_ID_FOURIER_PHASE_MINUS 106
|
||||
#define P_MENU_ID_FOURIER_REAL 100
|
||||
#define P_MENU_ID_FOURIER_IMAG 101
|
||||
#define P_MENU_ID_FOURIER_REAL_AND_IMAG 102
|
||||
#define P_MENU_ID_FOURIER_PWR 103
|
||||
#define P_MENU_ID_FOURIER_PHASE 104
|
||||
#define P_MENU_ID_FOURIER_PHASE_OPT_REAL 105
|
||||
#define P_MENU_ID_FOURIER_PHASE_PLUS 106
|
||||
#define P_MENU_ID_FOURIER_PHASE_MINUS 107
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Structure holding all necessary Fourier histograms.
|
||||
*/
|
||||
typedef struct {
|
||||
TH1F *dataFourierRe; ///< real part of the Fourier transform of the data histogram
|
||||
TH1F *dataFourierIm; ///< imaginary part of the Fourier transform of the data histogram
|
||||
TH1F *dataFourierPwr; ///< power spectrum of the Fourier transform of the data histogram
|
||||
TH1F *dataFourierPhase; ///< phase spectrum of the Fourier transform of the data histogram
|
||||
TH1F *dataFourierRe; ///< real part of the Fourier transform of the data histogram
|
||||
TH1F *dataFourierIm; ///< imaginary part of the Fourier transform of the data histogram
|
||||
TH1F *dataFourierPwr; ///< power spectrum of the Fourier transform of the data histogram
|
||||
TH1F *dataFourierPhase; ///< phase spectrum of the Fourier transform of the data histogram
|
||||
TH1F *dataFourierPhaseOptReal; ///< phase otpimized real Fourier transform of the data histogram
|
||||
Double_t optPhase; ///< optimal phase which maximizes the real Fourier
|
||||
} PFourierCanvasDataSet;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2015 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2014 by Bastian M. Wojek / Andreas Suter *
|
||||
* Copyright (C) 2009-2016 by Bastian M. Wojek / Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -102,6 +102,7 @@ class PMsrHandler
|
||||
virtual Bool_t CheckFuncs();
|
||||
virtual Bool_t CheckHistoGrouping();
|
||||
virtual Bool_t CheckAddRunParameters();
|
||||
virtual Bool_t CheckRRFSettings();
|
||||
virtual void CheckMaxLikelihood();
|
||||
|
||||
virtual void GetGroupingString(Int_t runNo, TString detector, TString &groupingStr);
|
||||
@@ -152,7 +153,6 @@ class PMsrHandler
|
||||
virtual UInt_t NeededPrecision(Double_t dval, UInt_t precLimit=13);
|
||||
virtual UInt_t LastSignificant(Double_t dval, UInt_t precLimit=6);
|
||||
|
||||
virtual Bool_t ParseDetectorGrouping(TString str, PIntVector &group);
|
||||
virtual void MakeDetectorGroupingString(TString str, PIntVector &group, TString &result, Bool_t includeDetector = true);
|
||||
|
||||
virtual void CheckLegacyLifetimecorrection();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2015 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -52,10 +52,12 @@ typedef struct { char a[7]; } __float128; // needed since cint doesn't know it
|
||||
#define PMUSR_MSR_FILE_WRITE_ERROR -7
|
||||
#define PMUSR_DATA_FILE_READ_ERROR -8
|
||||
|
||||
#define PRUN_SINGLE_HISTO 0
|
||||
#define PRUN_ASYMMETRY 2
|
||||
#define PRUN_MU_MINUS 4
|
||||
#define PRUN_NON_MUSR 8
|
||||
#define PRUN_SINGLE_HISTO 0
|
||||
#define PRUN_SINGLE_HISTO_RRF 1
|
||||
#define PRUN_ASYMMETRY 2
|
||||
#define PRUN_ASYMMETRY_RRF 3
|
||||
#define PRUN_MU_MINUS 4
|
||||
#define PRUN_NON_MUSR 8
|
||||
|
||||
// muon life time in (us), see PRL99, 032001 (2007)
|
||||
#define PMUON_LIFETIME 2.197019
|
||||
@@ -92,17 +94,21 @@ typedef struct { char a[7]; } __float128; // needed since cint doesn't know it
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// msr fit type tags
|
||||
#define MSR_FITTYPE_SINGLE_HISTO 0
|
||||
#define MSR_FITTYPE_ASYM 2
|
||||
#define MSR_FITTYPE_MU_MINUS 4
|
||||
#define MSR_FITTYPE_NON_MUSR 8
|
||||
#define MSR_FITTYPE_SINGLE_HISTO 0
|
||||
#define MSR_FITTYPE_SINGLE_HISTO_RRF 1
|
||||
#define MSR_FITTYPE_ASYM 2
|
||||
#define MSR_FITTYPE_ASYM_RRF 3
|
||||
#define MSR_FITTYPE_MU_MINUS 4
|
||||
#define MSR_FITTYPE_NON_MUSR 8
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// msr plot type tags
|
||||
#define MSR_PLOT_SINGLE_HISTO 0
|
||||
#define MSR_PLOT_ASYM 2
|
||||
#define MSR_PLOT_MU_MINUS 4
|
||||
#define MSR_PLOT_NON_MUSR 8
|
||||
#define MSR_PLOT_SINGLE_HISTO 0
|
||||
#define MSR_PLOT_SINGLE_HISTO_RRF 1
|
||||
#define MSR_PLOT_ASYM 2
|
||||
#define MSR_PLOT_ASYM_RRF 3
|
||||
#define MSR_PLOT_MU_MINUS 4
|
||||
#define MSR_PLOT_NON_MUSR 8
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// map and fun offsets for parameter parsing
|
||||
@@ -123,20 +129,24 @@ typedef struct { char a[7]; } __float128; // needed since cint doesn't know it
|
||||
#define FOURIER_APOD_MEDIUM 3
|
||||
#define FOURIER_APOD_STRONG 4
|
||||
|
||||
#define FOURIER_PLOT_NOT_GIVEN 0
|
||||
#define FOURIER_PLOT_REAL 1
|
||||
#define FOURIER_PLOT_IMAG 2
|
||||
#define FOURIER_PLOT_REAL_AND_IMAG 3
|
||||
#define FOURIER_PLOT_POWER 4
|
||||
#define FOURIER_PLOT_PHASE 5
|
||||
#define FOURIER_PLOT_NOT_GIVEN 0
|
||||
#define FOURIER_PLOT_REAL 1
|
||||
#define FOURIER_PLOT_IMAG 2
|
||||
#define FOURIER_PLOT_REAL_AND_IMAG 3
|
||||
#define FOURIER_PLOT_POWER 4
|
||||
#define FOURIER_PLOT_PHASE 5
|
||||
#define FOURIER_PLOT_PHASE_OPT_REAL 6
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// RRF related tags
|
||||
#define RRF_UNIT_kHz 0
|
||||
#define RRF_UNIT_MHz 1
|
||||
#define RRF_UNIT_Mcs 2
|
||||
#define RRF_UNIT_G 3
|
||||
#define RRF_UNIT_T 4
|
||||
#define RRF_UNIT_UNDEF -1
|
||||
#define RRF_UNIT_kHz 0
|
||||
#define RRF_UNIT_MHz 1
|
||||
#define RRF_UNIT_Mcs 2
|
||||
#define RRF_UNIT_G 3
|
||||
#define RRF_UNIT_T 4
|
||||
|
||||
#define RRF_FREQ_UNDEF 1.0e10
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
@@ -541,6 +551,11 @@ class PMsrGlobalBlock {
|
||||
virtual ~PMsrGlobalBlock() {}
|
||||
|
||||
virtual Bool_t IsPresent() { return fGlobalPresent; }
|
||||
virtual Double_t GetRRFFreq(const char *unit);
|
||||
virtual TString GetRRFUnit();
|
||||
virtual Int_t GetRRFUnitTag() { return fRRFUnitTag; }
|
||||
virtual Double_t GetRRFPhase() { return fRRFPhase; }
|
||||
virtual Int_t GetRRFPacking() { return fRRFPacking; }
|
||||
virtual Int_t GetFitType() { return fFitType; }
|
||||
virtual Int_t GetDataRange(UInt_t idx);
|
||||
virtual UInt_t GetT0BinSize() { return fT0.size(); }
|
||||
@@ -554,6 +569,9 @@ class PMsrGlobalBlock {
|
||||
virtual Int_t GetPacking() { return fPacking; }
|
||||
|
||||
virtual void SetGlobalPresent(Bool_t bval) { fGlobalPresent = bval; }
|
||||
virtual void SetRRFFreq(Double_t freq, const char *unit);
|
||||
virtual void SetRRFPhase(Double_t phase) { fRRFPhase = phase; }
|
||||
virtual void SetRRFPacking(Int_t pack);
|
||||
virtual void SetFitType(Int_t ival) { fFitType = ival; }
|
||||
virtual void SetDataRange(Int_t ival, Int_t idx);
|
||||
virtual void SetT0Bin(Double_t dval, Int_t idx=-1);
|
||||
@@ -565,10 +583,14 @@ class PMsrGlobalBlock {
|
||||
|
||||
private:
|
||||
Bool_t fGlobalPresent; ///< flag showing if a GLOBAL block is present at all.
|
||||
Int_t fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=mu^- single histo fit, 8=non muSR fit
|
||||
Int_t fDataRange[4]; ///< data bin range (fit type 0, 2, 4)
|
||||
PDoubleVector fT0; ///< t0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ...
|
||||
vector<PDoubleVector> fAddT0; ///< addt0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ...
|
||||
Double_t fRRFFreq; ///< RRF frequency given in units of (MHz, Mc, T)
|
||||
Int_t fRRFUnitTag; ///< RRF unit tag
|
||||
Double_t fRRFPhase; ///< RRF phase in (°)
|
||||
Int_t fRRFPacking; ///< RRF packing
|
||||
Int_t fFitType; ///< fit type: 0=single histo fit, 1=single histo RRF fit, 2=asymmetry fit, 4=mu^- single histo fit, 8=non muSR fit
|
||||
Int_t fDataRange[4]; ///< data bin range (fit type 0, 1, 2, 4)
|
||||
PDoubleVector fT0; ///< t0 bins (fit type 0, 1, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ...
|
||||
vector<PDoubleVector> fAddT0; ///< addt0 bins (fit type 0, 1, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ...
|
||||
Bool_t fFitRangeInBins; ///< flag telling if fit range is given in time or in bins
|
||||
Double_t fFitRange[2]; ///< fit range in (us)
|
||||
Int_t fFitRangeOffset[2]; ///< if fit range is given in bins it can have the form fit fgb+n0 lgb-n1. This variable holds the n0 and n1.
|
||||
@@ -780,6 +802,7 @@ typedef struct {
|
||||
TString outTemplate; ///< holds the output file template
|
||||
TString year; ///< holds the information about the year to be used
|
||||
PIntVector runList; ///< holds the run number list to be converted
|
||||
PIntVector groupHistoList; ///< holds the histo group list offset (used to define for MusrRoot files, what to be exported)
|
||||
PStringVector inFileName; ///< holds the file name of the input data file
|
||||
TString outFileName; ///< holds the output file name
|
||||
PStringVector outPathFileName; ///< holds the out path/file name
|
||||
@@ -801,4 +824,29 @@ typedef struct {
|
||||
Bool_t useDKS; ///< if set to true, use DKS if present and "sensible"
|
||||
} PStartupOptions;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>Helper class which parses list of numbers of the following 3 forms and its combination.
|
||||
* (i) list of integers separted by spaces, e.g. 1 3 7 14
|
||||
* (ii) a range of integers of the form nS-nE, e.g. 13-27 which will generate 13, 14, 15, .., 26, 27
|
||||
* (iii) a sequence of integers of the form nS:nE:nStep, e.g. 10:20:2 which will generate 10, 12, 14, .., 18, 20
|
||||
*/
|
||||
class PStringNumberList {
|
||||
public:
|
||||
PStringNumberList(char *str) { fString = str; }
|
||||
PStringNumberList(string str) { fString = str; }
|
||||
virtual ~PStringNumberList() { fList.clear(); }
|
||||
|
||||
virtual bool Parse(string &errorMsg, bool ignoreFirstToken=false);
|
||||
virtual PUIntVector GetList() { return fList; }
|
||||
|
||||
private:
|
||||
string fString;
|
||||
bool fIsValid;
|
||||
PUIntVector fList;
|
||||
|
||||
virtual bool IsNumber(string &str) { return (str.find_first_not_of("0123456789") == string::npos); }
|
||||
virtual void StripSpaces();
|
||||
};
|
||||
|
||||
#endif // _PMUSR_H_
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -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;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
@@ -334,6 +332,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)
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2015 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
81
src/include/PRunAsymmetryRRF.h
Normal file
81
src/include/PRunAsymmetryRRF.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/***************************************************************************
|
||||
|
||||
PRunAsymmetryRRF.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 _PRUNASYMMETRYRRF_H_
|
||||
#define _PRUNASYMMETRYRRF_H_
|
||||
|
||||
#include "PRunBase.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Class handling the asymmetry fit.
|
||||
*/
|
||||
class PRunAsymmetryRRF : public PRunBase
|
||||
{
|
||||
public:
|
||||
PRunAsymmetryRRF();
|
||||
PRunAsymmetryRRF(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag);
|
||||
virtual ~PRunAsymmetryRRF();
|
||||
|
||||
virtual Double_t CalcChiSquare(const std::vector<Double_t>& par);
|
||||
virtual Double_t CalcChiSquareExpected(const std::vector<Double_t>& par);
|
||||
virtual Double_t CalcMaxLikelihood(const std::vector<Double_t>& par);
|
||||
virtual void CalcTheory();
|
||||
|
||||
virtual UInt_t GetNoOfFitBins();
|
||||
|
||||
virtual void SetFitRangeBin(const TString fitRange);
|
||||
|
||||
protected:
|
||||
virtual void CalcNoOfFitBins();
|
||||
virtual Bool_t PrepareData();
|
||||
virtual Bool_t PrepareFitData();
|
||||
virtual Bool_t PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]);
|
||||
|
||||
private:
|
||||
UInt_t fAlphaBetaTag; ///< \f$ 1 \to \alpha = \beta = 1\f$; \f$ 2 \to \alpha \neq 1, \beta = 1\f$; \f$ 3 \to \alpha = 1, \beta \neq 1\f$; \f$ 4 \to \alpha \neq 1, \beta \neq 1\f$.
|
||||
UInt_t fNoOfFitBins; ///< number of bins to be be fitted
|
||||
Int_t fRRFPacking; ///< RRF packing for this particular run. Given in the GLOBAL-block.
|
||||
|
||||
PDoubleVector fForward; ///< forward histo data
|
||||
PDoubleVector fForwardErr; ///< forward histo errors
|
||||
PDoubleVector fBackward; ///< backward histo data
|
||||
PDoubleVector fBackwardErr; ///< backward histo errors
|
||||
|
||||
Int_t fGoodBins[4]; ///< keep first/last good bins. 0=fgb, 1=lgb (forward); 2=fgb, 3=lgb (backward)
|
||||
|
||||
Bool_t SubtractFixBkg();
|
||||
Bool_t SubtractEstimatedBkg();
|
||||
|
||||
virtual Bool_t GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlock, PUIntVector &forwardHisto, PUIntVector &backwardHistoNo);
|
||||
virtual Bool_t GetProperDataRange(PRawRunData* runData, UInt_t histoNo[2]);
|
||||
virtual void GetProperFitRange(PMsrGlobalBlock *globalBlock);
|
||||
};
|
||||
|
||||
#endif // _PRUNASYMMETRYRRF_H_
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2015 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
@@ -37,7 +37,9 @@ using namespace std;
|
||||
#include "PMsrHandler.h"
|
||||
#include "PRunDataHandler.h"
|
||||
#include "PRunSingleHisto.h"
|
||||
#include "PRunSingleHistoRRF.h"
|
||||
#include "PRunAsymmetry.h"
|
||||
#include "PRunAsymmetryRRF.h"
|
||||
#include "PRunMuMinus.h"
|
||||
#include "PRunNonMusr.h"
|
||||
|
||||
@@ -58,7 +60,9 @@ class PRunListCollection
|
||||
virtual void SetFitRange(const TString fitRange);
|
||||
|
||||
virtual Double_t GetSingleHistoChisq(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetSingleHistoRRFChisq(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetAsymmetryChisq(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetAsymmetryRRFChisq(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetMuMinusChisq(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetNonMusrChisq(const std::vector<Double_t>& par) const;
|
||||
|
||||
@@ -66,7 +70,9 @@ class PRunListCollection
|
||||
virtual Double_t GetSingleRunChisq(const std::vector<Double_t>& par, const UInt_t idx) const;
|
||||
|
||||
virtual Double_t GetSingleHistoMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetSingleHistoRRFMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetAsymmetryMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetAsymmetryRRFMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetMuMinusMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
virtual Double_t GetNonMusrMaximumLikelihood(const std::vector<Double_t>& par) const;
|
||||
|
||||
@@ -74,12 +80,16 @@ class PRunListCollection
|
||||
virtual UInt_t GetTotalNoOfBinsFitted() const;
|
||||
|
||||
virtual UInt_t GetNoOfSingleHisto() const { return fRunSingleHistoList.size(); } ///< returns the number of single histogram data sets present in the msr-file
|
||||
virtual UInt_t GetNoOfSingleHistoRRF() const { return fRunSingleHistoRRFList.size(); } ///< returns the number of single histogram RRF data sets present in the msr-file
|
||||
virtual UInt_t GetNoOfAsymmetry() const { return fRunAsymmetryList.size(); } ///< returns the number of asymmetry data sets present in the msr-file
|
||||
virtual UInt_t GetNoOfAsymmetryRRF() const { return fRunAsymmetryRRFList.size(); } ///< returns the number of asymmetry RRF data sets present in the msr-file
|
||||
virtual UInt_t GetNoOfMuMinus() const { return fRunMuMinusList.size(); } ///< returns the number of mu minus data sets present in the msr-file
|
||||
virtual UInt_t GetNoOfNonMusr() const { return fRunNonMusrList.size(); } ///< returns the number of non-muSR data sets present in the msr-file
|
||||
|
||||
virtual PRunData* GetSingleHisto(UInt_t index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetSingleHistoRRF(UInt_t index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetAsymmetry(UInt_t index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetAsymmetryRRF(UInt_t index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetMuMinus(UInt_t index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetNonMusr(UInt_t index, EDataSwitch tag=kIndex);
|
||||
|
||||
@@ -94,10 +104,12 @@ class PRunListCollection
|
||||
PMsrHandler *fMsrInfo; ///< pointer to the msr-file handler
|
||||
PRunDataHandler *fData; ///< pointer to the run-data handler
|
||||
|
||||
vector<PRunSingleHisto*> fRunSingleHistoList; ///< stores all processed single histogram data
|
||||
vector<PRunAsymmetry*> fRunAsymmetryList; ///< stores all processed asymmetry data
|
||||
vector<PRunMuMinus*> fRunMuMinusList; ///< stores all processed mu-minus data
|
||||
vector<PRunNonMusr*> fRunNonMusrList; ///< stores all processed non-muSR data
|
||||
vector<PRunSingleHisto*> fRunSingleHistoList; ///< stores all processed single histogram data
|
||||
vector<PRunSingleHistoRRF*> fRunSingleHistoRRFList; ///< stores all processed single histogram RRF data
|
||||
vector<PRunAsymmetry*> fRunAsymmetryList; ///< stores all processed asymmetry data
|
||||
vector<PRunAsymmetryRRF*> fRunAsymmetryRRFList; ///< stores all processed asymmetry RRF data
|
||||
vector<PRunMuMinus*> fRunMuMinusList; ///< stores all processed mu-minus data
|
||||
vector<PRunNonMusr*> fRunNonMusrList; ///< stores all processed non-muSR data
|
||||
};
|
||||
|
||||
#endif // _PRUNLISTCOLLECTION_H_
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
83
src/include/PRunSingleHistoRRF.h
Normal file
83
src/include/PRunSingleHistoRRF.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/***************************************************************************
|
||||
|
||||
PRunSingleHistoRRF.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 _PRUNSINGLEHISTORRF_H_
|
||||
#define _PRUNSINGLEHISTORRF_H_
|
||||
|
||||
#include "PRunBase.h"
|
||||
|
||||
/**
|
||||
* <p>Class handling single histogram fit type.
|
||||
*/
|
||||
class PRunSingleHistoRRF : public PRunBase
|
||||
{
|
||||
public:
|
||||
PRunSingleHistoRRF();
|
||||
PRunSingleHistoRRF(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag);
|
||||
virtual ~PRunSingleHistoRRF();
|
||||
|
||||
virtual Double_t CalcChiSquare(const std::vector<Double_t>& par);
|
||||
virtual Double_t CalcChiSquareExpected(const std::vector<Double_t>& par);
|
||||
virtual Double_t CalcMaxLikelihood(const std::vector<Double_t>& par);
|
||||
virtual void CalcTheory();
|
||||
|
||||
virtual UInt_t GetNoOfFitBins();
|
||||
|
||||
virtual void SetFitRangeBin(const TString fitRange);
|
||||
|
||||
protected:
|
||||
virtual void CalcNoOfFitBins();
|
||||
virtual Bool_t PrepareData();
|
||||
virtual Bool_t PrepareFitData(PRawRunData* runData, const UInt_t histoNo);
|
||||
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 ...
|
||||
|
||||
UInt_t fNoOfFitBins; ///< number of bins to be fitted
|
||||
Double_t fBackground; ///< needed if background range is given (units: 1/bin)
|
||||
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
|
||||
|
||||
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)).
|
||||
PDoubleVector fW; ///< vector holding the weight needed to estimate N0, and errN0.
|
||||
PDoubleVector fAerr; ///< vector holding the errors of estimated A(t)
|
||||
|
||||
virtual Bool_t GetProperT0(PRawRunData* runData, PMsrGlobalBlock *globalBlock, PUIntVector &histoNo);
|
||||
virtual Bool_t GetProperDataRange();
|
||||
virtual void GetProperFitRange(PMsrGlobalBlock *globalBlock);
|
||||
virtual Double_t GetMainFrequency(PDoubleVector &data);
|
||||
virtual Double_t EstimateN0(Double_t &errN0, Double_t freqMax);
|
||||
virtual Bool_t EstimateBkg(UInt_t histoNo);
|
||||
};
|
||||
|
||||
#endif // _PRUNSINGLEHISTORRF_H_
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2014 by Andreas Suter *
|
||||
* Copyright (C) 2007-2016 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#endif
|
||||
|
||||
#include "git-revision.h"
|
||||
#include "PMusr.h"
|
||||
#include "PMsr2Data.h"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -87,12 +88,17 @@ void msr2data_syntax()
|
||||
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 \\[<run1> <run2> ... <runN>\\] <extension> [-o<outputfile> ] [new] [data] [[no]header] [nosummary] [global[+[!]]]";
|
||||
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;
|
||||
cout << endl << " <run>, <run1>, <run2>, ... <runN> : run numbers";
|
||||
cout << endl << " <runList> can be:";
|
||||
cout << endl << " (i) <run0>, <run1>, <run2>, ... <runN> : run numbers, e.g. 123 124";
|
||||
cout << endl << " (ii) <run0>-<runN> : a range, e.g. 123-125 -> 123 124 125";
|
||||
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 << " <extension> : msr-file extension, e.g. _tf_h13 for the file name 8472_tf_h13.msr";
|
||||
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.";
|
||||
@@ -125,9 +131,27 @@ void msr2data_syntax()
|
||||
cout << endl << " from this pre-analysis for each run---they are not just copied from the template.";
|
||||
cout << endl << " The specification of '!' determines which fit mode (see above) is used for this pre-analysis.";
|
||||
cout << endl;
|
||||
cout << endl << " Typical examples:";
|
||||
cout << endl;
|
||||
cout << endl << " msr2data 2047 2050 _tf_histo fit-2046";
|
||||
cout << endl << " will use 2046_tf_histo.msr as templete, and subsequently generating 2047_tf_histo.msr until";
|
||||
cout << endl << " 2050_tf_histo.msr and fit them.";
|
||||
cout << endl;
|
||||
cout << endl << " msr2data 2047 2050 _tf_histo msr-2046";
|
||||
cout << endl << " will use 2046_tf_histo.msr as templete, and subsequently generating 2047_tf_histo.msr until";
|
||||
cout << endl << " 2050_tf_histo.msr, but NO fitting will be done.";
|
||||
cout << endl;
|
||||
cout << endl << " msr2data 2046 2050 _tf_histo -o fitParam.db";
|
||||
cout << endl << " will collect the fit parameters from runs 2046-2050 (msr-files 2046_tf_histo.msr etc.) and";
|
||||
cout << endl << " write them to the file fitParam.db (DB-format).";
|
||||
cout << endl;
|
||||
cout << endl << " msr2data [2047:2053:2 2056] _tf_histo fit-2045";
|
||||
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 << " For further information please refer to";
|
||||
cout << endl << " https://intranet.psi.ch/MUSR/Msr2Data";
|
||||
cout << endl << " http://lmu.web.psi.ch/facilities/software/musrfit/user/intranet.psi.ch/MUSR/Msr2Data.html";
|
||||
cout << endl << " http://lmu.web.psi.ch/musrfit/user/MUSR/Msr2Data.html";
|
||||
cout << endl << " https://intranet.psi.ch/MUSR/Msr2Data";
|
||||
cout << endl << endl;
|
||||
}
|
||||
|
||||
@@ -449,8 +473,26 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (unsigned int i(firstRunNumberInArg); i<=lastRunNumberInArg; ++i)
|
||||
run_vec.push_back(boost::lexical_cast<unsigned int>(arg[i]));
|
||||
// generate run_list string
|
||||
for (unsigned int i(firstRunNumberInArg); i<=lastRunNumberInArg; ++i) {
|
||||
run_list += arg[i] + " ";
|
||||
}
|
||||
// parse run_list string
|
||||
PStringNumberList *nl = new PStringNumberList(run_list);
|
||||
if (nl == 0) { // couldn't invoke object
|
||||
cerr << endl;
|
||||
cerr << ">> msr2data: **ERROR** Couldn't invoke run_list parser object! Quitting now." << endl;
|
||||
return 0;
|
||||
}
|
||||
string errorMsg("");
|
||||
if (!nl->Parse(errorMsg)) {
|
||||
cerr << endl;
|
||||
cerr << ">> msr2data: " << errorMsg << " - Quitting now." << endl;
|
||||
return 0;
|
||||
}
|
||||
// get run list vector
|
||||
run_vec = nl->GetList();
|
||||
delete nl;
|
||||
|
||||
msrExtension = arg[rightbracket + 1];
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ typedef struct {
|
||||
TString msrFlnOut; ///< dump file name for msr-file generation
|
||||
Int_t bkg_range[2]; ///< background range
|
||||
PDoubleVector bkg; ///< background value
|
||||
TString fourierOpt; ///< Fourier options, i.e. real, imag, power, phase
|
||||
TString fourierOpt; ///< Fourier options, i.e. real, imag, power, phase, phaseOptReal
|
||||
TString apodization; ///< apodization setting: none, weak, medium, strong
|
||||
Int_t fourierPower; ///< Fourier power for zero padding, i.e. 2^fourierPower points
|
||||
TString fourierUnits; ///< wished Fourier units: Gauss, Tesla, MHz, Mc/s
|
||||
@@ -116,7 +116,7 @@ void musrFT_syntax()
|
||||
cout << endl << " -br, --background-range <start> <end>: background interval used to estimate the background to be";
|
||||
cout << endl << " subtracted before the Fourier transform. <start>, <end> to be given in bins.";
|
||||
cout << endl << " -bg, --background <list> : gives the background explicit for each histogram.";
|
||||
cout << endl << " -fo, --fourier-option <fopt>: <fopt> can be 'real', 'imag', 'real+imag', 'power', or 'phase'.";
|
||||
cout << endl << " -fo, --fourier-option <fopt>: <fopt> can be 'real', 'imag', 'real+imag', 'power', 'phase', or 'phaseOptReal'.";
|
||||
cout << endl << " If this is not defined (neither on the command line nor in the musrfit_startup.xml),";
|
||||
cout << endl << " default will be 'power'.";
|
||||
cout << endl << " -ap, --apodization <val> : <val> can be either 'none', 'weak', 'medium', 'strong'.";
|
||||
@@ -377,7 +377,8 @@ Int_t musrFT_parse_options(Int_t argc, Char_t *argv[], musrFT_startup_param &sta
|
||||
return 2;
|
||||
}
|
||||
TString topt(argv[i+1]);
|
||||
if (!topt.BeginsWith("real") && !topt.BeginsWith("imag") && !topt.BeginsWith("power") && !topt.BeginsWith("phase")) {
|
||||
if (!topt.BeginsWith("real") && !topt.BeginsWith("imag") && !topt.BeginsWith("power") &&
|
||||
!topt.BeginsWith("phase") && !topt.BeginsWith("phaseOptReal")) {
|
||||
cerr << endl << ">> musrFT **ERROR** found option --fourier-option with unrecognized argument '" << topt << "'." << endl;
|
||||
return 2;
|
||||
}
|
||||
@@ -963,9 +964,9 @@ void musrFT_dumpMsrFile(musrFT_startup_param ¶m)
|
||||
fout << "units " << param.fourierUnits << " # units either 'Gauss', 'MHz', or 'Mc/s'" << endl;
|
||||
}
|
||||
if (param.fourierOpt.BeginsWith("??")) { // Fourier plot option not given, hence choose POWER
|
||||
fout << "plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE" << endl;
|
||||
fout << "plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL" << endl;
|
||||
} else {
|
||||
fout << "plot " << param.fourierOpt << " # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE" << endl;
|
||||
fout << "plot " << param.fourierOpt << " # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL" << endl;
|
||||
}
|
||||
if (param.fourierPower > 1) {
|
||||
fout << "fourier_power " << param.fourierPower << endl;
|
||||
@@ -1398,6 +1399,8 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
fourierPlotTag = FOURIER_PLOT_POWER;
|
||||
else if (!startupParam.fourierOpt.CompareTo("phase", TString::kIgnoreCase))
|
||||
fourierPlotTag = FOURIER_PLOT_PHASE;
|
||||
else if (!startupParam.fourierOpt.CompareTo("phaseoptreal", TString::kIgnoreCase))
|
||||
fourierPlotTag = FOURIER_PLOT_PHASE_OPT_REAL;
|
||||
else
|
||||
fourierPlotTag = FOURIER_PLOT_POWER;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
## Process this file with automake to create Makefile.in
|
||||
|
||||
CLEANFILES = *~ core
|
||||
CLEANFILES = *~ core moc_* ui_*
|
||||
|
||||
|
||||
|
||||
@@ -603,6 +603,7 @@ PAdmin::PAdmin() : QObject()
|
||||
fFontName = QString("Courier"); // default font
|
||||
fFontSize = 11; // default font size
|
||||
|
||||
fPrefPathName = QString("");
|
||||
fExecPath = QString("");
|
||||
fDefaultSavePath = QString("");
|
||||
fMsrDefaultFilePath = QString("");
|
||||
@@ -641,25 +642,28 @@ PAdmin::PAdmin() : QObject()
|
||||
fMsr2DataParam.globalPlus = false;
|
||||
|
||||
// XML Parser part
|
||||
QString fln = "musredit_startup.xml";
|
||||
// check if it is a MacOSX
|
||||
#ifdef Q_WS_MAC
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml";
|
||||
// 1st: check local directory
|
||||
QString path = QString("./");
|
||||
QString fln = QString("musredit_startup.xml");
|
||||
QString pathFln = path + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 2nd: check $HOME/.musrfit/musredit/musredit_startup.xml
|
||||
path = std::getenv("HOME");
|
||||
pathFln = path + "/.musrfit/musredit/" + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 3rd: check $MUSRFITPATH/musredit_startup.xml
|
||||
path = std::getenv("MUSRFITPATH");
|
||||
pathFln = path + "/" + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 4th: check $ROOTSYS/bin/musredit_startup.xml
|
||||
path = std::getenv("ROOTSYS");
|
||||
pathFln = path + "/bin/" + fln;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
QString path = std::getenv("MUSRFITPATH");
|
||||
QString rootsys = std::getenv("ROOTSYS");
|
||||
if (path.isEmpty())
|
||||
path = rootsys + "/bin";
|
||||
fln = path + "/musredit_startup.xml";
|
||||
}
|
||||
#endif
|
||||
fPrefPathName = pathFln;
|
||||
|
||||
loadPrefs(fln);
|
||||
loadPrefs(fPrefPathName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -769,25 +773,10 @@ int PAdmin::savePrefs(QString pref_fln)
|
||||
{
|
||||
// check if musredit_startup.xml is present in the current directory, and if yes, use this file to
|
||||
// save the recent file names otherwise use the "master" musredit_startup.xml
|
||||
QString fln = QString("./musredit_startup.xml");
|
||||
if (!QFile::exists(fln))
|
||||
fln = fPrefPathName;
|
||||
|
||||
QString str;
|
||||
QString fln = "musredit_startup.xml";
|
||||
// check if it is a MacOSX
|
||||
#ifdef Q_WS_MAC
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml";
|
||||
}
|
||||
#else
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
QString path = std::getenv("MUSRFITPATH");
|
||||
QString rootsys = std::getenv("ROOTSYS");
|
||||
if (path.isEmpty())
|
||||
path = rootsys + "/bin";
|
||||
fln = path + "/musredit_startup.xml";
|
||||
}
|
||||
#endif
|
||||
if (QFile::exists(fln)) { // administration file present
|
||||
QVector<QString> data;
|
||||
QFile file(fln);
|
||||
@@ -842,6 +831,12 @@ int PAdmin::savePrefs(QString pref_fln)
|
||||
else
|
||||
data[i] = " <estimate_n0>n</estimate_n0>";
|
||||
}
|
||||
if (data[i].contains("<musrview_show_fourier>") && data[i].contains("</musrview_show_fourier>")) {
|
||||
if (fMusrviewShowFourier)
|
||||
data[i] = " <musrview_show_fourier>y</musrview_show_fourier>";
|
||||
else
|
||||
data[i] = " <musrview_show_fourier>n</musrview_show_fourier>";
|
||||
}
|
||||
if (data[i].contains("<enable_musrt0>") && data[i].contains("</enable_musrt0>")) {
|
||||
if (fEnableMusrT0)
|
||||
data[i] = " <enable_musrt0>y</enable_musrt0>";
|
||||
@@ -853,13 +848,16 @@ int PAdmin::savePrefs(QString pref_fln)
|
||||
// write prefs
|
||||
file.setFileName(pref_fln);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
cerr << endl << ">> PAdmin::savePrefs: **ERROR** Cannot open " << fln.toLatin1().data() << " for writing." << endl;
|
||||
cerr << endl << ">> PAdmin::savePrefs: **ERROR** Cannot open " << pref_fln.toLatin1().data() << " for writing." << endl;
|
||||
return 0;
|
||||
}
|
||||
fin.setDevice(&file);
|
||||
for (int i=0; i<data.size(); i++)
|
||||
fin << data[i] << endl;
|
||||
file.close();
|
||||
} else {
|
||||
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
|
||||
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -894,25 +892,11 @@ void PAdmin::saveRecentFiles()
|
||||
{
|
||||
// check if musredit_startup.xml is present in the current directory, and if yes, use this file to
|
||||
// save the recent file names otherwise use the "master" musredit_startup.xml
|
||||
QString str("");
|
||||
QString fln = QString("./musredit_startup.xml");
|
||||
if (!QFile::exists(fln))
|
||||
fln = fPrefPathName;
|
||||
|
||||
QString str;
|
||||
QString fln = "musredit_startup.xml";
|
||||
// check if it is a MacOSX
|
||||
#ifdef Q_WS_MAC
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
fln = "/Applications/musredit.app/Contents/Resources/musredit_startup.xml";
|
||||
}
|
||||
#else
|
||||
fln = "./musredit_startup.xml";
|
||||
if (!QFile::exists(fln)) {
|
||||
QString path = std::getenv("MUSRFITPATH");
|
||||
QString rootsys = std::getenv("ROOTSYS");
|
||||
if (path.isEmpty())
|
||||
path = rootsys + "/bin";
|
||||
fln = path + "/musredit_startup.xml";
|
||||
}
|
||||
#endif
|
||||
if (QFile::exists(fln)) { // administration file present
|
||||
QVector<QString> data;
|
||||
QFile file(fln);
|
||||
@@ -959,6 +943,9 @@ void PAdmin::saveRecentFiles()
|
||||
for (int i=0; i<data.size(); i++)
|
||||
fin << data[i] << endl;
|
||||
file.close();
|
||||
} else {
|
||||
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
|
||||
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -136,6 +136,7 @@ class PAdmin : public QObject
|
||||
PTheory* getTheoryItem(const unsigned int idx);
|
||||
PMsr2DataParam getMsr2DataParam() { return fMsr2DataParam; }
|
||||
int getNumRecentFiles() { return fRecentFile.size(); }
|
||||
QString getDefaultPrefPathName() { return fPrefPathName; }
|
||||
QString getRecentFile(int idx);
|
||||
|
||||
void setTimeout(const int ival) { fTimeout = ival; }
|
||||
@@ -175,6 +176,7 @@ class PAdmin : public QObject
|
||||
QString fFontName; ///< default font name
|
||||
int fFontSize; ///< default font size
|
||||
|
||||
QString fPrefPathName; ///< path-name of the musredit_startup.xml
|
||||
QString fExecPath; ///< system path to the musrfit executables
|
||||
QString fDefaultSavePath; ///< default path where the msr-file should be saved
|
||||
QString fMsrDefaultFilePath; ///< path where to find musredit source
|
||||
|
||||
@@ -36,12 +36,13 @@
|
||||
|
||||
#include "PGetMusrFTOptionsDialog.h"
|
||||
|
||||
#define MUSRFT_OPT_UNDEF 0
|
||||
#define MUSRFT_OPT_REAL 1
|
||||
#define MUSRFT_OPT_IMAG 2
|
||||
#define MUSRFT_OPT_REAL_AND_IMAG 3
|
||||
#define MUSRFT_OPT_POWER 4
|
||||
#define MUSRFT_OPT_PHASE 5
|
||||
#define MUSRFT_OPT_UNDEF 0
|
||||
#define MUSRFT_OPT_REAL 1
|
||||
#define MUSRFT_OPT_IMAG 2
|
||||
#define MUSRFT_OPT_REAL_AND_IMAG 3
|
||||
#define MUSRFT_OPT_POWER 4
|
||||
#define MUSRFT_OPT_PHASE 5
|
||||
#define MUSRFT_OPT_PHASE_OPT_REAL 6
|
||||
|
||||
#define MUSRFT_APOD_UNDEF 0
|
||||
#define MUSRFT_APOD_WEAK 1
|
||||
@@ -139,6 +140,8 @@ PGetMusrFTOptionsDialog::PGetMusrFTOptionsDialog(QString currentMsrFile, QString
|
||||
fFourierOption_comboBox->setCurrentIndex(MUSRFT_OPT_POWER);
|
||||
else if (prevCmd[i+1] == "phase")
|
||||
fFourierOption_comboBox->setCurrentIndex(MUSRFT_OPT_PHASE);
|
||||
else if (prevCmd[i+1] == "phaseOptReal")
|
||||
fFourierOption_comboBox->setCurrentIndex(MUSRFT_OPT_PHASE_OPT_REAL);
|
||||
else
|
||||
fFourierOption_comboBox->setCurrentIndex(MUSRFT_OPT_UNDEF);
|
||||
i++;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include <QTextEdit>
|
||||
@@ -128,7 +129,7 @@ PTextEdit::PTextEdit( QWidget *parent, Qt::WindowFlags f )
|
||||
fileNew();
|
||||
}
|
||||
|
||||
connect( fTabWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( applyFontSettings(QWidget*) ));
|
||||
connect( fTabWidget, SIGNAL( currentChanged(int) ), this, SLOT( applyFontSettings(int) ));
|
||||
|
||||
fLastDirInUse = fAdmin->getDefaultSavePath();
|
||||
}
|
||||
@@ -679,42 +680,6 @@ void PTextEdit::doConnections( PSubTextEdit *e )
|
||||
connect( e, SIGNAL( cursorPositionChanged() ), this, SLOT( currentCursorPosition() ));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Validates a given runlist.
|
||||
*
|
||||
* \param runList run list string which should be a space separated list of run numbers.
|
||||
*/
|
||||
bool PTextEdit::validRunList(const QString runList)
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
int i = 0;
|
||||
QString subStr;
|
||||
bool done = false;
|
||||
int val = 0;
|
||||
bool ok;
|
||||
while (!done) {
|
||||
subStr = runList.section(' ', i, i, QString::SectionSkipEmpty);
|
||||
if (subStr.isEmpty()) {
|
||||
done = true;
|
||||
continue;
|
||||
}
|
||||
i++;
|
||||
val = subStr.toInt(&ok);
|
||||
if (!ok) {
|
||||
done = true;
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 0) { // no token found
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Start the dialog to enter a msr-file title. See also https://intranet.psi.ch/MUSR/MusrFit#4_1_The_Title
|
||||
@@ -938,12 +903,31 @@ void PTextEdit::fileReload()
|
||||
*/
|
||||
void PTextEdit::fileOpenPrefs()
|
||||
{
|
||||
QString fln = QFileDialog::getOpenFileName( this, tr("Open Prefs"),
|
||||
QString fln("");
|
||||
QString msg("");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Which Preferences do you want to open?");
|
||||
msgBox.addButton("Default", QMessageBox::AcceptRole);
|
||||
msgBox.addButton("Custom", QMessageBox::AcceptRole);
|
||||
msgBox.setStandardButtons(QMessageBox::Cancel);
|
||||
int result = msgBox.exec();
|
||||
if (result == QMessageBox::Cancel) {
|
||||
return;
|
||||
} else if (result == 0) { // default dir
|
||||
fln = fAdmin->getDefaultPrefPathName();
|
||||
msg = QString("Current Default Preferences Path-Name:\n") + fln;
|
||||
if (QMessageBox::information(this, "Info", msg, QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Cancel)
|
||||
return;
|
||||
} else if (result == 1) { // custom dir
|
||||
fln = QFileDialog::getOpenFileName( this, tr("Open Prefs"),
|
||||
fLastDirInUse,
|
||||
tr( "xml-Files (*.xml);; All Files (*)" ));
|
||||
}
|
||||
|
||||
if (fAdmin->loadPrefs(fln))
|
||||
QMessageBox::information(0, "Prefs", "<b>Prefs Loaded.</b>");
|
||||
if (fAdmin->loadPrefs(fln)) {
|
||||
msg = QString("Prefs from '") + fln + QString("' loaded.");
|
||||
QMessageBox::information(0, "Info", msg);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -1005,12 +989,31 @@ void PTextEdit::fileSaveAs()
|
||||
*/
|
||||
void PTextEdit::fileSavePrefs()
|
||||
{
|
||||
QString fn = QFileDialog::getSaveFileName( this,
|
||||
QString fln("");
|
||||
QString msg("");
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Which Preferences do you want to open?");
|
||||
msgBox.addButton("Default", QMessageBox::AcceptRole);
|
||||
msgBox.addButton("Custom", QMessageBox::AcceptRole);
|
||||
msgBox.setStandardButtons(QMessageBox::Cancel);
|
||||
int result = msgBox.exec();
|
||||
if (result == QMessageBox::Cancel) {
|
||||
return;
|
||||
} else if (result == 0) { // default dir
|
||||
fln = fAdmin->getDefaultPrefPathName();
|
||||
msg = QString("Current Default Preferences Path-Name:\n") + fln;
|
||||
if (QMessageBox::information(this, "Info", msg, QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Cancel)
|
||||
return;
|
||||
} else if (result == 1) { // custom dir
|
||||
fln = QFileDialog::getSaveFileName( this,
|
||||
tr( "Save Prefs As" ), "musredit_startup.xml",
|
||||
tr( "xml-Files (*.xml);;All Files (*)" ) );
|
||||
}
|
||||
|
||||
if ( !fn.isEmpty() ) {
|
||||
fAdmin->savePrefs(fn);
|
||||
if ( !fln.isEmpty() ) {
|
||||
fAdmin->savePrefs(fln);
|
||||
msg = QString("Prefs to '") + fln + QString("' saved.");
|
||||
QMessageBox::information(0, "Info", msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1892,12 +1895,6 @@ void PTextEdit::musrMsr2Data()
|
||||
break;
|
||||
case 1: // run list
|
||||
runList = fMsr2DataParam->runList;
|
||||
if (!validRunList(runList)) {
|
||||
QMessageBox::critical(this, "**ERROR**",
|
||||
"Invalid Run List!\nThe run list needs to be a space separated list of run numbers.",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 2: // run list file name
|
||||
runListFileName = fMsr2DataParam->runListFileName;
|
||||
@@ -2549,7 +2546,7 @@ void PTextEdit::replaceAll()
|
||||
/**
|
||||
* <p>SLOT: updates the fonts if the textedit tab has changed.
|
||||
*/
|
||||
void PTextEdit::applyFontSettings(QWidget*)
|
||||
void PTextEdit::applyFontSettings(int)
|
||||
{
|
||||
QFont font(fAdmin->getFontName(), fAdmin->getFontSize());
|
||||
fontChanged(font);
|
||||
|
||||
@@ -77,7 +77,6 @@ private:
|
||||
void load( const QString &f, const int index=-1 );
|
||||
PSubTextEdit *currentEditor() const;
|
||||
void doConnections( PSubTextEdit *e );
|
||||
bool validRunList(const QString runList);
|
||||
void fileSystemWatcherActivation();
|
||||
|
||||
private slots:
|
||||
@@ -148,7 +147,7 @@ private slots:
|
||||
void replaceAndClose();
|
||||
void replaceAll();
|
||||
|
||||
void applyFontSettings(QWidget*);
|
||||
void applyFontSettings(int);
|
||||
void fileChanged(const QString &fileName);
|
||||
void setFileSystemWatcherActive();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<property name="title">
|
||||
<string> Fourier </string>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>21</x>
|
||||
@@ -91,6 +91,11 @@ p, li { white-space: pre-wrap; }
|
||||
<string>phase</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>phaseOptReal</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@@ -58,8 +58,8 @@ QMAKE_CXX = $${CXX}
|
||||
QMAKE_LINK = $${CXX}
|
||||
|
||||
# install path for the XML configuration file
|
||||
unix:xml.path = $${MUSREDIT_INSTALL_PATH}
|
||||
macx:xml.path = /Applications/musredit.app/Contents/Resources
|
||||
unix:xml.path = $$(HOME)/.musrfit/musredit
|
||||
macx:xml.path = $$(HOME)/.musrfit/musredit
|
||||
win32:xml.path = c:/musrfit/bin
|
||||
xml.files = musredit_startup.xml
|
||||
INSTALLS += xml
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<musredit_startup xmlns="http://lmu.web.psi.ch/facilities/software/musrfit/user/MUSR/MusrGui.html">
|
||||
<musredit_startup xmlns="http://lmu.web.psi.ch/musrfit/user/MUSR/MusrGui.html">
|
||||
<comment>
|
||||
This is handling default setting parameters for the musredit.
|
||||
</comment>
|
||||
@@ -14,6 +14,7 @@
|
||||
<title_from_data_file>y</title_from_data_file>
|
||||
<chisq_per_run_block>n</chisq_per_run_block>
|
||||
<estimate_n0>y</estimate_n0>
|
||||
<musrview_show_fourier>n</musrview_show_fourier>
|
||||
<enable_musrt0>y</enable_musrt0>
|
||||
</general>
|
||||
<recent_files>
|
||||
|
||||
5
src/musredit_qt5/Makefile.am
Normal file
5
src/musredit_qt5/Makefile.am
Normal file
@@ -0,0 +1,5 @@
|
||||
## Process this file with automake to create Makefile.in
|
||||
|
||||
CLEANFILES = *~ core moc_* ui_*
|
||||
|
||||
|
||||
955
src/musredit_qt5/PAdmin.cpp
Normal file
955
src/musredit_qt5/PAdmin.cpp
Normal file
@@ -0,0 +1,955 @@
|
||||
/****************************************************************************
|
||||
|
||||
PAdmin.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010-2014 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include <QVector>
|
||||
|
||||
#include "PAdmin.h"
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// implementation of PAdminXMLParser class
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>XML Parser class for the musredit administration file.
|
||||
*
|
||||
* \param admin pointer to an admin class instance.
|
||||
*/
|
||||
PAdminXMLParser::PAdminXMLParser(PAdmin *admin) : fAdmin(admin)
|
||||
{
|
||||
fKeyWord = eEmpty;
|
||||
fFunc = false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Routine called at the beginning of the XML parsing process.
|
||||
*/
|
||||
bool PAdminXMLParser::startDocument()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Routine called when a new XML tag is found. Here it is used
|
||||
* to set a tag for filtering afterwards the content.
|
||||
*
|
||||
* \param qName name of the XML tag.
|
||||
*/
|
||||
bool PAdminXMLParser::startElement( const QString&, const QString&,
|
||||
const QString& qName,
|
||||
const QXmlAttributes& )
|
||||
{
|
||||
if (qName == "timeout") {
|
||||
fKeyWord = eTimeout;
|
||||
} else if (qName == "font_name") {
|
||||
fKeyWord = eFontName;
|
||||
} else if (qName == "font_size") {
|
||||
fKeyWord = eFontSize;
|
||||
} else if (qName == "exec_path") {
|
||||
fKeyWord = eExecPath;
|
||||
} else if (qName == "default_save_path") {
|
||||
fKeyWord = eDefaultSavePath;
|
||||
} else if (qName == "title_from_data_file") {
|
||||
fKeyWord = eTitleFromDataFile;
|
||||
} else if (qName == "musrview_show_fourier") {
|
||||
fKeyWord = eMusrviewShowFourier;
|
||||
} else if (qName == "enable_musrt0") {
|
||||
fKeyWord = eEnableMusrT0;
|
||||
} else if (qName == "keep_minuit2_output") {
|
||||
fKeyWord = eKeepMinuit2Output;
|
||||
} else if (qName == "dump_ascii") {
|
||||
fKeyWord = eDumpAscii;
|
||||
} else if (qName == "dump_root") {
|
||||
fKeyWord = eDumpRoot;
|
||||
} else if (qName == "estimate_n0") {
|
||||
fKeyWord = eEstimateN0;
|
||||
} else if (qName == "chisq_per_run_block") {
|
||||
fKeyWord = eChisqPreRunBlock;
|
||||
} else if (qName == "path_file_name") {
|
||||
fKeyWord = eRecentFile;
|
||||
} else if (qName == "beamline") {
|
||||
fKeyWord = eBeamline;
|
||||
} else if (qName == "institute") {
|
||||
fKeyWord = eInstitute;
|
||||
} else if (qName == "file_format") {
|
||||
fKeyWord = eFileFormat;
|
||||
} else if (qName == "lifetime_correction") {
|
||||
fKeyWord = eLifetimeCorrection;
|
||||
} else if (qName == "msr_default_file_path") {
|
||||
fKeyWord = eMsrDefaultFilePath;
|
||||
} else if (qName == "musr_web_main") {
|
||||
fKeyWord = eHelpMain;
|
||||
} else if (qName == "musr_web_title") {
|
||||
fKeyWord = eHelpTitle;
|
||||
} else if (qName == "musr_web_parameters") {
|
||||
fKeyWord = eHelpParameters;
|
||||
} else if (qName == "musr_web_theory") {
|
||||
fKeyWord = eHelpTheory;
|
||||
} else if (qName == "musr_web_functions") {
|
||||
fKeyWord = eHelpFunctions;
|
||||
} else if (qName == "musr_web_run") {
|
||||
fKeyWord = eHelpRun;
|
||||
} else if (qName == "musr_web_command") {
|
||||
fKeyWord = eHelpCommand;
|
||||
} else if (qName == "musr_web_fourier") {
|
||||
fKeyWord = eHelpFourier;
|
||||
} else if (qName == "musr_web_plot") {
|
||||
fKeyWord = eHelpPlot;
|
||||
} else if (qName == "musr_web_statistic") {
|
||||
fKeyWord = eHelpStatistic;
|
||||
} else if (qName == "musr_web_msr2data") {
|
||||
fKeyWord = eHelpMsr2Data;
|
||||
} else if (qName == "musr_web_musrFT") {
|
||||
fKeyWord = eHelpMusrFT;
|
||||
} else if (qName == "chain_fit") {
|
||||
fKeyWord = eChainFit;
|
||||
} else if (qName == "write_data_header") {
|
||||
fKeyWord = eWriteDataHeader;
|
||||
} else if (qName == "ignore_data_header_info") {
|
||||
fKeyWord = eIgnoreDataHeaderInfo;
|
||||
} else if (qName == "keep_minuit2_output") {
|
||||
fKeyWord = eKeepMinuit2Output;
|
||||
} else if (qName == "write_column_data") {
|
||||
fKeyWord = eWriteColumnData;
|
||||
} else if (qName == "recreate_data_file") {
|
||||
fKeyWord = eRecreateDataFile;
|
||||
} else if (qName == "open_file_after_fitting") {
|
||||
fKeyWord = eOpenFileAfterFitting;
|
||||
} else if (qName == "create_msr_file_only") {
|
||||
fKeyWord = eCreateMsrFileOnly;
|
||||
} else if (qName == "fit_only") {
|
||||
fKeyWord = eFitOnly;
|
||||
} else if (qName == "global") {
|
||||
fKeyWord = eGlobal;
|
||||
} else if (qName == "global_plus") {
|
||||
fKeyWord = eGlobalPlus;
|
||||
} else if (qName == "func_pixmap_path") {
|
||||
fKeyWord = eTheoFuncPixmapPath;
|
||||
} else if (qName == "func") {
|
||||
fKeyWord = eFunc;
|
||||
fFunc = true;
|
||||
// init theory item
|
||||
fTheoryItem.name = "";
|
||||
fTheoryItem.comment = "";
|
||||
fTheoryItem.label = "";
|
||||
fTheoryItem.pixmapName = "";
|
||||
fTheoryItem.pixmap = QPixmap();
|
||||
fTheoryItem.params = -1;
|
||||
} else if (qName == "name") {
|
||||
fKeyWord = eFuncName;
|
||||
} else if (qName == "comment") {
|
||||
fKeyWord = eFuncComment;
|
||||
} else if (qName == "label") {
|
||||
fKeyWord = eFuncLabel;
|
||||
} else if (qName == "pixmap") {
|
||||
fKeyWord = eFuncPixmap;
|
||||
} else if (qName == "params") {
|
||||
fKeyWord = eFuncParams;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Routine called when the end XML tag is found. It is used to
|
||||
* put the filtering tag to 'empty'. It also resets the fFunc flag in case
|
||||
* the entry was a theory function.
|
||||
*
|
||||
* \param qName name of the element.
|
||||
*/
|
||||
bool PAdminXMLParser::endElement( const QString&, const QString&, const QString &qName )
|
||||
{
|
||||
fKeyWord = eEmpty;
|
||||
|
||||
if (qName == "func") {
|
||||
fFunc = false;
|
||||
fAdmin->addTheoryItem(fTheoryItem);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>This routine delivers the content of an XML tag. It fills the
|
||||
* content into the load data structure.
|
||||
*
|
||||
* \param str keeps the content of the XML tag.
|
||||
*/
|
||||
bool PAdminXMLParser::characters(const QString& str)
|
||||
{
|
||||
QString help;
|
||||
bool flag, ok;
|
||||
int ival;
|
||||
|
||||
switch (fKeyWord) {
|
||||
case eTimeout:
|
||||
ival = QString(str.toLatin1()).trimmed().toInt(&ok);
|
||||
if (ok)
|
||||
fAdmin->setTimeout(ival);
|
||||
break;
|
||||
case eFontName:
|
||||
fAdmin->setFontName(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
case eFontSize:
|
||||
ival = QString(str.toLatin1()).trimmed().toInt(&ok);
|
||||
if (ok)
|
||||
fAdmin->setFontSize(ival);
|
||||
break;
|
||||
case eExecPath:
|
||||
fAdmin->setExecPath(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
case eDefaultSavePath:
|
||||
fAdmin->setDefaultSavePath(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
case eTitleFromDataFile:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setTitleFromDataFileFlag(flag);
|
||||
break;
|
||||
case eMusrviewShowFourier:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setMusrviewShowFourierFlag(flag);
|
||||
break;
|
||||
case eEnableMusrT0:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setEnableMusrT0Flag(flag);
|
||||
break;
|
||||
case eKeepMinuit2Output:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->fMsr2DataParam.keepMinuit2Output = flag;
|
||||
fAdmin->setKeepMinuit2OutputFlag(flag);
|
||||
break;
|
||||
case eDumpAscii:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setDumpAsciiFlag(flag);
|
||||
break;
|
||||
case eDumpRoot:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setDumpRootFlag(flag);
|
||||
break;
|
||||
case eEstimateN0:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setEstimateN0Flag(flag);
|
||||
break;
|
||||
case eChisqPreRunBlock:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setChisqPerRunBlockFlag(flag);
|
||||
break;
|
||||
case eRecentFile:
|
||||
fAdmin->addRecentFile(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
case eBeamline:
|
||||
fAdmin->setBeamline(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
case eInstitute:
|
||||
fAdmin->setInstitute(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
case eFileFormat:
|
||||
fAdmin->setFileFormat(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
case eLifetimeCorrection:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->setLifetimeCorrectionFlag(flag);
|
||||
break;
|
||||
case eMsrDefaultFilePath:
|
||||
fAdmin->setMsrDefaultFilePath(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
case eHelpMain:
|
||||
fAdmin->setHelpUrl("main", str);
|
||||
break;
|
||||
case eHelpTitle:
|
||||
fAdmin->setHelpUrl("title", str);
|
||||
break;
|
||||
case eHelpParameters:
|
||||
fAdmin->setHelpUrl("parameters", str);
|
||||
break;
|
||||
case eHelpTheory:
|
||||
fAdmin->setHelpUrl("theory", str);
|
||||
break;
|
||||
case eHelpFunctions:
|
||||
fAdmin->setHelpUrl("functions", str);
|
||||
break;
|
||||
case eHelpRun:
|
||||
fAdmin->setHelpUrl("run", str);
|
||||
break;
|
||||
case eHelpCommand:
|
||||
fAdmin->setHelpUrl("command", str);
|
||||
break;
|
||||
case eHelpFourier:
|
||||
fAdmin->setHelpUrl("fourier", str);
|
||||
break;
|
||||
case eHelpPlot:
|
||||
fAdmin->setHelpUrl("plot", str);
|
||||
break;
|
||||
case eHelpStatistic:
|
||||
fAdmin->setHelpUrl("statistic", str);
|
||||
break;
|
||||
case eHelpMsr2Data:
|
||||
fAdmin->setHelpUrl("msr2data", str);
|
||||
break;
|
||||
case eHelpMusrFT:
|
||||
fAdmin->setHelpUrl("musrFT", str);
|
||||
break;
|
||||
case eChainFit:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->fMsr2DataParam.chainFit = flag;
|
||||
break;
|
||||
case eWriteDataHeader:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->fMsr2DataParam.writeDbHeader = flag;
|
||||
break;
|
||||
case eIgnoreDataHeaderInfo:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->fMsr2DataParam.ignoreDataHeaderInfo = flag;
|
||||
break;
|
||||
case eWriteColumnData:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->fMsr2DataParam.writeColumnData = flag;
|
||||
break;
|
||||
case eRecreateDataFile:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->fMsr2DataParam.recreateDbFile = flag;
|
||||
break;
|
||||
case eOpenFileAfterFitting:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->fMsr2DataParam.openFilesAfterFitting = flag;
|
||||
break;
|
||||
case eCreateMsrFileOnly:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->fMsr2DataParam.createMsrFileOnly = flag;
|
||||
break;
|
||||
case eFitOnly:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->fMsr2DataParam.fitOnly = flag;
|
||||
break;
|
||||
case eGlobal:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->fMsr2DataParam.global = flag;
|
||||
break;
|
||||
case eGlobalPlus:
|
||||
if (str == "y")
|
||||
flag = true;
|
||||
else
|
||||
flag = false;
|
||||
fAdmin->fMsr2DataParam.globalPlus = flag;
|
||||
break;
|
||||
case eTheoFuncPixmapPath:
|
||||
fAdmin->setTheoFuncPixmapPath(QString(str.toLatin1()).trimmed());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (fFunc) {
|
||||
bool ok;
|
||||
switch (fKeyWord) {
|
||||
case eFuncName:
|
||||
fTheoryItem.name = QString(str.toLatin1()).trimmed();
|
||||
break;
|
||||
case eFuncComment:
|
||||
fTheoryItem.comment = QString(str.toLatin1()).trimmed();
|
||||
break;
|
||||
case eFuncLabel:
|
||||
fTheoryItem.label = QString(str.toLatin1()).trimmed();
|
||||
break;
|
||||
case eFuncPixmap:
|
||||
fTheoryItem.pixmapName = QString(str.toLatin1()).trimmed();
|
||||
break;
|
||||
case eFuncParams:
|
||||
fTheoryItem.params = str.toInt(&ok);
|
||||
if (!ok)
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Called at the end of the XML parse process. It checks if default paths
|
||||
* contain system variables, and if so expand them for the further use.
|
||||
*/
|
||||
bool PAdminXMLParser::endDocument()
|
||||
{
|
||||
// check if all necessary items are found
|
||||
QString str;
|
||||
|
||||
if (fAdmin->getExecPath().indexOf('$') >= 0) {
|
||||
str = expandPath(fAdmin->getExecPath());
|
||||
if (!str.isEmpty())
|
||||
fAdmin->setExecPath(str);
|
||||
}
|
||||
|
||||
if (fAdmin->getDefaultSavePath().indexOf('$') >= 0) {
|
||||
str = expandPath(fAdmin->getDefaultSavePath());
|
||||
if (!str.isEmpty())
|
||||
fAdmin->setDefaultSavePath(str);
|
||||
}
|
||||
|
||||
if (fAdmin->getMsrDefaultFilePath().indexOf('$') >= 0) {
|
||||
str = expandPath(fAdmin->getMsrDefaultFilePath());
|
||||
if (!str.isEmpty())
|
||||
fAdmin->setMsrDefaultFilePath(str);
|
||||
}
|
||||
|
||||
if (fAdmin->getTheoFuncPixmapPath().indexOf('$') >=0) {
|
||||
str = expandPath(fAdmin->getTheoFuncPixmapPath());
|
||||
if (!str.isEmpty())
|
||||
fAdmin->setTheoFuncPixmapPath(str);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Report XML warnings.
|
||||
*
|
||||
* \param exception holds the information of the XML warning
|
||||
*/
|
||||
bool PAdminXMLParser::warning( const QXmlParseException & exception )
|
||||
{
|
||||
QString msg;
|
||||
|
||||
msg = QString("**WARNING** while parsing musredit_startup.xml in line no %1\n").arg(exception.lineNumber());
|
||||
msg += QString("**WARNING MESSAGE** ") + exception.message();
|
||||
|
||||
qWarning() << endl << msg << endl;
|
||||
|
||||
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Report recoverable XML errors.
|
||||
*
|
||||
* \param exception holds the information of the XML recoverable errors.
|
||||
*/
|
||||
bool PAdminXMLParser::error( const QXmlParseException & exception )
|
||||
{
|
||||
QString msg;
|
||||
|
||||
msg = QString("**ERROR** while parsing musredit_startup.xml in line no %1\n").arg(exception.lineNumber());
|
||||
msg += QString("**ERROR MESSAGE** ") + exception.message();
|
||||
|
||||
qWarning() << endl << msg << endl;
|
||||
|
||||
QMessageBox::critical(0, "ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Report fatal XML errors.
|
||||
*
|
||||
* \param exception holds the information of the XML fatal errors.
|
||||
*/
|
||||
bool PAdminXMLParser::fatalError( const QXmlParseException & exception )
|
||||
{
|
||||
QString msg;
|
||||
|
||||
msg = QString("**FATAL ERROR** while parsing musredit_startup.xml in line no %1\n").arg(exception.lineNumber());
|
||||
msg += QString("**FATAL ERROR MESSAGE** ") + exception.message();
|
||||
|
||||
qWarning() << endl << msg << endl;
|
||||
|
||||
QMessageBox::critical(0, "FATAL ERROR", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Expands system variables to full path, e.g. <tt>$HOME -> \home\user</tt>
|
||||
*
|
||||
* \param str path string with none expanded system variables.
|
||||
*/
|
||||
QString PAdminXMLParser::expandPath(const QString &str)
|
||||
{
|
||||
QString token;
|
||||
QString path;
|
||||
QString msg;
|
||||
QString newStr="";
|
||||
|
||||
QStringList list = str.split("/");
|
||||
|
||||
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
|
||||
token = *it;
|
||||
if (token.contains("$")) {
|
||||
token.remove('$');
|
||||
path = std::getenv(token.toLatin1());
|
||||
if (path.isEmpty()) {
|
||||
msg = QString("Couldn't expand '%1'. Some things might not work properly").arg(token);
|
||||
QMessageBox::warning(0, "**WARNING**", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
newStr = "";
|
||||
break;
|
||||
}
|
||||
newStr += path;
|
||||
} else {
|
||||
newStr += "/" + token;
|
||||
}
|
||||
}
|
||||
|
||||
return newStr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// implementation of PAdmin class
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Initializes that PAdmin object, and calls the XML parser which feeds
|
||||
* the object variables.
|
||||
*/
|
||||
PAdmin::PAdmin() : QObject()
|
||||
{
|
||||
fTimeout = 3600;
|
||||
|
||||
fFontName = QString("Courier"); // default font
|
||||
fFontSize = 11; // default font size
|
||||
|
||||
fPrefPathName = QString("");
|
||||
fExecPath = QString("");
|
||||
fDefaultSavePath = QString("");
|
||||
fMsrDefaultFilePath = QString("");
|
||||
fTheoFuncPixmapPath = QString("");
|
||||
|
||||
fBeamline = QString("");
|
||||
fInstitute = QString("");
|
||||
fFileFormat = QString("");
|
||||
|
||||
fMusrviewShowFourier = false;
|
||||
|
||||
fTitleFromDataFile = false;
|
||||
fEnableMusrT0 = false;
|
||||
fLifetimeCorrection = true;
|
||||
fEstimateN0 = true;
|
||||
fChisqPreRunBlock = false;
|
||||
|
||||
fMsr2DataParam.firstRun = -1;
|
||||
fMsr2DataParam.lastRun = -1;
|
||||
fMsr2DataParam.runList = QString("");
|
||||
fMsr2DataParam.runListFileName = QString("");
|
||||
fMsr2DataParam.msrFileExtension = QString("");
|
||||
fMsr2DataParam.templateRunNo = -1;
|
||||
fMsr2DataParam.dbOutputFileName = QString("");
|
||||
fMsr2DataParam.writeDbHeader = true;
|
||||
fMsr2DataParam.ignoreDataHeaderInfo = false;
|
||||
fMsr2DataParam.keepMinuit2Output = false;
|
||||
fMsr2DataParam.writeColumnData = false;
|
||||
fMsr2DataParam.recreateDbFile = false;
|
||||
fMsr2DataParam.chainFit = true;
|
||||
fMsr2DataParam.openFilesAfterFitting = true;
|
||||
fMsr2DataParam.titleFromDataFile = true;
|
||||
fMsr2DataParam.createMsrFileOnly = false;
|
||||
fMsr2DataParam.fitOnly = false;
|
||||
fMsr2DataParam.global = false;
|
||||
fMsr2DataParam.globalPlus = false;
|
||||
|
||||
// XML Parser part
|
||||
// 1st: check local directory
|
||||
QString path = QString("./");
|
||||
QString fln = QString("musredit_startup.xml");
|
||||
QString pathFln = path + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 2nd: check $HOME/.musrfit/musredit/musredit_startup.xml
|
||||
path = std::getenv("HOME");
|
||||
pathFln = path + "/.musrfit/musredit/" + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 3rd: check $MUSRFITPATH/musredit_startup.xml
|
||||
path = std::getenv("MUSRFITPATH");
|
||||
pathFln = path + "/" + fln;
|
||||
if (!QFile::exists(pathFln)) {
|
||||
// 4th: check $ROOTSYS/bin/musredit_startup.xml
|
||||
path = std::getenv("ROOTSYS");
|
||||
pathFln = path + "/bin/" + fln;
|
||||
}
|
||||
}
|
||||
}
|
||||
fPrefPathName = pathFln;
|
||||
|
||||
loadPrefs(fPrefPathName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Destructor
|
||||
*/
|
||||
PAdmin::~PAdmin()
|
||||
{
|
||||
saveRecentFiles();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the help url corresponding the the tag.
|
||||
*
|
||||
* \param tag to map the help url. At the moment the following tags should be present:
|
||||
* main, title, parameters, theory, functions, run, command, fourier, plot, statistic
|
||||
*/
|
||||
QString PAdmin::getHelpUrl(QString tag)
|
||||
{
|
||||
return fHelpUrl[tag];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns a theory item from position idx. If idx is out of the range, a null pointer is returned.
|
||||
*
|
||||
* \param idx position of the theory item.
|
||||
*/
|
||||
PTheory* PAdmin::getTheoryItem(const unsigned int idx)
|
||||
{
|
||||
if (idx > (unsigned int)fTheory.size())
|
||||
return 0;
|
||||
else
|
||||
return &fTheory[idx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the recent path-file name at position idx. If idx is out of scope,
|
||||
* an empty string is returned.
|
||||
*
|
||||
* \param idx index of the recent path-file name to be retrieved.
|
||||
*/
|
||||
QString PAdmin::getRecentFile(int idx)
|
||||
{
|
||||
if (idx >= fRecentFile.size())
|
||||
return QString("");
|
||||
|
||||
return fRecentFile[idx];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>set the help url, addressed via a tag. At the moment the following tags should be present:
|
||||
* main, title, parameters, theory, functions, run, command, fourier, plot, statistic, msr2data
|
||||
*
|
||||
* \param tag to address the help url
|
||||
* \param url help url corresponding to the tag.
|
||||
*/
|
||||
void PAdmin::setHelpUrl(const QString tag, const QString url)
|
||||
{
|
||||
fHelpUrl[tag] = url;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Loads the preference file fln.
|
||||
*
|
||||
* <b>return:</b> 1 on success, 0 otherwise
|
||||
*
|
||||
* \param fln path-file name of the preference file to be loaded.
|
||||
*/
|
||||
int PAdmin::loadPrefs(QString fln)
|
||||
{
|
||||
if (QFile::exists(fln)) { // administration file present
|
||||
PAdminXMLParser handler(this);
|
||||
QFile xmlFile(fln);
|
||||
QXmlInputSource source( &xmlFile );
|
||||
QXmlSimpleReader reader;
|
||||
reader.setContentHandler( &handler );
|
||||
reader.setErrorHandler( &handler );
|
||||
if (!reader.parse( source )) {
|
||||
QMessageBox::critical(0, "ERROR",
|
||||
"Error parsing musredit_startup.xml settings file.\nProbably a few things will not work porperly.\nPlease fix this first.",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
QMessageBox::critical(0, "ERROR",
|
||||
"Couldn't find the musredit_startup.xml settings file.\nProbably a few things will not work porperly.\nPlease fix this first.",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Save the preference file pref_fln.
|
||||
*
|
||||
* <b>return:</b> 1 on success, 0 otherwise
|
||||
*
|
||||
* \param pref_fln preference path-file name
|
||||
*/
|
||||
int PAdmin::savePrefs(QString pref_fln)
|
||||
{
|
||||
// check if musredit_startup.xml is present in the current directory, and if yes, use this file to
|
||||
// save the recent file names otherwise use the "master" musredit_startup.xml
|
||||
QString fln = QString("./musredit_startup.xml");
|
||||
if (!QFile::exists(fln))
|
||||
fln = fPrefPathName;
|
||||
|
||||
if (QFile::exists(fln)) { // administration file present
|
||||
QVector<QString> data;
|
||||
QFile file(fln);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
cerr << endl << ">> PAdmin::savePrefs: **ERROR** Cannot open " << fln.toLatin1().data() << " for reading." << endl;
|
||||
return 1;
|
||||
}
|
||||
QTextStream fin(&file);
|
||||
while (!fin.atEnd()) {
|
||||
data.push_back(fin.readLine());
|
||||
}
|
||||
file.close();
|
||||
|
||||
// replace all the prefs
|
||||
for (int i=0; i<data.size(); i++) {
|
||||
if (data[i].contains("<timeout>") && data[i].contains("</timeout>")) {
|
||||
data[i] = " <timeout>" + QString("%1").arg(fTimeout) + "</timeout>";
|
||||
}
|
||||
if (data[i].contains("<keep_minuit2_output>") && data[i].contains("</keep_minuit2_output>")) {
|
||||
if (fKeepMinuit2Output)
|
||||
data[i] = " <keep_minuit2_output>y</keep_minuit2_output>";
|
||||
else
|
||||
data[i] = " <keep_minuit2_output>n</keep_minuit2_output>";
|
||||
}
|
||||
if (data[i].contains("<dump_ascii>") && data[i].contains("</dump_ascii>")) {
|
||||
if (fDumpAscii)
|
||||
data[i] = " <dump_ascii>y</dump_ascii>";
|
||||
else
|
||||
data[i] = " <dump_ascii>n</dump_ascii>";
|
||||
}
|
||||
if (data[i].contains("<dump_root>") && data[i].contains("</dump_root>")) {
|
||||
if (fDumpRoot)
|
||||
data[i] = " <dump_root>y</dump_root>";
|
||||
else
|
||||
data[i] = " <dump_root>n</dump_root>";
|
||||
}
|
||||
if (data[i].contains("<title_from_data_file>") && data[i].contains("</title_from_data_file>")) {
|
||||
if (fTitleFromDataFile)
|
||||
data[i] = " <title_from_data_file>y</title_from_data_file>";
|
||||
else
|
||||
data[i] = " <title_from_data_file>n</title_from_data_file>";
|
||||
}
|
||||
if (data[i].contains("<chisq_per_run_block>") && data[i].contains("</chisq_per_run_block>")) {
|
||||
if (fChisqPreRunBlock)
|
||||
data[i] = " <chisq_per_run_block>y</chisq_per_run_block>";
|
||||
else
|
||||
data[i] = " <chisq_per_run_block>n</chisq_per_run_block>";
|
||||
}
|
||||
if (data[i].contains("<estimate_n0>") && data[i].contains("</estimate_n0>")) {
|
||||
if (fEstimateN0)
|
||||
data[i] = " <estimate_n0>y</estimate_n0>";
|
||||
else
|
||||
data[i] = " <estimate_n0>n</estimate_n0>";
|
||||
}
|
||||
if (data[i].contains("<musrview_show_fourier>") && data[i].contains("</musrview_show_fourier>")) {
|
||||
if (fMusrviewShowFourier)
|
||||
data[i] = " <musrview_show_fourier>y</musrview_show_fourier>";
|
||||
else
|
||||
data[i] = " <musrview_show_fourier>n</musrview_show_fourier>";
|
||||
}
|
||||
if (data[i].contains("<enable_musrt0>") && data[i].contains("</enable_musrt0>")) {
|
||||
if (fEnableMusrT0)
|
||||
data[i] = " <enable_musrt0>y</enable_musrt0>";
|
||||
else
|
||||
data[i] = " <enable_musrt0>n</enable_musrt0>";
|
||||
}
|
||||
}
|
||||
|
||||
// write prefs
|
||||
file.setFileName(pref_fln);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
cerr << endl << ">> PAdmin::savePrefs: **ERROR** Cannot open " << pref_fln.toLatin1().data() << " for writing." << endl;
|
||||
return 0;
|
||||
}
|
||||
fin.setDevice(&file);
|
||||
for (int i=0; i<data.size(); i++)
|
||||
fin << data[i] << endl;
|
||||
file.close();
|
||||
} else {
|
||||
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
|
||||
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Add recent path-file name to the internal ring-buffer.
|
||||
*
|
||||
* \param str recent path-file name to be added
|
||||
*/
|
||||
void PAdmin::addRecentFile(const QString str)
|
||||
{
|
||||
// check if file name is not already present
|
||||
for (int i=0; i<fRecentFile.size(); i++) {
|
||||
if (str == fRecentFile[i])
|
||||
return;
|
||||
}
|
||||
|
||||
fRecentFile.push_front(str);
|
||||
if (fRecentFile.size() > MAX_RECENT_FILES)
|
||||
fRecentFile.resize(MAX_RECENT_FILES);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Merges the recent file ring buffer into musredit_startup.xml and saves it.
|
||||
* If a local copy is present it will be saved there, otherwise the master file
|
||||
* will be used.
|
||||
*/
|
||||
void PAdmin::saveRecentFiles()
|
||||
{
|
||||
// check if musredit_startup.xml is present in the current directory, and if yes, use this file to
|
||||
// save the recent file names otherwise use the "master" musredit_startup.xml
|
||||
|
||||
QString str("");
|
||||
QString fln = QString("./musredit_startup.xml");
|
||||
if (!QFile::exists(fln))
|
||||
fln = fPrefPathName;
|
||||
|
||||
if (QFile::exists(fln)) { // administration file present
|
||||
QVector<QString> data;
|
||||
QFile file(fln);
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
cerr << endl << ">> PAdmin::saveRecentFile: **ERROR** Cannot open " << fln.toLatin1().data() << " for reading." << endl;
|
||||
return;
|
||||
}
|
||||
QTextStream fin(&file);
|
||||
while (!fin.atEnd()) {
|
||||
data.push_back(fin.readLine());
|
||||
}
|
||||
file.close();
|
||||
|
||||
// remove <path_file_name> from data
|
||||
for (QVector<QString>::iterator it = data.begin(); it != data.end(); ++it) {
|
||||
if (it->contains("<path_file_name>")) {
|
||||
it = data.erase(it);
|
||||
--it;
|
||||
}
|
||||
}
|
||||
|
||||
// add recent files
|
||||
int i;
|
||||
for (i=0; i<data.size(); i++) {
|
||||
if (data[i].contains("<recent_files>"))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == data.size()) {
|
||||
cerr << endl << ">> PAdmin::saveRecentFile: **ERROR** " << fln.toLatin1().data() << " seems to be corrupt." << endl;
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
for (int j=0; j<fRecentFile.size(); j++) {
|
||||
str = " <path_file_name>" + fRecentFile[j] + "</path_file_name>";
|
||||
data.insert(i++, str);
|
||||
}
|
||||
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
cerr << endl << ">> PAdmin::saveRecentFile: **ERROR** Cannot open " << fln.toLatin1().data() << " for reading." << endl;
|
||||
return;
|
||||
}
|
||||
fin.setDevice(&file);
|
||||
for (int i=0; i<data.size(); i++)
|
||||
fin << data[i] << endl;
|
||||
file.close();
|
||||
} else {
|
||||
QString msg("Failed to write musredit_startup.xml. Neither a local nor a global copy found.");
|
||||
QMessageBox::warning(0, "WARNING", msg, QMessageBox::Ok, QMessageBox::NoButton);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// END
|
||||
//--------------------------------------------------------------------------
|
||||
210
src/musredit_qt5/PAdmin.h
Normal file
210
src/musredit_qt5/PAdmin.h
Normal file
@@ -0,0 +1,210 @@
|
||||
/****************************************************************************
|
||||
|
||||
PAdmin.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010-2014 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 _PADMIN_H_
|
||||
#define _PADMIN_H_
|
||||
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QMap>
|
||||
#include <QPixmap>
|
||||
#include <QtXml>
|
||||
|
||||
#include <musredit.h>
|
||||
|
||||
class PAdmin;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>This structure is keeping informations necessary to handle musrfit
|
||||
* theory functions (see also <code>https://intranet.psi.ch/MUSR/MusrFit#4_3_The_THEORY_Block</code>).
|
||||
*/
|
||||
typedef struct {
|
||||
QString name;
|
||||
QString comment;
|
||||
QString label;
|
||||
QString pixmapName;
|
||||
QPixmap pixmap;
|
||||
int params;
|
||||
} PTheory;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
* PAdminXMLParser is an XML parser class used to handle the musredit startup
|
||||
* XML-file called <tt>musredit_startup.xml</tt>. This startup file contains
|
||||
* necessary informations about executable pathes, online help informations,
|
||||
* default font sizes, etc.
|
||||
*/
|
||||
class PAdminXMLParser : public QXmlDefaultHandler
|
||||
{
|
||||
public:
|
||||
PAdminXMLParser(PAdmin*);
|
||||
virtual ~PAdminXMLParser() {}
|
||||
|
||||
private:
|
||||
enum EAdminKeyWords {eEmpty, eTimeout, eKeepMinuit2Output, eDumpAscii, eDumpRoot,
|
||||
eTitleFromDataFile, eChisqPreRunBlock, eEstimateN0, eMusrviewShowFourier, eEnableMusrT0,
|
||||
eFontName, eFontSize, eExecPath, eDefaultSavePath,
|
||||
eRecentFile, eBeamline, eInstitute, eFileFormat, eLifetimeCorrection, eMsrDefaultFilePath,
|
||||
eTheoFuncPixmapPath, eFunc, eFuncName, eFuncComment, eFuncLabel,
|
||||
eFuncPixmap, eFuncParams, eHelpMain, eHelpTitle, eHelpParameters, eHelpTheory, eHelpFunctions,
|
||||
eHelpRun, eHelpCommand, eHelpFourier, eHelpPlot, eHelpStatistic, eHelpMsr2Data, eHelpMusrFT,
|
||||
eChainFit, eWriteDataHeader, eIgnoreDataHeaderInfo, eWriteColumnData,
|
||||
eRecreateDataFile, eOpenFileAfterFitting, eCreateMsrFileOnly, eFitOnly, eGlobal, eGlobalPlus};
|
||||
|
||||
bool startDocument();
|
||||
bool startElement( const QString&, const QString&, const QString& ,
|
||||
const QXmlAttributes& );
|
||||
bool endElement( const QString&, const QString&, const QString& );
|
||||
|
||||
bool characters(const QString&);
|
||||
bool endDocument();
|
||||
|
||||
bool warning( const QXmlParseException & exception );
|
||||
bool error( const QXmlParseException & exception );
|
||||
bool fatalError( const QXmlParseException & exception );
|
||||
|
||||
QString expandPath(const QString&);
|
||||
|
||||
EAdminKeyWords fKeyWord; ///< key word tag to know how to handle the content
|
||||
bool fFunc; ///< flag needed to indicate that a new theory function is found
|
||||
PTheory fTheoryItem; ///< holding the informations necessary for a theory item
|
||||
PAdmin *fAdmin; ///< a pointer to the main administration class object
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
* The PAdmin class is handling the informations contained in the XML startup file,
|
||||
* <tt>musredit_startup.xml</tt>. This startup file contains
|
||||
* necessary informations about executable pathes, online help informations,
|
||||
* default font sizes, etc. The XML parsing is done with the help of the PAdminXMLParser
|
||||
* class.
|
||||
*/
|
||||
class PAdmin : public QObject
|
||||
{
|
||||
public:
|
||||
PAdmin();
|
||||
virtual ~PAdmin();
|
||||
|
||||
int getTimeout() { return fTimeout; }
|
||||
QString getFontName() { return fFontName; }
|
||||
int getFontSize() { return fFontSize; }
|
||||
QString getExecPath() { return fExecPath; }
|
||||
QString getDefaultSavePath() { return fDefaultSavePath; }
|
||||
bool getTitleFromDataFileFlag() { return fTitleFromDataFile; }
|
||||
bool getMusrviewShowFourierFlag() { return fMusrviewShowFourier; }
|
||||
bool getEnableMusrT0Flag() { return fEnableMusrT0; }
|
||||
bool getKeepMinuit2OutputFlag() { return fKeepMinuit2Output; }
|
||||
bool getDumpAsciiFlag() { return fDumpAscii; }
|
||||
bool getDumpRootFlag() { return fDumpRoot; }
|
||||
bool getEstimateN0Flag() { return fEstimateN0; }
|
||||
bool getChisqPerRunBlockFlag() { return fChisqPreRunBlock; }
|
||||
QString getBeamline() { return fBeamline; }
|
||||
QString getInstitute() { return fInstitute; }
|
||||
QString getFileFormat() { return fFileFormat; }
|
||||
bool getLifetimeCorrectionFlag() { return fLifetimeCorrection; }
|
||||
QString getMsrDefaultFilePath() { return fMsrDefaultFilePath; }
|
||||
QString getHelpUrl(QString tag);
|
||||
QString getTheoFuncPixmapPath() { return fTheoFuncPixmapPath; }
|
||||
unsigned int getTheoryCounts() { return fTheory.size(); }
|
||||
PTheory* getTheoryItem(const unsigned int idx);
|
||||
PMsr2DataParam getMsr2DataParam() { return fMsr2DataParam; }
|
||||
int getNumRecentFiles() { return fRecentFile.size(); }
|
||||
QString getDefaultPrefPathName() { return fPrefPathName; }
|
||||
QString getRecentFile(int idx);
|
||||
|
||||
void setTimeout(const int ival) { fTimeout = ival; }
|
||||
void setTitleFromDataFileFlag(const bool flag) { fTitleFromDataFile = flag; }
|
||||
void setMusrviewShowFourierFlag(const bool flag) { fMusrviewShowFourier = flag; }
|
||||
void setEnableMusrT0Flag(const bool flag) { fEnableMusrT0 = flag; }
|
||||
void setKeepMinuit2OutputFlag(const bool flag) { fKeepMinuit2Output = flag; }
|
||||
void setDumpAsciiFlag(const bool flag) { fDumpAscii = flag; }
|
||||
void setDumpRootFlag(const bool flag) { fDumpRoot = flag; }
|
||||
void setEstimateN0Flag(const bool flag) { fEstimateN0 = flag; }
|
||||
void setChisqPerRunBlockFlag(const bool flag) { fChisqPreRunBlock = flag; }
|
||||
|
||||
void setFontName(const QString str) { fFontName = str; }
|
||||
void setFontSize(const int ival) { fFontSize = ival; }
|
||||
void addRecentFile(const QString str);
|
||||
|
||||
int loadPrefs(QString fln);
|
||||
int savePrefs(QString pref_fln);
|
||||
|
||||
protected:
|
||||
void setExecPath(const QString str) { fExecPath = str; }
|
||||
void setDefaultSavePath(const QString str) { fDefaultSavePath = str; }
|
||||
void setBeamline(const QString str) { fBeamline = str; }
|
||||
void setInstitute(const QString str) { fInstitute = str; }
|
||||
void setFileFormat(const QString str) { fFileFormat = str; }
|
||||
void setLifetimeCorrectionFlag(const bool flag) { fLifetimeCorrection = flag; }
|
||||
void setMsrDefaultFilePath(const QString str) { fMsrDefaultFilePath = str; }
|
||||
void setHelpUrl(const QString tag, const QString url);
|
||||
void setTheoFuncPixmapPath (const QString str) { fTheoFuncPixmapPath = str; }
|
||||
void addTheoryItem(const PTheory theo) { fTheory.push_back(theo); }
|
||||
|
||||
private:
|
||||
friend class PAdminXMLParser;
|
||||
|
||||
int fTimeout; ///< timeout in seconds
|
||||
|
||||
QString fFontName; ///< default font name
|
||||
int fFontSize; ///< default font size
|
||||
|
||||
QString fPrefPathName; ///< path-name of the musredit_startup.xml
|
||||
QString fExecPath; ///< system path to the musrfit executables
|
||||
QString fDefaultSavePath; ///< default path where the msr-file should be saved
|
||||
QString fMsrDefaultFilePath; ///< path where to find musredit source
|
||||
QString fTheoFuncPixmapPath; ///< path where the default pixmaps can be found
|
||||
|
||||
QVector<QString> fRecentFile; ///< keep vector of recent path-file names
|
||||
|
||||
bool fMusrviewShowFourier; ///< flag indicating if musrview should show at startup data (=false) or Fourier of data (=true).
|
||||
bool fKeepMinuit2Output; ///< flag indicating if the Minuit2 output shall be kept (default: no)
|
||||
bool fDumpAscii; ///< flag indicating if musrfit shall make an ascii-dump file (for debugging purposes, default: no).
|
||||
bool fDumpRoot; ///< flag indicating if musrfit shall make an root-dump file (for debugging purposes, default: no).
|
||||
bool fTitleFromDataFile; ///< flag indicating if the title should be extracted from the data file (default: yes).
|
||||
bool fChisqPreRunBlock; ///< flag indicating if musrfit shall write 'per run block' chisq to the msr-file (default: no).
|
||||
bool fEstimateN0; ///< flag indicating if musrfit shall estimate N0 for single histogram fits (default: yes).
|
||||
bool fEnableMusrT0; ///< flag indicating if musrT0 shall be enabled at startup from within musredit (default: yes).
|
||||
|
||||
QString fBeamline; ///< name of the beamline. Used to generate default run header lines.
|
||||
QString fInstitute; ///< name of the institute. Used to generate default run header lines.
|
||||
QString fFileFormat; ///< default file format. Used to generate default run header lines.
|
||||
bool fLifetimeCorrection; ///< flag indicating if by default the lifetime-correction-flag in a single histo file shall be set.
|
||||
|
||||
mutable PMsr2DataParam fMsr2DataParam; ///< keeps msr2data default parameter flags
|
||||
|
||||
QMap<QString, QString> fHelpUrl; ///< maps tag to help url
|
||||
|
||||
QVector<PTheory> fTheory; ///< stores all known theories. Needed when generating theory blocks from within musredit.
|
||||
|
||||
void saveRecentFiles(); ///< save recent file list
|
||||
};
|
||||
|
||||
#endif // _PADMIN_H_
|
||||
153
src/musredit_qt5/PDumpOutputHandler.cpp
Normal file
153
src/musredit_qt5/PDumpOutputHandler.cpp
Normal file
@@ -0,0 +1,153 @@
|
||||
/****************************************************************************
|
||||
|
||||
PDumpOutputHandler.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2012-2014 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
#include "PDumpOutputHandler.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Sets up the dump output handler GUI and starts the actual dump_header command
|
||||
*
|
||||
* \param cmd command string vector. From this the actual dump_header command will be generated and executed.
|
||||
*/
|
||||
PDumpOutputHandler::PDumpOutputHandler(QVector<QString> &cmd)
|
||||
{
|
||||
if (cmd.empty())
|
||||
return;
|
||||
|
||||
// Layout
|
||||
fVbox = new QVBoxLayout( this );
|
||||
fOutput = new QTextEdit();
|
||||
fVbox->addWidget(fOutput);
|
||||
fOutput->setMinimumSize(600, 755);
|
||||
fOutput->setReadOnly(true);
|
||||
connect( fOutput, SIGNAL( destroyed() ), this, SLOT( quitButtonPressed() ) );
|
||||
fQuitButton = new QPushButton( tr("Quit") );
|
||||
fVbox->addWidget(fQuitButton);
|
||||
connect( fQuitButton, SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
||||
resize( 600, 800 );
|
||||
fQuitButton->setFocus();
|
||||
|
||||
// QProcess related code
|
||||
fProc = new QProcess( this );
|
||||
|
||||
// Set up the command and arguments.
|
||||
QString program = cmd[0];
|
||||
QStringList arguments;
|
||||
for (int i=1; i<cmd.size(); i++)
|
||||
arguments << cmd[i];
|
||||
|
||||
connect( fProc, SIGNAL( readyReadStandardOutput() ), this, SLOT( readFromStdOut() ) );
|
||||
connect( fProc, SIGNAL( readyReadStandardError() ), this, SLOT( readFromStdErr() ) );
|
||||
|
||||
fProc->start(program, arguments);
|
||||
if ( !fProc->waitForStarted() ) {
|
||||
// error handling
|
||||
QString msg(tr("Could not execute the output command: ")+cmd[0]);
|
||||
QMessageBox::critical( 0,
|
||||
tr("Fatal error"),
|
||||
msg,
|
||||
tr("Quit") );
|
||||
done(0);
|
||||
}
|
||||
fProcPID = fProc->pid();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Destructor. Checks if the a dump_header is still running and if yes try to kill it.
|
||||
*/
|
||||
PDumpOutputHandler::~PDumpOutputHandler()
|
||||
{
|
||||
if (fProc->state() == QProcess::Running) {
|
||||
fProc->terminate();
|
||||
if (!fProc->waitForFinished()) {
|
||||
qDebug() << "fProc still running, will call kill." << endl;
|
||||
fProc->kill();
|
||||
}
|
||||
fProc->waitForFinished();
|
||||
}
|
||||
if (fProc->state() == QProcess::Running) {
|
||||
QString cmd = "kill -9 "+ fProcPID;
|
||||
QString msg = "fProc still running even after Qt kill, will try system kill cmd: "+cmd;
|
||||
qDebug() << msg << endl;
|
||||
system(cmd.toLatin1());
|
||||
}
|
||||
if (fProc) {
|
||||
delete fProc;
|
||||
fProc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Captures the standard output and adds it to the output text edit.
|
||||
*/
|
||||
void PDumpOutputHandler::readFromStdOut()
|
||||
{
|
||||
// Read and process the data.
|
||||
// Bear in mind that the data might be output in chunks.
|
||||
fOutput->append( fProc->readAllStandardOutput() );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Captures the standard error and adds it to the output text edit.
|
||||
*/
|
||||
void PDumpOutputHandler::readFromStdErr()
|
||||
{
|
||||
// Read and process the data.
|
||||
// Bear in mind that the data might be output in chunks.
|
||||
fOutput->append( fProc->readAllStandardError() );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>If the quit button is pressed while the dump_header is still running, try to terminate dump_header, if this
|
||||
* does not work, try to kill dump_header.
|
||||
*/
|
||||
void PDumpOutputHandler::quitButtonPressed()
|
||||
{
|
||||
// if the fitting is still taking place, kill it
|
||||
if (fProc->state() == QProcess::Running) {
|
||||
fProc->terminate();
|
||||
if (!fProc->waitForFinished()) {
|
||||
fProc->kill();
|
||||
}
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// END
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
72
src/musredit_qt5/PDumpOutputHandler.h
Normal file
72
src/musredit_qt5/PDumpOutputHandler.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/****************************************************************************
|
||||
|
||||
PDumpOutputHandler.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2012-2014 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 _PDUMPOUTPUTHANDLER_H_
|
||||
#define _PDUMPOUTPUTHANDLER_H_
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QTextEdit>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QVector>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>This class is the capturing the output of musrfit and displays it in a dialog so
|
||||
* the user has the chance to follow the fitting process, warnings, error messages of
|
||||
* musrfit.
|
||||
*/
|
||||
class PDumpOutputHandler : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PDumpOutputHandler(QVector<QString> &cmd);
|
||||
virtual ~PDumpOutputHandler();
|
||||
|
||||
private slots:
|
||||
virtual void readFromStdOut();
|
||||
virtual void readFromStdErr();
|
||||
virtual void quitButtonPressed();
|
||||
|
||||
private:
|
||||
Q_PID fProcPID; ///< keeps the process PID
|
||||
QProcess *fProc; ///< pointer to the dump_header process
|
||||
|
||||
QVBoxLayout *fVbox; ///< pointer to the dialog layout manager
|
||||
QTextEdit *fOutput; ///< the captured dump_header output is written (read only) into this text edit object.
|
||||
QPushButton *fQuitButton; ///< quit button
|
||||
};
|
||||
|
||||
#endif // _PDUMPOUTPUTHANDLER_H_
|
||||
108
src/musredit_qt5/PFindDialog.cpp
Normal file
108
src/musredit_qt5/PFindDialog.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
/****************************************************************************
|
||||
|
||||
PFindDialog.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2014 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "PFindDialog.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Sets up the find dialog.
|
||||
*
|
||||
* \param data pointer to the find/replace data structure needed to perform the task.
|
||||
* \param selection flag indicating if the find shall be restricted to the selected area
|
||||
* \param parent pointer to the parent object
|
||||
* \param f qt specific window flags
|
||||
*/
|
||||
PFindDialog::PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent, Qt::WindowFlags f) :
|
||||
QDialog(parent, f), fData(data)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
setModal(true);
|
||||
|
||||
// if only empty text, disable find button
|
||||
if (fData->findText == "") {
|
||||
fFind_pushButton->setEnabled(false);
|
||||
}
|
||||
|
||||
// if there is no selection, disable that option
|
||||
if (!selection) {
|
||||
fSelectedText_checkBox->setChecked(false);
|
||||
fSelectedText_checkBox->setEnabled(false);
|
||||
}
|
||||
|
||||
fFind_comboBox->setItemText(0, fData->findText);
|
||||
fCaseSensitive_checkBox->setChecked(fData->caseSensitive);
|
||||
fWholeWordsOnly_checkBox->setChecked(fData->wholeWordsOnly);
|
||||
fFromCursor_checkBox->setChecked(fData->fromCursor);
|
||||
fFindBackwards_checkBox->setChecked(fData->findBackwards);
|
||||
|
||||
if (selection) {
|
||||
fSelectedText_checkBox->setChecked(fData->selectedText);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Extracts all the necessary informations from the find dialog, feeds it to the find/replace
|
||||
* structure and returns a point to this structure.
|
||||
*/
|
||||
PFindReplaceData* PFindDialog::getData()
|
||||
{
|
||||
fData->findText = fFind_comboBox->currentText();
|
||||
fData->caseSensitive = fCaseSensitive_checkBox->isChecked();
|
||||
fData->wholeWordsOnly = fWholeWordsOnly_checkBox->isChecked();
|
||||
fData->fromCursor = fFromCursor_checkBox->isChecked();
|
||||
fData->findBackwards = fFindBackwards_checkBox->isChecked();
|
||||
if (fSelectedText_checkBox->isEnabled())
|
||||
fData->selectedText = fSelectedText_checkBox->isChecked();
|
||||
|
||||
return fData;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Enables the find button only if there is any find text entered.
|
||||
*/
|
||||
void PFindDialog::onFindTextAvailable(const QString&)
|
||||
{
|
||||
if (fFind_comboBox->currentText() != "")
|
||||
fFind_pushButton->setEnabled(true);
|
||||
else
|
||||
fFind_pushButton->setEnabled(false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// END
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
57
src/musredit_qt5/PFindDialog.h
Normal file
57
src/musredit_qt5/PFindDialog.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/****************************************************************************
|
||||
|
||||
PFindDialog.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010-2014 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 _PFINDDIALOG_H_
|
||||
#define _PFINDDIALOG_H_
|
||||
|
||||
#include "musredit.h"
|
||||
#include "ui_PFindDialog.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>PFindDialog is the class handling the find dialog.
|
||||
*/
|
||||
class PFindDialog : public QDialog, private Ui::PFindDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PFindDialog(PFindReplaceData *data, const bool selection, QWidget *parent = 0, Qt::WindowFlags f = 0);
|
||||
virtual ~PFindDialog() {}
|
||||
|
||||
virtual PFindReplaceData *getData();
|
||||
|
||||
protected slots:
|
||||
virtual void onFindTextAvailable(const QString&);
|
||||
|
||||
private:
|
||||
PFindReplaceData *fData; ///< stores the data necessary to perform find/replace.
|
||||
};
|
||||
|
||||
#endif // _PFINDDIALOG_H_
|
||||
172
src/musredit_qt5/PFitOutputHandler.cpp
Normal file
172
src/musredit_qt5/PFitOutputHandler.cpp
Normal file
@@ -0,0 +1,172 @@
|
||||
/****************************************************************************
|
||||
|
||||
PFitOutputHandler.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2014 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QTimer>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
#include "PFitOutputHandler.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Sets up the fit output handler GUI and starts the actual fit
|
||||
*
|
||||
* \param workingDirectory string holding the working directory wished. In this directory the mlog-file will be saved.
|
||||
* \param cmd command string vector. From this the actuall fit command will be generated and executed.
|
||||
*/
|
||||
PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector<QString> &cmd)
|
||||
{
|
||||
if (cmd.empty())
|
||||
return;
|
||||
|
||||
// Layout
|
||||
fVbox = new QVBoxLayout( this );
|
||||
//Qt.3x fVbox->resize(800, 500);
|
||||
fOutput = new QTextEdit();
|
||||
fVbox->addWidget(fOutput);
|
||||
fOutput->setMinimumSize(800, 455);
|
||||
fOutput->setReadOnly(true);
|
||||
connect( fOutput, SIGNAL( destroyed() ), this, SLOT( quitButtonPressed() ) );
|
||||
fQuitButton = new QPushButton( tr("Fitting...") );
|
||||
fVbox->addWidget(fQuitButton);
|
||||
connect( fQuitButton, SIGNAL( clicked() ), this, SLOT( quitButtonPressed() ) );
|
||||
resize( 800, 500 );
|
||||
fQuitButton->setFocus();
|
||||
|
||||
// QProcess related code
|
||||
fProc = new QProcess( this );
|
||||
|
||||
fProc->setWorkingDirectory(workingDirectory);
|
||||
|
||||
// Set up the command and arguments.
|
||||
QString program = cmd[0];
|
||||
QStringList arguments;
|
||||
for (int i=1; i<cmd.size(); i++)
|
||||
arguments << cmd[i];
|
||||
|
||||
connect( fProc, SIGNAL( readyReadStandardOutput() ), this, SLOT( readFromStdOut() ) );
|
||||
connect( fProc, SIGNAL( readyReadStandardError() ), this, SLOT( readFromStdErr() ) );
|
||||
connect( fProc, SIGNAL( finished(int, QProcess::ExitStatus) ), this, SLOT( processDone(int, QProcess::ExitStatus) ) );
|
||||
|
||||
fProc->start(program, arguments);
|
||||
if ( !fProc->waitForStarted() ) {
|
||||
// error handling
|
||||
QString msg(tr("Could not execute the output command: ")+cmd[0]);
|
||||
QMessageBox::critical( 0,
|
||||
tr("Fatal error"),
|
||||
msg,
|
||||
tr("Quit") );
|
||||
done(0);
|
||||
}
|
||||
fProcPID = fProc->pid();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Destructor. Checks if the a fit is still running and if yes try to kill it.
|
||||
*/
|
||||
PFitOutputHandler::~PFitOutputHandler()
|
||||
{
|
||||
if (fProc->state() == QProcess::Running) {
|
||||
fProc->terminate();
|
||||
if (!fProc->waitForFinished()) {
|
||||
qDebug() << "fProc still running, will call kill." << endl;
|
||||
fProc->kill();
|
||||
}
|
||||
fProc->waitForFinished();
|
||||
}
|
||||
if (fProc->state() == QProcess::Running) {
|
||||
QString cmd = "kill -9 "+ fProcPID;
|
||||
QString msg = "fProc still running even after Qt kill, will try system kill cmd: "+cmd;
|
||||
qDebug() << msg << endl;
|
||||
system(cmd.toLatin1());
|
||||
}
|
||||
if (fProc) {
|
||||
delete fProc;
|
||||
fProc = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Captures the standard output and adds it to the output text edit.
|
||||
*/
|
||||
void PFitOutputHandler::readFromStdOut()
|
||||
{
|
||||
// Read and process the data.
|
||||
// Bear in mind that the data might be output in chunks.
|
||||
fOutput->append( fProc->readAllStandardOutput() );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Captures the standard error and adds it to the output text edit.
|
||||
*/
|
||||
void PFitOutputHandler::readFromStdErr()
|
||||
{
|
||||
// Read and process the data.
|
||||
// Bear in mind that the data might be output in chunks.
|
||||
fOutput->append( fProc->readAllStandardError() );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>If musrfit finishes, crashes, ..., the quit button text will be changed to done.
|
||||
*
|
||||
* \param exitCode exit code of musrfit
|
||||
* \param exitStatus exit status of musrfit
|
||||
*/
|
||||
void PFitOutputHandler::processDone(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
if ((exitStatus == QProcess::CrashExit) && (exitCode != 0))
|
||||
qDebug() << "**ERROR** PFitOutputHandler::processDone: exitCode = " << exitCode << endl;
|
||||
fQuitButton->setText("Done");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>If the quit button is pressed while the fit is still running, try to terminate musrfit, if this
|
||||
* does not work, try to kill musrfit.
|
||||
*/
|
||||
void PFitOutputHandler::quitButtonPressed()
|
||||
{
|
||||
// if the fitting is still taking place, kill it
|
||||
if (fProc->state() == QProcess::Running) {
|
||||
fProc->terminate();
|
||||
if (!fProc->waitForFinished()) {
|
||||
fProc->kill();
|
||||
}
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// END
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
73
src/musredit_qt5/PFitOutputHandler.h
Normal file
73
src/musredit_qt5/PFitOutputHandler.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/****************************************************************************
|
||||
|
||||
PFitOutputHandler.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010-2014 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 _PFITOUTPUTHANDLER_H_
|
||||
#define _PFITOUTPUTHANDLER_H_
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QDialog>
|
||||
#include <QVBoxLayout>
|
||||
#include <QTextEdit>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QVector>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>This class is the capturing the output of musrfit and displays it in a dialog so
|
||||
* the user has the chance to follow the fitting process, warnings, error messages of
|
||||
* musrfit.
|
||||
*/
|
||||
class PFitOutputHandler : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PFitOutputHandler(QString workingDirectory, QVector<QString> &cmd);
|
||||
virtual ~PFitOutputHandler();
|
||||
|
||||
private slots:
|
||||
virtual void readFromStdOut();
|
||||
virtual void readFromStdErr();
|
||||
virtual void quitButtonPressed();
|
||||
virtual void processDone(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
private:
|
||||
Q_PID fProcPID; ///< keeps the process PID
|
||||
QProcess *fProc; ///< pointer to the musrfit process
|
||||
|
||||
QVBoxLayout *fVbox; ///< pointer to the dialog layout manager
|
||||
QTextEdit *fOutput; ///< the captured musrfit output is written (read only) into this text edit object.
|
||||
QPushButton *fQuitButton; ///< quit button, either to interrupt the fit or to close the dialog at the end of the fit.
|
||||
};
|
||||
|
||||
#endif // _PFITOUTPUTHANDLER_H_
|
||||
298
src/musredit_qt5/PGetAsymmetryRunBlockDialog.cpp
Normal file
298
src/musredit_qt5/PGetAsymmetryRunBlockDialog.cpp
Normal file
@@ -0,0 +1,298 @@
|
||||
/****************************************************************************
|
||||
|
||||
PGetAsymmetryRunBlockDialog.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2014 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QValidator>
|
||||
#include <QComboBox>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "PHelp.h"
|
||||
|
||||
#include "PGetAsymmetryRunBlockDialog.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor.
|
||||
*
|
||||
* \param helpUrl help url for the asymmetry run block
|
||||
*/
|
||||
PGetAsymmetryRunBlockDialog::PGetAsymmetryRunBlockDialog(const QString helpUrl) : fHelpUrl(helpUrl)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
setModal(true);
|
||||
|
||||
fForwardHistoNo_lineEdit->setValidator( new QIntValidator(fForwardHistoNo_lineEdit) );
|
||||
fBackwardHistoNo_lineEdit->setValidator( new QIntValidator(fBackwardHistoNo_lineEdit) );
|
||||
fDataForwardStart_lineEdit->setValidator( new QIntValidator(fDataForwardStart_lineEdit) );
|
||||
fDataForwardEnd_lineEdit->setValidator( new QIntValidator(fDataForwardEnd_lineEdit) );
|
||||
fDataBackwardStart_lineEdit->setValidator( new QIntValidator(fDataBackwardStart_lineEdit) );
|
||||
fDataBackwardEnd_lineEdit->setValidator( new QIntValidator(fDataBackwardEnd_lineEdit) );
|
||||
fBackgroundForwardStart_lineEdit->setValidator( new QIntValidator(fBackgroundForwardStart_lineEdit) );
|
||||
fBackgroundForwardEnd_lineEdit->setValidator( new QIntValidator(fBackgroundForwardEnd_lineEdit) );
|
||||
fBackgroundBackwardStart_lineEdit->setValidator( new QIntValidator(fBackgroundBackwardStart_lineEdit) );
|
||||
fBackgroundBackwardEnd_lineEdit->setValidator( new QIntValidator(fBackgroundBackwardEnd_lineEdit) );
|
||||
fBackgroundForwardFix_lineEdit->setValidator( new QDoubleValidator(fBackgroundForwardFix_lineEdit) );
|
||||
fBackgroundBackwardFix_lineEdit->setValidator( new QDoubleValidator(fBackgroundBackwardFix_lineEdit) );
|
||||
fFitRangeStart_lineEdit->setValidator( new QDoubleValidator(fFitRangeStart_lineEdit) );
|
||||
fFitRangeEnd_lineEdit->setValidator( new QDoubleValidator(fFitRangeEnd_lineEdit) );
|
||||
fPacking_lineEdit->setValidator( new QIntValidator(fPacking_lineEdit) );
|
||||
fAlpha_lineEdit->setValidator( new QIntValidator(fAlpha_lineEdit) );
|
||||
fBeta_lineEdit->setValidator( new QIntValidator(fBeta_lineEdit) );
|
||||
fT0Forward_lineEdit->setValidator( new QIntValidator(fT0Forward_lineEdit) );
|
||||
fT0Backward_lineEdit->setValidator( new QIntValidator(fT0Backward_lineEdit) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the run information line of the asymmetry run block.
|
||||
*/
|
||||
QString PGetAsymmetryRunBlockDialog::getRunHeaderInfo()
|
||||
{
|
||||
QString str;
|
||||
|
||||
str = "RUN " + fRunFileName_lineEdit->text() + " ";
|
||||
str += fBeamline_lineEdit->text().toUpper() + " ";
|
||||
str += fInstitute_comboBox->currentText() + " ";
|
||||
str += fFileFormat_comboBox->currentText() + " (name beamline institute data-file-format)\n";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the alpha parameter for the asymmetry run block.
|
||||
*
|
||||
* \param present flag indicating if the alpha parameter is used, or a default alpha==1 is going to be used.
|
||||
*/
|
||||
QString PGetAsymmetryRunBlockDialog::getAlphaParameter(bool &present)
|
||||
{
|
||||
QString str = "alpha " + fAlpha_lineEdit->text() + "\n";
|
||||
|
||||
if (str.isEmpty())
|
||||
present = false;
|
||||
else
|
||||
present = true;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the beta parameter for the asymmetry run block
|
||||
*
|
||||
* \param present flag indicating if the beta parameter is used, or a default beta==1 is going to be used.
|
||||
*/
|
||||
QString PGetAsymmetryRunBlockDialog::getBetaParameter(bool &present)
|
||||
{
|
||||
QString str = "beta " + fBeta_lineEdit->text() + "\n";
|
||||
|
||||
if (str.isEmpty())
|
||||
present = false;
|
||||
else
|
||||
present = true;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the map for the asymmetry run block.
|
||||
*
|
||||
* \param valid flag indicating if the map is potentially valid.
|
||||
*/
|
||||
QString PGetAsymmetryRunBlockDialog::getMap(bool &valid)
|
||||
{
|
||||
QString str = fMap_lineEdit->text().trimmed().remove(" ");
|
||||
|
||||
// check if potentially proper map line
|
||||
for (int i=0; i<str.length(); i++) {
|
||||
if (!str[i].isDigit()) {
|
||||
valid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
str = "map " + fMap_lineEdit->text() + "\n";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the background information for the asymmetry run block.
|
||||
*
|
||||
* \param valid flag indicating if a valid background (either backgr.fix or background is given, but not both)
|
||||
* is present.
|
||||
*/
|
||||
QString PGetAsymmetryRunBlockDialog::getBackground(bool &valid)
|
||||
{
|
||||
QString str = "";
|
||||
|
||||
valid = true;
|
||||
|
||||
// check that either backgr.fix or background is given, but not both
|
||||
if (fBackgroundForwardStart_lineEdit->text().isEmpty() && fBackgroundForwardEnd_lineEdit->text().isEmpty() &&
|
||||
fBackgroundBackwardStart_lineEdit->text().isEmpty() && fBackgroundBackwardEnd_lineEdit->text().isEmpty() &&
|
||||
fBackgroundForwardFix_lineEdit->text().isEmpty() && fBackgroundBackwardFix_lineEdit->text().isEmpty()) {
|
||||
valid = false;
|
||||
str = "background 0 10 0 10\n";
|
||||
} else {
|
||||
if (!fBackgroundForwardStart_lineEdit->text().isEmpty()) { // assume the rest is given, not fool prove but ...
|
||||
str = "background ";
|
||||
str += fBackgroundForwardStart_lineEdit->text() + " ";
|
||||
str += fBackgroundForwardEnd_lineEdit->text() + " ";
|
||||
str += fBackgroundBackwardStart_lineEdit->text() + " ";
|
||||
str += fBackgroundBackwardEnd_lineEdit->text() + "\n";
|
||||
}
|
||||
if (!fBackgroundForwardFix_lineEdit->text().isEmpty()) { // assume the rest is given, not fool prove but ...
|
||||
str = "backgr.fix ";
|
||||
str += fBackgroundForwardFix_lineEdit->text() + " ";
|
||||
str += fBackgroundBackwardFix_lineEdit->text() + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns a data range (in bins) entry for the asymmetry run block.
|
||||
*
|
||||
* \param valid flag indicating if the data entries are valid.
|
||||
*/
|
||||
QString PGetAsymmetryRunBlockDialog::getData(bool &valid)
|
||||
{
|
||||
QString str = "";
|
||||
|
||||
if (fDataForwardStart_lineEdit->text().isEmpty() || fDataForwardEnd_lineEdit->text().isEmpty() ||
|
||||
fDataBackwardStart_lineEdit->text().isEmpty() || fDataBackwardEnd_lineEdit->text().isEmpty()) {
|
||||
valid = false;
|
||||
} else {
|
||||
str = "data ";
|
||||
str += fDataForwardStart_lineEdit->text() + " ";
|
||||
str += fDataForwardEnd_lineEdit->text() + " ";
|
||||
str += fDataBackwardStart_lineEdit->text() + " ";
|
||||
str += fDataBackwardEnd_lineEdit->text() + "\n";
|
||||
valid = true;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns a t0 parameter for the asymmetry run block.
|
||||
*
|
||||
* \param present flag indicating if a t0 parameter is set.
|
||||
*/
|
||||
QString PGetAsymmetryRunBlockDialog::getT0(bool &present)
|
||||
{
|
||||
QString str = "";
|
||||
|
||||
if (!fT0Forward_lineEdit->text().isEmpty() && !fT0Forward_lineEdit->text().isEmpty()) {
|
||||
str = "t0 ";
|
||||
str += fT0Forward_lineEdit->text() + " ";
|
||||
str += fT0Backward_lineEdit->text() + "\n";
|
||||
present = true;
|
||||
} else {
|
||||
present = false;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns a fit range entry for the asymmetry run block. If no fit range has been provided,
|
||||
* a fit range [0,10] will be set and the valid flag will be set to false.
|
||||
*
|
||||
* \param valid flag indicating if a fit range was provided.
|
||||
*/
|
||||
QString PGetAsymmetryRunBlockDialog::getFitRange(bool &valid)
|
||||
{
|
||||
QString str = "";
|
||||
|
||||
if (fFitRangeStart_lineEdit->text().isEmpty() || fFitRangeEnd_lineEdit->text().isEmpty()) {
|
||||
str += "fit 0.0 10.0\n";
|
||||
valid = false;
|
||||
} else {
|
||||
str += "fit ";
|
||||
str += fFitRangeStart_lineEdit->text() + " ";
|
||||
str += fFitRangeEnd_lineEdit->text() + "\n";
|
||||
valid = true;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>returns the packing/binning of the asymmetry run block. If no packing has been provided,
|
||||
* a packing of '1' will be set and the present flag will be set to false.
|
||||
*
|
||||
* \param present flag indicating if a packing parameter was provided.
|
||||
*/
|
||||
QString PGetAsymmetryRunBlockDialog::getPacking(bool &present)
|
||||
{
|
||||
QString str = "";
|
||||
|
||||
if (fPacking_lineEdit->text().isEmpty()) {
|
||||
present = false;
|
||||
str += "packing 1\n";
|
||||
} else {
|
||||
present = true;
|
||||
str += "packing " + fPacking_lineEdit->text() + "\n\n";
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Generates a help content window showing the description of the asymmetry run block.
|
||||
*/
|
||||
void PGetAsymmetryRunBlockDialog::helpContent()
|
||||
{
|
||||
if (fHelpUrl.isEmpty()) {
|
||||
QMessageBox::information(this, "**INFO**", "Will eventually show a help window");
|
||||
} else {
|
||||
#ifdef _WIN32GCC
|
||||
QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!");
|
||||
#else
|
||||
PHelp *help = new PHelp(fHelpUrl);
|
||||
help->show();
|
||||
#endif // _WIN32GCC
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// END
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
65
src/musredit_qt5/PGetAsymmetryRunBlockDialog.h
Normal file
65
src/musredit_qt5/PGetAsymmetryRunBlockDialog.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/****************************************************************************
|
||||
|
||||
PGetAsymmetryRunBlockDialog.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2014 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 _PGETASYMMETRYRUNBLOCKDIALOG_H_
|
||||
#define _PGETASYMMETRYRUNBLOCKDIALOG_H_
|
||||
|
||||
#include "ui_PGetAsymmetryRunBlockDialog.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Class handling the content of the menu: Edit/Add Block/Asymmetry Run Block.
|
||||
*/
|
||||
class PGetAsymmetryRunBlockDialog : public QDialog, private Ui::PGetAsymmetryRunBlockDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PGetAsymmetryRunBlockDialog(const QString helpUrl);
|
||||
|
||||
QString getRunHeaderInfo();
|
||||
QString getAlphaParameter(bool &present);
|
||||
QString getBetaParameter(bool &present);
|
||||
QString getMap(bool &valid);
|
||||
QString getForward() { return QString("forward " + fForwardHistoNo_lineEdit->text() + "\n"); }
|
||||
QString getBackward() { return QString("backward " + fBackwardHistoNo_lineEdit->text() + "\n"); }
|
||||
QString getBackground(bool &valid);
|
||||
QString getData(bool &valid);
|
||||
QString getT0(bool &present);
|
||||
QString getFitRange(bool &valid);
|
||||
QString getPacking(bool &present);
|
||||
|
||||
private slots:
|
||||
void helpContent();
|
||||
|
||||
private:
|
||||
QString fHelpUrl; ///< help url for the asymmetry run block
|
||||
};
|
||||
|
||||
#endif // _PGETASYMMETRYRUNBLOCKDIALOG_H_
|
||||
118
src/musredit_qt5/PGetDefaultDialog.cpp
Normal file
118
src/musredit_qt5/PGetDefaultDialog.cpp
Normal file
@@ -0,0 +1,118 @@
|
||||
/****************************************************************************
|
||||
|
||||
PGetDefaultDialog.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2014 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QObject>
|
||||
#include <QComboBox>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "PHelp.h"
|
||||
|
||||
#include "PGetDefaultDialog.h"
|
||||
|
||||
#define INSTITUTE_PSI 0
|
||||
#define INSTITUTE_RAL 1
|
||||
#define INSTITUTE_TRIUMF 2
|
||||
#define INSTITUTE_JPARC 3
|
||||
|
||||
#define FILE_FORMAT_NEXUS 0
|
||||
#define FILE_FORMAT_ROOT_NPP 1
|
||||
#define FILE_FORMAT_ROOT_PPC 2
|
||||
#define FILE_FORMAT_PSIBIN 3
|
||||
#define FILE_FORMAT_MUD 4
|
||||
#define FILE_FORMAT_WKM 5
|
||||
#define FILE_FORMAT_ASCII 6
|
||||
#define FILE_FORMAT_DB 7
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor
|
||||
*
|
||||
* \param helpUrl help url for the default dialog
|
||||
*/
|
||||
PGetDefaultDialog::PGetDefaultDialog(const QString helpUrl) : fHelpUrl(helpUrl)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Finds the name of the institute in the combo box and selects it.
|
||||
*
|
||||
* \param str name of the institute
|
||||
*/
|
||||
void PGetDefaultDialog::setInstitute(const QString &str) {
|
||||
|
||||
for (int i=0; i<fInstitute_comboBox->count(); i++) {
|
||||
if (fInstitute_comboBox->itemText(i).toLower() == str.toLower()) {
|
||||
fInstitute_comboBox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Finds the file format in the combo box and selects it.
|
||||
*
|
||||
* \param str file format
|
||||
*/
|
||||
void PGetDefaultDialog::setFileFormat(const QString &str)
|
||||
{
|
||||
|
||||
for (int i=0; i<fFileFormat_comboBox->count(); i++) {
|
||||
if (fFileFormat_comboBox->itemText(i).toLower() == str.toLower()) {
|
||||
fFileFormat_comboBox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Generates a help content window showing the description fitting the default dialog.
|
||||
*/
|
||||
void PGetDefaultDialog::helpContent()
|
||||
{
|
||||
#ifdef _WIN32GCC
|
||||
QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!");
|
||||
#else
|
||||
PHelp *help = new PHelp(fHelpUrl);
|
||||
help->show();
|
||||
#endif // _WIN32GCC
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// END
|
||||
//---------------------------------------------------------------------------
|
||||
69
src/musredit_qt5/PGetDefaultDialog.h
Normal file
69
src/musredit_qt5/PGetDefaultDialog.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/****************************************************************************
|
||||
|
||||
PGetDefaultDialog.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010-2014 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 _PGETDEFAULTDIALOG_H_
|
||||
#define _PGETDEFAULTDIALOG_H_
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
|
||||
#include "ui_PGetDefaultDialog.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Handels the default dialog which is used to generate a default asymmetry or
|
||||
* single histogram msr input file.
|
||||
*/
|
||||
class PGetDefaultDialog : public QDialog, private Ui::PGetDefaultDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PGetDefaultDialog(const QString helpUrl = "");
|
||||
virtual ~PGetDefaultDialog() {}
|
||||
|
||||
virtual const QString getRunFileName() const { return fRunFileName_lineEdit->text(); }
|
||||
virtual const QString getBeamline() const { return fBeamline_lineEdit->text(); }
|
||||
virtual const QString getInstitute() const { return fInstitute_comboBox->currentText(); }
|
||||
virtual const QString getFileFormat() const { return fFileFormat_comboBox->currentText(); }
|
||||
|
||||
virtual void setBeamline(const QString &str) { fBeamline_lineEdit->setText(str); }
|
||||
virtual void setInstitute(const QString &str);
|
||||
virtual void setFileFormat(const QString &str);
|
||||
|
||||
protected slots:
|
||||
virtual void helpContent();
|
||||
|
||||
private:
|
||||
QString fHelpUrl; ///< help url for the default dialog
|
||||
};
|
||||
|
||||
#endif // _PGETDEFAULTDIALOG_H_
|
||||
146
src/musredit_qt5/PGetFourierBlockDialog.cpp
Normal file
146
src/musredit_qt5/PGetFourierBlockDialog.cpp
Normal file
@@ -0,0 +1,146 @@
|
||||
/****************************************************************************
|
||||
|
||||
PGetFourierBlockDialog.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2014 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QObject>
|
||||
#include <QComboBox>
|
||||
#include <QValidator>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "PHelp.h"
|
||||
|
||||
#include "PGetFourierBlockDialog.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor
|
||||
*
|
||||
* \param helpUrl help url address for the Fourier block.
|
||||
*/
|
||||
PGetFourierBlockDialog::PGetFourierBlockDialog(const QString helpUrl) : fHelpUrl(helpUrl)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
setModal(true);
|
||||
|
||||
fFourierBlock = "";
|
||||
fFourierPower_lineEdit->setValidator( new QIntValidator(fFourierPower_lineEdit) );
|
||||
fPhaseCorrectionRangeLow_lineEdit->setValidator( new QDoubleValidator(fPhaseCorrectionRangeLow_lineEdit) );
|
||||
fPhaseCorrectionRangeUp_lineEdit->setValidator( new QDoubleValidator(fPhaseCorrectionRangeUp_lineEdit) );
|
||||
fRangeLow_lineEdit->setValidator( new QDoubleValidator(fRangeLow_lineEdit) );
|
||||
fRangeUp_lineEdit->setValidator( new QDoubleValidator(fRangeUp_lineEdit) );
|
||||
|
||||
connect( fPhase_lineEdit, SIGNAL( lostFocus() ), this, SLOT( checkPhaseParameter() ) );
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Checks if the phase parameter is either a number are has the form parXX, where XX is a number.
|
||||
*/
|
||||
void PGetFourierBlockDialog::checkPhaseParameter()
|
||||
{
|
||||
QString str = fPhase_lineEdit->text();
|
||||
|
||||
if (str.isEmpty())
|
||||
return;
|
||||
|
||||
bool ok;
|
||||
int ival;
|
||||
|
||||
ival = str.toInt(&ok);
|
||||
if (!ok) { // i.e. the phase entry is not a number. Check for parXX
|
||||
str.trimmed();
|
||||
if (str.startsWith("par")) { //
|
||||
str.remove("par");
|
||||
ival = str.toInt(&ok);
|
||||
if (!ok) {
|
||||
fPhase_lineEdit->clear();
|
||||
QMessageBox::critical(this, "**ERROR**",
|
||||
"Allowed phase entries are either a parameter number,\n or an parXX entry, where XX is a parameter number",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
fPhase_lineEdit->setFocus();
|
||||
}
|
||||
} else { // neither a parXX nor a number
|
||||
fPhase_lineEdit->clear();
|
||||
QMessageBox::critical(this, "**ERROR**",
|
||||
"Allowed phase entries are either a parameter number,\n or an parXX entry, where XX is a parameter number",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
fPhase_lineEdit->setFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Transfers the data of the dialog into a valid msr-file Fourier block string.
|
||||
*/
|
||||
void PGetFourierBlockDialog::fillFourierBlock()
|
||||
{
|
||||
fFourierBlock = "###############################################################\n";
|
||||
fFourierBlock += "FOURIER\n";
|
||||
fFourierBlock += "units " + fUnits_comboBox->currentText() + "\n";
|
||||
QString str = fFourierPower_lineEdit->text();
|
||||
if (!str.isEmpty())
|
||||
fFourierBlock += "fourier_power " + str + "\n";
|
||||
fFourierBlock += "apodization " + fApodization_comboBox->currentText() + "\n";
|
||||
fFourierBlock += "plot " + fPlot_comboBox->currentText() + "\n";
|
||||
str = fPhase_lineEdit->text();
|
||||
if (!str.isEmpty())
|
||||
fFourierBlock += "phase " + str + "\n";
|
||||
if (!fPhaseCorrectionRangeLow_lineEdit->text().isEmpty() && !fPhaseCorrectionRangeUp_lineEdit->text().isEmpty()) {
|
||||
fFourierBlock += "range_for_phase_correction " + fPhaseCorrectionRangeLow_lineEdit->text() + " " +
|
||||
fPhaseCorrectionRangeUp_lineEdit->text() + "\n";
|
||||
}
|
||||
if (!fRangeLow_lineEdit->text().isEmpty() && !fRangeUp_lineEdit->text().isEmpty()) {
|
||||
fFourierBlock += "range " + fRangeLow_lineEdit->text() + " " + fRangeUp_lineEdit->text() + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Generates a help content window showing the description of the Fourier block.
|
||||
*/
|
||||
void PGetFourierBlockDialog::helpContent()
|
||||
{
|
||||
if (fHelpUrl.isEmpty()) {
|
||||
QMessageBox::information(this, "**INFO**", "Will eventually show a help window");
|
||||
} else {
|
||||
#ifdef _WIN32GCC
|
||||
QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!");
|
||||
#else
|
||||
PHelp *help = new PHelp(fHelpUrl);
|
||||
help->show();
|
||||
#endif // _WIN32GCC
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// END
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
60
src/musredit_qt5/PGetFourierBlockDialog.h
Normal file
60
src/musredit_qt5/PGetFourierBlockDialog.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/****************************************************************************
|
||||
|
||||
PGetFourierBlockDialog.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2014 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 _PGETFOURIERBLOCKDIALOG_H_
|
||||
#define _PGETFOURIERBLOCKDIALOG_H_
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include "ui_PGetFourierBlockDialog.h"
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Handles the Fourier dialog.
|
||||
*/
|
||||
class PGetFourierBlockDialog : public QDialog, private Ui::PGetFourierBlockDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PGetFourierBlockDialog(const QString helpUrl);
|
||||
|
||||
QString getFourierBlock() { return fFourierBlock; }
|
||||
|
||||
private slots:
|
||||
void checkPhaseParameter();
|
||||
void fillFourierBlock();
|
||||
void helpContent();
|
||||
|
||||
private:
|
||||
QString fFourierBlock; ///< keeps the msr Fourier block
|
||||
QString fHelpUrl; ///< help url for the Fourier block
|
||||
};
|
||||
|
||||
#endif // _PGETFOURIERBLOCKDIALOG_H_
|
||||
122
src/musredit_qt5/PGetFunctionsBlockDialog.cpp
Normal file
122
src/musredit_qt5/PGetFunctionsBlockDialog.cpp
Normal file
@@ -0,0 +1,122 @@
|
||||
/****************************************************************************
|
||||
|
||||
PGetFunctionsBlockDialog.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2014 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QRegExp>
|
||||
#include <QEvent>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
#include "PHelp.h"
|
||||
|
||||
#include "PGetFunctionsBlockDialog.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor.
|
||||
*
|
||||
* \param helpUrl help url for the FUNCTIONS block.
|
||||
*/
|
||||
PGetFunctionsBlockDialog::PGetFunctionsBlockDialog(const QString helpUrl) : fHelpUrl(helpUrl)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
setModal(true);
|
||||
|
||||
fFunctionInput_lineEdit->setFocus();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Adds a function to the FUNCTIONS block text edit after carrying out some primitve tests about
|
||||
* the consistency of the function (far from being a syntax/semantic checker!!).
|
||||
*/
|
||||
void PGetFunctionsBlockDialog::addFunction()
|
||||
{
|
||||
QString str = fFunctionInput_lineEdit->text();
|
||||
|
||||
if (str.isEmpty())
|
||||
return;
|
||||
|
||||
// validation
|
||||
|
||||
// check that the function string starts with 'fun'
|
||||
if (!str.trimmed().startsWith("fun")) {
|
||||
QMessageBox::critical(this, "addFunction",
|
||||
"a function has to start with 'funX' (X a number).\nNeeds to be fixed.",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return;
|
||||
}
|
||||
|
||||
// check if function string contains 'funX ='
|
||||
if (str.indexOf( QRegExp("fun\\d+\\s*=") ) == -1) {
|
||||
QMessageBox::critical(this, "addFunction",
|
||||
"a function has to start with 'funX =' (X a positive number).\nNeeds to be fixed.",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return;
|
||||
}
|
||||
|
||||
// check if function string contains more than one 'funX'
|
||||
if (str.trimmed().lastIndexOf("fun", -1, Qt::CaseInsensitive) > 0) {
|
||||
QMessageBox::critical(this, "addFunction",
|
||||
"a function cannot contain more than one function,\ni.e. fun2 = fun1 + par1 is not OK.",
|
||||
QMessageBox::Ok, QMessageBox::NoButton);
|
||||
return;
|
||||
}
|
||||
|
||||
// add to Functions block
|
||||
fFunctionBlock_plainTextEdit->appendPlainText(str);
|
||||
|
||||
// clear functions input text
|
||||
fFunctionInput_lineEdit->clear();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Generates a help content window showing the description of the FUNCTIONS block.
|
||||
*/
|
||||
void PGetFunctionsBlockDialog::helpContent()
|
||||
{
|
||||
if (fHelpUrl.isEmpty()) {
|
||||
QMessageBox::information(this, "**INFO**", "Will eventually show a help window");
|
||||
} else {
|
||||
#ifdef _WIN32GCC
|
||||
QMessageBox::information(this, "**INFO**", "If a newer Qt version was available, a help window would be shown!");
|
||||
#else
|
||||
PHelp *help = new PHelp(fHelpUrl);
|
||||
help->show();
|
||||
#endif // _WIN32GCC
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// END
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user