packing == 1 bug fixed. Minor formating problem in the run block of PMsrHandler::WriteMsrLogFile() fixed.

This commit is contained in:
nemu
2008-07-02 06:13:44 +00:00
parent 5f3786330d
commit a1e97be5ca
5 changed files with 91 additions and 56 deletions

View File

@ -69,6 +69,10 @@ short term:
* implement NonMuSR stuff **DONE** 08-06-20, some more testing needed * implement NonMuSR stuff **DONE** 08-06-20, some more testing needed
* Minuit2: name length is now unlimited and hence the 10 char restriction can be lifted.
* nonMusr: check why in nonMusr view there is NO legend??
* implement FFT with msr-interface * implement FFT with msr-interface
--------------------- ---------------------

View File

@ -522,7 +522,7 @@ int PMsrHandler::WriteMsrLogFile()
// background // background
if (fRuns[i].fBkgRange[0] != -1) { if (fRuns[i].fBkgRange[0] != -1) {
f.width(16); f.width(16);
f << endl << "background"; f << endl << left << "background";
for (unsigned int j=0; j<4; j++) { for (unsigned int j=0; j<4; j++) {
if (fRuns[i].fBkgRange[j] == -1) if (fRuns[i].fBkgRange[j] == -1)
break; break;
@ -534,7 +534,7 @@ int PMsrHandler::WriteMsrLogFile()
// data // data
if (fRuns[i].fDataRange[0] != -1) { if (fRuns[i].fDataRange[0] != -1) {
f.width(16); f.width(16);
f << endl << "data"; f << endl << left << "data";
for (unsigned int j=0; j<4; j++) { for (unsigned int j=0; j<4; j++) {
if (fRuns[i].fDataRange[j] == -1) if (fRuns[i].fDataRange[j] == -1)
break; break;
@ -546,7 +546,7 @@ int PMsrHandler::WriteMsrLogFile()
// t0 // t0
if (fRuns[i].fT0[0] != -1) { if (fRuns[i].fT0[0] != -1) {
f.width(16); f.width(16);
f << endl << "t0"; f << endl << left << "t0";
for (unsigned int j=0; j<2; j++) { for (unsigned int j=0; j<2; j++) {
if (fRuns[i].fT0[j] == -1) if (fRuns[i].fT0[j] == -1)
break; break;
@ -558,7 +558,7 @@ int PMsrHandler::WriteMsrLogFile()
// fit // fit
if (fRuns[i].fFitRange[0] != -1) { if (fRuns[i].fFitRange[0] != -1) {
f.width(16); f.width(16);
f << endl << "fit"; f << endl << left << "fit";
for (unsigned int j=0; j<2; j++) { for (unsigned int j=0; j<2; j++) {
if (fRuns[i].fFitRange[j] == -1) if (fRuns[i].fFitRange[j] == -1)
break; break;

View File

@ -564,37 +564,47 @@ bool PRunAsymmetry::PrepareFitData(PRawRunData* runData, unsigned int histoNo[2]
double error = 0.0; double error = 0.0;
// forward // forward
for (unsigned i=start[0]; i<end[0]; i++) { for (unsigned i=start[0]; i<end[0]; i++) {
if (((i-start[0]) % fRunInfo->fPacking == 0) && (i != start[0])) { // fill data if (fRunInfo->fPacking == 1) {
// in order that after rebinning the fit does not need to be redone (important for plots) forwardPacked.fValue.push_back(fForward[i]);
// the value is normalize to per bin forwardPacked.fError.push_back(fForwardErr[i]);
value /= fRunInfo->fPacking; } else { // packed data, i.e. fRunInfo->fPacking > 1
forwardPacked.fValue.push_back(value); if (((i-start[0]) % fRunInfo->fPacking == 0) && (i != start[0])) { // fill data
if (value == 0.0) // in order that after rebinning the fit does not need to be redone (important for plots)
forwardPacked.fError.push_back(1.0); // the value is normalize to per bin
else value /= fRunInfo->fPacking;
forwardPacked.fError.push_back(TMath::Sqrt(error)/fRunInfo->fPacking); forwardPacked.fValue.push_back(value);
value = 0.0; if (value == 0.0)
error = 0.0; forwardPacked.fError.push_back(1.0);
else
forwardPacked.fError.push_back(TMath::Sqrt(error)/fRunInfo->fPacking);
value = 0.0;
error = 0.0;
}
value += fForward[i];
error += fForwardErr[i]*fForwardErr[i];
} }
value += fForward[i];
error += fForwardErr[i]*fForwardErr[i];
} }
// backward // backward
for (unsigned i=start[1]; i<end[1]; i++) { for (unsigned i=start[1]; i<end[1]; i++) {
if (((i-start[1]) % fRunInfo->fPacking == 0) && (i != start[1])) { // fill data if (fRunInfo->fPacking == 1) {
// in order that after rebinning the fit does not need to be redone (important for plots) backwardPacked.fValue.push_back(fBackward[i]);
// the value is normalize to per bin backwardPacked.fError.push_back(fBackwardErr[i]);
value /= fRunInfo->fPacking; } else { // packed data, i.e. fRunInfo->fPacking > 1
backwardPacked.fValue.push_back(value); if (((i-start[1]) % fRunInfo->fPacking == 0) && (i != start[1])) { // fill data
if (value == 0.0) // in order that after rebinning the fit does not need to be redone (important for plots)
backwardPacked.fError.push_back(1.0); // the value is normalize to per bin
else value /= fRunInfo->fPacking;
backwardPacked.fError.push_back(TMath::Sqrt(error)/fRunInfo->fPacking); backwardPacked.fValue.push_back(value);
value = 0.0; if (value == 0.0)
error = 0.0; backwardPacked.fError.push_back(1.0);
else
backwardPacked.fError.push_back(TMath::Sqrt(error)/fRunInfo->fPacking);
value = 0.0;
error = 0.0;
}
value += fBackward[i];
error += fBackwardErr[i]*fBackwardErr[i];
} }
value += fBackward[i];
error += fBackwardErr[i]*fBackwardErr[i];
} }
// check if packed forward and backward hist have the same size, otherwise something is wrong // check if packed forward and backward hist have the same size, otherwise something is wrong

View File

@ -186,17 +186,23 @@ bool PRunNonMusr::PrepareFitData()
cout << endl << ">> runData->fXData.size()=" << runData->fXData.size(); cout << endl << ">> runData->fXData.size()=" << runData->fXData.size();
for (unsigned int i=0; i<runData->fXData.size(); i++) { for (unsigned int i=0; i<runData->fXData.size(); i++) {
cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking; cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking;
if ((i % fRunInfo->fPacking == 0) && (i != 0)) { // fill data if (fRunInfo->fPacking == 1) {
fData.fX.push_back(runData->fXData[i]);
fData.fValue.push_back(runData->fYData[i]);
fData.fError.push_back(runData->fErrYData[i]);
} else { // packed data, i.e. fRunInfo->fPacking > 1
if ((i % fRunInfo->fPacking == 0) && (i != 0)) { // fill data
cout << endl << "-> i=" << i; cout << endl << "-> i=" << i;
fData.fX.push_back(runData->fXData[i]-(runData->fXData[i]-runData->fXData[i-fRunInfo->fPacking])/2.0); fData.fX.push_back(runData->fXData[i]-(runData->fXData[i]-runData->fXData[i-fRunInfo->fPacking])/2.0);
fData.fValue.push_back(value); fData.fValue.push_back(value);
fData.fError.push_back(TMath::Sqrt(err)); fData.fError.push_back(TMath::Sqrt(err));
value = 0.0; value = 0.0;
err = 0.0; err = 0.0;
}
// sum raw data values
value += runData->fYData[i];
err += runData->fErrYData[i]*runData->fErrYData[i];
} }
// sum raw data values
value += runData->fYData[i];
err += runData->fErrYData[i]*runData->fErrYData[i];
} }
cout << endl << ">> fData.fValue.size()=" << fData.fValue.size(); cout << endl << ">> fData.fValue.size()=" << fData.fValue.size();
@ -238,17 +244,23 @@ bool PRunNonMusr::PrepareViewData()
cout << endl << ">> runData->fXData.size()=" << runData->fXData.size(); cout << endl << ">> runData->fXData.size()=" << runData->fXData.size();
for (unsigned int i=0; i<runData->fXData.size(); i++) { for (unsigned int i=0; i<runData->fXData.size(); i++) {
cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking; cout << endl << ">> i=" << i << ", packing=" << fRunInfo->fPacking;
if ((i % fRunInfo->fPacking == 0) && (i != 0)) { // fill data if (fRunInfo->fPacking == 1) {
fData.fX.push_back(runData->fXData[i]);
fData.fValue.push_back(runData->fYData[i]);
fData.fError.push_back(runData->fErrYData[i]);
} else { // packed data, i.e. fRunInfo->fPacking > 1
if ((i % fRunInfo->fPacking == 0) && (i != 0)) { // fill data
cout << endl << "-> i=" << i; cout << endl << "-> i=" << i;
fData.fX.push_back(runData->fXData[i]-(runData->fXData[i]-runData->fXData[i-fRunInfo->fPacking])/2.0); fData.fX.push_back(runData->fXData[i]-(runData->fXData[i]-runData->fXData[i-fRunInfo->fPacking])/2.0);
fData.fValue.push_back(value); fData.fValue.push_back(value);
fData.fError.push_back(TMath::Sqrt(err)); fData.fError.push_back(TMath::Sqrt(err));
value = 0.0; value = 0.0;
err = 0.0; err = 0.0;
}
// sum raw data values
value += runData->fYData[i];
err += runData->fErrYData[i]*runData->fErrYData[i];
} }
// sum raw data values
value += runData->fYData[i];
err += runData->fErrYData[i]*runData->fErrYData[i];
} }
cout << endl << ">> fData.fValue.size()=" << fData.fValue.size(); cout << endl << ">> fData.fValue.size()=" << fData.fValue.size();

View File

@ -431,19 +431,28 @@ bool PRunSingleHisto::PrepareFitData()
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;
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 (fRunInfo->fPacking == 1) {
// in order that after rebinning the fit does not need to be redone (important for plots) value = runData->fDataBin[histoNo][i];
// the value is normalize to per bin
value /= fRunInfo->fPacking;
fData.fValue.push_back(value); fData.fValue.push_back(value);
if (value == 0.0) if (value == 0.0)
fData.fError.push_back(1.0); fData.fError.push_back(1.0);
else else
fData.fError.push_back(TMath::Sqrt(value/fRunInfo->fPacking)); fData.fError.push_back(TMath::Sqrt(value));
// reset values } else { // packed data, i.e. fRunInfo->fPacking > 1
value = 0.0; 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;
fData.fValue.push_back(value);
if (value == 0.0)
fData.fError.push_back(1.0);
else
fData.fError.push_back(TMath::Sqrt(value/fRunInfo->fPacking));
// reset values
value = 0.0;
}
value += runData->fDataBin[histoNo][i];
} }
value += runData->fDataBin[histoNo][i];
} }
// count the number of bins to be fitted // count the number of bins to be fitted