-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathTrajectorySeed.h
69 lines (52 loc) · 2.22 KB
/
TrajectorySeed.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef DATAFORMATS_TRAJECTORYSEED_TRAJECTORYSEED_h
#define DATAFORMATS_TRAJECTORYSEED_TRAJECTORYSEED_h
#include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
#include "DataFormats/Common/interface/OwnVector.h"
#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
#include "DataFormats/TrajectoryState/interface/PTrajectoryStateOnDet.h"
#include "FWCore/Utilities/interface/Range.h"
#include <utility>
#include <algorithm>
/**
TrajectorySeed contains
- a TSOS
- a vector of RecHits (with Own_vector to store polimorphic)
- a propagation direction
**/
class TrajectorySeed {
public:
typedef edm::OwnVector<TrackingRecHit> RecHitContainer;
typedef edm::Range<RecHitContainer::const_iterator> RecHitRange;
TrajectorySeed() {}
virtual ~TrajectorySeed() {}
TrajectorySeed(PTrajectoryStateOnDet const& ptsos, RecHitContainer const& rh, PropagationDirection dir)
: hits_(rh), tsos_(ptsos), dir_(dir) {}
TrajectorySeed(PTrajectoryStateOnDet const& ptsos, RecHitContainer&& rh, PropagationDirection dir) noexcept
: hits_(std::move(rh)), tsos_(ptsos), dir_(dir) {}
void swap(PTrajectoryStateOnDet& ptsos, RecHitContainer& rh, PropagationDirection& dir) noexcept {
hits_.swap(rh);
std::swap(tsos_, ptsos);
std::swap(dir_, dir);
}
void swap(TrajectorySeed& rh) noexcept {
hits_.swap(rh.hits_);
std::swap(tsos_, rh.tsos_);
std::swap(dir_, rh.dir_);
}
TrajectorySeed(TrajectorySeed const& o) = default;
TrajectorySeed& operator=(TrajectorySeed const& o) = default;
TrajectorySeed(TrajectorySeed&& o) noexcept = default;
TrajectorySeed& operator=(TrajectorySeed&& o) noexcept = default;
RecHitRange recHits() const { return {hits_.begin(), hits_.end()}; }
unsigned int nHits() const { return hits_.size(); }
PropagationDirection direction() const { return dir_; }
PTrajectoryStateOnDet const& startingState() const { return tsos_; }
virtual TrajectorySeed* clone() const { return new TrajectorySeed(*this); }
private:
RecHitContainer hits_;
PTrajectoryStateOnDet tsos_;
PropagationDirection dir_ = invalidDirection;
};
inline void swap(TrajectorySeed& rh, TrajectorySeed& lh) noexcept { rh.swap(lh); }
typedef TrajectorySeed BasicTrajectorySeed;
#endif