fix of a time window frame bug reported in MUSR-138
This commit is contained in:
@ -371,7 +371,11 @@ void PFourier::PrepareFFTwInputData(UInt_t apodizationTag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2nd fill fIn
|
// 2nd fill fIn
|
||||||
UInt_t start = (UInt_t)(fStartTime/fTimeResolution) + t0bin;
|
Int_t val = static_cast<Int_t>(fStartTime/fTimeResolution) + t0bin;
|
||||||
|
UInt_t start = 0;
|
||||||
|
if (val >= 0) {
|
||||||
|
start = static_cast<UInt_t>(static_cast<Int_t>(fStartTime/fTimeResolution) + t0bin);
|
||||||
|
}
|
||||||
for (UInt_t i=0; i<fNoOfData; i++) {
|
for (UInt_t i=0; i<fNoOfData; i++) {
|
||||||
fIn[i][0] = fData->GetBinContent(i+start);
|
fIn[i][0] = fData->GetBinContent(i+start);
|
||||||
fIn[i][1] = 0.0;
|
fIn[i][1] = 0.0;
|
||||||
|
@ -2015,11 +2015,14 @@ void PMusrCanvas::HandleDifferenceFourier()
|
|||||||
// check if difference has been already calcualted, if not do it
|
// check if difference has been already calcualted, if not do it
|
||||||
if (fData[0].diff == 0)
|
if (fData[0].diff == 0)
|
||||||
HandleDifference();
|
HandleDifference();
|
||||||
|
|
||||||
|
// get time from the current fHistoFrame
|
||||||
Int_t bin;
|
Int_t bin;
|
||||||
bin = fData[0].diff->GetXaxis()->GetFirst();
|
bin = fHistoFrame->GetXaxis()->GetFirst();
|
||||||
double startTime = fData[0].diff->GetBinCenter(bin);
|
double startTime = fHistoFrame->GetBinCenter(bin);
|
||||||
bin = fData[0].diff->GetXaxis()->GetLast();
|
bin = fHistoFrame->GetXaxis()->GetLast();
|
||||||
double endTime = fData[0].diff->GetBinCenter(bin);
|
double endTime = fHistoFrame->GetBinCenter(bin);
|
||||||
|
|
||||||
for (UInt_t i=0; i<fData.size(); i++) {
|
for (UInt_t i=0; i<fData.size(); i++) {
|
||||||
// calculate fourier transform of the data
|
// calculate fourier transform of the data
|
||||||
PFourier fourierData(fData[i].diff, fFourier.fUnits, startTime, endTime, fFourier.fFourierPower);
|
PFourier fourierData(fData[i].diff, fFourier.fUnits, startTime, endTime, fFourier.fFourierPower);
|
||||||
@ -2549,6 +2552,12 @@ void PMusrCanvas::PlotData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// delete old fHistoFrame if present
|
||||||
|
if (fHistoFrame) {
|
||||||
|
delete fHistoFrame;
|
||||||
|
fHistoFrame = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// create histo frame in order to plot histograms possibly with different x-frames
|
// create histo frame in order to plot histograms possibly with different x-frames
|
||||||
fHistoFrame = fDataTheoryPad->DrawFrame(dataXmin, dataYmin, dataXmax, dataYmax);
|
fHistoFrame = fDataTheoryPad->DrawFrame(dataXmin, dataYmin, dataXmax, dataYmax);
|
||||||
fHistoFrame->GetXaxis()->SetRangeUser(fXmin, fXmax);
|
fHistoFrame->GetXaxis()->SetRangeUser(fXmin, fXmax);
|
||||||
@ -2699,16 +2708,30 @@ void PMusrCanvas::PlotDifference()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (fPlotType != MSR_PLOT_NON_MUSR) {
|
if (fPlotType != MSR_PLOT_NON_MUSR) {
|
||||||
|
// keep the current x-axis range from the data view
|
||||||
|
Double_t xmin, xmax;
|
||||||
|
xmin = fHistoFrame->GetXaxis()->GetBinCenter(fHistoFrame->GetXaxis()->GetFirst());
|
||||||
|
xmax = fHistoFrame->GetXaxis()->GetBinCenter(fHistoFrame->GetXaxis()->GetLast());
|
||||||
|
|
||||||
|
// delete old fHistoFrame if present
|
||||||
|
if (fHistoFrame) {
|
||||||
|
delete fHistoFrame;
|
||||||
|
fHistoFrame = 0;
|
||||||
|
}
|
||||||
|
|
||||||
fHistoFrame = fDataTheoryPad->DrawFrame(fXmin, fYmin, fXmax, fYmax);
|
fHistoFrame = fDataTheoryPad->DrawFrame(fXmin, fYmin, fXmax, fYmax);
|
||||||
// set x-axis label
|
// set x-axis label
|
||||||
fHistoFrame->GetXaxis()->SetTitle("time (#mus)");
|
fHistoFrame->GetXaxis()->SetTitle("time (#mus)");
|
||||||
// set y-axis label
|
// set y-axis label
|
||||||
fHistoFrame->GetYaxis()->SetTitle("data-theory");
|
fHistoFrame->GetYaxis()->SetTitle("data-theory");
|
||||||
// plot all remaining diff data
|
// plot all diff data
|
||||||
for (UInt_t i=0; i<fData.size(); i++) {
|
for (UInt_t i=0; i<fData.size(); i++) {
|
||||||
fData[i].diff->Draw("pesame");
|
fData[i].diff->Draw("pesame");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set the axis frame to the values of the data frame
|
||||||
|
fHistoFrame->GetXaxis()->SetRangeUser(xmin, xmax);
|
||||||
|
|
||||||
// check if RRF and if yes show a label
|
// check if RRF and if yes show a label
|
||||||
if ((fRRFText != 0) && (fRRFLatexText != 0)) {
|
if ((fRRFText != 0) && (fRRFLatexText != 0)) {
|
||||||
fRRFLatexText->DrawLatex(0.1, 0.92, fRRFText->Data());
|
fRRFLatexText->DrawLatex(0.1, 0.92, fRRFText->Data());
|
||||||
|
Reference in New Issue
Block a user