Merge branch 'beta-NMR' into root6
This commit is contained in:
@ -71,6 +71,7 @@ add_library(PMusr SHARED
|
||||
PMusrT0Dict.cxx
|
||||
PPrepFourier.cpp
|
||||
PRunAsymmetry.cpp
|
||||
PRunAsymmetryBNMR.cpp
|
||||
PRunAsymmetryRRF.cpp
|
||||
PRunBase.cpp
|
||||
PRunDataHandler.cpp
|
||||
|
@ -77,6 +77,7 @@ Double_t PFitterFcn::operator()(const std::vector<Double_t>& par) const
|
||||
value += fRunListCollection->GetSingleHistoRRFChisq(par);
|
||||
value += fRunListCollection->GetAsymmetryChisq(par);
|
||||
value += fRunListCollection->GetAsymmetryRRFChisq(par);
|
||||
value += fRunListCollection->GetAsymmetryBNMRChisq(par);
|
||||
value += fRunListCollection->GetMuMinusChisq(par);
|
||||
value += fRunListCollection->GetNonMusrChisq(par);
|
||||
} else { // max likelihood
|
||||
@ -84,6 +85,7 @@ Double_t PFitterFcn::operator()(const std::vector<Double_t>& par) const
|
||||
value += fRunListCollection->GetSingleHistoRRFMaximumLikelihood(par);
|
||||
value += fRunListCollection->GetAsymmetryMaximumLikelihood(par);
|
||||
value += fRunListCollection->GetAsymmetryRRFMaximumLikelihood(par);
|
||||
value += fRunListCollection->GetAsymmetryBNMRMaximumLikelihood(par);
|
||||
value += fRunListCollection->GetMuMinusMaximumLikelihood(par);
|
||||
value += fRunListCollection->GetNonMusrMaximumLikelihood(par);
|
||||
}
|
||||
|
@ -640,6 +640,9 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
case MSR_FITTYPE_MU_MINUS:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_BNMR:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_BNMR << " (beta-NMR fit)" << std::endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_NON_MUSR:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ;
|
||||
break;
|
||||
@ -804,6 +807,9 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
case MSR_FITTYPE_MU_MINUS:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_BNMR:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_BNMR << " (beta-NMR fit)" << std::endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_NON_MUSR:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ;
|
||||
break;
|
||||
@ -1167,6 +1173,9 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
case MSR_PLOT_MU_MINUS:
|
||||
fout << "PLOT " << fPlots[plotNo].fPlotType << " (mu minus plot)" << std::endl;
|
||||
break;
|
||||
case MSR_PLOT_BNMR:
|
||||
fout << "PLOT " << fPlots[plotNo].fPlotType << " (beta-NMR asymmetry plot)" << std::endl;
|
||||
break;
|
||||
case MSR_PLOT_NON_MUSR:
|
||||
fout << "PLOT " << fPlots[plotNo].fPlotType << " (non muSR plot)" << std::endl;
|
||||
break;
|
||||
@ -1716,6 +1725,9 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, std::map<UInt_t, TString
|
||||
case MSR_FITTYPE_MU_MINUS:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_BNMR:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_BNMR << " (beta-NMR fit)" << std::endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_NON_MUSR:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ;
|
||||
break;
|
||||
@ -1907,6 +1919,9 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, std::map<UInt_t, TString
|
||||
case MSR_FITTYPE_MU_MINUS:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_MU_MINUS << " (mu minus fit)" << std::endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_BNMR:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_BNMR << " (beta-NMR fit)" << std::endl ;
|
||||
break;
|
||||
case MSR_FITTYPE_NON_MUSR:
|
||||
fout << std::left << "fittype" << MSR_FITTYPE_NON_MUSR << " (non muSR fit)" << std::endl ;
|
||||
break;
|
||||
@ -2263,6 +2278,9 @@ Int_t PMsrHandler::WriteMsrFile(const Char_t *filename, std::map<UInt_t, TString
|
||||
case MSR_PLOT_MU_MINUS:
|
||||
fout << "PLOT " << fPlots[i].fPlotType << " (mu minus plot)" << std::endl;
|
||||
break;
|
||||
case MSR_PLOT_BNMR:
|
||||
fout << "PLOT " << fPlots[i].fPlotType << " (beta-NMR asymmetry plot)" << std::endl;
|
||||
break;
|
||||
case MSR_PLOT_NON_MUSR:
|
||||
fout << "PLOT " << fPlots[i].fPlotType << " (non muSR plot)" << std::endl;
|
||||
break;
|
||||
@ -2981,6 +2999,7 @@ Bool_t PMsrHandler::HandleGlobalEntry(PMsrLines &lines)
|
||||
(fittype == MSR_FITTYPE_ASYM) ||
|
||||
(fittype == MSR_FITTYPE_ASYM_RRF) ||
|
||||
(fittype == MSR_FITTYPE_MU_MINUS) ||
|
||||
(fittype == MSR_FITTYPE_BNMR) ||
|
||||
(fittype == MSR_FITTYPE_NON_MUSR)) {
|
||||
global.SetFitType(fittype);
|
||||
} else {
|
||||
@ -3322,6 +3341,7 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
|
||||
(fittype == MSR_FITTYPE_ASYM) ||
|
||||
(fittype == MSR_FITTYPE_ASYM_RRF) ||
|
||||
(fittype == MSR_FITTYPE_MU_MINUS) ||
|
||||
(fittype == MSR_FITTYPE_BNMR) ||
|
||||
(fittype == MSR_FITTYPE_NON_MUSR)) {
|
||||
param.SetFitType(fittype);
|
||||
} else {
|
||||
@ -4589,6 +4609,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
|
||||
case MSR_PLOT_SINGLE_HISTO: // like: runs 1 5 13
|
||||
case MSR_PLOT_SINGLE_HISTO_RRF:
|
||||
case MSR_PLOT_ASYM:
|
||||
case MSR_PLOT_BNMR:
|
||||
case MSR_PLOT_ASYM_RRF:
|
||||
case MSR_PLOT_NON_MUSR:
|
||||
case MSR_PLOT_MU_MINUS:
|
||||
@ -5006,6 +5027,7 @@ Bool_t PMsrHandler::HandlePlotEntry(PMsrLines &lines)
|
||||
std::cerr << std::endl << ">> 2=forward-backward asym,";
|
||||
std::cerr << std::endl << ">> 3=forward-backward RRF asym,";
|
||||
std::cerr << std::endl << ">> 4=mu minus single histo,";
|
||||
std::cerr << std::endl << ">> 5=forward-backward beta-NMR asym,";
|
||||
std::cerr << std::endl << ">> 8=non muSR.";
|
||||
std::cerr << std::endl << ">> <run_list> is the list of runs, e.g. runs 1 3";
|
||||
std::cerr << std::endl << ">> range is optional";
|
||||
@ -5863,6 +5885,58 @@ Bool_t PMsrHandler::CheckRunBlockIntegrity()
|
||||
fRuns[i].SetPacking(1);
|
||||
}
|
||||
break;
|
||||
case PRUN_ASYMMETRY_BNMR:
|
||||
// check alpha
|
||||
// if ((fRuns[i].GetAlphaParamNo() == -1) && !fFourierOnly) {
|
||||
// std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
// std::cerr << std::endl << ">> alpha parameter number missing which is needed for an asymmetry fit.";
|
||||
// std::cerr << std::endl << ">> Consider to check the manual ;-)" << std::endl;
|
||||
// return false;
|
||||
// }
|
||||
// check that there is a forward parameter number
|
||||
if (fRuns[i].GetForwardHistoNo() == -1) {
|
||||
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
std::cerr << std::endl << ">> forward histogram number not defined. Necessary for asymmetry fits." << std::endl;
|
||||
return false;
|
||||
}
|
||||
// check that there is a backward parameter number
|
||||
if (fRuns[i].GetBackwardHistoNo() == -1) {
|
||||
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
std::cerr << std::endl << ">> backward histogram number not defined. Necessary for asymmetry fits." << std::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)) {
|
||||
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
std::cerr << std::endl << ">> Fit range is not defined, also NOT present in the GLOBAL block. Necessary for asymmetry fits." << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// check number of T0's provided
|
||||
if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize()) &&
|
||||
(fGlobal.GetT0BinSize() > 2*fRuns[i].GetForwardHistoNoSize())) {
|
||||
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
std::cerr << std::endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << " in forward. Needs to be fixed." << std::endl;
|
||||
std::cerr << std::endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetForwardHistoNoSize() << ". Needs to be fixed." << std::endl;
|
||||
return false;
|
||||
}
|
||||
if ((fRuns[i].GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize()) &&
|
||||
(fGlobal.GetT0BinSize() > 2*fRuns[i].GetBackwardHistoNoSize())) {
|
||||
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **ERROR** in RUN block number " << i+1;
|
||||
std::cerr << std::endl << ">> Found " << fRuns[i].GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << " in backward. Needs to be fixed." << std::endl;
|
||||
std::cerr << std::endl << ">> In GLOBAL block: " << fGlobal.GetT0BinSize() << " T0 entries. Expecting only " << 2*fRuns[i].GetBackwardHistoNoSize() << ". Needs to be fixed." << std::endl;
|
||||
return false;
|
||||
}
|
||||
// check packing
|
||||
if ((fRuns[i].GetPacking() == -1) && (fGlobal.GetPacking() == -1)) {
|
||||
std::cerr << std::endl << ">> PMsrHandler::CheckRunBlockIntegrity(): **WARNING** in RUN block number " << i+1;
|
||||
std::cerr << std::endl << ">> Packing is neither defined here, nor in the GLOBAL block, will set it to 1." << std::endl;
|
||||
fRuns[i].SetPacking(1);
|
||||
}
|
||||
break;
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
// check alpha
|
||||
if ((fRuns[i].GetAlphaParamNo() == -1) && !fFourierOnly) {
|
||||
@ -6207,7 +6281,7 @@ Bool_t PMsrHandler::CheckHistoGrouping()
|
||||
Bool_t result = true;
|
||||
|
||||
for (UInt_t i=0; i<fRuns.size(); i++) {
|
||||
if (fRuns[i].GetFitType() == MSR_FITTYPE_ASYM) {
|
||||
if (fRuns[i].GetFitType() == MSR_FITTYPE_ASYM || fRuns[i].GetFitType() == MSR_FITTYPE_BNMR) {
|
||||
if (fRuns[i].GetForwardHistoNoSize() != fRuns[i].GetBackwardHistoNoSize()) {
|
||||
std::cerr << std::endl << ">> PMsrHandler::CheckHistoGrouping: **ERROR** # of forward histos != # of backward histos.";
|
||||
std::cerr << std::endl << ">> Run #" << i+1;
|
||||
|
@ -1878,6 +1878,19 @@ void PMsrRunBlock::SetMapGlobal(UInt_t idx, Int_t ival)
|
||||
return;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetEstimatedAlpha (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> set the value of estimated alpha at position idx
|
||||
*
|
||||
* \param alpha is the estimated value
|
||||
*/
|
||||
void PMsrRunBlock::SetEstimatedAlpha(Double_t dval)
|
||||
{
|
||||
fAlpha = dval;
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// implementation PStringNumberList
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
@ -710,6 +710,18 @@ void PMusrCanvas::UpdateDataTheoryPad()
|
||||
// handle data
|
||||
HandleDataSet(i, runNo, data);
|
||||
break;
|
||||
case MSR_FITTYPE_BNMR:
|
||||
data = fRunList->GetAsymmetryBNMR(runNo, PRunListCollection::kRunNo);
|
||||
if (!data) { // something wrong
|
||||
fValid = false;
|
||||
// error message
|
||||
std::cerr << std::endl << ">> PMusrCanvas::UpdateDataTheoryPad(): **ERROR** couldn't obtain run no " << runNo << " for a beta-NMR asymmetry plot";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
// handle data
|
||||
HandleDataSet(i, runNo, data);
|
||||
break;
|
||||
case MSR_FITTYPE_ASYM_RRF:
|
||||
data = fRunList->GetAsymmetryRRF(runNo, PRunListCollection::kRunNo);
|
||||
if (!data) { // something wrong
|
||||
@ -902,7 +914,8 @@ void PMusrCanvas::UpdateInfoPad()
|
||||
tstr += grouping;
|
||||
tstr += TString(",");
|
||||
} else if ((runs[runNo].GetFitType() == MSR_FITTYPE_ASYM) ||
|
||||
(runs[runNo].GetFitType() == MSR_FITTYPE_ASYM_RRF)) {
|
||||
(runs[runNo].GetFitType() == MSR_FITTYPE_ASYM_RRF) ||
|
||||
(runs[runNo].GetFitType() == MSR_FITTYPE_BNMR)) {
|
||||
tstr += TString("h:");
|
||||
TString grouping;
|
||||
fMsrHandler->GetGroupingString(runNo, "forward", grouping);
|
||||
@ -1597,6 +1610,7 @@ void PMusrCanvas::ExportData(const Char_t *fileName)
|
||||
case MSR_PLOT_SINGLE_HISTO:
|
||||
case MSR_PLOT_SINGLE_HISTO_RRF:
|
||||
case MSR_PLOT_ASYM:
|
||||
case MSR_PLOT_BNMR:
|
||||
case MSR_PLOT_ASYM_RRF:
|
||||
case MSR_PLOT_MU_MINUS:
|
||||
if (fDifferenceView) { // difference view plot
|
||||
@ -2756,7 +2770,7 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data)
|
||||
size = data->GetValue()->size();
|
||||
dataSet.dataRange->SetXRange(start, end); // full possible range
|
||||
// make sure that for asymmetry the y-range is initialized reasonably
|
||||
if (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_ASYM)
|
||||
if ((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_ASYM) || (fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_BNMR))
|
||||
dataSet.dataRange->SetYRange(-0.4, 0.4);
|
||||
// extract necessary range information
|
||||
if ((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fTmin.size() == 0) &&
|
||||
@ -2772,6 +2786,7 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data)
|
||||
fXmax = end;
|
||||
}
|
||||
if ((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_ASYM) ||
|
||||
(fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_BNMR) ||
|
||||
(fMsrHandler->GetMsrRunList()->at(runNo).IsLifetimeCorrected())) {
|
||||
fYRangePresent = true;
|
||||
fYmin = -0.4;
|
||||
@ -2820,6 +2835,7 @@ void PMusrCanvas::HandleDataSet(UInt_t plotNo, UInt_t runNo, PRunData *data)
|
||||
|
||||
// make sure that for asymmetry the y-range is initialized reasonably
|
||||
if ((fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_ASYM) ||
|
||||
(fMsrHandler->GetMsrPlotList()->at(fPlotNumber).fPlotType == MSR_PLOT_BNMR) ||
|
||||
(fMsrHandler->GetMsrRunList()->at(runNo).IsLifetimeCorrected())) {
|
||||
dataSet.dataRange->SetYRange(-0.4, 0.4);
|
||||
}
|
||||
@ -4679,7 +4695,13 @@ void PMusrCanvas::PlotData(Bool_t unzoom)
|
||||
fDataTheoryPad->SetLogy(1);
|
||||
|
||||
// set x-axis label
|
||||
fHistoFrame->GetXaxis()->SetTitle("Time (#mus)");
|
||||
if (fPlotType == MSR_PLOT_BNMR ) {
|
||||
// For BNMR/BNQR runs use seconds
|
||||
fHistoFrame->GetXaxis()->SetTitle("time (s)");
|
||||
} else {
|
||||
fHistoFrame->GetXaxis()->SetTitle("time (#mus)");
|
||||
}
|
||||
|
||||
// set y-axis label
|
||||
TString yAxisTitle;
|
||||
PMsrRunList *runList = fMsrHandler->GetMsrRunList();
|
||||
@ -4701,6 +4723,9 @@ void PMusrCanvas::PlotData(Bool_t unzoom)
|
||||
case MSR_PLOT_ASYM:
|
||||
yAxisTitle = "Asymmetry";
|
||||
break;
|
||||
case MSR_PLOT_BNMR:
|
||||
yAxisTitle = "Asymmetry";
|
||||
break;
|
||||
case MSR_PLOT_MU_MINUS:
|
||||
yAxisTitle = "N(t) per bin";
|
||||
break;
|
||||
@ -4963,7 +4988,12 @@ void PMusrCanvas::PlotDifference(Bool_t unzoom)
|
||||
fHistoFrame->SetBins(noOfPoints, dataXmin, dataXmax);
|
||||
|
||||
// set x-axis label
|
||||
if (fPlotType == MSR_PLOT_BNMR) {
|
||||
// For BNMR/BNQR runs use seconds
|
||||
fHistoFrame->GetXaxis()->SetTitle("time (s)");
|
||||
} else {
|
||||
fHistoFrame->GetXaxis()->SetTitle("time (#mus)");
|
||||
}
|
||||
// set y-axis label
|
||||
fHistoFrame->GetYaxis()->SetTitleOffset(1.3);
|
||||
fHistoFrame->GetYaxis()->SetTitle("data-theory");
|
||||
@ -6081,7 +6111,12 @@ void PMusrCanvas::PlotAverage(Bool_t unzoom)
|
||||
// define x-axis title
|
||||
TString xAxisTitle("");
|
||||
if (fCurrentPlotView == PV_DATA) {
|
||||
if (fPlotType == MSR_PLOT_BNMR) {
|
||||
// For BNMR/BNQR runs use seconds
|
||||
xAxisTitle = TString("time (s)");
|
||||
} else {
|
||||
xAxisTitle = TString("time (#mus)");
|
||||
}
|
||||
} else { // all the Fourier
|
||||
if (fFourier.fUnits == FOURIER_UNIT_GAUSS) {
|
||||
xAxisTitle = TString("Field (G)");
|
||||
@ -6114,6 +6149,9 @@ void PMusrCanvas::PlotAverage(Bool_t unzoom)
|
||||
case MSR_PLOT_ASYM:
|
||||
yAxisTitle = "<asymmetry>";
|
||||
break;
|
||||
case MSR_PLOT_BNMR:
|
||||
yAxisTitle = "<asymmetry>";
|
||||
break;
|
||||
case MSR_PLOT_MU_MINUS:
|
||||
yAxisTitle = "<N(t)> per bin";
|
||||
break;
|
||||
|
1775
src/classes/PRunAsymmetryBNMR.cpp
Normal file
1775
src/classes/PRunAsymmetryBNMR.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -3045,8 +3045,9 @@ Bool_t PRunDataHandler::ReadMudFile()
|
||||
setup += TString(str) + TString("/");
|
||||
if (TString(str) == "BNQR" || TString(str) == "BNMR") {
|
||||
std::cerr << "PRunDataHandler::ReadMudFile: **INFORMATION** this run was performed on " << str << std::endl;
|
||||
std::cerr << "PRunDataHandler::ReadMudFile: **INFORMATION** apply correction to time resolution" << std::endl;
|
||||
// identified BNMR/BNQR, correct time resolution.
|
||||
timeResMultiplier = 1.0e15;
|
||||
timeResMultiplier = 1.0e9;
|
||||
}
|
||||
}
|
||||
success = MUD_getApparatus( fh, str, sizeof(str) );
|
||||
@ -3128,8 +3129,8 @@ Bool_t PRunDataHandler::ReadMudFile()
|
||||
}
|
||||
}
|
||||
|
||||
runData.SetTimeResolution(static_cast<Double_t>(timeResolution) * timeResMultiplier); // s -> ns
|
||||
// An additional factor of 1e6 needed for bNMR
|
||||
runData.SetTimeResolution(static_cast<Double_t>(timeResolution) * timeResMultiplier); // s -> ns or s -> ms for bNMR
|
||||
// Other possibility:
|
||||
// Check if it is a bNMR run and fix it or check if "timeres" line
|
||||
// was introduced in the msr file
|
||||
|
||||
|
@ -76,6 +76,12 @@ PRunListCollection::~PRunListCollection()
|
||||
}
|
||||
fRunAsymmetryRRFList.clear();
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++) {
|
||||
fRunAsymmetryBNMRList[i]->CleanUp();
|
||||
fRunAsymmetryBNMRList[i]->~PRunAsymmetryBNMR();
|
||||
}
|
||||
fRunAsymmetryBNMRList.clear();
|
||||
|
||||
for (UInt_t i=0; i<fRunMuMinusList.size(); i++) {
|
||||
fRunMuMinusList[i]->CleanUp();
|
||||
fRunMuMinusList[i]->~PRunMuMinus();
|
||||
@ -133,6 +139,11 @@ Bool_t PRunListCollection::Add(Int_t runNo, EPMusrHandleTag tag)
|
||||
if (!fRunAsymmetryRRFList[fRunAsymmetryRRFList.size()-1]->IsValid())
|
||||
success = false;
|
||||
break;
|
||||
case PRUN_ASYMMETRY_BNMR:
|
||||
fRunAsymmetryBNMRList.push_back(new PRunAsymmetryBNMR(fMsrInfo, fData, runNo, tag));
|
||||
if (!fRunAsymmetryBNMRList[fRunAsymmetryBNMRList.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())
|
||||
@ -175,6 +186,8 @@ void PRunListCollection::SetFitRange(const TString fitRange)
|
||||
fRunAsymmetryList[i]->SetFitRangeBin(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
fRunAsymmetryRRFList[i]->SetFitRangeBin(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++)
|
||||
fRunAsymmetryBNMRList[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++)
|
||||
@ -201,6 +214,8 @@ void PRunListCollection::SetFitRange(const PDoublePairVector fitRange)
|
||||
fRunAsymmetryList[i]->SetFitRange(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
fRunAsymmetryRRFList[i]->SetFitRange(fitRange);
|
||||
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++)
|
||||
fRunAsymmetryBNMRList[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++)
|
||||
@ -291,6 +306,27 @@ Double_t PRunListCollection::GetAsymmetryRRFChisq(const std::vector<Double_t>& p
|
||||
return chisq;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryBNMRChisq (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Calculates chi-square of <em>all</em> asymmetry BNMR runs of a msr-file.
|
||||
*
|
||||
* <b>return:</b>
|
||||
* - chi-square of all asymmetry BNMR runs of the msr-file
|
||||
*
|
||||
* \param par fit parameter vector
|
||||
*/
|
||||
Double_t PRunListCollection::GetAsymmetryBNMRChisq(const std::vector<Double_t>& par) const
|
||||
{
|
||||
Double_t chisq = 0.0;
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++)
|
||||
chisq += fRunAsymmetryBNMRList[i]->CalcChiSquare(par);
|
||||
|
||||
return chisq;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetMuMinusChisq (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@ -380,6 +416,9 @@ Double_t PRunListCollection::GetSingleHistoChisqExpected(const std::vector<Doubl
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
expectedChisq = fRunAsymmetryRRFList[subIdx]->CalcChiSquareExpected(par);
|
||||
break;
|
||||
case PRUN_ASYMMETRY_BNMR:
|
||||
expectedChisq = fRunAsymmetryBNMRList[subIdx]->CalcChiSquareExpected(par);
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
expectedChisq = fRunMuMinusList[subIdx]->CalcChiSquareExpected(par);
|
||||
break;
|
||||
@ -441,6 +480,9 @@ Double_t PRunListCollection::GetSingleRunChisq(const std::vector<Double_t>& par,
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
chisq = fRunAsymmetryRRFList[subIdx]->CalcChiSquare(par);
|
||||
break;
|
||||
case PRUN_ASYMMETRY_BNMR:
|
||||
chisq = fRunAsymmetryBNMRList[subIdx]->CalcChiSquare(par);
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
chisq = fRunMuMinusList[subIdx]->CalcChiSquare(par);
|
||||
break;
|
||||
@ -540,6 +582,28 @@ Double_t PRunListCollection::GetAsymmetryRRFMaximumLikelihood(const std::vector<
|
||||
return mlh;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryBNMRMaximumLikelihood (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 BNMR runs of the msr-file
|
||||
*
|
||||
* \param par fit parameter vector
|
||||
*/
|
||||
Double_t PRunListCollection::GetAsymmetryBNMRMaximumLikelihood(const std::vector<Double_t>& par) const
|
||||
{
|
||||
Double_t mlh = 0.0;
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++)
|
||||
mlh += fRunAsymmetryBNMRList[i]->CalcChiSquare(par);
|
||||
|
||||
return mlh;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetMuMinusMaximumLikelihood (public)
|
||||
//--------------------------------------------------------------------------
|
||||
@ -721,6 +785,9 @@ UInt_t PRunListCollection::GetNoOfBinsFitted(const UInt_t idx) const
|
||||
case PRUN_ASYMMETRY_RRF:
|
||||
result = fRunAsymmetryRRFList[subIdx]->GetNoOfFitBins();
|
||||
break;
|
||||
case PRUN_ASYMMETRY_BNMR:
|
||||
result = fRunAsymmetryBNMRList[subIdx]->GetNoOfFitBins();
|
||||
break;
|
||||
case PRUN_MU_MINUS:
|
||||
result = fRunMuMinusList[subIdx]->GetNoOfFitBins();
|
||||
break;
|
||||
@ -760,6 +827,9 @@ UInt_t PRunListCollection::GetTotalNoOfBinsFitted() const
|
||||
for (UInt_t i=0; i<fRunAsymmetryRRFList.size(); i++)
|
||||
counts += fRunAsymmetryRRFList[i]->GetNoOfFitBins();
|
||||
|
||||
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++)
|
||||
counts += fRunAsymmetryBNMRList[i]->GetNoOfFitBins();
|
||||
|
||||
for (UInt_t i=0; i<fRunMuMinusList.size(); i++)
|
||||
counts += fRunMuMinusList[i]->GetNoOfFitBins();
|
||||
|
||||
@ -898,6 +968,49 @@ PRunData* PRunListCollection::GetAsymmetry(UInt_t index, EDataSwitch tag)
|
||||
return data;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryBNMR (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Get a processed asymmetry from beta-NMR 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::GetAsymmetryBNMR(UInt_t index, EDataSwitch tag)
|
||||
{
|
||||
PRunData *data = 0;
|
||||
|
||||
switch (tag) {
|
||||
case kIndex: // called from musrfit when dumping the data
|
||||
if (index > fRunAsymmetryBNMRList.size()) {
|
||||
std::cerr << std::endl << ">> PRunListCollection::GetAsymmetryBNMR(): **ERROR** index = " << index << " out of bounds";
|
||||
std::cerr << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
fRunAsymmetryBNMRList[index]->CalcTheory();
|
||||
data = fRunAsymmetryBNMRList[index]->GetData();
|
||||
break;
|
||||
case kRunNo: // called from PMusrCanvas
|
||||
for (UInt_t i=0; i<fRunAsymmetryBNMRList.size(); i++) {
|
||||
if (fRunAsymmetryBNMRList[i]->GetRunNo() == index) {
|
||||
data = fRunAsymmetryBNMRList[i]->GetData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: // error
|
||||
break;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetAsymmetryRRF (public)
|
||||
//--------------------------------------------------------------------------
|
||||
|
1833
src/external/MuSRFitGUI/devel/MSR.pm
vendored
1833
src/external/MuSRFitGUI/devel/MSR.pm
vendored
File diff suppressed because it is too large
Load Diff
4492
src/external/MuSRFitGUI/devel/MuSRFit.pl
vendored
4492
src/external/MuSRFitGUI/devel/MuSRFit.pl
vendored
File diff suppressed because it is too large
Load Diff
5742
src/external/MuSRFitGUI/devel/MuSRFit.ui
vendored
5742
src/external/MuSRFitGUI/devel/MuSRFit.ui
vendored
File diff suppressed because it is too large
Load Diff
991
src/external/MuSRFitGUI/devel/MuSRFit.ui.h
vendored
991
src/external/MuSRFitGUI/devel/MuSRFit.ui.h
vendored
@ -1,991 +0,0 @@
|
||||
/****************************************************************************
|
||||
** ui.h extension file, included from the uic-generated form implementation.
|
||||
**
|
||||
** If you want to add, delete, or rename functions or slots, use
|
||||
** Qt Designer to update this file, preserving your code.
|
||||
**
|
||||
** You should not define a constructor or destructor in this file.
|
||||
** Instead, write your code in functions called init() and destroy().
|
||||
** These will automatically be called by theform's constructor and
|
||||
** destructor.
|
||||
*****************************************************************************/
|
||||
|
||||
# This file is part of MuSRFitGUI.
|
||||
#
|
||||
# MuSRFitGUI 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 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# MuSRFitGUI 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 MuSRFitGUI. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Copyright 2009 by Zaher Salman and the LEM Group.
|
||||
# <zaher.salman@psi.ch>
|
||||
|
||||
void MuSRFitMenu::fileOpen()
|
||||
{
|
||||
my $file=Qt::FileDialog::getOpenFileName(
|
||||
".",
|
||||
"MSR Files (*.msr *.mlog)",
|
||||
this,
|
||||
"open file dialog",
|
||||
"Choose a MSR file");
|
||||
print "Selected file: $file\n";
|
||||
# TODO: Possibly decipher the MSR file and setup the GUI accordingly
|
||||
# Find run numbers, beamlines etc.
|
||||
# Get theory block and understand it
|
||||
# Get parameters list and update table
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitMenu::fileSave()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
my $FILENAME=$All{"FILENAME"}.".msr";
|
||||
my $file=Qt::FileDialog::getSaveFileName(
|
||||
"$FILENAME",
|
||||
"MSR Files (*.msr *.mlog)",
|
||||
this,
|
||||
"save file dialog",
|
||||
"Choose a filename to save under");
|
||||
|
||||
# If the user gave a filename the copy to it
|
||||
if ($file ne "") {
|
||||
# TODO: check if the extension is correct, or add it.
|
||||
if (-e $FILENAME) {
|
||||
my $cmd="cp $FILENAME $file";
|
||||
my $pid=system($cmd);
|
||||
} else {
|
||||
if ($file ne "") {
|
||||
my $Warning = "Warning: No MSR file found yet!";
|
||||
my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MuSRFitMenu::fileChangeDir()
|
||||
{
|
||||
my $newdir=Qt::FileDialog::getExistingDirectory(
|
||||
"",
|
||||
this,
|
||||
"get existing directory",
|
||||
"Choose a directory",
|
||||
1);
|
||||
chdir ("$newdir");
|
||||
}
|
||||
|
||||
void MuSRFitMenu::filePrint()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitMenu::fileExit()
|
||||
{
|
||||
my $Ans = Qt::MessageBox::question( this, "Quit?","Are you sure you want to quit?","&Yes","&No","",0,1);
|
||||
if ($Ans==0) {
|
||||
# Then quit
|
||||
Qt::Application::exit( 0 );
|
||||
}
|
||||
# Otherwize go back
|
||||
}
|
||||
|
||||
void MuSRFitMenu::parametersExport()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
# Add also a flag for header
|
||||
$All{"Header"}=1;
|
||||
my $FILENAME=$All{"FILENAME"}.".dat";
|
||||
my $file=Qt::FileDialog::getSaveFileName(
|
||||
"$FILENAME",
|
||||
"Data Files (*.dat)",
|
||||
this,
|
||||
"export file dialog",
|
||||
"Choose a filename to export to");
|
||||
|
||||
# If the user gave a filename the copy to it
|
||||
if ($file ne "") {
|
||||
my $Text = MSR::ExportParams(\%All);
|
||||
open( DATF,q{>},"$file" );
|
||||
print DATF $Text;
|
||||
close(DATF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitMenu::parametersAppend()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
# Add also a flag for header
|
||||
$All{"Header"}=0;
|
||||
my $FILENAME=$All{"FILENAME"}.".dat";
|
||||
my $file=Qt::FileDialog::getOpenFileName(
|
||||
"./",
|
||||
"Data Files (*.dat)",
|
||||
this,
|
||||
"append file dialog",
|
||||
"Choose a filename to append to");
|
||||
|
||||
# If the user gave a filename the copy to it
|
||||
if ($file ne "") {
|
||||
my $Text = MSR::ExportParams(\%All);
|
||||
open( DATF,q{>>},"$file" );
|
||||
print DATF $Text;
|
||||
close(DATF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitMenu::editUndo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitMenu::editRedo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitMenu::editCut()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitMenu::editCopy()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitMenu::editPaste()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitMenu::helpIndex()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitMenu::helpContents()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MuSRFitMenu::helpAbout()
|
||||
{
|
||||
my $AboutText="
|
||||
This is a GUI that uses the musrfit binary, developed by Andreas Suter,
|
||||
to fit muSR spectra.
|
||||
|
||||
MuSRFitGUI 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
MuSRFitGUI 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 MuSRFitGUI. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2009 by Zaher Salman and the LEM Group.
|
||||
<zaher.salman\@psi.ch>
|
||||
";
|
||||
my $AboutWindow = Qt::MessageBox::information( this, "About MuSRFit GUI",$AboutText);
|
||||
}
|
||||
|
||||
void MuSRFitform::CreateAllInput()
|
||||
{
|
||||
my %All=();
|
||||
|
||||
# From RUNS Tab
|
||||
# Run data file
|
||||
$All{"RunNumbers"} = RunNumbers->text;
|
||||
$All{"RunFiles"} = RunFiles->text;
|
||||
$All{"BeamLine"} = BeamLine->currentText;
|
||||
$All{"RUNSType"} = ManualFile->isOn();
|
||||
$All{"optionsFourier"} = optionsFourier->isOn();
|
||||
$All{"optionsT0"} = optionsT0->isOn();
|
||||
$All{"YEAR"} =YEAR->currentText;
|
||||
if ($All{"YEAR"} eq "") {
|
||||
# If year combobox is empty fill it up from 2004 up to current year
|
||||
my ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime();
|
||||
my $current_year = 1900 + $yearOffset;
|
||||
for (my $i=$current_year;$i>=2004;$i--) {
|
||||
YEAR->insertItem($i,-1);
|
||||
}
|
||||
}
|
||||
# Time range and BINS
|
||||
$All{"Tis"} = Tis->text;
|
||||
$All{"Tfs"} = Tfs->text;
|
||||
$All{"BINS"} = BINS->text;
|
||||
$All{"FitAsyType"} = FitAsyType->currentText;
|
||||
$All{"LRBF"} = LRBF->text;
|
||||
my @Hists = split(/,/, $All{"LRBF"} );
|
||||
# Lifetime corrections in enabled/visible only for SingleHis fits
|
||||
if ( $All{"FitAsyType"} eq "Asymmetry" ) {
|
||||
ltc->setHidden(1);
|
||||
}
|
||||
elsif ( $All{"FitAsyType"} eq "SingleHist" ) {
|
||||
ltc->setHidden(0);
|
||||
}
|
||||
|
||||
# From Fitting Tab
|
||||
# Plot range
|
||||
$All{"Xi"}=Xi->text;
|
||||
$All{"Xf"}=Xf->text;
|
||||
$All{"Yi"}=Yi->text;
|
||||
$All{"Yf"}=Yf->text;
|
||||
$All{"ViewBin"}=ViewBin->text;
|
||||
# Life time correction
|
||||
if (ltc->isChecked()) {
|
||||
$All{"ltc"}="y";
|
||||
} else {
|
||||
$All{"ltc"}="n";
|
||||
}
|
||||
# Minuit commands
|
||||
if ( $All{"go"} eq "" ) {
|
||||
$All{"go"}="PLOT";
|
||||
}
|
||||
# Get minimization process
|
||||
$All{"Minimization"} = Minimization->currentText();
|
||||
$All{"go"}=$All{"Minimization"};
|
||||
|
||||
# Get Error calculation process
|
||||
$All{"ErrorCalc"} = ErrorCalc->currentText();
|
||||
$All{"go"}=$All{"ErrorCalc"};
|
||||
|
||||
RunSelectionToggle();
|
||||
my @RUNS = ();
|
||||
if ($All{"RUNSType"} ) {
|
||||
@RUNS = split( /,/, $All{"RunFiles"});
|
||||
} else {
|
||||
$All{"RunNumbers"} =~ s/[\ \.\~\/\&\*\[\;\>\<\^\$\(\)\`\|\]\'\@]/,/g;
|
||||
@RUNS = split( /,/, $All{"RunNumbers"} );
|
||||
}
|
||||
|
||||
# From MSR File Tab
|
||||
$All{"TITLE"}= TITLE->text;
|
||||
$All{"FILENAME"}= FILENAME->text;
|
||||
|
||||
# From Fourier Tab
|
||||
$All{"FUNITS"}= FUnits->currentText;
|
||||
$All{"FAPODIZATION"}= FApodization->currentText;
|
||||
$All{"FPLOT"}= FPlot->currentText;
|
||||
$All{"FPHASE"}=FPHASE->text;
|
||||
# Fourier range
|
||||
$All{"FrqMin"}=FrqMin->text;
|
||||
$All{"FrqMax"}=FrqMax->text;
|
||||
|
||||
# Rotating reference frame parameters
|
||||
$All{"RRFFrq"}=RRFFrq->text;
|
||||
$All{"RRFPack"}=RRFPack->text;
|
||||
$All{"RRFPhase"}=RRFPhase->text;
|
||||
$All{"RRFUnits"}=RRFUnits->currentText;
|
||||
|
||||
# Get values of t0 and Bg/Data bins if given
|
||||
my $NHist = 1;
|
||||
foreach my $Hist (@Hists) {
|
||||
foreach ("t0","Bg1","Bg2","Data1","Data2") {
|
||||
my $Name = "$_$NHist";
|
||||
$All{$Name}=child($Name)->text;
|
||||
# TODO: If empty fill with defaults
|
||||
if ($All{$Name} eq "") {
|
||||
$All{$Name}=MSR::T0BgData($_,$Hist,$All{"BeamLine"});
|
||||
child($Name)->setText($All{$Name});
|
||||
}
|
||||
}
|
||||
$NHist++;
|
||||
}
|
||||
|
||||
# Construct fittypes that can be understood by MSR.pm
|
||||
my %FTs=(0,"Exponential",
|
||||
1,"Gaussian",
|
||||
2,"Stretch",
|
||||
3,"ExponentialCos",
|
||||
4,"GaussianCos",
|
||||
5,"StretchCos",
|
||||
6,"LDKTLF",
|
||||
7,"GDKTLF",
|
||||
8,"Background",
|
||||
9,"LLFExp",
|
||||
10,"GLFExp",
|
||||
11,"LLFSExp",
|
||||
12,"GLFSExp",
|
||||
13,"MolMag",
|
||||
14,"Meissner",
|
||||
15,"None"
|
||||
);
|
||||
|
||||
my $FT1=FitType1->currentItem;
|
||||
my $FT2=FitType2->currentItem;
|
||||
my $FT3=FitType3->currentItem;
|
||||
$All{"FitType1"} = $FTs{$FT1};
|
||||
$All{"FitType2"} = $FTs{$FT2};
|
||||
$All{"FitType3"} = $FTs{$FT3};
|
||||
my @FitTypes =();
|
||||
my $FitType="";
|
||||
foreach $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
|
||||
if ( $FitType ne "None" ) {
|
||||
push( @FitTypes, $FitType );
|
||||
}
|
||||
}
|
||||
|
||||
# Also theory block and paramets list
|
||||
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
|
||||
$All{"Full_T_Block"}=$Full_T_Block;
|
||||
$All{"Paramcomp_ref"}=$Paramcomp_ref;
|
||||
my @Paramcomp = @$Paramcomp_ref;
|
||||
|
||||
# Functions block
|
||||
$All{"FunctionsBlock"}=FunctionsBlock->text;
|
||||
# and the associated theory block
|
||||
$All{"Func_T_Block"}=TheoryBlock->text;
|
||||
|
||||
# Shared settings are detected here
|
||||
$All{"EnableSharing"} = buttonGroupSharing->isChecked();
|
||||
|
||||
my $Shared = 0;
|
||||
my $PCount =0;
|
||||
my $Component=1;
|
||||
foreach $FitType (@FitTypes) {
|
||||
my $Parameters=$Paramcomp[$Component-1];
|
||||
my @Params = split( /\s+/, $Parameters );
|
||||
|
||||
if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
|
||||
unshift( @Params, "Alpha" );
|
||||
}
|
||||
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
|
||||
unshift( @Params, ( "No", "NBg" ) );
|
||||
}
|
||||
|
||||
# This is the counter for parameters of this component
|
||||
my $NP=1;
|
||||
$Shared = 0;
|
||||
# Change state/label of parameters
|
||||
foreach my $Param (@Params) {
|
||||
my $Param_ORG = $Param;
|
||||
# TODO: I need to take care of single hist fits here
|
||||
if ( $All{"FitAsyType"} eq "SingleHist" ) {
|
||||
$Param=$Param.$Hists[0];
|
||||
}
|
||||
if ( $#FitTypes != 0 && ( $Param ne "Alpha" && $Param ne "No" && $Param ne "NBg" ) ){
|
||||
$Param = join( "", $Param, "_", $Component);
|
||||
}
|
||||
|
||||
# Is there any point of sharing, multiple runs?
|
||||
if ( $#RUNS == 0 && $All{"FitAsyType"} eq "Asymmetry") {
|
||||
$Shared = 1;
|
||||
}
|
||||
elsif ( $#RUNS == 0 && $#Hists == 0 && $All{"FitAsyType"} eq "SingleHist" ) {
|
||||
$Shared = 1;
|
||||
} else {
|
||||
# Check if shared or not, construct name of checkbox, find its handle and then
|
||||
# check if it is checked
|
||||
my $ChkName="ShParam_".$Component."_".$NP;
|
||||
my $ChkBx = child($ChkName);
|
||||
$Shared = $ChkBx->isChecked();
|
||||
}
|
||||
$All{"Sh_$Param"}=$Shared;
|
||||
$NP++;
|
||||
}
|
||||
#Loop on parameters
|
||||
$Component++;
|
||||
}
|
||||
# Loop on components
|
||||
# Done with shared parameters detecting
|
||||
|
||||
# Construct a default filename if empty
|
||||
if ( $All{"FILENAME"} eq "" && !$All{"RUNSType"}) {
|
||||
$All{"FILENAME"}=$RUNS[0]."_".$All{"BeamLine"}."_".$All{"YEAR"};
|
||||
if ($All{"BeamLine"} eq "LEM (PPC)") {
|
||||
$All{"FILENAME"}=$RUNS[0]."_LEM_".$All{"YEAR"};
|
||||
}
|
||||
} else {
|
||||
$All{"FILENAME"}="TMP";
|
||||
}
|
||||
|
||||
|
||||
# This has to be at the end of CreateAll
|
||||
my %PTable=MSR::PrepParamTable(\%All);
|
||||
|
||||
# Setup the table with the right size
|
||||
my $NParam=scalar keys( %PTable );
|
||||
|
||||
# Read initial values of paramets from tabel
|
||||
my $erradd = "d";
|
||||
my $minadd = "_min";
|
||||
my $maxadd = "_max";
|
||||
my $Header=InitParamTable->verticalHeader();
|
||||
# TODO: Should not go over all rows, only on parameters.
|
||||
if ($NParam > 0) {
|
||||
for (my $i=0;$i<$NParam;$i++) {
|
||||
# Take label of row, i.e. name of parameter
|
||||
my $Param=$Header->label($i);
|
||||
# Then take the value, error, max and min (as numbers)
|
||||
$All{"$Param"}=1.0*InitParamTable->text($i,0);
|
||||
$All{"$erradd$Param"}=1.0*InitParamTable->text($i,1);
|
||||
$All{"$Param$minadd"}=1.0*InitParamTable->text($i,2);
|
||||
$All{"$Param$maxadd"}=1.0*InitParamTable->text($i,3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Return Hash with all important values
|
||||
return %All;
|
||||
}
|
||||
|
||||
void MuSRFitform::CallMSRCreate()
|
||||
{
|
||||
use MSR;
|
||||
my %All=CreateAllInput();
|
||||
|
||||
# Check if the option for checking for existing files is selected
|
||||
my $FileExistCheck= FileExistCheck->isOn();
|
||||
my $FILENAME=$All{"FILENAME"}.".msr";
|
||||
my $Answer=0;
|
||||
if ($All{"RunNumbers"} ne "" || $All{"RunFiles"} ne "") {
|
||||
if ( $FileExistCheck==1 ) {
|
||||
if (-e $FILENAME) {
|
||||
# Warning: MSR file exists
|
||||
# my $Warning = "Warning: MSR file $FILENAME Already exists!\nIf you continue it will overwriten.";
|
||||
my $Warning = "Warning: MSR file $FILENAME Already exists!\nDo you want to overwrite it?";
|
||||
# my $WarningWindow = Qt::MessageBox::information( this, "Warning",$Warning);
|
||||
# $Answer =1,0 for yes and no
|
||||
$Answer= Qt::MessageBox::warning( this, "Warning",$Warning, "&No", "&Yes", undef, 1,1);
|
||||
}
|
||||
} else {
|
||||
# Just overwrite file
|
||||
$Answer=1;
|
||||
}
|
||||
|
||||
if ($Answer) {
|
||||
if ( $All{"FitAsyType"} eq "Asymmetry" ) {
|
||||
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSR(\%All);
|
||||
}
|
||||
elsif ( $All{"FitAsyType"} eq "SingleHist" ) {
|
||||
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateMSRSingleHist(\%All);
|
||||
}
|
||||
UpdateMSRFileInitTable();
|
||||
}
|
||||
}
|
||||
return $Answer;
|
||||
}
|
||||
|
||||
void MuSRFitform::UpdateMSRFileInitTable()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
my $FILENAME=$All{"FILENAME"};
|
||||
open (MSRF,q{<},"$FILENAME.msr" );
|
||||
my @lines = <MSRF>;
|
||||
close(IFILE);
|
||||
textMSROutput->setText("");
|
||||
foreach my $line (@lines) {
|
||||
textMSROutput->append("$line");
|
||||
}
|
||||
|
||||
(my $TBlock_ref, my $FPBlock_ref)=MSR::ExtractBlks(@lines);
|
||||
my @FPBloc = @$FPBlock_ref;
|
||||
|
||||
my $PCount=0;
|
||||
foreach my $line (@FPBloc) {
|
||||
$PCount++;
|
||||
my @Param=split(/\s+/,$line);
|
||||
|
||||
# Depending on how many elements in @Param determine what they mean
|
||||
# 0th element is empty (always)
|
||||
# 1st element is the order (always)
|
||||
# 2nd element is the name (always)
|
||||
# 3rd element is the value (always)
|
||||
# 4th element can be taken as step/error (always)
|
||||
# 5th element can be
|
||||
# if it is last element or there are two more = positive error, check $#Param=5/7
|
||||
# if there is only one more = minimum, check $#Param=6
|
||||
|
||||
# To summarize, check the value of $#Param
|
||||
my $value=1.0*$Param[3];
|
||||
my $error = 1.0*$Param[4];
|
||||
my $minvalue=0.0;
|
||||
my $maxvalue=0.0;
|
||||
if ($#Param == 4) {
|
||||
$minvalue=0.0;
|
||||
$maxvalue=0.0;
|
||||
}
|
||||
elsif ($#Param == 6) {
|
||||
$minvalue=1.0*$Param[5];
|
||||
$maxvalue=1.0*$Param[6];
|
||||
}
|
||||
elsif ($#Param == 5 || $#Param == 7) {
|
||||
$minvalue=1.0*$Param[6];
|
||||
$maxvalue=1.0*$Param[7];
|
||||
}
|
||||
# Now update the initialization tabel
|
||||
InitParamTable->setText($PCount-1,0,$value);
|
||||
InitParamTable->setText($PCount-1,1,$error);
|
||||
InitParamTable->setText($PCount-1,2,$minvalue);
|
||||
InitParamTable->setText($PCount-1,3,$maxvalue);
|
||||
# Set bg color to mark different runs
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void MuSRFitform::ActivateT0Hists()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
my @Hists = split(/,/, $All{"LRBF"} );
|
||||
my $HistBox = "";
|
||||
for (my $iHist=1; $iHist<=4; $iHist++) {
|
||||
$HistBox="groupHist$iHist";
|
||||
my $HistBoxHandle = child($HistBox);
|
||||
if ($iHist<=$#Hists+1) {
|
||||
# Activate this histogram box
|
||||
$HistBoxHandle->setHidden(0);
|
||||
$HistBoxHandle->setEnabled(1);
|
||||
$HistBoxHandle->setTitle("Hist # $Hists[$iHist-1]");
|
||||
} else {
|
||||
# Deactivate this histogram box
|
||||
$HistBoxHandle->setHidden(1);
|
||||
$HistBoxHandle->setEnabled(0);
|
||||
}
|
||||
}
|
||||
|
||||
# TODO: Set default values
|
||||
|
||||
}
|
||||
|
||||
void MuSRFitform::ActivateShComp()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
my @RUNS = split( /,/, $All{"RunNumbers"} );
|
||||
|
||||
# Hide all sharing components
|
||||
SharingComp1->setHidden(1);
|
||||
SharingComp2->setHidden(1);
|
||||
SharingComp3->setHidden(1);
|
||||
SharingComp1->setEnabled(0);
|
||||
SharingComp2->setEnabled(0);
|
||||
SharingComp3->setEnabled(0);
|
||||
|
||||
my @FitTypes =();
|
||||
foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
|
||||
if ( $FitType ne "None" ) {
|
||||
push( @FitTypes, $FitType );
|
||||
}
|
||||
}
|
||||
|
||||
# Get number of parameters to determine the size of the table
|
||||
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
|
||||
# For now the line below does not work. Why?
|
||||
# my $Paramcomp_ref=$All{"Paramcomp_ref"};
|
||||
my @Paramcomp = @$Paramcomp_ref;
|
||||
my $Full_T_Block= $All{"Full_T_Block"};
|
||||
|
||||
# Possible to share only if sharing is enabled altogether
|
||||
my $EnableSharing = $All{"EnableSharing"};
|
||||
if ($EnableSharing) {
|
||||
my $Component=1;
|
||||
foreach my $FitType (@FitTypes) {
|
||||
my $Parameters=$Paramcomp[$Component-1];
|
||||
my @Params = split( /\s+/, $Parameters );
|
||||
|
||||
if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
|
||||
unshift( @Params, "Alpha" );
|
||||
}
|
||||
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
|
||||
unshift( @Params, ( "No", "NBg" ) );
|
||||
}
|
||||
|
||||
|
||||
# Make the component appear first (only if we have multiple runs)
|
||||
my $ShCompG="SharingComp".$Component;
|
||||
my $ShCG = child($ShCompG);
|
||||
if ($#RUNS>0) {
|
||||
$ShCG->setHidden(0);
|
||||
$ShCG->setEnabled(1);
|
||||
}
|
||||
my $CompShLabel = "Comp".$Component."ShLabel";
|
||||
my $CompShL = child($CompShLabel);
|
||||
$CompShL->setText($All{"FitType$Component"});
|
||||
|
||||
# Change state/label of parameters
|
||||
for (my $i=1; $i<=9;$i++) {
|
||||
my $ParamChkBx="ShParam_".$Component."_".$i;
|
||||
my $ChkBx = child($ParamChkBx);
|
||||
if ($Params[$i-1] ne "") {
|
||||
$ChkBx->setHidden(0);
|
||||
$ChkBx->setEnabled(1);
|
||||
$ChkBx ->setText($Params[$i-1]);
|
||||
} else {
|
||||
$ChkBx->setHidden(1);
|
||||
}
|
||||
}
|
||||
$Component++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MuSRFitform::InitializeTab()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
InitParamTable->setLeftMargin(100);
|
||||
my $NRows = InitParamTable->numRows();
|
||||
|
||||
# Remove any rows in table
|
||||
if ($NRows > 0) {
|
||||
for (my $i=0;$i<$NRows;$i++) {
|
||||
# TODO: Better remove the row rather than hide it.
|
||||
InitParamTable->hideRow($i);
|
||||
# InitParamTable->removeRow($i);
|
||||
}
|
||||
}
|
||||
|
||||
my %PTable=MSR::PrepParamTable(\%All);
|
||||
|
||||
# Setup the table with the right size
|
||||
my $NParam=scalar keys( %PTable );
|
||||
if ($NParam>$NRows) {
|
||||
InitParamTable->setNumRows($NParam);
|
||||
}
|
||||
|
||||
# Fill the table with labels and values of parametr
|
||||
for (my $PCount=0;$PCount<$NParam;$PCount++) {
|
||||
my ($Param,$value,$error,$minvalue,$maxvalue,$RUN) = split(/,/,$PTable{$PCount});
|
||||
# Now make sure we have no nans
|
||||
if ($error eq "nan") { $error=0.1;}
|
||||
# If you use this then reading the parameters from the table is a problem
|
||||
# You need to extract the correct parameter name from the row label
|
||||
# InitParamTable->verticalHeader()->setLabel( $PCount,"$RUN: $Param");
|
||||
InitParamTable->verticalHeader()->setLabel( $PCount,"$Param");
|
||||
InitParamTable->showRow($PCount);
|
||||
InitParamTable->setText($PCount,0,$value);
|
||||
InitParamTable->setText($PCount,1,$error);
|
||||
InitParamTable->setText($PCount,2,$minvalue);
|
||||
InitParamTable->setText($PCount,3,$maxvalue);
|
||||
}
|
||||
}
|
||||
|
||||
void MuSRFitform::TabChanged()
|
||||
{
|
||||
# TODO: First check if there are some runs given, otherwise disbale
|
||||
my %All=CreateAllInput();
|
||||
|
||||
# First make sure we have sharing initialized
|
||||
ActivateShComp();
|
||||
# Here we need to apply sharing if selected...
|
||||
InitializeTab();
|
||||
UpdateMSRFileInitTable();
|
||||
# And also setup T0 and Bg bins
|
||||
ActivateT0Hists();
|
||||
|
||||
# Initialize FUNCTIONS block only if it has not been initialized yet
|
||||
if ($All{"Func_T_Block"} eq "" ) {
|
||||
InitializeFunctions();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitform::GoFit()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
# Check here is the number of histograms makes sense
|
||||
# other wise give error.
|
||||
my @Hists = split( /,/, $All{"LRBF"} );
|
||||
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
|
||||
# we have a problem here send error message
|
||||
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
|
||||
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
|
||||
} else {
|
||||
musrfit_tabs->setCurrentPage(1);
|
||||
my $Answer=CallMSRCreate();
|
||||
if ($Answer) {
|
||||
my $FILENAME=$All{"FILENAME"}.".msr";
|
||||
if (-e $FILENAME) {
|
||||
my $cmd="musrfit -t $FILENAME";
|
||||
my $pid = open(FTO,"$cmd 2>&1 |");
|
||||
while (<FTO>) {
|
||||
FitTextOutput->append("$_");
|
||||
}
|
||||
close(FTO);
|
||||
$cmd="musrview $FILENAME &";
|
||||
$pid = system($cmd);
|
||||
} else {
|
||||
FitTextOutput->append("Cannot find MSR file!");
|
||||
}
|
||||
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
|
||||
# update MSR File tab and initialization table
|
||||
UpdateMSRFileInitTable();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void MuSRFitform::GoPlot()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
# Check here is the number of histograms makes sense
|
||||
# other wise give error.
|
||||
my @Hists = split( /,/, $All{"LRBF"} );
|
||||
if ($All{"FitAsyType"} eq "Asymmetry" && $#Hists != 1) {
|
||||
# we have a problem here send error message
|
||||
my $Warning = "Error: The number of histograms should be 2 for an asymmetry fit!";
|
||||
my $WarningWindow = Qt::MessageBox::information( this, "Error",$Warning);
|
||||
} else {
|
||||
my $Answer=CallMSRCreate();
|
||||
my $FILENAME=$All{"FILENAME"}.".msr";
|
||||
if ($Answer) {
|
||||
if (-e $FILENAME) {
|
||||
my $cmd="musrview $FILENAME &";
|
||||
my $pid = system($cmd);
|
||||
} else {
|
||||
FitTextOutput->append("Cannot find MSR file!");
|
||||
FitTextOutput->append("-----------------------------------------------------------------------------------------------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitform::ShowMuSRT0()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
musrfit_tabs->setCurrentPage(6);
|
||||
# Create MSR file and then run musrt0
|
||||
my $Answer=CallMSRCreate();
|
||||
|
||||
if ($Answer) {
|
||||
my $FILENAME=$All{"FILENAME"}.".msr";
|
||||
if (-e $FILENAME) {
|
||||
my $cmd="musrt0 $FILENAME &";
|
||||
my $pid = system($cmd);
|
||||
t0Update->setEnabled(1)
|
||||
} else {
|
||||
print STDERR "Cannot find MSR file!\n";
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitform::T0Update()
|
||||
{
|
||||
my %All = CreateAllInput();
|
||||
my @Hists = split(/,/, $All{"LRBF"} );
|
||||
|
||||
# Get values of t0 and Bg/Data bins if given
|
||||
my $NHist = 1;
|
||||
foreach my $Hist (@Hists) {
|
||||
foreach ("t0","Bg1","Bg2","Data1","Data2") {
|
||||
my $Name = "$_$NHist";
|
||||
my $tmp=MSR::T0BgData($_,$Hist,$All{"BeamLine"});
|
||||
child($Name)->setText($tmp);
|
||||
}
|
||||
$NHist++
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitform::RunSelectionToggle()
|
||||
{
|
||||
my $ManualFile= ManualFile->isOn();
|
||||
if ($ManualFile) {
|
||||
# Manual RUN selection
|
||||
RUNSMan->setEnabled(1);
|
||||
RUNSMan->setHidden(0);
|
||||
RunNumbers->setText("");
|
||||
RUNSAuto->setEnabled(0);
|
||||
RUNSAuto->setHidden(1);
|
||||
} else {
|
||||
# Auto RUN selection
|
||||
RUNSMan->setEnabled(0);
|
||||
RUNSMan->setHidden(1);
|
||||
RunFiles->setText("");
|
||||
RUNSAuto->setEnabled(1);
|
||||
RUNSAuto->setHidden(0);
|
||||
}
|
||||
|
||||
# Also use this for other options
|
||||
# Fourier toggle
|
||||
my $Fourier=optionsFourier->isOn();
|
||||
if ($Fourier) {
|
||||
# Fourier tab visible
|
||||
# musrfit_tabs->addTab(FourierPage,"Fourier");
|
||||
# musrfit_tabs->showPage(FourierPage);
|
||||
# FourierPage->hide();
|
||||
} else {
|
||||
# Fourier tab invisible
|
||||
# musrfit_tabs->removePage(FourierPage);
|
||||
# FourierPage->show();
|
||||
}
|
||||
}
|
||||
|
||||
void MuSRFitform::fileBrowse()
|
||||
{
|
||||
my $RunFiles=RunFiles->text();
|
||||
print "Runs:$RunFiles\n";
|
||||
my $files_ref=Qt::FileDialog::getOpenFileNames(
|
||||
"Data files (*.root *.bin)",
|
||||
"./",
|
||||
this,
|
||||
"open files dialog",
|
||||
"Select one or more files to fit");
|
||||
my @files = @$files_ref;
|
||||
if ($RunFiles eq "") {
|
||||
# We started with an empty list
|
||||
$RunFiles=join(",",@files);
|
||||
} else {
|
||||
# Add files to existing list
|
||||
$RunFiles=join(",",$RunFiles,@files);
|
||||
}
|
||||
RunFiles->setText($RunFiles);
|
||||
}
|
||||
|
||||
void MuSRFitform::AppendToFunctions()
|
||||
{
|
||||
my $ParName=CParamsCombo->currentText();
|
||||
my $Full_T_Block=TheoryBlock->text;
|
||||
my $Constraint=ConstraintLine->text;
|
||||
# Then clear the text
|
||||
ConstraintLine->setText("");
|
||||
|
||||
# Check how many constraints (lines) in FUNCTIONS Block
|
||||
my $i=FunctionsBlock->lines();
|
||||
my $ConstLine="fun$i = $Constraint\n";
|
||||
FunctionsBlock->append($ConstLine);
|
||||
|
||||
# Replace parameter in theory block with fun$i
|
||||
$Full_T_Block=~ s/$ParName/fun$i/;
|
||||
TheoryBlock->setText($Full_T_Block);
|
||||
}
|
||||
|
||||
void MuSRFitform::InitializeFunctions()
|
||||
{
|
||||
my %All=CreateAllInput();
|
||||
my @RUNS = split( /,/, $All{"RunNumbers"} );
|
||||
|
||||
my @FitTypes =();
|
||||
foreach my $FitType ($All{"FitType1"}, $All{"FitType2"}, $All{"FitType3"}) {
|
||||
if ( $FitType ne "None" ) {
|
||||
push( @FitTypes, $FitType );
|
||||
}
|
||||
}
|
||||
|
||||
# Get number of parameters to determine the size of the table
|
||||
my ($Full_T_Block,$Paramcomp_ref)= MSR::CreateTheory(@FitTypes);
|
||||
my @Paramcomp = @$Paramcomp_ref;
|
||||
my $Full_T_Block= $All{"Full_T_Block"};
|
||||
|
||||
# Initialize Parameters List in function block (constraints).
|
||||
my $ParametersList="";
|
||||
ParametersList->setText("");
|
||||
# Counter for function block (with out Alpha etc.)
|
||||
my $ParCount=0;
|
||||
CParamsCombo->clear();
|
||||
|
||||
# Possibly use the parameters block to axtract names for the dropdown menu
|
||||
# this makes sense if we can use fun in map line. Check!
|
||||
my $Component=1;
|
||||
foreach my $FitType (@FitTypes) {
|
||||
my $Parameters=$Paramcomp[$Component-1];
|
||||
my @Params = split( /\s+/, $Parameters );
|
||||
|
||||
# Alpha, No and NBg are counted in the parameters
|
||||
if ( $Component == 1 && $All{"FitAsyType"} eq "Asymmetry" ) {
|
||||
unshift( @Params, "Alpha" );
|
||||
}
|
||||
elsif ( $Component == 1 && $All{"FitAsyType"} eq "SingleHist" ) {
|
||||
unshift( @Params, ( "No", "NBg" ) );
|
||||
}
|
||||
|
||||
# Add list to the constraints drop down menu
|
||||
for (my $i=1; $i<=9;$i++) {
|
||||
my $CParam = $Params[$i-1]."_".$Component;
|
||||
if ($Params[$i-1] ne "" ) {
|
||||
if ($Params[$i-1] ne "Alpha" && $Params[$i-1] ne "No" && $Params[$i-1] ne "NBg") {
|
||||
CParamsCombo->insertItem($CParam,-1);
|
||||
$Full_T_Block=~ s/\b$Params[$i-1]\b/$CParam/;
|
||||
}
|
||||
# also enumerate the parameters as should be used in the FUNCTIONS Block
|
||||
$ParCount++;
|
||||
$ParametersList=$ParametersList."$CParam \t is \t par$ParCount\n";
|
||||
ParametersList->setText($ParametersList);
|
||||
}
|
||||
}
|
||||
$Component++;
|
||||
}
|
||||
# Set theory block in Constraints
|
||||
TheoryBlock->setText($Full_T_Block);
|
||||
# Then clear the text
|
||||
ConstraintLine->setText("");
|
||||
FunctionsBlock->setText("");
|
||||
}
|
||||
|
||||
|
||||
void MuSRFitform::optionConfigure()
|
||||
{
|
||||
use Customize;
|
||||
|
||||
my $Customize = Qt::Dialog(this);
|
||||
my $w = Customize;
|
||||
$w->setModal(1);
|
||||
$w->exec();
|
||||
# $Customize->setMainWidget($w);
|
||||
# $w->show;
|
||||
# exit $Customize->exec;
|
||||
|
||||
}
|
||||
|
||||
void MuSRFitform::t0UpdateClicked()
|
||||
{
|
||||
# Read MSR file and get new values of t0,Bg and Data
|
||||
my %All=CreateAllInput();
|
||||
my $FILENAME=$All{"FILENAME"};
|
||||
open (MSRF,q{<},"$FILENAME.msr" );
|
||||
my @lines = <MSRF>;
|
||||
close(IFILE);
|
||||
|
||||
my @T0s = grep {/t0 /} @lines;
|
||||
my @Bgs = grep {/background /} @lines;
|
||||
my @Datas = grep {/data /} @lines;
|
||||
|
||||
my @Hists = split(/,/, $All{"LRBF"} );
|
||||
my $NHist = $#Hists+1;
|
||||
print "Histograms: $NHist\n";
|
||||
|
||||
my $FinHist = 1;
|
||||
# First T0s
|
||||
while ($FinHist) {
|
||||
my $counter=0;
|
||||
(my $tmp,my @SplitT0) = split( /\s+/, $T0s[$counter]);
|
||||
(my $tmp,my @SplitBg) = split( /\s+/, $Bgs[$counter]);
|
||||
(my $tmp,my @SplitData) = split( /\s+/, $Datas[$counter]);
|
||||
if ($#SplitBg>0) {
|
||||
foreach (@SplitBg) {
|
||||
print $_."\n";
|
||||
}
|
||||
}
|
||||
$counter++;
|
||||
if ($counter>=$#Bgs) {$FinHist=0;}
|
||||
}
|
||||
|
||||
# Finally, disable the update button
|
||||
t0Update->setEnabled(0);
|
||||
# t0Update->setText("musrt0")
|
||||
}
|
BIN
src/external/MuSRFitGUI/icos/MuSRFit.odg
vendored
BIN
src/external/MuSRFitGUI/icos/MuSRFit.odg
vendored
Binary file not shown.
BIN
src/external/MuSRFitGUI/icos/MuSRFit.png
vendored
BIN
src/external/MuSRFitGUI/icos/MuSRFit.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 46 KiB |
96
src/external/libBNMR/45377.dat
vendored
96
src/external/libBNMR/45377.dat
vendored
@ -1,96 +0,0 @@
|
||||
DATA
|
||||
592.75 0.0466642055 0.00075601151
|
||||
693.25 0.042699595 0.0007136273
|
||||
793.75 0.03943051 0.000679583922
|
||||
894.25 0.0366291886 0.000652378784
|
||||
994.75 0.0355316716 0.000664640277
|
||||
1095.25 0.033304272 0.000610910492
|
||||
1195.75 0.0322397741 0.000595454518
|
||||
1296.25 0.0308209315 0.000581648459
|
||||
1396.75 0.0301227967 0.000569861788
|
||||
1497.25 0.0289808195 0.000559611024
|
||||
1597.75 0.0284020831 0.000550685264
|
||||
1698.25 0.0272996592 0.000542785334
|
||||
1798.75 0.0259033059 0.000536112979
|
||||
1899.25 0.0257421462 0.000529928146
|
||||
1999.75 0.0252476607 0.000524276201
|
||||
2100.25 0.0252439822 0.00049508141
|
||||
2200.75 0.0244494569 0.000514789454
|
||||
2301.25 0.0248826473 0.000510792766
|
||||
2401.75 0.0252364689 0.000507093213
|
||||
2502.25 0.024077753 0.000503959631
|
||||
2602.75 0.0239705744 0.000501170092
|
||||
2703.25 0.023648613 0.000498351823
|
||||
2803.75 0.0236132062 0.000496113677
|
||||
2904.25 0.0232728359 0.000494038794
|
||||
3004.75 0.0229806315 0.00049216698
|
||||
3105.25 0.0226408705 0.000490122174
|
||||
3205.75 0.022949639 0.000488517677
|
||||
3306.25 0.0236152274 0.000487206227
|
||||
3406.75 0.022514855 0.000485776619
|
||||
3507.25 0.0232919509 0.000484617162
|
||||
3607.75 0.0227762445 0.000483435077
|
||||
3708.25 0.0225740091 0.000482352785
|
||||
3808.75 0.0217810425 0.000481423643
|
||||
3909.25 0.0210459719 0.000480488676
|
||||
4009.75 0.0200829485 0.0004835672
|
||||
4110.25 0.0144273479 0.000480165881
|
||||
4210.75 0.0104726937 0.000526210282
|
||||
4311.25 0.00977670745 0.000548717033
|
||||
4411.75 0.00734786823 0.000572069626
|
||||
4512.25 0.0071749696 0.000596458669
|
||||
4612.75 0.0061713664 0.000621795033
|
||||
4713.25 0.00457656715 0.000648552578
|
||||
4813.75 0.00253947053 0.000676064828
|
||||
4914.25 0.00298436429 0.000705158693
|
||||
5014.75 0.00520775648 0.000735097152
|
||||
5115.25 0.00372267868 0.000766213043
|
||||
5215.75 0.00284020846 0.000798853062
|
||||
5316.25 0.00158717036 0.000832862333
|
||||
5416.75 0.00200819085 0.000868342561
|
||||
5517.25 0.0044706107 0.000905327348
|
||||
5617.75 0.00135523051 0.000943421323
|
||||
5718.25 0.000261760966 0.000983714257
|
||||
5818.75 0.000210009562 0.00102515713
|
||||
5919.25 -0.000157024642 0.00106890614
|
||||
6019.75 0.000611697915 0.00111378026
|
||||
6120.25 0.000353532075 0.00111004546
|
||||
6220.75 0.00120570511 0.00121565301
|
||||
6321.25 -0.00126499964 0.00126730997
|
||||
6421.75 0.0029594966 0.00132005144
|
||||
6522.25 -0.00180278144 0.00137777581
|
||||
6622.75 0.00154819637 0.00143478041
|
||||
6723.25 0.00137296473 0.00149757271
|
||||
6823.75 -0.000271202669 0.00155948172
|
||||
6924.25 -0.00306837271 0.00162568622
|
||||
7024.75 0.00346602562 0.00169188976
|
||||
7125.25 -8.40576554E-05 0.00176525436
|
||||
7225.75 0.00141055893 0.00183909095
|
||||
7326.25 -0.00170315946 0.00191744238
|
||||
7426.75 0.00399357243 0.00199844555
|
||||
7527.25 0.00378603394 0.00208493839
|
||||
7627.75 -0.0015303158 0.00216992033
|
||||
7728.25 -0.000931658073 0.00226567509
|
||||
7828.75 0.0011671311 0.00235924947
|
||||
7929.25 0.00147725609 0.00245769641
|
||||
8029.75 -0.00100983925 0.00256942322
|
||||
8130.25 -0.00329542124 0.00255286858
|
||||
8230.75 0.000636890228 0.00279597795
|
||||
8331.25 -0.000814018633 0.00291290155
|
||||
8431.75 0.000101912547 0.00303673191
|
||||
8532.25 0.00311038784 0.0031603991
|
||||
8632.75 0.000473049572 0.00329964113
|
||||
8733.25 8.36732E-05 0.00343974064
|
||||
8833.75 0.000275585165 0.00358184548
|
||||
8934.25 0.0059381551 0.00373021006
|
||||
9034.75 -0.0014588358 0.0038926573
|
||||
9135.25 -0.00158156038 0.00405870998
|
||||
9235.75 -0.00125287442 0.00422594705
|
||||
9336.25 -0.00212622165 0.00439704849
|
||||
9436.75 -0.00477056006 0.0045911195
|
||||
9537.25 -0.00229735693 0.00479087708
|
||||
9637.75 0.00575469607 0.00498561109
|
||||
9738.25 -7.52893075E-05 0.00519483122
|
||||
9838.75 -0.00368605583 0.0054198485
|
||||
9939.25 -0.00862419517 0.00564201231
|
||||
10039.75 -0.0323936833 0.0181186246
|
@ -1,21 +1,20 @@
|
||||
|
||||
# Run Numbers: 1111
|
||||
LaAlO3, SLR, 30G, 150K, Bias=23 kV, Ix=0A, Iy=+3A, aligned, beam on=1s
|
||||
###############################################################
|
||||
FITPARAMETER
|
||||
###############################################################
|
||||
# No Name Value Err Min Max
|
||||
1 Alpha 1.11587 0.00038 none
|
||||
2 Asy 0.0570 0.0011 none
|
||||
1 Alpha 1.11592 0.00035 none
|
||||
2 Asy 0.05868 0.00091 none 0 0.2
|
||||
3 T 1 0 none
|
||||
4 Rlx 1.015 0.023 none
|
||||
4 Rlx 1.142 0.023 none 0 15000
|
||||
5 One 1 0 none
|
||||
6 Bet -1.052 0.027 none
|
||||
6 FlHel -1.048 0.022 none -2 0
|
||||
|
||||
###############################################################
|
||||
THEORY
|
||||
###############################################################
|
||||
asymmetry fun1
|
||||
userFcn .libs/libBNMR.so ExpRlx 3 4
|
||||
userFcn libBNMR.so ExpRlx 3 4
|
||||
|
||||
###############################################################
|
||||
FUNCTIONS
|
||||
@ -28,12 +27,11 @@ fittype 2 (asymmetry fit)
|
||||
alpha 1
|
||||
forward 3
|
||||
backward 4
|
||||
data 11 800 11 800
|
||||
#backgr.fix 0
|
||||
data 11 910 11 910
|
||||
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 0.5 8
|
||||
fit 0.2 9
|
||||
packing 5
|
||||
|
||||
RUN 045674 BNMR TRIUMF MUD (name beamline institute data-file-format)
|
||||
@ -41,15 +39,13 @@ fittype 2 (asymmetry fit)
|
||||
alpha 1
|
||||
forward 5
|
||||
backward 6
|
||||
data 11 800 11 800
|
||||
#backgr.fix 0
|
||||
data 11 910 11 910
|
||||
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 0.5 8
|
||||
fit 0.2 9
|
||||
packing 5
|
||||
|
||||
|
||||
###############################################################
|
||||
COMMANDS
|
||||
MINIMIZE
|
||||
@ -68,9 +64,9 @@ FOURIER
|
||||
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
|
||||
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL
|
||||
phase 8
|
||||
#range FRQMIN FRQMAX
|
||||
###############################################################
|
||||
STATISTIC --- 2015-04-14 11:00:19
|
||||
chisq = 399.5, NDF = 290, chisq/NDF = 1.377736
|
||||
STATISTIC --- 2019-05-03 17:05:58
|
||||
chisq = 566.6, NDF = 346, chisq/NDF = 1.637584
|
52
src/external/libBNMR/ExpRlx.msr
vendored
52
src/external/libBNMR/ExpRlx.msr
vendored
@ -1,45 +1,53 @@
|
||||
Title
|
||||
LaAlO3, SLR, 30G, 150K, Bias=23 kV, Ix=0A, Iy=+3A, aligned, beam on=1s
|
||||
###############################################################
|
||||
FITPARAMETER
|
||||
# Nr. Name Value Step Pos_Error Boundaries
|
||||
1 Asy1 0.0812706 0.00149848 none 0 none
|
||||
2 T 4000 0 none 0 none
|
||||
3 Lam1 0.00239816 6.05947e-05 none 0 none
|
||||
###############################################################
|
||||
# No Name Value Err Min Max
|
||||
1 Alpha 1 0 none
|
||||
2 Asy 0.05992 0.00063 none 0 0.2
|
||||
3 T 1 0 none
|
||||
4 Rlx 1.143 0.023 none 0 100
|
||||
|
||||
###############################################################
|
||||
THEORY
|
||||
asymmetry 1
|
||||
userFcn /usr/local/lib/libBNMR.so ExpRlx 2 3
|
||||
###############################################################
|
||||
asymmetry 2
|
||||
userFcn libBNMR ExpRlx 3 4
|
||||
|
||||
###############################################################
|
||||
RUN 45377 MUE4 PSI ASCII (name beamline institute data-file-format)
|
||||
fittype 8 (non muSR fit)
|
||||
RUN 045674 BNMR TRIUMF MUD (name beamline institute data-file-format)
|
||||
fittype 5 (beta-NMR fit)
|
||||
alpha 1
|
||||
forward 3 5
|
||||
backward 4 6
|
||||
data 11 910 11 910
|
||||
background 1 9 1 9 # estimated bkg: 8.0000 / 9.6250
|
||||
t0 10.0 10.0 10.0 10.0
|
||||
map 0 0 0 0 0 0 0 0 0 0
|
||||
xy-data 1 2
|
||||
fit 0.00 8000.00
|
||||
packing 1
|
||||
fit 0.2 9
|
||||
packing 5
|
||||
|
||||
###############################################################
|
||||
COMMANDS
|
||||
STRATEGY 1
|
||||
MINIMIZE
|
||||
#MINOS
|
||||
HESSE
|
||||
SAVE
|
||||
END RETURN
|
||||
|
||||
###############################################################
|
||||
PLOT 8 (non muSR plot)
|
||||
PLOT 5 (beta-NMR asymmetry plot)
|
||||
runs 1
|
||||
range 0.00 8000.00
|
||||
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.50
|
||||
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL
|
||||
phase 8
|
||||
#range FRQMIN FRQMAX
|
||||
###############################################################
|
||||
STATISTIC --- 2010-09-02 17:44:20
|
||||
chisq = 186.322493286053, NDF = 72, chisq/NDF = 2.5878124067507362
|
||||
STATISTIC --- 2019-05-03 17:06:29
|
||||
chisq = 419.1, NDF = 173, chisq/NDF = 2.422357
|
||||
|
73
src/external/libBNMR/SExpRlx-hel.msr
vendored
Normal file
73
src/external/libBNMR/SExpRlx-hel.msr
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
LaAlO3, SLR, 30G, 150K, Bias=23 kV, Ix=0A, Iy=+3A, aligned, beam on=1s
|
||||
###############################################################
|
||||
FITPARAMETER
|
||||
###############################################################
|
||||
# No Name Value Err Min Max
|
||||
1 Alpha 1.11589 0.00037 none
|
||||
2 Asy 0.1121 0.0094 none 0 0.2
|
||||
3 T 1 0 none
|
||||
4 Rlx 4.12 0.87 none 0 15000
|
||||
5 Beta 0.434 0.031 none 0.3 2
|
||||
6 One 1 0 none
|
||||
7 FlHel -1.048 0.023 none -2 0
|
||||
|
||||
###############################################################
|
||||
THEORY
|
||||
###############################################################
|
||||
asymmetry fun1
|
||||
userFcn libBNMR SExpRlx 3 4 5
|
||||
|
||||
###############################################################
|
||||
FUNCTIONS
|
||||
###############################################################
|
||||
fun1 = 0.5 * map1 * map2
|
||||
|
||||
###############################################################
|
||||
RUN 045674 BNMR TRIUMF MUD (name beamline institute data-file-format)
|
||||
fittype 2 (asymmetry fit)
|
||||
alpha 1
|
||||
forward 3
|
||||
backward 4
|
||||
data 11 1000 11 1000
|
||||
background 1 9 1 9 # estimated bkg: 8.0000 / 9.6250
|
||||
t0 10.0 10.0
|
||||
map 2 6 0 0 0 0 0 0 0 0
|
||||
fit 0.2 9
|
||||
packing 5
|
||||
|
||||
RUN 045674 BNMR TRIUMF MUD (name beamline institute data-file-format)
|
||||
fittype 2 (asymmetry fit)
|
||||
alpha 1
|
||||
forward 5
|
||||
backward 6
|
||||
data 11 1000 11 1000
|
||||
background 1 9 1 9 # estimated bkg: 11.6250 / 15.6250
|
||||
t0 10.0 10.0
|
||||
map 2 7 0 0 0 0 0 0 0 0
|
||||
fit 0.2 9
|
||||
packing 5
|
||||
|
||||
###############################################################
|
||||
COMMANDS
|
||||
MINIMIZE
|
||||
HESSE
|
||||
SAVE
|
||||
|
||||
###############################################################
|
||||
PLOT 2 (asymmetry plot)
|
||||
runs 1 2
|
||||
use_fit_ranges
|
||||
view_packing 10
|
||||
|
||||
|
||||
###############################################################
|
||||
FOURIER
|
||||
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_OPT_REAL
|
||||
phase 8
|
||||
#range FRQMIN FRQMAX
|
||||
###############################################################
|
||||
STATISTIC --- 2019-05-01 11:29:06
|
||||
chisq = 358.6, NDF = 345, chisq/NDF = 1.039300
|
54
src/external/libBNMR/SExpRlx.msr
vendored
54
src/external/libBNMR/SExpRlx.msr
vendored
@ -1,46 +1,54 @@
|
||||
Title
|
||||
LaAlO3, SLR, 30G, 150K, Bias=23 kV, Ix=0A, Iy=+3A, aligned, beam on=1s
|
||||
###############################################################
|
||||
FITPARAMETER
|
||||
# Nr. Name Value Step Pos_Error Boundaries
|
||||
1 Asy1 0.262789 0.0465582 none 0 none
|
||||
2 T 4000 0 none 0 none
|
||||
3 Lam1 0.0233569 0.0094885 none 0 none
|
||||
4 Bet1 0.399259 0.0353915 none 0 none
|
||||
###############################################################
|
||||
# No Name Value Err Min Max
|
||||
1 Alpha 0.9 1.0 none
|
||||
2 Asy 0.115 0.012 none 0 0.2
|
||||
3 T 1 0 none
|
||||
4 Rlx 4.16 0.88 none 0 100
|
||||
5 Beta 0.433 0.031 none 0.3 2
|
||||
|
||||
###############################################################
|
||||
THEORY
|
||||
asymmetry 1
|
||||
userFcn /usr/local/lib/libBNMR.so SExpRlx 2 3 4
|
||||
###############################################################
|
||||
asymmetry 2
|
||||
userFcn libBNMR SExpRlx 3 4 5
|
||||
|
||||
###############################################################
|
||||
RUN 45377 MUE4 PSI ASCII (name beamline institute data-file-format)
|
||||
fittype 8 (non muSR fit)
|
||||
RUN 045674 BNMR TRIUMF MUD (name beamline institute data-file-format)
|
||||
fittype 5 (beta-NMR fit)
|
||||
alpha 1
|
||||
forward 3 5
|
||||
backward 4 6
|
||||
data 11 910 11 910
|
||||
background 1 9 1 9 # estimated bkg: 8.0000 / 9.6250
|
||||
t0 10.0 10.0 10.0 10.0
|
||||
map 0 0 0 0 0 0 0 0 0 0
|
||||
xy-data 1 2
|
||||
fit 0.00 8000.00
|
||||
packing 1
|
||||
fit 0.2 9
|
||||
packing 5
|
||||
|
||||
###############################################################
|
||||
COMMANDS
|
||||
STRATEGY 1
|
||||
MINIMIZE
|
||||
#MINOS
|
||||
HESSE
|
||||
SAVE
|
||||
END RETURN
|
||||
|
||||
###############################################################
|
||||
PLOT 8 (non muSR plot)
|
||||
PLOT 5 (beta-NMR asymmetry plot)
|
||||
runs 1
|
||||
range 0.00 8000.00
|
||||
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.50
|
||||
plot POWER # REAL, IMAG, REAL_AND_IMAG, POWER, PHASE, PHASE_OPT_REAL
|
||||
phase 8
|
||||
#range FRQMIN FRQMAX
|
||||
###############################################################
|
||||
STATISTIC --- 2010-09-02 17:51:10
|
||||
chisq = 93.71265965991455, NDF = 71, chisq/NDF = 1.319896614928374
|
||||
STATISTIC --- 2019-05-03 17:07:01
|
||||
chisq = 210.2, NDF = 171, chisq/NDF = 1.229344
|
||||
|
39
src/external/libBNMR/TBNMR.cpp
vendored
39
src/external/libBNMR/TBNMR.cpp
vendored
@ -31,55 +31,50 @@
|
||||
|
||||
#include "TBNMR.h"
|
||||
|
||||
#define tau_Li 1210
|
||||
#define gamma_Li 6.3018 // In units kHz/mT
|
||||
#define PI 3.14159265358979323846
|
||||
#define TWOPI 6.28318530717958647692
|
||||
|
||||
ClassImp(ExpRlx) // for the ROOT-dictionary
|
||||
ClassImp(SExpRlx)
|
||||
|
||||
|
||||
double ExpRlx::operator()(double x, const std::vector<double> &par) const {
|
||||
assert(par.size()==2); // make sure the number of parameters handed to the function is correct
|
||||
|
||||
// par[0] time of beam off
|
||||
// par[1] is the relaxation rate
|
||||
// par[0] time of beam on (pulse length) in seconds
|
||||
// par[1] is the relaxation rate in 1/s
|
||||
double tau_p;
|
||||
double y;
|
||||
|
||||
tau_p = (tau_Li/(1.+par[1]*tau_Li));
|
||||
|
||||
|
||||
// x should be in seconds, otherwise it should be rescaled here
|
||||
if ( x <= par[0] && x >= 0) {
|
||||
y=(tau_p/tau_Li)*(1-exp(-x/tau_p))/(1-exp(-x/tau_Li));
|
||||
return (tau_p/tau_Li)*(1-exp(-x/tau_p))/(1-exp(-x/tau_Li));
|
||||
} else if ( x > par[0] ){
|
||||
y=(tau_p/tau_Li)*(1-exp(-par[0]/tau_p))/(1-exp(-par[0]/tau_Li))*exp(-par[1]*(x-par[0]));
|
||||
} else {
|
||||
y = 0;
|
||||
}
|
||||
|
||||
return y;
|
||||
return (tau_p/tau_Li)*(1-exp(-par[0]/tau_p))/(1-exp(-par[0]/tau_Li))*exp(-par[1]*(x-par[0]));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//initialize Integrators
|
||||
TF1 SExpRlx::sexp1=TF1("sexp", "exp(-([0]-x)/[3])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0);
|
||||
TF1 SExpRlx::sexp2=TF1("sexp", "exp(-([3]-x)/[4])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20000.0);
|
||||
|
||||
double SExpRlx::operator()(double x, const std::vector<double> &par) const {
|
||||
|
||||
assert(par.size()==3); // make sure the number of parameters handed to the function is correct
|
||||
|
||||
// par[0] time of beam off
|
||||
// par[1] is the relaxation rate
|
||||
// par[0] beam of beam on (pulse length) in seconds
|
||||
// par[1] is the relaxation rate in 1/s
|
||||
// par[2] is the exponent
|
||||
|
||||
// x should be in seconds, otherwise it should be rescaled here
|
||||
if ( x >= 0 && x <= par[0] ) {
|
||||
TF1 sexp1("sexp1", "exp(-([0]-x)/[3])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20.0);
|
||||
sexp1.SetParameters(x, par[1], par[2],tau_Li);
|
||||
sexp1.SetNpx(1000);
|
||||
return sexp1.Integral(0.0,x)/(1-exp(-x/tau_Li))/tau_Li;
|
||||
} else if ( x > par[0] ) {
|
||||
TF1 sexp2("sexp2", "exp(-([3]-x)/[4])*exp(-pow(([1]*([0]-x)),[2]))", 0.0, 20.0);
|
||||
sexp2.SetParameters(x, par[1], par[2], par[0],tau_Li);
|
||||
sexp2.SetNpx(1000);
|
||||
return sexp2.Integral(0.0,par[0])/(1-exp(-par[0]/tau_Li))/tau_Li;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
6
src/external/libBNMR/TBNMR.h
vendored
6
src/external/libBNMR/TBNMR.h
vendored
@ -41,6 +41,10 @@
|
||||
#ifndef LIBBNMRH
|
||||
#define LIBBNMRH
|
||||
|
||||
#define tau_Li 1.210 // In seconds
|
||||
#define PI 3.14159265358979323846
|
||||
#define TWOPI 6.28318530717958647692
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -66,7 +70,7 @@ class SExpRlx : public PUserFcnBase {
|
||||
|
||||
public:
|
||||
// default constructor and destructor
|
||||
SExpRlx(){sexp1.SetNpx(1000); sexp2.SetNpx(1000);}
|
||||
SExpRlx(){}
|
||||
~SExpRlx(){}
|
||||
|
||||
Bool_t NeedGlobalPart() const { return false; }
|
||||
|
@ -58,6 +58,7 @@
|
||||
#define PRUN_ASYMMETRY 2
|
||||
#define PRUN_ASYMMETRY_RRF 3
|
||||
#define PRUN_MU_MINUS 4
|
||||
#define PRUN_ASYMMETRY_BNMR 5
|
||||
#define PRUN_NON_MUSR 8
|
||||
|
||||
// muon life time in (us), see PRL99, 032001 (2007)
|
||||
@ -100,6 +101,7 @@
|
||||
#define MSR_FITTYPE_ASYM 2
|
||||
#define MSR_FITTYPE_ASYM_RRF 3
|
||||
#define MSR_FITTYPE_MU_MINUS 4
|
||||
#define MSR_FITTYPE_BNMR 5
|
||||
#define MSR_FITTYPE_NON_MUSR 8
|
||||
|
||||
//-------------------------------------------------------------
|
||||
@ -109,6 +111,7 @@
|
||||
#define MSR_PLOT_ASYM 2
|
||||
#define MSR_PLOT_ASYM_RRF 3
|
||||
#define MSR_PLOT_MU_MINUS 4
|
||||
#define MSR_PLOT_BNMR 5
|
||||
#define MSR_PLOT_NON_MUSR 8
|
||||
|
||||
//-------------------------------------------------------------
|
||||
@ -568,6 +571,7 @@ class PMsrGlobalBlock {
|
||||
virtual Double_t GetFitRange(UInt_t idx);
|
||||
virtual Int_t GetFitRangeOffset(UInt_t idx);
|
||||
virtual Int_t GetPacking() { return fPacking; }
|
||||
virtual Double_t GetEstimatedAlpha() { return fAlpha; }
|
||||
|
||||
virtual void SetGlobalPresent(Bool_t bval) { fGlobalPresent = bval; }
|
||||
virtual void SetRRFFreq(Double_t freq, const char *unit);
|
||||
@ -596,6 +600,7 @@ class PMsrGlobalBlock {
|
||||
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.
|
||||
Int_t fPacking; ///< packing/rebinning
|
||||
Double_t fAlpha; ///< estimated alpha value from F/B counts
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------
|
||||
@ -643,6 +648,7 @@ class PMsrRunBlock {
|
||||
virtual Double_t GetFitRange(UInt_t idx);
|
||||
virtual Int_t GetFitRangeOffset(UInt_t idx);
|
||||
virtual Int_t GetPacking() { return fPacking; }
|
||||
virtual Double_t GetEstimatedAlpha() { return fAlpha; }
|
||||
virtual Int_t GetXDataIndex() { return fXYDataIndex[0]; }
|
||||
virtual Int_t GetYDataIndex() { return fXYDataIndex[1]; }
|
||||
virtual TString* GetXDataLabel() { return &fXYDataLabel[0]; }
|
||||
@ -665,6 +671,7 @@ class PMsrRunBlock {
|
||||
virtual void SetForwardHistoNo(Int_t histoNo, Int_t idx=-1);
|
||||
virtual void SetBackwardHistoNo(Int_t histoNo, Int_t idx=-1);
|
||||
virtual void SetBkgEstimated(Double_t dval, Int_t idx);
|
||||
virtual void SetEstimatedAlpha(Double_t dval);
|
||||
virtual void SetBkgFix(Double_t dval, Int_t idx);
|
||||
virtual void SetBkgRange(Int_t ival, Int_t idx);
|
||||
virtual void SetDataRange(Int_t ival, Int_t idx);
|
||||
@ -705,6 +712,7 @@ class PMsrRunBlock {
|
||||
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.
|
||||
Double_t fAlpha; ///< estimated alpha value from F/B counts
|
||||
Int_t fPacking; ///< packing/rebinning
|
||||
Int_t fXYDataIndex[2]; ///< used to get the data indices when using db-files (fit type 8)
|
||||
TString fXYDataLabel[2]; ///< used to get the indices via labels when using db-files (fit type 8)
|
||||
|
@ -246,7 +246,7 @@ class PMusrCanvas : public TObject, public TQObject
|
||||
Bool_t fDifferenceView; ///< tag showing that the shown data, fourier, are the difference between data and theory
|
||||
Int_t fCurrentPlotView; ///< tag showing what the current plot view is: data, fourier, ...
|
||||
Int_t fPreviousPlotView; ///< tag showing the previous plot view
|
||||
Int_t fPlotType; ///< plot type tag: -1 == undefined, MSR_PLOT_SINGLE_HISTO == single histogram, MSR_PLOT_ASYM == asymmetry, MSR_PLOT_MU_MINUS == mu minus (not yet implemented), MSR_PLOT_NON_MUSR == non-muSR
|
||||
Int_t fPlotType; ///< plot type tag: -1 == undefined, MSR_PLOT_SINGLE_HISTO == single histogram, MSR_PLOT_ASYM == asymmetry, MSR_PLOT_BNMR == beta-NMR asymmetry, MSR_PLOT_MU_MINUS == mu minus (not yet implemented), MSR_PLOT_NON_MUSR == non-muSR
|
||||
Int_t fPlotNumber; ///< plot number
|
||||
|
||||
Bool_t fXRangePresent, fYRangePresent; ///< flag indicating if x-/y-range is present
|
||||
|
94
src/include/PRunAsymmetryBNMR.h
Normal file
94
src/include/PRunAsymmetryBNMR.h
Normal file
@ -0,0 +1,94 @@
|
||||
/***************************************************************************
|
||||
|
||||
PRunAsymmetryBNMR.h
|
||||
|
||||
Author: Zaher Salman
|
||||
Based on PRunAsymmetry.h by Andreas Suter
|
||||
e-mail: zaher.salman@psi.ch
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2018-2019 by Zaher Salman *
|
||||
* zaher.salman@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 _PRUNASYMMETRYBNMR_H_
|
||||
#define _PRUNASYMMETRYBNMR_H_
|
||||
|
||||
#include "PRunBase.h"
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Class handling the asymmetry fit.
|
||||
*/
|
||||
class PRunAsymmetryBNMR : public PRunBase
|
||||
{
|
||||
public:
|
||||
PRunAsymmetryBNMR();
|
||||
PRunAsymmetryBNMR(PMsrHandler *msrInfo, PRunDataHandler *rawData, UInt_t runNo, EPMusrHandleTag tag);
|
||||
virtual ~PRunAsymmetryBNMR();
|
||||
|
||||
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);
|
||||
|
||||
virtual Int_t GetStartTimeBin() { return fStartTimeBin; }
|
||||
virtual Int_t GetEndTimeBin() { return fEndTimeBin; }
|
||||
virtual Int_t GetPacking() { return fPacking; }
|
||||
|
||||
protected:
|
||||
virtual void CalcNoOfFitBins();
|
||||
virtual Bool_t PrepareData();
|
||||
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 fPacking; ///< packing for this particular run. Either given in the RUN- or GLOBAL-block.
|
||||
|
||||
PDoubleVector fForwardp; ///< pos hel forward histo data
|
||||
PDoubleVector fForwardpErr; ///< pos hel forward histo errors
|
||||
PDoubleVector fBackwardp; ///< pos hel backward histo data
|
||||
PDoubleVector fBackwardpErr; ///< pos hel backward histo errors
|
||||
PDoubleVector fForwardm; ///< neg hel forward histo data
|
||||
PDoubleVector fForwardmErr; ///< neg hel forward histo errors
|
||||
PDoubleVector fBackwardm; ///< neg hel backward histo data
|
||||
PDoubleVector fBackwardmErr; ///< neg hel backward histo errors
|
||||
|
||||
Int_t fGoodBins[4]; ///< keep first/last good bins. 0=fgb, 1=lgb (forward); 2=fgb, 3=lgb (backward)
|
||||
|
||||
Int_t fStartTimeBin; ///< bin at which the fit starts
|
||||
Int_t fEndTimeBin; ///< bin at which the fit ends
|
||||
|
||||
Bool_t SubtractFixBkg();
|
||||
Bool_t SubtractEstimatedBkg();
|
||||
|
||||
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);
|
||||
virtual Double_t EstimateAlpha();
|
||||
};
|
||||
|
||||
#endif // _PRUNASYMMETRYBNMR_H_
|
@ -39,6 +39,7 @@
|
||||
#include "PRunSingleHistoRRF.h"
|
||||
#include "PRunAsymmetry.h"
|
||||
#include "PRunAsymmetryRRF.h"
|
||||
#include "PRunAsymmetryBNMR.h"
|
||||
#include "PRunMuMinus.h"
|
||||
#include "PRunNonMusr.h"
|
||||
|
||||
@ -62,6 +63,7 @@ class PRunListCollection
|
||||
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 GetAsymmetryBNMRChisq(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;
|
||||
|
||||
@ -72,6 +74,7 @@ class PRunListCollection
|
||||
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 GetAsymmetryBNMRMaximumLikelihood(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;
|
||||
|
||||
@ -85,6 +88,7 @@ class PRunListCollection
|
||||
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 GetNoOfAsymmetryBNMR() const { return fRunAsymmetryBNMRList.size(); } ///< returns the number of asymmetry BNMR 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
|
||||
|
||||
@ -92,6 +96,7 @@ class PRunListCollection
|
||||
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* GetAsymmetryBNMR(UInt_t index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetMuMinus(UInt_t index, EDataSwitch tag=kIndex);
|
||||
virtual PRunData* GetNonMusr(UInt_t index, EDataSwitch tag=kIndex);
|
||||
|
||||
@ -110,6 +115,7 @@ class PRunListCollection
|
||||
std::vector<PRunSingleHistoRRF*> fRunSingleHistoRRFList; ///< stores all processed single histogram RRF data
|
||||
std::vector<PRunAsymmetry*> fRunAsymmetryList; ///< stores all processed asymmetry data
|
||||
std::vector<PRunAsymmetryRRF*> fRunAsymmetryRRFList; ///< stores all processed asymmetry RRF data
|
||||
std::vector<PRunAsymmetryBNMR*> fRunAsymmetryBNMRList; ///< stores all processed asymmetry BNMR data
|
||||
std::vector<PRunMuMinus*> fRunMuMinusList; ///< stores all processed mu-minus data
|
||||
std::vector<PRunNonMusr*> fRunNonMusrList; ///< stores all processed non-muSR data
|
||||
};
|
||||
|
164
src/musrt0.cpp
164
src/musrt0.cpp
@ -645,6 +645,169 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MSR_FITTYPE_BNMR:
|
||||
if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // no addruns / no grouping
|
||||
// handle forward histo
|
||||
// get histo number
|
||||
histoNo = runList->at(i).GetForwardHistoNo();
|
||||
runName = runList->at(i).GetRunName();
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetT0Bin(t0Bin, 0);
|
||||
// set data range as well if firstGoodBinOffset is given
|
||||
if (firstGoodBinOffsetPresent) {
|
||||
start = t0Bin + firstGoodBinOffset;
|
||||
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
|
||||
runList->at(i).SetDataRange(start, 0);
|
||||
runList->at(i).SetDataRange(end, 1);
|
||||
}
|
||||
// handle backward histo
|
||||
// get histo number
|
||||
histoNo = runList->at(i).GetBackwardHistoNo();
|
||||
runName = runList->at(i).GetRunName();
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetT0Bin(t0Bin, 1);
|
||||
// set data range as well if firstGoodBinOffset is given
|
||||
if (firstGoodBinOffsetPresent) {
|
||||
start = t0Bin + firstGoodBinOffset;
|
||||
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
|
||||
runList->at(i).SetDataRange(start, 2);
|
||||
runList->at(i).SetDataRange(end, 3);
|
||||
}
|
||||
} else if ((runList->at(i).GetRunNameSize() > 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // addruns / no grouping
|
||||
// handle forward histo
|
||||
// get histo number
|
||||
histoNo = runList->at(i).GetForwardHistoNo();
|
||||
runName = runList->at(i).GetRunName();
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetT0Bin(t0Bin, 0);
|
||||
// set data range as well if firstGoodBinOffset is given
|
||||
if (firstGoodBinOffsetPresent) {
|
||||
start = t0Bin + firstGoodBinOffset;
|
||||
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
|
||||
runList->at(i).SetDataRange(start, 0);
|
||||
runList->at(i).SetDataRange(end, 1);
|
||||
}
|
||||
// handle addruns
|
||||
for (UInt_t j=1; j<runList->at(i).GetRunNameSize(); j++) {
|
||||
runName = runList->at(i).GetRunName(j);
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetAddT0Bin(t0Bin, j-1, 0);
|
||||
}
|
||||
// handle backward histo
|
||||
// get histo number
|
||||
histoNo = runList->at(i).GetBackwardHistoNo();
|
||||
runName = runList->at(i).GetRunName();
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetT0Bin(t0Bin, 1);
|
||||
// set data range as well if firstGoodBinOffset is given
|
||||
if (firstGoodBinOffsetPresent) {
|
||||
start = t0Bin + firstGoodBinOffset;
|
||||
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
|
||||
runList->at(i).SetDataRange(start, 2);
|
||||
runList->at(i).SetDataRange(end, 3);
|
||||
}
|
||||
// handle addruns
|
||||
for (UInt_t j=1; j<runList->at(i).GetRunNameSize(); j++) {
|
||||
runName = runList->at(i).GetRunName(j);
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetAddT0Bin(t0Bin, j-1, 1);
|
||||
}
|
||||
} else if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() > 1)) { // no addruns / grouping
|
||||
// handle forward histo
|
||||
for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
|
||||
// get histo number
|
||||
histoNo = runList->at(i).GetForwardHistoNo(j);
|
||||
runName = runList->at(i).GetRunName();
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetT0Bin(t0Bin, 2*j);
|
||||
if (firstGoodBinOffsetPresent && (j==0)) {
|
||||
start = t0Bin + firstGoodBinOffset;
|
||||
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
|
||||
runList->at(i).SetDataRange(start, 0);
|
||||
runList->at(i).SetDataRange(end, 1);
|
||||
}
|
||||
}
|
||||
// handle backward histo
|
||||
for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++) {
|
||||
// get histo number
|
||||
histoNo = runList->at(i).GetBackwardHistoNo(j);
|
||||
runName = runList->at(i).GetRunName();
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetT0Bin(t0Bin, 2*j+1);
|
||||
if (firstGoodBinOffsetPresent && (j==0)) {
|
||||
start = t0Bin + firstGoodBinOffset;
|
||||
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
|
||||
runList->at(i).SetDataRange(start, 2);
|
||||
runList->at(i).SetDataRange(end, 3);
|
||||
}
|
||||
}
|
||||
} else { // addruns / grouping
|
||||
// handle forward histo
|
||||
for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
|
||||
// get histo number
|
||||
histoNo = runList->at(i).GetForwardHistoNo(j);
|
||||
runName = runList->at(i).GetRunName();
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetT0Bin(t0Bin, 2*j);
|
||||
if (firstGoodBinOffsetPresent && (j==0)) {
|
||||
start = t0Bin + firstGoodBinOffset;
|
||||
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
|
||||
runList->at(i).SetDataRange(start, 0);
|
||||
runList->at(i).SetDataRange(end, 1);
|
||||
}
|
||||
// handle addruns
|
||||
for (UInt_t k=1; k<runList->at(i).GetRunNameSize(); k++) {
|
||||
runName = runList->at(i).GetRunName(k);
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetAddT0Bin(t0Bin, k-1, 2*j);
|
||||
}
|
||||
}
|
||||
// handle backward histo
|
||||
for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++) {
|
||||
// get histo number
|
||||
histoNo = runList->at(i).GetBackwardHistoNo(j);
|
||||
runName = runList->at(i).GetRunName();
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetT0Bin(t0Bin, 2*j+1);
|
||||
if (firstGoodBinOffsetPresent && (j==0)) {
|
||||
start = t0Bin + firstGoodBinOffset;
|
||||
end = dataHandler->GetRunData(*runName)->GetDataBin(histoNo)->size();
|
||||
runList->at(i).SetDataRange(start, 2);
|
||||
runList->at(i).SetDataRange(end, 3);
|
||||
}
|
||||
// handle addruns
|
||||
for (UInt_t k=1; k<runList->at(i).GetRunNameSize(); k++) {
|
||||
runName = runList->at(i).GetRunName(k);
|
||||
// get bin position of maximal data
|
||||
t0Bin = musrt0_getMaxBin(dataHandler->GetRunData(*runName)->GetDataBin(histoNo));
|
||||
// set t0 to maximum data position
|
||||
runList->at(i).SetAddT0Bin(t0Bin, k-1, 2*j+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -806,6 +969,7 @@ Int_t main(Int_t argc, Char_t *argv[])
|
||||
}
|
||||
break;
|
||||
case MSR_FITTYPE_ASYM:
|
||||
case MSR_FITTYPE_BNMR:
|
||||
case MSR_FITTYPE_ASYM_RRF:
|
||||
if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // no addruns / no grouping
|
||||
// feed necessary data forward
|
||||
|
Reference in New Issue
Block a user