Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:49:08

0001 #ifndef ModifiedSurfaceGenerator_h_
0002 #define ModifiedSurfaceGenerator_h_
0003 
0004 #include "DataFormats/GeometrySurface/interface/Surface.h"
0005 
0006 /** Creates a new instance of a BoundSurface at 
0007  *  a new location (using the copy constructor). */
0008 
0009 template <class T>
0010 class ConstReferenceCountingPointer;
0011 template <class T>
0012 class ReferenceCountingPointer;
0013 class MediumProperties;
0014 
0015 template <class T>
0016 class ModifiedSurfaceGenerator {
0017 private:
0018   typedef ReferenceCountingPointer<T> SurfacePointer;
0019 
0020 public:
0021   /// constructor from pointer
0022   ModifiedSurfaceGenerator(const T* surface) : theSurface(surface) {}
0023   /// constructor from ReferenceCountingPointer
0024   ModifiedSurfaceGenerator(const SurfacePointer surface) : theSurface(surface.get()) {}
0025   /** creation of a new surface at a different position, but with
0026    *  identical Bounds and MediumProperties */
0027   SurfacePointer atNewPosition(const Surface::PositionType& position, const Surface::RotationType& rotation) const {
0028     const MediumProperties& mp = theSurface->mediumProperties();
0029     SurfacePointer newSurface(new T(position, rotation, mp, theSurface->bounds().clone()));
0030     return newSurface;
0031   }
0032 
0033 private:
0034   /// original surface
0035   ConstReferenceCountingPointer<T> theSurface;
0036 };
0037 
0038 #endif