From 174ea7f4dbc2ec3c53937e25a4aeb7813dcb7412 Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Tue, 21 Nov 2023 09:55:37 +0100 Subject: [PATCH] Fix runtime warnings from TGeant3 While accessing geometry information from TGeant3 a level outside of the geometry hierarchy was requested. Exit from loop when needed information is found. refs #3092 --- core/detectors/fsd/CbmFsdGeoHandler.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/detectors/fsd/CbmFsdGeoHandler.cxx b/core/detectors/fsd/CbmFsdGeoHandler.cxx index 465e5ff215..d1b311fbb0 100644 --- a/core/detectors/fsd/CbmFsdGeoHandler.cxx +++ b/core/detectors/fsd/CbmFsdGeoHandler.cxx @@ -120,10 +120,15 @@ int32_t CbmFsdGeoHandler::GetCurrentAddress(TVirtualMC* vmc) const Int_t upstreamOffset = 0; while (((TString) vmc->CurrentVolOffName(upstreamOffset)).Length() > 0) { - if (((TString) vmc->CurrentVolOffName(upstreamOffset)).Contains(fUnitStr)) + if (((TString) vmc->CurrentVolOffName(upstreamOffset)).Contains(fUnitStr)) { vmc->CurrentVolOffID(upstreamOffset, unitID); - if (((TString) vmc->CurrentVolOffName(upstreamOffset)).Contains(fModuleStr)) + } + if (((TString) vmc->CurrentVolOffName(upstreamOffset)).Contains(fModuleStr)) { vmc->CurrentVolOffID(upstreamOffset, moduleID); + } + // if module and unit information was found one can + // exit the loop + if (moduleID > -1 && unitID > -1) { break; } upstreamOffset++; } -- GitLab