RATS: the photometric data reduction automatic pipeline