/usr/include/HepMC/GenRanges.h is in libhepmc-dev 2.06.09-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | #ifndef HEPMC_GEN_EVENT_ITERATORS_H
#define HEPMC_GEN_EVENT_ITERATORS_H
//--------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////
// garren@fnal.gov, May 2009
//
//////////////////////////////////////////////////////////////////////////
//--------------------------------------------------------------------------
#include <stdexcept>
#include "HepMC/GenEvent.h"
#include "HepMC/GenVertex.h"
namespace HepMC {
//! GenEventVertexRange acts like a collection of vertices
///
/// \class GenEventVertexRange
/// HepMC::GenEventVertexRange is used to mimic a collection of
/// vertices for ease of use - especially with utilities such as
/// the Boost foreach funtion
///
class GenEventVertexRange {
public:
/// the constructor requires a GenEvent
GenEventVertexRange( GenEvent & e ) : m_event(e) {}
///
GenEvent::vertex_iterator begin() { return m_event.vertices_begin(); }
GenEvent::vertex_iterator end() { return m_event.vertices_end(); }
private:
/// Because the class contains a reference, assignments are not allowed.
/// However, we need the copy constructor for GenEvent::vertex_range().
GenEventVertexRange& operator=( GenEventVertexRange & );
private:
GenEvent & m_event;
};
//! ConstGenEventVertexRange acts like a collection of vertices
///
/// \class ConstGenEventVertexRange
/// HepMC::ConstGenEventVertexRange is used to mimic a collection of
/// vertices for ease of use - especially with utilities such as
/// the Boost foreach funtion
/// This is the const partner of GenEventVertexRange
///
class ConstGenEventVertexRange {
public:
/// the constructor requires a const GenEvent
ConstGenEventVertexRange( GenEvent const & e ) : m_event(e) {}
///
GenEvent::vertex_const_iterator begin() const { return m_event.vertices_begin(); }
GenEvent::vertex_const_iterator end() const { return m_event.vertices_end(); }
private:
/// Because the class contains a reference, assignments are not allowed.
/// However, we need the copy constructor for GenEvent::vertex_range().
ConstGenEventVertexRange& operator=( ConstGenEventVertexRange & );
private:
GenEvent const & m_event;
};
//! GenEventParticleRange acts like a collection of particles
///
/// \class GenEventParticleRange
/// HepMC::GenEventParticleRange is used to mimic a collection of
/// particles for ease of use - especially with utilities such as
/// the Boost foreach funtion
///
class GenEventParticleRange {
public:
/// the constructor requires a GenEvent
GenEventParticleRange( GenEvent & e ) : m_event(e) {}
///
GenEvent::particle_iterator begin() { return m_event.particles_begin(); }
GenEvent::particle_iterator end() { return m_event.particles_end(); }
private:
/// Because the class contains a reference, assignments are not allowed.
/// However, we need the copy constructor for GenEvent::particle_range().
GenEventParticleRange& operator=( GenEventParticleRange & );
private:
GenEvent & m_event;
};
//! ConstGenEventParticleRange acts like a collection of particles
///
/// \class ConstGenEventParticleRange
/// HepMC::ConstGenEventParticleRange is used to mimic a collection of
/// particles for ease of use - especially with utilities such as
/// the Boost foreach funtion
/// This is the const partner of GenEventParticleRange
///
class ConstGenEventParticleRange {
public:
/// the constructor requires a const GenEvent
ConstGenEventParticleRange( GenEvent const & e ) : m_event(e) {}
///
GenEvent::particle_const_iterator begin() const { return m_event.particles_begin(); }
GenEvent::particle_const_iterator end() const { return m_event.particles_end(); }
private:
/// Because the class contains a reference, assignments are not allowed.
/// However, we need the copy constructor for GenEvent::particle_range().
ConstGenEventParticleRange& operator=( ConstGenEventParticleRange & );
private:
GenEvent const & m_event;
};
//! GenVertexParticleRange acts like a collection of particles
///
/// \class GenVertexParticleRange
/// HepMC::GenVertexParticleRange is used to mimic a collection of
/// particles for ease of use - especially with utilities such as
/// the Boost foreach funtion
///
class GenVertexParticleRange {
public:
/// the constructor requires a GenVertex
GenVertexParticleRange( GenVertex & v, IteratorRange range = relatives )
: m_vertex(v),m_range(range) {}
///
GenVertex::particle_iterator begin() { return m_vertex.particles_begin(m_range); }
GenVertex::particle_iterator end() { return m_vertex.particles_end(m_range); }
private:
/// Because the class contains a reference, assignments are not allowed.
/// However, we need the copy constructor for GenVertex::particles().
GenVertexParticleRange& operator=( GenVertexParticleRange & );
private:
GenVertex & m_vertex;
IteratorRange m_range;
};
//! GenParticleProductionRange acts like a collection of particles
///
/// \class GenParticleProductionRange
/// HepMC::GenParticleProductionRange is used to mimic a collection of
/// particles associated with the particle's production vertex for ease of use
/// Utilities such as the Boost foreach funtion will want to use this class.
///
class GenParticleProductionRange {
public:
/// the constructor requires a GenParticle
GenParticleProductionRange( GenParticle const & p, IteratorRange range = relatives )
: m_particle(p),m_range(range) {}
/// begin iterator throws an error if the particle production_vertex is undefined
GenVertex::particle_iterator begin();
/// end iterator throws an error if the particle production_vertex is undefined
GenVertex::particle_iterator end();
private:
/// Because the class contains a reference, assignments are not allowed.
/// However, we need the copy constructor for GenVertex::particles_in().
GenParticleProductionRange& operator=( GenParticleProductionRange & );
private:
GenParticle const & m_particle;
IteratorRange m_range;
};
class ConstGenParticleProductionRange {
public:
/// the constructor requires a GenParticle
ConstGenParticleProductionRange( GenParticle const & p, IteratorRange range = relatives )
: m_particle(p),m_range(range) {}
/// begin iterator throws an error if the particle production_vertex is undefined
GenVertex::particle_iterator begin();
/// end iterator throws an error if the particle production_vertex is undefined
GenVertex::particle_iterator end();
private:
/// Because the class contains a reference, assignments are not allowed.
/// However, we need the copy constructor for GenVertex::particles_in().
ConstGenParticleProductionRange& operator=( ConstGenParticleProductionRange & );
private:
GenParticle const & m_particle;
IteratorRange m_range;
};
//! GenParticleEndRange acts like a collection of particles
///
/// \class GenParticleEndRange
/// HepMC::GenParticleEndRange is used to mimic a collection of
/// particles associated with the particle's end vertex for ease of use
/// Utilities such as the Boost foreach funtion will want to use this class.
///
class GenParticleEndRange {
public:
/// the constructor requires a GenParticle
GenParticleEndRange( GenParticle const & p, IteratorRange range = relatives )
: m_particle(p),m_range(range) {}
/// begin iterator throws an error if the particle end_vertex is undefined
GenVertex::particle_iterator begin();
/// end iterator throws an error if the particle end_vertex is undefined
GenVertex::particle_iterator end();
private:
/// Because the class contains a reference, assignments are not allowed.
/// However, we need the copy constructor for GenVertex::particles_out().
GenParticleEndRange& operator=( GenParticleEndRange & );
private:
GenParticle const & m_particle;
IteratorRange m_range;
};
class ConstGenParticleEndRange {
public:
/// the constructor requires a GenParticle
ConstGenParticleEndRange( GenParticle const & p, IteratorRange range = relatives )
: m_particle(p),m_range(range) {}
/// begin iterator throws an error if the particle end_vertex is undefined
GenVertex::particle_iterator begin();
/// end iterator throws an error if the particle end_vertex is undefined
GenVertex::particle_iterator end();
private:
/// Because the class contains a reference, assignments are not allowed.
/// However, we need the copy constructor for GenVertex::particles_out().
ConstGenParticleEndRange& operator=( ConstGenParticleEndRange & );
private:
GenParticle const & m_particle;
IteratorRange m_range;
};
inline GenVertex::particle_iterator GenParticleProductionRange::begin()
{
if ( ! m_particle.production_vertex() )
throw(std::range_error("GenParticleProductionRange: GenParticle has no production_vertex"));
return m_particle.production_vertex()->particles_begin(m_range);
}
inline GenVertex::particle_iterator GenParticleProductionRange::end()
{
if ( ! m_particle.production_vertex() )
throw(std::range_error("GenParticleProductionRange: GenParticle has no production_vertex"));
return m_particle.production_vertex()->particles_end(m_range);
}
inline GenVertex::particle_iterator ConstGenParticleProductionRange::begin()
{
if ( ! m_particle.production_vertex() )
throw(std::range_error("ConstGenParticleProductionRange: GenParticle has no production_vertex"));
return m_particle.production_vertex()->particles_begin(m_range);
}
inline GenVertex::particle_iterator ConstGenParticleProductionRange::end()
{
if ( ! m_particle.production_vertex() )
throw(std::range_error("ConstGenParticleProductionRange: GenParticle has no production_vertex"));
return m_particle.production_vertex()->particles_end(m_range);
}
inline GenVertex::particle_iterator GenParticleEndRange::begin()
{
if ( ! m_particle.end_vertex() )
throw(std::range_error("GenParticleEndRange: GenParticle has no end_vertex"));
return m_particle.end_vertex()->particles_begin(m_range);
}
inline GenVertex::particle_iterator GenParticleEndRange::end()
{
if ( ! m_particle.end_vertex() )
throw(std::range_error("GenParticleEndRange: GenParticle has no end_vertex"));
return m_particle.end_vertex()->particles_end(m_range);
}
inline GenVertex::particle_iterator ConstGenParticleEndRange::begin()
{
if ( ! m_particle.end_vertex() )
throw(std::range_error("ConstGenParticleEndRange: GenParticle has no end_vertex"));
return m_particle.end_vertex()->particles_begin(m_range);
}
inline GenVertex::particle_iterator ConstGenParticleEndRange::end()
{
if ( ! m_particle.end_vertex() )
throw(std::range_error("ConstGenParticleEndRange: GenParticle has no end_vertex"));
return m_particle.end_vertex()->particles_end(m_range);
}
} // HepMC
#endif // HEPMC_GEN_EVENT_ITERATORS_H
|