diff --git a/src/classes/PMusr.cpp b/src/classes/PMusr.cpp index dea9bbbc6..f590010e6 100644 --- a/src/classes/PMusr.cpp +++ b/src/classes/PMusr.cpp @@ -490,7 +490,7 @@ PMsrRunBlock::PMsrRunBlock() fBkgFitParamNo = -1; // undefined background parameter number fPhaseParamNo = -1; // undefined phase parameter number fLifetimeParamNo = -1; // undefined lifetime parameter number - fLifetimeCorrection = true; // lifetime correction == true by default (used in single histogram musrview) + fLifetimeCorrection = false; // lifetime correction == false by default (used in single histogram musrview) fForwardHistoNo = -1; // undefined forward histogram number fBackwardHistoNo = -1; // undefined backward histogram number fFitRange[0] = PMUSR_UNDEFINED; // undefined start fit range diff --git a/src/classes/PRunAsymmetry.cpp b/src/classes/PRunAsymmetry.cpp index c1ebbfbc5..600696d92 100644 --- a/src/classes/PRunAsymmetry.cpp +++ b/src/classes/PRunAsymmetry.cpp @@ -629,6 +629,31 @@ Bool_t PRunAsymmetry::PrepareFitData(PRawRunData* runData, UInt_t histoNo[2]) Int_t start[2] = {fRunInfo->GetDataRange(0), fRunInfo->GetDataRange(2)}; Int_t end[2] = {fRunInfo->GetDataRange(1), fRunInfo->GetDataRange(3)}; Double_t t0[2] = {fT0s[0], fT0s[1]}; + // check if data range has been provided, and if not try to estimate them + if (start[0] < 0) { + start[0] = (Int_t)t0[0]+5; + cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** data range (forward) was not provided, will try data range start = t0+5 = " << start[0] << "."; + cerr << endl << "NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + cerr << endl; + } + if (start[1] < 0) { + start[1] = (Int_t)t0[1]+5; + cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** data range (backward) was not provided, will try data range start = t0+5 = " << start[1] << "."; + cerr << endl << "NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + cerr << endl; + } + if (end[0] < 0) { + end[0] = runData->GetDataBin(histoNo[0])->size(); + cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** data range (forward) was not provided, will try data range end = " << end[0] << "."; + cerr << endl << "NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + cerr << endl; + } + if (end[1] < 0) { + end[1] = runData->GetDataBin(histoNo[1])->size(); + cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** data range (backward) was not provided, will try data range end = " << end[1] << "."; + cerr << endl << "NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + cerr << endl; + } // check if start, end, and t0 make any sense // 1st check if start and end are in proper order for (UInt_t i=0; i<2; i++) { @@ -783,15 +808,30 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2]) // transform raw histo data. This is done the following way (for details see the manual): // first rebin the data, than calculate the asymmetry // first get start data, end data, and t0 - Int_t val = fRunInfo->GetDataRange(0)-packing*(fRunInfo->GetDataRange(0)/packing); - do { - if (fRunInfo->GetDataRange(2) - fRunInfo->GetDataRange(0) < 0) - val += packing; - } while (val + fRunInfo->GetDataRange(2) - fRunInfo->GetDataRange(0) < 0); - - Int_t start[2] = {val, val + fRunInfo->GetDataRange(2) - fRunInfo->GetDataRange(0)}; - Int_t end[2]; + Int_t start[2] = {0, 0}; + Int_t end[2] = {0, 0}; Double_t t0[2] = {fT0s[0], fT0s[1]}; + // check if data range has been provided, and if not try to estimate them + if (fRunInfo->GetDataRange(0) < 0) { + start[0] = ((Int_t)t0[0]+5) - (((Int_t)t0[0]+5)/packing)*packing; + cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** data range (forward) was not provided, will try data range start = " << start[0] << "."; + cerr << endl << "NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + cerr << endl; + } else if (fRunInfo->GetDataRange(2) < 0) { + start[1] = ((Int_t)t0[1]+5) - (((Int_t)t0[1]+5)/packing)*packing; + cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** data range (backward) was not provided, will try data range start = " << start[1] << "."; + cerr << endl << "NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + cerr << endl; + } else { + Int_t val = fRunInfo->GetDataRange(0)-packing*(fRunInfo->GetDataRange(0)/packing); + do { + if (fRunInfo->GetDataRange(2) - fRunInfo->GetDataRange(0) < 0) + val += packing; + } while (val + fRunInfo->GetDataRange(2) - fRunInfo->GetDataRange(0) < 0); + + start[0] = val; + start[1] = val + fRunInfo->GetDataRange(2) - fRunInfo->GetDataRange(0); + } /* cout << endl << ">> start[0]=" << start[0] << ", end[0]=" << end[0]; diff --git a/src/classes/PRunSingleHisto.cpp b/src/classes/PRunSingleHisto.cpp index a322bb7a6..f14910773 100644 --- a/src/classes/PRunSingleHisto.cpp +++ b/src/classes/PRunSingleHisto.cpp @@ -459,6 +459,20 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN Int_t end; start = fRunInfo->GetDataRange(0); end = fRunInfo->GetDataRange(1); + // check if data range has been provided, and if not try to estimate them + if (start < 0) { + start = fT0s[0]+5; + cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** data range was not provided, will try data range start = t0+5 = " << start << "."; + cerr << endl << "NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + cerr << endl; + } + if (end < 0) { + end = runData->GetDataBin(histoNo)->size(); + cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** data range was not provided, will try data range end = " << end << "."; + cerr << endl << "NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + cerr << endl; + } + // check if start, end, and t0 make any sense // 1st check if start and end are in proper order if (end < start) { // need to swap them @@ -564,6 +578,14 @@ Bool_t PRunSingleHisto::PrepareRawViewData(PRawRunData* runData, const UInt_t hi Int_t start = fRunInfo->GetDataRange(0) - (fRunInfo->GetDataRange(0)/packing)*packing; // end = last bin starting from start which is a multipl of packing and still within the data Int_t end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing; + // check if data range has been provided, and if not try to estimate them + if (start < 0) { + start = (fT0s[0]+5) - ((fT0s[0]+5)/packing)*packing; + end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing; + cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** data range was not provided, will try data range start = " << start << "."; + cerr << endl << "NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + cerr << endl; + } // check if start, end, and t0 make any sense // 1st check if start and end are in proper order if (end < start) { // need to swap them @@ -729,6 +751,15 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo // end = last bin starting from start which is a multiple of packing and still within the data Int_t end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing; + // check if data range has been provided, and if not try to estimate them + if (start < 0) { + start = (fT0s[0]+5) - ((fT0s[0]+5)/packing)*packing; + end = start + ((runData->GetDataBin(histoNo)->size()-start)/packing)*packing; + cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** data range was not provided, will try data range start = " << start << "."; + cerr << endl << "NO WARRANTY THAT THIS DOES MAKE ANY SENSE."; + cerr << endl; + } + // check if start, end, and t0 make any sense // 1st check if start and end are in proper order if (end < start) { // need to swap them