if the background is estimated from an interval rather than fitted, it will be added as a comment to the background interval tag. (MUSR-192)

This commit is contained in:
suter_a 2011-11-15 08:46:00 +00:00
parent a63ed33de7
commit 379345496b
6 changed files with 77 additions and 4 deletions

View File

@ -6,6 +6,8 @@
changes since 0.9.0
===================================
NEW if the background is estimated form an interval rather than fitted, it will be added as a comment
to the background interval tag. (MUSR-192).
NEW forward/backward accept now not only c0 c1 c2 ... cn, but also c0-cn cm-cp, or c0 c1-cn cm cx-cy, etc. (MUSR-201, improvement whish).
NEW added minimal NeXus IDF 2 support.
NEW Added the online documentation to the repository. It can be found under "doc/html".

View File

@ -746,6 +746,21 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
fout << left << fRuns[runNo].GetBkgRange(j);
}
}
if (fRuns[runNo].GetBkgEstimated(0) != PMUSR_UNDEFINED) {
Int_t precision=4;
if ((Int_t)log10(fRuns[runNo].GetBkgEstimated(0))+1 >= 4)
precision = 2;
fout << " # estimated bkg: ";
fout << fixed;
fout.precision(precision);
fout << fRuns[runNo].GetBkgEstimated(0);
if (fRuns[runNo].GetBkgEstimated(1) != PMUSR_UNDEFINED) {
fout << " / ";
fout << fixed;
fout.precision(precision);
fout << fRuns[runNo].GetBkgEstimated(1);
}
}
fout << endl;
} else if (sstr.BeginsWith("data")) {
dataTagMissing[runNo] = false;
@ -2465,8 +2480,14 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
iter = lines.begin();
while ((iter != lines.end()) && !error) {
// remove potential comment at the end of lines
str = iter->fLine;
Ssiz_t idx = str.Index("#");
if (idx != -1)
str.Remove(idx);
// tokenize line
tokens = iter->fLine.Tokenize(" \t");
tokens = str.Tokenize(" \t");
if (!tokens) {
cerr << endl << ">> PMsrHandler::HandleRunEntry: **SEVERE ERROR** Couldn't tokenize Parameters in line " << iter->fLineNo;
cerr << endl << endl;

View File

@ -577,8 +577,10 @@ PMsrRunBlock::PMsrRunBlock()
fBkgFitParamNo = -1; // undefined background parameter number
fLifetimeParamNo = -1; // undefined lifetime parameter number
fLifetimeCorrection = false; // lifetime correction == false by default (used in single histogram musrview)
for (UInt_t i=0; i<2; i++)
for (UInt_t i=0; i<2; i++) {
fBkgEstimated[i] = PMUSR_UNDEFINED;
fBkgFix[i] = PMUSR_UNDEFINED;
}
for (UInt_t i=0; i<4; i++) {
fBkgRange[i] = -1; // undefined start background range
fDataRange[i] = -1; // undefined start data range
@ -955,6 +957,48 @@ void PMsrRunBlock::SetMap(Int_t mapVal, Int_t idx)
fMap[idx] = mapVal;
}
//--------------------------------------------------------------------------
// GetBkgEstimated
//--------------------------------------------------------------------------
/**
* <p> get estimated background value at position idx. If not present,
* PMUSR_UNDEFINED is returned.
*
* <b>return:</b>
* - estimated background value, if idx is within proper boundaries
* - PMUSR_UNDEFINED, otherwise
*
* \param idx index of the estimated background value to be returned
*/
Double_t PMsrRunBlock::GetBkgEstimated(UInt_t idx)
{
if (idx >= 2)
return PMUSR_UNDEFINED;
return fBkgEstimated[idx];
}
//--------------------------------------------------------------------------
// SetBkgEstimated
//--------------------------------------------------------------------------
/**
* <p> set estimated background value at position idx
*
* \param dval estimated background value
* \param idx index of the estimated background value to be set.
*/
void PMsrRunBlock::SetBkgEstimated(Double_t dval, Int_t idx)
{
if (idx >= 2) {
cerr << endl << ">> PMsrRunBlock::SetBkgEstimated: **WARNING** idx=" << idx << ", only idx=0,1 are sensible.";
cerr << endl;
return;
}
fBkgEstimated[idx] = dval;
}
//--------------------------------------------------------------------------
// GetBkgFix
//--------------------------------------------------------------------------

View File

@ -820,6 +820,9 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg()
fBackward[i] -= bkg[1];
}
fRunInfo->SetBkgEstimated(bkg[0], 0);
fRunInfo->SetBkgEstimated(bkg[1], 1);
return true;
}

View File

@ -1358,7 +1358,7 @@ Bool_t PRunSingleHisto::EstimateBkg(UInt_t histoNo)
else
fBackground = bkg * fRunInfo->GetPacking(); // keep background (per bin)
cout << endl << ">> fRunInfo->fRunName=" << fRunInfo->GetRunName()->Data() << ", histNo=" << histoNo << ", fBackground=" << fBackground;
fRunInfo->SetBkgEstimated(fBackground, 0);
return true;
}

View File

@ -441,6 +441,7 @@ class PMsrRunBlock {
virtual Int_t GetForwardHistoNo(UInt_t idx=0);
virtual UInt_t GetBackwardHistoNoSize() { return fBackwardHistoNo.size(); }
virtual Int_t GetBackwardHistoNo(UInt_t idx=0);
virtual Double_t GetBkgEstimated(UInt_t idx);
virtual Double_t GetBkgFix(UInt_t idx);
virtual Int_t GetBkgRange(UInt_t idx);
virtual Int_t GetDataRange(UInt_t idx);
@ -472,7 +473,8 @@ class PMsrRunBlock {
virtual void SetMap(Int_t mapVal, Int_t idx=-1);
virtual void SetForwardHistoNo(Int_t histoNo, Int_t idx=-1);
virtual void SetBackwardHistoNo(Int_t histoNo, Int_t idx=-1);
virtual void SetBkgFix(Double_t dval, Int_t idx=-1);
virtual void SetBkgEstimated(Double_t dval, Int_t idx);
virtual void SetBkgFix(Double_t dval, Int_t idx);
virtual void SetBkgRange(Int_t ival, Int_t idx);
virtual void SetDataRange(Int_t ival, Int_t idx);
virtual void SetT0(Int_t ival, Int_t idx=-1);
@ -501,6 +503,7 @@ class PMsrRunBlock {
PIntVector fMap; ///< map vector needed to switch parameters for different runs within a single theory
PIntVector fForwardHistoNo; ///< forward histogram number (fit type 0, 2, 4)
PIntVector fBackwardHistoNo; ///< backward histogram number (fit type 2, 4)
Double_t fBkgEstimated[2]; ///< keeps estimated background values (if present)
Double_t fBkgFix[2]; ///< fixed background in (1/ns) (fit type 0, 2, 4)
Int_t fBkgRange[4]; ///< background bin range (fit type 0, 2, 4)
Int_t fDataRange[4]; ///< data bin range (fit type 0, 2, 4)