finish event detection and num of event couting