CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/DataFormats/TrajectorySeed/interface/TrajectorySeed.h

Go to the documentation of this file.
00001 #ifndef DATAFORMATS_TRAJECTORYSEED_TRAJECTORYSEED_h
00002 #define DATAFORMATS_TRAJECTORYSEED_TRAJECTORYSEED_h
00003 
00004 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
00005 #include "DataFormats/Common/interface/OwnVector.h"
00006 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00007 #include "DataFormats/TrajectoryState/interface/PTrajectoryStateOnDet.h"
00008 #include <utility>
00009 #include <algorithm>
00010 #include "FWCore/Utilities/interface/GCC11Compatibility.h"
00011 
00018 class TrajectorySeed {
00019  public:
00020   typedef edm::OwnVector<TrackingRecHit> recHitContainer;
00021   typedef recHitContainer::const_iterator const_iterator;
00022   typedef std::pair<const_iterator,const_iterator> range;
00023   
00024   
00025   TrajectorySeed(){}
00026   virtual ~TrajectorySeed(){}
00027 
00028   TrajectorySeed(PTrajectoryStateOnDet const & ptsos, 
00029                  recHitContainer const & rh, 
00030                  PropagationDirection  dir) : 
00031     hits_(rh),  tsos_(ptsos), dir_(dir) {}
00032   
00033 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
00034   TrajectorySeed(PTrajectoryStateOnDet const & ptsos, 
00035                  recHitContainer && rh, 
00036                  PropagationDirection  dir) noexcept : 
00037     hits_(std::move(rh)),  tsos_(ptsos), dir_(dir) {}
00038 #endif
00039 
00040 
00041   void swap(PTrajectoryStateOnDet & ptsos, 
00042                  recHitContainer & rh, 
00043             PropagationDirection & dir) noexcept { 
00044     hits_.swap(rh);
00045     std::swap(tsos_,ptsos);
00046     std::swap(dir_,dir);
00047   }
00048 
00049   void swap(TrajectorySeed & rh) noexcept { 
00050     hits_.swap(rh.hits_);
00051     std::swap(tsos_,rh.tsos_);
00052     std::swap(dir_,rh.dir_);
00053   }
00054 
00055   TrajectorySeed(TrajectorySeed const & o) :
00056     hits_(o.hits_),  tsos_(o.tsos_), dir_(o.dir_) {}
00057 
00058   TrajectorySeed & operator=(TrajectorySeed const & o) {
00059     TrajectorySeed tmp(o); swap(tmp);   
00060     return *this;
00061   }
00062 
00063 
00064 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
00065   TrajectorySeed(TrajectorySeed && o) noexcept :
00066     hits_(std::move(o.hits_)),  tsos_(std::move(o.tsos_)), dir_(std::move(o.dir_)) {}
00067 
00068   TrajectorySeed & operator=(TrajectorySeed && o) {
00069     swap(o);   
00070     return *this;
00071   }
00072 
00073 #endif
00074 
00075   range recHits() const {
00076     return std::make_pair(hits_.begin(), hits_.end());
00077   }
00078   unsigned int nHits() const {return hits_.size();}
00079   PropagationDirection direction() const {return  dir_;}
00080   PTrajectoryStateOnDet const & startingState() const {return tsos_;}
00081 
00082   virtual TrajectorySeed * clone() const {return new TrajectorySeed( * this); }
00083 
00084  
00085  private:
00086   edm::OwnVector<TrackingRecHit> hits_;
00087   PTrajectoryStateOnDet tsos_;
00088   PropagationDirection dir_;
00089 };
00090 
00091 inline void swap(TrajectorySeed & rh, TrajectorySeed & lh) noexcept { 
00092   rh.swap(lh);
00093 }
00094 
00095 typedef TrajectorySeed BasicTrajectorySeed;
00096 
00097 #endif