diff --git a/core/detectors/fsd/CbmFsdGeoHandler.cxx b/core/detectors/fsd/CbmFsdGeoHandler.cxx index 465e5ff2154d348f875d83115404669be117695e..d1b311fbb09349d02f581927dec2f693555a4f24 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++; }