some plot bug fixing

This commit is contained in:
nemu 2008-05-16 12:18:47 +00:00
parent 7e646d360a
commit 0913660736
4 changed files with 33 additions and 14 deletions

View File

@ -54,6 +54,8 @@ short term:
* something is strange with the coordinate system in TPaveText! **CHECK**
* something is wrong with lifetimecorrection plot of musrview (up shifted data)
---------------------
intermediate term:

View File

@ -730,16 +730,16 @@ void PMusrCanvas::HandleDataSet(unsigned int runNo, PRunData *data)
// create histo specific infos
name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName + "_DataRunNo";
name += (int)runNo;
start = data->fDataTimeStart;
end = data->fDataTimeStart + (data->fValue.size()-1)*data->fDataTimeStep;
start = data->fDataTimeStart - data->fDataTimeStep/2.0;
end = data->fDataTimeStart + data->fValue.size()*data->fDataTimeStep + data->fDataTimeStep/2.0;
// 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
for (unsigned int i=0; i<data->fValue.size(); i++) {
dataHisto->SetBinContent(i, data->fValue[i]);
dataHisto->SetBinError(i, data->fError[i]);
dataHisto->SetBinContent(i+1, data->fValue[i]);
dataHisto->SetBinError(i+1, data->fError[i]);
}
// set marker and line color
@ -766,17 +766,17 @@ void PMusrCanvas::HandleDataSet(unsigned int runNo, PRunData *data)
// create histo specific infos
name = fMsrHandler->GetMsrRunList()->at(runNo).fRunName + "_TheoRunNo";
name += (int)runNo;
start = data->fTheoryTimeStart;
end = data->fTheoryTimeStart + (data->fTheory.size()-1)*data->fTheoryTimeStep;
start = data->fTheoryTimeStart - data->fTheoryTimeStep/2.0;
end = data->fTheoryTimeStart + data->fTheory.size()*data->fTheoryTimeStep + data->fTheoryTimeStep/2.0;
//cout << endl << ">> start = " << start << ", end = " << end << endl;
// 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
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

View File

@ -796,7 +796,7 @@ bool PRunAsymmetry::PrepareViewData(PRawRunData* runData, unsigned int histoNo[2
default:
break;
}
cout << endl << ">> alpha = " << alpha << ", beta = " << beta;
//cout << endl << ">> alpha = " << alpha << ", beta = " << beta;
for (unsigned int i=0; i<forwardPacked.fValue.size(); i++) {
// to make the formulae more readable

View File

@ -557,7 +557,12 @@ bool PRunSingleHisto::PrepareRawViewData()
double value = 0.0;
// data start at data_start-t0
// 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;
for (unsigned i=start; i<end; i++) {
if (((i-start) % fRunInfo->fPacking == 0) && (i != start)) { // fill data
@ -575,8 +580,9 @@ bool PRunSingleHisto::PrepareRawViewData()
value += runData->fDataBin[histoNo][i];
}
// count the number of bins to be fitted
// count the number of bins
fNoOfFitBins=0;
double time;
for (unsigned int i=0; i<fData.fValue.size(); i++) {
time = fData.fDataTimeStart + (double)i*fData.fDataTimeStep;
@ -633,10 +639,19 @@ bool PRunSingleHisto::PrepareRawViewData()
unsigned int size = runData->fDataBin[histoNo].size();
double startTime = -fT0s[0]*fTimeResolution;
fData.fTheoryTimeStart = startTime;
//cout << endl << ">> theory start time = " << fData.fTheoryTimeStart;
fData.fTheoryTimeStep = fTimeResolution;
for (unsigned int i=0; i<size; i++) {
time = startTime + (double)i*fTimeResolution;
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
@ -789,16 +804,18 @@ bool PRunSingleHisto::PrepareViewData()
} else { // bkg fitted
bkg = par[fRunInfo->fBkgFitParamNo-1];
}
//cout << endl << ">> bkg = " << bkg;
double value = 0.0;
double expval;
double time;
// data start at data_start-t0
// 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;
//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
// in order that after rebinning the fit does not need to be redone (important for plots)
// the value is normalize to per bin