ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkTau
src
TauMassDecorator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
DerivationFrameworkTau/TauMassDecorator.h
"
6
#include "
xAODTau/TauJetContainer.h
"
7
#include "
xAODTau/TauJetAuxContainer.h
"
8
#include "
StoreGate/ReadHandle.h
"
9
#include "
StoreGate/WriteHandle.h
"
10
#include "
TauAnalysisTools/HelperFunctions.h
"
11
#include "
StoreGate/WriteDecorHandle.h
"
12
13
namespace
DerivationFramework
{
14
15
TauMassDecorator::TauMassDecorator
(
const
std::string& name,
16
ISvcLocator* pSvcLocator)
17
:
AthReentrantAlgorithm
(name, pSvcLocator)
18
{}
19
20
StatusCode
TauMassDecorator::initialize
()
21
{
22
// initialize read/write handle keys
23
ATH_CHECK
(
m_tauOutputKey
.initialize());
24
ATH_CHECK
(
m_tauInputKey
.initialize());
25
ATH_CHECK
(
m_massKey
.initialize() );
26
27
return
StatusCode::SUCCESS;
28
}
29
30
StatusCode
TauMassDecorator::execute
(
const
EventContext& ctx)
const
31
{
32
33
// retrieve input tau container
34
SG::ReadHandle<xAOD::TauJetContainer>
tau_inputContainer(
m_tauInputKey
, ctx);
35
if
(!tau_inputContainer.
isValid
()) {
36
ATH_MSG_ERROR
(
"Could not retrieve TauJetContainer with key "
<< tau_inputContainer.
key
());
37
return
StatusCode::FAILURE;
38
}
39
40
SG::WriteHandle<xAOD::TauJetContainer>
tau_outputContainer(
m_tauOutputKey
,ctx);
41
ATH_CHECK
(tau_outputContainer.
record
(std::make_unique<xAOD::TauJetContainer>(),
42
std::make_unique<xAOD::TauJetAuxContainer>()));
43
44
xAOD::TauJetContainer
*
taus
= tau_outputContainer.
ptr
();
45
taus
->reserve(tau_inputContainer->size());
46
for
(
const
xAOD::TauJet
* old_tau : *tau_inputContainer) {
47
xAOD::TauJet
* tau =
taus
->push_back(std::make_unique<xAOD::TauJet>());
48
*tau=*old_tau;
49
}
50
51
52
SG::WriteDecorHandle<xAOD::TauJetContainer, float>
dec_mass (
m_massKey
, ctx);
53
54
// update the mass value
55
std::vector<TLorentzVector> combinedPi0sP4;
56
for
(
const
auto
tau : *
taus
) {
57
TauAnalysisTools::createPi0Vectors(tau, combinedPi0sP4);
//clears the vector before filling it
58
TLorentzVector tau_comp(0,0,0,0);
59
60
for
(
size_t
i = 0; i < tau->nTracks(); i++) {
61
tau_comp += tau->track(i)->p4();
62
}
63
64
for
(
const
auto
& pi0LVec : combinedPi0sP4) {
65
tau_comp += pi0LVec;
66
}
67
dec_mass(*tau) = tau_comp.M();
68
}
69
70
return
StatusCode::SUCCESS;
71
}
72
}
73
74
75
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
taus
static Double_t taus
Definition
LArPhysWaveHECTool.cxx:37
HelperFunctions.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
WriteHandle.h
Handle class for recording to StoreGate.
TauJetAuxContainer.h
TauJetContainer.h
TauMassDecorator.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
DerivationFramework::TauMassDecorator::m_tauOutputKey
SG::WriteHandleKey< xAOD::TauJetContainer > m_tauOutputKey
Name of the tau output collection.
Definition
TauMassDecorator.h:32
DerivationFramework::TauMassDecorator::initialize
virtual StatusCode initialize() override final
Definition
TauMassDecorator.cxx:20
DerivationFramework::TauMassDecorator::TauMassDecorator
TauMassDecorator(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TauMassDecorator.cxx:15
DerivationFramework::TauMassDecorator::execute
StatusCode execute(const EventContext &ctx) const override final
Definition
TauMassDecorator.cxx:30
DerivationFramework::TauMassDecorator::m_tauInputKey
SG::ReadHandleKey< xAOD::TauJetContainer > m_tauInputKey
Name of the tau input collection.
Definition
TauMassDecorator.h:35
DerivationFramework::TauMassDecorator::m_massKey
SG::WriteDecorHandleKey< xAOD::TauJetContainer > m_massKey
Definition
TauMassDecorator.h:37
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:71
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
xAOD::TauJet
TauJet_v3 TauJet
Definition of the current "tau version".
Definition
TauJet.h:17
xAOD::TauJetContainer
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
Definition
TauJetContainer.h:17
Generated on
for ATLAS Offline Software by
1.17.0