ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
AsgAnalysisAlgorithms
Root
FakeBkgCalculatorAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
#include "
AsgAnalysisAlgorithms/FakeBkgCalculatorAlg.h
"
8
#include "
AthContainers/ConstDataVector.h
"
9
10
namespace
CP
{
11
12
StatusCode
FakeBkgCalculatorAlg::initialize
() {
13
14
ANA_CHECK
(
m_electronsHandle
.initialize(
m_systematicsList
));
15
ANA_CHECK
(
m_electronSelection
.initialize(
m_systematicsList
,
m_electronsHandle
));
16
ANA_CHECK
(
m_electronSelectionTarget
.initialize(
m_systematicsList
,
m_electronsHandle
));
17
18
ANA_CHECK
(
m_muonsHandle
.initialize(
m_systematicsList
));
19
ANA_CHECK
(
m_muonSelection
.initialize(
m_systematicsList
,
m_muonsHandle
));
20
ANA_CHECK
(
m_muonSelectionTarget
.initialize(
m_systematicsList
,
m_muonsHandle
));
21
22
ANA_CHECK
(
m_eventInfoHandle
.initialize(
m_systematicsList
));
23
ANA_CHECK
(
m_preselection
.initialize(
m_systematicsList
,
m_eventInfoHandle
,
SG::AllowEmpty
));
24
25
ANA_CHECK
(
m_fakeTool
.retrieve());
26
ANA_CHECK
(
m_fakeToolOutput
.initialize(
m_systematicsList
,
m_eventInfoHandle
));
27
28
ANA_CHECK
(
m_systematicsList
.initialize());
29
30
return
StatusCode::SUCCESS;
31
}
32
33
StatusCode
FakeBkgCalculatorAlg::execute
(
const
EventContext& ctx) {
34
35
static
const
SG::Decorator<char>
dec_lepton_tight(
"TightForFakeBkgCalculation"
);
36
static
const
SG::Accessor<char>
flagAcc(
"TightForFakeBkgCalculation"
);
37
38
ANA_MSG_DEBUG
(
" ----> FakeBkgCalculatorAlg::execute()"
);
39
for
(
const
auto
&sys :
m_systematicsList
.systematicsVector()) {
40
const
xAOD::EventInfo
*evtInfo =
nullptr
;
41
const
xAOD::ElectronContainer
*electrons =
nullptr
;
42
const
xAOD::MuonContainer
*muons =
nullptr
;
43
44
ANA_CHECK
(
m_eventInfoHandle
.retrieve(evtInfo, sys, ctx));
45
46
m_fakeToolOutput
.set(*evtInfo, -1, sys);
// default value
47
if
(
m_preselection
&& !
m_preselection
.getBool(*evtInfo, sys))
continue
;
48
49
ANA_CHECK
(
m_electronsHandle
.retrieve(electrons, sys, ctx));
50
ANA_CHECK
(
m_muonsHandle
.retrieve(muons, sys, ctx));
51
52
ConstDataVector<xAOD::IParticleContainer>
leptons(
SG::VIEW_ELEMENTS
);
53
for
(
const
xAOD::Electron
*t : *electrons) {
54
if
(
m_electronSelection
&& !
m_electronSelection
.getBool(*t, sys))
continue
;
55
leptons.
push_back
(t);
56
dec_lepton_tight(*leptons.
back
()) =
m_electronSelectionTarget
.getBool(*t, sys);
57
}
58
for
(
const
xAOD::Muon
*t : *muons) {
59
if
(
m_muonSelection
&& !
m_muonSelection
.getBool(*t, sys))
continue
;
60
leptons.
push_back
(t);
61
dec_lepton_tight(*leptons.
back
()) =
m_muonSelectionTarget
.getBool(*t, sys);
62
}
63
64
for
(
const
xAOD::IParticle
*t : leptons)
65
ANA_MSG_DEBUG
(
"lepton type = "
<<t->type()<<
", pt = "
<<t->pt()<<
" , eta = "
<<t->eta()<<
", tight = "
<<
bool
(flagAcc(*t)));
66
67
ANA_CHECK
(
m_fakeTool
->addEvent(leptons));
68
float
asmWgt = 0.;
69
ANA_CHECK
(
m_fakeTool
->applySystematicVariation({}));
// the nominal MM weight is computed
70
ANA_CHECK
(
m_fakeTool
->getEventWeight(asmWgt,
m_definition
,
m_process
));
71
ANA_MSG_DEBUG
(
" ----> asmWgt = "
<<asmWgt);
72
73
m_fakeToolOutput
.set(*evtInfo, asmWgt, sys);
74
}
75
76
return
StatusCode::SUCCESS;
77
}
78
79
}
// namespace
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
FakeBkgCalculatorAlg.h
CP::FakeBkgCalculatorAlg::m_muonSelectionTarget
CP::SysReadSelectionHandle m_muonSelectionTarget
Definition
FakeBkgCalculatorAlg.h:59
CP::FakeBkgCalculatorAlg::m_fakeToolOutput
CP::SysWriteDecorHandle< float > m_fakeToolOutput
Definition
FakeBkgCalculatorAlg.h:76
CP::FakeBkgCalculatorAlg::m_electronsHandle
CP::SysReadHandle< xAOD::ElectronContainer > m_electronsHandle
Definition
FakeBkgCalculatorAlg.h:43
CP::FakeBkgCalculatorAlg::m_definition
Gaudi::Property< std::string > m_definition
Definition
FakeBkgCalculatorAlg.h:39
CP::FakeBkgCalculatorAlg::initialize
virtual StatusCode initialize() override
Definition
FakeBkgCalculatorAlg.cxx:12
CP::FakeBkgCalculatorAlg::m_muonSelection
CP::SysReadSelectionHandle m_muonSelection
Definition
FakeBkgCalculatorAlg.h:56
CP::FakeBkgCalculatorAlg::m_fakeTool
ToolHandle< ILinearFakeBkgTool > m_fakeTool
Definition
FakeBkgCalculatorAlg.h:71
CP::FakeBkgCalculatorAlg::m_preselection
CP::SysReadSelectionHandle m_preselection
Definition
FakeBkgCalculatorAlg.h:67
CP::FakeBkgCalculatorAlg::m_eventInfoHandle
CP::SysReadHandle< xAOD::EventInfo > m_eventInfoHandle
Definition
FakeBkgCalculatorAlg.h:63
CP::FakeBkgCalculatorAlg::m_muonsHandle
CP::SysReadHandle< xAOD::MuonContainer > m_muonsHandle
Definition
FakeBkgCalculatorAlg.h:53
CP::FakeBkgCalculatorAlg::m_systematicsList
CP::SysListHandle m_systematicsList
Definition
FakeBkgCalculatorAlg.h:36
CP::FakeBkgCalculatorAlg::m_electronSelection
CP::SysReadSelectionHandle m_electronSelection
Definition
FakeBkgCalculatorAlg.h:46
CP::FakeBkgCalculatorAlg::m_process
Gaudi::Property< std::string > m_process
Definition
FakeBkgCalculatorAlg.h:40
CP::FakeBkgCalculatorAlg::m_electronSelectionTarget
CP::SysReadSelectionHandle m_electronSelectionTarget
Definition
FakeBkgCalculatorAlg.h:49
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition
ConstDataVector.h:76
ConstDataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ConstDataVector::back
ElementProxy back()
Access the last element in the collection as an lvalue.
EL::AnaAlgorithm::execute
virtual::StatusCode execute()
execute this algorithm
Definition
AnaAlgorithm.cxx:315
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition
Control/AthContainers/AthContainers/Accessor.h:68
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
CP
Select isolated Photons, Electrons and Muons.
Definition
Control/xAODRootAccess/xAODRootAccess/TEvent.h:27
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
SG::Decorator
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition
AuxElement.h:576
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
xAOD::ElectronContainer
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/ElectronContainer.h:17
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
xAOD::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/Muon.h:13
xAOD::MuonContainer
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Definition
Event/xAOD/xAODMuon/xAODMuon/MuonContainer.h:14
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition
Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
Generated on
for ATLAS Offline Software by
1.17.0