TCutG evaluation at point

Hey there,

Is there a way to use a TCutG object to perform cut on a single parameter-set (x and y coordinates).

Right now I’m using this function:

bool isPointInPolygon(const float& pointX, const float& pointY, const std::pair<std::vector<float>, std::vector<float>>& poligonVertices)
{
   bool answer = false;
   int numVertices = poligonVertices.first.size();
   for(int i = 0, j = numVertices - 1; i < numVertices; j = i++)
   {
      if(((poligonVertices.second[i] > pointY) != (poligonVertices.second[j] > pointY)) && (pointX < (poligonVertices.first[j] - poligonVertices.first[i]) * (pointY - poligonVertices.second[i]) / (poligonVertices.second[j] - poligonVertices.second[i]) + poligonVertices.first[i]))
      {
        answer = !answer;
      }
   }
   return answer;
}

Is this implemented in ROOT? Can TCutG objects be evaluated at a single point?

Cheers,
Adam

https://root.cern/doc/master/classTGraph.html#aea5ba663016816774704d6cd1aa1759a

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.