ATLAS Offline Software
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  ATH_MSG_DEBUG("Retrieving " << m_particlesHandle.getName(syst));
69 
70  if (particles != nullptr)
71  {
72  for (const xAOD::IParticle *particle : *particles)
73  {
74  ATH_MSG_DEBUG("-- Considering offline eta:" << particle->eta() << " phi:" << particle->phi() << " (pT:" << particle->pt() << ")");
75  for (const std::string &chain : m_trigSingleMatchingList)
76  {
77  // A string-based signature-identifier per leg, may contain duplicated return values for asymmetric chains.
78  const std::vector<std::string> signatures = ChainNameParser::signatures(chain);
79  if (signatures.size() != 1) {
80  ANA_MSG_ERROR("The decoration-based TrigMatchingAlg only supports single-legged triggers." << chain << " has " << signatures.size() << " legs.");
81  return StatusCode::FAILURE;
82  }
83 
84  const float dR = (signatures.at(0) == "tau" ? 0.2 : 0.1);
85  const bool match = m_trigMatchingTool->match(*particle, chain, dR, false);
87  ATH_MSG_DEBUG("-- -- Considering for " << chain << ", match = " << match);
88  }
89 
90  for (const std::string &chain : m_trigSingleMatchingListDummy)
91  {
92  ATH_MSG_DEBUG("Applying dummy match=0 decoration for " << chain);
94  }
95  }
96  }
97  }
98  return StatusCode::SUCCESS;
99  }
100 } // namespace CP
101 
CP::TrigMatchingAlg::m_systematicsList
SysListHandle m_systematicsList
the systematics list we run
Definition: TrigMatchingAlg.h:50
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:79
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
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AsgComponentFactories.h:16
CP::TrigMatchingAlg::m_matchingDecorators
std::unordered_map< std::string, SG::Decorator< char > > m_matchingDecorators
the decorators for m_matchingDecoration and triggers combination
Definition: TrigMatchingAlg.h:56
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:240
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:237
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_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
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition: hcg.cxx:356