4 namespace matcherDetails {
15 template<
typename MonoIterator,
typename StereoIterator,
typename CollectorHelper>
17 StereoIterator seconditer, StereoIterator seconditerend,
19 CollectorHelper & collectorHelper)
const{
31 bool notk = trdir.
mag2()<FLT_MIN;
42 ToGlobal
const & stripDetTrans = stripdet->
surface();
43 ToGlobal
const & partnerStripDetTrans = partnerstripdet->
surface();
44 ToLocal gluedDetInvTrans(gluedDet->
surface());
48 StereoInfo cache[std::distance(seconditer,seconditerend)];
52 for (;seconditer!=seconditerend; ++seconditer){
54 const SiStripRecHit2D & secondHit = CollectorHelper::stereoHit(seconditer);
56 double sigmap22 =secondHit.sigmaPitch();
67 GlobalPoint globalpointini=partnerStripDetTrans.toGlobal(locp1);
68 GlobalPoint globalpointend=partnerStripDetTrans.toGlobal(locp2);
71 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
72 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
76 LocalPoint lcenterofstrip=secondHit.localPositionFast();
77 GlobalPoint gcenterofstrip= partnerStripDetTrans.toGlobal(lcenterofstrip);
79 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
89 double m10=-(ret2.arr[1] - ret1.arr[1]);
90 double m11= ret2.arr[0] - ret1.arr[0];
92 Vec2D c1vec; c1vec.set1(m11*ret1.arr[1] + m10 * ret1.arr[0]);
95 StereoInfo
info = {c1vec,&secondHit,sigmap22,m10,m11};
96 cache[cacheSize++] =
info;
101 for (;monoRHiter != monoRHend; ++monoRHiter) {
103 SiStripRecHit2D
const & monoRH = CollectorHelper::monoHit(monoRHiter);
118 LocalPoint lcenterofstrip=monoRH.localPositionFast();
119 GlobalPoint gcenterofstrip= stripDetTrans.toGlobal(lcenterofstrip);
121 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
129 GlobalPoint globalpointini=stripDetTrans.toGlobal(locp1o);
130 GlobalPoint globalpointend=stripDetTrans.toGlobal(locp2o);
133 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
134 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
145 double m00 = -(projend.arr[1] - projini.arr[1]);
146 double m01 = (projend.arr[0] - projini.arr[0]);
147 double c0 = m01*projini.arr[1] + m00*projini.arr[0];
150 Vec2D minv00(-m01, m00);
155 double l1 = 1./(c1*c1+s1*s1);
158 double sigmap12 = monoRH.sigmaPitch();
162 float fc1(c1), fs1(s1);
163 Vec3F scc1(fs1, fc1, fc1, 0.
f);
164 Vec3F ssc1(fs1, fs1, fc1, 0.
f);
165 Vec3F l1vec; l1vec.set1(l1);
166 const Vec3F cslsimd = scc1 * ssc1 * l1vec;
167 Vec3F sigmap12simd; sigmap12simd.set1(sigmap12);
169 for (
int i=0;
i!=cacheSize; ++
i) {
170 StereoInfo
const si = cache[
i];
173 Vec2D minv10(si.m11, -si.m10);
174 Vec2D mult; mult.set1(1./(m00*si.m11 - m01*si.m10));
175 Vec2D resultmatmul = mult * (minv10 * c0vec + minv00 * si.c1vec);
180 if (!((gluedDet->
surface()).bounds().inside(position,10.
f*
scale_)))
continue;
184 double l2 = 1./(c2*c2+s2*
s2);
186 double diff=(c1*s2-c2*s1);
187 double invdet2 = 1./(diff*diff*l1*l2);
189 float fc2(c2), fs2(s2), fid2(invdet2);
190 Vec3F invdet2simd(fid2, -fid2, fid2, 0.
f);
191 Vec3F ccssimd(fs2, fc2, fc2, 0.
f);
192 Vec3F csssimd(fs2, fs2, fc2, 0.
f);
193 Vec3F l2simd; l2simd.set1(l2);
194 Vec3F sigmap22simd; sigmap22simd.set1(si.sigmap22);
195 Vec3F result = invdet2simd * (sigmap22simd * cslsimd + sigmap12simd * ccssimd * csssimd * l2simd);
201 if((gluedDet->
surface()).bounds().inside(position,error,scale_)){
206 collectorHelper.collector()(SiStripMatchedRecHit2D(
LocalPoint(position), error,
207 *gluedDet,&monoRH,si.secondHit));
212 collectorHelper.closure(monoRHiter);
const GeomDetUnit * monoDet() const
Global3DPoint GlobalPoint
const Plane & surface() const
The nominal surface of the GeomDet.
static int position[TOTALCHAMBERS][3]
virtual const Topology & topology() const =0
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
unsigned int offset(bool)
void doubleMatch(MonoIterator monoRHiter, MonoIterator monoRHend, StereoIterator seconditer, StereoIterator seconditerend, const GluedGeomDet *gluedDet, LocalVector trdir, CollectorHelper &collectorHelper) const
const SiStripRecHit2D * secondHit
virtual LocalPoint localPosition(float strip) const =0
const BasicVectorType & basicVector() const
const GeomDetUnit * stereoDet() const