@@ -148,7 +148,6 @@ MnUserParameterState::MnUserParameterState(const MinimumState &st, double up, co
148
148
fIntCovariance =
149
149
MnUserCovariance ({st.Error ().InvHessian ().Data (), st.Error ().InvHessian ().size ()}, st.Error ().InvHessian ().Nrow ());
150
150
fCovariance .Scale (2 . * up);
151
- fGlobalCC = MnGlobalCorrelationCoeff (st.Error ().InvHessian ());
152
151
153
152
assert (fCovariance .Nrow () == VariableParameters ());
154
153
@@ -219,7 +218,6 @@ void MnUserParameterState::Add(const std::string &name, double val, double err)
219
218
if (fParameters .Add (name, val, err)) {
220
219
fIntParameters .push_back (val);
221
220
fCovarianceValid = false ;
222
- fGlobalCC = MnGlobalCorrelationCoeff{}; // invalidate
223
221
fValid = true ;
224
222
} else {
225
223
// redefine an existing parameter
@@ -244,7 +242,6 @@ void MnUserParameterState::Add(const std::string &name, double val, double err,
244
242
if (fParameters .Add (name, val, err, low, up)) {
245
243
fCovarianceValid = false ;
246
244
fIntParameters .push_back (Ext2int (Index (name), val));
247
- fGlobalCC = MnGlobalCorrelationCoeff{}; // invalidate
248
245
fValid = true ;
249
246
} else { // Parameter already exist - just set values
250
247
int i = Index (name);
@@ -317,7 +314,6 @@ void MnUserParameterState::Fix(unsigned int e)
317
314
fIntParameters .erase (fIntParameters .begin () + i, fIntParameters .begin () + i + 1 );
318
315
}
319
316
fParameters .Fix (e);
320
- fGlobalCC = MnGlobalCorrelationCoeff{}; // invalidate
321
317
}
322
318
323
319
void MnUserParameterState::Release (unsigned int e)
@@ -328,7 +324,6 @@ void MnUserParameterState::Release(unsigned int e)
328
324
return ;
329
325
fParameters .Release (e);
330
326
fCovarianceValid = false ;
331
- fGlobalCC = MnGlobalCorrelationCoeff{}; // invalidate
332
327
unsigned int i = IntOfExt (e);
333
328
if (Parameter (e).HasLimits ())
334
329
fIntParameters .insert (fIntParameters .begin () + i, Ext2int (e, Parameter (e).Value ()));
@@ -360,7 +355,6 @@ void MnUserParameterState::SetLimits(unsigned int e, double low, double up)
360
355
// set limits for parameter e (external index)
361
356
fParameters .SetLimits (e, low, up);
362
357
fCovarianceValid = false ;
363
- fGlobalCC = MnGlobalCorrelationCoeff{}; // invalidate
364
358
if (!Parameter (e).IsFixed () && !Parameter (e).IsConst ()) {
365
359
unsigned int i = IntOfExt (e);
366
360
if (low < fIntParameters [i] && fIntParameters [i] < up)
@@ -377,7 +371,6 @@ void MnUserParameterState::SetUpperLimit(unsigned int e, double up)
377
371
// set upper limit for parameter e (external index)
378
372
fParameters .SetUpperLimit (e, up);
379
373
fCovarianceValid = false ;
380
- fGlobalCC = MnGlobalCorrelationCoeff{}; // invalidate
381
374
if (!Parameter (e).IsFixed () && !Parameter (e).IsConst ()) {
382
375
unsigned int i = IntOfExt (e);
383
376
if (fIntParameters [i] < up)
@@ -392,7 +385,6 @@ void MnUserParameterState::SetLowerLimit(unsigned int e, double low)
392
385
// set lower limit for parameter e (external index)
393
386
fParameters .SetLowerLimit (e, low);
394
387
fCovarianceValid = false ;
395
- fGlobalCC = MnGlobalCorrelationCoeff{}; // invalidate
396
388
if (!Parameter (e).IsFixed () && !Parameter (e).IsConst ()) {
397
389
unsigned int i = IntOfExt (e);
398
390
if (low < fIntParameters [i])
@@ -407,7 +399,6 @@ void MnUserParameterState::RemoveLimits(unsigned int e)
407
399
// remove limit for parameter e (external index)
408
400
fParameters .RemoveLimits (e);
409
401
fCovarianceValid = false ;
410
- fGlobalCC = MnGlobalCorrelationCoeff{}; // invalidate
411
402
if (!Parameter (e).IsFixed () && !Parameter (e).IsConst ())
412
403
fIntParameters [IntOfExt (e)] = Value (e);
413
404
}
@@ -531,6 +522,21 @@ void MnUserParameterState::SetPrecision(double eps)
531
522
fParameters .SetPrecision (eps);
532
523
}
533
524
525
+ MnGlobalCorrelationCoeff MnUserParameterState::GlobalCC () const
526
+ {
527
+ if (!fCovarianceValid ) {
528
+ return MnGlobalCorrelationCoeff{}; // invalidate
529
+ }
530
+ int n = fIntCovariance .Nrow ();
531
+ MnAlgebraicSymMatrix invHessian{static_cast <unsigned int >(n)};
532
+ for (int i = 0 ; i < n; ++i) {
533
+ for (int j = 0 ; j <= i; ++j) {
534
+ invHessian (i, j) = fIntCovariance (i, j);
535
+ }
536
+ }
537
+ return MnGlobalCorrelationCoeff{invHessian};
538
+ }
539
+
534
540
} // namespace Minuit2
535
541
536
542
} // namespace ROOT
0 commit comments