ATLAS Offline Software
DiTauWPDecorator.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 //=================================PUBLIC-PART==================================
8 //______________________________________________________________________________
9 DiTauWPDecorator::DiTauWPDecorator( const std::string& type, const std::string& name, const IInterface * parent) :
11 {
12  declareInterface<DiTauToolBase > (this);
13 }
14 
15 //______________________________________________________________________________
17 
18 //______________________________________________________________________________
20 {
21  if (!m_ditauContainerName.empty() && m_decorWPs.empty()) {
22  ATH_MSG_ERROR("DiTauContainerName is provided but DecorWPNames is empty");
23  return StatusCode::FAILURE;
24  }
25 
26  for (size_t wpIndex=0; wpIndex < m_decorWPs.size(); ++wpIndex) {
27  m_charDecors.emplace_back(SG::AuxElement::Accessor<char>( m_decorWPs[wpIndex] ));
28  }
29 
30  return StatusCode::SUCCESS;
31 }
32 
33 StatusCode DiTauWPDecorator::executeObj( xAOD::DiTauJet &xDiTau, const EventContext& /*ctx*/) const
34 {
35  const SG::ConstAccessor<float> acc_score(m_scoreName);
36  float score = acc_score(xDiTau);
37 
38  // Decorate other WPs
39  for (size_t wpIndex=0; wpIndex < m_decorWPs.size(); ++wpIndex) {
40  const SG::Accessor<char>& decorator = m_charDecors[wpIndex];
41  decorator(xDiTau) = passOmniWP(score,m_decorWPCuts[wpIndex]);
42  }
43 
44  return StatusCode::SUCCESS;
45 }
46 
47 bool DiTauWPDecorator::passOmniWP(float score, float wp_thrshold ) const{
48  return score > wp_thrshold;
49 }
50 
51 
52 
53 
DiTauWPDecorator::m_scoreName
Gaudi::Property< std::string > m_scoreName
Definition: DiTauWPDecorator.h:34
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
DiTauWPDecorator::initialize
virtual StatusCode initialize() override
Tool initializer.
Definition: DiTauWPDecorator.cxx:19
DiTauWPDecorator::DiTauWPDecorator
DiTauWPDecorator(const std::string &type, const std::string &name, const IInterface *parent)
Definition: DiTauWPDecorator.cxx:9
DiTauWPDecorator::passOmniWP
bool passOmniWP(float score, float wp_thrshold) const
Definition: DiTauWPDecorator.cxx:47
DiTauWPDecorator::~DiTauWPDecorator
virtual ~DiTauWPDecorator()
SG::ConstAccessor< float >
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DiTauWPDecorator::m_ditauContainerName
Gaudi::Property< std::string > m_ditauContainerName
Definition: DiTauWPDecorator.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
DiTauToolBase
The base class for all tau tools.
Definition: DiTauToolBase.h:21
xAOD::score
@ score
Definition: TrackingPrimitives.h:514
DiTauWPDecorator::m_decorWPCuts
Gaudi::Property< std::vector< float > > m_decorWPCuts
Definition: DiTauWPDecorator.h:36
DiTauWPDecorator.h
DiTauWPDecorator::m_decorWPs
Gaudi::Property< std::vector< std::string > > m_decorWPs
Definition: DiTauWPDecorator.h:35
xAOD::DiTauJet_v1
Definition: DiTauJet_v1.h:31
DiTauWPDecorator::m_charDecors
std::vector< SG::AuxElement::Accessor< char > > m_charDecors
Definition: DiTauWPDecorator.h:38
DiTauWPDecorator::executeObj
virtual StatusCode executeObj(xAOD::DiTauJet &xDiTau, const EventContext &ctx) const override
Execute - called for each Ditau jet.
Definition: DiTauWPDecorator.cxx:33