How to get input only in a defined area?

I am making a pool game, for that, i want that the touch input should only work inside pool area.

Make some raycast/touch input with a collider attached to you pool area that trigger a boolean you can read on your code