ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
FakeBkgTools::Weight Struct Reference

a structure to hold a weight together with a variable number of systematic uncertainties More...

#include <FakeBkgInternals.h>

Inheritance diagram for FakeBkgTools::Weight:
Collaboration diagram for FakeBkgTools::Weight:

Public Member Functions

float syst () const
 Helper function to extract the total systematic uncertainty from the 'uncertainties' field; it is computed as the quadratic sum of all symmetrized uncertainties. More...
 
float value (const CP::BaseFakeBkgTool *tool) const
 
Efficiencyadd (const Efficiency &rhs, float weight=1.f)
 key = source of uncertainty (ID), value = up/down More...
 
Efficiencymultiply (const Efficiency &rhs, float weight=1.f)
 the first version of multiply() takes the product of two Efficiencies, setting the up and down variations for each uncertainty to give the correct variation for the product More...
 
Efficiencymultiply (float weight)
 
EfficiencysetToConst (float value=1.f)
 setToConst() sets the nominal and all varied values to the same constant More...
 
EfficiencysubFromOne ()
 subFromOne() sets nominal and varied values to 1 - previous value. More...
 

Public Attributes

float nominal = 0
 
std::map< uint16_t, FakeBkgTools::Uncertaintyuncertainties
 

Detailed Description

a structure to hold a weight together with a variable number of systematic uncertainties

Definition at line 61 of file FakeBkgInternals.h.

Member Function Documentation

◆ add()

Efficiency & FakeBkgTools::Efficiency::add ( const Efficiency rhs,
float  weight = 1.f 
)
inlineinherited

key = source of uncertainty (ID), value = up/down

add() treats systematic uncertainties as correlated and updates (or creates) the total statistical uncertainty (RMS)

Systematic uncertainties

Central value

Definition at line 208 of file FakeBkgInternals.h.

209 {
211  for(auto& kv : rhs.uncertainties)
212  {
213  auto r = uncertainties.emplace(kv);
214  if(r.second) r.first->second *= weight;
215  else r.first->second += weight * kv.second;
216  }
218  nominal += weight * rhs.nominal;
219  return *this;
220 }

◆ multiply() [1/2]

Efficiency & FakeBkgTools::Efficiency::multiply ( const Efficiency rhs,
float  weight = 1.f 
)
inlineinherited

the first version of multiply() takes the product of two Efficiencies, setting the up and down variations for each uncertainty to give the correct variation for the product

Systematic uncertainties

Central value

Definition at line 222 of file FakeBkgInternals.h.

223 {
225  for(auto& kv : rhs.uncertainties)
226  {
227  auto r = uncertainties.emplace(kv);
228  if(!r.second) {
229  Uncertainty u_init = r.first->second;
230  r.first->second = nominal*kv.second;
231  r.first->second += (rhs.nominal*u_init);
232  r.first->second += (u_init*=kv.second);
233  }
234  }
236  nominal *= weight * rhs.nominal;
237  return *this;
238 }

◆ multiply() [2/2]

Efficiency & FakeBkgTools::Efficiency::multiply ( float  weight)
inlineinherited

Systematic uncertainties

Central value

Definition at line 240 of file FakeBkgInternals.h.

241 {
243  for(auto& kv : uncertainties)
244  {
245  kv.second*= weight;
246  }
248  nominal *= weight;
249  return *this;
250 }

◆ setToConst()

Efficiency & FakeBkgTools::Efficiency::setToConst ( float  value = 1.f)
inlineinherited

setToConst() sets the nominal and all varied values to the same constant

Systematic uncertainties

Central value

Definition at line 252 of file FakeBkgInternals.h.

253 {
255  for(auto& kv : uncertainties)
256  {
257  kv.second.up = 0.;
258  kv.second.down = 0.;
259  }
261  nominal = val;
262  return *this;
263 }

◆ subFromOne()

Efficiency & FakeBkgTools::Efficiency::subFromOne ( )
inlineinherited

subFromOne() sets nominal and varied values to 1 - previous value.

Systematic uncertainties

Central value

Definition at line 265 of file FakeBkgInternals.h.

266 {
268  for(auto& kv : uncertainties)
269  {
270  kv.second.up = -kv.second.up;
271  kv.second.down = -kv.second.down;
272  }
274  nominal = 1.-nominal;;
275  return *this;
276 }

◆ syst()

float FakeBkgTools::Weight::syst ( ) const
inline

Helper function to extract the total systematic uncertainty from the 'uncertainties' field; it is computed as the quadratic sum of all symmetrized uncertainties.

Definition at line 166 of file FakeBkgInternals.h.

167 {
168  double syst2 = 0;
169  for(auto& kv : uncertainties) syst2 += std::pow(0.5*(kv.second.up+kv.second.down), 2);
170  return sqrt(syst2);
171 }

◆ value()

float Efficiency::value ( const CP::BaseFakeBkgTool tool) const
inherited

Definition at line 17 of file FakeBkgInternals.cxx.

18 {
19  float val = nominal;
20  for(const auto* su = tool->m_selectedUncertainties; su; su = su->next())
21  {
22  auto unc = uncertainties.find(su->UID);
23  if(unc != uncertainties.end())
24  {
25  val += su->sigma * ((su->sigma>=0)? unc->second.up : unc->second.down);
26  }
27  }
28  return val;
29 }

Member Data Documentation

◆ nominal

float FakeBkgTools::Efficiency::nominal = 0
inherited

Definition at line 42 of file FakeBkgInternals.h.

◆ uncertainties

std::map<uint16_t, FakeBkgTools::Uncertainty> FakeBkgTools::Efficiency::uncertainties
inherited

Definition at line 43 of file FakeBkgInternals.h.


The documentation for this struct was generated from the following file:
beamspotman.r
def r
Definition: beamspotman.py:676
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
Analysis::Uncertainty
Uncertainty
specification of type information requested by the user
Definition: CalibrationDataInterfaceROOT.h:70
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
FakeBkgTools::Efficiency::nominal
float nominal
Definition: FakeBkgInternals.h:42
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
FakeBkgTools::Efficiency::uncertainties
std::map< uint16_t, FakeBkgTools::Uncertainty > uncertainties
Definition: FakeBkgInternals.h:43