ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetMonitoring
src
JetHistoSelectSort.cxx
Go to the documentation of this file.
1
#include <list>
2
#include "
AthContainers/ConstDataVector.h
"
3
#include "
JetMonitoring/JetHistoSelectSort.h
"
4
#include "
JetMonitoring/JetMonitoringAlg.h
"
5
6
7
JetHistoSelectSort::JetHistoSelectSort
(
const
std::string&
type
,
const
std::string & name ,
const
IInterface* parent):
8
AthAlgTool
(
type
, name, parent )
9
,
m_jetFillerTools
(this)
10
,
m_selectTool
(this)
11
,
m_eventSelTool
(this)
12
,
m_sortVar
(this)
13
14
{
15
declareInterface<IJetHistoFiller>(
this
);
16
17
declareProperty
(
"FillerTools"
,
m_jetFillerTools
);
18
declareProperty
(
"Selector"
,
m_selectTool
);
19
declareProperty
(
"EventSelector"
,
m_eventSelTool
);
20
declareProperty
(
"SortVariable"
,
m_sortVar
);
21
}
22
23
24
StatusCode
JetHistoSelectSort::initialize
() {
25
ATH_MSG_DEBUG
(
" initialize JetHistoSelectSort "
);
26
27
ATH_CHECK
(
m_jetFillerTools
.retrieve() );
28
29
ATH_MSG_DEBUG
(
" Scheduled Histo fillers/selectors : "
);
30
for
(
const
auto
& t:
m_jetFillerTools
){
31
ATH_MSG_DEBUG
(
"--> "
<< t->name() );
32
}
33
34
35
if
(
m_selectTool
.isEnabled()){
36
ATH_CHECK
(
m_selectTool
.retrieve());
37
ATH_MSG_DEBUG
(
" Selecting with "
<<
m_selectTool
->name() );
38
}
39
if
(
m_inverseJetSel
){
40
ATH_MSG_DEBUG
(
" inverse Jet Selection will be applied"
);
41
}
42
43
if
(
m_eventSelTool
.isEnabled()){
44
ATH_CHECK
(
m_eventSelTool
.retrieve());
45
ATH_MSG_DEBUG
(
" Selecting with "
<<
m_eventSelTool
->name() );
46
}
47
48
if
(
m_sortVar
.isEnabled() ){
49
ATH_CHECK
(
m_sortVar
.retrieve());
50
ATH_MSG_DEBUG
(
"Sorting on var =("
<<
m_sortVar
->describe() <<
")"
);
51
}
52
53
return
StatusCode::SUCCESS;
54
}
55
56
57
StatusCode
JetHistoSelectSort::processJetContainer
(
const
JetMonitoringAlg
& parentAlg,
const
xAOD::JetContainer
& jets,
const
EventContext& ctx)
const
{
58
59
60
// fill a temporary list of pointer
61
std::list<const xAOD::Jet*> tmpList;
62
63
// do sort if needed
64
if
(
m_sortVar
.isEnabled() ){
65
auto
sort
= [
this
] (
const
xAOD::Jet
* j1,
const
xAOD::Jet
* j2) {
return
m_sortVar
->value(*j1) >
m_sortVar
->value(*j2); } ;
66
tmpList.sort(
sort
);
67
}
68
69
if
(
m_selIndex
>-1){
70
if
( (
int
) jets.size( ) >
m_selIndex
) { tmpList.push_back( jets[
m_selIndex
]); }
71
}
else
{
72
for
(
const
xAOD::Jet
*
jet
: jets ) tmpList.push_back(
jet
);
73
}
74
75
// select if needed
76
if
(
m_selectTool
.isEnabled()){
77
if
(
m_inverseJetSel
) {
78
auto
sel
= [
this
] (
const
xAOD::Jet
* j) {
return
m_selectTool
->keep(*j) ; } ;
79
tmpList.remove_if(
sel
);
80
}
81
else
{
82
auto
sel
= [
this
] (
const
xAOD::Jet
* j) {
return
!
m_selectTool
->keep(*j) ; } ;
83
tmpList.remove_if(
sel
);
84
}
85
}
86
87
if
(
m_eventSelTool
.isEnabled()){
88
auto
eventInfo = parentAlg.
GetEventInfo
(ctx);
89
if
( !
m_eventSelTool
->keep(*eventInfo, jets) ) tmpList.clear();
90
}
91
92
93
ConstDataVector< xAOD::JetContainer >
tmpCont(
SG::VIEW_ELEMENTS
);
94
for
(
const
xAOD::Jet
*
jet
: tmpList ) tmpCont.
push_back
(
jet
);
95
const
xAOD::JetContainer
* filteredCont = tmpCont.
asDataVector
();
96
97
for
(
const
auto
& t:
m_jetFillerTools
){
98
ATH_CHECK
(t->processJetContainer(parentAlg, *filteredCont, ctx));
99
}
100
101
102
return
StatusCode::SUCCESS;
103
}
104
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
JetHistoSelectSort.h
JetMonitoringAlg.h
sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
sel
sel
Definition
SUSYToolsTester.cxx:92
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
AthMonitorAlgorithm::GetEventInfo
SG::ReadHandle< xAOD::EventInfo > GetEventInfo(const EventContext &) const
Return a ReadHandle for an EventInfo object (get run/event numbers, etc.).
Definition
AthMonitorAlgorithm.cxx:111
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition
ConstDataVector.h:76
ConstDataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ConstDataVector::asDataVector
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
JetHistoSelectSort::m_inverseJetSel
Gaudi::Property< bool > m_inverseJetSel
Definition
JetHistoSelectSort.h:36
JetHistoSelectSort::initialize
virtual StatusCode initialize()
Definition
JetHistoSelectSort.cxx:24
JetHistoSelectSort::m_eventSelTool
ToolHandle< IJetEventSelector > m_eventSelTool
Definition
JetHistoSelectSort.h:35
JetHistoSelectSort::m_selectTool
ToolHandle< IJetSelector > m_selectTool
Definition
JetHistoSelectSort.h:34
JetHistoSelectSort::m_selIndex
Gaudi::Property< int > m_selIndex
Definition
JetHistoSelectSort.h:37
JetHistoSelectSort::m_sortVar
ToolHandle< IJetHistoVarTool > m_sortVar
Definition
JetHistoSelectSort.h:38
JetHistoSelectSort::JetHistoSelectSort
JetHistoSelectSort(const std::string &type, const std::string &name, const IInterface *parent)
Definition
JetHistoSelectSort.cxx:7
JetHistoSelectSort::m_jetFillerTools
ToolHandleArray< IJetHistoFiller > m_jetFillerTools
Definition
JetHistoSelectSort.h:32
JetHistoSelectSort::processJetContainer
virtual StatusCode processJetContainer(const JetMonitoringAlg &parentAlg, const xAOD::JetContainer &jets, const EventContext &ctx) const
Definition
JetHistoSelectSort.cxx:57
JetMonitoringAlg
A monitoring algorithm in charge of filling histogram for a JetContainer.
Definition
JetMonitoringAlg.h:26
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
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
type
Generated on
for ATLAS Offline Software by
1.17.0