some changes related to the bin data plotting
This commit is contained in:
parent
b47e5a4672
commit
c463cb2530
11
src/ToDo.txt
11
src/ToDo.txt
@ -41,11 +41,20 @@ short term:
|
|||||||
* implement table based theory functions (LF stuff)
|
* implement table based theory functions (LF stuff)
|
||||||
static GKT LF **DONE** 08-03-12
|
static GKT LF **DONE** 08-03-12
|
||||||
|
|
||||||
|
* setup startup handler with infos like: data path, symbol list, color list, ...
|
||||||
|
**DONE** 08-04-04
|
||||||
|
|
||||||
|
* at the moment that startup handler is looked for in the directory where musrfit/musrview
|
||||||
|
is executed, this is stupid. Define a place where to look for it.
|
||||||
|
|
||||||
|
* check concept to get bin data for musrview on single histo (fBinData in PRunBase).
|
||||||
|
If it is ok, implement it for the others.
|
||||||
|
|
||||||
* do I need to cleanup AddText() objects from TPaveText etc myself? **CHECK**
|
* do I need to cleanup AddText() objects from TPaveText etc myself? **CHECK**
|
||||||
|
|
||||||
* something is strange with the coordinate system in TPaveText! **CHECK**
|
* something is strange with the coordinate system in TPaveText! **CHECK**
|
||||||
|
|
||||||
* setup startup handler with infos like: data path, symbol list, color list, ...
|
* check problem with the mathmore implementation of 1F1(m;n;z)
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
intermediate term:
|
intermediate term:
|
||||||
|
@ -112,7 +112,7 @@ PRunAsymmetry::PRunAsymmetry(PMsrHandler *msrInfo, PRunDataHandler *rawData, uns
|
|||||||
|
|
||||||
//cout << endl << ">> PRunAsymmetry::PRunAsymmetry(): fAlphaBetaTag = " << fAlphaBetaTag;
|
//cout << endl << ">> PRunAsymmetry::PRunAsymmetry(): fAlphaBetaTag = " << fAlphaBetaTag;
|
||||||
|
|
||||||
// calculate fData
|
// calculate fFitData
|
||||||
if (!PrepareData())
|
if (!PrepareData())
|
||||||
fValid = false;
|
fValid = false;
|
||||||
}
|
}
|
||||||
@ -153,34 +153,34 @@ double PRunAsymmetry::CalcChiSquare(const std::vector<double>& par)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// calculate chisq
|
// calculate chisq
|
||||||
for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
for (unsigned int i=0; i<fFitData.fValue.size(); i++) {
|
||||||
if ((fData.fTime[i]>=fFitStartTime) && (fData.fTime[i]<=fFitStopTime)) {
|
if ((fFitData.fTime[i]>=fFitStartTime) && (fFitData.fTime[i]<=fFitStopTime)) {
|
||||||
switch (fAlphaBetaTag) {
|
switch (fAlphaBetaTag) {
|
||||||
case 1: // alpha == 1, beta == 1
|
case 1: // alpha == 1, beta == 1
|
||||||
asymFcnValue = fTheory->Func(fData.fTime[i], par, fFuncValues);
|
asymFcnValue = fTheory->Func(fFitData.fTime[i], par, fFuncValues);
|
||||||
break;
|
break;
|
||||||
case 2: // alpha != 1, beta == 1
|
case 2: // alpha != 1, beta == 1
|
||||||
a = par[fRunInfo->fAlphaParamNo-1];
|
a = par[fRunInfo->fAlphaParamNo-1];
|
||||||
f = fTheory->Func(fData.fTime[i], par, fFuncValues);
|
f = fTheory->Func(fFitData.fTime[i], par, fFuncValues);
|
||||||
asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0));
|
asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0));
|
||||||
break;
|
break;
|
||||||
case 3: // alpha == 1, beta != 1
|
case 3: // alpha == 1, beta != 1
|
||||||
b = par[fRunInfo->fBetaParamNo-1];
|
b = par[fRunInfo->fBetaParamNo-1];
|
||||||
f = fTheory->Func(fData.fTime[i], par, fFuncValues);
|
f = fTheory->Func(fFitData.fTime[i], par, fFuncValues);
|
||||||
asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0));
|
asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0));
|
||||||
break;
|
break;
|
||||||
case 4: // alpha != 1, beta != 1
|
case 4: // alpha != 1, beta != 1
|
||||||
a = par[fRunInfo->fAlphaParamNo-1];
|
a = par[fRunInfo->fAlphaParamNo-1];
|
||||||
b = par[fRunInfo->fBetaParamNo-1];
|
b = par[fRunInfo->fBetaParamNo-1];
|
||||||
f = fTheory->Func(fData.fTime[i], par, fFuncValues);
|
f = fTheory->Func(fFitData.fTime[i], par, fFuncValues);
|
||||||
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
|
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//if (i==0) cout << endl << "A(0) = " << asymFcnValue;
|
//if (i==0) cout << endl << "A(0) = " << asymFcnValue;
|
||||||
diff = fData.fValue[i] - asymFcnValue;
|
diff = fFitData.fValue[i] - asymFcnValue;
|
||||||
chisq += diff*diff / (fData.fError[i]*fData.fError[i]);
|
chisq += diff*diff / (fFitData.fError[i]*fFitData.fError[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,32 +227,32 @@ void PRunAsymmetry::CalcTheory()
|
|||||||
// calculate asymmetry
|
// calculate asymmetry
|
||||||
double asymFcnValue = 0.0;
|
double asymFcnValue = 0.0;
|
||||||
double a, b, f;
|
double a, b, f;
|
||||||
for (unsigned int i=0; i<fData.fTime.size(); i++) {
|
for (unsigned int i=0; i<fFitData.fTime.size(); i++) {
|
||||||
switch (fAlphaBetaTag) {
|
switch (fAlphaBetaTag) {
|
||||||
case 1: // alpha == 1, beta == 1
|
case 1: // alpha == 1, beta == 1
|
||||||
asymFcnValue = fTheory->Func(fData.fTime[i], par, fFuncValues);
|
asymFcnValue = fTheory->Func(fFitData.fTime[i], par, fFuncValues);
|
||||||
break;
|
break;
|
||||||
case 2: // alpha != 1, beta == 1
|
case 2: // alpha != 1, beta == 1
|
||||||
a = par[fRunInfo->fAlphaParamNo-1];
|
a = par[fRunInfo->fAlphaParamNo-1];
|
||||||
f = fTheory->Func(fData.fTime[i], par, fFuncValues);
|
f = fTheory->Func(fFitData.fTime[i], par, fFuncValues);
|
||||||
asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0));
|
asymFcnValue = (f*(a+1.0)-(a-1.0))/((a+1.0)-f*(a-1.0));
|
||||||
break;
|
break;
|
||||||
case 3: // alpha == 1, beta != 1
|
case 3: // alpha == 1, beta != 1
|
||||||
b = par[fRunInfo->fBetaParamNo-1];
|
b = par[fRunInfo->fBetaParamNo-1];
|
||||||
f = fTheory->Func(fData.fTime[i], par, fFuncValues);
|
f = fTheory->Func(fFitData.fTime[i], par, fFuncValues);
|
||||||
asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0));
|
asymFcnValue = f*(b+1.0)/(2.0-f*(b-1.0));
|
||||||
break;
|
break;
|
||||||
case 4: // alpha != 1, beta != 1
|
case 4: // alpha != 1, beta != 1
|
||||||
a = par[fRunInfo->fAlphaParamNo-1];
|
a = par[fRunInfo->fAlphaParamNo-1];
|
||||||
b = par[fRunInfo->fBetaParamNo-1];
|
b = par[fRunInfo->fBetaParamNo-1];
|
||||||
f = fTheory->Func(fData.fTime[i], par, fFuncValues);
|
f = fTheory->Func(fFitData.fTime[i], par, fFuncValues);
|
||||||
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
|
asymFcnValue = (f*(a*b+1.0)-(a-1.0))/((a+1.0)-f*(a*b-1.0));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
asymFcnValue = 0.0;
|
asymFcnValue = 0.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fData.fTheory.push_back(asymFcnValue);
|
fFitData.fTheory.push_back(asymFcnValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
@ -272,7 +272,7 @@ void PRunAsymmetry::CalcTheory()
|
|||||||
*/
|
*/
|
||||||
bool PRunAsymmetry::PrepareData()
|
bool PRunAsymmetry::PrepareData()
|
||||||
{
|
{
|
||||||
//cout << endl << "in PRunAsymmetry::PrepareData(): will feed fData";
|
//cout << endl << "in PRunAsymmetry::PrepareData(): will feed fFitData";
|
||||||
|
|
||||||
// get forward/backward histo from PRunDataHandler object ------------------------
|
// get forward/backward histo from PRunDataHandler object ------------------------
|
||||||
// get the correct run
|
// get the correct run
|
||||||
@ -459,7 +459,7 @@ bool PRunAsymmetry::PrepareData()
|
|||||||
cout << endl << " forward/backward time are not equal! This cannot be handled";
|
cout << endl << " forward/backward time are not equal! This cannot be handled";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
fData.fTime.push_back(forwardPacked.fTime[i]);
|
fFitData.fTime.push_back(forwardPacked.fTime[i]);
|
||||||
// to make the formulae more readable
|
// to make the formulae more readable
|
||||||
f = forwardPacked.fValue[i];
|
f = forwardPacked.fValue[i];
|
||||||
b = backwardPacked.fValue[i];
|
b = backwardPacked.fValue[i];
|
||||||
@ -470,19 +470,19 @@ bool PRunAsymmetry::PrepareData()
|
|||||||
asym = (f-b) / (f+b);
|
asym = (f-b) / (f+b);
|
||||||
else
|
else
|
||||||
asym = 0.0;
|
asym = 0.0;
|
||||||
fData.fValue.push_back(asym);
|
fFitData.fValue.push_back(asym);
|
||||||
// calculate the error
|
// calculate the error
|
||||||
if (f+b != 0.0)
|
if (f+b != 0.0)
|
||||||
error = 2.0/((f+b)*(f+b))*TMath::Sqrt(b*b*ef*ef+eb*eb*f*f);
|
error = 2.0/((f+b)*(f+b))*TMath::Sqrt(b*b*ef*ef+eb*eb*f*f);
|
||||||
else
|
else
|
||||||
error = 1.0;
|
error = 1.0;
|
||||||
fData.fError.push_back(error);
|
fFitData.fError.push_back(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
FILE *fp = fopen("asym.dat", "w");
|
FILE *fp = fopen("asym.dat", "w");
|
||||||
for (unsigned int i=0; i<fData.fTime.size(); i++) {
|
for (unsigned int i=0; i<fFitData.fTime.size(); i++) {
|
||||||
fprintf(fp, "%lf, %lf, %lf\n", fData.fTime[i], fData.fValue[i], fData.fError[i]);
|
fprintf(fp, "%lf, %lf, %lf\n", fFitData.fTime[i], fFitData.fValue[i], fFitData.fError[i]);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return false;
|
return false;
|
||||||
@ -490,8 +490,8 @@ return false;
|
|||||||
|
|
||||||
// count the number of bins to be fitted
|
// count the number of bins to be fitted
|
||||||
fNoOfFitBins=0;
|
fNoOfFitBins=0;
|
||||||
for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
for (unsigned int i=0; i<fFitData.fValue.size(); i++) {
|
||||||
if ((fData.fTime[i] >= fFitStartTime) && (fData.fTime[i] <= fFitStopTime))
|
if ((fFitData.fTime[i] >= fFitStartTime) && (fFitData.fTime[i] <= fFitStopTime))
|
||||||
fNoOfFitBins++;
|
fNoOfFitBins++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,10 +122,15 @@ PRunBase::~PRunBase()
|
|||||||
{
|
{
|
||||||
fParamNo.clear();
|
fParamNo.clear();
|
||||||
|
|
||||||
fData.fTime.clear();
|
fFitData.fTime.clear();
|
||||||
fData.fValue.clear();
|
fFitData.fValue.clear();
|
||||||
fData.fError.clear();
|
fFitData.fError.clear();
|
||||||
fData.fTheory.clear();
|
fFitData.fTheory.clear();
|
||||||
|
|
||||||
|
fBinData.fTime.clear();
|
||||||
|
fBinData.fValue.clear();
|
||||||
|
fBinData.fError.clear();
|
||||||
|
fBinData.fTheory.clear();
|
||||||
|
|
||||||
fT0s.clear();
|
fT0s.clear();
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ PRunNonMusr::PRunNonMusr(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigne
|
|||||||
{
|
{
|
||||||
bool success;
|
bool success;
|
||||||
|
|
||||||
// calculate fData
|
// calculate fFitData
|
||||||
if (success) {
|
if (success) {
|
||||||
success = PrepareData();
|
success = PrepareData();
|
||||||
}
|
}
|
||||||
@ -130,12 +130,12 @@ bool PRunNonMusr::PrepareData()
|
|||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
cout << endl << "in PRunNonMusr::PrepareData(): will feed fData";
|
cout << endl << "in PRunNonMusr::PrepareData(): will feed fFitData";
|
||||||
|
|
||||||
// count the number of bins to be fitted
|
// count the number of bins to be fitted
|
||||||
fNoOfFitBins=0;
|
fNoOfFitBins=0;
|
||||||
for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
for (unsigned int i=0; i<fFitData.fValue.size(); i++) {
|
||||||
if ((fData.fTime[i] >= fFitStartTime) && (fData.fTime[i] <= fFitStopTime))
|
if ((fFitData.fTime[i] >= fFitStartTime) && (fFitData.fTime[i] <= fFitStopTime))
|
||||||
fNoOfFitBins++;
|
fNoOfFitBins++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ PRunRRF::PRunRRF(PMsrHandler *msrInfo, PRunDataHandler *rawData, unsigned int ru
|
|||||||
{
|
{
|
||||||
bool success;
|
bool success;
|
||||||
|
|
||||||
// calculate fData
|
// calculate fFitData
|
||||||
if (success) {
|
if (success) {
|
||||||
success = PrepareData();
|
success = PrepareData();
|
||||||
}
|
}
|
||||||
@ -130,12 +130,12 @@ bool PRunRRF::PrepareData()
|
|||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
cout << endl << "in PRunRRF::PrepareData(): will feed fData";
|
cout << endl << "in PRunRRF::PrepareData(): will feed fFitData";
|
||||||
|
|
||||||
// count the number of bins to be fitted
|
// count the number of bins to be fitted
|
||||||
fNoOfFitBins=0;
|
fNoOfFitBins=0;
|
||||||
for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
for (unsigned int i=0; i<fFitData.fValue.size(); i++) {
|
||||||
if ((fData.fTime[i] >= fFitStartTime) && (fData.fTime[i] <= fFitStopTime))
|
if ((fFitData.fTime[i] >= fFitStartTime) && (fFitData.fTime[i] <= fFitStopTime))
|
||||||
fNoOfFitBins++;
|
fNoOfFitBins++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,11 +127,11 @@ double PRunSingleHisto::CalcChiSquare(const std::vector<double>& par)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// calculate chi square
|
// calculate chi square
|
||||||
for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
for (unsigned int i=0; i<fFitData.fValue.size(); i++) {
|
||||||
if ((fData.fTime[i]>=fFitStartTime) && (fData.fTime[i]<=fFitStopTime)) {
|
if ((fFitData.fTime[i]>=fFitStartTime) && (fFitData.fTime[i]<=fFitStopTime)) {
|
||||||
diff = fData.fValue[i] -
|
diff = fFitData.fValue[i] -
|
||||||
(N0*TMath::Exp(-fData.fTime[i]/tau)*(1+fTheory->Func(fData.fTime[i], par, fFuncValues))+bkg);
|
(N0*TMath::Exp(-fFitData.fTime[i]/tau)*(1+fTheory->Func(fFitData.fTime[i], par, fFuncValues))+bkg);
|
||||||
chisq += diff*diff / (fData.fError[i]*fData.fError[i]);
|
chisq += diff*diff / (fFitData.fError[i]*fFitData.fError[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,15 +139,15 @@ double PRunSingleHisto::CalcChiSquare(const std::vector<double>& par)
|
|||||||
// static int counter = 0;
|
// static int counter = 0;
|
||||||
// TString fln=fRunInfo->fRunName+"_"+(Long_t)fRunInfo->fForwardHistoNo+"_data.dat";
|
// TString fln=fRunInfo->fRunName+"_"+(Long_t)fRunInfo->fForwardHistoNo+"_data.dat";
|
||||||
// ofstream f(fln.Data(),ios_base::out);
|
// ofstream f(fln.Data(),ios_base::out);
|
||||||
// for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
// for (unsigned int i=0; i<fFitData.fValue.size(); i++) {
|
||||||
// f << endl << fData.fTime[i] << " " << fData.fValue[i] << " " << fData.fError[i];
|
// f << endl << fFitData.fTime[i] << " " << fFitData.fValue[i] << " " << fFitData.fError[i];
|
||||||
// }
|
// }
|
||||||
// f.close();
|
// f.close();
|
||||||
//
|
//
|
||||||
// fln=fRunInfo->fRunName+"_"+(Long_t)fRunInfo->fForwardHistoNo+"_theo.dat";
|
// fln=fRunInfo->fRunName+"_"+(Long_t)fRunInfo->fForwardHistoNo+"_theo.dat";
|
||||||
// ofstream ft(fln.Data(),ios_base::out);
|
// ofstream ft(fln.Data(),ios_base::out);
|
||||||
// for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
// for (unsigned int i=0; i<fFitData.fValue.size(); i++) {
|
||||||
// ft << endl << fData.fTime[i] << " " << N0*TMath::Exp(-fData.fTime[i]/tau)*(1+fTheory->Func(fData.fTime[i], par))+bkg;
|
// ft << endl << fFitData.fTime[i] << " " << N0*TMath::Exp(-fFitData.fTime[i]/tau)*(1+fTheory->Func(fFitData.fTime[i], par))+bkg;
|
||||||
// }
|
// }
|
||||||
// ft.close();
|
// ft.close();
|
||||||
// counter++;
|
// counter++;
|
||||||
@ -200,13 +200,13 @@ double PRunSingleHisto::CalcMaxLikelihood(const std::vector<double>& par)
|
|||||||
// calculate maximum log likelihood
|
// calculate maximum log likelihood
|
||||||
double theo;
|
double theo;
|
||||||
double data;
|
double data;
|
||||||
for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
for (unsigned int i=0; i<fFitData.fValue.size(); i++) {
|
||||||
if ((fData.fTime[i]>=fFitStartTime) && (fData.fTime[i]<=fFitStopTime)) {
|
if ((fFitData.fTime[i]>=fFitStartTime) && (fFitData.fTime[i]<=fFitStopTime)) {
|
||||||
// calculate theory for the given parameter set
|
// calculate theory for the given parameter set
|
||||||
theo = N0*TMath::Exp(-fData.fTime[i]/tau)*(1+fTheory->Func(fData.fTime[i], par, fFuncValues))+bkg;
|
theo = N0*TMath::Exp(-fFitData.fTime[i]/tau)*(1+fTheory->Func(fFitData.fTime[i], par, fFuncValues))+bkg;
|
||||||
// check if data value is not too small
|
// check if data value is not too small
|
||||||
if (fData.fValue[i] > 1.0e-9)
|
if (fFitData.fValue[i] > 1.0e-9)
|
||||||
data = fData.fValue[i];
|
data = fFitData.fValue[i];
|
||||||
else
|
else
|
||||||
data = 1.0e-9;
|
data = 1.0e-9;
|
||||||
// add maximum log likelihood contribution of bin i
|
// add maximum log likelihood contribution of bin i
|
||||||
@ -251,8 +251,8 @@ void PRunSingleHisto::CalcTheory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// calculate theory
|
// calculate theory
|
||||||
for (unsigned int i=0; i<fData.fTime.size(); i++) {
|
for (unsigned int i=0; i<fFitData.fTime.size(); i++) {
|
||||||
fData.fTheory.push_back(N0*TMath::Exp(-fData.fTime[i]/tau)*(1+fTheory->Func(fData.fTime[i], par, fFuncValues))+bkg);
|
fFitData.fTheory.push_back(N0*TMath::Exp(-fFitData.fTime[i]/tau)*(1+fTheory->Func(fFitData.fTime[i], par, fFuncValues))+bkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
@ -268,7 +268,7 @@ void PRunSingleHisto::CalcTheory()
|
|||||||
*/
|
*/
|
||||||
bool PRunSingleHisto::PrepareData()
|
bool PRunSingleHisto::PrepareData()
|
||||||
{
|
{
|
||||||
// cout << endl << "in PRunSingleHisto::PrepareData(): will feed fData";
|
// cout << endl << "in PRunSingleHisto::PrepareData(): will feed fFitData";
|
||||||
|
|
||||||
// get the proper run
|
// get the proper run
|
||||||
PRawRunData* runData = fRawData->GetRunData(fRunInfo->fRunName);
|
PRawRunData* runData = fRawData->GetRunData(fRunInfo->fRunName);
|
||||||
@ -356,7 +356,8 @@ bool PRunSingleHisto::PrepareData()
|
|||||||
cout << endl << "PRunSingleHisto::PrepareData(): t0 data bin doesn't make any sense!";
|
cout << endl << "PRunSingleHisto::PrepareData(): t0 data bin doesn't make any sense!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// everything looks fine, hence fill data set
|
|
||||||
|
// everything looks fine, hence fill fit data set
|
||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
for (unsigned i=start; i<end; i++) {
|
for (unsigned i=start; i<end; i++) {
|
||||||
if (((i-start) % fRunInfo->fPacking == 0) && (i != start)) { // fill data
|
if (((i-start) % fRunInfo->fPacking == 0) && (i != start)) { // fill data
|
||||||
@ -364,12 +365,12 @@ bool PRunSingleHisto::PrepareData()
|
|||||||
// the value is normalize to per bin
|
// the value is normalize to per bin
|
||||||
value /= fRunInfo->fPacking;
|
value /= fRunInfo->fPacking;
|
||||||
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
|
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
|
||||||
fData.fTime.push_back(fTimeResolution*((double)i-(double)t0-(double)fRunInfo->fPacking));
|
fFitData.fTime.push_back(fTimeResolution*((double)i-(double)t0-(double)fRunInfo->fPacking));
|
||||||
fData.fValue.push_back(value);
|
fFitData.fValue.push_back(value);
|
||||||
if (value == 0.0)
|
if (value == 0.0)
|
||||||
fData.fError.push_back(1.0);
|
fFitData.fError.push_back(1.0);
|
||||||
else
|
else
|
||||||
fData.fError.push_back(TMath::Sqrt(value));
|
fFitData.fError.push_back(TMath::Sqrt(value));
|
||||||
value = 0.0;
|
value = 0.0;
|
||||||
}
|
}
|
||||||
value += runData->fDataBin[histoNo][i];
|
value += runData->fDataBin[histoNo][i];
|
||||||
@ -377,11 +378,34 @@ bool PRunSingleHisto::PrepareData()
|
|||||||
|
|
||||||
// count the number of bins to be fitted
|
// count the number of bins to be fitted
|
||||||
fNoOfFitBins=0;
|
fNoOfFitBins=0;
|
||||||
for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
for (unsigned int i=0; i<fFitData.fValue.size(); i++) {
|
||||||
if ((fData.fTime[i] >= fFitStartTime) && (fData.fTime[i] <= fFitStopTime))
|
if ((fFitData.fTime[i] >= fFitStartTime) && (fFitData.fTime[i] <= fFitStopTime))
|
||||||
fNoOfFitBins++;
|
fNoOfFitBins++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fill the bin data set (used for plots and t0's search
|
||||||
|
start = (unsigned int)t0-fRunInfo->fPacking*((unsigned int)t0/fRunInfo->fPacking);
|
||||||
|
end = (unsigned int)t0+fRunInfo->fPacking*((runData->fDataBin[histoNo].size()-1-(unsigned int)t0)/fRunInfo->fPacking);
|
||||||
|
value = 0.0;
|
||||||
|
//cout << endl << ">> start = " << start << ", end = " << end << ", " << runData->fDataBin[histoNo].size();
|
||||||
|
for (unsigned i=start; i<end; i++) {
|
||||||
|
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 bin
|
||||||
|
value /= fRunInfo->fPacking;
|
||||||
|
// time shifted so that packing is included correctly, i.e. t0 == t0 after packing
|
||||||
|
fBinData.fTime.push_back(fTimeResolution*((double)i-(double)t0-(double)fRunInfo->fPacking));
|
||||||
|
fBinData.fValue.push_back(value);
|
||||||
|
if (value == 0.0)
|
||||||
|
fBinData.fError.push_back(1.0);
|
||||||
|
else
|
||||||
|
fBinData.fError.push_back(TMath::Sqrt(value));
|
||||||
|
value = 0.0;
|
||||||
|
}
|
||||||
|
value += runData->fDataBin[histoNo][i];
|
||||||
|
}
|
||||||
|
//cout << endl << "fBinData.fValue.size() = " << fBinData.fValue.size();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ using namespace std;
|
|||||||
*/
|
*/
|
||||||
typedef vector<int> PIntVector;
|
typedef vector<int> PIntVector;
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*/
|
*/
|
||||||
@ -116,7 +116,7 @@ typedef vector<TComplex> PComplexVector;
|
|||||||
*/
|
*/
|
||||||
typedef vector<TString> PStringVector;
|
typedef vector<TString> PStringVector;
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>Predominantly used in PRunBase.
|
* <p>Predominantly used in PRunBase.
|
||||||
*/
|
*/
|
||||||
@ -127,7 +127,7 @@ typedef struct {
|
|||||||
vector<double> fTheory;
|
vector<double> fTheory;
|
||||||
} PRunData;
|
} PRunData;
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*/
|
*/
|
||||||
@ -142,7 +142,7 @@ typedef struct {
|
|||||||
vector<PDoubleVector> fDataBin; ///< vector of all histos of a run
|
vector<PDoubleVector> fDataBin; ///< vector of all histos of a run
|
||||||
} PRawRunData;
|
} PRawRunData;
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//-------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
*/
|
*/
|
||||||
|
@ -70,7 +70,7 @@ class PRunBase
|
|||||||
virtual void CalcTheory() = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!
|
virtual void CalcTheory() = 0; // pure virtual, i.e. needs to be implemented by the deriving class!!
|
||||||
|
|
||||||
virtual unsigned int GetRunNo() { return fRunNo; }
|
virtual unsigned int GetRunNo() { return fRunNo; }
|
||||||
virtual PRunData* GetData() { return &fData; }
|
virtual PRunData* GetData() { return &fFitData; }
|
||||||
virtual void CleanUp();
|
virtual void CleanUp();
|
||||||
virtual bool IsValid() { return fValid; }
|
virtual bool IsValid() { return fValid; }
|
||||||
|
|
||||||
@ -82,15 +82,16 @@ class PRunBase
|
|||||||
PMsrRunStructure *fRunInfo; ///< run info used to filter out needed infos for the run
|
PMsrRunStructure *fRunInfo; ///< run info used to filter out needed infos for the run
|
||||||
PRunDataHandler *fRawData; ///< holds the raw run data
|
PRunDataHandler *fRawData; ///< holds the raw run data
|
||||||
|
|
||||||
vector<int> 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
|
PRunData fFitData; ///< data to be fitted, i.e. binned data on the fit time range
|
||||||
|
PRunData fBinData; ///< binned data set, starting at raw data 0, i.e. at negative times used to plot and determine t0's
|
||||||
double fTimeResolution; ///< time resolution
|
double fTimeResolution; ///< time resolution
|
||||||
vector<double> fT0s; ///< all t0's of a run! The derived classes will handle it
|
PDoubleVector 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!!
|
||||||
|
|
||||||
vector<double> fFuncValues; ///< is keeping the values of the functions from the FUNCTIONS block
|
PDoubleVector fFuncValues; ///< is keeping the values of the functions from the FUNCTIONS block
|
||||||
PTheory *fTheory; ///< theory needed to calculate chi-square
|
PTheory *fTheory; ///< theory needed to calculate chi-square
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user