|
ATLAS Offline Software
|
Tool to perform trigger matching in the derivation framework.
More...
#include <TriggerMatchingTool.h>
|
| TriggerMatchingTool (const std::string &type, const std::string &name, const IInterface *pSvcLocator) |
| Constructor. More...
|
|
virtual StatusCode | initialize () override |
| Initialize the tool. More...
|
|
virtual StatusCode | addBranches () const override |
| Calculate the matchings. More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
|
StatusCode | createOutputContainer (xAOD::TrigCompositeContainer *&container, const std::string &chain) const |
| Create an output container for the named chain. More...
|
|
const particleVec_t & | getCandidateMatchesFor (const xAOD::IParticle *part, std::map< xAOD::Type::ObjectType, particleVec_t > &offlineParticles, std::map< const xAOD::IParticle *, particleVec_t > &cache) const |
| Get all offline particles that could match a given online one. More...
|
|
bool | matchParticles (const xAOD::IParticle *lhs, const xAOD::IParticle *rhs) const |
| Check if the dR between two particles is below threshold. More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
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
◆ StoreGateSvc_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 declareInterface<IAugmentationTool>(
this);
50 "The list of trigger chains to match.");
52 "The tool to retrieve online particles from the navigation.");
55 "Offline electron candidates for matching.");
58 "Offline photon candidates for matching.");
61 "Offline muon candidates for matching.");
64 "Offline tau candidates for matching.");
66 "The maximum dR between an offline and an online particle to consider "
67 "a match between them.");
69 "Whether to match triggers in rerun mode.");
71 "The prefix to add to the output containers.");
73 "If set, discard any empty chain groups. Otherwise these will cause "
76 "Warn when a trigger is removed (if the configuration is dependent "
77 "on the inputs, removal is not expected).");
◆ addBranches()
StatusCode DerivationFramework::TriggerMatchingTool::addBranches |
( |
| ) |
const |
|
overridevirtual |
Calculate the matchings.
Implements DerivationFramework::IAugmentationTool.
Definition at line 97 of file TriggerMatchingTool.cxx.
99 [[maybe_unused]]
static const bool firstEvent = [&](){
100 auto itr = m_chainNames.begin();
101 while (itr != m_chainNames.end() ) {
105 ATH_MSG_WARNING(
"Removing trigger " << (*itr) <<
" -- suggests a bad tool configuration (asking for triggers not in the menu)");
108 itr = m_chainNames.erase(itr);
115 const EventContext &ctx = Gaudi::Hive::currentContext();
119 std::map<xAOD::Type::ObjectType, const xAOD::IParticleContainer *> offlineContainers;
120 std::map<xAOD::Type::ObjectType, particleVec_t> offlineCandidates;
124 if (
p.second.empty() )
127 if (!handle.isValid())
130 return StatusCode::FAILURE;
132 offlineContainers[
p.first] = handle.ptr();
133 offlineCandidates.emplace(std::make_pair(
142 std::map<const xAOD::IParticle*, particleVec_t> matches;
145 for (
const std::string&
chain : m_chainNames) {
151 std::vector<particleVec_t> onlineCombinations;
155 onlineCombinations.size() <<
" combinations found for chain" <<
chain);
159 if (onlineCombinations.size() == 0)
162 using particleRange_t = TriggerMatchingUtils::RangedItr<typename particleVec_t::const_iterator>;
164 std::vector<particleVec_t> offlineCombinations;
165 for (
const particleVec_t& combination : onlineCombinations) {
170 std::vector<particleRange_t> matchCandidates;
173 part, offlineCandidates, matches);
174 matchCandidates.emplace_back(possibleMatches.begin(), possibleMatches.end() );
178 auto theseOfflineCombinations =
179 TriggerMatchingUtils::getAllDistinctCombinations<const xAOD::IParticle*>(
184 "Checking matching for chain " <<
chain
185 <<
" with " << matchCandidates.size() <<
" legs");
187 for (
const particleRange_t&
range : matchCandidates)
189 <<
" offline candidates." );
191 "Matching generated " << theseOfflineCombinations.size()
192 <<
" offline combinations");
203 for (
const particleVec_t& foundCombination : offlineCombinations) {
205 container->push_back(composite);
206 static const acc_t<vecLink_t<xAOD::IParticleContainer>> dec_links(
207 "TrigMatchedObjects");
208 vecLink_t<xAOD::IParticleContainer>&
links = dec_links(*composite);
214 if (container->trackIndices())
218 extendedCtx.proxy());
220 links.push_back(makeLink<xAOD::IParticleContainer>(
part, extendedCtx.proxy()));
224 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 227 of file TriggerMatchingTool.cxx.
231 auto uniqueContainer = std::make_unique<xAOD::TrigCompositeContainer>();
232 auto aux = std::make_unique<xAOD::AuxContainerBase>();
233 uniqueContainer->setStore(aux.get() );
234 container = uniqueContainer.
get();
241 return StatusCode::SUCCESS;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ 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 244 of file TriggerMatchingTool.cxx.
250 auto cacheItr = cache.find(
part);
251 if (cacheItr == cache.end() ) {
257 static const constAcc_t<vecLink_t<xAOD::CaloClusterContainer>> acc_calo(
"caloClusterLinks");
262 const vecLink_t<xAOD::CaloClusterContainer>&
links = acc_calo(*cand);
263 if (
links.size() == 0 || !
links.at(0).isValid() )
276 cacheItr = cache.emplace(
279 return cacheItr->second;
◆ initialize()
StatusCode DerivationFramework::TriggerMatchingTool::initialize |
( |
| ) |
|
|
overridevirtual |
Initialize the tool.
Definition at line 80 of file TriggerMatchingTool.cxx.
85 std::sort(m_chainNames.begin(), m_chainNames.end() );
86 m_chainNames.erase(std::unique(m_chainNames.begin(), m_chainNames.end() ), m_chainNames.end() );
94 return StatusCode::SUCCESS;
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ interfaceID()
static const InterfaceID& DerivationFramework::IAugmentationTool::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
AlgTool interface methods.
Definition at line 31 of file IAugmentationTool.h.
31 {
return IID_IAugmentationTool; }
◆ matchParticles()
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ renounce()
◆ renounceArray()
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ 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 84 of file TriggerMatchingTool.h.
◆ m_detStore
◆ m_drThreshold
float DerivationFramework::TriggerMatchingTool::m_drThreshold |
|
private |
◆ m_evtStore
◆ 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 88 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 80 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 94 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 |
◆ m_varHandleArraysDeclared
◆ m_vhka
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.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
const T * get(size_type n) const
Access an element, as an rvalue.
bool msgLvl(const MSG::Level lvl) const
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.
virtual void setOwner(IDataHandleHolder *o)=0
bool insertIntoSortedVector(std::vector< T > &vec, const T &ele)
Helper function for inserting an element into a sorted vector.
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.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Description of a calorimeter cluster.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Class used to describe composite objects in the HLT.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
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)
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
@ Tau
The object is a tau (jet)
std::vector< std::string > getListOfTriggers() const
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>