ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::EGSelectionToolWrapper Class Reference

#include <EGSelectionToolWrapper.h>

Inheritance diagram for DerivationFramework::EGSelectionToolWrapper:
Collaboration diagram for DerivationFramework::EGSelectionToolWrapper:

Public Member Functions

virtual StatusCode initialize () override final
virtual StatusCode addBranches (const EventContext &ctx) const override final

Private Attributes

ToolHandle< IAsgEGammaIsEMSelectorm_tool
SG::ReadHandleKey< xAOD::EgammaContainerm_ContainerName
SG::ReadHandleKey< xAOD::EgammaContainerm_fudgedContainerName { this, "FudgedContainerName", "", "Input with fudge factors applied" }
SG::WriteDecorHandleKey< xAOD::EgammaContainerm_decoratorPass
SG::WriteDecorHandleKey< xAOD::EgammaContainerm_decoratorIsEM
Gaudi::Property< std::string > m_cut { this, "CutType", "", "cut type" }

Detailed Description

Definition at line 25 of file EGSelectionToolWrapper.h.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::EGSelectionToolWrapper::addBranches ( const EventContext & ctx) const
finaloverridevirtual

Definition at line 33 of file EGSelectionToolWrapper.cxx.

34{
35 // retrieve container
36 SG::ReadHandle<xAOD::EgammaContainer> particles;
37 if(!m_fudgedContainerName.empty()){
38 SG::ReadHandle<xAOD::EgammaContainer> fudged{ m_fudgedContainerName, ctx };
39 particles = std::move(fudged);
40 } else {
41 SG::ReadHandle<xAOD::EgammaContainer> egammas{ m_ContainerName, ctx };
42 particles = std::move(egammas);
43 }
44
45 // Decorators
46 SG::WriteDecorHandle<xAOD::EgammaContainer, char> decoratorPass{
48 };
49 SG::WriteDecorHandle<xAOD::EgammaContainer, unsigned int> decoratorIsEM{
51 };
52
53 for (const auto& egamma : *particles) {
54 // compute the output of the selector with the fudged object
55 asg::AcceptData theAccept(m_tool->accept(ctx, egamma));
56 // this should work for both the
57 // cut-based and the LH selectors
58 unsigned int isEM =
59 static_cast<unsigned int>(theAccept.getCutResultInvertedBitSet()
60 .to_ulong());
61
62 // decorate the original object
63 const xAOD::IParticle* original = m_fudgedContainerName.empty() ?
65 if (m_cut == "") {
66 bool pass_selection = static_cast<bool>(theAccept);
67 decoratorPass(*original) = pass_selection ? 1 : 0;
68 } else {
69 decoratorPass(*original) = theAccept.getCutResult(m_cut) ? 1 : 0;
70 }
71 decoratorIsEM(*original) = isEM;
72 }
73
74 return StatusCode::SUCCESS;
75}
ToolHandle< IAsgEGammaIsEMSelector > m_tool
SG::WriteDecorHandleKey< xAOD::EgammaContainer > m_decoratorIsEM
SG::ReadHandleKey< xAOD::EgammaContainer > m_ContainerName
SG::WriteDecorHandleKey< xAOD::EgammaContainer > m_decoratorPass
SG::ReadHandleKey< xAOD::EgammaContainer > m_fudgedContainerName
const IParticle * getOriginalObject(const IParticle &copy)
This function can be used to conveniently get a pointer back to the original object from which a copy...

◆ initialize()

StatusCode DerivationFramework::EGSelectionToolWrapper::initialize ( )
finaloverridevirtual

Definition at line 19 of file EGSelectionToolWrapper.cxx.

20{
21 ATH_CHECK(m_tool.retrieve());
22
23 ATH_CHECK(m_ContainerName.initialize());
25
26 ATH_CHECK(m_decoratorPass.initialize());
27 ATH_CHECK(m_decoratorIsEM.initialize());
28
29 return StatusCode::SUCCESS;
30}
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_ContainerName

SG::ReadHandleKey<xAOD::EgammaContainer> DerivationFramework::EGSelectionToolWrapper::m_ContainerName
private
Initial value:
{ this,
"ContainerName", "", "Input to decorate" }

Definition at line 42 of file EGSelectionToolWrapper.h.

42 { this,
43 "ContainerName", "", "Input to decorate" };

◆ m_cut

Gaudi::Property<std::string> DerivationFramework::EGSelectionToolWrapper::m_cut { this, "CutType", "", "cut type" }
private

Definition at line 52 of file EGSelectionToolWrapper.h.

52{ this, "CutType", "", "cut type" };

◆ m_decoratorIsEM

SG::WriteDecorHandleKey<xAOD::EgammaContainer> DerivationFramework::EGSelectionToolWrapper::m_decoratorIsEM
private
Initial value:
{ this,
"decoratorIsEM", m_ContainerName, "", "" }
SG::ReadHandleKey< xAOD::EgammaContainer > m_ContainerName

Definition at line 50 of file EGSelectionToolWrapper.h.

50 { this,
51 "decoratorIsEM", m_ContainerName, "", "" };

◆ m_decoratorPass

SG::WriteDecorHandleKey<xAOD::EgammaContainer> DerivationFramework::EGSelectionToolWrapper::m_decoratorPass
private
Initial value:
{ this,
"decoratorPass", m_ContainerName, "", "" }

Definition at line 48 of file EGSelectionToolWrapper.h.

48 { this,
49 "decoratorPass", m_ContainerName, "", "" };

◆ m_fudgedContainerName

SG::ReadHandleKey<xAOD::EgammaContainer> DerivationFramework::EGSelectionToolWrapper::m_fudgedContainerName { this, "FudgedContainerName", "", "Input with fudge factors applied" }
private

Definition at line 44 of file EGSelectionToolWrapper.h.

44{ this, "FudgedContainerName", "", "Input with fudge factors applied" };

◆ m_tool

ToolHandle<IAsgEGammaIsEMSelector> DerivationFramework::EGSelectionToolWrapper::m_tool
private
Initial value:
{
this,
"EGammaSelectionTool",
"",
"Selector tool",
}

Definition at line 35 of file EGSelectionToolWrapper.h.

35 {
36 this,
37 "EGammaSelectionTool",
38 "",
39 "Selector tool",
40 };

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