ShowerParticleIterator.cc
Go to the documentation of this file.
1 
9 #include <utl/ShowerParticleIterator.h>
10 #include <utl/AugerException.h>
11 #include <utl/VShowerFileParticleIterator.h>
12 
13 #include <cstddef>
14 
15 
16 namespace utl {
17 
19  const CoordinateSystemPtr& cs) :
20  fParticles(fileIt),
21  fGroundCS(cs)
22  {
23  if (fParticles) {
24  fParticles->Rewind();
26  if (!fCurrentParticle)
27  fParticles = nullptr;
28  }
29  }
30 
31 
32  void
34  const
35  {
36  if (!fCurrentParticle)
37  throw InvalidIteratorException("Dereferencing invalid ShowerParticleIterator");
38  }
39 
40 
41  const Particle&
43  const
44  {
46  return *fCurrentParticle;
47  }
48 
49 
50  const Particle*
52  const
53  {
55  return fCurrentParticle;
56  }
57 
58 
61  {
62  if (!fParticles)
63  throw InvalidIteratorException("Incrementing invalid ShowerParticleIterator");
64 
66  if (!fCurrentParticle)
67  fParticles = nullptr;
68  return *this;
69  }
70 
71 
74  {
75  ShowerParticleIterator old(*this);
76  ++(*this);
77  return old;
78  }
79 
80 
81  bool
83  const
84  {
85  return fParticles == it.fParticles &&
87  }
88 
89 }
Iterator to retrieve particles from utl::VShowerParticlList.
const Particle * operator->() const
virtual void Rewind()=0
Rewind the particle list in the shower file to the beginning.
Describes a particle for Simulation.
Definition: Particle.h:26
ShowerParticleIterator & operator++()
Prefix increment.
bool operator==(const ShowerParticleIterator &it) const
VShowerFileParticleIterator * fParticles
Interface class for accessing a list of particles from a shower file.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
CoordinateSystemPtr fGroundCS
The reference frame for particle reading.
ShowerParticleIterator(VShowerFileParticleIterator *const fileIt=nullptr, const CoordinateSystemPtr &cs=CoordinateSystemPtr())
const Particle & operator*() const
Exception for invalid operation on Iterators.
virtual Particle * GetOneParticle(const CoordinateSystemPtr &cs)=0
Member function to fetch the next particle.

, generated on Tue Sep 26 2023.