Loading [MathJax]/extensions/tex2jax.js
 |
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 |
|
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);
114 const EventContext &ctx = Gaudi::Hive::currentContext();
118 std::map<xAOD::Type::ObjectType, const xAOD::IParticleContainer *> offlineContainers;
119 std::map<xAOD::Type::ObjectType, particleVec_t> offlineCandidates;
123 if (
p.second.empty() )
126 if (!handle.isValid())
129 return StatusCode::FAILURE;
131 offlineContainers[
p.first] = handle.ptr();
132 offlineCandidates.emplace(std::make_pair(
141 std::map<const xAOD::IParticle*, particleVec_t> matches;
144 for (
const std::string&
chain : m_chainNames) {
150 std::vector<particleVec_t> onlineCombinations;
154 onlineCombinations.size() <<
" combinations found for chain" <<
chain);
158 if (onlineCombinations.size() == 0)
161 using particleRange_t = TriggerMatchingUtils::RangedItr<typename particleVec_t::const_iterator>;
163 std::vector<particleVec_t> offlineCombinations;
178 for (
const particleVec_t& combination : onlineCombinations) {
183 std::vector<particleRange_t> matchCandidates;
186 part, offlineCandidates, matches);
187 matchCandidates.emplace_back(possibleMatches.begin(), possibleMatches.end() );
191 auto theseOfflineCombinations =
192 TriggerMatchingUtils::getAllDistinctCombinations<const xAOD::IParticle*>(
199 "Checking matching for chain " <<
chain
200 <<
" with " << matchCandidates.size() <<
" legs");
202 for (
const particleRange_t&
range : matchCandidates)
204 <<
" offline candidates." );
206 "Matching generated " << theseOfflineCombinations.size()
207 <<
" offline combinations");
218 for (
const particleVec_t& foundCombination : offlineCombinations) {
220 container->push_back(composite);
221 static const acc_t<vecLink_t<xAOD::IParticleContainer>> dec_links(
222 "TrigMatchedObjects");
223 vecLink_t<xAOD::IParticleContainer>&
links = dec_links(*composite);
229 if (container->trackIndices())
233 extendedCtx.proxy());
235 links.push_back(makeLink<xAOD::IParticleContainer>(
part, extendedCtx.proxy()));
239 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 242 of file TriggerMatchingTool.cxx.
246 auto uniqueContainer = std::make_unique<xAOD::TrigCompositeContainer>();
247 auto aux = std::make_unique<xAOD::AuxContainerBase>();
248 uniqueContainer->setStore(aux.get() );
249 container = uniqueContainer.
get();
254 ATH_CHECK( evtStore()->record(std::move(uniqueContainer),
name) );
255 ATH_CHECK( evtStore()->record(std::move(aux),
name+
"Aux.") );
256 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 259 of file TriggerMatchingTool.cxx.
265 auto cacheItr = cache.find(
part);
266 if (cacheItr == cache.end() ) {
272 static const constAcc_t<vecLink_t<xAOD::CaloClusterContainer>> acc_calo(
"caloClusterLinks");
277 const vecLink_t<xAOD::CaloClusterContainer>&
links = acc_calo(*cand);
278 if (
links.size() == 0 || !
links.at(0).isValid() )
291 cacheItr = cache.emplace(
294 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.
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.
decltype(auto) operator()(ObjectId< OT, CM > id) const noexcept
Photon_v1 Photon
Definition of the current "egamma version".
struct TBPatternUnitContext Muon
accumulate
Update flags based on parser line args.
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