Skip to content

Commit

Permalink
Fix id-name conistency check in Inst.Def.Parser
Browse files Browse the repository at this point in the history
Refs #9959
  • Loading branch information
Harry Jeffery committed Jul 28, 2014
1 parent db68243 commit 7dfe28c
Showing 1 changed file with 6 additions and 13 deletions.
Expand Up @@ -1970,23 +1970,16 @@ namespace Geometry
//If the user also supplied a name, make sure it's consistent with the detector id.
if(name.length() > 0)
{
std::vector<boost::shared_ptr<const Geometry::IComponent> > comps = instrument->getAllComponentsWithName(name);
bool consistent = false;
for(auto it = comps.begin(); it != comps.end(); ++it)
auto comp = boost::dynamic_pointer_cast<const IComponent>(detector);
if(comp)
{
//If the name matches the detector
if((*it)->getComponentID() != detector->getComponentID())
bool consistent = (comp->getFullName() == name || comp->getName() == name);
if(!consistent)
{
consistent = true;
break;
g_log.error() << "Error whilst loading parameters. Name '" << name << "' does not match id '" << detid << "'." << std::endl;
g_log.error() << "Parameters have been applied to detector with id '" << detid << "'. Please check the name is correct." << std::endl;
}
}

if(!consistent)
{
g_log.error() << "Error whilst loading parameters. Name '" << name << "' does not match id '" << detid << "'." << std::endl;
g_log.error() << "Parameters have been applied to detector with id '" << detid << "'. Please check the name is correct.";
}
}
}
else
Expand Down

0 comments on commit 7dfe28c

Please sign in to comment.