ATLAS Offline Software
Loading...
Searching...
No Matches
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:
9#include <cmath>
10
11namespace Ringer {
12
13
14
15//==============================================================================
16// Standard constructor
17//==============================================================================
18AsgRingerSelectorTool::AsgRingerSelectorTool(const std::string& name) :
19 AsgTool( name ),
20 m_selector( name )
21{}
22
25
26
27
28//==============================================================================
29// Athena initialize method
30//==============================================================================
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
49{
50 return StatusCode::SUCCESS;
51}
52
53//==============================================================================
54
56{
57 asg::AcceptData acceptData(&m_accept);
58 return acceptData;
59}
60
61// =============================================================================
62
63asg::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
73float 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
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
#define ATH_MSG_ERROR(x)
virtual StatusCode initialize() override
Gaudi Service Interface method implementations.
virtual asg::AcceptData accept(const xAOD::TrigRingerRings *, float discr, float mu) const override
Accept method.
Gaudi::Property< bool > m_useTansigOutput
virtual StatusCode finalize() override
Gaudi Service Interface method implementations.
ServiceHandle< AthOnnx::IOnnxRuntimeSvc > m_onnxSvc
Gaudi::Property< std::vector< std::string > > m_configFiles
virtual ASG_TOOL_CLASS2(AsgRingerSelectorTool, IAsgRingerSelectorTool, IAsgSelectionTool) AsgRingerSelectorTool(const std ~AsgRingerSelectorTool()
Standard constructor.
virtual float predict(const xAOD::TrigRingerRings *) const override
@briel Calculation of model output for fast calorimetry or fast photon step (HLT usage only)
void setCutResult(const std::string &cutName, bool cutResult)
Set the result of a cut, based on the cut name (safer)
Definition AcceptData.h:134
Class providing the definition of the 4-vector interface.
Namespace dedicated for Ringer utilities.
TrigRingerRings_v2 TrigRingerRings
Define the latest version of the TrigRingerRings class.
TrigElectron_v1 TrigElectron
Declare the latest version of the class.