Public Member Functions | Protected Attributes | List of all members
ana::SummedSyst Class Reference

Generic way to add systematics in quadrature. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-28/CAFAna/Systs/SummedSysts.h"

Inheritance diagram for ana::SummedSyst:
ana::ISyst

Public Member Functions

 SummedSyst (std::vector< const ISyst * > systs, const std::string shortname, const std::string latexname)
 
virtual ~SummedSyst ()
 
void Shift (double sigma, caf::SRProxy *sr, double &weight) const override
 Perform the systematic shift. More...
 
bool IsGenieReweight () const override
 GENIE reweights can only provide +/-1,2sigma. More...
 
virtual const std::stringShortName () const final
 The name printed out to the screen. More...
 
virtual const std::stringLatexName () const final
 The name used on plots (ROOT's TLatex syntax) More...
 
virtual void TruthShift (double sigma, caf::SRNeutrinoProxy *nu, double &weight) const
 

Protected Attributes

std::vector< const ISyst * > fSysts
 

Detailed Description

Generic way to add systematics in quadrature.

Definition at line 12 of file SummedSysts.h.

Constructor & Destructor Documentation

ana::SummedSyst::SummedSyst ( std::vector< const ISyst * >  systs,
const std::string  shortname,
const std::string  latexname 
)

Definition at line 11 of file SummedSysts.cxx.

13  :
14  ISyst(shortname, latexname),
15  fSysts(systs)
16  {
17  }
std::vector< SystGroupDef > systs
Definition: syst_header.h:385
std::vector< const ISyst * > fSysts
Definition: SummedSysts.h:27
ISyst(const std::string &shortName, const std::string &latexName)
Definition: ISyst.cxx:10
virtual ana::SummedSyst::~SummedSyst ( )
inlinevirtual

Definition at line 19 of file SummedSysts.h.

References Shift(), sigma(), sr, and ana::weight.

19 {}

Member Function Documentation

bool ana::SummedSyst::IsGenieReweight ( ) const
inlineoverridevirtual

GENIE reweights can only provide +/-1,2sigma.

Reimplemented from ana::ISyst.

Definition at line 24 of file SummedSysts.h.

24 {return false;}
virtual const std::string& ana::ISyst::LatexName ( ) const
inlinefinalvirtualinherited

The name used on plots (ROOT's TLatex syntax)

Definition at line 30 of file ISyst.h.

References ana::ISyst::fLatexName, ana::ISyst::Shift(), sigma(), sr, and ana::weight.

Referenced by ana::PredictionInterp::DebugPlotColz(), GetGENIEShiftLabels(), ana::NuISyst::SaveTo(), SystsGENIEAna(), and WriteSystName().

30 {return fLatexName;}
std::string fLatexName
Definition: ISyst.h:60
void ana::SummedSyst::Shift ( double  sigma,
caf::SRProxy sr,
double &  weight 
) const
overridevirtual

Perform the systematic shift.

Override this function if your systematic depends on non-SRNeutrino quantities. If it is SRNeutrino-only, implement the other function, and let this default forward to you when necessary.

Parameters
sigmaNumber of sigma to shift record by
srThe record to inspect and alter
weightScale this weight for reweighting systematics

Reimplemented from ana::ISyst.

Definition at line 20 of file SummedSysts.cxx.

References fSysts, std::max(), std::min(), runNovaSAM::ret, canMan::sign(), util::sqr(), std::sqrt(), and w.

Referenced by ~SummedSyst().

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  }
T max(const caf::Proxy< T > &a, T b)
const Var weight
T sqrt(T number)
Definition: d0nt_math.hpp:156
T sqr(T x)
More efficient square function than pow(x,2)
Definition: MathUtil.h:23
std::vector< const ISyst * > fSysts
Definition: SummedSysts.h:27
double sigma(TH1F *hist, double percentile)
T min(const caf::Proxy< T > &a, T b)
Float_t w
Definition: plot.C:20
def sign(x)
Definition: canMan.py:197
virtual const std::string& ana::ISyst::ShortName ( ) const
inlinefinalvirtualinherited
virtual void ana::ISyst::TruthShift ( double  sigma,
caf::SRNeutrinoProxy nu,
double &  weight 
) const
inlinevirtualinherited

For systematics that deal only with the neutrino truth and not any reconstruction/PID details. Systematics defined this way will work on nuTree-derived spectra too (e.g. denominators of efficiencies).

Reimplemented in demo::DemoSyst1, ana::BeamSyst, ana::GenericSystComponentScale< T >, ana::GenericSystComponentScale< T >, ana::GenericSystComponentScale< T >, and ana::NOvARwgtSyst.

Definition at line 46 of file ISyst.h.

Referenced by ana::ISyst::Shift().

49  {
50  // Implement this function if your systematic depends only
51  // SRNeutrino. Left blank by default, since systematics using other
52  // information can do nothing sensible to the nuTree.
53  }

Member Data Documentation

std::vector<const ISyst*> ana::SummedSyst::fSysts
protected

Definition at line 27 of file SummedSysts.h.

Referenced by Shift().


The documentation for this class was generated from the following files: