CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/Geometry/CommonDetUnit/interface/ModifiedSurfaceGenerator.h

Go to the documentation of this file.
00001 #ifndef ModifiedSurfaceGenerator_h_
00002 #define ModifiedSurfaceGenerator_h_
00003 
00004 #include "DataFormats/GeometrySurface/interface/BoundSurface.h"
00005 
00009 template <class T> class ConstReferenceCountingPointer;
00010 template <class T> class ReferenceCountingPointer;
00011 class MediumProperties;
00012 
00013 template <class T> class ModifiedSurfaceGenerator {
00014 private:
00015   typedef ReferenceCountingPointer<T> SurfacePointer;
00016 
00017 public:
00019   ModifiedSurfaceGenerator (const T* surface) :
00020     theSurface(surface) {}
00022   ModifiedSurfaceGenerator (const SurfacePointer surface) :
00023     theSurface(surface.get()) {}
00026   SurfacePointer atNewPosition (const Surface::PositionType& position,
00027                                 const Surface::RotationType& rotation) const {
00028     const MediumProperties* mp(theSurface->mediumProperties());
00029     SurfacePointer newSurface(new T(position, rotation,theSurface->bounds()));
00030     if ( mp ) newSurface->setMediumProperties(const_cast<MediumProperties*>(mp));
00031     return newSurface;
00032   }
00033 
00034 private:
00036   ConstReferenceCountingPointer<T> theSurface;
00037 };
00038 
00039 #endif