ATLAS Offline Software
BaseLinearFakeBkgTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 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 #include <memory>
21 #include <functional>
22 
23 namespace FakeBkgTools
24 {
26  struct ParticleData;
27  class FinalState;
28  class Database;
29  struct Weight;
30  struct Yield;
31  enum class Client;
32 }
33 
34 namespace CP
35 {
36 
37 /*
38  * Base class of concrete tools implementations, providing common helper methods
39  */
41 #ifndef FAKEBKGTOOLS_ATLAS_ENVIRONMENT
42  , public FakeBkgTools::ExtraPropertyManager<BaseLinearFakeBkgTool, BaseFakeBkgTool>
43 #endif
44 {
45  public:
46 
47  BaseLinearFakeBkgTool(const std::string& toolname);
48  virtual ~BaseLinearFakeBkgTool();
49 
50  virtual StatusCode initialize() override;
51 
52  virtual StatusCode getEventWeight(float& weight, const std::string& selection, const std::string& process) override final;
53 
54  virtual StatusCode getTotalYield(float& yield, float& statErrorUp, float& statErrorDown) override final;
55 
56  virtual StatusCode register1DHistogram(TH1* h1, const float *val) override;
57  virtual StatusCode register2DHistogram(TH2* h2, const float *xval, const float *yval) override;
58  virtual StatusCode register3DHistogram(TH3* h3, const float *xval, const float *yval, const float *zval) override;
59 
61 
62  virtual StatusCode saveProgress(TDirectory* dir) override;
63 
64  protected:
65 
66  #ifndef __CLING__
67  std::vector<FakeBkgTools::Yield> m_yields;
69 
72  std::map<FakeBkgTools::FinalState, FakeBkgTools::Weight> m_cachedWeights;
73  #else
74  std::vector<int> m_yields;
75  std::map<int,int> m_cachedWeights;
76  #endif
77 
78  std::map<TH1*, std::pair<uint32_t, uint32_t>> m_histogramYieldsRange;
79 
82 
84 
85  private:
86 
87  StatusCode getEventWeightCommon(FakeBkgTools::Weight& weight, const std::string& selection, const std::string& process);
88 
90 
91 };
92 
93 }
94 
95 #endif
CP::BaseLinearFakeBkgTool::incrementTotalYield
StatusCode incrementTotalYield()
be sure to only call this once per event! (typically at the end of addEvent())
Definition: BaseLinearFakeBkgTool.cxx:104
CP::BaseFakeBkgTool
Definition: BaseFakeBkgTool.h:42
python.exampleDriverScript.Database
Database
Definition: exampleDriverScript.py:28
IParticle.h
FakeBkgTools::Client
Client
Definition: FakeBkgInternals.h:141
CP::BaseLinearFakeBkgTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: BaseLinearFakeBkgTool.cxx:41
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
CP::BaseLinearFakeBkgTool::getEventWeight
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.
Definition: BaseLinearFakeBkgTool.cxx:46
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::BaseLinearFakeBkgTool::m_histogramYieldsRange
std::map< TH1 *, std::pair< uint32_t, uint32_t > > m_histogramYieldsRange
Definition: BaseLinearFakeBkgTool.h:78
SUSY_SimplifiedModel_PostInclude.process
string process
Definition: SUSY_SimplifiedModel_PostInclude.py:42
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:200
CP::BaseLinearFakeBkgTool::mergeSubjobs
StatusCode mergeSubjobs()
Definition: BaseLinearFakeBkgTool.cxx:229
CP::BaseLinearFakeBkgTool::~BaseLinearFakeBkgTool
virtual ~BaseLinearFakeBkgTool()
Definition: BaseLinearFakeBkgTool.cxx:37
CP::BaseLinearFakeBkgTool::register2DHistogram
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 ...
Definition: BaseLinearFakeBkgTool.cxx:135
CP::BaseLinearFakeBkgTool::register3DHistogram
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
Definition: BaseLinearFakeBkgTool.cxx:142
FakeBkgTools
Definition: BaseFakeBkgTool.h:21
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ILinearFakeBkgTool.h
TH3
Definition: rootspy.cxx:440
CP::BaseLinearFakeBkgTool::assignYieldRange
StatusCode assignYieldRange(TH1 *h)
Definition: BaseLinearFakeBkgTool.cxx:149
plotting.yearwise_efficiency.yval
float yval
Definition: yearwise_efficiency.py:43
BaseFakeBkgTool.h
CP::BaseLinearFakeBkgTool
Definition: BaseLinearFakeBkgTool.h:44
plotting.yearwise_efficiency.xval
float xval
Definition: yearwise_efficiency.py:42
selection
std::string selection
Definition: fbtTestBasics.cxx:73
TH2
Definition: rootspy.cxx:373
beamspotman.dir
string dir
Definition: beamspotman.py:623
python.hypoToolDisplay.toolname
def toolname(tool)
Definition: hypoToolDisplay.py:13
FakeBkgTools::Weight
a structure to hold a weight together with a variable number of systematic uncertainties
Definition: FakeBkgInternals.h:62
CP::ILinearFakeBkgTool
Interface for the tools providing an estimate of the fake lepton background, which are able to provid...
Definition: ILinearFakeBkgTool.h:17
FakeBkgTools::FinalState
Definition: FakeBkgInternals.h:98
CP::BaseLinearFakeBkgTool::register1DHistogram
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 ...
Definition: BaseLinearFakeBkgTool.cxx:128
h
CP::BaseLinearFakeBkgTool::getEventWeightCommon
StatusCode getEventWeightCommon(FakeBkgTools::Weight &weight, const std::string &selection, const std::string &process)
Definition: BaseLinearFakeBkgTool.cxx:54
CP::BaseLinearFakeBkgTool::getEventWeightCustom
virtual StatusCode getEventWeightCustom(FakeBkgTools::Weight &weight, const FakeBkgTools::FinalState &fs)=0
CP::BaseLinearFakeBkgTool::getTotalYield
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...
Definition: BaseLinearFakeBkgTool.cxx:77
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
TH1
Definition: rootspy.cxx:268
CP::BaseLinearFakeBkgTool::BaseLinearFakeBkgTool
BaseLinearFakeBkgTool(const std::string &toolname)
Definition: BaseLinearFakeBkgTool.cxx:30
Herwig7_QED_EvtGen_ll.fs
dictionary fs
Definition: Herwig7_QED_EvtGen_ll.py:17
CP::BaseLinearFakeBkgTool::saveProgress
virtual StatusCode saveProgress(TDirectory *dir) override
Definition: BaseLinearFakeBkgTool.cxx:168
CP::BaseLinearFakeBkgTool::m_yields
std::vector< FakeBkgTools::Yield > m_yields
accumulated yield for all events (and histogram bins with uncertainties)
Definition: BaseLinearFakeBkgTool.h:68
AsgTool.h
CP::BaseLinearFakeBkgTool::m_cachedWeights
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 ...
Definition: BaseLinearFakeBkgTool.h:72