LeptonInjector C++ API Reference

struct BasicEventProperties : public I3FrameObject
#include <LeptonInjector.h>

Parameters common to events injected in all modes.

Subclassed by LeptonInjector::RangedEventProperties, LeptonInjector::VolumeEventProperties

Public Functions

inline BasicEventProperties()
~BasicEventProperties()
double radius() const
double impactParameter() const
template<typename Archive>
void serialize(Archive&, unsigned)

Public Members

double totalEnergy

Total energy in the final state (lab frame)

double zenith

Sampled zenith angle (of final state particle 1)

double azimuth

Sampled azimuth angle (of final state particle 1)

double finalStateX

Bjorken x for the interaction.

double finalStateY

Bjorken y for the interaction p1.energy = (1-finalStateY)*totalEnergy p2.energy = finalStateY*totalEnergy.

I3Particle::ParticleType finalType1

Type of first particle which was injected in the final state.

I3Particle::ParticleType finalType2

Type of second particle which was injected in the final state.

I3Particle::ParticleType initialType

Type of the neutrino which interacted to produce this event.

double x

X coordinate of the interaction vertex.

double y

Y coordinate of the interaction vertex.

double z

Z coordinate of the interaction vertex.

double totalColumnDepth

The total column depth along the particle path within which the interaction is sampled.

Public Static Attributes

static constexpr uint8_t classVersion = 1

Friends

friend class icecube::serialization::access
struct BasicInjectionConfiguration : public I3FrameObject
#include <LeptonInjector.h>

Configuration parameters needed for all injection modes.

Subclassed by LeptonInjector::RangedInjectionConfiguration, LeptonInjector::VolumeInjectionConfiguration

Public Functions

BasicInjectionConfiguration()
~BasicInjectionConfiguration()
template<typename Archive>
void serialize(Archive&, unsigned)
void setCrossSection(const photospline::splinetable<> &crossSection, const photospline::splinetable<> &totalCrossSection)

Public Members

uint32_t events

Number of events the generator should/did generate.

double energyMinimum

Minimum total event energy to inject.

double energyMaximum

Maximum total event energy to inject.

double powerlawIndex

Powerlaw index of the energy spectrum to inject.

double azimuthMinimum

Minimum azimuth angle at which to inject events.

double azimuthMaximum

Maximum azimuth angle at which to inject events.

double zenithMinimum

Minimum zenith angle at which to inject events.

double zenithMaximum

Maximum zenith angle at which to inject events.

I3Particle::ParticleType finalType1

Type of first particle to be injected in the final state.

I3Particle::ParticleType finalType2

Type of second particle to be injected in the final state.

std::vector<char> crossSectionBlob
std::vector<char> totalCrossSectionBlob

Public Static Attributes

static constexpr uint8_t classVersion = 0

Friends

friend class icecube::serialization::access
template<typename T>
struct endian_adapter

Public Functions

inline endian_adapter(const T &t)

Public Members

const T &t
class EventPropertiesConverter : public I3ConverterImplementation<BasicEventProperties>

Public Functions

I3TableRowDescriptionPtr CreateDescription(const BasicEventProperties &p)
size_t FillRows(const BasicEventProperties &p, I3TableRowPtr rows)
class InjectionConfigSerializer : public I3Module

Public Functions

inline InjectionConfigSerializer(const I3Context &ctx)
inline ~InjectionConfigSerializer()
inline void setOverwrite(bool overwrite_)
inline void Configure()
inline void S(boost::shared_ptr<I3Frame> frame)

Private Members

std::ofstream output
bool wroteParticleTypes
bool overwrite
bool iAmOverwriting = false
class LeptonInjectorBase : public I3ConditionalModule
#include <LeptonInjector.h>

Subclassed by LeptonInjector::RangedLeptonInjector, LeptonInjector::VolumeLeptonInjector

Public Functions

LeptonInjectorBase(const I3Context &context, BasicInjectionConfiguration &config)
virtual ~LeptonInjectorBase()
virtual void DAQ(boost::shared_ptr<I3Frame>) = 0
void Finish()
inline bool DoneGenerating() const

Protected Functions

void AddBaseParameters()

Add common I3Module parameters.

void BaseConfigure()

Get common I3Module parameter values.

I3Position SampleFromDisk(double radius, double zenith = 0., double azimuth = 0.)

Sample a random position on a disk with a given size and orientation. The disk is always centered on the origin of the coordinate system.

Parameters:
  • radius – the radius of the disk

  • zenith – the zenith angle of the disk normal

  • azimuth – the azimuth angle of the disk normal

double SampleEnergy()

Sample one energy value from the energy spectrum.

I3Particle::ParticleType SampleParticleType(I3Particle::ParticleType baseType)

Sample either baseType or its antiparticle depending on config.toggleAntiparticles.

std::pair<double, double> computeFinalStateAngles(double E_total, double x, double y)

Determine the angles of the final state particles with respect to the initial state neutrino direction, in the lab frame.

Parameters:
  • E_total – the energy of the initial neutrino

  • x – Bjorken x for the interaction

  • y – Bjorken y for the interaction

Returns:

the relative zenith angles for the first and second final state particles

boost::shared_ptr<I3MCTree> FillTree(I3Position vertex, I3Direction dir, double energy, BasicEventProperties &properties)

Construct an I3MCTree representing an interaction.

Samples a suitable final state and computes all resulting directions and energies.

Parameters:
  • vertex – the point at which the interaction occurs

  • dir – the direction of the interacting neutrino

  • energy – the energy of the interacting neutrino

  • properties – the associated structure where the event properties should be recorded

inline const photospline::splinetable &getCrossSection() const
inline const photospline::splinetable &getTotalCrossSection() const

Protected Attributes

boost::shared_ptr<I3RandomService> random

Random number source.

BasicInjectionConfiguration &config

Configuration structure in which to store parameters.

unsigned int eventsGenerated

Number of events produced so far.

bool wroteConfigFrame

Whether an S frame has been written.

bool suspendOnCompletion

Whether to suspend the tray after all events have been generated.

I3Particle::ParticleType initialType

The type of interacting neutrino this instance will produce. Note that in the presence of oscillations this may not be the type of the neutrino which arrived at the surface of the Earth.

Private Functions

SET_LOGGER ("LeptonInjectorBase")

Private Members

I3CrossSection crossSection
struct MinimalInjectionConfiguration
#include <LeptonInjector.h>

Parameters for injectors placed within a MultiLeptonInjector.

Public Functions

inline MinimalInjectionConfiguration(unsigned int events, I3Particle::ParticleType finalType1, I3Particle::ParticleType finalType2, const std::string &crossSectionPath, const std::string &totalCrossSectionPath, bool ranged)

Public Members

unsigned int events

Number of events the generator should/did generate.

I3Particle::ParticleType finalType1

Type of first particle to be injected in the final state.

I3Particle::ParticleType finalType2

Type of second particle to be injected in the final state.

std::string crossSectionPath
std::string totalCrossSectionPath
bool ranged
class MultiLeptonInjector : public I3ConditionalModule
#include <LeptonInjector.h>

Public Functions

MultiLeptonInjector(const I3Context &ctx)
MultiLeptonInjector(const I3Context &ctx, RangedInjectionConfiguration rconfig, VolumeInjectionConfiguration vconfig)

For properties appearing in both config objects, the values in rconfig will take precedence.

MultiLeptonInjector(const MultiLeptonInjector&) = delete
MultiLeptonInjector &operator=(const MultiLeptonInjector&) = delete
~MultiLeptonInjector() = default
void Configure()
void DAQ(boost::shared_ptr<I3Frame>)

Private Functions

void AddParameters()

Private Members

I3Context innerContext
boost::shared_ptr<OutputCollector> collector
std::queue<boost::shared_ptr<I3Frame>> &results
std::vector<MinimalInjectionConfiguration> generatorSettings
std::deque<boost::movelib::unique_ptr<LeptonInjectorBase>> generators
RangedInjectionConfiguration rangedConfig
VolumeInjectionConfiguration volumeConfig
class OutputCollector : public I3Module
#include <LeptonInjector.h>

A normal I3Module can only send its output frames to the inbox associated with another I3Module. This Module provides such an inbox, but instead of sending output to another module’s inbox it stores it in a queue of its own, which it makes externally accessible.

Public Functions

inline OutputCollector(const I3Context &ctx)
inline void Process()
inline void DiscardOutput()

Public Members

std::queue<boost::shared_ptr<I3Frame>> output
struct RangedEventProperties : public LeptonInjector::BasicEventProperties
#include <LeptonInjector.h>

Parameters for events produced in ranged injection mode This class no longer does anything useful except provide backwards-compatibility with old data.

Public Functions

inline RangedEventProperties()
~RangedEventProperties()
template<typename Archive>
void serialize(Archive&, unsigned)

Public Static Attributes

static constexpr uint8_t classVersion = 1

Friends

friend class icecube::serialization::access
struct RangedInjectionConfiguration : public LeptonInjector::BasicInjectionConfiguration
#include <LeptonInjector.h>

Configuration parameters for ranged injections mode.

Public Functions

RangedInjectionConfiguration()
~RangedInjectionConfiguration()
template<typename Archive>
void serialize(Archive&, unsigned)

Public Members

double injectionRadius

Radius around the origin within which to target events.

double endcapLength

Length of the fixed endcaps add to the distance along which to sample interactions.

Public Static Attributes

static constexpr uint8_t classVersion = 0

Friends

friend class icecube::serialization::access
class RangedLeptonInjector : public LeptonInjector::LeptonInjectorBase
#include <LeptonInjector.h>

Public Functions

RangedLeptonInjector(const I3Context &context)
RangedLeptonInjector(const I3Context &context, RangedInjectionConfiguration config)
void Configure()
virtual void DAQ(boost::shared_ptr<I3Frame> frame)

Private Functions

void init()
SET_LOGGER ("RangedLeptonInjector")

Private Members

RangedInjectionConfiguration config
boost::shared_ptr<earthmodel::EarthModelService> earthModel

Model to use for calculating lepton range due to matter.

struct VolumeEventProperties : public LeptonInjector::BasicEventProperties
#include <LeptonInjector.h>

Parameters for events produced in volume injection mode This class no longer does anything useful except provide backwards-compatibility with old data.

Public Functions

inline VolumeEventProperties()
~VolumeEventProperties()
template<typename Archive>
void serialize(Archive&, unsigned)

Public Static Attributes

static constexpr uint8_t classVersion = 1

Friends

friend class icecube::serialization::access
struct VolumeInjectionConfiguration : public LeptonInjector::BasicInjectionConfiguration
#include <LeptonInjector.h>

Configuration parameters for volume injection mode.

Public Functions

VolumeInjectionConfiguration()
~VolumeInjectionConfiguration()
template<typename Archive>
void serialize(Archive&, unsigned)

Public Members

double cylinderRadius

Radius of the origin-centered vertical cylinder within which to inject events.

double cylinderHeight

Height of the origin-centered vertical cylinder within which to inject events.

Public Static Attributes

static constexpr uint8_t classVersion = 0

Friends

friend class icecube::serialization::access
class VolumeLeptonInjector : public LeptonInjector::LeptonInjectorBase
#include <LeptonInjector.h>

Public Functions

VolumeLeptonInjector(const I3Context &context)
VolumeLeptonInjector(const I3Context &context, VolumeInjectionConfiguration config)
void Configure()
virtual void DAQ(boost::shared_ptr<I3Frame> frame)

Private Functions

void init()
SET_LOGGER ("VolumeLeptonInjector")

Private Members

VolumeInjectionConfiguration config
boost::shared_ptr<earthmodel::EarthModelService> earthModel

Model to use for calculating lepton range due to matter.

namespace LeptonInjector

Functions

bool isLepton(I3Particle::ParticleType p)

Determine whether a given particle type is a lepton.

Note

Only knows about the types used by LeptonInjector.

bool isCharged(I3Particle::ParticleType p)

Determine whether a given particle type is charged.

Note

Only knows about the types used by LeptonInjector.

std::string particleName(I3Particle::ParticleType p)

Extract the name for a given particle type.

double particleMass(I3Particle::ParticleType type)
std::vector<char> dumpSpline(const photospline::splinetable<> &spline)
double kineticEnergy(I3Particle::ParticleType type, double totalEnergy)

Compute the portion of a particle’s energy which is kinetic.

Note

Treats particles of unknown mass as massless, making their kinetic energy equal to their total energy

double particleSpeed(I3Particle::ParticleType type, double kineticEnergy)

Figure out a particle’s speed given its kinetic energy.

Note

Treats particles of unknown mass as massless, assigning them speed c.

I3Particle::ParticleShape decideShape(I3Particle::ParticleType t)

Guess the shape which should be associated with a given particle type. Particles with long ranges (at least multiple meters) in ice are considered tracks, while those with shorter ranges are labeled cascades.

Note

Only knows about the types used by LeptonInjector.

I3Particle::ParticleType deduceInitialType(I3Particle::ParticleType pType1, I3Particle::ParticleType pType2)

Determine the type of neutrino which would produce the specified final state. Verify that the user has provided a valid pair of particle types for the final state, call log_fatal() if the settings are not valid.

Returns:

The interacting neutrino type required by the specified final state.

I3Direction rotateRelative(I3Direction base, double zenith, double azimuth)

Construct a new direction with the given relative angles with respect to an existing direction.

Parameters:
  • base – the existing base direction

  • zenith – the angle of the new direction with respect to the base

  • azimuth – the rotation of the new direction about the base

I3_MODULE(RangedLeptonInjector)
I3_MODULE(VolumeLeptonInjector)
bool operator==(const MinimalInjectionConfiguration &c1, const MinimalInjectionConfiguration &c2)
std::tuple<I3Position, I3Position> computeCylinderIntersections(const I3Position &pos, const I3Direction &dir, double radius, double z_min, double z_max)
I3_MODULE(MultiLeptonInjector)
template<typename T>
endian_adapter<T> little_endian(const T &t)
std::ostream &endianWrite(std::ostream &os, const char *data, size_t dataSize)
template<typename T>
std::ostream &operator<<(std::ostream &os, const endian_adapter<T> &e)
std::ostream &operator<<(std::ostream &os, const endian_adapter<std::string> &e)
std::ostream &operator<<(std::ostream &os, const endian_adapter<std::vector<char>> &e)
void writeBlockHeader(std::ostream &os, uint64_t blockDataSize, const std::string &blockTypeName, uint8_t version)
template<typename Enum>
void writeEnumDefBlock(std::ostream &os, const std::string &enumName, const std::vector<std::pair<std::string, Enum>> &enumerators)
void writeConfiguration(std::ostream &os, const RangedInjectionConfiguration &config)
void writeConfiguration(std::ostream &os, const VolumeInjectionConfiguration &config)
bool does_file_exist(const char *filename)
I3_MODULE(InjectionConfigSerializer)
void ProcessFrame(I3Module &mod, boost::shared_ptr<I3Frame> frame)
namespace std

STL namespace.

file LeptonInjectionConfigurationConverter.cxx
file LeptonInjectionConfigurationConverter.h
#include <tableio/I3Converter.h>
file LeptonInjector.cxx
#include <cassert>
#include <fstream>
#include <tuple>
#include <utility>
#include <boost/math/constants/constants.hpp>
#include <boost/make_shared.hpp>
#include <icetray/open.h>
#include <icetray/I3Units.h>
#include <dataclasses/physics/I3MCTree.h>
file LeptonInjector.h
#include <queue>
#include <tuple>
#include <icetray/I3ConditionalModule.h>
#include <dataclasses/physics/I3Particle.h>
#include <phys-services/I3RandomService.h>
#include <earthmodel-service/EarthModelService.h>
#include <dataclasses/physics/I3MCTree.h>
#include <phys-services/I3CrossSection.h>
#include <boost/move/unique_ptr.hpp>
#include <boost/move/make_unique.hpp>
file serialization.cxx
#include <fstream>
#include <tableio/I3TableRowDescription.h>
dir converter
dir icetray
dir LeptonInjector
dir LeptonInjector
dir LeptonInjector
dir private
dir public