1 package org.lcsim.recon.tracking.vsegment.hit.base;
2
3 import hep.physics.matrix.SymmetricMatrix;
4 import hep.physics.vec.Hep3Vector;
5 import hep.physics.vec.BasicHep3Vector;
6 import hep.physics.vec.VecOp;
7
8 import org.lcsim.spacegeom.SpacePoint;
9 import org.lcsim.spacegeom.SpacePointVector;
10
11 import org.lcsim.recon.tracking.vsegment.geom.Sensor;
12 import org.lcsim.recon.tracking.vsegment.hit.TrackerCluster;
13 import org.lcsim.recon.tracking.vsegment.hit.TrackerHit;
14
15
16
17
18
19
20
21
22
23
24 public class TrackerHitSegment extends TrackerHitAdapter {
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 public TrackerHitSegment(TrackerCluster cluster, Hep3Vector position, double length,
43 SymmetricMatrix covMatrix, boolean isLocal) {
44 super(cluster);
45 if (isLocal) {
46 _posLocal = position;
47 _covLocal = covMatrix;
48 } else {
49 _posGlobal = position;
50 _covGlobal = covMatrix;
51 }
52 _length = length;
53 }
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69 public TrackerHitSegment(TrackerCluster cluster, Hep3Vector position, double length,
70 SymmetricMatrix covMatrix, boolean isLocal, double signal, double time) {
71 super(cluster, signal, time);
72 if (isLocal) {
73 _posLocal = position;
74 _covLocal = covMatrix;
75 } else {
76 _posGlobal = position;
77 _covGlobal = covMatrix;
78 }
79 _length = length;
80 }
81
82
83
84
85
86
87 public Hep3Vector getLocalPosition() {
88 if (_posLocal == null) _posLocal = super.getLocalPosition();
89 return _posLocal;
90 }
91
92
93
94
95 public SymmetricMatrix getLocalCovMatrix() {
96 if (_covLocal == null) _covLocal = super.getLocalCovMatrix();
97 return _covLocal;
98 }
99
100
101
102
103
104 public SpacePointVector getLocalSegment() {
105 if (_segLocal == null) {
106 if (_posLocal == null) _posLocal = super.getLocalPosition();
107 Hep3Vector dif = new BasicHep3Vector(0., _length/2., 0.);
108 _segLocal = new SpacePointVector(new SpacePoint(VecOp.sub(_posLocal, dif)),
109 new SpacePoint(VecOp.add(_posLocal, dif)));
110 }
111 return _segLocal;
112 }
113
114
115
116
117
118
119
120 public Hep3Vector getPosition() {
121 if (_posGlobal == null) _posGlobal = super.getPosition();
122 return _posGlobal;
123 }
124
125
126
127
128 public SymmetricMatrix getCovMatrix() {
129 if (_covGlobal == null) _covGlobal = super.getCovMatrix();
130 return _covGlobal;
131 }
132
133
134
135
136
137 public SpacePointVector getSegment() {
138 if (_segGlobal == null) _segGlobal = super.getSegment();
139 return _segGlobal;
140 }
141
142
143
144
145
146
147
148 public double getLength() {
149 return _length;
150 }
151
152
153
154 Hep3Vector _posLocal;
155 Hep3Vector _posGlobal;
156 SymmetricMatrix _covLocal;
157 SymmetricMatrix _covGlobal;
158 SpacePointVector _segLocal;
159 SpacePointVector _segGlobal;
160 double _length;
161 }