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