Do not copy data in memory when counting particles

counting the number of particles of a ParticleAnalyzer created a full
list of particles and was then just returning its length. Assembling the
this list of particles always copied them in memory. The number of
particles is now counted without this additional data copying.