13 std::tuple<HLT::class_id_type, xAOD::Type::ObjectType, std::string>;
15 template <std::
size_t FROM, std::
size_t TO>
17 typename std::tuple_element<TO, CLIDTuple_t>::type& to,
18 const typename std::tuple_element<FROM, CLIDTuple_t>::type& from)
20 static const std::vector<CLIDTuple_t> CLIDVector {
27 auto itr = std::find_if(CLIDVector.begin(), CLIDVector.end(),
28 [from] (
const CLIDTuple_t& tup) {
29 return std::get<FROM>(tup) == from;
31 if (itr == CLIDVector.end() )
34 to = std::get<TO>(*itr);
40 return CLIDLookUp<0, 1>(
type, clid);
44 return CLIDLookUp<1, 0>(clid,
type);
48 return CLIDLookUp<0, 2>(name, clid);
58 "The trigger decision tool to use.");
60 "Only spit a warning on a navigation error, don't cause a job failure.");
70 return StatusCode::SUCCESS;
74 std::vector<std::vector<const xAOD::IParticle*>>& combinations,
75 const std::string& chain,
86 <<
" is empty! This means that no matching chains were found!");
87 return StatusCode::FAILURE;
94 return StatusCode::SUCCESS;
103 std::vector<const xAOD::IParticle*> currentCombination;
104 bool navFailure =
false;
108 ATH_MSG_ERROR(
"Failed to retrieve particles for chain " << chain );
109 return StatusCode::FAILURE;
117 <<
" due to navigation failure");
119 combinations.push_back(currentCombination);
121 return StatusCode::SUCCESS;
125 std::vector<const xAOD::IParticle*>& combination,
127 bool& navFailure)
const
134 if (!CLIDToObjectType(
type, feature.getCLID() ) )
142 std::string message =
147 return StatusCode::SUCCESS;
151 return StatusCode::FAILURE;
156 ObjectTypeToCLID(clid, egType);
161 m_tdt->ExperimentalAndExpertMethods().getNavigation();
165 std::ostringstream os;
166 os <<
"Unable to retrieve feature of type " << egType
171 return StatusCode::SUCCESS;
175 return StatusCode::FAILURE;
180 return StatusCode::SUCCESS;
185 else if (egType !=
type) {
195 "'final' particles attached to it! This breaks this tool's asumptions!";
199 return StatusCode::SUCCESS;
203 return StatusCode::FAILURE;
208 return StatusCode::SUCCESS;
214 combination.push_back(part);
215 return StatusCode::SUCCESS;
223 return StatusCode::SUCCESS;
231 if (teName.find(
"etcut") != std::string::npos &&
232 teName.find(
"trkcut") == std::string::npos)
234 else if (teName.starts_with(
"EF_e"))
236 else if (teName.starts_with(
"EF_g"))
246 bool& navFailure)
const
249 std::string containerType;
250 if (!CLIDToContainerType(containerType, feature.
getCLID() ) ) {
254 return StatusCode::FAILURE;
259 m_tdt->ExperimentalAndExpertMethods().getNavigation();
263 auto typelessHolder = navigation->
getHolder(feature);
265 if (!typelessHolder) {
266 std::string message =
"Typeless holder for feature not present!";
270 return StatusCode::SUCCESS;
274 return StatusCode::FAILURE;
280 "HLT", containerType, typelessHolder->label() );
283 std::string message =
"Store does not contain " + key +
"!";
287 return StatusCode::SUCCESS;
291 return StatusCode::FAILURE;
296 if (cont->
size() < idx.objectsEnd() ) {
297 std::ostringstream os;
298 os <<
"Featured object end " << idx.objectsEnd()
299 <<
" is *after* the end of container " << key;
303 return StatusCode::SUCCESS;
307 return StatusCode::FAILURE;
310 std::vector<const xAOD::IParticle*> particleFeatures;
311 particleFeatures.reserve(idx.objectsEnd() - idx.objectsBegin() );
312 auto begin = cont->
begin();
313 auto end = cont->
begin();
314 std::advance(begin, idx.objectsBegin() );
315 std::advance(end, idx.objectsEnd() );
316 particleFeatures.insert(particleFeatures.end(), begin, end);
319 std::ostringstream os;
320 switch (particleFeatures.size() ) {
322 os <<
"No particles retrieved from feature "
328 return StatusCode::SUCCESS;
332 return StatusCode::FAILURE;
336 particle = particleFeatures.at(0);
344 particle = *(std::max_element(
345 particleFeatures.begin(), particleFeatures.end(),
347 { return lhs->pt() < rhs->pt(); }) );
349 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
const BaseHolder * getHolder(const TriggerElement::FeatureAccessHelper &fea) const
TriggerElement::FeatureAccessHelper getFeatureRecursively(const TriggerElement *startTE, class_id_type clid, const index_or_label_type &index_or_label, const TriggerElement *&sourceTE) const
recursive search for features the function is similar to the above butif th features is not found at ...
static const std::vector< TriggerElement * > & getDirectPredecessors(const TriggerElement *te)
returns list of direct predecessors (nodes seeding me)
std::string label(class_id_type clid, const index_or_label_type &sti_or_label) const
the FeatureAccessHelper is a class used to keep track of features attached to this TE.
const ObjectIndex & getIndex() const
index in the external ojects array
class_id_type getCLID() const
Class ID of object.
Helper class for conversion from/to int stored in TE and pair of ints used in Navigation Object point...
sub_index_type subTypeIndex() const
to get collection index
TriggerElement is the basic ingreedient of the interface between HLT algorithms and the navigation It...
const std::vector< FeatureAccessHelper > & getFeatureAccessHelpers() const
returns all features which ara attached to this TE
const FeatureContainer features(unsigned int condition=TrigDefs::Physics) const
returns all features related to given chain group of HLT chains or L1 items Note: This does not yet w...
bool isPassed(unsigned int condition=TrigDefs::Physics) const
tells if chain group passed
std::vector< std::string > getListOfTriggers() const
is a connector between chains and object It store single combination of trigger elements.
const std::vector< Trig::Combination > & getCombinations() const
gives back reference to combinations collected through append
~IParticleRetrievalTool() override
Default destructor.
IParticleRetrievalTool(const std::string &name)
Standard constructor.
xAOD::Type::ObjectType getEGammaTEType(const HLT::TriggerElement *te) const
Get the type of particle that should be retrieved from this TE.
StatusCode initialize() override
Initialise the tool.
bool m_warnOnNavigationFailure
Be forgiving about the navigation not matching our expectations.
StatusCode retrieveFeatureParticle(const xAOD::IParticle *&particle, const HLT::TriggerElement::FeatureAccessHelper &feature, const HLT::TriggerElement *te, bool &navFailure) const
Retrieve an IParticle from a feature.
ToolHandle< Trig::TrigDecisionTool > m_tdt
The TrigDecisionTool that will be used to get the navigation.
StatusCode retrieveParticles(std::vector< std::vector< const xAOD::IParticle * > > &combinations, const std::string &chain, bool rerun=false) const override
Retrieve the particles that caused this trigger to fire.
Class providing the definition of the 4-vector interface.
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
std::string formatSGkey(const std::string &prefix, const std::string &containername, const std::string &label)
declaration of formatting function.
static const unsigned int allowResurrectedDecision
static const unsigned int Physics
The common trigger namespace for trigger analysis tools.
std::string getTEName(const HLT::TriggerElement &te)
converts TEid to TE name (this may not always work, it depends on the availability of config)
ObjectType
Type of objects that have a representation in the xAOD EDM.
@ Photon
The object is a photon.
@ Other
An object not falling into any of the other categories.
@ CaloCluster
The object is a calorimeter cluster.
@ Muon
The object is a muon.
@ Electron
The object is an electron.
@ Tau
The object is a tau (jet)
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.