prevent dynamic LF to allocate too much memory

This commit is contained in:
2012-08-28 11:23:59 +00:00
parent 807eb49456
commit be9457281d
2 changed files with 6 additions and 2 deletions

View File

@ -20,6 +20,7 @@ NEW 2012-04-24 added a first version for negative muon fitting. At the same
logx/logy handling). logx/logy handling).
FIXED 2012-05-30 fixed RRF bug in single histo plotting. FIXED 2012-05-30 fixed RRF bug in single histo plotting.
FIXED 2012-05-18 fixed wrong forward/backward tag for ROOT-PPC (MUSR-215) FIXED 2012-05-18 fixed wrong forward/backward tag for ROOT-PPC (MUSR-215)
CHANGED 2012-08-28 prevent LF from allocating too much memory
CHANGED 2012-06-29 changed handling of the timeout for musrfit. CHANGED 2012-06-29 changed handling of the timeout for musrfit.
CHANGED 2012-05-10 prevent any2many from overwriting an input file. At the CHANGED 2012-05-10 prevent any2many from overwriting an input file. At the
some additional bug fixing of any2many has be carried out. some additional bug fixing of any2many has be carried out.

View File

@ -2595,10 +2595,10 @@ void PTheory::CalculateDynKTLF(const Double_t *val, Int_t tag) const
Double_t tmin = 20.0; Double_t tmin = 20.0;
switch (tag) { switch (tag) {
case 0: // Gauss case 0: // Gauss
tmin = sqrt(3.0)/val[1]; tmin = fabs(sqrt(3.0)/val[1]);
break; break;
case 1: // Lorentz case 1: // Lorentz
tmin = 2.0/val[1]; tmin = fabs(2.0/val[1]);
break; break;
default: default:
break; break;
@ -2612,6 +2612,9 @@ void PTheory::CalculateDynKTLF(const Double_t *val, Int_t tag) const
if (N < 300) // if too few points, i.e. nu0 very small, take 300 points if (N < 300) // if too few points, i.e. nu0 very small, take 300 points
N = 300; N = 300;
if (N>1e6) // make sure that N is not too large to prevent memory overflow
N = 1e6;
// allocate memory for dyn KT LF function vector // allocate memory for dyn KT LF function vector
fDynLFFuncValue.clear(); // get rid of a possible previous vector fDynLFFuncValue.clear(); // get rid of a possible previous vector
fDynLFFuncValue.resize(N); fDynLFFuncValue.resize(N);