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)
139 #else // ext vect version
144 namespace matcherDetails {
155 template<
typename MonoIterator,
typename StereoIterator,
typename CollectorHelper>
157 StereoIterator seconditer, StereoIterator seconditerend,
159 CollectorHelper & collectorHelper)
const{
168 bool notk = trdir.
mag2()<float(FLT_MIN);
179 ToGlobal
const & stripDetTrans = stripdet->
surface();
180 ToGlobal
const & partnerStripDetTrans = partnerstripdet->
surface();
181 ToLocal gluedDetInvTrans(gluedDet->
surface());
185 StereoInfo cache[std::distance(seconditer,seconditerend)];
189 for (;seconditer!=seconditerend; ++seconditer){
191 const SiStripRecHit2D & secondHit = CollectorHelper::stereoHit(seconditer);
203 GlobalPoint globalpointini=partnerStripDetTrans.toGlobal(locp1);
204 GlobalPoint globalpointend=partnerStripDetTrans.toGlobal(locp2);
207 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
208 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
213 GlobalPoint gcenterofstrip= partnerStripDetTrans.toGlobal(lcenterofstrip);
215 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
225 double m10=-(ret2[1] - ret1[1]);
226 double m11= ret2[0] - ret1[0];
227 double dd = m11*ret1[1] + m10 * ret1[0];
232 StereoInfo
info = {c1vec,&secondHit,sigmap22,m10,m11};
233 cache[cacheSize++] =
info;
238 for (;monoRHiter != monoRHend; ++monoRHiter) {
256 GlobalPoint gcenterofstrip= stripDetTrans.toGlobal(lcenterofstrip);
258 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
266 GlobalPoint globalpointini=stripDetTrans.toGlobal(locp1o);
267 GlobalPoint globalpointend=stripDetTrans.toGlobal(locp2o);
270 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
271 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
282 double m00 = -(projend[1] - projini[1]);
283 double m01 = (projend[0] - projini[0]);
284 double c0 = m01*projini[1] + m00*projini[0];
287 Vec2D minv00{-m01, m00};
292 double l1 = 1./(c1*c1+s1*s1);
299 float fc1(c1), fs1(s1);
300 Vec3F scc1{fs1, fc1, fc1, 0.f};
301 Vec3F ssc1{fs1, fs1, fc1, 0.f};
302 const Vec3F cslsimd = scc1 * ssc1 * float(l1);
304 for (
int i=0;
i!=cacheSize; ++
i) {
305 StereoInfo
const si = cache[
i];
308 Vec2D minv10{si.m11, -si.m10};
309 double mult = 1./(m00*si.m11 - m01*si.m10);
310 Vec2D resultmatmul = mult * (minv10 * c0vec + minv00 * si.c1vec);
319 double l2 = 1./(c2*c2+s2*
s2);
321 double diff=(c1*s2-c2*s1);
322 double invdet2 = 1./(diff*diff*l1*l2);
324 float fc2(c2), fs2(s2), fid2(invdet2);
325 Vec3F invdet2simd{fid2, -fid2, fid2, 0.f};
326 Vec3F ccssimd{fs2, fc2, fc2, 0.f};
327 Vec3F csssimd{fs2, fs2, fc2, 0.f};
328 Vec3F result = invdet2simd * (si.sigmap22 * cslsimd + sigmap12 * ccssimd * csssimd * float(l2));
340 *gluedDet,&monoRH,si.secondHit));
345 collectorHelper.closure(monoRHiter);
351 #endif //DOUBLE_MATCH
355 #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
unsigned int offset(bool)
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]
const SiStripRecHit2D * secondHit
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