formatting issue for high field muSR (MUSR-164)
This commit is contained in:
parent
a406219826
commit
ade1f49d96
@ -838,6 +838,8 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
fout.width(8);
|
||||
fout.precision(NeededPrecision(fRuns[runNo].GetFitRange(j)));
|
||||
fout << left << fixed << fRuns[runNo].GetFitRange(j);
|
||||
if (j==0)
|
||||
fout << " ";
|
||||
}
|
||||
fout << endl;
|
||||
} else if (sstr.BeginsWith("packing")) {
|
||||
@ -941,10 +943,17 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
||||
fout << endl;
|
||||
} else if (sstr.BeginsWith("range")) {
|
||||
fout << "range ";
|
||||
fout.precision(2);
|
||||
fout << fPlots[plotNo].fTmin[0] << " " << fPlots[plotNo].fTmax[0];
|
||||
fout.precision(NeededPrecision(fPlots[plotNo].fTmin[0]));
|
||||
fout << fPlots[plotNo].fTmin[0];
|
||||
fout << " ";
|
||||
fout.precision(NeededPrecision(fPlots[plotNo].fTmax[0]));
|
||||
fout << fPlots[plotNo].fTmax[0];
|
||||
if (fPlots[plotNo].fYmin.size() > 0) {
|
||||
fout << " " << fPlots[plotNo].fYmin[0] << " " << fPlots[plotNo].fYmax[0];
|
||||
fout << " ";
|
||||
fout.precision(NeededPrecision(fPlots[plotNo].fYmin[0]));
|
||||
fout << fPlots[plotNo].fYmin[0] << " ";
|
||||
fout.precision(NeededPrecision(fPlots[plotNo].fYmax[0]));
|
||||
fout << fPlots[plotNo].fYmax[0];
|
||||
}
|
||||
fout << endl;
|
||||
} else {
|
||||
@ -4668,7 +4677,7 @@ void PMsrHandler::CheckMaxLikelihood()
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Calculates the needed precision of Double_t values for WriteMsrLogFile and WriteMsrFile of the fit range.
|
||||
* If a precision of > 4 decimal places is needed, a warning is placed and a value of 4 is returned.
|
||||
* If a precision of > 6 decimal places is needed, a warning is placed and a value of 6 is returned.
|
||||
*
|
||||
* \param dval value for which the precision has to be estimated
|
||||
*
|
||||
@ -4679,20 +4688,24 @@ UInt_t PMsrHandler::NeededPrecision(Double_t dval)
|
||||
{
|
||||
UInt_t prec=0;
|
||||
|
||||
Int_t ival = static_cast<Int_t>(round(dval*1.0e4));
|
||||
Int_t ival = static_cast<Int_t>(round(dval*1.0e6));
|
||||
|
||||
if ((ival % 10) != 0)
|
||||
prec = 4;
|
||||
prec = 6;
|
||||
else if ((ival % 100) != 0)
|
||||
prec = 3;
|
||||
prec = 5;
|
||||
else if ((ival % 1000) != 0)
|
||||
prec = 2;
|
||||
prec = 4;
|
||||
else if ((ival % 10000) != 0)
|
||||
prec = 3;
|
||||
else if ((ival % 100000) != 0)
|
||||
prec = 2;
|
||||
else if ((ival % 1000000) != 0)
|
||||
prec = 1;
|
||||
else if (static_cast<Double_t>(ival)-dval*1.0e4 > 0.1) {
|
||||
else if (static_cast<Double_t>(ival)-dval*1.0e6 > 0.1) {
|
||||
prec = 4;
|
||||
cerr << endl << ">> PMsrHandler::NeededPrecision(): **WARNING** fit range value = " << dval << ", is asking for a rediculous resolution.";
|
||||
cerr << endl << ">> Will limit the precision to 4 decimal places, only." << endl;
|
||||
cerr << endl << ">> Will limit the precision to 6 decimal places, only." << endl;
|
||||
}
|
||||
|
||||
return prec;
|
||||
|
Loading…
x
Reference in New Issue
Block a user