To get the correct measurement for your cylinder, you need the length from either end to the centre of the cylinder, signified by the screw hole. You should be able to measure the cylinder while it is in the door, though to get more accurate measurements taking it out of the door would be better.

Please see the diagram for a visual aid. The overall length of the cylinder should equal the two measurements together.