StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
GenRanges.h
1 #ifndef HEPMC_GEN_EVENT_ITERATORS_H
2 #define HEPMC_GEN_EVENT_ITERATORS_H
3 
4 //--------------------------------------------------------------------------
6 // garren@fnal.gov, May 2009
7 //
9 //--------------------------------------------------------------------------
10 
11 #include <stdexcept>
12 
13 #include "HepMC/GenEvent.h"
14 #include "HepMC/GenVertex.h"
15 
16 namespace HepMC {
17 
19 
27 
28 public:
29 
31  GenEventVertexRange( GenEvent & e ) : m_event(e) {}
33  GenEvent::vertex_iterator begin() { return m_event.vertices_begin(); }
34  GenEvent::vertex_iterator end() { return m_event.vertices_end(); }
35 
36 private:
40 
41 private:
42  GenEvent & m_event;
43 
44 };
45 
47 
56 
57 public:
58 
60  ConstGenEventVertexRange( GenEvent const & e ) : m_event(e) {}
62  GenEvent::vertex_const_iterator begin() const { return m_event.vertices_begin(); }
63  GenEvent::vertex_const_iterator end() const { return m_event.vertices_end(); }
64 
65 private:
69 
70 private:
71  GenEvent const & m_event;
72 
73 };
74 
76 
84 
85 public:
86 
88  GenEventParticleRange( GenEvent & e ) : m_event(e) {}
90  GenEvent::particle_iterator begin() { return m_event.particles_begin(); }
91  GenEvent::particle_iterator end() { return m_event.particles_end(); }
92 
93 private:
97 
98 private:
99  GenEvent & m_event;
100 
101 };
102 
104 
113 
114 public:
115 
117  ConstGenEventParticleRange( GenEvent const & e ) : m_event(e) {}
119  GenEvent::particle_const_iterator begin() const { return m_event.particles_begin(); }
120  GenEvent::particle_const_iterator end() const { return m_event.particles_end(); }
121 
122 private:
126 
127 private:
128  GenEvent const & m_event;
129 
130 };
131 
133 
141 
142 public:
143 
145  GenVertexParticleRange( GenVertex & v, IteratorRange range = relatives )
146  : m_vertex(v),m_range(range) {}
148  GenVertex::particle_iterator begin() { return m_vertex.particles_begin(m_range); }
149  GenVertex::particle_iterator end() { return m_vertex.particles_end(m_range); }
150 
151 private:
155 
156 private:
157  GenVertex & m_vertex;
158  IteratorRange m_range;
159 
160 };
161 
163 
171 
172 public:
173 
175  GenParticleProductionRange( GenParticle const & p, IteratorRange range = relatives )
176  : m_particle(p),m_range(range) {}
181 
182 private:
186 
187 private:
188  GenParticle const & m_particle;
189  IteratorRange m_range;
190 
191 };
192 
194 
195 public:
196 
199  : m_particle(p),m_range(range) {}
204 
205 private:
209 
210 private:
211  GenParticle const & m_particle;
212  IteratorRange m_range;
213 
214 };
215 
217 
225 
226 public:
227 
229  GenParticleEndRange( GenParticle const & p, IteratorRange range = relatives )
230  : m_particle(p),m_range(range) {}
235 
236 private:
240 
241 private:
242  GenParticle const & m_particle;
243  IteratorRange m_range;
244 
245 };
246 
248 
249 public:
250 
252  ConstGenParticleEndRange( GenParticle const & p, IteratorRange range = relatives )
253  : m_particle(p),m_range(range) {}
258 
259 private:
263 
264 private:
265  GenParticle const & m_particle;
266  IteratorRange m_range;
267 
268 };
269 
270 
272 {
273  if ( ! m_particle.production_vertex() )
274  throw(std::range_error("GenParticleProductionRange: GenParticle has no production_vertex"));
275  return m_particle.production_vertex()->particles_begin(m_range);
276 }
277 
279 {
280  if ( ! m_particle.production_vertex() )
281  throw(std::range_error("GenParticleProductionRange: GenParticle has no production_vertex"));
282  return m_particle.production_vertex()->particles_end(m_range);
283 }
284 
285 
287 {
288  if ( ! m_particle.production_vertex() )
289  throw(std::range_error("ConstGenParticleProductionRange: GenParticle has no production_vertex"));
290  return m_particle.production_vertex()->particles_begin(m_range);
291 }
292 
294 {
295  if ( ! m_particle.production_vertex() )
296  throw(std::range_error("ConstGenParticleProductionRange: GenParticle has no production_vertex"));
297  return m_particle.production_vertex()->particles_end(m_range);
298 }
299 
301 {
302  if ( ! m_particle.end_vertex() )
303  throw(std::range_error("GenParticleEndRange: GenParticle has no end_vertex"));
304  return m_particle.end_vertex()->particles_begin(m_range);
305 }
307 {
308  if ( ! m_particle.end_vertex() )
309  throw(std::range_error("GenParticleEndRange: GenParticle has no end_vertex"));
310  return m_particle.end_vertex()->particles_end(m_range);
311 }
312 
314 {
315  if ( ! m_particle.end_vertex() )
316  throw(std::range_error("ConstGenParticleEndRange: GenParticle has no end_vertex"));
317  return m_particle.end_vertex()->particles_begin(m_range);
318 }
320 {
321  if ( ! m_particle.end_vertex() )
322  throw(std::range_error("ConstGenParticleEndRange: GenParticle has no end_vertex"));
323  return m_particle.end_vertex()->particles_end(m_range);
324 }
325 
326 } // HepMC
327 
328 #endif // HEPMC_GEN_EVENT_ITERATORS_H
ConstGenEventParticleRange(GenEvent const &e)
the constructor requires a const GenEvent
Definition: GenRanges.h:117
ConstGenParticleEndRange(GenParticle const &p, IteratorRange range=relatives)
the constructor requires a GenParticle
Definition: GenRanges.h:252
GenVertex::particle_iterator begin()
begin iterator throws an error if the particle end_vertex is undefined
Definition: GenRanges.h:300
particle_iterator particles_begin(IteratorRange range=relatives)
begin particle range
Definition: GenVertex.h:525
GenVertex::particle_iterator end()
end iterator throws an error if the particle end_vertex is undefined
Definition: GenRanges.h:306
GenVertex::particle_iterator end()
end iterator throws an error if the particle end_vertex is undefined
Definition: GenRanges.h:319
GenVertexParticleRange(GenVertex &v, IteratorRange range=relatives)
the constructor requires a GenVertex
Definition: GenRanges.h:145
ConstGenParticleProductionRange(GenParticle const &p, IteratorRange range=relatives)
the constructor requires a GenParticle
Definition: GenRanges.h:198
const particle iterator
Definition: GenEvent.h:464
ConstGenEventParticleRange acts like a collection of particles.
Definition: GenRanges.h:112
particle_const_iterator particles_begin() const
begin particle iteration
Definition: GenEvent.h:507
GenParticleEndRange(GenParticle const &p, IteratorRange range=relatives)
the constructor requires a GenParticle
Definition: GenRanges.h:229
GenVertexParticleRange acts like a collection of particles.
Definition: GenRanges.h:140
non-const particle iterator
Definition: GenEvent.h:520
GenVertex * production_vertex() const
pointer to the production vertex
Definition: GenParticle.h:218
GenVertex contains information about decay vertices.
Definition: GenVertex.h:52
GenEventParticleRange acts like a collection of particles.
Definition: GenRanges.h:83
The GenEvent class is the core of HepMC.
Definition: GenEvent.h:155
GenParticleEndRange acts like a collection of particles.
Definition: GenRanges.h:224
particle_iterator particles_end(IteratorRange)
end particle range
Definition: GenVertex.h:530
GenParticleProductionRange(GenParticle const &p, IteratorRange range=relatives)
the constructor requires a GenParticle
Definition: GenRanges.h:175
vertex_const_iterator vertices_end() const
end vertex iteration
Definition: GenEvent.h:381
GenEventParticleRange(GenEvent &e)
the constructor requires a GenEvent
Definition: GenRanges.h:88
GenVertex::particle_iterator end()
end iterator throws an error if the particle production_vertex is undefined
Definition: GenRanges.h:293
particle_const_iterator particles_end() const
end particle iteration
Definition: GenEvent.h:511
GenVertex::particle_iterator begin()
begin iterator throws an error if the particle production_vertex is undefined
Definition: GenRanges.h:286
GenVertex::particle_iterator begin()
begin iterator throws an error if the particle production_vertex is undefined
Definition: GenRanges.h:271
ConstGenEventVertexRange acts like a collection of vertices.
Definition: GenRanges.h:55
GenParticleProductionRange acts like a collection of particles.
Definition: GenRanges.h:170
GenVertex::particle_iterator end()
end iterator throws an error if the particle production_vertex is undefined
Definition: GenRanges.h:278
vertex_const_iterator vertices_begin() const
begin vertex iteration
Definition: GenEvent.h:377
GenEventVertexRange acts like a collection of vertices.
Definition: GenRanges.h:26
GenEventVertexRange(GenEvent &e)
the constructor requires a GenEvent
Definition: GenRanges.h:31
GenVertex * end_vertex() const
pointer to the decay vertex
Definition: GenParticle.h:221
IteratorRange
type of iteration
Definition: IteratorRange.h:17
non-const vertex iterator
Definition: GenEvent.h:391
ConstGenEventVertexRange(GenEvent const &e)
the constructor requires a const GenEvent
Definition: GenRanges.h:60
GenVertex::particle_iterator begin()
begin iterator throws an error if the particle end_vertex is undefined
Definition: GenRanges.h:313
The GenParticle class contains information about generated particles.
Definition: GenParticle.h:60