From 2f15c89f064fa1dbd4b1322ee37d972ff69203ce Mon Sep 17 00:00:00 2001 From: Gabriel Facini <gabriel.facini@cern.ch> Date: Wed, 4 Nov 2020 14:11:55 +0000 Subject: [PATCH] fix PixelGangedClusterAmbiguities "feature" Some pixel clusters have the same identity PixelGangedClusterAmbiguities confuses them to be the same since it uses the identity to sort now use the width to sort when the identity is the same --- .../PixelGangedClusterAmbiguities.h | 7 +++++ .../InDetPrepRawData/SiWidth.h | 29 +++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelGangedClusterAmbiguities.h b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelGangedClusterAmbiguities.h index 3e044d86b77a..fe1968a56e74 100755 --- a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelGangedClusterAmbiguities.h +++ b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/PixelGangedClusterAmbiguities.h @@ -26,6 +26,13 @@ namespace InDet{ { Identifier ida = (a!=0 ? a->identify() : Identifier(0)); Identifier idb = (b!=0 ? b->identify() : Identifier(0)); + + // sometimes different clusters have the same identity + // use the size to determine the order/break degeneracy + if( ida == idb && ida != Identifier(0) ) { + return (a->width() < b->width()); + } + return ida < idb; } }; diff --git a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiWidth.h b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiWidth.h index 563e23dfab39..f7663d62483c 100755 --- a/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiWidth.h +++ b/InnerDetector/InDetRecEvent/InDetPrepRawData/InDetPrepRawData/SiWidth.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -63,6 +63,9 @@ namespace InDet { // return z double z() const; + // comparison + bool operator <(const SiWidth& width) const; + bool operator >(const SiWidth& width) const; /////////////////////////////////////////////////////////////////// // Non-const methods: @@ -128,6 +131,28 @@ namespace InDet { { return m_phirzWidth[Trk::locZ]; } + + // comparison + // return true if smaller in either direction + inline bool InDet::SiWidth::operator <(const InDet::SiWidth &width) const + { + // size phi + if ( m_colrow[0] < width.colRow()[0] ) { return true; } + // size z + if ( m_colrow[1] < width.colRow()[1] ) { return true; } + return false; + } + + // flip logic of < + inline bool InDet::SiWidth::operator >(const InDet::SiWidth &width) const + { + // size phi + if ( m_colrow[0] < width.colRow()[0] ) { return false; } + // size z + if ( m_colrow[1] < width.colRow()[1] ) { return false; } + return true; + } + inline void SiWidth::setColumn(const double col) { @@ -137,7 +162,7 @@ namespace InDet { inline void SiWidth::setRow(const double row) { m_colrow[1] = row; - } + } inline void SiWidth::setColRow(const Amg::Vector2D& colRow) { -- GitLab