ATLAS Offline Software
Loading...
Searching...
No Matches
FakeBkgTools::Efficiency Struct Reference

a structure to hold an efficiency together with a variable number of uncertainties More...

#include <FakeBkgInternals.h>

Inheritance diagram for FakeBkgTools::Efficiency:
Collaboration diagram for FakeBkgTools::Efficiency:

Public Member Functions

float value (const CP::BaseFakeBkgTool *tool) const
Efficiencyadd (const Efficiency &rhs, float weight=1.f)
 key = source of uncertainty (ID), value = up/down
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
Efficiencymultiply (float weight)
EfficiencysetToConst (float value=1.f)
 setToConst() sets the nominal and all varied values to the same constant
EfficiencysubFromOne ()
 subFromOne() sets nominal and varied values to 1 - previous value.

Public Attributes

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

Detailed Description

a structure to hold an efficiency together with a variable number of uncertainties

Definition at line 39 of file FakeBkgInternals.h.

Member Function Documentation

◆ add()

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

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}
int r
Definition globals.cxx:22
std::map< uint16_t, FakeBkgTools::Uncertainty > uncertainties
std::map< uint16_t, FakeBkgTools::Uncertainty > uncertainties

◆ multiply() [1/2]

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

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}
Uncertainty
specification of type information requested by the user

◆ multiply() [2/2]

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

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)
inline

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 ( )
inline

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}

◆ value()

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

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

Definition at line 42 of file FakeBkgInternals.h.

◆ uncertainties

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

Definition at line 43 of file FakeBkgInternals.h.


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