diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index 27b2a4b4..36e33c14 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -471,7 +471,8 @@ bool PRunAsymmetry::PrepareData() // SubtractFixBkg //-------------------------------------------------------------------------- /** - *

Subtracts a fixed background from the raw data. The error propagation + *

Subtracts a fixed background from the raw data. The background is given + * in units of (1/ns). The error propagation * is done the following way: it is assumed that the error of the background * is Poisson like, i.e. \f$\Delta\mathrm{bkg} = \sqrt{\mathrm{bkg}}\f$. * @@ -482,14 +483,14 @@ bool PRunAsymmetry::PrepareData() * and \f$ \mathrm{bkg} \f$ the fix given background. */ bool PRunAsymmetry::SubtractFixBkg() -{ +{ for (unsigned int i=0; ifBkgFix[0])); - fForward[i] -= fRunInfo->fBkgFix[0]; - fBackwardErr.push_back(TMath::Sqrt(fBackward[i]+fRunInfo->fBkgFix[1])); - fBackward[i] -= fRunInfo->fBkgFix[1]; + fForwardErr.push_back(TMath::Sqrt(fForward[i]+fRunInfo->fBkgFix[0] * fTimeResolution * 1.0e3)); + fForward[i] -= fRunInfo->fBkgFix[0] * fTimeResolution * 1.0e3; // bkg per ns -> bkg per bin; 1.0e3: us -> ns + fBackwardErr.push_back(TMath::Sqrt(fBackward[i]+fRunInfo->fBkgFix[1] * fTimeResolution * 1.0e3)); + fBackward[i] -= fRunInfo->fBkgFix[1] * fTimeResolution * 1.0e3; // bkg per ns -> bkg per bin; 1.0e3: us -> ns } - + return true; } @@ -575,12 +576,14 @@ bool PRunAsymmetry::SubtractEstimatedBkg() bkg[0] += fForward[i]; errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1); bkg[0] /= static_cast(end[0] - start[0] + 1); +//cout << endl << ">> bkg[0] = " << bkg[0]; // backward for (unsigned int i=start[1]; i(end[1] - start[1] + 1); +//cout << endl << ">> bkg[1] = " << bkg[1] << endl; // correct error for forward, backward for (unsigned int i=0; iEvalFunc(funNo,fRunInfo->fMap,par); } -//cout << endl << ">> N0 = " << N0; // get tau double tau; @@ -775,7 +774,6 @@ bool PRunSingleHisto::PrepareViewData(PRawRunData* runData, const unsigned int h } else { // bkg fitted bkg = par[fRunInfo->fBkgFitParamNo-1]; } -//cout << endl << ">> bkg = " << bkg; double value = 0.0; double expval; @@ -796,9 +794,9 @@ cout << endl << "--------------------------------" << endl; if (((i-start) % fRunInfo->fPacking == 0) && (i != start)) { // fill data // in order that after rebinning the fit does not need to be redone (important for plots) // the value is normalize to per 1 nsec - normalizer = fRunInfo->fPacking * (fTimeResolution * 1e3); // fTimeResolution us->ns + normalizer = fRunInfo->fPacking * (fTimeResolution * 1.0e3); // fTimeResolution us->ns value /= normalizer; - time = ((double)(i-fRunInfo->fPacking)-t0)*fTimeResolution; + time = (((double)i-(double)(fRunInfo->fPacking-1)/2.0)-t0)*fTimeResolution; expval = TMath::Exp(+time/tau)/N0; fData.fValue.push_back(-1.0+expval*(value-bkg)); //cout << endl << ">> i=" << i << ",t0=" << t0 << ",time=" << time << ",expval=" << expval << ",value=" << value << ",bkg=" << bkg << ",expval*(value-bkg)-1=" << expval*(value-bkg)-1.0; diff --git a/src/include/PRunBase.h b/src/include/PRunBase.h index d3dcd5f5..ae8963d8 100644 --- a/src/include/PRunBase.h +++ b/src/include/PRunBase.h @@ -87,7 +87,7 @@ class PRunBase PIntVector fParamNo; ///< vector of parameter numbers for the specifc run PRunData fData; ///< data to be fitted, viewed, i.e. binned data - double fTimeResolution; ///< time resolution + double fTimeResolution; ///< time resolution in (us) PIntVector fT0s; ///< all t0's of a run! The derived classes will handle it virtual bool PrepareData() = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!