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

#include <MuonJetDrTool.h>

Inheritance diagram for DerivationFramework::MuonJetDrTool:
Collaboration diagram for DerivationFramework::MuonJetDrTool:

Public Member Functions

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

Private Attributes

SG::ReadHandleKey< xAOD::MuonContainerm_muonSGKey {this, "ContainerKey", "Muons"}
SG::ReadHandleKey< xAOD::JetContainerm_jetSGKey {this, "JetContainerKey", "AntiKt4EMTopoJets"}
SG::WriteDecorHandleKey< xAOD::MuonContainerm_jetDR_SGKey {this, "dRDecoration", m_muonSGKey, "DFCommonJetDr"}
Gaudi::Property< float > m_jetMinPt {this, "JetMinPt", 20.e3, "Minimal pt cut of the jets to be considered"}

Detailed Description

Definition at line 21 of file MuonJetDrTool.h.

Member Function Documentation

◆ addBranches()

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

Definition at line 19 of file MuonJetDrTool.cxx.

19 {
20
21 // Retrieve main muonicle collection
22 SG::ReadHandle<xAOD::MuonContainer> muons{m_muonSGKey, ctx};
23 if (!muons.isValid()) {
24 ATH_MSG_FATAL("Failed to retrieve container " << m_muonSGKey.fullKey());
25 return StatusCode::FAILURE;
26 }
27 SG::ReadHandle<xAOD::JetContainer> jets{m_jetSGKey, ctx};
28 if (!jets.isValid()) {
29 ATH_MSG_FATAL("Failed to retrieve " << m_jetSGKey.fullKey());
30 return StatusCode::FAILURE;
31 }
32 SG::WriteDecorHandle<xAOD::MuonContainer, float> decorator_jetdR{m_jetDR_SGKey, ctx};
33
34 for (auto muon : *muons) {
35 double new_jetdR = FLT_MAX;
36 bool found{false};
37 for (auto jet : *jets) {
38 if (jet->pt() <= m_jetMinPt) continue;
39 new_jetdR = std::min(xAOD::P4Helpers::deltaR(jet, muon), new_jetdR);
40 found = true;
41 }
42 decorator_jetdR(*muon) = found ? new_jetdR : -1;
43 }
44 return StatusCode::SUCCESS;
45}
#define ATH_MSG_FATAL(x)
Gaudi::Property< float > m_jetMinPt
SG::ReadHandleKey< xAOD::MuonContainer > m_muonSGKey
SG::WriteDecorHandleKey< xAOD::MuonContainer > m_jetDR_SGKey
SG::ReadHandleKey< xAOD::JetContainer > m_jetSGKey
virtual bool isValid() override final
Can the handle be successfully dereferenced?
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi

◆ initialize()

StatusCode DerivationFramework::MuonJetDrTool::initialize ( )
finaloverridevirtual

Definition at line 11 of file MuonJetDrTool.cxx.

11 {
12 ATH_CHECK(m_muonSGKey.initialize());
13 ATH_CHECK(m_jetSGKey.initialize());
14 ATH_CHECK(m_jetDR_SGKey.initialize());
15 return StatusCode::SUCCESS;
16}
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_jetDR_SGKey

SG::WriteDecorHandleKey<xAOD::MuonContainer> DerivationFramework::MuonJetDrTool::m_jetDR_SGKey {this, "dRDecoration", m_muonSGKey, "DFCommonJetDr"}
private

Definition at line 32 of file MuonJetDrTool.h.

32{this, "dRDecoration", m_muonSGKey, "DFCommonJetDr"};

◆ m_jetMinPt

Gaudi::Property<float> DerivationFramework::MuonJetDrTool::m_jetMinPt {this, "JetMinPt", 20.e3, "Minimal pt cut of the jets to be considered"}
private

Definition at line 34 of file MuonJetDrTool.h.

34{this, "JetMinPt", 20.e3, "Minimal pt cut of the jets to be considered"};

◆ m_jetSGKey

SG::ReadHandleKey<xAOD::JetContainer> DerivationFramework::MuonJetDrTool::m_jetSGKey {this, "JetContainerKey", "AntiKt4EMTopoJets"}
private

Definition at line 31 of file MuonJetDrTool.h.

31{this, "JetContainerKey", "AntiKt4EMTopoJets"};

◆ m_muonSGKey

SG::ReadHandleKey<xAOD::MuonContainer> DerivationFramework::MuonJetDrTool::m_muonSGKey {this, "ContainerKey", "Muons"}
private

Definition at line 30 of file MuonJetDrTool.h.

30{this, "ContainerKey", "Muons"};

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