some plot bug fixing
This commit is contained in:
@ -54,6 +54,8 @@ short term:
|
|||||||
|
|
||||||
* something is strange with the coordinate system in TPaveText! **CHECK**
|
* something is strange with the coordinate system in TPaveText! **CHECK**
|
||||||
|
|
||||||
|
* something is wrong with lifetimecorrection plot of musrview (up shifted data)
|
||||||
|
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
intermediate term:
|
intermediate term:
|
||||||
|
@ -730,16 +730,16 @@ void PMusrCanvas::HandleDataSet(unsigned int runNo, PRunData *data)
|
|||||||
// create histo specific infos
|
// create histo specific infos
|
||||||
name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName + "_DataRunNo";
|
name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName + "_DataRunNo";
|
||||||
name += (int)runNo;
|
name += (int)runNo;
|
||||||
start = data->fDataTimeStart;
|
start = data->fDataTimeStart - data->fDataTimeStep/2.0;
|
||||||
end = data->fDataTimeStart + (data->fValue.size()-1)*data->fDataTimeStep;
|
end = data->fDataTimeStart + data->fValue.size()*data->fDataTimeStep + data->fDataTimeStep/2.0;
|
||||||
|
|
||||||
// invoke histo
|
// invoke histo
|
||||||
dataHisto = new TH1F(name, name, data->fValue.size(), start, end);
|
dataHisto = new TH1F(name, name, data->fValue.size()+2, 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++) {
|
||||||
dataHisto->SetBinContent(i, data->fValue[i]);
|
dataHisto->SetBinContent(i+1, data->fValue[i]);
|
||||||
dataHisto->SetBinError(i, data->fError[i]);
|
dataHisto->SetBinError(i+1, data->fError[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set marker and line color
|
// set marker and line color
|
||||||
@ -766,17 +766,17 @@ void PMusrCanvas::HandleDataSet(unsigned int runNo, PRunData *data)
|
|||||||
// create histo specific infos
|
// create histo specific infos
|
||||||
name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName + "_TheoRunNo";
|
name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName + "_TheoRunNo";
|
||||||
name += (int)runNo;
|
name += (int)runNo;
|
||||||
start = data->fTheoryTimeStart;
|
start = data->fTheoryTimeStart - data->fTheoryTimeStep/2.0;
|
||||||
end = data->fTheoryTimeStart + (data->fTheory.size()-1)*data->fTheoryTimeStep;
|
end = data->fTheoryTimeStart + data->fTheory.size()*data->fTheoryTimeStep + data->fTheoryTimeStep/2.0;
|
||||||
|
|
||||||
//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(), start, end);
|
theoHisto = new TH1F(name, name, data->fTheory.size()+2, 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++) {
|
||||||
theoHisto->SetBinContent(i, data->fTheory[i]);
|
theoHisto->SetBinContent(i+1, data->fTheory[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the line color
|
// set the line color
|
||||||
|
@ -796,7 +796,7 @@ bool PRunAsymmetry::PrepareViewData(PRawRunData* runData, unsigned int histoNo[2
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cout << endl << ">> alpha = " << alpha << ", beta = " << beta;
|
//cout << endl << ">> alpha = " << alpha << ", beta = " << beta;
|
||||||
|
|
||||||
for (unsigned int i=0; i<forwardPacked.fValue.size(); i++) {
|
for (unsigned int i=0; i<forwardPacked.fValue.size(); i++) {
|
||||||
// to make the formulae more readable
|
// to make the formulae more readable
|
||||||
|
@ -557,7 +557,12 @@ bool PRunSingleHisto::PrepareRawViewData()
|
|||||||
double value = 0.0;
|
double value = 0.0;
|
||||||
// data start at data_start-t0
|
// data start at data_start-t0
|
||||||
// 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.fDataTimeStart = fTimeResolution*(((double)start-t0)+(double)fRunInfo->fPacking/2.0);
|
fData.fDataTimeStart = fTimeResolution*((double)start-t0+(double)fRunInfo->fPacking/2.0);
|
||||||
|
/*
|
||||||
|
cout << endl << ">> time resolution = " << fTimeResolution;
|
||||||
|
cout << endl << ">> start = " << start << ", t0 = " << t0 << ", packing = " << fRunInfo->fPacking;
|
||||||
|
cout << endl << ">> data start time = " << fData.fDataTimeStart;
|
||||||
|
*/
|
||||||
fData.fDataTimeStep = fTimeResolution*fRunInfo->fPacking;
|
fData.fDataTimeStep = fTimeResolution*fRunInfo->fPacking;
|
||||||
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
|
||||||
@ -575,8 +580,9 @@ bool PRunSingleHisto::PrepareRawViewData()
|
|||||||
value += runData->fDataBin[histoNo][i];
|
value += runData->fDataBin[histoNo][i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// count the number of bins to be fitted
|
// count the number of bins
|
||||||
fNoOfFitBins=0;
|
fNoOfFitBins=0;
|
||||||
|
|
||||||
double time;
|
double time;
|
||||||
for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
for (unsigned int i=0; i<fData.fValue.size(); i++) {
|
||||||
time = fData.fDataTimeStart + (double)i*fData.fDataTimeStep;
|
time = fData.fDataTimeStart + (double)i*fData.fDataTimeStep;
|
||||||
@ -633,10 +639,19 @@ bool PRunSingleHisto::PrepareRawViewData()
|
|||||||
unsigned int size = runData->fDataBin[histoNo].size();
|
unsigned int size = runData->fDataBin[histoNo].size();
|
||||||
double startTime = -fT0s[0]*fTimeResolution;
|
double startTime = -fT0s[0]*fTimeResolution;
|
||||||
fData.fTheoryTimeStart = startTime;
|
fData.fTheoryTimeStart = startTime;
|
||||||
|
//cout << endl << ">> theory start time = " << fData.fTheoryTimeStart;
|
||||||
fData.fTheoryTimeStep = fTimeResolution;
|
fData.fTheoryTimeStep = fTimeResolution;
|
||||||
for (unsigned int i=0; i<size; i++) {
|
for (unsigned int i=0; i<size; i++) {
|
||||||
time = startTime + (double)i*fTimeResolution;
|
time = startTime + (double)i*fTimeResolution;
|
||||||
fData.fTheory.push_back(N0*TMath::Exp(-time/tau)*(1+fTheory->Func(time, par, fFuncValues))+bkg);
|
fData.fTheory.push_back(N0*TMath::Exp(-time/tau)*(1+fTheory->Func(time, par, fFuncValues))+bkg);
|
||||||
|
if (i==126) {
|
||||||
|
cout << endl << ">> time = " << time;
|
||||||
|
cout << endl << ">> value = " << N0*TMath::Exp(-time/tau)*(1+fTheory->Func(time, par, fFuncValues))+bkg;
|
||||||
|
cout << endl << ">> N0 = " << N0;
|
||||||
|
cout << endl << ">> bkg = " << bkg;
|
||||||
|
cout << endl << ">> TMath::Exp(-time/tau) = " << TMath::Exp(-time/tau);
|
||||||
|
cout << endl << ">> theory = " << fTheory->Func(time, par, fFuncValues);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clean up
|
// clean up
|
||||||
@ -789,16 +804,18 @@ bool PRunSingleHisto::PrepareViewData()
|
|||||||
} 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;
|
||||||
double time;
|
double time;
|
||||||
|
|
||||||
// data start at data_start-t0
|
// data start at data_start-t0
|
||||||
// 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.fDataTimeStart = fTimeResolution*(((double)start-t0)+(double)fRunInfo->fPacking/2.0);
|
fData.fDataTimeStart = fTimeResolution*((double)start-t0+(double)fRunInfo->fPacking/2.0);
|
||||||
fData.fDataTimeStep = fTimeResolution*fRunInfo->fPacking;
|
fData.fDataTimeStep = fTimeResolution*fRunInfo->fPacking;
|
||||||
//cout << endl << ">> start = " << fData.fDataTimeStart << ", step = " << fData.fDataTimeStep;
|
//cout << endl << ">> start = " << fData.fDataTimeStart << ", step = " << fData.fDataTimeStep;
|
||||||
for (unsigned i=start; i<end; i++) {
|
for (unsigned int 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
|
||||||
// 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 bin
|
// the value is normalize to per bin
|
||||||
|
Reference in New Issue
Block a user