CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/DataFormats/GeometrySurface/interface/Surface.h

Go to the documentation of this file.
00001 #ifndef Geom_Surface_H
00002 #define Geom_Surface_H
00003 
00004 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
00005 
00006 #include "DataFormats/GeometrySurface/interface/GloballyPositioned.h"
00007 
00008 
00009 #include "DataFormats/GeometrySurface/interface/MediumProperties.h"
00010 
00011 #include "FWCore/Utilities/interface/GCC11Compatibility.h"
00012 
00013 
00014 /*
00015 #include "DataFormats/GeometrySurface/interface/GlobalError.h"
00016 #include "DataFormats/GeometrySurface/interface/LocalError.h"
00017 */
00018 
00022 namespace SurfaceOrientation {
00023   enum Side {positiveSide, negativeSide, onSurface};
00024   enum GlobalFace {outer,inner,zplus,zminus,phiplus,phiminus};
00025 }
00026 
00027 
00028 //template <class T> class ReferenceCountingPointer;
00029 
00030 class TangentPlane;
00031 
00036 class Surface : public GloballyPositioned<float> 
00037                 , public ReferenceCountedInConditions 
00038 {
00039 public:
00040   typedef SurfaceOrientation::Side Side;
00041 
00042   typedef GloballyPositioned<float>       Base;
00043 
00044   Surface( const PositionType& pos, const RotationType& rot) :
00045     Base( pos, rot), theMediumProperties(0.,0.), m_mpSet(false) {}
00046 
00047   Surface( const PositionType& pos, const RotationType& rot, 
00048            MediumProperties* mp) : 
00049     Base( pos, rot), 
00050     theMediumProperties(mp? *mp : MediumProperties(0.,0.)),
00051     m_mpSet(mp)
00052   {}
00053  
00054  Surface( const PositionType& pos, const RotationType& rot,
00055            MediumProperties mp) :
00056     Base( pos, rot),
00057     theMediumProperties(mp),
00058     m_mpSet(true)
00059   {}
00060  
00061   Surface( const Surface& iSurface ) : 
00062   Base( iSurface), 
00063   theMediumProperties(iSurface.theMediumProperties),
00064   m_mpSet(iSurface.m_mpSet)
00065   {}
00066 
00067   // pure virtual destructor - makes base classs abstract
00068   virtual ~Surface() = 0;
00069 
00074   virtual Side side( const LocalPoint& p, Scalar tolerance=0) const = 0;
00075   virtual Side side( const GlobalPoint& p, Scalar tolerance=0) const {
00076     return side( toLocal(p), tolerance);
00077   }
00078 
00079   using Base::toGlobal;
00080   using Base::toLocal;
00081 
00082   GlobalPoint toGlobal( const Point2DBase< Scalar, LocalTag> lp) const {
00083     return GlobalPoint( rotation().multiplyInverse( lp.basicVector()) +
00084                         position().basicVector());
00085   }
00086 
00087   /*
00088   GlobalError toGlobal( const LocalError& le) const {
00089     return rotation().transform(le);
00090   }
00091 
00092   LocalError toLocal( const GlobalError& ge) const {
00093     return rotation().transform(ge);
00094   }
00095   */
00096 
00097   const MediumProperties* mediumProperties() const { 
00098     return  m_mpSet ? &theMediumProperties : 0;
00099   }
00100 
00101   void setMediumProperties( const MediumProperties & mp ) {
00102     theMediumProperties = mp;
00103     m_mpSet = true;
00104   }
00105 
00106   void setMediumProperties( MediumProperties* mp ) {
00107     if (mp) {
00108       theMediumProperties = *mp;
00109       m_mpSet = true;
00110     } else {
00111       theMediumProperties = MediumProperties(0.,0.);
00112       m_mpSet = false;
00113     }
00114   }
00115 
00122   virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const GlobalPoint&) const = 0;
00125   virtual ReferenceCountingPointer<TangentPlane> tangentPlane (const LocalPoint&) const = 0;
00126 
00127 private:
00128 
00129   MediumProperties theMediumProperties;
00130   bool m_mpSet;
00131 };
00132   
00133 inline Surface::~Surface() {}
00134 
00135 #endif // Geom_Surface_H