1 #ifndef RECOLOCALTRACKER_SISTRIPCLUSTERIZER_SISTRIPRECHITMATCH_H
2 #define RECOLOCALTRACKER_SISTRIPCLUSTERIZER_SISTRIPRECHITMATCH_H
24 #include <boost/function.hpp>
36 typedef boost::function<void(SiStripMatchedRecHit2D const&)>
Collector;
52 return error.
uu()*pitch*pitch;
57 template<
typename MonoIterator,
typename StereoIterator,
typename CollectorHelper>
58 void doubleMatch(MonoIterator monoRHiter, MonoIterator monoRHend,
59 StereoIterator seconditer, StereoIterator seconditerend,
61 CollectorHelper & collectorHelper)
const;
68 LocalVector trackdirection,
bool force=
false)
const;
108 std::vector<SiStripMatchedRecHit2D*> & collector,
131 #if defined(USE_SSEVECT) || defined(USE_EXTVECT)
137 #if defined(USE_SSEVECT)
147 namespace matcherDetails {
158 template<
typename MonoIterator,
typename StereoIterator,
typename CollectorHelper>
160 StereoIterator seconditer, StereoIterator seconditerend,
162 CollectorHelper & collectorHelper)
const{
164 using matcherDetails::StereoInfo;
171 bool notk = trdir.
mag2()<float(FLT_MIN);
182 ToGlobal
const & stripDetTrans = stripdet->
surface();
183 ToGlobal
const & partnerStripDetTrans = partnerstripdet->
surface();
184 ToLocal gluedDetInvTrans(gluedDet->
surface());
188 std::vector<StereoInfo> cache(
std::distance(seconditer,seconditerend));
192 for (;seconditer!=seconditerend; ++seconditer){
194 const SiStripRecHit2D & secondHit = CollectorHelper::stereoHit(seconditer);
206 GlobalPoint globalpointini=partnerStripDetTrans.toGlobal(locp1);
207 GlobalPoint globalpointend=partnerStripDetTrans.toGlobal(locp2);
210 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
211 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
216 GlobalPoint gcenterofstrip= partnerStripDetTrans.toGlobal(lcenterofstrip);
218 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
228 double m10=-(ret2[1] - ret1[1]);
229 double m11= ret2[0] - ret1[0];
230 double dd = m11*ret1[1] + m10 * ret1[0];
235 StereoInfo
info = {c1vec,&secondHit,sigmap22,m10,m11};
236 cache[cacheSize++] =
info;
241 for (;monoRHiter != monoRHend; ++monoRHiter) {
259 GlobalPoint gcenterofstrip= stripDetTrans.toGlobal(lcenterofstrip);
261 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
269 GlobalPoint globalpointini=stripDetTrans.toGlobal(locp1o);
270 GlobalPoint globalpointend=stripDetTrans.toGlobal(locp2o);
273 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
274 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
285 double m00 = -(projend[1] - projini[1]);
286 double m01 = (projend[0] - projini[0]);
287 double c0 = m01*projini[1] + m00*projini[0];
290 Vec2D minv00{-m01, m00};
295 double l1 = 1./(c1*c1+s1*s1);
302 float fc1(c1), fs1(s1);
303 Vec3F scc1{fs1, fc1, fc1, 0.f};
304 Vec3F ssc1{fs1, fs1, fc1, 0.f};
305 const Vec3F cslsimd = scc1 * ssc1 * float(l1);
307 for (
int i=0;
i!=cacheSize; ++
i) {
308 StereoInfo
const si = cache[
i];
311 Vec2D minv10{si.m11, -si.m10};
312 double mult = 1./(m00*si.m11 - m01*si.m10);
313 Vec2D resultmatmul = mult * (minv10 * c0vec + minv00 * si.c1vec);
322 double l2 = 1./(c2*c2+s2*
s2);
324 double diff=(c1*s2-c2*s1);
325 double invdet2 = 1./(diff*diff*l1*l2);
327 float fc2(c2), fs2(s2), fid2(invdet2);
328 Vec3F invdet2simd{fid2, -fid2, fid2, 0.f};
329 Vec3F ccssimd{fs2, fc2, fc2, 0.f};
330 Vec3F csssimd{fs2, fs2, fc2, 0.f};
331 Vec3F result = invdet2simd * (si.sigmap22 * cslsimd + sigmap12 * ccssimd * csssimd * float(l2));
343 *gluedDet,&monoRH,si.secondHit));
348 collectorHelper.closure(monoRHiter);
353 #endif //DOUBLE_MATCH
357 #endif // RECOLOCALTRACKER_SISTRIPCLUSTERIZER_SISTRIPRECHITMATCH_H
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const GeomDetUnit * monoDet() const
virtual const Topology & topology() const
StripPosition project(const GeomDetUnit *det, const GluedGeomDet *glueddet, StripPosition strip, LocalVector trackdirection) const
Global3DPoint GlobalPoint
static float sigmaPitch(LocalPoint const &pos, LocalError const &err, const StripTopology &topol)
const Plane & surface() const
The nominal surface of the GeomDet.
virtual float localPitch(const LocalPoint &) const =0
virtual LocalError localPositionError() const
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const =0
std::pair< LocalPoint, LocalPoint > StripPosition
SiStripRecHitMatcher(const edm::ParameterSet &conf)
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
void doubleMatch(MonoIterator monoRHiter, MonoIterator monoRHend, StereoIterator seconditer, StereoIterator seconditerend, const GluedGeomDet *gluedDet, LocalVector trdir, CollectorHelper &collectorHelper) const
SiStripMatchedRecHit2DCollectionNew::FastFiller CollectorMatched
std::vector< const SiStripRecHit2D * > SimpleHitCollection
std::unique_ptr< SiStripMatchedRecHit2D > match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection, bool force=false) const
SiStripRecHit2DCollectionNew::DetSet::const_iterator RecHitIterator
SimpleHitCollection::const_iterator SimpleHitIterator
static int position[264][3]
virtual LocalPoint localPosition(float strip) const =0
const LocalPoint & localPositionFast() const
boost::function< void(SiStripMatchedRecHit2D const &)> Collector
virtual LocalPoint localPosition() const
const BasicVectorType & basicVector() const
const GeomDetUnit * stereoDet() const