ATLAS Offline Software
Loading...
Searching...
No Matches
APWeightSum.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6
17
18#ifndef APWeightSum_h
19#define APWeightSum_h
20
21#include "TNamed.h"
22#include "APEvtWeight.h"
23#include <vector>
24
25class APWeightEntry;
26class APReweightBase;
27class THnSparse;
28
29class APWeightSum : public TNamed {
30
31public:
32 APWeightSum();
33 virtual ~APWeightSum();
34 void AddWeightToEvt(APWeightEntry* weight);
35 void FinishEvt(double ext_weight = 1.0);
36 void AddEvt(APEvtWeight* evt_weight, double ext_weight = 1.0);
37
38 double GetSumW() const;
39 double GetSumW2() const;
40 double GetSumWExternal() const;
41 double GetStdDev();
42 double GetVariance();
43 double GetVarianceNoCorr();
44 double GetVarianceFullCorr();
45 double GetSysUncert() const;
46
47 unsigned long GetKUnweighted() const;
48
49 THnSparse* GetUncertHistogram( APReweightBase* weighter );
50 const std::vector<THnSparse*> & GetAllUncertHistograms();
51
52 ClassDef(APWeightSum,1)
53
54protected:
55 void Compute();
56
57 std::vector< APWeightEntry* > m_current_evt_weights;
58 std::vector< THnSparse* > m_linear_uncert;
59 unsigned long int m_k_evt_orig;
63 double m_variance;
68};
69
70#endif
Class to calculate the sum of weights ("weighted counter")
Definition APEvtWeight.h:26
Class to provide common methods for all Reweight classes.
Class to store a single weight entry (one bin).
double m_k_evt_weight
Holds the sum of weights.
Definition APWeightSum.h:60
double GetSumW2() const
Returns sum of (weights^2).
double m_k_evt_weight_external
Holds the sum of external weights (no trigger weighting).
Definition APWeightSum.h:62
void AddEvt(APEvtWeight *evt_weight, double ext_weight=1.0)
Adds an event with an externally calculated EvtWeight object.
double GetVarianceFullCorr()
Returns the variance, assuming full correlation amongst objects.
double GetVariance()
Returns the variance.
double GetSumWExternal() const
Returns the sum of weights without taking into account the trigger weighting (external weights only) ...
double GetVarianceNoCorr()
Returns the variance, assuming no correlations.
unsigned long int m_k_evt_orig
Holds the original amount of unweighted counts ("sum of 1's").
Definition APWeightSum.h:59
THnSparse * GetUncertHistogram(APReweightBase *weighter)
Returns THnSparse holding the uncertainties for given APReweightBase instance.
double m_variance
Holds the variance.
Definition APWeightSum.h:63
double m_variance_sys
Holds the systematic variance (from systematics assigned to weights).
Definition APWeightSum.h:66
virtual ~APWeightSum()
Default destructor.
bool m_isComputed
Definition APWeightSum.h:67
double GetStdDev()
Returns the standard deviation.
double m_variance_fullcorr
Holds the variance, assuming full correlation amongst objects.
Definition APWeightSum.h:65
double m_k_evt_weight2
Holds the sum of squared weights.
Definition APWeightSum.h:61
double m_variance_nocorr
Holds the variance, assuming no correlations.
Definition APWeightSum.h:64
unsigned long GetKUnweighted() const
Returns the unweighted sum of entries.
void AddWeightToEvt(APWeightEntry *weight)
Adds a weight to the sum of weights.
std::vector< THnSparse * > m_linear_uncert
Holds all histograms for uncertainties.
Definition APWeightSum.h:58
double GetSysUncert() const
Returns the systematic uncertainty (from systematics assigned to weights).
double GetSumW() const
Returns the sum of weights.
void FinishEvt(double ext_weight=1.0)
Finishes the current event and calculates the event weight.
APWeightSum()
Default constructor.
ClassDef(APWeightSum, 1) protected std::vector< APWeightEntry * > m_current_evt_weights
< Calculates the final uncertainties including correlations.
Definition APWeightSum.h:52
const std::vector< THnSparse * > & GetAllUncertHistograms()
Returns vector of THnSparses holding the uncertainties for all APReweight IDs.