From 5cadc57e137105be7a672f7117902038b1d556d9 Mon Sep 17 00:00:00 2001 From: nemu Date: Tue, 26 May 2009 05:51:48 +0000 Subject: [PATCH] some necessary cleanup --- src/classes/PFourier.cpp | 5 +++-- src/classes/PMusrCanvas.cpp | 20 ++++++++++---------- src/classes/PRunSingleHisto.cpp | 6 +++--- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/classes/PFourier.cpp b/src/classes/PFourier.cpp index c0b8cfbc..63e5e3dc 100644 --- a/src/classes/PFourier.cpp +++ b/src/classes/PFourier.cpp @@ -95,6 +95,8 @@ for (unsigned int i=0; i<10; i++) { fEndTime = keep; } +//cout << endl << "start time = " << fStartTime << endl; + // calculate start and end bin unsigned int start = (unsigned int)(fStartTime/fTimeResolution); unsigned int end = (unsigned int)(fEndTime/fTimeResolution); @@ -202,7 +204,6 @@ void PFourier::Transform(unsigned int apodizationTag) fOut[i][0] = re; fOut[i][1] = im; } - } //-------------------------------------------------------------------------- @@ -378,7 +379,7 @@ void PFourier::PrepareFFTwInputData(unsigned int apodizationTag) // 1st find t==0. fData start at times t<0!! int t0bin = -1; //cout << ">> PFourier::PrepareFFTwInputData: fData=" << fData << ", fData->GetNbinsX() = " << fData->GetNbinsX(); - for (int i=0; iGetNbinsX(); i++) { + for (int i=1; iGetNbinsX(); i++) { //if (i<20) cout << endl << ">> PFourier::PrepareFFTwInputData: i=" << i << ", fData->GetBinCenter(i)=" << fData->GetBinCenter(i); if (fData->GetBinCenter(i) >= 0.0) { t0bin = i; diff --git a/src/classes/PMusrCanvas.cpp b/src/classes/PMusrCanvas.cpp index 4c8961aa..c3388685 100644 --- a/src/classes/PMusrCanvas.cpp +++ b/src/classes/PMusrCanvas.cpp @@ -99,7 +99,7 @@ PMusrCanvas::PMusrCanvas(const int number, const char* title, CreateStyle(); InitMusrCanvas(title, wtopx, wtopy, ww, wh); - fCurrentFourierPhase = fFourier.fPhaseIncrement; + fCurrentFourierPhase = 0.0; fCurrentFourierPhaseText = 0; } @@ -124,7 +124,7 @@ PMusrCanvas::PMusrCanvas(const int number, const char* title, CreateStyle(); InitMusrCanvas(title, wtopx, wtopy, ww, wh); - fCurrentFourierPhase = fFourier.fPhaseIncrement; + fCurrentFourierPhase = 0.0; fCurrentFourierPhaseText = 0; } @@ -1379,10 +1379,10 @@ void PMusrCanvas::HandleDataSet(unsigned int plotNo, unsigned int runNo, PRunDat name += "_"; name += fPlotNumber; start = data->fDataTimeStart - data->fDataTimeStep/2.0; - end = data->fDataTimeStart + data->fValue.size()*data->fDataTimeStep + data->fDataTimeStep/2.0; + end = data->fDataTimeStart + data->fValue.size()*data->fDataTimeStep; // invoke histo - dataHisto = new TH1F(name, name, data->fValue.size()+1, start, end); + dataHisto = new TH1F(name, name, data->fValue.size(), start, end); // fill histogram for (unsigned int i=0; ifValue.size(); i++) { @@ -1417,12 +1417,12 @@ void PMusrCanvas::HandleDataSet(unsigned int plotNo, unsigned int runNo, PRunDat name += "_"; name += fPlotNumber; start = data->fTheoryTimeStart - data->fTheoryTimeStep/2.0; - end = data->fTheoryTimeStart + data->fTheory.size()*data->fTheoryTimeStep + data->fTheoryTimeStep/2.0; + end = data->fTheoryTimeStart + data->fTheory.size()*data->fTheoryTimeStep; //cout << endl << ">> start = " << start << ", end = " << end << endl; // invoke histo - theoHisto = new TH1F(name, name, data->fTheory.size()+1, start, end); + theoHisto = new TH1F(name, name, data->fTheory.size(), start, end); // fill histogram for (unsigned int i=0; ifTheory.size(); i++) { @@ -1728,7 +1728,7 @@ cout << endl; } // apply global phase if present -//cout << endl << ">> fFourier.fPhase = " << fFourier.fPhase; +//cout << endl << ">> fFourier.fPhase = " << fFourier.fPhase << endl; if (fFourier.fPhase != 0.0) { //cout << endl << ">> apply global phase fFourier.fPhase = " << fFourier.fPhase; double re, im; @@ -1811,7 +1811,7 @@ void PMusrCanvas::HandleFourierDifference() if (fPlotType == MSR_PLOT_NON_MUSR) return; -cout << endl << ">> in HandleFourierDifference ..." << endl; +//cout << endl << ">> in HandleFourierDifference ..." << endl; // check if fourier needs to be calculated if (fData[0].diffFourierRe == 0) { @@ -1835,7 +1835,7 @@ cout << endl << ">> in HandleFourierDifference ..." << endl; fourierData.Transform(fFourier.fApodization); double scale; scale = sqrt(fData[0].diff->GetBinWidth(1)/(endTime-startTime)); -cout << endl << ">> data scale = " << scale; +//cout << endl << ">> data scale = " << scale; // get real part of the data fData[i].diffFourierRe = fourierData.GetRealFourier(scale); //cout << endl << ">> i: " << i << ", fData[i].diffFourierRe = " << fData[i].diffFourierRe; @@ -2693,7 +2693,7 @@ void PMusrCanvas::PlotFourier() */ void PMusrCanvas::PlotFourierDifference() { -cout << endl << ">> in PlotFourierDifference() ..." << endl; +//cout << endl << ">> in PlotFourierDifference() ..." << endl; fDataTheoryPad->cd(); diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index b3a7f6f7..95c97050 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -557,7 +557,7 @@ bool PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const unsigned in // start = the first bin which is a multiple of packing backward from first good data bin int start = fRunInfo->fDataRange[0] - (fRunInfo->fDataRange[0]/fRunInfo->fPacking)*fRunInfo->fPacking; // end = last bin starting from start which is a multipl of packing and still within the data - int end = start + ((runData->fDataBin[histoNo].size()-start-1)/fRunInfo->fPacking)*fRunInfo->fPacking; + int end = start + ((runData->fDataBin[histoNo].size()-start)/fRunInfo->fPacking)*fRunInfo->fPacking; // check if start, end, and t0 make any sense // 1st check if start and end are in proper order if (end < start) { // need to swap them @@ -712,8 +712,8 @@ bool PRunSingleHisto::PrepareViewData(PRawRunData* runData, const unsigned int h // start = the first bin which is a multiple of packing backward from first good data bin int start = fRunInfo->fDataRange[0] - (fRunInfo->fDataRange[0]/fRunInfo->fPacking)*fRunInfo->fPacking; - // end = last bin starting from start which is a multipl of packing and still within the data - int end = start + ((runData->fDataBin[histoNo].size()-start-1)/fRunInfo->fPacking)*fRunInfo->fPacking; + // end = last bin starting from start which is a multiple of packing and still within the data + int end = start + ((runData->fDataBin[histoNo].size()-start)/fRunInfo->fPacking)*fRunInfo->fPacking; // check if start, end, and t0 make any sense // 1st check if start and end are in proper order