corsika-reader C++ API Reference

class CorsikaClient
#include <CorsikaClient.h>

Basic client for RemoteControl CORSIKA.

This client is stateful, and requires calls in the following sequence:

  1. Call StartShower()

  2. Call NextParticle() until it returns an empty vector

  3. Call GetEventHeader()/GetEventTrailer()

Subclassed by CorsikaService

Public Functions

CorsikaClient(const std::string &corsika_executable, uint32_t seed1, uint32_t seed2, uint32_t atmosphere = 11)

param[in] corsika_executable path to CORSIKA binary

virtual ~CorsikaClient()
std::vector<double> StartShower(uint32_t particle_id, double energy, double theta, double phi, I3ShowerBias::BiasParticleType I3ShowerBiasBiasbias_target = I3ShowerBias::Mu, double bias_factor = 1, std::array<double, 4> elcuts = {{0.3, 0.3, 0.003, 0.003}})

Start a new shower simulation. Blocks until an event header and primary are received from CORSIKA.

Parameters:
  • particle_id[in] Particle number in CORSIKA convention

  • energy[in] total energy of primary particle in GeV

  • theta[in] zenith angle in rad as measured from the observation level

  • phi[in] azimuth angle in rad

Returns:

A particle block containing the primary at the top of the atmosphere.

std::vector<double> NextParticle()

Get the next particle at the observation level. Blocks until the next particle or the event end block is received.

May be called after StartShower().

Returns:

A particle block containing the particle at the lowest observation level, or an empty vector if there are no more particles.

const std::vector<float> &GetEventHeader() const

Get the EVTH block from the current shower.

May be called after StartShower()

const std::vector<float> &GetEventEnd() const

Get the EVTE block from the current shower.

May be called after NextParticle() has returned an empty vector

Private Members

std::unique_ptr<CorsikaClientImpl> impl_
bool more_particles_available_
std::vector<float> event_header_
std::vector<float> event_trailer_
std::vector<rng_stream> rng_
uint32_t atmosphere_
class CorsikaClientImpl

Public Functions

inline CorsikaClientImpl()

Public Members

boost::asio::io_service io_
boost::asio::ip::tcp::acceptor acceptor_
boost::asio::ip::tcp::socket socket_
boost::process::child corsika_
class CORSIKAResampler : public I3Module

Public Functions

CORSIKAResampler(const I3Context &context)
void Configure()
void Simulation(I3FramePtr frame)
void DAQ(I3FramePtr frame)

Private Functions

SET_LOGGER ("I3CorsikaReader")
I3MCTreePtr ResampleEvent(const I3MCTree, const I3CorsikaShowerInfo)

Private Members

I3RandomServicePtr rng_
std::string weightdictname_
std::string orig_mctree_name_
std::string mctree_name_
int oversampling_
I3Surfaces::Cylinder surface_
bool volumeCorr_
class CorsikaService : public I3IncrementalEventGeneratorService, private CorsikaClient
#include <I3CORSIKAService.h>

IceTray client for RemoteControl CORSIKA.

This client is stateful; see also CorsikaClient

Public Functions

inline CorsikaService(const std::string &corsika_executable, uint32_t seed1, uint32_t seed2, uint32_t atmosphere)
inline virtual ~CorsikaService()
void StartShower(I3Particle &primary, const I3Frame &frame)

Start simulation for an air shower.

Parameters:

primary[inout] The primary particle for the air shower. The particle should be initialized with the type, total energy, and direction (in IceCube frame) of the primary, as well as a position and time. On return, contains the primary particle at the top of the atmosphere.

bool NextParticle(I3Particle &particle)

Fetch the next particle at the surface.

Parameters:

particle[out] particle to fill

Returns:

false if the shower is finished, true otherwise

void EndEvent(I3Frame &frame)

Emit weighting info.

Private Functions

void FillParticle(const std::vector<double> &block, I3Particle &particle, bool use_elevation)

Private Members

I3Orientation core_position_
double time_shift_
I3Particle primary_
bool save_weight_

Private Static Attributes

static const double magnetic_north_ = -119 * I3Units::degree
class I3CORSIKAReader : public I3Module

Public Functions

I3CORSIKAReader(const I3Context &context)
void Configure()
void Process()

Private Functions

SET_LOGGER ("I3CorsikaReader")
int FillFrameFromCORSIKA(I3FramePtr frame)
int ReadNextBlock(float corsika_block[313], char type[5])
void ProcessEventHeader(float *corsika_block, I3FramePtr frame, I3MCTreePtr mctree, I3Particle &primary, double core_displace[2])
void ProcessParticleBlock(float *corsika_block, I3FramePtr frame, std::vector<I3Particle> &daughters, I3MCTreePtr mctree, I3ParticleIDMapPtr weights, const I3Particle &primary, double core_displace[2])

Private Members

I3CorsikaInfoPtr info_
I3RandomServicePtr rng_
I3FileStagerPtr file_stager_
I3::dataio::shared_filehandle current_filename_
boost::iostreams::filtering_istream i3_ifs_
boost::iostreams::filtering_istream corsika_ifs_
std::vector<std::string> filenames_
std::vector<std::string> files_
std::vector<std::string>::const_iterator filenames_iter_
std::vector<I3Particle::ParticleType> particles_to_write_
std::string weightdictname_
int nevents_
int legacy_oversampling_
bool runComplete_
bool checkOnly_
unsigned lastEventID_
unsigned eventID_
unsigned run_number_
I3MapStringDouble weightMap_
double obs_level_
bool padded_
bool curved_
bool curved_obs_
int sub_blocks_
bool thinned_
bool ehistory_
double corsika_version_
double arrang_
I3Particle mother_
I3Particle grandmother_
int ancestors_
int mother_hadr_gen_

Private Static Attributes

static constexpr float corsika_v_compat_ehist_arrang_ = 7.741
struct rng_stream
#include <CorsikaClient.h>

Public Members

uint32_t seed
uint64_t ncalls
class welford_gap_timer

Public Functions

inline welford_gap_timer(bool storeit = false)
inline void update()
inline void report()
inline void dump(const std::string &fname)

Public Members

std::vector<int> storage

Private Types

typedef std::chrono::high_resolution_clock clock

Private Members

decltype(clock::now()) t0
size_t count
double mean
double mean2
bool store
namespace [anonymous]
namespace I3CORSIKAReaderUtils

Typedefs

typedef std::map<int, int> CORSIKAtoPDGMap_t

Functions

bool is_charmed(int pdg_id)
bool is_resonance(int pdg_id)
template<typename T1, typename T2>
std::pair<T2, T1> reverse(const std::pair<T1, T2> &p)
static CORSIKAtoPDGMap_t PDGtoCORSIKAMap (boost::make_transform_iterator(CORSIKAtoPDGMap.begin(), reverse< int, int >), boost::make_transform_iterator(CORSIKAtoPDGMap.end(), reverse< int, int >))
int32_t CorsikaToPDG(int corsika_id)
int32_t PDGToCorsika(int pdg_id)
double GetSlantDepth(const I3Direction &dir, const I3Position &pos, double altitude)
double LocalZenith(double reference_zenith, double reference_elevation, double target_elevation)
int32_t PDGToCorsika(int32_t pdg_id)

Variables

static const CORSIKAtoPDGMap_t CORSIKAtoPDGMap
static const std::set<int> Resonances = {313, 323, -323, -313}
static const std::set<int> CharmedParticles
const double EarthRadius = 637131500 * I3Units::cm
namespace std

STL namespace.

file cli.cxx
#include “I3CORSIKAReaderUtils.h
#include <iostream>
#include <cmath>
#include <chrono>
#include <fstream>
#include <dataclasses/physics/I3MCTreeUtils.h>
#include <phys-services/surfaces/Cylinder.h>
#include <phys-services/I3GSLRandomService.h>
#include <neutrino-generator/legacy/I3NuGIncrementalEventGenerator.h>
#include <neutrino-generator/Steering.h>
#include <MuonGun/Cylinder.h>
#include <earthmodel-service/EarthModelService.h>
#include <weighting/fluxes.h>
#include <boost/range/irange.hpp>

Functions

double muon_energy_threshold(double max_range)
void hoboplopia(I3MCTree &tree, I3MuonGun::SamplingSurface &surface, I3RandomService &rng)
void run_single_event(const std::string &corsika_executable, int nshowers = 1, bool neutrinos = true)
void run_powerlaw(const std::string &corsika_executable, int nshowers, double emin, double emax, double gamma, bool skip_subthreshold = false)
void run_single_shower(const std::string &corsika_executable)
int main(int argc, char const *argv[])
file CorsikaClient.cxx
#include <boost/asio.hpp>
#include <boost/process.hpp>
#include <iostream>

Enums

enum message_id

Values:

file CorsikaClient.h
#include <string>
#include <vector>
#include <memory>
#include <cstdint>
#include <array>
#include “simclasses/I3ShowerBias.h”
file CORSIKAResampler.cxx
#include “dataclasses/I3Position.h”
#include <icetray/open.h>
#include <icetray/I3Frame.h>
#include <icetray/I3Module.h>
#include <dataio/I3FileStager.h>
#include <dataclasses/physics/I3MCTreeUtils.h>
#include <dataclasses/physics/I3Particle.h>
#include <dataclasses/I3Double.h>
#include <simclasses/I3CorsikaInfo.h>
#include <simclasses/I3CorsikaShowerInfo.h>
#include <phys-services/I3RandomService.h>
#include <phys-services/surfaces/Cylinder.h>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/assign.hpp>
#include <boost/python.hpp>
#include <boost/scoped_ptr.hpp>
#include <cmath>

Typedefs

typedef I3Map<I3ParticleID, double> I3ParticleIDMap
typedef boost::shared_ptr<I3ParticleIDMap> I3ParticleIDMapPtr

Functions

I3_MODULE(CORSIKAResampler)
double GetSlantDepth(const I3Direction &dir, const I3Position &pos)
void AddParticleTree(const I3MCTree &mctree, I3MCTree &newtree, const I3Particle &orig_primary, const I3Particle &primary, const I3CorsikaShowerInfo &shower_info, const I3Position &surface_pos, const I3Particle &orig_leaf, const I3Particle &new_leaf)

Recursive function to copy a particle from an old tree to a new tree, with all it’s daughters, while keeping the tree-structure. Input naming is consistent with CORSIKAResampler::ResampleEvent.

Parameters:
  • mctree – original tree where the particle will be copied from

  • newtree – new tree where the particle will be copied to

  • orig_primary – the primary particle of the original tree

  • primary – the primary particle in the new tree

  • shower_info – the I3CorsikaShowerInfo object of the shower

  • surface_pos – the surface position of the shower

  • orig_leaf – the leaf in the original tree

  • new_leaf – the same leaf in the new tree

Variables

const double EarthRadius = 637131500 * I3Units::cm

Rcs

CORSIKAResampler.cxx 150715 2016-10-12 20:23:40Z hpandya

Copyright (C) 2012 The IceCube Collaboration http://www.icecube.wisc.edu

file I3CORSIKAReader.cxx
#include <icetray/open.h>
#include <icetray/I3Frame.h>
#include <icetray/I3Module.h>
#include <dataio/I3FileStager.h>
#include <dataclasses/physics/I3MCTreeUtils.h>
#include <dataclasses/physics/I3Particle.h>
#include <dataclasses/I3Double.h>
#include <simclasses/I3CorsikaInfo.h>
#include <simclasses/I3CorsikaShowerInfo.h>
#include <phys-services/I3RandomService.h>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/assign.hpp>
#include <boost/python.hpp>
#include <boost/scoped_ptr.hpp>
#include <cmath>
#include “icetray/I3Units.h”

Typedefs

typedef I3Map<I3ParticleID, double> I3ParticleIDMap

$Id$

Copyright (C) 2012 The IceCube Collaboration http://www.icecube.wisc.edu

typedef boost::shared_ptr<I3ParticleIDMap> I3ParticleIDMapPtr

Functions

I3_MODULE(I3CORSIKAReader)
inline bool IsEquivalent(double p1, double p2)
inline bool IsEquivalent(const I3Position &p1, const I3Position &p2)
inline bool IsEquivalent(const I3Particle &p1, const I3Particle &p2)
I3MCTree::iterator EnsureNode(I3MCTreePtr mctree, I3MCTree::iterator root, I3Particle &child)
file I3CORSIKAReaderUtils.cxx
#include “dataclasses/physics/I3Particle.h”
#include “dataclasses/I3Direction.h”
#include <phys-services/surfaces/Sphere.h>
#include <boost/bimap.hpp>
#include <boost/iterator/transform_iterator.hpp>
file I3CORSIKAReaderUtils.h
#include <cstdint>
#include <icetray/I3Units.h>
#include <dataclasses/I3Constants.h>
#include <set>
file I3CORSIKAService.cxx
#include “simclasses/I3ShowerBias.h”
#include “simclasses/I3CorsikaWeight.h”

Functions

double muon_energy_threshold(double max_range)
file I3CORSIKAService.h
#include <sim-services/I3CosmicEventGenerator.h>
#include <dataclasses/I3Orientation.h>
dir corsika-reader
dir corsika-reader
dir corsika-reader
dir icetray
dir private
dir public