Skip to content
Snippets Groups Projects
Commit 4e32d391 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'checkTauPtBins' into 'master'

Add protection against missing decorations for single particles in InDetPhysValMonitoring

See merge request atlas/athena!39119
parents 6360fa7c a3215627
No related branches found
No related tags found
No related merge requests found
......@@ -286,19 +286,28 @@ const xAOD::TruthVertex* InDetPerfPlot_VertexTruthMatching::getTruthVertex(const
const xAOD::TruthVertex* truthVtx = nullptr;
if (recoVtx) {
const static xAOD::Vertex::Decorator<std::vector<InDetVertexTruthMatchUtils::VertexTruthMatchInfo>> truthMatchingInfos("TruthEventMatchingInfos");
const std::vector<InDetVertexTruthMatchUtils::VertexTruthMatchInfo>& truthInfos = truthMatchingInfos(*recoVtx);
if (!truthInfos.empty()) {
const InDetVertexTruthMatchUtils::VertexTruthMatchInfo& truthInfo = truthInfos.at(0);
const ElementLink<xAOD::TruthEventBaseContainer> truthEventLink = std::get<0>(truthInfo);
const xAOD::TruthEvent* truthEvent = nullptr;
if (truthEventLink.isValid()) {
truthEvent = static_cast<const xAOD::TruthEvent*>(*truthEventLink);
if (truthEvent) {
truthVtx = truthEvent->truthVertex(0);
try{
if (!truthMatchingInfos.isAvailable(*recoVtx)){
ATH_MSG_WARNING("TruthEventMatchingInfos DECORATOR not available -- returning nullptr!");
return truthVtx;
}
const std::vector<InDetVertexTruthMatchUtils::VertexTruthMatchInfo>& truthInfos = truthMatchingInfos(*recoVtx);
if (!truthInfos.empty()) {
const InDetVertexTruthMatchUtils::VertexTruthMatchInfo& truthInfo = truthInfos.at(0);
const ElementLink<xAOD::TruthEventBaseContainer> truthEventLink = std::get<0>(truthInfo);
const xAOD::TruthEvent* truthEvent = nullptr;
if (truthEventLink.isValid()) {
truthEvent = static_cast<const xAOD::TruthEvent*>(*truthEventLink);
if (truthEvent) {
truthVtx = truthEvent->truthVertex(0);
}
}
}
else {
ATH_MSG_WARNING("TruthEventMatchingInfos DECORATOR yields empty vector -- returning nullptr!");
}
}
else {
catch (SG::ExcBadAuxVar &){
ATH_MSG_WARNING("TruthEventMatchingInfos DECORATOR yields empty vector -- returning nullptr!");
}
}
......
......@@ -47,12 +47,20 @@ const std::vector<std::pair<const xAOD::Vertex*, size_t> > hardScatterMatches( c
//loop and look
for ( auto vxit : vxContainer ) {
const std::vector<VertexTruthMatchInfo> & info = matchInfoDecor( *vxit );
for ( size_t i = 0; i < info.size(); ++i ) {
if ( isHardScatterEvent( std::get<0>(info[i]) ) ) {
result.push_back( std::make_pair(vxit, i) );
break;
try{
const std::vector<VertexTruthMatchInfo> & info = matchInfoDecor( *vxit );
if (!matchInfoDecor.isAvailable(*vxit)){
return result;
}
for ( size_t i = 0; i < info.size(); ++i ) {
if ( isHardScatterEvent( std::get<0>(info[i]) ) ) {
result.push_back( std::make_pair(vxit, i) );
break;
}
}
}
catch (SG::ExcBadAuxVar &){
return result;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment