Top quark mass measurement using the template method at CDF