ATLAS Offline Software
PhysicsAnalysis
DerivationFramework
DerivationFrameworkSUSY
src
trackIsolationDecorator.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// trackIsolationDecorator.cxx, (c) ATLAS Detector software
8
// Author: Christopher Young (christopher.young@cern.ch)
9
#include "
DerivationFrameworkSUSY/trackIsolationDecorator.h
"
10
#include "
AthenaKernel/errorcheck.h
"
11
#include <vector>
12
#include <string>
13
14
#include "
xAODTracking/TrackingPrimitives.h
"
15
#include "
xAODTracking/TrackParticleContainer.h
"
16
17
// Constructor
18
DerivationFramework::trackIsolationDecorator::trackIsolationDecorator
(
const
std::string&
t
,
19
const
std::string&
n
,
20
const
IInterface*
p
):
21
AthAlgTool
(
t
,
n
,
p
),
22
m_trackIsolationTool(),
23
m_decorators(
xAOD
::
Iso
::
numIsolationTypes
, 0)
24
{
25
declareInterface<DerivationFramework::IAugmentationTool>(
this
);
26
declareProperty
(
"TrackIsolationTool"
,
m_trackIsolationTool
);
27
declareProperty
(
"TargetContainer"
,
m_containerName
=
"InDetTrackParticles"
);
28
declareProperty
(
"ptcones"
,
m_ptcones
);
29
declareProperty
(
"Prefix"
,
m_prefix
=
""
);
30
}
31
32
// Destructor
33
DerivationFramework::trackIsolationDecorator::~trackIsolationDecorator
() {
34
}
35
36
// Athena initialize and finalize
37
StatusCode
DerivationFramework::trackIsolationDecorator::initialize
()
38
{
39
ATH_MSG_VERBOSE
(
"initialize() ..."
);
40
41
// load the matching tool
42
if
( ! m_trackIsolationTool.empty() ) {
43
CHECK
( m_trackIsolationTool.retrieve() );
44
ATH_MSG_INFO
(
"Successfully retrived the TrackIsolationTool!"
);
45
}
46
47
m_trkCorrList.trackbitset.set(
static_cast<
unsigned
int
>
(
xAOD::Iso::coreTrackPtr
));
48
50
m_ptconeTypes.clear();
51
for
(
auto
c
: m_ptcones){
52
xAOD::Iso::IsolationType
t
=
static_cast<
xAOD::Iso::IsolationType
>
(
c
);
53
m_decorators[
c
] =
new
SG::AuxElement::Decorator< float >
(m_prefix+xAOD::Iso::toCString(
t
));
54
m_ptconeTypes.push_back(
t
);
55
}
56
57
return
StatusCode::SUCCESS;
58
}
59
60
StatusCode
DerivationFramework::trackIsolationDecorator::finalize
()
61
{
62
ATH_MSG_VERBOSE
(
"finalize() ..."
);
63
65
for
(
auto
d
: m_decorators) {
if
(
d
)
delete
d
;}
66
68
69
return
StatusCode::SUCCESS;
70
}
71
72
StatusCode
DerivationFramework::trackIsolationDecorator::addBranches
()
const
73
{
74
// retrieve container
75
const
xAOD::IParticleContainer
* toDecorate = 0;
76
if
(evtStore()->
retrieve
(toDecorate, m_containerName).isFailure()) {
77
ATH_MSG_FATAL
(
"Unable to retrieve "
<< m_containerName );
78
return
StatusCode::FAILURE;
79
}
80
82
for
(
auto
particle
: *toDecorate) {
83
85
xAOD::TrackIsolation
resultTrack;
86
if
(m_trackIsolationTool->trackIsolation(resultTrack, *
particle
, m_ptconeTypes, m_trkCorrList)){
87
for
(
unsigned
int
i
=0;
i
<m_ptcones.size();
i
++){
88
// (*(m_decorators[static_cast<int>(m_ptcones[i])]))(*particle) = resultTrack.ptcones.at(i);
89
(*(m_decorators[m_ptcones[
i
]]))(*particle) = resultTrack.
ptcones
.at(
i
);
90
}
91
}
else
{
92
ATH_MSG_WARNING
(
"Failed to apply the track isolation for a particle"
);
93
}
94
95
}
96
97
return
StatusCode::SUCCESS;
98
}
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition:
PyKernel.py:110
DerivationFramework::trackIsolationDecorator::~trackIsolationDecorator
~trackIsolationDecorator()
Destructor.
Definition:
trackIsolationDecorator.cxx:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition:
AthMsgStreamMacros.h:34
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition:
ParticleHypothesis.h:76
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition:
AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition:
AthCommonDataStore.h:145
hist_file_dump.d
d
Definition:
hist_file_dump.py:137
xAOD::Iso::coreTrackPtr
@ coreTrackPtr
tracks pointer
Definition:
Event/xAOD/xAODPrimitives/xAODPrimitives/IsolationCorrection.h:66
DerivationFramework::trackIsolationDecorator::addBranches
virtual StatusCode addBranches() const
Pass the thinning service
Definition:
trackIsolationDecorator.cxx:72
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition:
ICaloAffectedTool.h:24
read_hist_ntuple.t
t
Definition:
read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition:
AthMsgStreamMacros.h:28
DerivationFramework::trackIsolationDecorator::m_prefix
std::string m_prefix
Definition:
trackIsolationDecorator.h:41
DerivationFramework::trackIsolationDecorator::trackIsolationDecorator
trackIsolationDecorator(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Definition:
trackIsolationDecorator.cxx:18
DerivationFramework::trackIsolationDecorator::m_ptcones
std::vector< int > m_ptcones
Definition:
trackIsolationDecorator.h:47
trackIsolationDecorator.h
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:210
CP::Iso
@ Iso
Definition:
MuonEfficiencyType.h:16
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition:
Decorator.h:59
lumiFormat.i
int i
Definition:
lumiFormat.py:85
beamspotman.n
n
Definition:
beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::Iso::IsolationType
IsolationType
Overall enumeration for isolation types in xAOD files.
Definition:
IsolationType.h:26
DerivationFramework::trackIsolationDecorator::finalize
StatusCode finalize()
Definition:
trackIsolationDecorator.cxx:60
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition:
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DataVector
Derived DataVector<T>.
Definition:
DataVector.h:794
DerivationFramework::trackIsolationDecorator::initialize
StatusCode initialize()
Definition:
trackIsolationDecorator.cxx:37
xAOD::TrackIsolation
Definition:
IsolationCommon.h:33
errorcheck.h
Helpers for checking error return status codes and reporting errors.
DerivationFramework::trackIsolationDecorator::m_trackIsolationTool
ToolHandle< xAOD::ITrackIsolationTool > m_trackIsolationTool
Athena configured tools.
Definition:
trackIsolationDecorator.h:44
xAOD::TrackIsolation::ptcones
std::vector< float > ptcones
Definition:
IsolationCommon.h:36
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition:
AthMsgStreamMacros.h:32
DerivationFramework::trackIsolationDecorator::m_containerName
std::string m_containerName
Definition:
trackIsolationDecorator.h:40
xAOD::Iso::numIsolationTypes
@ numIsolationTypes
Definition:
IsolationType.h:118
AthAlgTool
Definition:
AthAlgTool.h:26
python.compressB64.c
def c
Definition:
compressB64.py:93
TrackingPrimitives.h
TrackParticleContainer.h
Generated on Sun Dec 22 2024 21:20:25 for ATLAS Offline Software by
1.8.18