SummedSysts.cxx
Go to the documentation of this file.
3 #include "Utilities/func/MathUtil.h"
4 #include <cmath>
5 #include <algorithm>
6 
7 namespace ana
8 {
9 
10  //----------------------------------------------------------------------
11  SummedSyst::SummedSyst(std::vector <const ISyst*> systs,
12  const std::string shortname,
13  const std::string latexname):
14  ISyst(shortname, latexname),
15  fSysts(systs)
16  {
17  }
18 
19  //----------------------------------------------------------------------
20  void SummedSyst::Shift(double sigma,
22  double& weight) const
23  {
24  double weightSum = 0;
25  for ( const auto& syst:fSysts )
26  {
27  double wPlus = 1;
28  double wMinus = 1;
29 
30  syst->Shift( +sigma, sr, wPlus);
31  syst->Shift( -sigma, sr, wMinus);
32 
33  double w = 1;
34  if( sigma > 0 )
35  w = std::max( std::max(wPlus - 1, wMinus - 1), 0.);
36  if( sigma < 0 )
37  w = std::min( std::min(wPlus - 1, wMinus - 1), 0.);
38 
39  weightSum += util::sqr(w);
40  }
41 
42  double sign = sigma > 0 ? +1 : -1;
43  double ret = 1 + sqrt(weightSum) * sign;
44 
45  if ( ret < 0. ) ret = 0.;
46  weight *= ret;
47 
48  }
49 
50 }
T max(const caf::Proxy< T > &a, T b)
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
const Var weight
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2038
T sqrt(T number)
Definition: d0nt_math.hpp:156
SummedSyst(std::vector< const ISyst * > systs, const std::string shortname, const std::string latexname)
Definition: SummedSysts.cxx:11
void Shift(double sigma, caf::SRProxy *sr, double &weight) const override
Perform the systematic shift.
Definition: SummedSysts.cxx:20
T sqr(T x)
More efficient square function than pow(x,2)
Definition: MathUtil.h:23
Encapsulate code to systematically shift a caf::SRProxy.
Definition: ISyst.h:14
std::vector< const ISyst * > fSysts
Definition: SummedSysts.h:27
double sigma(TH1F *hist, double percentile)
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
T min(const caf::Proxy< T > &a, T b)
Float_t w
Definition: plot.C:20
static constexpr Double_t sr
Definition: Munits.h:164
def sign(x)
Definition: canMan.py:197