//----------------------------------------------------------- // // Description: // Representation of a Hyperplane in 2-dimensional // Hough-Space. // -- implementation // // // Environment: // Software developed for the PANDA Detector at FAIR. // // Author List: // Felix Boehmer TU Munich (original author) // // //----------------------------------------------------------- #include "Hypersurface2D.h" #include "TMath.h" #include #include #include Hypersurface2D::Hypersurface2D(double par1,double par2, const TF1& rep, int index) : _paramsSet(false) { _index = index; _rep = new TF1(rep); _rep->SetLineWidth(1); _pars = (double*) malloc(2*sizeof(double)); _mins = (double*) malloc(2*sizeof(double)); _maxs = (double*) malloc(2*sizeof(double)); _pars[0] = par1; _pars[1] = par2; //given in actual parameter space, not unit space _rep->SetParameter(0,par1); _rep->SetParameter(1,par2); _mins[0] = 0.f; _mins[1] = 0.f; _maxs[0] = 0.f; _maxs[1] = 0.f; } Hypersurface2D::~Hypersurface2D() { delete _rep; } bool Hypersurface2D::testIntersect(Hough2DNode* node) const { const double* proj1 = node->getProjection0(); const double* proj2 = node->getProjection1(); int signs = 0; if(!_paramsSet) { std::cerr<<"Hypersurface2D::testIntersect():" <<" Parameter space not specified!" <<" Aborting."<Eval(p1_par_min); //std::cout<<"val1: "<Eval(p1_par_max); //std::cout<<"val2: "<0); signs+=((val1-p2_par_max)>0); signs+=((val2-p2_par_min)>0); signs+=((val2-p2_par_max)>0); if(signs == 4 || signs == 0) return false; else { node->setHit(_index); node->vote(); return true; } } void Hypersurface2D::setParamSpace(double* mins, double* maxs) { _mins = mins; _maxs = maxs; _paramsSet=true; }