ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
Jet
JetMonitoring
Root
JetSelectorAttributeRunII.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 "
JetMonitoring/JetSelectorAttributeRunII.h
"
6
#include <limits>
7
8
namespace
{
9
10
template
<
class
T>
11
struct
ValueRetriever :
public
JetSelectorAttributeRunII::SelValueRetriever
{
12
ValueRetriever(
const
std::string &n) : acc(
n
) {}
13
virtual
float
value
(
const
xAOD::Jet
& j)
const override
{
return
acc(j);}
14
SG::AuxElement::Accessor<T> acc;
15
};
16
17
template
<
class
T>
18
struct
VecValueRetriever :
public
JetSelectorAttributeRunII::SelValueRetriever
{
19
VecValueRetriever(
const
std::string &n,
int
ind) : acc(
n
), index(
ind
) {}
20
virtual
float
value
(
const
xAOD::Jet
& j)
const override
{
return
acc(j)[index];}
21
SG::AuxElement::Accessor<std::vector<T> > acc;
22
int
index;
23
};
24
25
26
}
27
28
JetSelectorAttributeRunII::JetSelectorAttributeRunII
(
const
std::string &t)
29
:
asg
::
AsgTool
(t)
30
,
m_min
(-
std
::numeric_limits<float>::
max
())
31
,
m_max
(
std
::numeric_limits<float>::
max
())
32
,
m_attName
(
""
)
33
,
m_attType
(
"float"
)
34
,
m_vectorAttIndex
(0)
35
,
m_vretriever
(nullptr)
36
{
37
38
declareProperty
(
"CutMin"
,
m_min
);
39
declareProperty
(
"CutMax"
,
m_max
);
40
declareProperty
(
"Attribute"
,
m_attName
) ;
41
declareProperty
(
"AttributeType"
,
m_attType
) ;
42
declareProperty
(
"VectorIndex"
,
m_vectorAttIndex
) ;
43
44
}
45
46
JetSelectorAttributeRunII:: ~JetSelectorAttributeRunII
(){
47
if
(
m_vretriever
)
delete
m_vretriever
;
48
}
49
50
StatusCode
JetSelectorAttributeRunII::initialize
() {
51
if
(
m_attName
.empty()) {
52
ATH_MSG_ERROR
(
"Please specify an attribute name"
);
53
return
StatusCode::FAILURE;
54
}
55
56
if
(
m_attType
==
"float"
)
m_vretriever
= new ::ValueRetriever<float>(
m_attName
);
57
else
if
(
m_attType
==
"int"
)
m_vretriever
= new ::ValueRetriever<int>(
m_attName
);
58
else
if
(
m_attType
==
"vector<float>"
)
m_vretriever
= new ::VecValueRetriever<float>(
m_attName
,
m_vectorAttIndex
);
59
else
{
60
ATH_MSG_ERROR
(
"Unsupported attribute type : "
<<
m_attType
);
61
return
StatusCode::FAILURE;
62
}
63
ATH_MSG_INFO
(
" will select on attribute of type : "
<<
m_attType
<<
". "
<<
m_min
<<
" < "
<<
m_attName
<<
" < "
<<
m_max
);
64
return
StatusCode::SUCCESS;
65
}
66
67
int
JetSelectorAttributeRunII::keep
(
const
xAOD::Jet
&
jet
)
const
{
68
float
v =
m_vretriever
->value(
jet
);
69
return
(
m_min
< v ) && (v<
m_max
);
70
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
JetSelectorAttributeRunII.h
max
#define max(a, b)
Definition
cfImp.cxx:41
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
JetSelectorAttributeRunII::keep
int keep(const xAOD::Jet &jet) const
Method to select.
Definition
JetSelectorAttributeRunII.cxx:67
JetSelectorAttributeRunII::m_min
float m_min
Definition
JetSelectorAttributeRunII.h:42
JetSelectorAttributeRunII::m_max
float m_max
Definition
JetSelectorAttributeRunII.h:43
JetSelectorAttributeRunII::m_vectorAttIndex
int m_vectorAttIndex
Definition
JetSelectorAttributeRunII.h:48
JetSelectorAttributeRunII::~JetSelectorAttributeRunII
virtual ~JetSelectorAttributeRunII()
Definition
JetSelectorAttributeRunII.cxx:46
JetSelectorAttributeRunII::initialize
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition
JetSelectorAttributeRunII.cxx:50
JetSelectorAttributeRunII::m_attName
std::string m_attName
Definition
JetSelectorAttributeRunII.h:45
JetSelectorAttributeRunII::m_vretriever
SelValueRetriever * m_vretriever
if the attribute is a vector we'll use the value at this index. else it is ignored.
Definition
JetSelectorAttributeRunII.h:49
JetSelectorAttributeRunII::m_attType
std::string m_attType
Definition
JetSelectorAttributeRunII.h:46
JetSelectorAttributeRunII::JetSelectorAttributeRunII
JetSelectorAttributeRunII(const std::string &t)
Definition
JetSelectorAttributeRunII.cxx:28
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
WriteLumiToCool.ind
int ind
Definition
WriteLumiToCool.py:198
asg
Definition
DataHandleTestTool.h:28
athena.value
value
Definition
athena.py:126
beamspotman.n
n
Definition
beamspotman.py:727
jet
Definition
JetCalibTools_PlotJESFactors.cxx:23
std
STL namespace.
xAOD::Jet
Jet_v1 Jet
Definition of the current "jet version".
Definition
Event/xAOD/xAODJet/xAODJet/Jet.h:17
JetSelectorAttributeRunII::SelValueRetriever
SelValueRetriever retrieves the value on which this tool select jets.
Definition
JetSelectorAttributeRunII.h:28
Generated on
for ATLAS Offline Software by
1.17.0