ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
RingerSelectorTools
Root
AsgRingerSelectorTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
// Local includes:
7
#include "
RingerSelectorTools/AsgRingerSelectorTool.h
"
8
#include "
RingerSelectorTools/tools/onnx/RingerSelector.h
"
9
#include <cmath>
10
11
namespace
Ringer
{
12
13
14
15
//==============================================================================
16
// Standard constructor
17
//==============================================================================
18
AsgRingerSelectorTool::AsgRingerSelectorTool(
const
std::string& name) :
19
AsgTool(
name
),
20
m_selector(
name
)
21
{}
22
23
AsgRingerSelectorTool::~AsgRingerSelectorTool
()
24
{}
25
26
27
28
//==============================================================================
29
// Athena initialize method
30
//==============================================================================
31
StatusCode
AsgRingerSelectorTool::initialize
()
32
{
33
34
for
(
auto
&
configFile
:
m_configFiles
)
35
{
36
if
(
m_selector
.read_from(
configFile
, &*
m_onnxSvc
).isFailure() ){
37
ATH_MSG_ERROR
(
"It's not possible to read all tuning files from "
<<
configFile
);
38
return
StatusCode::FAILURE;
39
}
40
}
41
42
m_accept
.addCut(
"Pass"
,
"Aproved by ringer"
);
43
return
StatusCode::SUCCESS;
44
}
45
46
//==============================================================================
47
48
StatusCode
AsgRingerSelectorTool::finalize
()
49
{
50
return
StatusCode::SUCCESS;
51
}
52
53
//==============================================================================
54
55
asg::AcceptData
AsgRingerSelectorTool::accept
(
const
xAOD::IParticle
*)
const
56
{
57
asg::AcceptData
acceptData(&
m_accept
);
58
return
acceptData;
59
}
60
61
// =============================================================================
62
63
asg::AcceptData
AsgRingerSelectorTool::accept
(
const
xAOD::TrigRingerRings
*ringsCluster,
float
discr,
float
mu )
const
64
{
65
asg::AcceptData
acceptData(&
m_accept
);
66
bool
pass =
m_selector
.accept( ringsCluster, discr, mu );
67
acceptData.
setCutResult
(
"Pass"
, pass);
68
return
acceptData;
69
}
70
71
// =============================================================================
72
73
float
AsgRingerSelectorTool::predict
(
const
xAOD::TrigRingerRings
* ringsCluster )
const
74
{
75
float
output =
m_selector
.predict( ringsCluster ,
nullptr
);
76
return
m_useTansigOutput
? tanh(output) : output;
77
}
78
79
// =============================================================================
80
81
float
AsgRingerSelectorTool::predict
(
const
xAOD::TrigRingerRings
* ringsCluster,
82
const
xAOD::TrigElectron
*el )
const
83
{
84
float
output =
m_selector
.predict( ringsCluster , el);
85
return
m_useTansigOutput
? tanh(output) : output;
86
}
87
88
// =============================================================================
89
90
91
92
93
94
}
// namespace
95
AsgRingerSelectorTool.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
RingerSelector.h
Ringer::AsgRingerSelectorTool::initialize
virtual StatusCode initialize() override
Gaudi Service Interface method implementations.
Definition
AsgRingerSelectorTool.cxx:31
Ringer::AsgRingerSelectorTool::accept
virtual asg::AcceptData accept(const xAOD::TrigRingerRings *, float discr, float mu) const override
Accept method.
Definition
AsgRingerSelectorTool.cxx:63
Ringer::AsgRingerSelectorTool::m_accept
asg::AcceptInfo m_accept
Definition
AsgRingerSelectorTool.h:77
Ringer::AsgRingerSelectorTool::m_useTansigOutput
Gaudi::Property< bool > m_useTansigOutput
Definition
AsgRingerSelectorTool.h:82
Ringer::AsgRingerSelectorTool::finalize
virtual StatusCode finalize() override
Gaudi Service Interface method implementations.
Definition
AsgRingerSelectorTool.cxx:48
Ringer::AsgRingerSelectorTool::m_selector
onnx::RingerSelector m_selector
Definition
AsgRingerSelectorTool.h:78
Ringer::AsgRingerSelectorTool::m_onnxSvc
ServiceHandle< AthOnnx::IOnnxRuntimeSvc > m_onnxSvc
Definition
AsgRingerSelectorTool.h:81
Ringer::AsgRingerSelectorTool::m_configFiles
Gaudi::Property< std::vector< std::string > > m_configFiles
Definition
AsgRingerSelectorTool.h:80
Ringer::AsgRingerSelectorTool::~AsgRingerSelectorTool
virtual ASG_TOOL_CLASS2(AsgRingerSelectorTool, IAsgRingerSelectorTool, IAsgSelectionTool) AsgRingerSelectorTool(const std ~AsgRingerSelectorTool()
Standard constructor.
Definition
AsgRingerSelectorTool.cxx:23
Ringer::AsgRingerSelectorTool::predict
virtual float predict(const xAOD::TrigRingerRings *) const override
@briel Calculation of model output for fast calorimetry or fast photon step (HLT usage only)
Definition
AsgRingerSelectorTool.cxx:73
asg::AcceptData
Definition
AcceptData.h:31
asg::AcceptData::setCutResult
void setCutResult(const std::string &cutName, bool cutResult)
Set the result of a cut, based on the cut name (safer).
Definition
AcceptData.h:135
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
Ringer
Namespace dedicated for Ringer utilities.
Definition
CaloRingsDefs.h:9
configFile
Definition
configFile.py:1
extractSporadic.name
name
Definition
extractSporadic.py:101
xAOD::TrigRingerRings
TrigRingerRings_v2 TrigRingerRings
Define the latest version of the TrigRingerRings class.
Definition
TrigRingerRings.h:17
xAOD::TrigElectron
TrigElectron_v1 TrigElectron
Declare the latest version of the class.
Definition
Event/xAOD/xAODTrigEgamma/xAODTrigEgamma/TrigElectron.h:16
Generated on
for ATLAS Offline Software by
1.17.0