ATLAS Offline Software
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 
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 //==============================================================================
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 
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 
xAOD::TrigElectron_v1
Class describing an electron reconstructed in the HLT.
Definition: TrigElectron_v1.h:39
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
taskman.configFile
configFile
Definition: taskman.py:311
initialize
void initialize()
Definition: run_EoverP.cxx:894
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
RingerSelector.h
AsgRingerSelectorTool.h
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
merge.output
output
Definition: merge.py:17
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
xAOD::TrigRingerRings_v2
Definition: TrigRingerRings_v2.h:24
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:134
asg::AcceptData
Definition: AcceptData.h:30
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
Ringer
Namespace dedicated for Ringer utilities.
Definition: CaloRingsDefs.h:9