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