some necessary cleanup

This commit is contained in:
nemu 2009-05-26 05:51:48 +00:00
parent 2760785bce
commit 5cadc57e13
3 changed files with 16 additions and 15 deletions

View File

@ -95,6 +95,8 @@ for (unsigned int i=0; i<10; i++) {
fEndTime = keep; fEndTime = keep;
} }
//cout << endl << "start time = " << fStartTime << endl;
// calculate start and end bin // calculate start and end bin
unsigned int start = (unsigned int)(fStartTime/fTimeResolution); unsigned int start = (unsigned int)(fStartTime/fTimeResolution);
unsigned int end = (unsigned int)(fEndTime/fTimeResolution); unsigned int end = (unsigned int)(fEndTime/fTimeResolution);
@ -202,7 +204,6 @@ void PFourier::Transform(unsigned int apodizationTag)
fOut[i][0] = re; fOut[i][0] = re;
fOut[i][1] = im; fOut[i][1] = im;
} }
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -378,7 +379,7 @@ void PFourier::PrepareFFTwInputData(unsigned int apodizationTag)
// 1st find t==0. fData start at times t<0!! // 1st find t==0. fData start at times t<0!!
int t0bin = -1; int t0bin = -1;
//cout << ">> PFourier::PrepareFFTwInputData: fData=" << fData << ", fData->GetNbinsX() = " << fData->GetNbinsX(); //cout << ">> PFourier::PrepareFFTwInputData: fData=" << fData << ", fData->GetNbinsX() = " << fData->GetNbinsX();
for (int i=0; i<fData->GetNbinsX(); i++) { for (int i=1; i<fData->GetNbinsX(); i++) {
//if (i<20) cout << endl << ">> PFourier::PrepareFFTwInputData: i=" << i << ", fData->GetBinCenter(i)=" << fData->GetBinCenter(i); //if (i<20) cout << endl << ">> PFourier::PrepareFFTwInputData: i=" << i << ", fData->GetBinCenter(i)=" << fData->GetBinCenter(i);
if (fData->GetBinCenter(i) >= 0.0) { if (fData->GetBinCenter(i) >= 0.0) {
t0bin = i; t0bin = i;

View File

@ -99,7 +99,7 @@ PMusrCanvas::PMusrCanvas(const int number, const char* title,
CreateStyle(); CreateStyle();
InitMusrCanvas(title, wtopx, wtopy, ww, wh); InitMusrCanvas(title, wtopx, wtopy, ww, wh);
fCurrentFourierPhase = fFourier.fPhaseIncrement; fCurrentFourierPhase = 0.0;
fCurrentFourierPhaseText = 0; fCurrentFourierPhaseText = 0;
} }
@ -124,7 +124,7 @@ PMusrCanvas::PMusrCanvas(const int number, const char* title,
CreateStyle(); CreateStyle();
InitMusrCanvas(title, wtopx, wtopy, ww, wh); InitMusrCanvas(title, wtopx, wtopy, ww, wh);
fCurrentFourierPhase = fFourier.fPhaseIncrement; fCurrentFourierPhase = 0.0;
fCurrentFourierPhaseText = 0; fCurrentFourierPhaseText = 0;
} }
@ -1379,10 +1379,10 @@ void PMusrCanvas::HandleDataSet(unsigned int plotNo, unsigned int runNo, PRunDat
name += "_"; name += "_";
name += fPlotNumber; name += fPlotNumber;
start = data->fDataTimeStart - data->fDataTimeStep/2.0; 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 // 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 // fill histogram
for (unsigned int i=0; i<data->fValue.size(); i++) { for (unsigned int i=0; i<data->fValue.size(); i++) {
@ -1417,12 +1417,12 @@ void PMusrCanvas::HandleDataSet(unsigned int plotNo, unsigned int runNo, PRunDat
name += "_"; name += "_";
name += fPlotNumber; name += fPlotNumber;
start = data->fTheoryTimeStart - data->fTheoryTimeStep/2.0; 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; //cout << endl << ">> start = " << start << ", end = " << end << endl;
// invoke histo // 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 // fill histogram
for (unsigned int i=0; i<data->fTheory.size(); i++) { for (unsigned int i=0; i<data->fTheory.size(); i++) {
@ -1728,7 +1728,7 @@ cout << endl;
} }
// apply global phase if present // apply global phase if present
//cout << endl << ">> fFourier.fPhase = " << fFourier.fPhase; //cout << endl << ">> fFourier.fPhase = " << fFourier.fPhase << endl;
if (fFourier.fPhase != 0.0) { if (fFourier.fPhase != 0.0) {
//cout << endl << ">> apply global phase fFourier.fPhase = " << fFourier.fPhase; //cout << endl << ">> apply global phase fFourier.fPhase = " << fFourier.fPhase;
double re, im; double re, im;
@ -1811,7 +1811,7 @@ void PMusrCanvas::HandleFourierDifference()
if (fPlotType == MSR_PLOT_NON_MUSR) if (fPlotType == MSR_PLOT_NON_MUSR)
return; return;
cout << endl << ">> in HandleFourierDifference ..." << endl; //cout << endl << ">> in HandleFourierDifference ..." << endl;
// check if fourier needs to be calculated // check if fourier needs to be calculated
if (fData[0].diffFourierRe == 0) { if (fData[0].diffFourierRe == 0) {
@ -1835,7 +1835,7 @@ cout << endl << ">> in HandleFourierDifference ..." << endl;
fourierData.Transform(fFourier.fApodization); fourierData.Transform(fFourier.fApodization);
double scale; double scale;
scale = sqrt(fData[0].diff->GetBinWidth(1)/(endTime-startTime)); 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 // get real part of the data
fData[i].diffFourierRe = fourierData.GetRealFourier(scale); fData[i].diffFourierRe = fourierData.GetRealFourier(scale);
//cout << endl << ">> i: " << i << ", fData[i].diffFourierRe = " << fData[i].diffFourierRe; //cout << endl << ">> i: " << i << ", fData[i].diffFourierRe = " << fData[i].diffFourierRe;
@ -2693,7 +2693,7 @@ void PMusrCanvas::PlotFourier()
*/ */
void PMusrCanvas::PlotFourierDifference() void PMusrCanvas::PlotFourierDifference()
{ {
cout << endl << ">> in PlotFourierDifference() ..." << endl; //cout << endl << ">> in PlotFourierDifference() ..." << endl;
fDataTheoryPad->cd(); fDataTheoryPad->cd();

View File

@ -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 // 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; 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 // 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 // check if start, end, and t0 make any sense
// 1st check if start and end are in proper order // 1st check if start and end are in proper order
if (end < start) { // need to swap them 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 // 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; 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 // 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-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 // check if start, end, and t0 make any sense
// 1st check if start and end are in proper order // 1st check if start and end are in proper order