Skip to content

Commit

Permalink
Merge pull request #7409 from Dr15Jones/constCorrectGeometry
Browse files Browse the repository at this point in the history
Make GeometrySurface code fully const correct
  • Loading branch information
ktf committed Jan 29, 2015
2 parents 762675b + c066818 commit 1ddce9c
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 34 deletions.
Expand Up @@ -758,10 +758,10 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack

if( isolatedMuonMode_ ){ //------------------------------- Isolated Muon -----
const Surface& refSurface = innerMuTSOS.surface();
ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
tpMuLocal(refSurface.tangentPlane(innerMuTSOS.localPosition()));
Nl = tpMuLocal->normalVector();
ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
tpMuGlobal(refSurface.tangentPlane(innerMuTSOS.globalPosition()));
GlobalVector Ng = tpMuGlobal->normalVector();
Surface* surf = (Surface*)&refSurface;
Expand Down Expand Up @@ -819,7 +819,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack
if(debug_) std::cout<<" ----- Out - In -----"<<std::endl;

const Surface& refSurface = innerMuTSOS.surface();
ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
tpMuGlobal(refSurface.tangentPlane(innerMuTSOS.globalPosition()));
Nl = tpMuGlobal->normalVector();

Expand Down Expand Up @@ -876,7 +876,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack
if(debug_) std::cout<<" ----- In - Out -----"<<std::endl;

const Surface& refSurface = outerMuTSOS.surface();
ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
tpMuGlobal(refSurface.tangentPlane(outerMuTSOS.globalPosition()));
Nl = tpMuGlobal->normalVector();

Expand Down Expand Up @@ -934,7 +934,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrack
continue;

const Surface& refSurface = outerMuTSOS.surface();
ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
tpMuGlobal(refSurface.tangentPlane(outerMuTSOS.globalPosition()));
Nl = tpMuGlobal->normalVector();

Expand Down Expand Up @@ -1477,10 +1477,10 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory
if( isolatedMuonMode_ ){ //------------------------------- Isolated Muon --- Out-In --
if(debug_) std::cout<<" ------ Isolated (out-in) ----- "<<std::endl;
const Surface& refSurface = innerMuTSOS.surface();
ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
tpMuLocal(refSurface.tangentPlane(innerMuTSOS.localPosition()));
Nl = tpMuLocal->normalVector();
ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
tpMuGlobal(refSurface.tangentPlane(innerMuTSOS.globalPosition()));
GlobalVector Ng = tpMuGlobal->normalVector();
Surface* surf = (Surface*)&refSurface;
Expand Down Expand Up @@ -1550,7 +1550,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory
if(debug_) std::cout<<" ----- Out - In -----"<<std::endl;

const Surface& refSurface = innerMuTSOS.surface();
ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
tpMuGlobal(refSurface.tangentPlane(innerMuTSOS.globalPosition()));
Nl = tpMuGlobal->normalVector();

Expand Down Expand Up @@ -1617,7 +1617,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory
if(debug_) std::cout<<" ----- In - Out -----"<<std::endl;

const Surface& refSurface = outerMuTSOS.surface();
ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
tpMuGlobal(refSurface.tangentPlane(outerMuTSOS.globalPosition()));
Nl = tpMuGlobal->normalVector();

Expand Down Expand Up @@ -1686,7 +1686,7 @@ void GlobalTrackerMuonAlignment::analyzeTrackTrajectory
continue;

const Surface& refSurface = outerMuTSOS.surface();
ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
tpMuGlobal(refSurface.tangentPlane(outerMuTSOS.globalPosition()));
Nl = tpMuGlobal->normalVector();

Expand Down
4 changes: 2 additions & 2 deletions DataFormats/GeometrySurface/interface/Cone.h
Expand Up @@ -64,9 +64,9 @@ class Cone GCC11_FINAL : public Surface {
virtual Side side( const GlobalPoint& p, Scalar tolerance) const;

// Tangent plane to surface from global point
virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const;
virtual ConstReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const;
// Tangent plane to surface from local point
virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const;
virtual ConstReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const;


private:
Expand Down
4 changes: 2 additions & 2 deletions DataFormats/GeometrySurface/interface/Cylinder.h
Expand Up @@ -72,9 +72,9 @@ class Cylinder GCC11_FINAL : public Surface {
virtual Side side( const LocalPoint& p, Scalar toler) const;

/// tangent plane to surface from global point
virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const;
virtual ConstReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const;
/// tangent plane to surface from local point
virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const;
virtual ConstReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const;

/// tangent plane to surface from global point
Plane fastTangent(const GlobalPoint& aPoint) const{
Expand Down
4 changes: 2 additions & 2 deletions DataFormats/GeometrySurface/interface/Plane.h
Expand Up @@ -82,10 +82,10 @@ class Plane : public Surface {
}

/// tangent plane to surface from global point
virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const GCC11_FINAL;
virtual ConstReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const GCC11_FINAL;

/// tangent plane to surface from local point
virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const GCC11_FINAL;
virtual ConstReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const GCC11_FINAL;

private:
void setPosPrec() {
Expand Down
4 changes: 2 additions & 2 deletions DataFormats/GeometrySurface/interface/Surface.h
Expand Up @@ -139,10 +139,10 @@ class Surface : public GloballyPositioned<float>
* The return type is a ReferenceCountingPointer, so the plane
* will be deleted automatically when no longer needed.
*/
virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const = 0;
virtual ConstReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const = 0;
/** Tangent plane to surface from local point.
*/
virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const = 0;
virtual ConstReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const = 0;

protected:
MediumProperties theMediumProperties;
Expand Down
8 changes: 4 additions & 4 deletions DataFormats/GeometrySurface/src/Cone.cc
Expand Up @@ -5,18 +5,18 @@

#include <iostream>

ReferenceCountingPointer<TangentPlane> Cone::tangentPlane (const GlobalPoint&) const {
ConstReferenceCountingPointer<TangentPlane> Cone::tangentPlane (const GlobalPoint&) const {
// FIXME: to be implemented...
std::cout << "*** WARNING: Cone::tangentPlane not implemented." <<std::endl;
abort();
return ReferenceCountingPointer<TangentPlane>();
return ConstReferenceCountingPointer<TangentPlane>();
}

ReferenceCountingPointer<TangentPlane> Cone::tangentPlane (const LocalPoint&) const {
ConstReferenceCountingPointer<TangentPlane> Cone::tangentPlane (const LocalPoint&) const {
// FIXME: to be implemented...
std::cout << "*** WARNING: Cone::tangentPlane not implemented." <<std::endl;
abort();
return ReferenceCountingPointer<TangentPlane>();
return ConstReferenceCountingPointer<TangentPlane>();
}

Surface::Side Cone::side( const GlobalPoint& p, Scalar tolerance) const {
Expand Down
6 changes: 3 additions & 3 deletions DataFormats/GeometrySurface/src/Cylinder.cc
Expand Up @@ -13,13 +13,13 @@ Surface::Side Cylinder::side( const LocalPoint& p, Scalar toler) const
(lz>0 ? SurfaceOrientation::positiveSide : SurfaceOrientation::negativeSide));
}

ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
Cylinder::tangentPlane (const LocalPoint& aPoint) const
{
return tangentPlane(toGlobal(aPoint));
}

ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
Cylinder::tangentPlane (const GlobalPoint& aPoint) const
{
//
Expand All @@ -38,7 +38,7 @@ Cylinder::tangentPlane (const GlobalPoint& aPoint) const
// // local z defined by x and y (should point outwards from axis)
// GlobalVector zPlane(xPlane.cross(yPlane));
// rotation constructor will normalize...
return ReferenceCountingPointer<TangentPlane>(new TangentPlane(aPoint,
return ConstReferenceCountingPointer<TangentPlane>(new TangentPlane(aPoint,
RotationType(xPlane,
yPlane)
));
Expand Down
8 changes: 4 additions & 4 deletions DataFormats/GeometrySurface/src/Plane.cc
Expand Up @@ -2,14 +2,14 @@
#include "DataFormats/GeometrySurface/interface/TangentPlane.h"


ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
Plane::tangentPlane (const GlobalPoint&) const
{
return ReferenceCountingPointer<TangentPlane>(const_cast<Plane*>(this));
return ConstReferenceCountingPointer<TangentPlane>(this);
}

ReferenceCountingPointer<TangentPlane>
ConstReferenceCountingPointer<TangentPlane>
Plane::tangentPlane (const LocalPoint&) const
{
return ReferenceCountingPointer<TangentPlane>(const_cast<Plane*>(this));
return ConstReferenceCountingPointer<TangentPlane>(this);
}
2 changes: 1 addition & 1 deletion FastSimulation/TrajectoryManager/src/TrajectoryManager.cc
Expand Up @@ -593,7 +593,7 @@ TrajectoryManager::makeTrajectoryState( const DetLayer* layer,
{
GlobalPoint pos( pp.X(), pp.Y(), pp.Z());
GlobalVector mom( pp.Px(), pp.Py(), pp.Pz());
ReferenceCountingPointer<TangentPlane> plane = layer->surface().tangentPlane(pos);
auto plane = layer->surface().tangentPlane(pos);
return TrajectoryStateOnSurface
(GlobalTrajectoryParameters( pos, mom, TrackCharge( pp.charge()), field), *plane);
}
Expand Down
4 changes: 2 additions & 2 deletions RecoMuon/GlobalTrackingTools/src/GlobalMuonTrackMatcher.cc
Expand Up @@ -522,8 +522,8 @@ GlobalMuonTrackMatcher::samePlane(const TrajectoryStateOnSurface& tsos1,
const float maxtilt = 0.999;
const float maxdist = 0.01; // in cm

ReferenceCountingPointer<TangentPlane> p1(tsos1.surface().tangentPlane(tsos1.localPosition()));
ReferenceCountingPointer<TangentPlane> p2(tsos2.surface().tangentPlane(tsos2.localPosition()));
auto p1(tsos1.surface().tangentPlane(tsos1.localPosition()));
auto p2(tsos2.surface().tangentPlane(tsos2.localPosition()));

bool returnValue = ( (fabs(p1->normalVector().dot(p2->normalVector())) > maxtilt) || (fabs((p1->toLocal(p2->position())).z()) < maxdist) ) ? true : false;

Expand Down
Expand Up @@ -544,7 +544,7 @@ ConvBremSeedProducer::makeTrajectoryState( const DetLayer* layer,
GlobalPoint pos( pp.X(), pp.Y(), pp.Z());
GlobalVector mom( pp.Px(), pp.Py(), pp.Pz());

ReferenceCountingPointer<TangentPlane> plane = layer->surface().tangentPlane(pos);
auto plane = layer->surface().tangentPlane(pos);

return TrajectoryStateOnSurface
(GlobalTrajectoryParameters( pos, mom, TrackCharge( pp.charge()), field), *plane);
Expand Down
2 changes: 1 addition & 1 deletion TrackingTools/GeomPropagators/src/AnalyticalPropagator.cc
Expand Up @@ -95,7 +95,7 @@ AnalyticalPropagator::propagateWithPath(const FreeTrajectoryState& fts,
//

//try {
ReferenceCountingPointer<TangentPlane> plane(cylinder.tangentPlane(x)); // need to be here until tsos is created!
ConstReferenceCountingPointer<TangentPlane> plane(cylinder.tangentPlane(x)); // need to be here until tsos is created!
return propagatedStateWithPath(fts,*plane,gtp,s);
/*
} catch(...) {
Expand Down

0 comments on commit 1ddce9c

Please sign in to comment.