#include <RoadSearchCircleSeed.h>
Public Types | |
typedef std::pair< double, double > | line |
enum | type { circle, straightLine } |
Public Member Functions | |
std::vector< const TrackingRecHit * > ::const_iterator | begin_hits () const |
std::vector< GlobalPoint > ::const_iterator | begin_points () const |
double | calculateEta (double theta) const |
double | calculateImpactParameter (GlobalPoint ¢er, double radius) |
bool | calculateInBarrel () |
GlobalPoint | Center () const |
bool | Compare (const RoadSearchCircleSeed *circle, double centerCut, double radiusCut, unsigned int differentHitsCut) const |
bool | CompareCenter (const RoadSearchCircleSeed *circle, double centerCut) const |
bool | CompareDifferentHits (const RoadSearchCircleSeed *circle, unsigned int differentHitsCut) const |
bool | CompareRadius (const RoadSearchCircleSeed *circle, double radiusCut) const |
double | determinant (double array[][3], unsigned int bins) |
std::vector< const TrackingRecHit * > ::const_iterator | end_hits () const |
std::vector< GlobalPoint > ::const_iterator | end_points () const |
double | Eta () const |
const Roads::RoadSeed * | getSeed () |
const Roads::RoadSet * | getSet () |
std::vector< const TrackingRecHit * > | Hits () const |
double | ImpactParameter () const |
bool | InBarrel () const |
double | Phi0 () const |
std::vector< GlobalPoint > | Points () const |
std::string | print () const |
double | Radius () const |
RoadSearchCircleSeed (const TrackingRecHit *hit1, const TrackingRecHit *hit2, GlobalPoint &point1, GlobalPoint &point2) | |
RoadSearchCircleSeed (const TrackingRecHit *hit1, const TrackingRecHit *hit2, const TrackingRecHit *hit3, GlobalPoint &point1, GlobalPoint &point2, GlobalPoint &point3) | |
void | setSeed (const Roads::RoadSeed *input) |
void | setSet (const Roads::RoadSet *input) |
double | Theta () const |
double | Type () const |
~RoadSearchCircleSeed () | |
Private Attributes | |
GlobalPoint | center_ |
std::vector< const TrackingRecHit * > | hits_ |
double | impactParameter_ |
bool | inBarrel_ |
std::vector< GlobalPoint > | points_ |
double | radius_ |
const Roads::RoadSeed * | seed_ |
const Roads::RoadSet * | set_ |
type | type_ |
Definition at line 29 of file RoadSearchCircleSeed.h.
typedef std::pair<double,double> RoadSearchCircleSeed::line |
Definition at line 34 of file RoadSearchCircleSeed.h.
Definition at line 36 of file RoadSearchCircleSeed.h.
{ circle, straightLine };
RoadSearchCircleSeed::RoadSearchCircleSeed | ( | const TrackingRecHit * | hit1, |
const TrackingRecHit * | hit2, | ||
const TrackingRecHit * | hit3, | ||
GlobalPoint & | point1, | ||
GlobalPoint & | point2, | ||
GlobalPoint & | point3 | ||
) |
Definition at line 25 of file RoadSearchCircleSeed.cc.
References calculateImpactParameter(), calculateInBarrel(), center_, circle, hits_, impactParameter_, inBarrel_, FastCircle::isValid(), points_, radius_, FastCircle::rho(), straightLine, type_, FastCircle::x0(), and FastCircle::y0().
{ hits_.reserve(3); hits_.push_back(hit1); hits_.push_back(hit2); hits_.push_back(hit3); points_.reserve(3); points_.push_back(point1); points_.push_back(point2); points_.push_back(point3); FastCircle kreis(point1, point2, point3); if ( !kreis.isValid() ) { // line type_ = straightLine; inBarrel_ = true; // Not used for lines center_ = GlobalPoint(0,0,0); radius_ = 0; impactParameter_ = 0; } else { type_ = circle; inBarrel_ = calculateInBarrel(); radius_ = kreis.rho(); center_ = GlobalPoint(kreis.x0(),kreis.y0(),0); impactParameter_ = calculateImpactParameter(center_,radius_); } }
RoadSearchCircleSeed::RoadSearchCircleSeed | ( | const TrackingRecHit * | hit1, |
const TrackingRecHit * | hit2, | ||
GlobalPoint & | point1, | ||
GlobalPoint & | point2 | ||
) |
Definition at line 63 of file RoadSearchCircleSeed.cc.
References center_, hits_, impactParameter_, inBarrel_, points_, radius_, straightLine, and type_.
{ // // straight line constructor // hits_.reserve(2); hits_.push_back(hit1); hits_.push_back(hit2); points_.reserve(2); points_.push_back(point1); points_.push_back(point2); type_ = straightLine; inBarrel_ = true; // Not used for lines center_ = GlobalPoint(0,0,0); radius_ = 0; impactParameter_ = 0; }
RoadSearchCircleSeed::~RoadSearchCircleSeed | ( | ) |
Definition at line 87 of file RoadSearchCircleSeed.cc.
{ }
std::vector<const TrackingRecHit*>::const_iterator RoadSearchCircleSeed::begin_hits | ( | ) | const [inline] |
Definition at line 59 of file RoadSearchCircleSeed.h.
References hits_.
Referenced by CompareDifferentHits().
{ return hits_.begin(); }
std::vector<GlobalPoint>::const_iterator RoadSearchCircleSeed::begin_points | ( | ) | const [inline] |
Definition at line 55 of file RoadSearchCircleSeed.h.
References points_.
{ return points_.begin(); }
double RoadSearchCircleSeed::calculateEta | ( | double | theta | ) | const |
Definition at line 118 of file RoadSearchCircleSeed.cc.
References funct::log(), and funct::tan().
Referenced by Eta().
double RoadSearchCircleSeed::calculateImpactParameter | ( | GlobalPoint & | center, |
double | radius | ||
) |
Definition at line 106 of file RoadSearchCircleSeed.cc.
References abs, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
Referenced by RoadSearchCircleSeed().
bool RoadSearchCircleSeed::calculateInBarrel | ( | ) |
Definition at line 90 of file RoadSearchCircleSeed.cc.
References hits_, and sistripsummary::TEC.
Referenced by RoadSearchCircleSeed().
GlobalPoint RoadSearchCircleSeed::Center | ( | ) | const [inline] |
Definition at line 62 of file RoadSearchCircleSeed.h.
References center_.
Referenced by CompareCenter(), and operator<<().
{ return center_;}
bool RoadSearchCircleSeed::Compare | ( | const RoadSearchCircleSeed * | circle, |
double | centerCut, | ||
double | radiusCut, | ||
unsigned int | differentHitsCut | ||
) | const |
Definition at line 316 of file RoadSearchCircleSeed.cc.
References CompareCenter(), CompareDifferentHits(), CompareRadius(), and query::result.
Referenced by RoadSearchSeedFinderAlgorithm::calculateCircleSeedsFromHits().
{ // // compare this circle with the input circle // compare: percentage of center difference of center average // compare: percentage of radius difference of radius average // compare: number of hits which don't overlap between the two circles // // return value bool result = false; result = CompareRadius(circle,radiusCut); if ( result ) { result = CompareCenter(circle,centerCut); if ( result ) { result = CompareDifferentHits(circle,differentHitsCut); } } return result; }
bool RoadSearchCircleSeed::CompareCenter | ( | const RoadSearchCircleSeed * | circle, |
double | centerCut | ||
) | const |
Definition at line 342 of file RoadSearchCircleSeed.cc.
References Center(), center_, query::result, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
Referenced by Compare().
{ // // compare this circle with the input circle // compare: percentage of center difference of center average // // return value bool result = false; double averageCenter = std::sqrt(((center_.x()+circle->Center().x())/2) * ((center_.x()+circle->Center().x())/2) + ((center_.y()+circle->Center().y())/2) * ((center_.y()+circle->Center().y())/2)); double differenceCenter = std::sqrt((center_.x()-circle->Center().x()) * (center_.x()-circle->Center().x()) + (center_.y()-circle->Center().y()) * (center_.y()-circle->Center().y())); if ( differenceCenter/averageCenter <= centerCut ) { result = true; } // edm::LogVerbatim("OLI") << "center difference: " << differenceCenter // << "center average: " << averageCenter // << "center percentage: " << differenceCenter/averageCenter // << " cut: " << centerCut // << " result: " << result; return result; }
bool RoadSearchCircleSeed::CompareDifferentHits | ( | const RoadSearchCircleSeed * | circle, |
unsigned int | differentHitsCut | ||
) | const |
Definition at line 402 of file RoadSearchCircleSeed.cc.
References begin_hits(), end_hits(), hits_, and query::result.
Referenced by Compare().
{ // // compare this circle with the input circle // compare: number of hits which don't overlap between the two circles // // return value bool result = false; // assume circles always have 3 hits unsigned int counter = 0; for ( std::vector<const TrackingRecHit*>::const_iterator hit1 = hits_.begin(), hit1End = hits_.end(); hit1 != hit1End; ++hit1 ) { bool included = false; for ( std::vector<const TrackingRecHit*>::const_iterator hit2 = circle->begin_hits(), hit2End = circle->end_hits(); hit2 != hit2End; ++hit2 ) { if ( *hit1 == *hit2 ) { included = true; } } if ( !included ) { ++counter; } } if ( counter <= differentHitsCut ) { result = true; } // edm::LogVerbatim("OLI") << "hits: " << counter // << " cut: " << differentHitsCut // << " result: " << result; return result; }
bool RoadSearchCircleSeed::CompareRadius | ( | const RoadSearchCircleSeed * | circle, |
double | radiusCut | ||
) | const |
Definition at line 375 of file RoadSearchCircleSeed.cc.
References abs, Radius(), radius_, and query::result.
Referenced by Compare().
{ // // compare: percentage of center difference of center average // compare: percentage of radius difference of radius average // // return value bool result = false; double averageRadius = (radius_ + circle->Radius() ) /2; double differenceRadius = std::abs(radius_ - circle->Radius()); if ( differenceRadius/averageRadius <= radiusCut ) { result = true; } // edm::LogVerbatim("OLI") << "radius difference: " << differenceRadius // << " radius average: " << averageRadius // << " radius percentage: " << differenceRadius/averageRadius // << " cut: " << radiusCut // << " result: " << result; return result; }
double RoadSearchCircleSeed::determinant | ( | double | array[][3], |
unsigned int | bins | ||
) |
std::vector<const TrackingRecHit*>::const_iterator RoadSearchCircleSeed::end_hits | ( | ) | const [inline] |
Definition at line 60 of file RoadSearchCircleSeed.h.
References hits_.
Referenced by CompareDifferentHits().
{ return hits_.end(); }
std::vector<GlobalPoint>::const_iterator RoadSearchCircleSeed::end_points | ( | ) | const [inline] |
double RoadSearchCircleSeed::Eta | ( | ) | const [inline] |
Definition at line 65 of file RoadSearchCircleSeed.h.
References calculateEta(), and Theta().
{ return calculateEta(Theta());}
const Roads::RoadSeed* RoadSearchCircleSeed::getSeed | ( | ) | [inline] |
const Roads::RoadSet* RoadSearchCircleSeed::getSet | ( | ) | [inline] |
std::vector<const TrackingRecHit*> RoadSearchCircleSeed::Hits | ( | ) | const [inline] |
double RoadSearchCircleSeed::ImpactParameter | ( | ) | const [inline] |
Definition at line 64 of file RoadSearchCircleSeed.h.
References impactParameter_.
Referenced by RoadSearchSeedFinderAlgorithm::calculateCircleSeedsFromHits(), operator<<(), and Phi0().
{ return impactParameter_;}
bool RoadSearchCircleSeed::InBarrel | ( | ) | const [inline] |
Definition at line 67 of file RoadSearchCircleSeed.h.
References inBarrel_.
Referenced by RoadSearchSeedFinderAlgorithm::calculateCircleSeedsFromHits(), and operator<<().
{ return inBarrel_; }
double RoadSearchCircleSeed::Phi0 | ( | ) | const |
Definition at line 157 of file RoadSearchCircleSeed.cc.
References PV3DBase< T, PVType, FrameType >::barePhi(), center_, i, ImpactParameter(), groupFilesInBlocks::lines, PV3DBase< T, PVType, FrameType >::perp(), phi, Geom::pi(), pi, points_, Radius(), straightLine, and type_.
{ // // calculate the angle in the x-y plane // of the momentum vector at the point of // closest approach to (0,0,0) // // Note: A faster implementation would // calculate in the constructor, save, and // return the member here. This implementation // minimizes the memory footprint. // // Calculate phi as the average phi of all // lines formed by combinations of hits if // this is a straight line if (type_ == straightLine) { std::vector<LineXY> lines; for (std::vector<GlobalPoint>::const_iterator point1 = points_.begin(); point1 != points_.end(); ++point1) { for (std::vector<GlobalPoint>::const_iterator point2 = point1+1; point2 != points_.end(); ++point2) { lines.push_back(LineXY(*point1,*point2)); } } double netPhi = 0.; for (std::vector<LineXY>::const_iterator line = lines.begin(); line != lines.end(); ++line) { netPhi += line->Phi(); } return netPhi/(double)lines.size(); } // END calculation for linear seeds // This calculation is not valid for seeds which do not exit // the tracking detector (lines always exit) else if (2.*Radius()+ImpactParameter()<110) { return 100000.; } // circular seeds else { double phi = 100000.; double centerPhi = center_.barePhi(); // Find the first hit in time, which determines the direction of // the momentum vector (tangent to the circle at the point of // closest approach, clockwise or counter-clockwise). // The first hit in time is always the hit with the smallest // value r as long as the track exits the tracking detector. GlobalPoint firstPoint = points_[0]; for (unsigned int i=1; i<points_.size(); ++i) { if (firstPoint.perp() > points_[i].perp()) { firstPoint = points_[i]; } } // Get the next hit, firstPoint is at the point of // closest approach and cannot be used to // determine the direction of the initial // momentum vector if (firstPoint.barePhi() == centerPhi) { GlobalPoint nextHit = points_[0]; for (unsigned int i=1; i<points_.size(); ++i) { if (nextHit.perp() == firstPoint.perp() || (firstPoint.perp()!= points_[i].perp() && nextHit.perp() > points_[i].perp())) { nextHit = points_[i]; } } firstPoint = nextHit; } // Find the direction of the momentum vector if (firstPoint.barePhi() > centerPhi) { // The momentum vector is tangent to // the track phi = centerPhi + Geom::pi()/2.; if (phi>Geom::pi()) { phi -= 2.*Geom::pi(); } } // Other direction! else if (firstPoint.barePhi() < centerPhi) { // The momentum vector is tangent to // the track phi = centerPhi - Geom::pi()/2.; if (phi<-1.*Geom::pi()) { phi += 2.*Geom::pi(); } } return phi; } // END calculation for circular seeds }
std::vector<GlobalPoint> RoadSearchCircleSeed::Points | ( | ) | const [inline] |
Definition at line 54 of file RoadSearchCircleSeed.h.
References points_.
Referenced by operator<<().
{ return points_; }
std::string RoadSearchCircleSeed::print | ( | void | ) | const |
Definition at line 250 of file RoadSearchCircleSeed.cc.
References center_, impactParameter_, inBarrel_, point, points_, radius_, straightLine, type_, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
{ // // print function // std::ostringstream ost; if ( type_ == RoadSearchCircleSeed::straightLine ) { ost << "Straight Line: number of points: " << points_.size() << "\n"; unsigned int counter = 0; for ( std::vector<GlobalPoint>::const_iterator point = points_.begin(); point != points_.end(); ++point ) { ++counter; ost << " Point " << counter << ": " << point->x() << "," << point->y() << "\n"; } } else { ost << "Circle: number of points: " << points_.size() << "\n"; ost << " Radius : " << radius_ << "\n"; ost << " In the barrel : " << inBarrel_ << "\n"; ost << " ImpactParameter: " << impactParameter_ << "\n"; ost << " Center : " << center_.x() << "," << center_.y() << "\n"; unsigned int counter = 0; for ( std::vector<GlobalPoint>::const_iterator point = points_.begin(); point != points_.end(); ++point ) { ++counter; ost << " Point " << counter << " : " << point->x() << "," << point->y() << "\n"; } } return ost.str(); }
double RoadSearchCircleSeed::Radius | ( | ) | const [inline] |
Definition at line 63 of file RoadSearchCircleSeed.h.
References radius_.
Referenced by RoadSearchSeedFinderAlgorithm::calculateCircleSeedsFromHits(), CompareRadius(), operator<<(), and Phi0().
{ return radius_;}
void RoadSearchCircleSeed::setSeed | ( | const Roads::RoadSeed * | input | ) | [inline] |
Definition at line 69 of file RoadSearchCircleSeed.h.
References collect_tpl::input, and seed_.
Referenced by RoadSearchSeedFinderAlgorithm::calculateCircleSeedsFromHits().
void RoadSearchCircleSeed::setSet | ( | const Roads::RoadSet * | input | ) | [inline] |
Definition at line 72 of file RoadSearchCircleSeed.h.
References collect_tpl::input, and set_.
Referenced by RoadSearchSeedFinderAlgorithm::calculateCircleSeedsFromHits().
double RoadSearchCircleSeed::Theta | ( | ) | const |
Definition at line 126 of file RoadSearchCircleSeed.cc.
References groupFilesInBlocks::lines, and points_.
Referenced by Eta().
{ // // calculate the theta of the seed // by taking the average theta of all // the lines formed by combinations of // hits in the seed // // Note: A faster implementation would // calculate in the constructor, save, and // return the member here. This implementation // minimizes the memory footprint. // // Form all the possible lines std::vector<LineRZ> lines; for (std::vector<GlobalPoint>::const_iterator point1 = points_.begin(); point1 != points_.end(); ++point1) { for (std::vector<GlobalPoint>::const_iterator point2 = point1+1; point2 != points_.end(); ++point2) { lines.push_back(LineRZ(*point1, *point2)); } } double netTheta = 0.; for (std::vector<LineRZ>::const_iterator line = lines.begin(); line != lines.end(); ++line){ netTheta += line->Theta(); } return netTheta/(double)lines.size(); }
double RoadSearchCircleSeed::Type | ( | ) | const [inline] |
Definition at line 66 of file RoadSearchCircleSeed.h.
References type_.
Referenced by RoadSearchSeedFinderAlgorithm::calculateCircleSeedsFromHits(), and operator<<().
{ return type_; }
GlobalPoint RoadSearchCircleSeed::center_ [private] |
Definition at line 107 of file RoadSearchCircleSeed.h.
Referenced by Center(), CompareCenter(), Phi0(), print(), and RoadSearchCircleSeed().
std::vector<const TrackingRecHit*> RoadSearchCircleSeed::hits_ [private] |
Definition at line 103 of file RoadSearchCircleSeed.h.
Referenced by begin_hits(), calculateInBarrel(), CompareDifferentHits(), end_hits(), Hits(), and RoadSearchCircleSeed().
double RoadSearchCircleSeed::impactParameter_ [private] |
Definition at line 109 of file RoadSearchCircleSeed.h.
Referenced by ImpactParameter(), print(), and RoadSearchCircleSeed().
bool RoadSearchCircleSeed::inBarrel_ [private] |
Definition at line 106 of file RoadSearchCircleSeed.h.
Referenced by InBarrel(), print(), and RoadSearchCircleSeed().
std::vector<GlobalPoint> RoadSearchCircleSeed::points_ [private] |
Definition at line 101 of file RoadSearchCircleSeed.h.
Referenced by begin_points(), end_points(), Phi0(), Points(), print(), RoadSearchCircleSeed(), and Theta().
double RoadSearchCircleSeed::radius_ [private] |
Definition at line 108 of file RoadSearchCircleSeed.h.
Referenced by CompareRadius(), print(), Radius(), and RoadSearchCircleSeed().
const Roads::RoadSeed* RoadSearchCircleSeed::seed_ [private] |
Definition at line 111 of file RoadSearchCircleSeed.h.
const Roads::RoadSet* RoadSearchCircleSeed::set_ [private] |
Definition at line 112 of file RoadSearchCircleSeed.h.
type RoadSearchCircleSeed::type_ [private] |
Definition at line 105 of file RoadSearchCircleSeed.h.
Referenced by Phi0(), print(), RoadSearchCircleSeed(), and Type().