From bed5affd16f6e5eff3458718fda336a90bb5ef84 Mon Sep 17 00:00:00 2001 From: scott snyder Date: Wed, 12 Feb 2020 04:05:55 -0500 Subject: [PATCH] Fix compilation warnings. - Fix dangling reference to potentially-deleted temporary. - Avoid shadowing class members with local variables. --- src/DDConeMeasLayer.cc | 6 +++--- src/DDCylinderMeasLayer.cc | 2 +- src/DDPlanarMeasLayer.cc | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/DDConeMeasLayer.cc b/src/DDConeMeasLayer.cc index b0065d2..7d80e8f 100644 --- a/src/DDConeMeasLayer.cc +++ b/src/DDConeMeasLayer.cc @@ -104,16 +104,16 @@ Bool_t DDConeMeasLayer::IsOnSurface(const TVector3 &xx) const { Double_t r = xxc.Perp(); Double_t z = xxc.Z(); Double_t s = (r - GetTanA()*z) * (r + GetTanA()*z); - const Double_t kTol = 1.e-8; + const Double_t tol = 1.e-8; #if 0 std::cout << this->TVMeasLayer::GetName() << ":" << this->GetIndex() << ":" << "s=" << s << " xx=(" << xx.X() << "," << xx.Y() << "," << xx.Z() << ")" - << "bool=" << (TMath::Abs(s) < kTol && ((xx.Z()-_Z1)*(xx.Z()-_Z2) <= 0.)) + << "bool=" << (TMath::Abs(s) < tol && ((xx.Z()-_Z1)*(xx.Z()-_Z2) <= 0.)) << "_Z1=" << _Z1 << " _Z2=" << _Z2 << std::endl; #endif - return (TMath::Abs(s) < kTol && ((xx.Z()-_Z1)*(xx.Z()-_Z2) <= 0.)); + return (TMath::Abs(s) < tol && ((xx.Z()-_Z1)*(xx.Z()-_Z2) <= 0.)); } Int_t DDConeMeasLayer::CalcXingPointWith(const TVTrack &hel, diff --git a/src/DDCylinderMeasLayer.cc b/src/DDCylinderMeasLayer.cc index 991df32..96a5c84 100644 --- a/src/DDCylinderMeasLayer.cc +++ b/src/DDCylinderMeasLayer.cc @@ -58,7 +58,7 @@ DDCylinderMeasLayer::DDCylinderMeasLayer(dd4hep::rec::ISurface* surf, _cellIDs.push_back( encoder.lowWord() ) ; } - fSortingPolicy = dynamic_cast(surf)->radius()/dd4hep::mm + side * epsilon ; + fSortingPolicy = dynamic_cast(*surf).radius()/dd4hep::mm + side * epsilon ; // assumptions made here: the cylinder runs parallel to z and v ... diff --git a/src/DDPlanarMeasLayer.cc b/src/DDPlanarMeasLayer.cc index 4f518a1..cbddd41 100644 --- a/src/DDPlanarMeasLayer.cc +++ b/src/DDPlanarMeasLayer.cc @@ -62,7 +62,8 @@ DDPlanarMeasLayer::DDPlanarMeasLayer(dd4hep::rec::ISurface* surf, Double_t Bz, // get global/local origin const dd4hep::rec::Vector3D& o = surf->origin() ; - const dd4hep::rec::Vector3D& oL = ((dd4hep::rec::Surface*)surf)->volSurface().origin() ; + dd4hep::rec::VolSurface vs = ((dd4hep::rec::Surface*)surf)->volSurface(); + const dd4hep::rec::Vector3D& oL = vs.origin() ; // dd4hep::rec::Vector3D oR( o[0] , o[1] , 0 ) ; // radial direction of origin in global coordinates // if ( oR.trans2() < epsilon ){ // if origin has zero length use x-axis