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();
58 LocalError tmpError( secondHit.localPositionErrorFast());
62 double pitch=partnertopol.
localPitch(secondHit.localPositionFast());
63 secondHit.setSigmaPitch(sigmap22=errorstereoRH.
uu()*pitch*pitch);
74 GlobalPoint globalpointini=partnerStripDetTrans.toGlobal(locp1);
75 GlobalPoint globalpointend=partnerStripDetTrans.toGlobal(locp2);
78 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
79 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
83 LocalPoint lcenterofstrip=secondHit.localPositionFast();
84 GlobalPoint gcenterofstrip= partnerStripDetTrans.toGlobal(lcenterofstrip);
86 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
96 double m10=-(ret2.arr[1] - ret1.arr[1]);
97 double m11= ret2.arr[0] - ret1.arr[0];
99 Vec2D c1vec; c1vec.set1(m11*ret1.arr[1] + m10 * ret1.arr[0]);
102 StereoInfo
info = {c1vec,&secondHit,sigmap22,m10,m11};
103 cache[cacheSize++] =
info;
108 for (;monoRHiter != monoRHend; ++monoRHiter) {
110 SiStripRecHit2D
const & monoRH = CollectorHelper::monoHit(monoRHiter);
125 LocalPoint lcenterofstrip=monoRH.localPositionFast();
126 GlobalPoint gcenterofstrip= stripDetTrans.toGlobal(lcenterofstrip);
128 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
136 GlobalPoint globalpointini=stripDetTrans.toGlobal(locp1o);
137 GlobalPoint globalpointend=stripDetTrans.toGlobal(locp2o);
140 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
141 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
152 double m00 = -(projend.arr[1] - projini.arr[1]);
153 double m01 = (projend.arr[0] - projini.arr[0]);
154 double c0 = m01*projini.arr[1] + m00*projini.arr[0];
157 Vec2D minv00(-m01, m00);
162 double l1 = 1./(c1*c1+s1*s1);
165 double sigmap12 = monoRH.sigmaPitch();
168 LocalError tmpError(monoRH.localPositionErrorFast());
172 double pitch=topol.
localPitch(monoRH.localPositionFast());
173 monoRH.setSigmaPitch(sigmap12=errormonoRH.
uu()*pitch*pitch);
177 float fc1(c1), fs1(s1);
178 Vec3F scc1(fs1, fc1, fc1, 0.
f);
179 Vec3F ssc1(fs1, fs1, fc1, 0.
f);
180 Vec3F l1vec; l1vec.set1(l1);
181 const Vec3F cslsimd = scc1 * ssc1 * l1vec;
182 Vec3F sigmap12simd; sigmap12simd.set1(sigmap12);
184 for (
int i=0;
i!=cacheSize; ++
i) {
185 StereoInfo
const si = cache[
i];
188 Vec2D minv10(si.m11, -si.m10);
189 Vec2D mult; mult.set1(1./(m00*si.m11 - m01*si.m10));
190 Vec2D resultmatmul = mult * (minv10 * c0vec + minv00 * si.c1vec);
195 if (!((gluedDet->
surface()).bounds().inside(position,10.
f*
scale_)))
continue;
199 double l2 = 1./(c2*c2+s2*
s2);
201 double diff=(c1*s2-c2*s1);
202 double invdet2 = 1./(diff*diff*l1*l2);
204 float fc2(c2), fs2(s2), fid2(invdet2);
205 Vec3F invdet2simd(fid2, -fid2, fid2, 0.
f);
206 Vec3F ccssimd(fs2, fc2, fc2, 0.
f);
207 Vec3F csssimd(fs2, fs2, fc2, 0.
f);
208 Vec3F l2simd; l2simd.set1(l2);
209 Vec3F sigmap22simd; sigmap22simd.set1(si.sigmap22);
210 Vec3F result = invdet2simd * (sigmap22simd * cslsimd + sigmap12simd * ccssimd * csssimd * l2simd);
216 if((gluedDet->
surface()).bounds().inside(position,error,scale_)){
222 &monoRH,si.secondHit));
227 collectorHelper.closure(monoRHiter);
const GeomDetUnit * monoDet() const
Global3DPoint GlobalPoint
static void updateWithAPE(LocalError &le, const GeomDet &det)
const Plane & surface() const
The nominal surface of the GeomDet.
static int position[TOTALCHAMBERS][3]
virtual const Topology & topology() const =0
virtual float localPitch(const LocalPoint &) const =0
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
DetId geographicalId() const
The label of this GeomDet.
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