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
00017 class TrajectorySeed {
00018 public:
00019 typedef edm::OwnVector<TrackingRecHit> recHitContainer;
00020 typedef recHitContainer::const_iterator const_iterator;
00021 typedef std::pair<const_iterator,const_iterator> range;
00022
00023
00024 TrajectorySeed(){}
00025 virtual ~TrajectorySeed(){}
00026
00027 TrajectorySeed(PTrajectoryStateOnDet const & ptsos,
00028 recHitContainer const & rh,
00029 PropagationDirection dir) :
00030 hits_(rh), tsos_(ptsos), dir_(dir) {}
00031
00032 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
00033 TrajectorySeed(PTrajectoryStateOnDet const & ptsos,
00034 recHitContainer && rh,
00035 PropagationDirection dir) :
00036 hits_(std::move(rh)), tsos_(ptsos), dir_(dir) {}
00037 #endif
00038
00039
00040 void swap(PTrajectoryStateOnDet & ptsos,
00041 recHitContainer & rh,
00042 PropagationDirection & dir) {
00043 hits_.swap(rh);
00044 std::swap(tsos_,ptsos);
00045 std::swap(dir_,dir);
00046 }
00047
00048 void swap(TrajectorySeed & rh) {
00049 hits_.swap(rh.hits_);
00050 std::swap(tsos_,rh.tsos_);
00051 std::swap(dir_,rh.dir_);
00052 }
00053
00054 TrajectorySeed(TrajectorySeed const & o) :
00055 hits_(o.hits_), tsos_(o.tsos_), dir_(o.dir_) {}
00056
00057 TrajectorySeed & operator=(TrajectorySeed const & o) {
00058 TrajectorySeed tmp(o); swap(tmp);
00059 return *this;
00060 }
00061
00062
00063 #if defined( __GXX_EXPERIMENTAL_CXX0X__)
00064 TrajectorySeed(TrajectorySeed && o) :
00065 hits_(std::move(o.hits_)), tsos_(std::move(o.tsos_)), dir_(std::move(o.dir_)) {}
00066
00067 TrajectorySeed & operator=(TrajectorySeed && o) {
00068 swap(o);
00069 return *this;
00070 }
00071
00072 #endif
00073
00074 range recHits() const {
00075 return std::make_pair(hits_.begin(), hits_.end());
00076 }
00077 unsigned int nHits() const {return hits_.size();}
00078 PropagationDirection direction() const {return dir_;}
00079 PTrajectoryStateOnDet const & startingState() const {return tsos_;}
00080
00081 virtual TrajectorySeed * clone() const {return new TrajectorySeed( * this); }
00082
00083
00084 private:
00085 edm::OwnVector<TrackingRecHit> hits_;
00086 PTrajectoryStateOnDet tsos_;
00087 PropagationDirection dir_;
00088 };
00089
00090 inline void swap(TrajectorySeed & rh, TrajectorySeed & lh) {
00091 rh.swap(lh);
00092 }
00093
00094 typedef TrajectorySeed BasicTrajectorySeed;
00095
00096 #endif