#include <SiStripRecHitMatcher.h>
Public Types | |
typedef boost::function< void(SiStripMatchedRecHit2D const &)> | Collector |
typedef SiStripMatchedRecHit2DCollectionNew::FastFiller | CollectorMatched |
typedef SiStripRecHit2DCollectionNew::DetSet::const_iterator | RecHitIterator |
typedef std::vector< const SiStripRecHit2D * > | SimpleHitCollection |
typedef SimpleHitCollection::const_iterator | SimpleHitIterator |
typedef std::pair< LocalPoint, LocalPoint > | StripPosition |
Public Member Functions | |
template<typename MonoIterator , typename StereoIterator , typename CollectorHelper > | |
void | doubleMatch (MonoIterator monoRHiter, MonoIterator monoRHend, StereoIterator seconditer, StereoIterator seconditerend, const GluedGeomDet *gluedDet, LocalVector trdir, CollectorHelper &collectorHelper) const |
void | match (const SiStripRecHit2D *monoRH, SimpleHitIterator begin, SimpleHitIterator end, Collector &collector, const GluedGeomDet *gluedDet, LocalVector trackdirection) const |
the actual implementation | |
void | match (const SiStripRecHit2D *monoRH, SimpleHitIterator begin, SimpleHitIterator end, std::vector< SiStripMatchedRecHit2D * > &collector, const GluedGeomDet *gluedDet, LocalVector trackdirection) const |
SiStripMatchedRecHit2D * | match (const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const |
edm::OwnVector < SiStripMatchedRecHit2D > | match (const SiStripRecHit2D *monoRH, SimpleHitIterator begin, SimpleHitIterator end, const GluedGeomDet *gluedDet, LocalVector trackdirection) const |
void | match (const SiStripRecHit2D *monoRH, SimpleHitIterator begin, SimpleHitIterator end, CollectorMatched &collector, const GluedGeomDet *gluedDet, LocalVector trackdirection) const |
void | match (const SiStripRecHit2D *monoRH, RecHitIterator begin, RecHitIterator end, CollectorMatched &collector, const GluedGeomDet *gluedDet, LocalVector trackdirection) const |
SiStripMatchedRecHit2D * | match (const SiStripMatchedRecHit2D *originalRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const |
edm::OwnVector < SiStripMatchedRecHit2D > | match (const SiStripRecHit2D *monoRH, RecHitIterator begin, RecHitIterator end, const GluedGeomDet *gluedDet, LocalVector trackdirection) const |
void | match (const SiStripRecHit2D *monoRH, SimpleHitIterator begin, SimpleHitIterator end, edm::OwnVector< SiStripMatchedRecHit2D > &collector, const GluedGeomDet *gluedDet, LocalVector trackdirection) const |
edm::OwnVector < SiStripMatchedRecHit2D > | match (const SiStripRecHit2D *monoRH, RecHitIterator begin, RecHitIterator end, const GluedGeomDet *gluedDet) const |
StripPosition | project (const GeomDetUnit *det, const GluedGeomDet *glueddet, StripPosition strip, LocalVector trackdirection) const |
SiStripRecHitMatcher (const edm::ParameterSet &conf) | |
SiStripRecHitMatcher (const double theScale) | |
Public Attributes | |
float | scale_ |
Definition at line 23 of file SiStripRecHitMatcher.h.
typedef boost::function<void(SiStripMatchedRecHit2D const&)> SiStripRecHitMatcher::Collector |
Definition at line 33 of file SiStripRecHitMatcher.h.
Definition at line 27 of file SiStripRecHitMatcher.h.
Definition at line 29 of file SiStripRecHitMatcher.h.
typedef std::vector<const SiStripRecHit2D *> SiStripRecHitMatcher::SimpleHitCollection |
Definition at line 30 of file SiStripRecHitMatcher.h.
typedef SimpleHitCollection::const_iterator SiStripRecHitMatcher::SimpleHitIterator |
Definition at line 31 of file SiStripRecHitMatcher.h.
typedef std::pair<LocalPoint,LocalPoint> SiStripRecHitMatcher::StripPosition |
Definition at line 36 of file SiStripRecHitMatcher.h.
SiStripRecHitMatcher::SiStripRecHitMatcher | ( | const edm::ParameterSet & | conf | ) |
Definition at line 18 of file SiStripRecHitMatcher.cc.
References edm::ParameterSet::getParameter(), and scale_.
{ scale_=conf.getParameter<double>("NSigmaInside"); }
SiStripRecHitMatcher::SiStripRecHitMatcher | ( | const double | theScale | ) |
void SiStripRecHitMatcher::doubleMatch | ( | MonoIterator | monoRHiter, |
MonoIterator | monoRHend, | ||
StereoIterator | seconditer, | ||
StereoIterator | seconditerend, | ||
const GluedGeomDet * | gluedDet, | ||
LocalVector | trdir, | ||
CollectorHelper & | collectorHelper | ||
) | const |
void SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, |
SimpleHitIterator | begin, | ||
SimpleHitIterator | end, | ||
Collector & | collector, | ||
const GluedGeomDet * | gluedDet, | ||
LocalVector | trackdirection | ||
) | const |
the actual implementation
Definition at line 165 of file SiStripRecHitMatcher.cc.
References trackerHits::c, alignmentValidation::c1, diffTreeTool::diff, end, error, GeomDet::geographicalId(), StripTopology::localPitch(), StripTopology::localPosition(), BaseTrackerRecHit::localPositionErrorFast(), BaseTrackerRecHit::localPositionFast(), m, PV3DBase< T, PVType, FrameType >::mag2(), Topology::measurementError(), Topology::measurementPosition(), GluedGeomDet::monoDet(), position, project(), indexGen::s2, scale_, SiStripRecHit2D::setSigmaPitch(), SiStripRecHit2D::sigmaPitch(), GluedGeomDet::stereoDet(), GeomDet::surface(), toLocal(), GeomDetUnit::topology(), HelpertRecHit2DLocalPos::updateWithAPE(), MeasurementError::uu(), x, and xy().
{ // stripdet = mono // partnerstripdet = stereo const GeomDetUnit* stripdet = gluedDet->monoDet(); const GeomDetUnit* partnerstripdet = gluedDet->stereoDet(); const StripTopology& topol=(const StripTopology&)stripdet->topology(); // position of the initial and final point of the strip (RPHI cluster) in local strip coordinates double RPHIpointX = topol.measurementPosition(monoRH->localPositionFast()).x(); MeasurementPoint RPHIpointini(RPHIpointX,-0.5); MeasurementPoint RPHIpointend(RPHIpointX,0.5); // position of the initial and final point of the strip in local coordinates (mono det) StripPosition stripmono=StripPosition(topol.localPosition(RPHIpointini),topol.localPosition(RPHIpointend)); if(trackdirection.mag2()<FLT_MIN){// in case of no track hypothesis assume a track from the origin through the center of the strip LocalPoint lcenterofstrip=monoRH->localPositionFast(); GlobalPoint gcenterofstrip=(stripdet->surface()).toGlobal(lcenterofstrip); GlobalVector gtrackdirection=gcenterofstrip-GlobalPoint(0,0,0); trackdirection=(gluedDet->surface()).toLocal(gtrackdirection); } //project mono hit on glued det StripPosition projectedstripmono=project(stripdet,gluedDet,stripmono,trackdirection); const StripTopology& partnertopol=(const StripTopology&)partnerstripdet->topology(); double m00 = -(projectedstripmono.second.y()-projectedstripmono.first.y()); double m01 = (projectedstripmono.second.x()-projectedstripmono.first.x()); double c0 = m01*projectedstripmono.first.y() + m00*projectedstripmono.first.x(); //error calculation (the part that depends on mono RH only) // LocalVector RPHIpositiononGluedendvector=projectedstripmono.second-projectedstripmono.first; /* double l1 = 1./RPHIpositiononGluedendvector.perp2(); double c1 = RPHIpositiononGluedendvector.y(); double s1 =-RPHIpositiononGluedendvector.x(); */ double c1 = -m00; double s1 = -m01; double l1 = 1./(c1*c1+s1*s1); // FIXME: here for test... double sigmap12 = monoRH->sigmaPitch(); if (sigmap12<0) { //AlgebraicSymMatrix tmpMatrix = monoRH->parametersError(); /* std::cout << "DEBUG START" << std::endl; std::cout << "APE mono,stereo,glued : " << stripdet->alignmentPositionError()->globalError().cxx() << " , " << partnerstripdet->alignmentPositionError()->globalError().cxx() << " , " << gluedDet->alignmentPositionError()->globalError().cxx() << std::endl; */ LocalError tmpError(monoRH->localPositionErrorFast()); HelpertRecHit2DLocalPos::updateWithAPE(tmpError,*stripdet); MeasurementError errormonoRH=topol.measurementError(monoRH->localPositionFast(),tmpError); /* std::cout << "localPosError.xx(), helper.xx(), param.xx(): " << monoRH->localPositionError().xx() << " , " << monoRH->parametersError()[0][0] << " , " << tmpMatrix[0][0] << std::endl; */ //MeasurementError errormonoRH=topol.measurementError(monoRH->localPosition(),monoRH->localPositionError()); double pitch=topol.localPitch(monoRH->localPositionFast()); monoRH->setSigmaPitch(sigmap12=errormonoRH.uu()*pitch*pitch); } SimpleHitIterator seconditer; for(seconditer=begin;seconditer!=end;++seconditer){//iterate on stereo rechits // position of the initial and final point of the strip (STEREO cluster) double STEREOpointX=partnertopol.measurementPosition((*seconditer)->localPositionFast()).x(); MeasurementPoint STEREOpointini(STEREOpointX,-0.5); MeasurementPoint STEREOpointend(STEREOpointX,0.5); // position of the initial and final point of the strip in local coordinates (stereo det) StripPosition stripstereo(partnertopol.localPosition(STEREOpointini),partnertopol.localPosition(STEREOpointend)); //project stereo hit on glued det StripPosition projectedstripstereo=project(partnerstripdet,gluedDet,stripstereo,trackdirection); double m10=-(projectedstripstereo.second.y()-projectedstripstereo.first.y()); double m11=(projectedstripstereo.second.x()-projectedstripstereo.first.x()); //perform the matching //(x2-x1)(y-y1)=(y2-y1)(x-x1) AlgebraicMatrix22 m; AlgebraicVector2 c; // FIXME understand why moving this initializer out of the loop changes the output! m(0,0)=m00; m(0,1)=m01; m(1,0)=m10; m(1,1)=m11; c(0)=c0; c(1)=m11*projectedstripstereo.first.y()+m10*projectedstripstereo.first.x(); m.Invert(); AlgebraicVector2 solution = m * c; LocalPoint position(solution(0),solution(1)); /* { double m00 = -(projectedstripmono.second.y()-projectedstripmono.first.y()); double m01 = (projectedstripmono.second.x()-projectedstripmono.first.x()); double m10 = -(projectedstripstereo.second.y()-projectedstripstereo.first.y()); double m11 = (projectedstripstereo.second.x()-projectedstripstereo.first.x()); double c0 = m01*projectedstripmono.first.y() + m00*projectedstripmono.first.x(); double c1 = m11*projectedstripstereo.first.y() + m10*projectedstripstereo.first.x(); double invDet = 1./(m00*m11-m10*m01); } */ // // temporary fix by tommaso // LocalError tempError (100,0,100); if (!((gluedDet->surface()).bounds().inside(position,tempError,scale_))) continue; // then calculate the error /* LocalVector stereopositiononGluedendvector=projectedstripstereo.second-projectedstripstereo.first; double l2 = 1./stereopositiononGluedendvector.perp2(); double c2 = stereopositiononGluedendvector.y(); double s2 =-stereopositiononGluedendvector.x(); */ double c2 = -m10; double s2 = -m11; double l2 = 1./(c2*c2+s2*s2); // FIXME: here for test... double sigmap22 = (*seconditer)->sigmaPitch(); if (sigmap22<0) { //AlgebraicSymMatrix tmpMatrix = (*seconditer)->parametersError(); LocalError tmpError((*seconditer)->localPositionErrorFast()); HelpertRecHit2DLocalPos::updateWithAPE(tmpError, *partnerstripdet); MeasurementError errorstereoRH=partnertopol.measurementError((*seconditer)->localPositionFast(),tmpError); //MeasurementError errorstereoRH=partnertopol.measurementError((*seconditer)->localPosition(),(*seconditer)->localPositionError()); double pitch=partnertopol.localPitch((*seconditer)->localPositionFast()); (*seconditer)->setSigmaPitch(sigmap22=errorstereoRH.uu()*pitch*pitch); } double diff=(c1*s2-c2*s1); double invdet2=1/(diff*diff*l1*l2); float xx= invdet2*(sigmap12*s2*s2*l2+sigmap22*s1*s1*l1); float xy=-invdet2*(sigmap12*c2*s2*l2+sigmap22*c1*s1*l1); float yy= invdet2*(sigmap12*c2*c2*l2+sigmap22*c1*c1*l1); LocalError error(xx,xy,yy); if((gluedDet->surface()).bounds().inside(position,error,scale_)){ //if it is inside the gluedet bonds //Change NSigmaInside in the configuration file to accept more hits //...and add it to the Rechit collection const SiStripRecHit2D* secondHit = *seconditer; collector(SiStripMatchedRecHit2D(position, error,gluedDet->geographicalId() , monoRH,secondHit)); } } }
void SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, |
SimpleHitIterator | begin, | ||
SimpleHitIterator | end, | ||
std::vector< SiStripMatchedRecHit2D * > & | collector, | ||
const GluedGeomDet * | gluedDet, | ||
LocalVector | trackdirection | ||
) | const |
Definition at line 119 of file SiStripRecHitMatcher.cc.
References SiStripMatchedRecHit2D::clone(), match(), and query::result.
void SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, |
SimpleHitIterator | begin, | ||
SimpleHitIterator | end, | ||
edm::OwnVector< SiStripMatchedRecHit2D > & | collector, | ||
const GluedGeomDet * | gluedDet, | ||
LocalVector | trackdirection | ||
) | const |
Definition at line 98 of file SiStripRecHitMatcher.cc.
References match(), AlCaHLTBitMon_ParallelJobs::p, edm::OwnVector< T, P >::push_back(), and query::result.
SiStripMatchedRecHit2D * SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, |
const SiStripRecHit2D * | stereoRH, | ||
const GluedGeomDet * | gluedDet, | ||
LocalVector | trackdirection | ||
) | const |
Definition at line 28 of file SiStripRecHitMatcher.cc.
References runEdmFileComparison::collection.
Referenced by TSiStripMatchedRecHit::clone(), TkGluedMeasurementDet::collectRecHits(), TSiStripMatchedRecHit::ComputeCoarseLocalPosition(), RoadSearchCloudMakerAlgorithm::CorrectMatchedHit(), RoadSearchTrackCandidateMakerAlgorithm::createSeedTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::extrapolateTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::FindBestHits(), and match().
{ SimpleHitCollection stereoHits(1,stereoRH); std::vector<SiStripMatchedRecHit2D*> collection; match( monoRH, stereoHits.begin(), stereoHits.end(), collection, gluedDet,trackdirection); return collection.empty() ? (SiStripMatchedRecHit2D*)(0) : collection.front(); }
edm::OwnVector<SiStripMatchedRecHit2D> SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, |
RecHitIterator | begin, | ||
RecHitIterator | end, | ||
const GluedGeomDet * | gluedDet | ||
) | const [inline] |
Definition at line 61 of file SiStripRecHitMatcher.h.
References match().
{ return match(monoRH,begin, end, gluedDet,LocalVector(0.,0.,0.)); }
void SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, |
RecHitIterator | begin, | ||
RecHitIterator | end, | ||
CollectorMatched & | collector, | ||
const GluedGeomDet * | gluedDet, | ||
LocalVector | trackdirection | ||
) | const |
Definition at line 132 of file SiStripRecHitMatcher.cc.
edm::OwnVector< SiStripMatchedRecHit2D > SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, |
SimpleHitIterator | begin, | ||
SimpleHitIterator | end, | ||
const GluedGeomDet * | gluedDet, | ||
LocalVector | trackdirection | ||
) | const |
Definition at line 86 of file SiStripRecHitMatcher.cc.
References match(), and edm::OwnVector< T, P >::reserve().
edm::OwnVector< SiStripMatchedRecHit2D > SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, |
RecHitIterator | begin, | ||
RecHitIterator | end, | ||
const GluedGeomDet * | gluedDet, | ||
LocalVector | trackdirection | ||
) | const |
Definition at line 69 of file SiStripRecHitMatcher.cc.
void SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, |
SimpleHitIterator | begin, | ||
SimpleHitIterator | end, | ||
CollectorMatched & | collector, | ||
const GluedGeomDet * | gluedDet, | ||
LocalVector | trackdirection | ||
) | const |
Definition at line 151 of file SiStripRecHitMatcher.cc.
References match(), edmNew::DetSetVector< T >::FastFiller::push_back(), and query::result.
SiStripMatchedRecHit2D * SiStripRecHitMatcher::match | ( | const SiStripMatchedRecHit2D * | originalRH, |
const GluedGeomDet * | gluedDet, | ||
LocalVector | trackdirection | ||
) | const |
Definition at line 43 of file SiStripRecHitMatcher.cc.
{ throw "SiStripRecHitMatcher::match(const SiStripMatchedRecHit2D *,..) is obsoltete since 5.2.0"; /* const SiStripRecHit2D* theMonoRH = origRH->monoHit(); // const SiStripRecHit2D* theStereoRH = origRH->stereoHit(); SimpleHitCollection theStereoHits(1, origRH->stereoHit()); // theStereoHits.push_back(theStereoRH); std::vector<SiStripMatchedRecHit2D*> collection; match( theMonoRH, theStereoHits.begin(), theStereoHits.end(), collection, gluedDet,trackdirection); return collection.empty() ? (SiStripMatchedRecHit2D*)(0) : collection.front(); */ return nullptr; }
SiStripRecHitMatcher::StripPosition SiStripRecHitMatcher::project | ( | const GeomDetUnit * | det, |
const GluedGeomDet * | glueddet, | ||
StripPosition | strip, | ||
LocalVector | trackdirection | ||
) | const |
Definition at line 333 of file SiStripRecHitMatcher.cc.
References pileupReCalc_HLTpaths::scale, GeomDet::surface(), toLocal(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by match().
{ GlobalPoint globalpointini=(det->surface()).toGlobal(strip.first); GlobalPoint globalpointend=(det->surface()).toGlobal(strip.second); // position of the initial and final point of the strip in glued local coordinates LocalPoint positiononGluedini=(glueddet->surface()).toLocal(globalpointini); LocalPoint positiononGluedend=(glueddet->surface()).toLocal(globalpointend); //correct the position with the track direction float scale=-positiononGluedini.z()/trackdirection.z(); LocalPoint projpositiononGluedini= positiononGluedini + scale*trackdirection; LocalPoint projpositiononGluedend= positiononGluedend + scale*trackdirection; return StripPosition(projpositiononGluedini,projpositiononGluedend); }
Definition at line 130 of file SiStripRecHitMatcher.h.
Referenced by match(), and SiStripRecHitMatcher().