#include <RecoLocalTracker/SiStripRecHitConverter/interface/SiStripRecHitMatcher.h>
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 14 of file SiStripRecHitMatcher.cc.
References edm::ParameterSet::getParameter(), and scale_.
00014 { 00015 scale_=conf.getParameter<double>("NSigmaInside"); 00016 }
SiStripRecHitMatcher::SiStripRecHitMatcher | ( | const double | theScale | ) |
Definition at line 18 of file SiStripRecHitMatcher.cc.
References scale_.
00018 { 00019 scale_=theScale; 00020 }
void SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, | |
SimpleHitIterator | begin, | |||
SimpleHitIterator | end, | |||
Collector & | collector, | |||
const GluedGeomDet * | gluedDet, | |||
LocalVector | trackdirection | |||
) | const |
the actual implementation
Definition at line 149 of file SiStripRecHitMatcher.cc.
References c, c1, c2, diff, error, GluedGeomDet::geographicalId(), l1, l2, StripTopology::localPitch(), BaseSiTrackerRecHit2DLocalPos::localPosition(), StripTopology::localPosition(), BaseSiTrackerRecHit2DLocalPos::localPositionError(), m, m10, PV3DBase< T, PVType, FrameType >::mag2(), Topology::measurementError(), Topology::measurementPosition(), GluedGeomDet::monoDet(), project(), s1, s2, scale_, SiStripRecHit2D::setSigmaPitch(), SiStripRecHit2D::sigmaPitch(), GluedGeomDet::stereoDet(), GeomDet::surface(), toLocal(), GeomDetUnit::topology(), MeasurementError::uu(), and x.
00153 { 00154 // stripdet = mono 00155 // partnerstripdet = stereo 00156 const GeomDetUnit* stripdet = gluedDet->monoDet(); 00157 const GeomDetUnit* partnerstripdet = gluedDet->stereoDet(); 00158 const StripTopology& topol=(const StripTopology&)stripdet->topology(); 00159 00160 // position of the initial and final point of the strip (RPHI cluster) in local strip coordinates 00161 double RPHIpointX = topol.measurementPosition(monoRH->localPosition()).x(); 00162 MeasurementPoint RPHIpointini(RPHIpointX,-0.5); 00163 MeasurementPoint RPHIpointend(RPHIpointX,0.5); 00164 00165 // position of the initial and final point of the strip in local coordinates (mono det) 00166 StripPosition stripmono=StripPosition(topol.localPosition(RPHIpointini),topol.localPosition(RPHIpointend)); 00167 00168 if(trackdirection.mag2()<FLT_MIN){// in case of no track hypothesis assume a track from the origin through the center of the strip 00169 LocalPoint lcenterofstrip=monoRH->localPosition(); 00170 GlobalPoint gcenterofstrip=(stripdet->surface()).toGlobal(lcenterofstrip); 00171 GlobalVector gtrackdirection=gcenterofstrip-GlobalPoint(0,0,0); 00172 trackdirection=(gluedDet->surface()).toLocal(gtrackdirection); 00173 } 00174 00175 //project mono hit on glued det 00176 StripPosition projectedstripmono=project(stripdet,gluedDet,stripmono,trackdirection); 00177 const StripTopology& partnertopol=(const StripTopology&)partnerstripdet->topology(); 00178 00179 double m00 = -(projectedstripmono.second.y()-projectedstripmono.first.y()); 00180 double m01 = (projectedstripmono.second.x()-projectedstripmono.first.x()); 00181 double c0 = m01*projectedstripmono.first.y() + m00*projectedstripmono.first.x(); 00182 00183 //error calculation (the part that depends on mono RH only) 00184 // LocalVector RPHIpositiononGluedendvector=projectedstripmono.second-projectedstripmono.first; 00185 /* 00186 double l1 = 1./RPHIpositiononGluedendvector.perp2(); 00187 double c1 = RPHIpositiononGluedendvector.y(); 00188 double s1 =-RPHIpositiononGluedendvector.x(); 00189 */ 00190 double c1 = -m00; 00191 double s1 = -m01; 00192 double l1 = 1./(c1*c1+s1*s1); 00193 00194 00195 // FIXME: here for test... 00196 double sigmap12 = monoRH->sigmaPitch(); 00197 if (sigmap12<0) { 00198 MeasurementError errormonoRH=topol.measurementError(monoRH->localPosition(),monoRH->localPositionError()); 00199 double pitch=topol.localPitch(monoRH->localPosition()); 00200 monoRH->setSigmaPitch(sigmap12=errormonoRH.uu()*pitch*pitch); 00201 } 00202 00203 SimpleHitIterator seconditer; 00204 00205 for(seconditer=begin;seconditer!=end;++seconditer){//iterate on stereo rechits 00206 00207 // position of the initial and final point of the strip (STEREO cluster) 00208 double STEREOpointX=partnertopol.measurementPosition((*seconditer)->localPosition()).x(); 00209 MeasurementPoint STEREOpointini(STEREOpointX,-0.5); 00210 MeasurementPoint STEREOpointend(STEREOpointX,0.5); 00211 00212 // position of the initial and final point of the strip in local coordinates (stereo det) 00213 StripPosition stripstereo(partnertopol.localPosition(STEREOpointini),partnertopol.localPosition(STEREOpointend)); 00214 00215 //project stereo hit on glued det 00216 StripPosition projectedstripstereo=project(partnerstripdet,gluedDet,stripstereo,trackdirection); 00217 00218 00219 double m10=-(projectedstripstereo.second.y()-projectedstripstereo.first.y()); 00220 double m11=(projectedstripstereo.second.x()-projectedstripstereo.first.x()); 00221 00222 //perform the matching 00223 //(x2-x1)(y-y1)=(y2-y1)(x-x1) 00224 AlgebraicMatrix22 m; AlgebraicVector2 c; 00225 m(0,0)=m00; 00226 m(0,1)=m01; 00227 m(1,0)=m10; 00228 m(1,1)=m11; 00229 c(0)=c0; 00230 c(1)=m11*projectedstripstereo.first.y()+m10*projectedstripstereo.first.x(); 00231 m.Invert(); 00232 AlgebraicVector2 solution = m * c; 00233 LocalPoint position(solution(0),solution(1)); 00234 00235 /* 00236 { 00237 double m00 = -(projectedstripmono.second.y()-projectedstripmono.first.y()); 00238 double m01 = (projectedstripmono.second.x()-projectedstripmono.first.x()); 00239 double m10 = -(projectedstripstereo.second.y()-projectedstripstereo.first.y()); 00240 double m11 = (projectedstripstereo.second.x()-projectedstripstereo.first.x()); 00241 double c0 = m01*projectedstripmono.first.y() + m00*projectedstripmono.first.x(); 00242 double c1 = m11*projectedstripstereo.first.y() + m10*projectedstripstereo.first.x(); 00243 00244 double invDet = 1./(m00*m11-m10*m01); 00245 } 00246 */ 00247 00248 // 00249 // temporary fix by tommaso 00250 // 00251 00252 00253 LocalError tempError (100,0,100); 00254 if (!((gluedDet->surface()).bounds().inside(position,tempError,scale_))) continue; 00255 00256 // then calculate the error 00257 /* 00258 LocalVector stereopositiononGluedendvector=projectedstripstereo.second-projectedstripstereo.first; 00259 double l2 = 1./stereopositiononGluedendvector.perp2(); 00260 double c2 = stereopositiononGluedendvector.y(); 00261 double s2 =-stereopositiononGluedendvector.x(); 00262 */ 00263 00264 double c2 = -m10; 00265 double s2 = -m11; 00266 double l2 = 1./(c2*c2+s2*s2); 00267 00268 00269 // FIXME: here for test... 00270 double sigmap22 = (*seconditer)->sigmaPitch(); 00271 if (sigmap22<0) { 00272 MeasurementError errorstereoRH=partnertopol.measurementError((*seconditer)->localPosition(),(*seconditer)->localPositionError()); 00273 double pitch=partnertopol.localPitch((*seconditer)->localPosition()); 00274 (*seconditer)->setSigmaPitch(sigmap22=errorstereoRH.uu()*pitch*pitch); 00275 } 00276 00277 double diff=(c1*s2-c2*s1); 00278 double invdet2=1/(diff*diff*l1*l2); 00279 float xx=invdet2*(sigmap12*s2*s2*l2+sigmap22*s1*s1*l1); 00280 float xy=-invdet2*(sigmap12*c2*s2*l2+sigmap22*c1*s1*l1); 00281 float yy=invdet2*(sigmap12*c2*c2*l2+sigmap22*c1*c1*l1); 00282 LocalError error(xx,xy,yy); 00283 00284 if((gluedDet->surface()).bounds().inside(position,error,scale_)){ //if it is inside the gluedet bonds 00285 //Change NSigmaInside in the configuration file to accept more hits 00286 //...and add it to the Rechit collection 00287 00288 const SiStripRecHit2D* secondHit = *seconditer; 00289 collector(SiStripMatchedRecHit2D(position, error,gluedDet->geographicalId() , 00290 monoRH,secondHit)); 00291 } 00292 } 00293 }
void SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, | |
SimpleHitIterator | begin, | |||
SimpleHitIterator | end, | |||
std::vector< SiStripMatchedRecHit2D * > & | collector, | |||
const GluedGeomDet * | gluedDet, | |||
LocalVector | trackdirection | |||
) | const |
Definition at line 103 of file SiStripRecHitMatcher.cc.
References SiStripMatchedRecHit2D::clone(), match(), and HLT_VtxMuL3::result.
00107 { 00108 Collector result(boost::bind(&std::vector<SiStripMatchedRecHit2D*>::push_back,boost::ref(collector), 00109 boost::bind(&SiStripMatchedRecHit2D::clone,_1))); 00110 match(monoRH,begin,end,result,gluedDet,trackdirection); 00111 }
void SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, | |
SimpleHitIterator | begin, | |||
SimpleHitIterator | end, | |||
edm::OwnVector< SiStripMatchedRecHit2D > & | collector, | |||
const GluedGeomDet * | gluedDet, | |||
LocalVector | trackdirection | |||
) | const |
Definition at line 89 of file SiStripRecHitMatcher.cc.
References match(), p, edm::OwnVector< T, P >::push_back(), and HLT_VtxMuL3::result.
00093 { 00094 00095 std::vector<SiStripMatchedRecHit2D*> result; 00096 result.reserve(end-begin); 00097 match(monoRH,begin,end,result,gluedDet,trackdirection); 00098 for (std::vector<SiStripMatchedRecHit2D*>::iterator p=result.begin(); p!=result.end(); 00099 p++) collector.push_back(*p); 00100 }
void SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, | |
SimpleHitIterator | begin, | |||
SimpleHitIterator | end, | |||
CollectorMatched & | collector, | |||
const GluedGeomDet * | gluedDet, | |||
LocalVector | trackdirection | |||
) | const |
Definition at line 135 of file SiStripRecHitMatcher.cc.
References match(), edmNew::DetSetVector< T >::FastFiller::push_back(), and HLT_VtxMuL3::result.
00139 { 00140 00141 Collector result(boost::bind(&CollectorMatched::push_back,boost::ref(collector),_1)); 00142 match(monoRH,begin,end,result,gluedDet,trackdirection); 00143 00144 }
void SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, | |
RecHitIterator | begin, | |||
RecHitIterator | end, | |||
CollectorMatched & | collector, | |||
const GluedGeomDet * | gluedDet, | |||
LocalVector | trackdirection | |||
) | const |
Definition at line 116 of file SiStripRecHitMatcher.cc.
00120 { 00121 00122 // is this really needed now???? 00123 SimpleHitCollection stereoHits; 00124 stereoHits.reserve(end-begin); 00125 for (RecHitIterator i=begin; i != end; ++i) 00126 stereoHits.push_back( &(*i)); // convert to simple pointer 00127 00128 return match( monoRH, 00129 stereoHits.begin(), stereoHits.end(), 00130 collector, 00131 gluedDet,trackdirection); 00132 }
edm::OwnVector< SiStripMatchedRecHit2D > SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, | |
SimpleHitIterator | begin, | |||
SimpleHitIterator | end, | |||
const GluedGeomDet * | gluedDet, | |||
LocalVector | trackdirection | |||
) | const |
Definition at line 77 of file SiStripRecHitMatcher.cc.
References match(), and edm::OwnVector< T, P >::reserve().
00080 { 00081 edm::OwnVector<SiStripMatchedRecHit2D> collector; 00082 collector.reserve(end-begin); // a resonable estimate of its size... 00083 match(monoRH,begin,end,collector,gluedDet,trackdirection); 00084 return collector; 00085 }
edm::OwnVector< SiStripMatchedRecHit2D > SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, | |
RecHitIterator | begin, | |||
RecHitIterator | end, | |||
const GluedGeomDet * | gluedDet, | |||
LocalVector | trackdirection | |||
) | const |
Definition at line 60 of file SiStripRecHitMatcher.cc.
00064 { 00065 SimpleHitCollection stereoHits; 00066 stereoHits.reserve(end-begin); 00067 00068 for (RecHitIterator i=begin; i != end; ++i) { 00069 stereoHits.push_back( &(*i)); // convert to simple pointer 00070 } 00071 return match( monoRH, 00072 stereoHits.begin(), stereoHits.end(), 00073 gluedDet,trackdirection); 00074 }
edm::OwnVector<SiStripMatchedRecHit2D> SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, | |
RecHitIterator | begin, | |||
RecHitIterator | end, | |||
const GluedGeomDet * | gluedDet | |||
) | const [inline] |
Definition at line 53 of file SiStripRecHitMatcher.h.
References match().
00055 { 00056 return match(monoRH,begin, end, gluedDet,LocalVector(0.,0.,0.)); 00057 }
SiStripMatchedRecHit2D * SiStripRecHitMatcher::match | ( | const SiStripMatchedRecHit2D * | originalRH, | |
const GluedGeomDet * | gluedDet, | |||
LocalVector | trackdirection | |||
) | const |
Definition at line 39 of file SiStripRecHitMatcher.cc.
References collection, match(), SiStripMatchedRecHit2D::monoHit(), and SiStripMatchedRecHit2D::stereoHit().
00041 { 00042 00043 const SiStripRecHit2D* theMonoRH = origRH->monoHit(); 00044 // const SiStripRecHit2D* theStereoRH = origRH->stereoHit(); 00045 SimpleHitCollection theStereoHits(1, origRH->stereoHit()); 00046 // theStereoHits.push_back(theStereoRH); 00047 00048 std::vector<SiStripMatchedRecHit2D*> collection; 00049 match( theMonoRH, 00050 theStereoHits.begin(), theStereoHits.end(), 00051 collection, 00052 gluedDet,trackdirection); 00053 00054 return collection.empty() ? (SiStripMatchedRecHit2D*)(0) : collection.front(); 00055 00056 }
SiStripMatchedRecHit2D * SiStripRecHitMatcher::match | ( | const SiStripRecHit2D * | monoRH, | |
const SiStripRecHit2D * | stereoRH, | |||
const GluedGeomDet * | gluedDet, | |||
LocalVector | trackdirection | |||
) | const |
Definition at line 24 of file SiStripRecHitMatcher.cc.
References collection.
Referenced by TSiStripMatchedRecHit::clone(), RoadSearchCloudMakerAlgorithm::CorrectMatchedHit(), RoadSearchTrackCandidateMakerAlgorithm::createSeedTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::extrapolateTrajectory(), RoadSearchTrackCandidateMakerAlgorithm::FindBestHits(), match(), SiStripRecHitConverterAlgorithm::match(), and TkGluedMeasurementDet::recHits().
00027 { 00028 SimpleHitCollection stereoHits(1,stereoRH); 00029 std::vector<SiStripMatchedRecHit2D*> collection; 00030 match( monoRH, 00031 stereoHits.begin(), stereoHits.end(), 00032 collection, 00033 gluedDet,trackdirection); 00034 00035 return collection.empty() ? (SiStripMatchedRecHit2D*)(0) : collection.front(); 00036 }
SiStripRecHitMatcher::StripPosition SiStripRecHitMatcher::project | ( | const GeomDetUnit * | det, | |
const GluedGeomDet * | glueddet, | |||
StripPosition | strip, | |||
LocalVector | trackdirection | |||
) | const |
Definition at line 296 of file SiStripRecHitMatcher.cc.
References scale, GeomDet::surface(), toLocal(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by match().
00297 { 00298 00299 GlobalPoint globalpointini=(det->surface()).toGlobal(strip.first); 00300 GlobalPoint globalpointend=(det->surface()).toGlobal(strip.second); 00301 00302 // position of the initial and final point of the strip in glued local coordinates 00303 LocalPoint positiononGluedini=(glueddet->surface()).toLocal(globalpointini); 00304 LocalPoint positiononGluedend=(glueddet->surface()).toLocal(globalpointend); 00305 00306 //correct the position with the track direction 00307 00308 float scale=-positiononGluedini.z()/trackdirection.z(); 00309 00310 LocalPoint projpositiononGluedini= positiononGluedini + scale*trackdirection; 00311 LocalPoint projpositiononGluedend= positiononGluedend + scale*trackdirection; 00312 00313 return StripPosition(projpositiononGluedini,projpositiononGluedend); 00314 }
Definition at line 122 of file SiStripRecHitMatcher.h.
Referenced by match(), and SiStripRecHitMatcher().