ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkMuons
src
IDTrackCaloDepositsDecoratorAlg.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 "
IDTrackCaloDepositsDecoratorAlg.h
"
6
#include "
CaloEvent/CaloCellContainer.h
"
7
#include "
muonEvent/DepositInCalo.h
"
8
#include "
xAODMuon/Muon.h
"
9
#include "
xAODTracking/TrackParticle.h
"
10
#include "
StoreGate/ReadDecorHandle.h
"
11
#include "
StoreGate/WriteDecorHandle.h
"
12
#include "
xAODMuonViews/ContainerDecorator.h
"
13
14
namespace
DerivationFramework
{
15
16
17
StatusCode
IDTrackCaloDepositsDecoratorAlg::initialize
() {
18
ATH_CHECK
(
m_trkDepositInCalo
.retrieve());
19
20
ATH_CHECK
(
m_partKey
.initialize());
21
for
(
const
std::string& decor :
m_trkSelDecors
) {
22
m_trkSelKeys
.emplace_back(
m_partKey
, decor);
23
}
24
ATH_CHECK
(
m_trkSelKeys
.initialize());
25
ATH_CHECK
(
m_depositKey
.initialize());
26
ATH_CHECK
(
m_elossKey
.initialize());
27
ATH_CHECK
(
m_typeKey
.initialize());
28
return
StatusCode::SUCCESS;
29
}
30
31
StatusCode
IDTrackCaloDepositsDecoratorAlg::execute
(
const
EventContext& ctx)
const
{
32
33
const
xAOD::IParticleContainer
* tracks{};
34
ATH_CHECK
(
SG::get
(tracks,
m_partKey
, ctx));
35
36
xAOD::ContainerDecorator<xAOD::IParticleContainer, std::vector<float>
> dec_deposit {
m_depositKey
, ctx};
37
xAOD::ContainerDecorator<xAOD::IParticleContainer, std::vector<float>
> dec_eloss {
m_elossKey
, ctx};
38
xAOD::ContainerDecorator<xAOD::IParticleContainer, std::vector<uint16_t>
> dec_type {
m_typeKey
, ctx};
39
40
using
SelDecorator =
SG::ReadDecorHandle<xAOD::IParticleContainer, std::uint8_t>
;
41
42
std::vector<SelDecorator> selDecors;
43
for
(
const
SG::ReadDecorHandleKey<xAOD::IParticleContainer>
& key:
m_trkSelKeys
) {
44
selDecors.emplace_back(key, ctx);
45
}
46
for
(
const
xAOD::IParticle
* particle : *tracks) {
47
if
(particle->pt() <
m_ptMin
)
continue
;
48
if
(!selDecors.empty() && std::find_if(selDecors.begin(), selDecors.end(),
49
[particle](
const
SelDecorator& dec){
50
return dec(*particle);
51
}) == selDecors.end())
continue
;
52
ATH_MSG_DEBUG
(
"Recomputing calo deposition by hand"
);
53
54
const
xAOD::TrackParticle
* track_part =
nullptr
;
55
if
(particle->type() ==
xAOD::Type::ObjectType::TrackParticle
) {
56
track_part =
static_cast<
const
xAOD::TrackParticle
*
>
(particle);
57
}
else
if
(particle->type() ==
xAOD::Type::ObjectType::Muon
) {
58
const
xAOD::Muon
* muon =
static_cast<
const
xAOD::Muon
*
>
(particle);
59
track_part = muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
60
if
(!track_part) {
61
ATH_MSG_VERBOSE
(
"The muon does not have an associated ID track"
);
62
track_part = muon->trackParticle(xAOD::Muon::TrackParticleType::Primary);
63
}
64
}
65
if
(!track_part) {
66
ATH_MSG_ERROR
(
"Unable to retrieve xAOD::TrackParticle from probe object"
);
67
return
StatusCode::FAILURE;
68
}
69
70
const
CaloCellContainer
* caloCellCont =
nullptr
;
71
std::vector<DepositInCalo> deposits =
m_trkDepositInCalo
->getDeposits(&(track_part->
perigeeParameters
()), caloCellCont);
72
std::vector<float>& dep_val{dec_deposit(*particle)};
73
std::vector<float>& eloss_val{dec_eloss(*particle)};
74
std::vector<uint16_t>&
types
{dec_type(*particle)};
75
dep_val.reserve(deposits.size());
76
eloss_val.reserve(deposits.size());
77
types
.reserve(deposits.size());
78
for
(
const
DepositInCalo
& it : deposits) {
79
dep_val.push_back(it.energyDeposited());
80
eloss_val.push_back(it.muonEnergyLoss());
81
types
.push_back(it.subCaloId());
82
}
83
}
84
return
StatusCode::SUCCESS;
85
}
86
}
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:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloCellContainer.h
ContainerDecorator.h
DepositInCalo.h
Muon.h
TrackParticle.h
IDTrackCaloDepositsDecoratorAlg.h
types
static const std::vector< std::string > types
Definition
MuonTriggerSFFilesTest.cxx:20
ReadDecorHandle.h
Handle class for reading a decoration on an object.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
DepositInCalo
class describing the measured energy loss associated to muons on the detector level,...
Definition
DepositInCalo.h:23
DerivationFramework::IDTrackCaloDepositsDecoratorAlg::m_typeKey
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_typeKey
Definition
IDTrackCaloDepositsDecoratorAlg.h:53
DerivationFramework::IDTrackCaloDepositsDecoratorAlg::m_partKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_partKey
Particle container to decorate the Pivot plane coordinates to.
Definition
IDTrackCaloDepositsDecoratorAlg.h:37
DerivationFramework::IDTrackCaloDepositsDecoratorAlg::m_trkDepositInCalo
ToolHandle< ITrackDepositInCaloTool > m_trkDepositInCalo
Definition
IDTrackCaloDepositsDecoratorAlg.h:34
DerivationFramework::IDTrackCaloDepositsDecoratorAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition
IDTrackCaloDepositsDecoratorAlg.cxx:31
DerivationFramework::IDTrackCaloDepositsDecoratorAlg::m_trkSelDecors
Gaudi::Property< std::vector< std::string > > m_trkSelDecors
Optional list of decorators to select only the good tracks for the isolation decoration.
Definition
IDTrackCaloDepositsDecoratorAlg.h:44
DerivationFramework::IDTrackCaloDepositsDecoratorAlg::m_elossKey
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_elossKey
Definition
IDTrackCaloDepositsDecoratorAlg.h:51
DerivationFramework::IDTrackCaloDepositsDecoratorAlg::initialize
StatusCode initialize() override
Definition
IDTrackCaloDepositsDecoratorAlg.cxx:17
DerivationFramework::IDTrackCaloDepositsDecoratorAlg::m_trkSelKeys
SG::ReadDecorHandleKeyArray< xAOD::IParticleContainer > m_trkSelKeys
Definition
IDTrackCaloDepositsDecoratorAlg.h:46
DerivationFramework::IDTrackCaloDepositsDecoratorAlg::m_depositKey
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_depositKey
Definition
IDTrackCaloDepositsDecoratorAlg.h:49
DerivationFramework::IDTrackCaloDepositsDecoratorAlg::m_ptMin
Gaudi::Property< float > m_ptMin
Definition
IDTrackCaloDepositsDecoratorAlg.h:39
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition
StoreGate/StoreGate/ReadDecorHandleKey.h:86
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition
StoreGate/StoreGate/ReadDecorHandle.h:94
xAOD::ContainerDecorator
Auxiliary class to instantiate WriteDecorHandles.The handles can be created in an empty state.
Definition
ContainerDecorator.h:18
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
xAOD::TrackParticle_v1::perigeeParameters
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
Definition
TrackParticle_v1.cxx:437
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:282
xAODType::TrackParticle
@ TrackParticle
The object is a charged track particle.
Definition
ObjectType.h:43
xAODType::Muon
@ Muon
The object is a muon.
Definition
ObjectType.h:48
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
xAOD::Muon
Muon_v1 Muon
Reference the current persistent version:
Definition
Event/xAOD/xAODMuon/xAODMuon/Muon.h:13
xAOD::IParticleContainer
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
Definition
xAOD/xAODBase/xAODBase/IParticleContainer.h:32
Generated on
for ATLAS Offline Software by
1.17.0