ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkJetEtMiss
src
ViewContainerThinning.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// ViewContainerThinning.cxx
8
// Implementation file for class ViewContainerThinning
9
// Author: S.Binet<binet@cern.ch>
11
12
// DerivationFrameworkJetEtMiss includes
13
#include "
ViewContainerThinning.h
"
14
15
// STL includes
16
17
// FrameWork includes
18
#include "
StoreGate/ThinningHandle.h
"
19
#include "
StoreGate/ReadHandle.h
"
20
21
#include "
xAODCaloEvent/CaloClusterContainer.h
"
22
#include "
xAODTracking/TrackParticleContainer.h
"
23
#include "
xAODTruth/TruthParticleContainer.h
"
24
25
26
27
namespace
DerivationFramework
{
28
29
template
<
class
T>
30
StatusCode
31
ViewContainerThinning::doThinningT
(
const
EventContext& ctx,
32
const
SG::ThinningHandleKey<T>
& key,
33
const
SG::ReadHandleKey<T>
& viewKey)
const
34
{
35
36
SG::ThinningHandle<T>
sourceCont (key, ctx);
37
SG::ReadHandle<T>
viewCont (viewKey, ctx);
38
39
std::vector<bool> masks;
40
masks.assign( sourceCont->size(),
false
);
41
42
for
(
const
auto
* part: *viewCont){
43
masks[ part->index() ] =
true
;
44
}
45
46
sourceCont.
keep
(masks);
47
return
StatusCode::SUCCESS;
48
}
49
50
51
// Athena algtool's Hooks
53
StatusCode
ViewContainerThinning::initialize
()
54
{
55
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
);
56
57
ATH_CHECK
(
m_trackParticleKey
.initialize (
m_streamName
, !
m_trackParticleKey
.empty()) );
58
ATH_CHECK
(
m_caloClusterKey
.initialize (
m_streamName
, !
m_caloClusterKey
.empty()) );
59
ATH_CHECK
(
m_truthParticleKey
.initialize (
m_streamName
, !
m_truthParticleKey
.empty()) );
60
61
ATH_CHECK
(
m_trackParticleViewKey
.initialize (!
m_trackParticleViewKey
.empty()) );
62
ATH_CHECK
(
m_caloClusterViewKey
.initialize (!
m_caloClusterViewKey
.empty()) );
63
ATH_CHECK
(
m_truthParticleViewKey
.initialize (!
m_truthParticleViewKey
.empty()) );
64
65
return
StatusCode::SUCCESS;
66
}
67
68
StatusCode
ViewContainerThinning::finalize
()
69
{
70
return
StatusCode::SUCCESS;
71
}
72
73
74
75
StatusCode
ViewContainerThinning::doThinning
(
const
EventContext& ctx)
const
76
{
77
78
if
(!
m_trackParticleKey
.empty()) {
79
ATH_CHECK
(
doThinningT
(ctx,
m_trackParticleKey
,
m_trackParticleViewKey
) );
80
}
81
82
if
(!
m_caloClusterKey
.empty()) {
83
ATH_CHECK
(
doThinningT
(ctx,
m_caloClusterKey
,
m_caloClusterViewKey
) );
84
}
85
86
if
(!
m_truthParticleKey
.empty()) {
87
ATH_CHECK
(
doThinningT
(ctx,
m_truthParticleKey
,
m_truthParticleViewKey
) );
88
}
89
return
StatusCode::SUCCESS;
90
}
91
92
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
CaloClusterContainer.h
TrackParticleContainer.h
TruthParticleContainer.h
ReadHandle.h
Handle class for reading from StoreGate.
ThinningHandle.h
Handle for requesting thinning for a data object.
ViewContainerThinning.h
DerivationFramework::ViewContainerThinning::m_trackParticleViewKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticleViewKey
Definition
ViewContainerThinning.h:66
DerivationFramework::ViewContainerThinning::finalize
virtual StatusCode finalize() override
Definition
ViewContainerThinning.cxx:68
DerivationFramework::ViewContainerThinning::m_truthParticleViewKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthParticleViewKey
Definition
ViewContainerThinning.h:70
DerivationFramework::ViewContainerThinning::m_caloClusterViewKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_caloClusterViewKey
Definition
ViewContainerThinning.h:68
DerivationFramework::ViewContainerThinning::m_caloClusterKey
SG::ThinningHandleKey< xAOD::CaloClusterContainer > m_caloClusterKey
Definition
ViewContainerThinning.h:61
DerivationFramework::ViewContainerThinning::m_truthParticleKey
SG::ThinningHandleKey< xAOD::TruthParticleContainer > m_truthParticleKey
Definition
ViewContainerThinning.h:63
DerivationFramework::ViewContainerThinning::doThinning
virtual StatusCode doThinning(const EventContext &ctx) const override
Definition
ViewContainerThinning.cxx:75
DerivationFramework::ViewContainerThinning::m_streamName
StringProperty m_streamName
Definition
ViewContainerThinning.h:56
DerivationFramework::ViewContainerThinning::initialize
virtual StatusCode initialize() override
Definition
ViewContainerThinning.cxx:53
DerivationFramework::ViewContainerThinning::doThinningT
StatusCode doThinningT(const EventContext &ctx, const SG::ThinningHandleKey< T > &key, const SG::ReadHandleKey< T > &viewKey) const
Definition
ViewContainerThinning.cxx:31
DerivationFramework::ViewContainerThinning::m_trackParticleKey
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_trackParticleKey
Definition
ViewContainerThinning.h:59
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition
StoreGate/StoreGate/ReadHandleKey.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ThinningHandleBase::keep
void keep(size_t ndx)
Mark that index ndx in the container should be kept (not thinned away).
Definition
ThinningHandleBase.cxx:75
SG::ThinningHandleKey
HandleKey object for adding thinning to an object.
Definition
ThinningHandleKey.h:39
SG::ThinningHandle
Handle for requesting thinning for a data object.
Definition
ThinningHandle.h:84
DerivationFramework
THE reconstruction tool.
Definition
CascadeTools.h:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Generated on
for ATLAS Offline Software by
1.17.0