diff --git a/ChangeLog b/ChangeLog index aa2f75f1..cae078e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ NEW any2many: an attempt to write the universial musr-data-file converter. Just NEW musrt0: added the possibility to show the t0 saved in the data file 's'. Furthermore added the option --getT0FromPromptPeak, -g with : will, in non-interactive mode estimate the t0's from the prompt peak and write it into the msr-file (MUSR-133). +FIXED 2 little annoying problems: (i) now it is possible to zoom down to the single bin in musrview. + (ii) when switching between data- and difference-view, the x-range doesn't change anymore. FIXED musrt0 crash for histogram number out of range (MUSR-157) FIXED fixes the inadequate attempt to use log max likelihood fit for asymmetry/non-muSR fit (MUSR-148) CHANGED less strict handling of empty FUNCTION block diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index 9eff8f33..8a1c7a2b 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -2942,8 +2942,8 @@ void PMusrCanvas::PlotData(Bool_t unzoom) // keep the current x-axis range from the data view if (fHistoFrame && (fPreviousPlotView == PV_DATA)) { - xmin = fHistoFrame->GetXaxis()->GetBinCenter(fHistoFrame->GetXaxis()->GetFirst()); - xmax = fHistoFrame->GetXaxis()->GetBinCenter(fHistoFrame->GetXaxis()->GetLast()); + xmin = fHistoFrame->GetXaxis()->GetBinLowEdge(fHistoFrame->GetXaxis()->GetFirst()); + xmax = fHistoFrame->GetXaxis()->GetBinLowEdge(fHistoFrame->GetXaxis()->GetLast()) + fHistoFrame->GetXaxis()->GetBinWidth(fHistoFrame->GetXaxis()->GetLast()); } else { xmin = fXmin; xmax = fXmax; @@ -3000,11 +3000,20 @@ void PMusrCanvas::PlotData(Bool_t unzoom) // create histo frame in order to plot histograms possibly with different x-frames fHistoFrame = fDataTheoryPad->DrawFrame(dataXmin, dataYmin, dataXmax, dataYmax); + // find the maximal number of points present in the histograms and increase the default number of points of fHistoFrame (1000) to the needed one + UInt_t noOfPoints = 1000; + for (UInt_t i=0; iGetNbinsX() > (Int_t)noOfPoints) + noOfPoints = fData[i].data->GetNbinsX(); + } + noOfPoints *= 2; // make sure that there are enough points + fHistoFrame->SetBins(noOfPoints, dataXmin, dataXmax); + // set all histo/theory ranges properly for (UInt_t i=0; iGetXaxis()->SetRangeUser(dataXmin, dataXmax); + fData[i].data->GetXaxis()->SetRange(fData[i].data->FindBin(dataXmin), fData[i].data->FindBin(dataXmax)); fData[i].data->GetYaxis()->SetRangeUser(dataYmin, dataYmax); - fData[i].theory->GetXaxis()->SetRangeUser(dataXmin, dataXmax); + fData[i].theory->GetXaxis()->SetRange(fData[i].theory->FindBin(dataXmin), fData[i].theory->FindBin(dataXmax)); fData[i].theory->GetYaxis()->SetRangeUser(dataYmin, dataYmax); } @@ -3204,8 +3213,8 @@ void PMusrCanvas::PlotDifference(Bool_t unzoom) if (fPlotType != MSR_PLOT_NON_MUSR) { // keep the current x-axis range from the data view if (fHistoFrame && (fPreviousPlotView == PV_DATA)) { - xmin = fHistoFrame->GetXaxis()->GetBinCenter(fHistoFrame->GetXaxis()->GetFirst()); - xmax = fHistoFrame->GetXaxis()->GetBinCenter(fHistoFrame->GetXaxis()->GetLast()); + xmin = fHistoFrame->GetXaxis()->GetBinLowEdge(fHistoFrame->GetXaxis()->GetFirst()); + xmax = fHistoFrame->GetXaxis()->GetBinLowEdge(fHistoFrame->GetXaxis()->GetLast()) + fHistoFrame->GetXaxis()->GetBinWidth(fHistoFrame->GetXaxis()->GetLast()); } else { xmin = fXmin; xmax = fXmax; @@ -3252,6 +3261,15 @@ void PMusrCanvas::PlotDifference(Bool_t unzoom) fHistoFrame = fDataTheoryPad->DrawFrame(dataXmin, dataYmin, dataXmax, dataYmax); + // find the maximal number of points present in the histograms and increase the default number of points of fHistoFrame (1000) to the needed one + UInt_t noOfPoints = 1000; + for (UInt_t i=0; iGetNbinsX() > (Int_t)noOfPoints) + noOfPoints = fData[i].diff->GetNbinsX(); + } + noOfPoints *= 2; // make sure that there are enough points + fHistoFrame->SetBins(noOfPoints, dataXmin, dataXmax); + // set x-axis label fHistoFrame->GetXaxis()->SetTitle("time (#mus)"); // set y-axis label @@ -3265,7 +3283,7 @@ void PMusrCanvas::PlotDifference(Bool_t unzoom) if (fData[i].dataRange->IsXRangePresent()) fData[i].diff->GetXaxis()->SetRangeUser(fData[i].dataRange->GetXmin(), fData[i].dataRange->GetXmax()); else - fData[i].diff->GetXaxis()->SetRangeUser(dataXmin, dataXmax); + fData[i].diff->GetXaxis()->SetRange(fData[i].diff->FindBin(dataXmin), fData[i].diff->FindBin(dataXmax)); if (fData[i].dataRange->IsYRangePresent()) fData[i].diff->GetYaxis()->SetRangeUser(fData[i].dataRange->GetYmin(), fData[i].dataRange->GetYmax()); @@ -3405,7 +3423,8 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) } // plot fourier data - double xmin, xmax, ymin, ymax, binContent; + Double_t xmin, xmax, ymin, ymax, binContent; + UInt_t noOfPoints = 1000; switch (fCurrentPlotView) { case PV_FOURIER_REAL: // set x-range @@ -3444,6 +3463,15 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); + // find the maximal number of points present in the histograms and increase the default number of points of fHistoFrame (1000) to the needed one + noOfPoints = 1000; + for (UInt_t i=0; iGetNbinsX() > (Int_t)noOfPoints) + noOfPoints = fData[i].dataFourierRe->GetNbinsX(); + } + noOfPoints *= 2; // make sure that there are enough points + fHistoFrame->SetBins(noOfPoints, xmin, xmax); + // set ranges for Fourier and Fourier theory for (UInt_t i=0; iGetXaxis()->SetRangeUser(xmin, xmax); @@ -3509,6 +3537,15 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); + // find the maximal number of points present in the histograms and increase the default number of points of fHistoFrame (1000) to the needed one + noOfPoints = 1000; + for (UInt_t i=0; iGetNbinsX() > (Int_t)noOfPoints) + noOfPoints = fData[i].dataFourierIm->GetNbinsX(); + } + noOfPoints *= 2; // make sure that there are enough points + fHistoFrame->SetBins(noOfPoints, xmin, xmax); + // set ranges for Fourier and Fourier theory for (UInt_t i=0; iGetXaxis()->SetRangeUser(xmin, xmax); @@ -3587,6 +3624,15 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); + // find the maximal number of points present in the histograms and increase the default number of points of fHistoFrame (1000) to the needed one + noOfPoints = 1000; + for (UInt_t i=0; iGetNbinsX() > (Int_t)noOfPoints) + noOfPoints = fData[i].dataFourierRe->GetNbinsX(); + } + noOfPoints *= 2; // make sure that there are enough points + fHistoFrame->SetBins(noOfPoints, xmin, xmax); + // set ranges for Fourier and Fourier theory for (UInt_t i=0; iGetXaxis()->SetRangeUser(xmin, xmax); @@ -3658,6 +3704,15 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); + // find the maximal number of points present in the histograms and increase the default number of points of fHistoFrame (1000) to the needed one + noOfPoints = 1000; + for (UInt_t i=0; iGetNbinsX() > (Int_t)noOfPoints) + noOfPoints = fData[i].dataFourierPwr->GetNbinsX(); + } + noOfPoints *= 2; // make sure that there are enough points + fHistoFrame->SetBins(noOfPoints, xmin, xmax); + // set ranges for Fourier and Fourier theory for (UInt_t i=0; iGetXaxis()->SetRangeUser(xmin, xmax); @@ -3721,6 +3776,15 @@ void PMusrCanvas::PlotFourier(Bool_t unzoom) fHistoFrame = fDataTheoryPad->DrawFrame(xmin, 1.05*ymin, xmax, 1.05*ymax); + // find the maximal number of points present in the histograms and increase the default number of points of fHistoFrame (1000) to the needed one + noOfPoints = 1000; + for (UInt_t i=0; iGetNbinsX() > (Int_t)noOfPoints) + noOfPoints = fData[i].dataFourierPhase->GetNbinsX(); + } + noOfPoints *= 2; // make sure that there are enough points + fHistoFrame->SetBins(noOfPoints, xmin, xmax); + for (UInt_t i=0; iGetXaxis()->SetRangeUser(xmin, xmax); fData[i].dataFourierPhase->GetYaxis()->SetRangeUser(1.05*ymin, 1.05*ymax);