ATLAS Offline Software
TrigMatchingAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
10 #include "PATCore/PATCoreEnums.h"
11 
12 namespace CP
13 {
14 
16  ISvcLocator *svcLoc)
17  : EL::AnaAlgorithm(name, svcLoc)
18  {
19  declareProperty("matchingTool", m_trigMatchingTool, "trigger matching tool");
20  }
21 
23  {
24  if (m_matchingDecoration.empty())
25  {
26  ATH_MSG_ERROR("The decoration name needs to be defined");
27  return StatusCode::FAILURE;
28  }
29 
30  if (m_trigSingleMatchingList.empty())
31  {
32  ATH_MSG_ERROR("At least one trigger needs to be provided in the list");
33  return StatusCode::FAILURE;
34  }
35 
36  // retrieve the trigger matching tool
37  ANA_CHECK(m_trigMatchingTool.retrieve());
38 
39  for (const std::string &chain : m_trigSingleMatchingList)
40  {
42  }
44 
46 
48 
49  return StatusCode::SUCCESS;
50  }
51 
52 
53 
55  {
56 
57  for (const auto & syst : m_systematicsList.systematicsVector())
58  {
59  const xAOD::IParticleContainer* particles(nullptr);
60 
62 
63  if (particles != nullptr)
64  {
65  for (const xAOD::IParticle *particle : *particles)
66  {
67  for (const std::string &chain : m_trigSingleMatchingList)
68  {
69  float dR = chain.starts_with("HLT_tau")? 0.2:0.1;
70  (m_matchingDecorators.at(chain))(*particle) = m_trigMatchingTool->match(*particle, chain, dR, false);
71  }
72  }
73  }
74  }
75  return StatusCode::SUCCESS;
76  }
77 } // namespace CP
78 
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:76
runLayerRecalibration.chain
chain
Definition: runLayerRecalibration.py:175
CP::TrigMatchingAlg::TrigMatchingAlg
TrigMatchingAlg(const std::string &name, ISvcLocator *pSvcLocator)
the standard constructor
Definition: TrigMatchingAlg.cxx:15
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
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:62
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:48
StringUtil.h
CP::TrigMatchingAlg::m_particleSelection
SysReadSelectionHandle m_particleSelection
input particle selection
Definition: TrigMatchingAlg.h:65
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
PATCoreEnums.h
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:54
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
CP::TrigMatchingAlg::initialize
virtual StatusCode initialize() final override
Definition: TrigMatchingAlg.cxx:22
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
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30