diff --git a/ChangeLog b/ChangeLog index c326ee8b..d74fd7ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ NEW any2many: an attempt to write the universial musr-data-file converter. Just NEW musrt0: added the possibility to show the t0 saved in the data file 's'. Furthermore added the option --getT0FromPromptPeak, -g with : will, in non-interactive mode estimate the t0's from the prompt peak and write it into the msr-file (MUSR-133). +FIXED background range correction, such that it is a multiple of the proton cycle time FIXED linking of BMWlibs on Cygwin FIXED various bugs in msr2data FIXED 2 little annoying problems: (i) now it is possible to zoom down to the single bin in musrview. diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index 0a3ba780..cefdc364 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -32,6 +32,7 @@ #include #include +using namespace std; #include "PMusr.h" #include "PRunAsymmetry.h" @@ -316,6 +317,8 @@ Bool_t PRunAsymmetry::PrepareData() // keep the time resolution in (us) fTimeResolution = runData->GetTimeResolution()/1.0e3; + cout.precision(8); + cout << endl << ">> PRunSingleHisto::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl; // collect histogram numbers PUIntVector forwardHistoNo; @@ -690,9 +693,10 @@ Bool_t PRunAsymmetry::SubtractEstimatedBkg() // calculate proper background range for (UInt_t i=0; i<2; i++) { if (beamPeriod != 0.0) { - Double_t beamPeriodBins = beamPeriod/fRunInfo->GetPacking(); - UInt_t periods = (UInt_t)((Double_t)(end[i] - start[i] + 1) / beamPeriodBins); - end[i] = start[i] + (UInt_t)round((Double_t)periods*beamPeriodBins); + Double_t timeBkg = (Double_t)(end-start)*(fTimeResolution*fRunInfo->GetPacking()); // length of the background intervall in time + UInt_t fullCycles = (UInt_t)(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall + // correct the end of the background intervall such that the background is as close as possible to a multiple of the proton cylce + end[i] = start[i] + (UInt_t) ((fullCycles*beamPeriod)/(fTimeResolution*fRunInfo->GetPacking())); cout << "PRunAsymmetry::SubtractEstimatedBkg(): Background " << start[i] << ", " << end[i] << endl; if (end[i] == start[i]) end[i] = fRunInfo->GetBkgRange(2*i+1); diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index 9c21a470..a0748e86 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -31,6 +31,7 @@ #include #include +using namespace std; #include "PMusr.h" #include "PRunSingleHisto.h" @@ -494,6 +495,8 @@ Bool_t PRunSingleHisto::PrepareData() // keep the time resolution in (us) fTimeResolution = runData->GetTimeResolution()/1.0e3; + cout.precision(8); + cout << endl << ">> PRunSingleHisto::PrepareData(): time resolution=" << fixed << runData->GetTimeResolution() << "(ns)" << endl; if (fHandleTag == kFit) success = PrepareFitData(runData, histoNo[0]); @@ -1137,9 +1140,10 @@ Bool_t PRunSingleHisto::EstimateBkg(UInt_t histoNo) // calculate proper background range if (beamPeriod != 0.0) { - Double_t beamPeriodBins = beamPeriod/fRunInfo->GetPacking(); - UInt_t periods = (UInt_t)((Double_t)(end - start + 1) / beamPeriodBins); - end = start + (UInt_t)round((Double_t)periods*beamPeriodBins); + Double_t timeBkg = (Double_t)(end-start)*(fTimeResolution*fRunInfo->GetPacking()); // length of the background intervall in time + UInt_t fullCycles = (UInt_t)(timeBkg/beamPeriod); // how many proton beam cylces can be placed within the proposed background intervall + // correct the end of the background intervall such that the background is as close as possible to a multiple of the proton cylce + end = start + (UInt_t) ((fullCycles*beamPeriod)/(fTimeResolution*fRunInfo->GetPacking())); cout << endl << "PRunSingleHisto::EstimatBkg(): Background " << start << ", " << end; if (end == start) end = fRunInfo->GetBkgRange(1);