Commit 697c5803 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'derivesFrom.xAODTrigger-20211111' into 'master'

xAODTrigger+TrigCompositeUtils: Implement derivesFromIParticle.

See merge request atlas/athena!48160
parents 39fc53c4 775c6fde
......@@ -17,8 +17,17 @@
// Local include(s):
#include "xAODTrigger/versions/TrigComposite_v1.h"
#ifndef XAOD_STANDALONE
#include "AthenaKernel/BaseInfo.h"
#endif
namespace xAOD {
ExcNotIParticleContainer::ExcNotIParticleContainer (const std::string& msg)
: std::runtime_error (msg)
{
}
const std::string TrigComposite_v1::s_collectionSuffix{"__COLL"};
......@@ -261,9 +270,14 @@ namespace xAOD {
return false;
}
bool TrigComposite_v1::derivesFromIParticle(const CLID /*clid*/) const {
// It would be nice to include some logic here.
return true;
bool TrigComposite_v1::derivesFromIParticle(const CLID clid [[maybe_unused]]) const {
#ifndef XAOD_STANDALONE
const SG::BaseInfoBase* bib = SG::BaseInfoBase::find (clid);
if (bib) {
return bib->is_base (ClassID_traits< xAOD::IParticleContainer >::ID());
}
#endif
return true;
}
AUXSTORE_OBJECT_GETTER( TrigComposite_v1, std::vector< std::string >,
......
......@@ -30,6 +30,13 @@ namespace TrigCompositeUtils{
namespace xAOD {
class ExcNotIParticleContainer
: public std::runtime_error
{
public:
ExcNotIParticleContainer (const std::string& msg);
};
/// Class used to describe composite objects in the HLT
///
/// This is a generic class for describing the output of high-level
......
// Dear emacs, this is -*- c++ -*-
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
// $Id: TrigComposite_v1.icc 784388 2016-11-15 17:08:58Z tamartin $
......@@ -303,8 +303,8 @@ namespace xAOD {
void TrigComposite_v1::checkTypes(const uint32_t storedCLID, const std::string& name) const {
if (ClassID_traits< CONTAINER >::ID() == ClassID_traits< xAOD::IParticleContainer >::ID()) {
if (!derivesFromIParticle(storedCLID)) {
throw std::runtime_error( "xAOD::TrigComposite::checkTypes: "
"Cannot retrieve \"" + name + "\" as an IParticle");
throw ExcNotIParticleContainer( "xAOD::TrigComposite::checkTypes: "
"Cannot retrieve \"" + name + "\" as an IParticle");
}
} else if (ClassID_traits< CONTAINER >::ID() != storedCLID) {
const std::string typeName = SG::normalizedTypeinfoName( typeid( CONTAINER ) );
......
......@@ -540,7 +540,7 @@ int main ATLAS_NOT_THREAD_SAFE () {
// Check retrieval of a link which does NOT derive from IParticle
END->setObjectLink<DecisionContainer>("notAnIParticle", end_link);
EXPECT_EXCEPTION (SG::ExcCLIDMismatch, END->objectLink<xAOD::IParticleContainer>("notAnIParticle"));
EXPECT_EXCEPTION (xAOD::ExcNotIParticleContainer, END->objectLink<xAOD::IParticleContainer>("notAnIParticle"));
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment