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,
147 namespace matcherDetails {
151 const SiStripRecHit2D * secondHit;
158 template<
typename MonoIterator,
typename StereoIterator,
typename CollectorHelper>
160 StereoIterator seconditer, StereoIterator seconditerend,
162 CollectorHelper & collectorHelper)
const{
164 using matcherDetails::StereoInfo;
174 bool notk = trdir.
mag2()<FLT_MIN;
185 ToGlobal
const & stripDetTrans = stripdet->
surface();
186 ToGlobal
const & partnerStripDetTrans = partnerstripdet->
surface();
187 ToLocal gluedDetInvTrans(gluedDet->
surface());
191 StereoInfo cache[std::distance(seconditer,seconditerend)];
195 for (;seconditer!=seconditerend; ++seconditer){
197 const SiStripRecHit2D & secondHit = CollectorHelper::stereoHit(seconditer);
199 double sigmap22 =secondHit.sigmaPitch();
201 LocalError tmpError( secondHit.localPositionErrorFast());
205 double pitch=partnertopol.
localPitch(secondHit.localPositionFast());
206 secondHit.setSigmaPitch(sigmap22=errorstereoRH.
uu()*pitch*pitch);
217 GlobalPoint globalpointini=partnerStripDetTrans.toGlobal(locp1);
218 GlobalPoint globalpointend=partnerStripDetTrans.toGlobal(locp2);
221 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
222 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
226 LocalPoint lcenterofstrip=secondHit.localPositionFast();
227 GlobalPoint gcenterofstrip= partnerStripDetTrans.toGlobal(lcenterofstrip);
229 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
239 double m10=-(ret2.arr[1] - ret1.arr[1]);
240 double m11= ret2.arr[0] - ret1.arr[0];
242 Vec2D c1vec; c1vec.set1(m11*ret1.arr[1] + m10 * ret1.arr[0]);
245 StereoInfo
info = {c1vec,&secondHit,sigmap22,m10,m11};
246 cache[cacheSize++] =
info;
251 for (;monoRHiter != monoRHend; ++monoRHiter) {
253 SiStripRecHit2D
const & monoRH = CollectorHelper::monoHit(monoRHiter);
268 LocalPoint lcenterofstrip=monoRH.localPositionFast();
269 GlobalPoint gcenterofstrip= stripDetTrans.toGlobal(lcenterofstrip);
271 trdir=gluedDetInvTrans.toLocal(gtrackdirection);
279 GlobalPoint globalpointini=stripDetTrans.toGlobal(locp1o);
280 GlobalPoint globalpointend=stripDetTrans.toGlobal(locp2o);
283 LocalPoint positiononGluedini=gluedDetInvTrans.toLocal(globalpointini);
284 LocalPoint positiononGluedend=gluedDetInvTrans.toLocal(globalpointend);
295 double m00 = -(projend.arr[1] - projini.arr[1]);
296 double m01 = (projend.arr[0] - projini.arr[0]);
297 double c0 = m01*projini.arr[1] + m00*projini.arr[0];
300 Vec2D minv00(-m01, m00);
305 double l1 = 1./(c1*c1+s1*s1);
308 double sigmap12 = monoRH.sigmaPitch();
311 LocalError tmpError(monoRH.localPositionErrorFast());
315 double pitch=topol.
localPitch(monoRH.localPositionFast());
316 monoRH.setSigmaPitch(sigmap12=errormonoRH.
uu()*pitch*pitch);
320 float fc1(c1), fs1(s1);
321 Vec3F scc1(fs1, fc1, fc1, 0.
f);
322 Vec3F ssc1(fs1, fs1, fc1, 0.
f);
324 const Vec3F cslsimd = scc1 * ssc1 * l1vec;
325 Vec3F sigmap12simd; sigmap12simd.
set1(sigmap12);
327 for (
int i=0;
i!=cacheSize; ++
i) {
328 StereoInfo
const si = cache[
i];
331 Vec2D minv10(si.m11, -si.m10);
332 Vec2D mult; mult.set1(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);
352 Vec3F sigmap22simd; sigmap22simd.
set1(si.sigmap22);
353 Vec3F result = invdet2simd * (sigmap22simd * cslsimd + sigmap12simd * ccssimd * csssimd * l2simd);
365 &monoRH,si.secondHit));
370 collectorHelper.closure(monoRHiter);
375 #endif //DOUBLE_MATCH
379 #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)
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
const BoundPlane & surface() const
The nominal surface of the GeomDet.
SimpleHitCollection::const_iterator SimpleHitIterator
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