fix of a time window frame bug reported in MUSR-138

This commit is contained in:
nemu 2010-08-11 13:12:31 +00:00
parent e94d869534
commit 91c66651aa
2 changed files with 33 additions and 6 deletions

View File

@ -371,7 +371,11 @@ void PFourier::PrepareFFTwInputData(UInt_t apodizationTag)
}
// 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++) {
fIn[i][0] = fData->GetBinContent(i+start);
fIn[i][1] = 0.0;

View File

@ -2015,11 +2015,14 @@ void PMusrCanvas::HandleDifferenceFourier()
// check if difference has been already calcualted, if not do it
if (fData[0].diff == 0)
HandleDifference();
// get time from the current fHistoFrame
Int_t bin;
bin = fData[0].diff->GetXaxis()->GetFirst();
double startTime = fData[0].diff->GetBinCenter(bin);
bin = fData[0].diff->GetXaxis()->GetLast();
double endTime = fData[0].diff->GetBinCenter(bin);
bin = fHistoFrame->GetXaxis()->GetFirst();
double startTime = fHistoFrame->GetBinCenter(bin);
bin = fHistoFrame->GetXaxis()->GetLast();
double endTime = fHistoFrame->GetBinCenter(bin);
for (UInt_t i=0; i<fData.size(); i++) {
// calculate fourier transform of the data
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
fHistoFrame = fDataTheoryPad->DrawFrame(dataXmin, dataYmin, dataXmax, dataYmax);
fHistoFrame->GetXaxis()->SetRangeUser(fXmin, fXmax);
@ -2699,16 +2708,30 @@ void PMusrCanvas::PlotDifference()
return;
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);
// set x-axis label
fHistoFrame->GetXaxis()->SetTitle("time (#mus)");
// set y-axis label
fHistoFrame->GetYaxis()->SetTitle("data-theory");
// plot all remaining diff data
// plot all diff data
for (UInt_t i=0; i<fData.size(); i++) {
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
if ((fRRFText != 0) && (fRRFLatexText != 0)) {
fRRFLatexText->DrawLatex(0.1, 0.92, fRRFText->Data());