Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TrigMatchingAlg.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 
11 
12 
13 namespace CP
14 {
15 
17  ISvcLocator *svcLoc)
18  : EL::AnaAlgorithm(name, svcLoc)
19  {
20  declareProperty("matchingTool", m_trigMatchingTool, "trigger matching tool");
21  }
22 
24  {
25  if (m_matchingDecoration.empty())
26  {
27  ATH_MSG_ERROR("The decoration name needs to be defined");
28  return StatusCode::FAILURE;
29  }
30 
32  {
33  ATH_MSG_ERROR("At least one trigger needs to be provided in the list");
34  return StatusCode::FAILURE;
35  }
36 
37  // retrieve the trigger matching tool
38  ANA_CHECK(m_trigMatchingTool.retrieve());
39 
40  for (const std::string &chain : m_trigSingleMatchingList)
41  {
43  }
44  for (const std::string &chain : m_trigSingleMatchingListDummy)
45  {
47  }
49 
51 
53 
54  return StatusCode::SUCCESS;
55  }
56 
57 
58 
60  {
61 
62  for (const auto & syst : m_systematicsList.systematicsVector())
63  {
64  const xAOD::IParticleContainer* particles(nullptr);
65 
67 
68  if (particles != nullptr)
69  {
70  for (const xAOD::IParticle *particle : *particles)
71  {
72  for (const std::string &chain : m_trigSingleMatchingList)
73  {
74  // A string-based signature-identifier per leg, may contain duplicated return values for asymmetric chains.
75  const std::vector<std::string> signatures = ChainNameParser::signatures(chain);
76  if (signatures.size() != 1) {
77  ANA_MSG_ERROR("The decoration-based TrigMatchingAlg only supports single-legged triggers." << chain << " has " << signatures.size() << " legs.");
78  return StatusCode::FAILURE;
79  }
80 
81  const float dR = (signatures.at(0) == "tau" ? 0.2 : 0.1);
82  (m_matchingDecorators.at(chain))(*particle) = m_trigMatchingTool->match(*particle, chain, dR, false);
83  }
84 
85  for (const std::string &chain : m_trigSingleMatchingListDummy)
86  {
87  (m_matchingDecorators.at(chain))(*particle) = 0;
88  }
89  }
90  }
91  }
92  return StatusCode::SUCCESS;
93  }
94 } // namespace CP
95 
CP::TrigMatchingAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition: TrigMatchingAlg.h:50
ChainNameParser.h
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
CP::TrigMatchingAlg::TrigMatchingAlg
TrigMatchingAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition: TrigMatchingAlg.cxx:16
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
CP::SysListHandle::systematicsVector
const std::vector< CP::SystematicSet > & systematicsVector() const
the list of systematics to loop over
Definition: SysListHandle.cxx:96
CP::TrigMatchingAlg::m_particlesHandle
SysReadHandle< xAOD::IParticleContainer > m_particlesHandle
input particle collection
Definition: TrigMatchingAlg.h:65
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:49
StringUtil.h
CP::TrigMatchingAlg::m_particleSelection
SysReadSelectionHandle m_particleSelection
input particle selection
Definition: TrigMatchingAlg.h:68
CP::TrigMatchingAlg::m_trigSingleMatchingList
Gaudi::Property< std::vector< std::string > > m_trigSingleMatchingList
list of triggers
Definition: TrigMatchingAlg.h:59
TrigMatchingAlg.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CP::SysListHandle::initialize
::StatusCode initialize()
intialize this property
Definition: SysListHandle.cxx:69
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
CP::TrigMatchingAlg::execute
virtual StatusCode execute() final override
Definition: TrigMatchingAlg.cxx:59
CP::TrigMatchingAlg::m_matchingDecoration
Gaudi::Property< std::string > m_matchingDecoration
the decoration for trigger matching
Definition: TrigMatchingAlg.h:53
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
CP::TrigMatchingAlg::m_trigMatchingTool
ToolHandle< Trig::IMatchingTool > m_trigMatchingTool
trigger decision tool handle
Definition: TrigMatchingAlg.h:47
ChainNameParser::signatures
std::vector< std::string > signatures(const std::string &chain)
Definition: ChainNameParser.cxx:210
CP::TrigMatchingAlg::initialize
virtual StatusCode initialize() final override
Definition: TrigMatchingAlg.cxx:23
EventInfo.h
RCU::substitute
std::string substitute(const std::string &str, const std::string &pattern, const std::string &with)
effects: substitute all occurences of "pattern" with "with" in the string "str" returns: the substitu...
Definition: StringUtil.cxx:24
CP::SysReadSelectionHandle::initialize
StatusCode initialize(SysListHandle &sysListHandle, const ISysHandleBase &objectHandle)
initialize the accessor
Definition: SysReadSelectionHandle.cxx:34
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
CP::TrigMatchingAlg::m_matchingDecorators
std::unordered_map< std::string, SG::AuxElement::Decorator< char > > m_matchingDecorators
the decorators for m_matchingDecoration and triggers combination
Definition: TrigMatchingAlg.h:56
CP::TrigMatchingAlg::m_trigSingleMatchingListDummy
Gaudi::Property< std::vector< std::string > > m_trigSingleMatchingListDummy
list of triggers for dummy matching decorations
Definition: TrigMatchingAlg.h:62
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30