11 #include<boost/bind.hpp>
19 scale_(conf.getParameter<double>(
"NSigmaInside")),
20 preFilter_(conf.existsAs<bool>(
"PreFilter") ? conf.getParameter<bool>(
"PreFilter") :
false)
30 inline void pb1(std::vector<SiStripMatchedRecHit2D*> &
v, SiStripMatchedRecHit2D*
h) {
48 std::vector<SiStripMatchedRecHit2D*>
result;
49 result.reserve(end-begin);
50 match(monoRH,begin,end,result,gluedDet,trackdirection);
51 for (std::vector<SiStripMatchedRecHit2D*>::iterator
p=result.begin();
p!=result.end();
59 std::vector<SiStripMatchedRecHit2D*> & collector,
64 match(monoRH,begin,end,result,gluedDet,trackdirection);
75 match(monoRH,begin,end,result,gluedDet,trackdirection);
91 stereoHits.reserve(end-begin);
93 stereoHits.push_back( &(*
i));
96 stereoHits.begin(), stereoHits.end(),
98 gluedDet,trackdirection);
124 if(trackdirection.
mag2()<FLT_MIN){
125 LocalPoint lcenterofstrip=monoRH->localPositionFast();
135 double m00 = -(projectedstripmono.second.y()-projectedstripmono.first.y());
136 double m01 = (projectedstripmono.second.x()-projectedstripmono.first.x());
137 double c0 = m01*projectedstripmono.first.y() + m00*projectedstripmono.first.x();
148 double l1 = 1./(c1*c1+s1*s1);
151 float sigmap12 =
sigmaPitch(monoRH->localPosition(), monoRH->localPositionError(),topol);
158 for(seconditer=begin;seconditer!=
end;++seconditer){
169 StripPosition projectedstripstereo=
project(partnerstripdet,gluedDet,stripstereo,trackdirection);
172 double m10=-(projectedstripstereo.second.y()-projectedstripstereo.first.y());
173 double m11=(projectedstripstereo.second.x()-projectedstripstereo.first.x());
183 c(1)=m11*projectedstripstereo.first.y()+m10*projectedstripstereo.first.x();
207 if (!((gluedDet->
surface()).bounds().inside(position,tempError,
scale_)))
continue;
219 double l2 = 1./(c2*c2+s2*
s2);
221 float sigmap22 =
sigmaPitch((*seconditer)->localPosition(),(*seconditer)->localPositionError(),partnertopol);
225 double diff=(c1*s2-c2*s1);
226 double invdet2=1/(diff*diff*l1*l2);
227 float xx= invdet2*(sigmap12*s2*s2*l2+sigmap22*s1*s1*l1);
228 float xy=-invdet2*(sigmap12*c2*s2*l2+sigmap22*c1*s1*l1);
229 float yy= invdet2*(sigmap12*c2*c2*l2+sigmap22*c1*c1*l1);
232 if((gluedDet->
surface()).bounds().inside(position,error,
scale_)){
236 const SiStripRecHit2D* secondHit = *seconditer;
237 collector(SiStripMatchedRecHit2D(position, error,*gluedDet,
257 float scale=-positiononGluedini.
z()/trackdirection.
z();
259 LocalPoint projpositiononGluedini= positiononGluedini + scale*trackdirection;
260 LocalPoint projpositiononGluedend= positiononGluedend + scale*trackdirection;
262 return StripPosition(projpositiononGluedini,projpositiononGluedend);
268 std::unique_ptr<SiStripMatchedRecHit2D>
270 const SiStripRecHit2D *stereoRH,
287 if(trackdirection.
mag2()<float(FLT_MIN)){
288 LocalPoint lcenterofstrip=monoRH->localPositionFast();
298 double m00 = -(projectedstripmono.second.y()-projectedstripmono.first.y());
299 double m01 = (projectedstripmono.second.x()-projectedstripmono.first.x());
300 double c0 = m01*projectedstripmono.first.y() + m00*projectedstripmono.first.x();
311 double l1 = 1./(c1*c1+s1*s1);
314 float sigmap12 =
sigmaPitch(monoRH->localPosition(), monoRH->localPositionError(),topol);
330 StripPosition projectedstripstereo=
project(partnerstripdet,gluedDet,stripstereo,trackdirection);
333 double m10=-(projectedstripstereo.second.y()-projectedstripstereo.first.y());
334 double m11=(projectedstripstereo.second.x()-projectedstripstereo.first.x());
344 c(1)=m11*projectedstripstereo.first.y()+m10*projectedstripstereo.first.x();
350 if ((!force) && (!((gluedDet->
surface()).bounds().inside(position,10.
f*
scale_))) )
return std::unique_ptr<SiStripMatchedRecHit2D>(
nullptr);
354 double l2 = 1./(c2*c2+s2*
s2);
357 float sigmap22 =
sigmaPitch(stereoRH->localPosition(),stereoRH->localPositionError(),partnertopol);
361 double diff=(c1*s2-c2*s1);
362 double invdet2=1/(diff*diff*l1*l2);
363 float xx= invdet2*(sigmap12*s2*s2*l2+sigmap22*s1*s1*l1);
364 float xy=-invdet2*(sigmap12*c2*s2*l2+sigmap22*c1*s1*l1);
365 float yy= invdet2*(sigmap12*c2*c2*l2+sigmap22*c1*c1*l1);
371 if(force || (gluedDet->
surface()).bounds().inside(position,error,scale_))
372 return std::unique_ptr<SiStripMatchedRecHit2D> (
new SiStripMatchedRecHit2D(
LocalPoint(position), error, *gluedDet, monoRH,stereoRH));
373 return std::unique_ptr<SiStripMatchedRecHit2D>(
nullptr);
void push_back(data_type const &d)
const GeomDetUnit * monoDet() 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)
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
const Plane & surface() const
The nominal surface of the GeomDet.
static int position[TOTALCHAMBERS][3]
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepStd< double, 2, 2 > > AlgebraicMatrix22
virtual const Topology & topology() const =0
std::pair< LocalPoint, LocalPoint > StripPosition
SiStripRecHitMatcher(const edm::ParameterSet &conf)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
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
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
SimpleHitCollection::const_iterator SimpleHitIterator
virtual LocalPoint localPosition(float strip) const =0
boost::function< void(SiStripMatchedRecHit2D const &)> Collector
volatile std::atomic< bool > shutdown_flag false
ROOT::Math::SVector< double, 2 > AlgebraicVector2
const GeomDetUnit * stereoDet() const