1 #ifndef RECOLOCALTRACKER_SISTRIPCLUSTERIZER_SISTRIPRECHITMATCH_H
2 #define RECOLOCALTRACKER_SISTRIPCLUSTERIZER_SISTRIPRECHITMATCH_H
21 #include <boost/function.hpp>
33 typedef boost::function<void(SiStripMatchedRecHit2D const&)>
Collector;
43 template<
typename MonoIterator,
typename StereoIterator,
typename CollectorHelper>
44 void doubleMatch(MonoIterator monoRHiter, MonoIterator monoRHend,
45 StereoIterator seconditer, StereoIterator seconditerend,
47 CollectorHelper & collectorHelper)
const;
51 SiStripMatchedRecHit2D *
match(
const SiStripRecHit2D *monoRH,
52 const SiStripRecHit2D *stereoRH,
56 SiStripMatchedRecHit2D*
match(
const SiStripMatchedRecHit2D *originalRH,
61 match(
const SiStripRecHit2D *monoRH,
68 match(
const SiStripRecHit2D *monoRH,
74 match(
const SiStripRecHit2D *monoRH,
80 match(
const SiStripRecHit2D *monoRH,
87 match(
const SiStripRecHit2D *monoRH,
105 match(
const SiStripRecHit2D *monoRH,
113 match(
const SiStripRecHit2D *monoRH,
115 std::vector<SiStripMatchedRecHit2D*> & collector,
123 match(
const SiStripRecHit2D *monoRH,
138 #if defined(USE_SSEVECT) || defined(USE_EXTVECT)
144 #if defined(USE_SSEVECT)
146 #else // ext vect version
151 namespace matcherDetails {
162 template<
typename MonoIterator,
typename StereoIterator,
typename CollectorHelper>
164 StereoIterator seconditer, StereoIterator seconditerend,
166 CollectorHelper & collectorHelper)
const{
175 bool notk = trdir.
mag2()<FLT_MIN;
186 ToGlobal
const & stripDetTrans = stripdet->
surface();
187 ToGlobal
const & partnerStripDetTrans = partnerstripdet->
surface();
188 ToLocal gluedDetInvTrans(gluedDet->
surface());
192 StereoInfo cache[std::distance(seconditer,seconditerend)];
196 for (;seconditer!=seconditerend; ++seconditer){
198 const SiStripRecHit2D & secondHit = CollectorHelper::stereoHit(seconditer);
200 float sigmap22 =secondHit.sigmaPitch();
202 LocalError tmpError( secondHit.localPositionErrorFast());
206 double pitch=partnertopol.
localPitch(secondHit.localPositionFast());
207 secondHit.setSigmaPitch(sigmap22=errorstereoRH.
uu()*pitch*pitch);
218 GlobalPoint globalpointini=partnerStripDetTrans.toGlobal(locp1);
219 GlobalPoint globalpointend=partnerStripDetTrans.toGlobal(locp2);
222 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
223 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
227 LocalPoint lcenterofstrip=secondHit.localPositionFast();
228 GlobalPoint gcenterofstrip= partnerStripDetTrans.toGlobal(lcenterofstrip);
230 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
240 double m10=-(ret2[1] - ret1[1]);
241 double m11= ret2[0] - ret1[0];
242 double dd = m11*ret1[1] + m10 * ret1[0];
247 StereoInfo
info = {c1vec,&secondHit,sigmap22,m10,m11};
248 cache[cacheSize++] =
info;
253 for (;monoRHiter != monoRHend; ++monoRHiter) {
255 SiStripRecHit2D
const & monoRH = CollectorHelper::monoHit(monoRHiter);
270 LocalPoint lcenterofstrip=monoRH.localPositionFast();
271 GlobalPoint gcenterofstrip= stripDetTrans.toGlobal(lcenterofstrip);
273 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
281 GlobalPoint globalpointini=stripDetTrans.toGlobal(locp1o);
282 GlobalPoint globalpointend=stripDetTrans.toGlobal(locp2o);
285 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
286 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
297 double m00 = -(projend[1] - projini[1]);
298 double m01 = (projend[0] - projini[0]);
299 double c0 = m01*projini[1] + m00*projini[0];
302 Vec2D minv00{-m01, m00};
307 double l1 = 1./(c1*c1+s1*s1);
310 float sigmap12 = monoRH.sigmaPitch();
313 LocalError tmpError(monoRH.localPositionErrorFast());
317 double pitch=topol.
localPitch(monoRH.localPositionFast());
318 monoRH.setSigmaPitch(sigmap12=errormonoRH.
uu()*pitch*pitch);
322 float fc1(c1), fs1(s1);
323 Vec3F scc1{fs1, fc1, fc1, 0.f};
324 Vec3F ssc1{fs1, fs1, fc1, 0.f};
325 const Vec3F cslsimd = scc1 * ssc1 * float(l1);
327 for (
int i=0;
i!=cacheSize; ++
i) {
328 StereoInfo
const si = cache[
i];
331 Vec2D minv10{si.m11, -si.m10};
332 double mult = 1./(m00*si.m11 - m01*si.m10);
333 Vec2D resultmatmul = mult * (minv10 * c0vec + minv00 * si.c1vec);
342 double l2 = 1./(c2*c2+s2*
s2);
344 double diff=(c1*s2-c2*s1);
345 double invdet2 = 1./(diff*diff*l1*l2);
347 float fc2(c2), fs2(s2), fid2(invdet2);
348 Vec3F invdet2simd{fid2, -fid2, fid2, 0.f};
349 Vec3F ccssimd{fs2, fc2, fc2, 0.f};
350 Vec3F csssimd{fs2, fs2, fc2, 0.f};
351 Vec3F result = invdet2simd * (si.sigmap22 * cslsimd + sigmap12 * ccssimd * csssimd * float(l2));
363 &monoRH,si.secondHit));
368 collectorHelper.closure(monoRHiter);
374 #endif //DOUBLE_MATCH
378 #endif // RECOLOCALTRACKER_SISTRIPCLUSTERIZER_SISTRIPRECHITMATCH_H
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Local3DVector LocalVector
const GeomDetUnit * monoDet() const
SiStripMatchedRecHit2D * match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
StripPosition project(const GeomDetUnit *det, const GluedGeomDet *glueddet, StripPosition strip, LocalVector trackdirection) 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
std::pair< LocalPoint, LocalPoint > StripPosition
SiStripRecHitMatcher(const edm::ParameterSet &conf)
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
SiStripMatchedRecHit2DCollectionNew::FastFiller CollectorMatched
std::vector< const SiStripRecHit2D * > SimpleHitCollection
SiStripRecHit2DCollectionNew::DetSet::const_iterator RecHitIterator
SimpleHitCollection::const_iterator SimpleHitIterator
const SiStripRecHit2D * secondHit
virtual LocalPoint localPosition(float strip) const =0
edm::OwnVector< SiStripMatchedRecHit2D > match(const SiStripRecHit2D *monoRH, RecHitIterator begin, RecHitIterator end, const GluedGeomDet *gluedDet) const
boost::function< void(SiStripMatchedRecHit2D const &)> Collector
const BasicVectorType & basicVector() const
const GeomDetUnit * stereoDet() const