1 |
#ifndef RECOTRACKER_TRANSIENTRACKINGRECHIT_TRecHit2DPosConstraint_H
|
2 |
#define RECOTRACKER_TRANSIENTRACKINGRECHIT_TRecHit2DPosConstraint_H
|
3 |
|
4 |
#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
|
5 |
#include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
|
6 |
|
7 |
class GeomDetUnit;
|
8 |
|
9 |
class TRecHit2DPosConstraint : public TransientTrackingRecHit {
|
10 |
public:
|
11 |
|
12 |
virtual ~TRecHit2DPosConstraint() {}
|
13 |
|
14 |
virtual AlgebraicVector parameters() const {
|
15 |
AlgebraicVector result(2);
|
16 |
LocalPoint lp = localPosition();
|
17 |
result[0] = lp.x();
|
18 |
result[1] = lp.y();
|
19 |
return result;
|
20 |
}
|
21 |
|
22 |
virtual AlgebraicSymMatrix parametersError() const {
|
23 |
AlgebraicSymMatrix m(2);
|
24 |
LocalError le( localPositionError());
|
25 |
m[0][0] = le.xx();
|
26 |
m[0][1] = le.xy();
|
27 |
m[1][1] = le.yy();
|
28 |
return m;
|
29 |
}
|
30 |
|
31 |
virtual AlgebraicMatrix projectionMatrix() const {
|
32 |
AlgebraicMatrix theProjectionMatrix;
|
33 |
theProjectionMatrix = AlgebraicMatrix( 2, 5, 0);
|
34 |
theProjectionMatrix[0][3] = 1;
|
35 |
theProjectionMatrix[1][4] = 1;
|
36 |
return theProjectionMatrix;
|
37 |
}
|
38 |
virtual int dimension() const {return 2;}
|
39 |
|
40 |
virtual LocalPoint localPosition() const {return pos_;}
|
41 |
virtual LocalError localPositionError() const {return err_;}
|
42 |
|
43 |
virtual const TrackingRecHit * hit() const {return 0;}//fixme return invalid
|
44 |
|
45 |
virtual std::vector<const TrackingRecHit*> recHits() const {
|
46 |
return hit()->recHits();
|
47 |
}
|
48 |
virtual std::vector<TrackingRecHit*> recHits() {
|
49 |
return std::vector<TrackingRecHit*>();
|
50 |
}
|
51 |
|
52 |
virtual bool canImproveWithTrack() const {return false;}
|
53 |
|
54 |
virtual RecHitPointer clone (const TrajectoryStateOnSurface& ts) const {return clone();}
|
55 |
|
56 |
virtual const GeomDetUnit* detUnit() const {return 0;}
|
57 |
virtual const GeomDet* det() const {return 0;}
|
58 |
|
59 |
static RecHitPointer build( const LocalPoint& pos, const LocalError& err,
|
60 |
const Surface* surface) {
|
61 |
return RecHitPointer( new TRecHit2DPosConstraint( pos, err, surface));
|
62 |
}
|
63 |
|
64 |
virtual const Surface * surface() const {return &(*surface_);}
|
65 |
|
66 |
private:
|
67 |
const LocalPoint pos_;
|
68 |
const LocalError err_;
|
69 |
// const Surface* surface_;
|
70 |
ConstReferenceCountingPointer<Surface> surface_;
|
71 |
/// Creates the TrackingRecHit internally, avoids redundent cloning
|
72 |
TRecHit2DPosConstraint(const LocalPoint& pos,
|
73 |
const LocalError& err,
|
74 |
const Surface* surface):
|
75 |
pos_(pos),err_(err),surface_(surface) {}
|
76 |
|
77 |
TRecHit2DPosConstraint( const TRecHit2DPosConstraint& other ):
|
78 |
pos_( other.localPosition() ),err_( other.localPositionError() ), surface_((other.surface())) {}
|
79 |
|
80 |
virtual TRecHit2DPosConstraint * clone() const {
|
81 |
return new TRecHit2DPosConstraint(*this);
|
82 |
}
|
83 |
|
84 |
};
|
85 |
|
86 |
#endif
|