ATLAS Offline Software
Loading...
Searching...
No Matches
BaseLinearFakeBkgTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef BASE_LINEAR_FAKE_BKG_TOOL_H
6#define BASE_LINEAR_FAKE_BKG_TOOL_H
7
10
11#ifdef FAKEBKGTOOLS_ATLAS_ENVIRONMENT
12 #include "AsgTools/AsgTool.h"
13 #include "xAODBase/IParticle.h"
14#endif
15
16#include <string>
17#include <map>
18#include <set>
19#include <vector>
20
21namespace FakeBkgTools
22{
24 struct ParticleData;
25 class FinalState;
26 class Database;
27 struct Weight;
28 struct Yield;
29 enum class Client;
30}
31
32namespace CP
33{
34
35/*
36 * Base class of concrete tools implementations, providing common helper methods
37 */
39{
40 public:
41
42 BaseLinearFakeBkgTool(const std::string& toolname);
43 virtual ~BaseLinearFakeBkgTool();
44
45 virtual StatusCode initialize() override;
46
47 virtual StatusCode getEventWeight(float& weight, const std::string& selection, const std::string& process) override final;
48
49 virtual StatusCode getTotalYield(float& yield, float& statErrorUp, float& statErrorDown) override final;
50
51 virtual StatusCode register1DHistogram(TH1* h1, const float *val) override;
52 virtual StatusCode register2DHistogram(TH2* h2, const float *xval, const float *yval) override;
53 virtual StatusCode register3DHistogram(TH3* h3, const float *xval, const float *yval, const float *zval) override;
54
55 StatusCode assignYieldRange(TH1* h);
56
57 virtual StatusCode saveProgress(TDirectory* dir) override;
58
59 protected:
60
61 #ifndef __CLING__
63 std::vector<FakeBkgTools::Yield> m_yields;
64
67 std::map<FakeBkgTools::FinalState, FakeBkgTools::Weight> m_cachedWeights;
68 #else
69 std::vector<int> m_yields;
70 std::map<int,int> m_cachedWeights;
71 #endif
72
73 std::map<TH1*, std::pair<uint32_t, uint32_t>> m_histogramYieldsRange;
74
76 StatusCode incrementTotalYield();
77
79
80 private:
81
82 StatusCode getEventWeightCommon(FakeBkgTools::Weight& weight, const std::string& selection, const std::string& process);
83
84 StatusCode mergeSubjobs();
85
86};
87
88}
89
90#endif
static Double_t fs
Header file for AthHistogramAlgorithm.
BaseFakeBkgTool(const std::string &toolname)
virtual StatusCode getEventWeight(float &weight, const std::string &selection, const std::string &process) override final
returns an event weight addEvent() must have been called before hand.
std::vector< FakeBkgTools::Yield > m_yields
accumulated yield for all events (and histogram bins with uncertainties)
BaseLinearFakeBkgTool(const std::string &toolname)
virtual StatusCode register1DHistogram(TH1 *h1, const float *val) override
associates a 1D histogram to the tool, to obtain a binned estimate of the fake lepton background the ...
StatusCode incrementTotalYield()
be sure to only call this once per event! (typically at the end of addEvent())
virtual StatusCode register3DHistogram(TH3 *h3, const float *xval, const float *yval, const float *zval) override
associates a 3D histogram to the tool, to obtain a binned estimate of the fake lepton background the ...
virtual StatusCode getTotalYield(float &yield, float &statErrorUp, float &statErrorDown) override final
returns the accumulated fake lepton background yield (or compute it, in the case of the likelihood ma...
virtual StatusCode register2DHistogram(TH2 *h2, const float *xval, const float *yval) override
associates a 2D histogram to the tool, to obtain a binned estimate of the fake lepton background the ...
StatusCode getEventWeightCommon(FakeBkgTools::Weight &weight, const std::string &selection, const std::string &process)
std::map< TH1 *, std::pair< uint32_t, uint32_t > > m_histogramYieldsRange
virtual StatusCode saveProgress(TDirectory *dir) override
virtual StatusCode getEventWeightCustom(FakeBkgTools::Weight &weight, const FakeBkgTools::FinalState &fs)=0
std::map< FakeBkgTools::FinalState, FakeBkgTools::Weight > m_cachedWeights
cached weight+uncertainties for a single event Each tool derived from this base class MUST clear the ...
Interface for the tools providing an estimate of the fake lepton background, which are able to provid...
const std::string selection
const std::string process
Select isolated Photons, Electrons and Muons.
void ErrorHandler ATLAS_NOT_THREAD_SAFE(Int_t level, Bool_t abort, const char *location, const char *message)
Function filtering the warnings coming from ROOT.
Definition Init.cxx:105
void initialize()
a structure to hold a weight together with a variable number of systematic uncertainties
a structure to hold an event yield together with a statistical uncertainty and a variable number of s...