From c6b2c68b5b26e0ef6ca4b53ec95f1a6588ffd221 Mon Sep 17 00:00:00 2001
From: Ivan Novikov <novivanya@yandex.ru>
Date: Fri, 1 Feb 2019 12:21:13 +0100
Subject: [PATCH] Fix inconsistent treatment of uncertainties when using
 DataToTheo

---
 src/fcn.f | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/fcn.f b/src/fcn.f
index 171b65fa4..3f90725f5 100644
--- a/src/fcn.f
+++ b/src/fcn.f
@@ -412,9 +412,18 @@ c             call fillvfngrid
       endif
 
       if ( (IFlag.eq.1).and.(DataToTheo)) then
-         do i=1,npoints
-            daten(i) = theo(i)
-         enddo
+        !Copy theory to data
+        do i=1,npoints
+          daten(i)=theo(i)
+          !Update total uncorrelated uncertainty
+          alpha(i)=daten(i)*sqrt(
+     &      e_stat_poisson(i)**2+
+     &      e_stat_const(i)**2+   !Should I use e_stat_const or e_sta_const or e_sta? I am not sure... --Ivan
+     &      e_uncor_poisson(i)**2+
+     &      e_uncor_const(i)**2+  !or e_unc_const?
+     &      e_uncor_mult(i)**2+
+     &      e_uncor_logNorm(i)**2)
+        enddo
       endif
 
 *     ---------------------------------------------------------
-- 
GitLab