hist: define a function for intersection comparison method