some changes concerning proper scaling
This commit is contained in:
parent
a2844ad03d
commit
6e7b2fa1b2
@ -471,7 +471,8 @@ bool PRunAsymmetry::PrepareData()
|
|||||||
// SubtractFixBkg
|
// SubtractFixBkg
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>Subtracts a fixed background from the raw data. The error propagation
|
* <p>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 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$.
|
* is Poisson like, i.e. \f$\Delta\mathrm{bkg} = \sqrt{\mathrm{bkg}}\f$.
|
||||||
*
|
*
|
||||||
@ -484,10 +485,10 @@ bool PRunAsymmetry::PrepareData()
|
|||||||
bool PRunAsymmetry::SubtractFixBkg()
|
bool PRunAsymmetry::SubtractFixBkg()
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i<fForward.size(); i++) {
|
for (unsigned int i=0; i<fForward.size(); i++) {
|
||||||
fForwardErr.push_back(TMath::Sqrt(fForward[i]+fRunInfo->fBkgFix[0]));
|
fForwardErr.push_back(TMath::Sqrt(fForward[i]+fRunInfo->fBkgFix[0] * fTimeResolution * 1.0e3));
|
||||||
fForward[i] -= fRunInfo->fBkgFix[0];
|
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]));
|
fBackwardErr.push_back(TMath::Sqrt(fBackward[i]+fRunInfo->fBkgFix[1] * fTimeResolution * 1.0e3));
|
||||||
fBackward[i] -= fRunInfo->fBkgFix[1];
|
fBackward[i] -= fRunInfo->fBkgFix[1] * fTimeResolution * 1.0e3; // bkg per ns -> bkg per bin; 1.0e3: us -> ns
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -575,12 +576,14 @@ bool PRunAsymmetry::SubtractEstimatedBkg()
|
|||||||
bkg[0] += fForward[i];
|
bkg[0] += fForward[i];
|
||||||
errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1);
|
errBkg[0] = TMath::Sqrt(bkg[0])/(end[0] - start[0] + 1);
|
||||||
bkg[0] /= static_cast<double>(end[0] - start[0] + 1);
|
bkg[0] /= static_cast<double>(end[0] - start[0] + 1);
|
||||||
|
//cout << endl << ">> bkg[0] = " << bkg[0];
|
||||||
|
|
||||||
// backward
|
// backward
|
||||||
for (unsigned int i=start[1]; i<end[1]; i++)
|
for (unsigned int i=start[1]; i<end[1]; i++)
|
||||||
bkg[1] += fBackward[i];
|
bkg[1] += fBackward[i];
|
||||||
errBkg[1] = TMath::Sqrt(bkg[1])/(end[0] - start[0] + 1);
|
errBkg[1] = TMath::Sqrt(bkg[1])/(end[0] - start[0] + 1);
|
||||||
bkg[1] /= static_cast<double>(end[1] - start[1] + 1);
|
bkg[1] /= static_cast<double>(end[1] - start[1] + 1);
|
||||||
|
//cout << endl << ">> bkg[1] = " << bkg[1] << endl;
|
||||||
|
|
||||||
// correct error for forward, backward
|
// correct error for forward, backward
|
||||||
for (unsigned int i=0; i<fForward.size(); i++) {
|
for (unsigned int i=0; i<fForward.size(); i++) {
|
||||||
|
@ -752,7 +752,6 @@ bool PRunSingleHisto::PrepareViewData(PRawRunData* runData, const unsigned int h
|
|||||||
// evaluate function
|
// evaluate function
|
||||||
N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par);
|
N0 = fMsrInfo->EvalFunc(funNo,fRunInfo->fMap,par);
|
||||||
}
|
}
|
||||||
//cout << endl << ">> N0 = " << N0;
|
|
||||||
|
|
||||||
// get tau
|
// get tau
|
||||||
double tau;
|
double tau;
|
||||||
@ -775,7 +774,6 @@ bool PRunSingleHisto::PrepareViewData(PRawRunData* runData, const unsigned int h
|
|||||||
} else { // bkg fitted
|
} else { // bkg fitted
|
||||||
bkg = par[fRunInfo->fBkgFitParamNo-1];
|
bkg = par[fRunInfo->fBkgFitParamNo-1];
|
||||||
}
|
}
|
||||||
//cout << endl << ">> bkg = " << bkg;
|
|
||||||
|
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
double expval;
|
double expval;
|
||||||
@ -796,9 +794,9 @@ cout << endl << "--------------------------------" << endl;
|
|||||||
if (((i-start) % fRunInfo->fPacking == 0) && (i != start)) { // fill data
|
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)
|
// in order that after rebinning the fit does not need to be redone (important for plots)
|
||||||
// the value is normalize to per 1 nsec
|
// 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;
|
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;
|
expval = TMath::Exp(+time/tau)/N0;
|
||||||
fData.fValue.push_back(-1.0+expval*(value-bkg));
|
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;
|
//cout << endl << ">> i=" << i << ",t0=" << t0 << ",time=" << time << ",expval=" << expval << ",value=" << value << ",bkg=" << bkg << ",expval*(value-bkg)-1=" << expval*(value-bkg)-1.0;
|
||||||
|
@ -87,7 +87,7 @@ class PRunBase
|
|||||||
PIntVector fParamNo; ///< vector of parameter numbers for the specifc run
|
PIntVector fParamNo; ///< vector of parameter numbers for the specifc run
|
||||||
|
|
||||||
PRunData fData; ///< data to be fitted, viewed, i.e. binned data
|
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
|
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!!
|
virtual bool PrepareData() = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user