From e36bb78246346a8311dd44054e58609c22db8488 Mon Sep 17 00:00:00 2001 From: Sasha Glazov <glazov@mail.desy.de> Date: Tue, 11 Dec 2018 13:22:53 +0100 Subject: [PATCH] New flag for datasets ForceAdditive to force all systematic uncertainties to be additive --- include/indata.inc | 4 ++++ src/GetChisquare.f | 11 ++++++++++- src/read_data.f | 8 +++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/include/indata.inc b/include/indata.inc index 4e7f0a38f..af588ef3f 100644 --- a/include/indata.inc +++ b/include/indata.inc @@ -26,6 +26,10 @@ C !> New definition of stat. and uncor uncertainties: common/CUncErrors/e_stat_poisson,e_stat_const, $ e_uncor_poisson, e_uncor_const, e_uncor_mult, e_uncor_logNorm +C !> Force additive errors for a given data point: + logical LForceAdditiveData(NTOT) + common/cForceAdditive/LForceAdditiveData + C SG: Abstract binning: double precision AbstractBins(NBinDimensionMax,NTOT) diff --git a/src/GetChisquare.f b/src/GetChisquare.f index de2245c1f..54ef8f43a 100644 --- a/src/GetChisquare.f +++ b/src/GetChisquare.f @@ -508,6 +508,7 @@ c#include "steering.inc" integer i1,j1,i,j,k integer scaling_type double precision scale + logical lfirstPass/.true./ C----------------------------------------------------- do k=1,NSYS scaling_type = SysScalingType(k) @@ -515,8 +516,15 @@ C----------------------------------------------------- do i1=1,n_syst_meas(k) i = syst_meas_idx(i1,k) - if (scaling_type.eq. isNoRescale) then + if ( (scaling_type.eq. isNoRescale) + $ .or. LForceAdditiveData(i) ! force additive scaling for all syst. sources for this datapoint + $ ) then scale = daten(i) + if ( LForceAdditiveData(i) .and. k.eq.1 + $ .and. lfirstPass) then + call hf_errlog(2018121101, + $ 'I: Force additive systematics for a datapoint') + endif elseif (scaling_type.eq. isLinear) then scale = theo(i) elseif (scaling_type.eq. isPoisson) then @@ -533,6 +541,7 @@ C----------------------------------------------------- ScaledOmega(k,i) = omega(k,i)*scale enddo enddo + lfirstPass = .false. C----------------------------------------------------- end diff --git a/src/read_data.f b/src/read_data.f index 9f6dfc82c..e72be26a5 100644 --- a/src/read_data.f +++ b/src/read_data.f @@ -264,6 +264,7 @@ C Extra info about k-factors, applegrid file(s): C Infomation for open more than 1 applgrid C character*80 applgridNames(NapplgridMax) integer NTheoryFiles + logical ForceAdditive ! force all errors to be treated as additive C Namelist definition: namelist/Data/Name,NData $ ,NInfo,datainfo,CInfo,Reaction,Percent @@ -271,7 +272,7 @@ C Namelist definition: $ ,TheoryInfoFile,TheoryType,KFactorNames,NKFactor $ ,TermName,TermType,TermInfo, TermSource,TheorExpr $ ,ColumnName, ColumnType, NColumn - $ ,NTheoryFiles + $ ,NTheoryFiles, ForceAdditive namelist/PlotDesc/PlotN, PlotDefColumn, PlotDefValue, $ PlotVarColumn, PlotOptions @@ -377,7 +378,7 @@ c double precision PlotDefValue(ncolumnMax) PlotDefTitle(1)='undefined' PlotVarColumn='undefined' - + ForceAdditive = .false. C Reset scales to 1.0 do i=1,nsysmax @@ -859,7 +860,8 @@ C XXXXXXXXXXXXXXXXXXXXXXXXX Call SetUncorErrors(npoints, StatError, $ StatErrorConst,UncorError,UncorConstError) - + LForceAdditiveData(npoints) = ForceAdditive + ! Check total error if (TotalErrorRead.ne.0) then if ( abs(TotalError -TotalErrorRead)/TotalErrorRead.gt.0.01) then -- GitLab