Cylindrical restraint with a certain length along the z-axis

GROMACS version: 2019.6
GROMACS modification: No

Same as the topic title, I’d like to apply cylindrical position restraint to all water molecules with a certain length along the z-axis.

For example, all water molecules from z = -1 nm to z = +1 nm (or -1 < z < +1) along the z-axis are restrained in a cylinder with a certain radius R (in x-y direction), and the water with z < -1 nm or z > +1 nm are free to move in the whole simulation box.

How can I achieve this goal?
Anyone can show me an example?

Thank you in advance.

See my response to your other question