ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetRec
Root
JetSorter.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
JetRec/JetSorter.h
"
6
8
// Comparison functions
9
bool
ptCompare
(
const
xAOD::Jet
* j1,
const
xAOD::Jet
* j2){
return
j1->pt() > j2->pt() ;}
10
11
// A global map for comparison functions
12
using
compFunc
= bool (*)(
const
xAOD::Jet
*,
const
xAOD::Jet
*);
13
const
std::map<std::string, compFunc>
g_compFuncMap
= {
14
{
"ByPtDown"
,
ptCompare
}
15
};
16
17
JetSorter::JetSorter
(
const
std::string& n) :
18
asg
::
AsgTool
(n)
19
,
m_sortType
(
"ByPtDown"
)
20
{
21
declareProperty
(
"SortingType"
,
m_sortType
);
22
}
23
24
StatusCode
JetSorter::modify
(
xAOD::JetContainer
& jets)
const
{
25
ATH_MSG_DEBUG
(
" Sorting : "
<<
m_sortType
<<
" "
<< jets.size() );
26
// leave early if empty otherwise sort() throws an exception.
27
if
(jets.empty() )
return
StatusCode::SUCCESS;
28
29
const
auto
itr =
g_compFuncMap
.find(
m_sortType
);
30
if
(itr ==
g_compFuncMap
.end()) {
31
ATH_MSG_ERROR
(
"Unsupported SortingType "
<<
m_sortType
);
32
return
StatusCode::FAILURE;
33
}
34
jets.sort( *itr->second );
35
return
StatusCode::SUCCESS;
36
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
g_compFuncMap
const std::map< std::string, compFunc > g_compFuncMap
Definition
JetSorter.cxx:13
compFunc
bool(*)(const xAOD::Jet *, const xAOD::Jet *) compFunc
Definition
JetSorter.cxx:12
ptCompare
bool ptCompare(const xAOD::Jet *j1, const xAOD::Jet *j2)
Definition
JetSorter.cxx:9
JetSorter.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
JetSorter::modify
virtual StatusCode modify(xAOD::JetContainer &jets) const
Method to modify a jet collection.
Definition
JetSorter.cxx:24
JetSorter::m_sortType
std::string m_sortType
Definition
JetSorter.h:32
JetSorter::JetSorter
JetSorter(const std::string &t)
Definition
JetSorter.cxx:17
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
asg
Definition
DataHandleTestTool.h:28
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
xAOD::JetContainer
JetContainer_v1 JetContainer
Definition of the current "jet container version".
Definition
JetContainer.h:17
Generated on
for ATLAS Offline Software by
1.17.0