 |
ATLAS Offline Software
|
Tool to perform trigger matching in the derivation framework.
More...
#include <TriggerMatchingTool.h>
Tool to perform trigger matching in the derivation framework.
Trigger matching in the derivation framework has to take the reverse approach to matching in analysis code. There, the matching tool is provided with a list of analysis particles to match to a given trigger. The navigation then proceeds to search out all features that match the types of those particles. In the derivation framework however, we need to get the full list of all particles that a user could ask for in their analysis code. To do this, we ask the navigation for all the relevant xAOD objects and then use those to query the available offline objects.
- Author
- Jon Burr
Definition at line 38 of file TriggerMatchingTool.h.
◆ particleVec_t
◆ TriggerMatchingTool()
| DerivationFramework::TriggerMatchingTool::TriggerMatchingTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
pSvcLocator |
|
) |
| |
Constructor.
Definition at line 42 of file TriggerMatchingTool.cxx.
48 declareProperty(
"ChainNames", m_chainNames,
49 "The list of trigger chains to match.");
51 "The tool to retrieve online particles from the navigation.");
52 declareProperty(
"InputElectrons",
54 "Offline electron candidates for matching.");
55 declareProperty(
"InputPhotons",
57 "Offline photon candidates for matching.");
58 declareProperty(
"InputMuons",
60 "Offline muon candidates for matching.");
61 declareProperty(
"InputTaus",
63 "Offline tau candidates for matching.");
65 "The maximum dR between an offline and an online particle to consider "
66 "a match between them.");
67 declareProperty(
"Rerun",
m_rerun =
true,
68 "Whether to match triggers in rerun mode.");
69 declareProperty(
"OutputContainerPrefix",
m_outputPrefix=
"TrigMatch_",
70 "The prefix to add to the output containers.");
72 "If set, discard any empty chain groups. Otherwise these will cause "
75 "Warn when a trigger is removed (if the configuration is dependent "
76 "on the inputs, removal is not expected).");
◆ addBranches()
| StatusCode DerivationFramework::TriggerMatchingTool::addBranches |
( |
const EventContext & |
ctx | ) |
const |
|
overridevirtual |
Calculate the matchings.
Definition at line 96 of file TriggerMatchingTool.cxx.
98 [[maybe_unused]]
static const bool firstEvent = [&](){
99 auto itr = m_chainNames.begin();
100 while (itr != m_chainNames.end() ) {
104 ATH_MSG_WARNING(
"Removing trigger " << (*itr) <<
" -- suggests a bad tool configuration (asking for triggers not in the menu)");
107 itr = m_chainNames.erase(itr);
117 std::map<xAOD::Type::ObjectType, const xAOD::IParticleContainer *> offlineContainers;
118 std::map<xAOD::Type::ObjectType, particleVec_t> offlineCandidates;
122 if (
p.second.empty() )
125 if (!handle.isValid())
128 return StatusCode::FAILURE;
130 offlineContainers[
p.first] = handle.ptr();
131 offlineCandidates.emplace(std::make_pair(
140 std::map<const xAOD::IParticle*, particleVec_t> matches;
143 for (
const std::string&
chain : m_chainNames) {
149 std::vector<particleVec_t> onlineCombinations;
153 onlineCombinations.size() <<
" combinations found for chain" <<
chain);
157 if (onlineCombinations.size() == 0)
160 using particleRange_t = TriggerMatchingUtils::RangedItr<typename particleVec_t::const_iterator>;
162 std::vector<particleVec_t> offlineCombinations;
177 for (
const particleVec_t& combination : onlineCombinations) {
182 std::vector<particleRange_t> matchCandidates;
185 part, offlineCandidates, matches);
186 matchCandidates.emplace_back(possibleMatches.begin(), possibleMatches.end() );
190 auto theseOfflineCombinations =
191 TriggerMatchingUtils::getAllDistinctCombinations<const xAOD::IParticle*>(
198 "Checking matching for chain " <<
chain
199 <<
" with " << matchCandidates.size() <<
" legs");
201 for (
const particleRange_t&
range : matchCandidates)
203 <<
" offline candidates." );
205 "Matching generated " << theseOfflineCombinations.size()
206 <<
" offline combinations");
217 for (
const particleVec_t& foundCombination : offlineCombinations) {
219 container->push_back(composite);
220 static const acc_t<vecLink_t<xAOD::IParticleContainer>> dec_links(
221 "TrigMatchedObjects");
222 vecLink_t<xAOD::IParticleContainer>&
links = dec_links(*composite);
228 if (container->trackIndices())
232 extendedCtx.proxy());
234 links.push_back(makeLink<xAOD::IParticleContainer>(
part, extendedCtx.proxy()));
238 return StatusCode::SUCCESS;
◆ createOutputContainer()
Create an output container for the named chain.
- Parameters
-
| [out] | container | A pointer to the created container |
| chain | The name of the chain to create the container for The container will be recorded in the StoreGate using the name of the chain as a key. |
Definition at line 241 of file TriggerMatchingTool.cxx.
245 auto uniqueContainer = std::make_unique<xAOD::TrigCompositeContainer>();
246 auto aux = std::make_unique<xAOD::AuxContainerBase>();
247 uniqueContainer->setStore(aux.get() );
248 container = uniqueContainer.
get();
253 ATH_CHECK( evtStore()->record(std::move(uniqueContainer),
name) );
254 ATH_CHECK( evtStore()->record(std::move(aux),
name+
"Aux.") );
255 return StatusCode::SUCCESS;
◆ getCandidateMatchesFor()
Get all offline particles that could match a given online one.
- Parameters
-
| part | The online particle to match against. |
| offlineParticles | The offline particles, key by xAOD type. |
| cache | Store past matches here to speed up future look ups. |
Definition at line 258 of file TriggerMatchingTool.cxx.
264 auto cacheItr = cache.find(
part);
265 if (cacheItr == cache.end() ) {
271 static const constAcc_t<vecLink_t<xAOD::CaloClusterContainer>> acc_calo(
"caloClusterLinks");
276 const vecLink_t<xAOD::CaloClusterContainer>&
links = acc_calo(*cand);
277 if (
links.size() == 0 || !
links.at(0).isValid() )
290 cacheItr = cache.emplace(
293 return cacheItr->second;
◆ initialize()
| StatusCode DerivationFramework::TriggerMatchingTool::initialize |
( |
| ) |
|
|
overridevirtual |
Initialize the tool.
Definition at line 79 of file TriggerMatchingTool.cxx.
84 std::sort(m_chainNames.begin(), m_chainNames.end() );
85 m_chainNames.erase(std::unique(m_chainNames.begin(), m_chainNames.end() ), m_chainNames.end() );
93 return StatusCode::SUCCESS;
◆ matchParticles()
◆ ATLAS_THREAD_SAFE
| std::vector<std::string> m_chainNames DerivationFramework::TriggerMatchingTool::ATLAS_THREAD_SAFE |
|
mutableprivate |
◆ m_checkEmptyChainGroups
| bool DerivationFramework::TriggerMatchingTool::m_checkEmptyChainGroups |
|
private |
If set, discard any triggers with empty chain groups (break the job otherwise).
Definition at line 83 of file TriggerMatchingTool.h.
◆ m_drThreshold
| float DerivationFramework::TriggerMatchingTool::m_drThreshold |
|
private |
◆ m_inputDependentConfig
| bool DerivationFramework::TriggerMatchingTool::m_inputDependentConfig |
|
private |
If using an input-file-dependent config then we warn when triggers are removed.
Definition at line 87 of file TriggerMatchingTool.h.
◆ m_offlineInputs
◆ m_outputPrefix
| std::string DerivationFramework::TriggerMatchingTool::m_outputPrefix |
|
private |
The prefix to place at the beginning of the output containers.
Definition at line 79 of file TriggerMatchingTool.h.
◆ m_rerun
| bool DerivationFramework::TriggerMatchingTool::m_rerun |
|
private |
◆ m_scoreTool
Initial value:{
this, "ScoringTool", "Trig::DRScoringTool", "The pair scoring tool"}
The pair scoring tool.
Definition at line 93 of file TriggerMatchingTool.h.
◆ m_tdt
| ToolHandle<Trig::TrigDecisionTool> DerivationFramework::TriggerMatchingTool::m_tdt {"Trig::TrigDecisionTool/TrigDecisionTool"} |
|
private |
◆ m_trigParticleTool
| ToolHandle<Trig::IIParticleRetrievalTool> DerivationFramework::TriggerMatchingTool::m_trigParticleTool {"Trig::IParticleRetrievalTool/OnlineParticleTool"} |
|
private |
The documentation for this class was generated from the following files:
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Electron_v1 Electron
Definition of the current "egamma version".
TrigComposite_v1 TrigComposite
Declare the latest version of the class.
accumulate
Update flags based on parser line args.
bool insertIntoSortedVector(std::vector< T > &vec, const T &ele, PROJ proj={})
Helper function for inserting an element into a sorted vector.
const T * get(size_type n) const
Access an element, as an rvalue.
std::vector< size_t > vec
#define ATH_MSG_VERBOSE(x)
Class providing the definition of the 4-vector interface.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
Description of a calorimeter cluster.
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Class used to describe composite objects in the HLT.
virtual double pt() const =0
The transverse momentum ( ) of the particle.
Photon_v1 Photon
Definition of the current "egamma version".
struct TBPatternUnitContext Muon
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
#define ATH_MSG_WARNING(x)
@ Tau
The object is a tau (jet)
std::vector< std::string > getListOfTriggers() const
decltype(auto) operator()(ObjectId< CI, CM > id) const noexcept