move downsample to detector

make tool function members of detector class, easy for integration