From eabe135a25ff2a08462f0f18d1e27744aaab6fbf Mon Sep 17 00:00:00 2001 From: Elmar Ritsch <Elmar.Ritsch@cern.ch> Date: Wed, 22 Oct 2014 08:05:22 +0200 Subject: [PATCH] bugfix in IEnvelopeDefSvc::mirrorRZ(..) method (ATLASSIM-1601, Coverity #17631) (SubDetectorEnvelopes-00-03-01) * IEnvelopeDefSvc.h: bugfix in mirrorRZ(..) method (ATLASSIM-1601, Coverity #17631) * tagging SubDetectorEnvelopes-00-03-01 2014-10-21 Elmar Ritsch < Elmar.Ritsch -at- cern.ch > * IEnvelopeDefSvc.h: updated interface regarding the mirrorRZ(..) method (ATLASSIM-1601, Coverity #17631) * tagging SubDetectorEnvelopes-00-03-00 2014-10-15 Elmar Ritsch < Elmar.Ritsch -at- cern.ch > * DetDescrDBEnvelopeSvc.cxx: change WARNING messages into INFO when using Python-based envelope definitions * tagging SubDetectorEnvelopes-00-02-03 --- .../SubDetectorEnvelopes/IEnvelopeDefSvc.h | 24 +++++++++---------- .../src/DetDescrDBEnvelopeSvc.cxx | 16 ++++++++----- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/AtlasGeometryCommon/SubDetectorEnvelopes/SubDetectorEnvelopes/IEnvelopeDefSvc.h b/AtlasGeometryCommon/SubDetectorEnvelopes/SubDetectorEnvelopes/IEnvelopeDefSvc.h index f1d5ec05b9f..41be29f1f11 100644 --- a/AtlasGeometryCommon/SubDetectorEnvelopes/SubDetectorEnvelopes/IEnvelopeDefSvc.h +++ b/AtlasGeometryCommon/SubDetectorEnvelopes/SubDetectorEnvelopes/IEnvelopeDefSvc.h @@ -61,34 +61,34 @@ class IEnvelopeDefSvc : virtual public IInterface { RZPairVector &getCavernRZValues( unsigned short = 0) const { return const_cast<RZPairVector&>( getRZBoundary(AtlasDetDescr::fAtlasCavern) ); } protected: - /** mirror the given RZPairs in the XY-plane to describe all corner points - in (r,z) space */ - inline RZPairVector *mirrorRZ( RZPairVector &rposz ) const ; + /** mirror the given srcRZ RZPairVector in the XY-plane to describe all corner points + in (r,z) space in the dstRZ RZPairVector */ + inline void mirrorRZ( const RZPairVector &srcRZ, RZPairVector &dstRZ ) const ; }; /** mirror the given RZPairs in the XY-plane to describe all corner points in (r,z) space */ -inline RZPairVector *IEnvelopeDefSvc::mirrorRZ( RZPairVector &rposz ) const +inline void IEnvelopeDefSvc::mirrorRZ( const RZPairVector &srcRZ, RZPairVector &dstRZ ) const { - int numPosPairs = rposz.size(); - // the mirrored envelope will have exactly twice as many entries as the given rposz - RZPairVector *completeRZ = new RZPairVector(2*numPosPairs); + int numPosPairs = srcRZ.size(); + // the mirrored envelope will have exactly twice as many entries as the given srcRZ + dstRZ.resize(2*numPosPairs); // loop over all positive (r,z) pairs for ( int curNum = 0; curNum<numPosPairs; curNum++) { - double curR = rposz[curNum].first; - double curZ = rposz[curNum].second; + double curR = srcRZ[curNum].first; + double curZ = srcRZ[curNum].second; // debugging output: //std::cout << "Envelope: pos=" << curNum << " r=" << curR << " z="<< curZ << std::endl; // fill in the z<0 side - (*completeRZ)[numPosPairs-curNum-1] = RZPair(curR, -curZ); + dstRZ[numPosPairs-curNum-1] = RZPair(curR, -curZ); // fill in the z>0 side - (*completeRZ)[numPosPairs+curNum] = RZPair(curR, curZ); + dstRZ[numPosPairs+curNum] = RZPair(curR, curZ); } - return completeRZ; + return; } #endif // IENVELOPEDEFSVC_H diff --git a/AtlasGeometryCommon/SubDetectorEnvelopes/src/DetDescrDBEnvelopeSvc.cxx b/AtlasGeometryCommon/SubDetectorEnvelopes/src/DetDescrDBEnvelopeSvc.cxx index a2b52831f29..5ad06cf973f 100644 --- a/AtlasGeometryCommon/SubDetectorEnvelopes/src/DetDescrDBEnvelopeSvc.cxx +++ b/AtlasGeometryCommon/SubDetectorEnvelopes/src/DetDescrDBEnvelopeSvc.cxx @@ -148,7 +148,7 @@ StatusCode DetDescrDBEnvelopeSvc::initialize() // in (r,z) space for each envelope volume for ( int region = AtlasDetDescr::fFirstAtlasRegion; region < AtlasDetDescr::fNumAtlasRegions; region++) { ATH_MSG_VERBOSE( "Envelope: positive-z region=" << region); - m_rz[region] = *mirrorRZ( m_rposz[region] ); + mirrorRZ( m_rposz[region], m_rz[region] ); } // debugging output: @@ -185,13 +185,17 @@ RZPairVector *DetDescrDBEnvelopeSvc::retrieveRZBoundaryOptionalFallback( // try the DB approach to retrieve the (r,z) values RZPairVector *rz = retrieveRZBoundary(dbNode); - // if 0 return value -> something went wrong + // if 0 return value -> unsuccessfully read DDDB if (!rz) { - ATH_MSG_WARNING("Problems retrieving the envelope volume definition from DDDB node '" - << dbNode << "'."); + ATH_MSG_DEBUG("Will try reading Python-based envelope definition for '" << dbNode << "'."); + // try fallback approach rz = enableFallback() ? fallbackRZBoundary(r, z) : 0; - if (rz) ATH_MSG_INFO("Fallback envelope volume definition created for " << dbNode); + if (rz) { + ATH_MSG_INFO("Sucessfully read Python-based envelope definition for '" << dbNode << "'."); + } else { + ATH_MSG_WARNING("Could not create envelope volume for '" << dbNode << "'."); + } } return rz; @@ -232,7 +236,7 @@ RZPairVector *DetDescrDBEnvelopeSvc::retrieveRZBoundary( std::string &node) // entries in the database table size_t numEntries = envelopeRec ? envelopeRec->size() : 0; if ( !numEntries) { - ATH_MSG_WARNING("No entries for table '" << node << "' in Detector Description DB. Will skip this envelope volume."); + ATH_MSG_INFO("No entries for table '" << node << "' in Detector Description Database (DDDB). Maybe you are using Python-based envelope definitions..."); return 0; } -- GitLab