added default background estimate if not present. Update the PSIBIN/MDU class from AA/AR.

This commit is contained in:
nemu
2009-12-09 08:03:51 +00:00
parent 76cc302e78
commit 0e5d18160c
5 changed files with 252 additions and 166 deletions

View File

@ -1988,32 +1988,6 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
param.CleanUp();
}
// check if for fittypes: single histo, asymmetry, RRF any background info is given
for (UInt_t i=0; i<fRuns.size(); i++) {
if ((fRuns[i].GetFitType() == MSR_FITTYPE_SINGLE_HISTO) ||
(fRuns[i].GetFitType() == MSR_FITTYPE_ASYM) ||
(fRuns[i].GetFitType() == MSR_FITTYPE_ASYM_RRF)) {
Bool_t found;
if (fRuns[i].GetBkgFitParamNo() >= 0) { // check if backgr.fit is given
found = true;
} else if (fRuns[i].GetBkgFixSize() > 0) { // check if backgr.fix is given
found = true;
} else if (fRuns[i].GetBkgRangeSize() > 0) { // check if background window is given
found = true;
} else {
found = false;
}
if (!found) {
cerr << endl << ">> PMsrHandler::HandleRunEntry: **ERROR** for run " << fRuns[i].GetRunName()->Data() << ", forward " << fRuns[i].GetForwardHistoNo();
cerr << endl << " no background information found!";
cerr << endl << " Either of the tags 'backgr.fit', 'backgr.fix', 'background'";
cerr << endl << " with data is needed.";
cerr << endl;
return false;
}
}
}
return !error;
}

View File

@ -454,10 +454,19 @@ Bool_t PRunAsymmetry::PrepareData()
if (fRunInfo->GetBkgRangeSize() != 0) {
if (!SubtractEstimatedBkg())
return false;
} else { // no background given to do the job
cerr << endl << "PRunAsymmetry::PrepareData(): **ERROR** Neither fix background nor background bins are given!";
cerr << endl << "One of the two is needed! Will quit ...";
return false;
} else { // no background given to do the job, try to estimate it
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[1]*0.1), 2);
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[1]*0.6), 3);
cerr << endl << "PRunAsymmetry::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
cerr << endl << "Will try the following:";
cerr << endl << "forward: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
cerr << endl << "backward: bkg start = " << fRunInfo->GetBkgRange(2) << ", bkg end = " << fRunInfo->GetBkgRange(3);
cerr << endl << "NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
cerr << endl;
if (!SubtractEstimatedBkg())
return false;
}
} else { // fixed background given
if (!SubtractFixBkg())

View File

@ -500,11 +500,15 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN
if (fRunInfo->GetBkgRangeSize() != 0) {
if (!EstimateBkg(histoNo))
return false;
} else { // no background given to do the job
cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** Neither fix background nor background bins are given!";
cerr << endl << "One of the two is needed! Will quit ...";
} else { // no background given to do the job, try estimate
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
cerr << endl << "PRunSingleHisto::PrepareFitData(): **WARNING** Neither fix background nor background bins are given!";
cerr << endl << "Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
cerr << endl << "NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
cerr << endl;
return false;
if (!EstimateBkg(histoNo))
return false;
}
}
}
@ -678,8 +682,19 @@ cout << endl << ">> data start time = " << fData.GetDataTimeStart();
Double_t bkg;
if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg not fitted
if (fRunInfo->GetBkgFixSize() == 0) { // no fixed background given (background interval)
if (!EstimateBkg(histoNo))
return false;
if (fRunInfo->GetBkgRangeSize() != 0) { // background range given
if (!EstimateBkg(histoNo))
return false;
} else { // no background given to do the job, try estimate
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
cerr << endl << "Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
cerr << endl << "NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
cerr << endl;
if (!EstimateBkg(histoNo))
return false;
}
bkg = fBackground;
} else { // fixed bkg given
bkg = fRunInfo->GetBkgFix(0);
@ -812,8 +827,19 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
Double_t bkg;
if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg not fitted
if (fRunInfo->GetBkgFixSize() == 0) { // no fixed background given (background interval)
if (!EstimateBkg(histoNo))
return false;
if (fRunInfo->GetBkgRangeSize() != 0) { // background range given
if (!EstimateBkg(histoNo))
return false;
} else { // no background given to do the job, try estimate
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
cerr << endl << "Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
cerr << endl << "NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
cerr << endl;
if (!EstimateBkg(histoNo))
return false;
}
bkg = fBackground;
} else { // fixed bkg given
bkg = fRunInfo->GetBkgFix(0);