filtering and merging quickly a large number of ntuples