photonics-service C++ API Reference

struct Amasim_Level2_Table_type

Public Members

photonics::MetaHead_type MetaHead_data
char dummy_padding[256]
float zLow
float zHigh
float aLow
float aHigh
float dummy_padding2
Level2_data_type abs
Level2_data_type prob
struct Amasim_Table_Type

Public Members

float zLow
float zHigh
float aLow
float aHigh
photonics::ph_int type
photonics::ph_int padding

currently not used int

photonics::Header_type h_abs
photonics::Header_type h_prob
Data_type abs
Data_type prob
struct Data_type

Public Members

float *cont

Data pointer

float *err

Error matrix pointer

size_t mmaped

Bytes mmaped in cont and err. If zero, data were allocated with malloc(), not mmap()

photonics::ph_size_t offset[VARS]

Array encoding size of each subtable

struct Edge_type

Public Members

double val

Edge location in appropriate units

double **area

Area of an edge surface as function of other 2 coordinates

double sine

Sine of a value (for angular bins)

template<typename T>
struct evaluators

Evaluate spline tables at the given precision.

Public Members

std::unique_ptr<evaluator<T>> amplitude_
std::unique_ptr<evaluator<T>> timing_
std::unique_ptr<evaluator<T>> effectiveDistance_
std::unique_ptr<evaluator<T>> effectiveDistanceProb_
std::unique_ptr<evaluator<T>> effectiveDistanceTmod_
struct Geo_type

Overall geometry.

Public Members

ph_int n[3]

Number of geometrical bins per dimension

bool buffer[3][2]

Indicator whether active geometry extends beyond recordable region

ph_int dummy_padding

not used

Region_type *dim[3]

Dimensional regions

double d[VARS]

Dimensional steps

double *bracket[3]

Arrays used for fast binary search of location

double *middle[3]

Array used for fast interpolation lookup

double *timing

Time binning array

double *timing_middle

Centers of timing bins for fast interpolation lookup some arrays handy for optimizations

struct Header_type

Header/setup information.

Public Members

MetaHead_type MetaHead
char dummy_padding[16]

not used

float sphere_frac

fraction of all scatters that will be with <cos>=0

float impsampl_Lf

Importance sampling factor for exp() steps length

float impsampl_Tf

Importance sampling factor for HG scattering

float dummy_l2padd

not used [in level1, gauss factor in level2]

float ref_np

phase refractive index used for true <&#8212;> residual calc

float ref_ng

phase refractive index used for true <&#8212;> residual calc

bool record_errors

Statistical errors are tracked

source_type source

Emission source type

bool extended_source

Simulaton of extended shower sources

float step

Step for photon tracking (m)

float e

Shower energy for shower sources in (GeV)

float volume

Radial size for volume source (m)

float angle

Source axis zenith angle

float source_rz[2]

Source location wrt active volume center

geo_type geo

Geometry type

ph_int n[VARS]

Number of bins in each dimension

float limits[VARS][2]

Recordable limits for each dimension

float maxes[VARS][2]

Active limits for each dimension

float depth

depth of active volume center wrt ice table

scale_type d_scale

distance scaling parameter

scale_type t_scale

time scaling parameter

float lambda

light wavelength, or negative; spectral “index”

ph_int efficiency

Efficinency calibrations applied

ph_long n_photon

number of photons to generate

ph_long n_entries

total number of MC entries

ph_int refraction_mode

if we do refraction between layers (0 == no)

ph_int User_ieC

not used

class I3DummyPhotonicsService : public I3PhotonicsService

Dummy version of I3PhotonicsService (does not use photonics)

Uses some simple eyeball parametrisations based on looking at a few event displays. Light yield falls off exponentially with some suitable distance measure with some additional suppression behind the source. The time distribution rises linearly and then decays exponentially in a way which depends on distance. This is not meant for any serious use; please read the code if you want to know the details anyway.

Public Functions

I3DummyPhotonicsService()

Constructor.

inline ~I3DummyPhotonicsService()

Destructor.

virtual void SelectSource(double &meanPEs, double &emissionPointDistance, double &geoTime, PhotonicsSource const &source)

Select source Select source, return light yield, and set time distribution parameters for later calls to timing methods.

Parameters:
  • meanPEs – Mean number of PEs

  • emissionPointDistance – Distance from nominal point of cherenkov point to OM

  • geoTime – “Geometric time”

  • source – Source parameters

virtual void SelectSource(double &meanPEs, double &emissionPointDistance, double &geoTime, PhotonicsSource const &source, double &rho_radial_dist)
virtual void UpdateInternalParams(PhotonicsSource const &source, double saved_meanamp)
virtual void GetTimeDelay(double random, double &timeDelay)

Get residual time for hit (w.r.t direct propagation from nominal emission point)

Parameters:
  • random[in] Uniform random number

  • timeDelay[out] Residual time

virtual void GetProbabilityDensity(double &density, double timeDelay)

Get probability density for previously selected OM/source combination.

Parameters:
  • density[out] Probability density (ns^-1)for given residual time

  • timeDelay[in] Residual time

double GetIntegratedProbability(double timeDelay)
virtual bool GetProbabilityQuantiles(double*, double, double*, size_t)

Fill an array with probability quantiles for a previously selected OM/source combination.

Parameters:
  • time_edges[in] Array giving the edges of the time bins

  • t_0[in] Direct time (time at which unscattered photons from the source would reach the DOM)

  • amplitudes[out] Array to fill with mean PE counts

  • n_bins[in] Size of the amplitude array. There are n_bins + 1 time edges.

bool GetMeanAmplitudeGradient(double*)
bool GetMeanAmplitudeHessian(double*, double (*)[6])
bool GetProbabilityQuantileGradients(double*, double, double (*)[6], size_t)
bool GetProbabilityQuantileHessians(double*, double, double*, double (*)[6], double (*)[6][6], size_t)
virtual bool GetProbabilityDensityGradient(double gradient[6], double timeDelay)
virtual bool GetProbabilityDensityGradnHessian(double density_grad[6], double density_hessian[6][6], double timeDelay)
virtual void GetCDF(double &cdf, double const timeDelay)
virtual bool GetCDFGradient(double gradient[6], double timeDelay)
virtual bool GetCDFGradnHessian(double density_grad[6], double density_hessian[6][6], double timeDelay)
virtual void GetKnotVector(double *knots, int dim)
virtual void GetTimeExtent(double *ext)

Protected Functions

SET_LOGGER ("I3DummyPhotonicsService")

Private Members

double t0_
double k_
double expNorm_
double tOffset_
class I3IceLayerTilt
#include <I3IceLayerTilt.h>

Public Functions

I3IceLayerTilt()
void ini(std::string)
void set_r0()
double zshift(double, double, double)
void grad(double, double, double, double jac[6][6])

Private Functions

void error(const std::string&)

Private Members

bool tilt
int lnum
int lpts
int l0
double lmin
double lrdz
double r0
double lnx
double lny
double lr[LMAX]
double lp[LMAX][LYRS]
float mmin[2]
float mstp[2]
int mnum[2]
int mcut[2]
int mcol[CTX][CTY]
double invproj[2][2]
int tmod
class I3PhotonicsHitMaker : public I3Module

Public Functions

I3PhotonicsHitMaker(const I3Context &context)
void Configure()
void DAQ(I3FramePtr frame)

Private Functions

SET_LOGGER ("I3PhotonicsHitMaker")

Private Members

I3PhotonicsServicePtr trackp_
I3PhotonicsServicePtr cascadep_
I3RandomServicePtr rng_
std::string hcList_
std::string input_
std::string output_
double binwidth_
std::vector<I3Particle::ParticleType> light_producing_tracks
class I3PhotonicsL1Reader

Class for Reading Photonics Level1 files for use with photonics-service.

This class is created from various photonics header files. Photonics relied on global variables. All global variables are now member variables in this class. Functions nescessary for reading level1 files which don’t use the globals were added as private static member functions.

Public Functions

I3PhotonicsL1Reader()

Constructor initilized formarly global variables which photonics uses.

~I3PhotonicsL1Reader()

Destructor frees memory used by photonics.

geo_type get_level1_geometry()
void free_tablesets_level1()
void set_level1_angular_interval(float alow, float ahigh)
void set_level1_depth_interval(float zlow, float zhigh)
int load_tables(const char*)

Routine that reads in all tables specified in driver file.

double get_photon_density(float, float, int, float, float, float, int, int*, int*, int*, int*) const

Returns mean photon density for specified source depth, angle, and type.

Returns:

-1 for no table found (z_source/angle out of bounds)

double get_photon_delay(double, int, int, int, int) const

Returns time delay based on input random number for selected table and bin.

int get_photon_delays(double (*uniform_random)(const void *r, double a, double b), void (*multinomial_random)(const void *r, size_t k, unsigned int N, const double p[], unsigned int n[]), const void *r, int N, double *delays, int id, int z_bin, int rho_bin, int phi_bin) const
double get_delay_prob(double, int, int, int, int) const

Returns probability of given time delay based for selected table and bin.

double get_level1_lmax() const

Private Functions

int init_tableset_level1()
int swap_tableset_level1(int index)
inline int find_l1z_table(float z_source, int *idA, int *idB, double *wA, double *wB) const

find the index to the tables [upper and lower] for a requested source depth.

inline int find_l1theta_table(float a_source, int *TidA, int *TidB, double *wA, double *wB) const

Find the angle number [upper and lower] for a requsted angle.

The returned indecis are offsets from the lowest angle. Add the index from find_z_table to acces the right table.

void close_input(FILE*)
bool read_header(photonics::Header_type *h, FILE *fh) const

Returns a pointer to header of currently opened input file, or NULL if none available.

float *read_current_chunk(FILE *fh)

Read chunk from current stream position.

FILE *test_input(const Opt_type *opt)

Verify that it’s possible to read data and setup variables for input.

photonics::Header_type *get_header(void) const

Returns a pointer to header of currently opened input file, or NULL if none available.

bool mmap_file(const Opt_type *opt, Data_type *data, bool errs) const

Entire photon array is readout out.

bool read_file_without_errors(const Opt_type*, Data_type*)

Entire photon table file is readout but without errors.

bool read_table(float*, FILE*)

Entire photon array is readout out.

Private Members

FILE *in
Io_type io
float *data_chunk
float *err_chunk
Amasim_Table_Type *table
int *n_tables
photonics::Geo_type *geo
Tableset_level1_container_type mytablesets_level1
pref_level1_t pref_level1

Private Static Functions

static int level1_table_comp(const void *a, const void *b)

Table comparator for sorting of data tables.

static bool open_binary_input(const char *file, FILE **fh)
static void byteswap32_l1header(photonics::Header_type *h)

performs byte swapping on relevant members of level1 headers for Power-PC etc.

static double next_boundary_lin(const double base, const double step)

Functions calculating next boundry value based in scaling used.

static bool evaluate_slices(const photonics::Header_type *h, photonics::Geo_type *geo)

Set up azimuthal regions based on user input NB: Values kept as cosines for faster computation down the line.

static bool cylindrical_geometry(const photonics::Header_type *h, photonics::Geo_type *geo)

Set up cylindrical active volume based on user input.

static bool cylindrical_areas(const photonics::Header_type *h, photonics::Geo_type *geo)

Evaluate area of each surface edge.

static bool spherical_geometry(const photonics::Header_type *h, photonics::Geo_type *geo)

Set up spherical active volume based on user input.

static bool spherical_areas(const photonics::Header_type *h, photonics::Geo_type *geo)

Evaluate area of each surface edge.

static bool cubic_geometry(const photonics::Header_type *h, photonics::Geo_type *geo)

Set up cubic active volume based on user input.

static bool cubic_areas(const photonics::Header_type *h, photonics::Geo_type *geo)

Evaluate area of each surface edge.

static bool timing_geometry(const photonics::Header_type *h, photonics::Geo_type *geo)

Calculates timing bin coordinates based on user input.

static bool set_up_geometry(const photonics::Header_type*, photonics::Geo_type*)

set up requested geometry

static bool get_coord(const photonics::Header_type*, const photonics::Geo_type*, Read_type*)

Coordinates to bins conversions with lookup of interpolation variables.

static bool interpolate(const Read_type*, Interp_type*)

Full interpolation routine for table entry.

Input: Structure with bin info

Output: Interpolation factors and bins to use as a structure, and status as a return value.

Intepolation logic: This is full multidimensional bilinear interpolation. The simpification is that dimensions are treated as linear grids. Cross-bins are taken care off automatically. Find the weight for the current and an adjecent bin. Always weight current bin higher, and select the adjecent bin closer to the actual value. Edge bins are not interpolared towards the outside.

static bool data_alloc(Data_type *data, const photonics::Header_type *h)

Allocate memory for our main data array.

static unsigned long data_allocated(Data_type *data, const photonics::Header_type *h)

Determine the size of memory that WAS allocated by identical call to data_alloc.

static void data_free(Data_type *data)

Free memory from our main data array.

class I3PhotonicsL2Reader

Class for Reading Photonics Level2 files for use with photonics-service.

This class is a modified version of photonics_cppio which was a class provided by photonics for accessing level2 photonics tables. It used weird a preprocessor directive scheme to recycle straight c files into the class. I think this was created so that the globals in the original c file would now be class members.

All the preprocessor stuff was removed so it is now a straightforward c++ class. Necessary functions from level2/level2_reader.c were also included as private static member functions.

Public Types

enum tableset_type

Enumeration for type of tableset.

Values:

enumerator START
enumerator STOP
enum photonics_l2_table_flavor

Level2 table enumerations.

Values:

enumerator ABS
enumerator DIFF
enumerator PROB

Public Functions

I3PhotonicsL2Reader()
~I3PhotonicsL2Reader()
void free_tablesets_level2()

Free all memory used by level2 table sets.

int init_tableset_level2()

Initialize a new tableset.

This will allocate memory for a new tableset, table info and tables.

Note

That actual table content is allocated in routines called by I3PhotonicsL2Reader::load_level2_tables and not here. Because of this don’t call free_tablesets_level2::free_tablesets_level2 before I3PhotonicsL2Reader::load_level2_tables unless you want a runtime error.

Note

Also note that tables allways will get the size MAX_TABLES. This is to make the code backwardscompatible, it is possible to implement this dynamic but then more changes to existing photonics routines.

Returns:

index of newly initialized tableset

int swap_tableset_level2(int index)

Swap active tableset.

This will change the current tableset index I3PhotonicsL2Reader::mytablesets_level2 and set the pointers I3PhotonicsL2Reader::table and I3PhotonicsL2Reader::geo and I3PhotonicsL2Reader::n_tables to the corresponding data in mytablesets_level2.tableset[mytablesets_level2.current]

Returns:

If index is larger then the number of tablesets -1 will be returned, otherwise index will be returned.

int load_level2_tables(const char *driver_file)

Routine that reads in all tables specified in driver file.

Returns:

1 on success 0 or -1 on error.

double get_level2_general_photon_density(float angle_track, float rho, float phi, float l_start, float l_stop, float z_start, float z_stop, int interp_mask, int *tableset_id, int *table_id_A, int *table_id_B, int *l_bin_A, int *l_bin_B, int *rho_bin_A, int *rho_bin_B, int *phi_bin_A, int *phi_bin_B)

Table lookup for finite line-like sources such as muons.

The user specifies any finite (starting and or stopping) track The routine figures out how to best fulfill the requrest, given the already loaded tables, and returns the amplitude and handles for time/prob querries.

We follow the photonics convention to have coordinates as floats. Amplitudes, times, probabilities etc as doubles.

The output ids and bins are used with:

Note

This function must only be used with tables for line like sources. (The user must know that) For point like tables (such as LEDs and pointlike cascades) you should instead use get_level2_general_pointlike_photon_density()

Parameters:
  • angle_track – track theta [degrees]

  • rho – track rho

  • phi – track phi [radians]

  • l_start – start

  • l_stop

  • z_start – track start depth

  • z_stop – track stop depth

  • interp_mask – photonics interpolation mask

  • tableset_id – ‘A’ bins refer to the table with higher amp

  • table_id_A – contains depth/theta information

  • table_id_B

  • l_bin_A

  • l_bin_B

  • rho_bin_A

  • rho_bin_B

  • phi_bin_A

  • phi_bin_B

double get_level2_general_delay(double r, int tableset_id, int table_id_A, int table_id_B, int l_bin_A, int l_bin_B, int rho_bin_A, int rho_bin_B, int phi_bin_A, int phi_bin_B)

This is a general funtion for level2 delay queries.

Works with the handles given by get_level2_general_photon_density(). This function is identical in form to double get_level2_general_delay_prob().

This function is a wrapper for

Note

this assumes that -1 is not a valid respons. This is currently fine.

Parameters:
  • r – the random number

  • tableset_id

  • table_id_A

  • table_id_B

  • l_bin_A

  • l_bin_B

  • rho_bin_A

  • rho_bin_B

  • phi_bin_A

  • phi_bin_B

Returns:

The function itself returns delay -1 if question not relevant (no amp)

double get_level2_general_delay_prob(double delay, int tableset_id, int table_id_A, int table_id_B, int l_bin_A, int l_bin_B, int rho_bin_A, int rho_bin_B, int phi_bin_A, int phi_bin_B)

This is a general funtion for level2 delay queries.

Works with the handles given by get_level2_general_photon_density(). This function is identical in form to double get_level2_general_delay().

Parameters:
  • delay – the time delay

  • tableset_id

  • table_id_A

  • table_id_B

  • l_bin_A

  • l_bin_B

  • rho_bin_A

  • rho_bin_B

  • phi_bin_A

  • phi_bin_B

int get_level2_photorec(float angle_track, float rho, float phi, float l_start, float z_start, float delay, double *amp, double *prob, int interp_mask, double energy) const

Reader for the ‘photorec’ reconstruction pdf framework.

Supports multi linear interpolation in all dimentions, of both abs and prob.

This function is used for reconstruction with tables of point like sources (like showers), or degenerate (only one l-bin) muons.

For finite line sources, use get_level2_photorec_finite()

Most of the new code is implemented elsewhere in this file, while this function is a selector and wrapper to the new functionallity.

When the number of l-bins of the table is 1, the functionallity previously implemented in get_level2_photorec_degenerate is provided.

Parameters:
  • angle_track – track theta [degrees]

  • rho – track rho

  • phi

  • l_start – start

  • z_start – track start depth

  • delay – residual time

  • amp – amplitude (poisson mean)

  • prob – differential prob: dp/dt integrates to 1

  • interp_mask – photonics interpolation mask

  • energy – vertex energy (GeV). 0 means no scaling. the particle type is read from the table

Returns:

true on success

int get_level2_photorec_finite(float angle_track, float rho, float phi, float l_start, float l_stop, float z_start, float z_stop, float delay, double *amp, double *prob, int interp_mask, double energy)

Reader for the ‘photorec’ reconstruction pdf framework.

Supports multi linear interpolation in all dimentions, of both abs and prob.

The intention is to provide an interface to table reading with full interpolation of abs and pdf for any line like (muonic) request

This is to support reconstruction where the track start and stop positions are parameters to be fitted.

Most of the new code is implemented elsewhere in this file, while this function is a selector and wrapper to the new functionallity.

Parameters:
  • angle_track – track theta [degrees]

  • rho – track rho

  • phi – track phi [radians]

  • l_start – start

  • l_stop

  • z_start – track start depth

  • z_stop – track stop depth

  • delay – residual time

  • amp – amplitude (poisson mean)

  • prob – differential prob: dp/dt unit: [1/ns]

  • interp_mask – photonics interpolation mask

  • energy – vertex energy (GeV). 0 means no scaling the particle type is read from the table

Returns:

true on success

void set_level2_angular_interval(float alow, float ahigh)

Block of functions used to set preferences and query tables status:

void get_level2_angular_interval(float *alow, float *ahigh) const
void set_level2_depth_interval(float zlow, float zhigh)
void get_level2_depth_interval(float *zlow, float *zhigh) const
void get_level2_memory_usage(unsigned long *mem) const

Return the amount of memory (bytes) used for tableset in photonics level2.

void get_level2_angular_memory_requirement(float alow, float ahigh, unsigned long *mem) const

returns estimate of number of bytes needed to load an interval of given size, assuming equidistant theta binning.

The results should be exact as long as the first possible angle given by the driver file is zero, or a multiple of angular bin size

bool get_level2_sourcetype(int *sourcetype, int *time_reference) const
double get_level2_lmax() const
double get_level2_photon_density(float, float, float, float, float, int, int*, int*, int*, int*) const

Returns mean photon density for specified source depth, angle, and type.

Private Functions

inline int find_z_table(float z_source, int *TidA, int *TidB, double *wA, double *wB) const

Returns mean photon density for specified source depth, angle, and type.

This function is responsible for finding the table bins and amplitudes for point like sources. It can be called directly for point like sources (such as LEDs and pointlike cascades). But it should not be called directly for line like sources such as finite or infinite muons. Use the apropriate muon-specific function instead.

Returns:

-1 for no table found (z_source/angle out of bounds)

inline int find_theta_table(float theta_source, int *idA, int *idB, double *wA, double *wB) const

Find the angle number [upper and lower] for a requsted angle.

The returned indecis are offsets from the lowest angle. Add the index from find_z_table to acces the right table.

double get_level2_photon_delay(double, int, int, int, int) const

Returns a (random) time delay based on input (random) cumulative probability distribution number for selected table and spatial bin.

double get_level2_photon_delay_prob(double, int, int, int, int) const

Reads the time distribution directly for a selected time bin.

Note

this differentiates the content (even if you loaded a differential table!) This function is used to obtain the differential time distribution with simulation tables.

double get_finite_level2_photon_delay(double, int, int, int, int, int, int, int, int) const

Returns time delay based on input random number for selected table and bin of starting and stopping point.

Contribution of source light beyond the stopping point is removed from timing array before calculating the delay.

double get_finite_level2_photon_delay_prob(double, int, int, int, int, int, int, int, int) const

Returns probability of given time delay based on input random number for selected table and bin of starting and stopping point. Finite muons.

As get_level2_photon_delay_prob() but for finate muons.

void get_level2_angle_status(int*, float*) const

gives the number of angles loaded and the angle bin size

tableset_type swap_tableset_pair_level2(tableset_type type)

Switch to paired tableset of desired type.

Harmless if current tableset is of ‘type’ already, otherwise a swap to pair_id will be done.

Returns:

the type we managed to select.

Private Members

const char *infstop_mark
const char *startinf_mark
const char *photorec_mark
struct Amasim_Level2_Table_type *table
int *n_tables
struct Level2_geo_type *geo
struct pref_level2_t pref_level2
struct Tableset_level2_container_type mytablesets_level2

Private Static Functions

static double light(int, double)

Number of cerenkov photons emitted by muon per meter of pathlength.

With correction for low energy loss effects. See CHW thesis, section 7.2 & Number of cerenkov photons emitted by a shower of energy E. See CHW thesis, section 7.1

static double light_for_source(int sourcetype, double e)

light scaling for any type of source.

static int level2_geometry(const Level2_header_type*, Level2_geo_type*)

Precalculates level2 table binnings for fast lookup.

static bool get_level2_coord(const Level2_geo_type*, Level2_read_type*)

Coordinates to bins conversions with remainders.

Copied and simplified from reader.c

static bool level2_interpolate(const Level2_read_type*, Level2_interp_type*)

Full interpolation routine for table entry.

Input: Structure with bin info Output: Interpolation factors and bins to use as a structure, and status as a return value. Intepolation logic: Find the weight for the current and an adjecent bin. Always weight current bin higher, and select the adjecent bin closer to the actual value. Edge bins are not interpolared towards the outside. Copied from reader.c, with minor changes.

static int read_level2_file(const char *file, Level2_header_type *h, Level2_data_type *data, unsigned long *memused)

Routine that reads single level2 file.

static int level2_table_comp(const void *a, const void *b)

Table comparator for sorting of data tables.

static void byteswap32_l2header(Level2_header_type *h)

performs byte swapping on relevant members of level2 headers for Power-PC etc.

class I3PhotonicsService

Service interfacing to the photonics table access functions.

Subclassed by I3DummyPhotonicsService, I3PhotonicsServiceCollection, I3PhotonicsTableService, I3PhotoSplineService

Public Functions

I3PhotonicsService()
virtual ~I3PhotonicsService()
virtual void SelectModuleCoordinates(double xOM, double yOM, double zOM)

Select OM coordinates.

Parameters:

xOM, yOM, zOM – Coordinates in metres

virtual void SelectModule(const I3OMGeo &geo)

Select OM coordinates By default, this calls SelectModuleCoordinates. Subclasses that know about more dimensions should override this function.

Parameters:

geo – Module coordinates, orientation, etc

virtual void SetEfficiencies(double domEfficiency, double unshadowedFraction = 0.94)

Set the DOMEfficiency and UnshadowedFraction This sets global efficiencies to be applied on the light-scale calculation.

Parameters:
  • domEfficiency – Set the DOMEfficiency relative to the unshadowed detector

  • unshadowedFraction – Sets fraction of the OM that on average is not shadowed by the cable

virtual void SelectSource(double &meanPEs, double &emissionPointDistance, double &geoTime, PhotonicsSource const &source) = 0

Select light source Set source properties, calculate geometrical quantities based on OM previously selected by SelectModuleCoordinates(), call photonics, and return result.

Parameters:
  • meanPEs – Mean number of PEs

  • emissionPointDistance – Distance between nominal cherenkov emission point and OM

  • geoTime – Nominal arrival time for cherenkov light relative to time of track starting point

  • source – Source parameters

virtual void SelectSource(double &meanPEs, double gradients[6], double &emissionPointDistance, double &geoTime, PhotonicsSource const &source, bool getAmp = true)
virtual void SelectSource(double &meanPEs, double &emissionPointDistance, double &geoTime, PhotonicsSource const &source, double &rho_radial_dist) = 0
virtual void SelectSource(double &meanPEs, double gradients[6], double &emissionPointDistance, double &geoTime, PhotonicsSource const &source, double &rho_radial_dist, bool getAmp = true)
void SelectSource(double &meanPEs, double &emissionPointDistance, double &geoTime, double x, double y, double z, double zenith, double azimuth, double length, double Energy, int type) __attribute__((__deprecated__))
virtual void UpdateInternalParams(PhotonicsSource const &source, double saved_meanamp)
virtual void GetTimeDelay(double random, double &timeDelay) = 0

Get photon arrival time Draws a photon arrival time (in ns) using table pointers set up by previous call to SelectSource.

Parameters:
  • random[in] Random number (0-1)

  • timeDelay[out] Photon arrival time relative to direct light time

virtual void GetTimeDelays(I3RandomServicePtr random, double *timeDelays, int n)
virtual void GetProbabilityDensity(double &density, double timeDelay) = 0

Get photon probability density in time.

Get time probability density for single photon arrival time (in ns^-1), based on the table pointers set up in latest call to SelectSource().

Parameters:
  • density[out] Probability density (ns^-1)

  • timeDelay[in] Time offset from direct light arrival time

virtual bool GetProbabilityQuantiles(double *time_edges, double t_0, double *amplitudes, size_t n_bins) = 0

Fill an array with probability quantiles for a previously selected OM/source combination.

Parameters:
  • time_edges[in] Array giving the edges of the time bins

  • t_0[in] Direct time (time at which unscattered photons from the source would reach the DOM)

  • amplitudes[out] Array to fill with mean PE counts

  • n_bins[in] Size of the amplitude array. There are n_bins + 1 time edges.

virtual bool GetProbabilityQuantiles(double *time_edges, double t_0, double *amplitudes, double gradients[][6], size_t n_bins)
virtual bool GetMeanAmplitudeGradient(double gradient[6]) = 0

Get the gradient of the number of photoelectrons expected at the OM coordinates specified by a previous call to SelectModuleCoordinates.

Parameters:

gradient – (out) Store the gradient in this array. The gradient is given with respect to the source position (d/dx, d/dy, d/dz in PE/meter), direction of source origin (d/dtheta and d/dphi in PE/radian) and source energy (in PE/GeV).

virtual bool GetMeanAmplitudeHessian(double gradient[6], double hessian[6][6]) = 0
virtual bool GetProbabilityQuantileGradients(double *time_edges, double t_0, double gradients[][6], size_t n_bins) = 0

Get the gradient of photon detection probability at the OM coordinates specified by a previous call to SelectOMCoordinates in each of the time bins specified by time_edges.

Parameters:
  • time_edges – (in) Array giving the edges of the time bins.

  • t_0 – (in) Direct time (time at which unscattered photons from the source would reach the DOM)

  • gradients – (out) Store the gradients for each time bin in this array. Gradients are given with respect to source position (d/dx, d/dy, d/dz in meter^-1), event time (d/dt in ns^-1), and direction of source origin (d/dtheta, d/dphi in radian^-1).

  • n_bins – (in) Size of the leading dimension of gradients. There are n_bins+1 elements in time_edges.

virtual bool GetProbabilityQuantileHessians(double *time_edges, double t_0, double values[], double gradients[][6], double hessians[][6][6], size_t n_bins) = 0
virtual bool GetProbabilityDensityGradient(double gradient[6], double timeDelay) = 0
virtual bool GetProbabilityDensityGradnHessian(double density_grad[6], double density_hessian[6][6], double timeDelay) = 0
virtual void GetCDF(double &cdf, double timeDelay) = 0
virtual bool GetCDFGradient(double gradient[6], double timeDelay) = 0
virtual bool GetCDFGradnHessian(double cdf_grad[6], double cdf_hessian[6][6], double timeDelay) = 0
virtual void GetKnotVector(double *knots, int dim) = 0
virtual void GetTimeExtent(double *ext) = 0
virtual bool GetPhotorecInfo(double &yield, double &probDensity, double delay, PhotonicsSource const &source)

Get photorec information.

Gets photorec information based on OM coordinates specified by previous call to SelectOMCoordinates, delay time, and photonics source information in PhotonicsSource struct.

Parameters:
  • yield[out] Light yield as given by table. For level 2 cascade line sources this is usually normalised to an energy loss of 1 GeV/m

  • probDensity[out] Probability density in time (ns^-1)

  • delay[in] Delay time

  • source[in] Photonics source

Returns:

Success or failure of photonics table access

virtual bool GetPhotorecDensities(double &yield, std::vector<double> &probDensities, std::vector<double> delays, PhotonicsSource const &source)
bool GetPhotorecInfo(double &yield, double &probdensity, double delay, double x, double y, double z, double zenith, double azimuth, double length, double Energy, int type) __attribute__((__deprecated__))
inline virtual bool SetAngularSelection(int level, float low, float high)

Set angular selection for loading of photonics tables. This is advisory only, and does nothing by default.

Parameters:
  • level – Photonics level affected

  • low – Minimum zenith angle (degrees)

  • high – Maximum zenith angle (degrees)

inline virtual double GetAngularSelectionLow()
inline virtual double GetAngularSelectionHigh()
inline virtual bool SetDepthSelection(int level, float low, float high)

Set depth selection for loading of photonics tables. This is advisory only, and does nothing by default.

Parameters:
  • level – Photonics level affected

  • low – Minimum depth (m)

  • high – Maximum depth (m)

inline virtual double GetDepthSelectionLow()
inline virtual double GetDepthSelectionHigh()
inline virtual double GetLmaxLevel1()

Get maximum l in level 1 photonics tables.

Returns:

maximum l

inline virtual double GetLmaxLevel2()

Get maximum l in level 2 photonics tables.

Returns:

maximum l

void GetPhotonicsInput(double &zenith, double &rho, double &phiOM, double &l, double &z, double &eOffset, double &eDistance)

return photonics geometry parameters (+ emission point parameters) as doubles

bool CalculatePhotonicsInput(bool CheckLmax, double xOM, double yOM, double zOM, const PhotonicsSource &source)

Calculate photonics input variables (floats) and check if outside table range in l coordinate.

Parameters:
  • CheckLmax[in] Bool to enable checking lmax

  • xOM, yOM, zOM[in] OM coordinates

  • source[in] Source information

Returns:

False if OM is outside table range for given source, true otherwise.

inline std::vector<double> GetTableCoordinates() const
inline geo_type GetGeometry() const
inline parity_type GetParity() const
inline double GetNGroup() const

Public Static Functions

static PhotonicsSource FillPhotonicsSource(double x, double y, double z, double zenith, double azimuth, double length, double Energy, int type) __attribute__((__deprecated__))

Fill a PhotonicsSource struct from basic quantities.

NB: DEPRECATED IN FAVOR OF PHOTONICSSOURCE METHODS

Parameters:
  • x, y, z – Source coordinates (metres)

  • zenith, azimuth – Direction which source points from (degrees)

  • Energy – Energy (GeV)

  • length – Source length (zero for point source) (metres)

  • type – Source type (0=muon, 1=EM cascade)

Protected Functions

SET_LOGGER ("I3PhotonicsService")

Protected Attributes

double b_
double nPhase_
double nGroup_
double cVacuum_
double tanCh_
double sinCh_
geo_type geometry_
parity_type parity_
bool mirror_azimuth_
double coordPxC_[5]
double zStopPxC_
double lStopPxC_
double l_
double rho_
double cosAzi_
double cosAziMin_
double cosAziMax_
double r_
double cosZenith_
double emissionPointOffset_
double emissionPointDistance_
double xOM_
double yOM_
double zOM_
double efficiency_
class I3PhotonicsServiceCollection : public I3PhotonicsService

Public Functions

I3PhotonicsServiceCollection(std::map<I3OMGeo::OMType, I3PhotonicsServicePtr> &services)
virtual ~I3PhotonicsServiceCollection()
virtual void SelectModule(const I3OMGeo&)

Select OM coordinates By default, this calls SelectModuleCoordinates. Subclasses that know about more dimensions should override this function.

Parameters:

geo – Module coordinates, orientation, etc

virtual void SelectSource(double &meanPEs, double &emissionPointDistance, double &geoTime, PhotonicsSource const &source)

Select light source Set source properties, calculate geometrical quantities based on OM previously selected by SelectModuleCoordinates(), call photonics, and return result.

Parameters:
  • meanPEs – Mean number of PEs

  • emissionPointDistance – Distance between nominal cherenkov emission point and OM

  • geoTime – Nominal arrival time for cherenkov light relative to time of track starting point

  • source – Source parameters

virtual void SelectSource(double &meanPEs, double gradients[6], double &emissionPointDistance, double &geoTime, PhotonicsSource const &source, bool getAmp = true)
virtual void SelectSource(double &meanPEs, double &emissionPointDistance, double &geoTime, PhotonicsSource const &source, double &rho_radial_dist)
virtual void SelectSource(double &meanPEs, double gradients[6], double &emissionPointDistance, double &geoTime, PhotonicsSource const &source, double &rho_radial_dist, bool getAmp = true)
virtual void GetTimeDelay(double random, double &timeDelay)

Get photon arrival time Draws a photon arrival time (in ns) using table pointers set up by previous call to SelectSource.

Parameters:
  • random[in] Random number (0-1)

  • timeDelay[out] Photon arrival time relative to direct light time

virtual void GetTimeDelays(I3RandomServicePtr random, double *timeDelays, int n)
virtual void GetProbabilityDensity(double &density, double timeDelay)

Get photon probability density in time.

Get time probability density for single photon arrival time (in ns^-1), based on the table pointers set up in latest call to SelectSource().

Parameters:
  • density[out] Probability density (ns^-1)

  • timeDelay[in] Time offset from direct light arrival time

virtual bool GetProbabilityDensityGradient(double gradient[6], double timeDelay)
virtual bool GetProbabilityDensityGradnHessian(double density_grad[6], double density_hessian[6][6], double timeDelay)
virtual void GetCDF(double &cdf, double timeDelay)
virtual bool GetCDFGradient(double gradient[6], double timeDelay)
virtual bool GetCDFGradnHessian(double cdf_grad[6], double cdf_hessian[6][6], double timeDelay)
virtual void GetKnotVector(double *knots, int dim)
virtual void GetTimeExtent(double *ext)
virtual bool GetProbabilityQuantiles(double *time_edges, double t_0, double *amplitudes, size_t n_bins)

Fill an array with probability quantiles for a previously selected OM/source combination.

Parameters:
  • time_edges[in] Array giving the edges of the time bins

  • t_0[in] Direct time (time at which unscattered photons from the source would reach the DOM)

  • amplitudes[out] Array to fill with mean PE counts

  • n_bins[in] Size of the amplitude array. There are n_bins + 1 time edges.

virtual bool GetProbabilityQuantiles(double *time_edges, double t_0, double *amplitudes, double gradients[][6], size_t n_bins)
virtual bool GetMeanAmplitudeGradient(double gradient[6])

Get the gradient of the number of photoelectrons expected at the OM coordinates specified by a previous call to SelectModuleCoordinates.

Parameters:

gradient – (out) Store the gradient in this array. The gradient is given with respect to the source position (d/dx, d/dy, d/dz in PE/meter), direction of source origin (d/dtheta and d/dphi in PE/radian) and source energy (in PE/GeV).

virtual bool GetMeanAmplitudeHessian(double gradient[6], double hessian[6][6])
virtual bool GetProbabilityQuantileGradients(double *time_edges, double t_0, double gradients[][6], size_t n_bins)

Get the gradient of photon detection probability at the OM coordinates specified by a previous call to SelectOMCoordinates in each of the time bins specified by time_edges.

Parameters:
  • time_edges – (in) Array giving the edges of the time bins.

  • t_0 – (in) Direct time (time at which unscattered photons from the source would reach the DOM)

  • gradients – (out) Store the gradients for each time bin in this array. Gradients are given with respect to source position (d/dx, d/dy, d/dz in meter^-1), event time (d/dt in ns^-1), and direction of source origin (d/dtheta, d/dphi in radian^-1).

  • n_bins – (in) Size of the leading dimension of gradients. There are n_bins+1 elements in time_edges.

virtual bool GetProbabilityQuantileHessians(double *time_edges, double t_0, double values[], double gradients[][6], double hessians[][6][6], size_t n_bins)

Private Members

std::map<I3OMGeo::OMType, I3PhotonicsServicePtr> services_
I3PhotonicsService *current_
class I3PhotonicsServiceFactory : public I3ServiceFactory

Initialise an I3PhotonicsService and add it to the tray.

Public Functions

I3PhotonicsServiceFactory(I3Context const &context)

Constructor.

Parameters:

context – IceTray context

virtual ~I3PhotonicsServiceFactory()

Destructor.

virtual bool InstallService(I3Context &services)

Initialise photonics service and add it to the tray.

Parameters:

services – Reference to service context

void Configure()

Get parameters from IceTray.

Private Functions

SET_LOGGER ("I3PhotonicsServiceFactory")
I3PhotonicsServiceFactory()

default constructor declared private and unimplemented

I3PhotonicsServiceFactory(I3PhotonicsServiceFactory const &rhs)

copy constructor declared private and unimplemented

I3PhotonicsServiceFactory operator=(I3PhotonicsServiceFactory const &rhs)

assignment operator declared private and unimplemented

Private Members

std::string level1DriverFile_

Level 1 driver file name

std::string level2DriverFile_

Level 2 driver file name

int interpolMode_

Interpolation mode (bit mask)

int verbosity_

Verbosity

double angularSelectLow_

Minimum zenith angle to load tables for

double angularSelectHigh_

Maximum zenith angle to load tables for

double zSelectLow_

Minimum z to load tables for

double zSelectHigh_

Maximum z to load tables for

int photonicsTableSelection_

Specifies wanted table format (level 1, level 2 or both (0))

bool useDummyService_

Flags dummy photonics service to be used

double domEfficiency_
double unshadowedFraction_
I3PhotonicsServicePtr pxs_

pointer to PhotonicsService instance

std::string driverFileDirectory_

Directory holding photonics driver files

std::string photonicsTopLevelDirectory_

Directory holding “tables” subdirectory with photonics tables

std::string tablesDirectory_

Deprecated alias for photonicsTopLevelDirectory_

std::string serviceName_

Name of the photonics service

bool isPhotorecTable_

Whether the table to load is a photorec table

class I3PhotonicsTableService : public I3PhotonicsService

Service interfacing to the photonics table access functions.

Public Functions

I3PhotonicsTableService()

Constructor - initialise data members and create photonics level2 object.

I3PhotonicsTableService(const std::string &tablesDirectory, const std::string &driverFileDirectory, const std::string &level1DriverFile, const std::string &level2DriverFile, int interpolMode, int verbosity, double angularSelectLow, double angularSelectHigh, double zSelectLow, double zSelectHigh, int photonicsTableSelection, bool isPhotorecTable)
virtual ~I3PhotonicsTableService()

Destructor - unloads photonics tables and deletes photonics object

void SetInterpolationMode(int mode)

Select photonics interpolation mode.

A bit mask where each bit corresponds to interpolation in one of the dimensions of the tables: 1 l 2 rho 4 phi 8 nothing (time, always on) 16 depth 32 zenith 128 choose tables to select those giving the best desription of closest approach

Parameters:

mode – Interpolation mode

virtual bool SetPhotonicsVerbosity(int level, int verbosity)

Set photonics verbosity (deprecated)

Parameters:
  • level – Photonics level affected

  • verbosity – Degree of verbosity

virtual bool SetAngularSelection(int level, float low, float high)

Set angular selection for loading of photonics tables.

Parameters:
  • level – Photonics level affected

  • low – Minimum zenith angle (degrees)

  • high – Maximum zenith angle (degrees)

inline virtual double GetAngularSelectionLow()

Get lower limit of angular selection used for loading of photonics tables.

Returns:

Minimum zenith angle (degrees)

inline virtual double GetAngularSelectionHigh()

Get upper limit of angular selection used for loading of photonics tables.

Returns:

Maximum zenith angle (degrees)

virtual bool SetDepthSelection(int level, float low, float high)

Set depth selection for loading of photonics tables.

Parameters:
  • level – Photonics level affected

  • low – Minimum depth (m)

  • high – Maximum depth (m)

inline virtual double GetDepthSelectionLow()

Get lower limit of z selection used for loading of photonics tables.

Returns:

Minimum zenith angle (degrees)

inline virtual double GetDepthSelectionHigh()

Get upper limit of z selection used for loading of photonics tables.

Returns:

Minimum zenith angle (degrees)

bool LoadTables(int level, std::string driverFile, std::string topLevel)

Load photonics tables for specified level.

Tables must reside below “tables” subdirectory (or link) in cwd. I3PhotonicsServiceFactory changes working directory to achieve this before calling LoadTables.

Parameters:
  • level – Photonics level

  • driverFile – Name of driver file

  • topLevel – Name of top level table directory (containing “tables” subdirectory)

void ClearTables(int level)

Clears the photonics table memory. Not needed for normal operation.

Parameters:

level – photonics level for tables to be cleared

virtual void SelectModuleCoordinates(double xOM, double yOM, double zOM)

Select OM coordinates.

Parameters:

xOM, yOM, zOM – Coordinates in metres

virtual void SelectModule(const I3OMGeo &omgeo)

Select OM coordinates.

Parameters:

omgeo – I3OMGeo object from the I3Geometry

virtual void SelectSource(double &meanPEs, double &emissionPointDistance, double &geoTime, PhotonicsSource const &source)

Select light source Set source properties, calculate geometrical quantities based on OM previously selected by SelectModuleCoordinates(), call photonics, and return result.

Parameters:
  • meanPEs – Mean number of PEs

  • emissionPointDistance – Distance between nominal cherenkov emission point and OM

  • geoTime – Nominal arrival time for cherenkov light relative to time of track starting point

  • source – Source parameters (type PhotonicsSource)

virtual void SelectSource(double &meanPEs, double &emissionPointDistance, double &geoTime, PhotonicsSource const &source, double &rho_radial_dist)
virtual void UpdateInternalParams(PhotonicsSource const &source, double saved_meanamp)
virtual void GetTimeDelay(double random, double &timeDelay)

Get photon arrival time Draws a photon arrival time (in ns) using table pointers set up by previous call to SelectSource.

Parameters:
  • random[in] Random number

  • timeDelay[out] Photon arrival time relative to direct light time

virtual void GetTimeDelays(I3RandomServicePtr random, double *timeDelays, int n)

Get residual times for hit (w.r.t direct propagation from nominal emission point)

Parameters:
  • random[in] Random number generator

  • timeDelay[out] Residual time

  • n[in] Number of time delays to sample

virtual void GetProbabilityDensity(double &density, double timeDelay)

Get photon probability density in time.

Get time probability density for single photon arrival time (in ns^-1), based on the table pointers set up in latest call to SelectSource().

Parameters:
  • density[out] Probability density (ns^-1)

  • timeDelay[in] Time offset from direct light arrival time

virtual bool GetProbabilityQuantiles(double *time_edges, double t_0, double *amplitudes, size_t n_bins)

Fill an array with probability quantiles for a previously selected OM/source combination, optionally convoluted with a Gaussian.

Parameters:
  • time_edges[in] Array giving the edges of the time bins

  • t_0[in] Direct time (time at which unscattered photons from the source would reach the DOM)

  • amplitudes[out] Array to fill with mean PE counts

  • n_bins[in] Size of the amplitude array. There are n_bins + 1 time edges.

virtual bool GetMeanAmplitudeGradient(double gradient[6])

Get the gradient of the number of photoelectrons expected at the OM coordinates specified by a previous call to SelectOMCoordinates.

Parameters:

gradient – (out) Store the gradient in this array. The gradient is given with respect to the source position (d/dx, d/dy, d/dz in PE/meter), direction of source origin (d/dtheta and d/dphi in PE/radian) and source energy (in PE/GeV).

virtual bool GetMeanAmplitudeHessian(double gradient[6], double hessian[6][6])
virtual bool GetProbabilityQuantileGradients(double *time_edges, double t_0, double gradients[][6], size_t n_bins)

Get the gradient of photon detection probability at the OM coordinates specified by a previous call to SelectOMCoordinates in each of the time bins specified by time_edges.

Parameters:
  • time_edges – (in) Array giving the edges of the time bins.

  • t_0 – (in) Direct time (time at which unscattered photons from the source would reach the DOM)

  • gradients – (out) Store the gradients for each time bin in this array. Gradients are given with respect to source position (d/dx, d/dy, d/dz in meter^-1), event time (d/dt in ns^-1), and direction of source origin (d/dtheta, d/dphi in radian^-1).

  • n_bins – (in) Size of the leading dimension of gradients. There are n_bins+1 elements in time_edges.

virtual bool GetProbabilityQuantileHessians(double *time_edges, double t_0, double values[], double gradients[][6], double hessians[][6][6], size_t n_bins)
virtual bool GetProbabilityDensityGradient(double gradient[6], double timeDelay)
virtual bool GetProbabilityDensityGradnHessian(double density_grad[6], double density_hessian[6][6], double timeDelay)
virtual void GetCDF(double &cdf, double timeDelay)
virtual bool GetCDFGradient(double gradient[6], double timeDelay)
virtual bool GetCDFGradnHessian(double cdf_grad[6], double cdf_hessian[6][6], double timeDelay)
virtual void GetKnotVector(double *knots, int dim)
virtual void GetTimeExtent(double *ext)
virtual bool GetPhotorecInfo(double &yield, double &probDensity, double delay, PhotonicsSource const &source)

Get photorec information.

Gets photorec information based on OM coordinates specified by previous call to SelectOMCoordinates, delay time, and photonics source information in PhotonicsSource struct.

Parameters:
  • yield[out] Light yield as given by table. For level 2 cascade line sources this is usually normalised to an energy loss of 1 GeV/m

  • probDensity[out] Probability density in time (ns^-1)

  • delay[in] Delay time

  • source[in] Photonics source

Returns:

Success or failure of photonics table access

virtual bool GetPhotorecDensities(double &yield, std::vector<double> &probDensities, std::vector<double> delays, PhotonicsSource const &source)

Get several photorec probability densities.

Gets mean number of PEs and the probability density for a specified set of times. Uses OM coordinates specified by previous, call to SelectOMCoordinates and photonics source information in PhotonicsSource struct.

Parameters:
  • yield[out] Light yield as given by table. For level 2 cascade line sources this is usually normalised to an energy loss of 1 GeV/m

  • probDensities[out] Vector with probability densities (in ns^-1)

  • delays[in] Vector of delay times to give densities for

  • source[in] Photonics source

Returns:

Success or failure of photonics table access

virtual double GetLmaxLevel1()

Get maximum l in level 1 photonics tables.

Returns:

maximum l

virtual double GetLmaxLevel2()

Get maximum l in level 2 photonics tables.

Returns:

maximum l

Private Functions

float EmissionEnergy(double E, double length)

Find energy at nominal point of cherenkov emission Adjust a in dE/dx=-a-bE such that E=0 for x=length and return energy at nominal point for cherenkov emission or zero if point beyond track end.

Parameters:
  • E – Energy at start of track

  • length – Track length

bool LoadLevel1Tables()

Load level 1 photonics tables Paths must be set by LoadTables() before call to this function.

bool LoadLevel2Tables()

Load level 2 photonics tables Paths must be set by LoadTables() before call to this function.

Private Members

I3PhotonicsL1Reader *l1_photonics_

Pointer to photonics object for level 1 tables.

I3PhotonicsL2Reader *l2_photonics_

Pointer to photonics object for level 2 tables.

int interpolationMode_
bool level1TablesLoaded_
bool level2TablesLoaded_
std::string level1DriverFileName_
std::string level2DriverFileName_
std::string photonicsTopLevelDirectory_
double lmaxLevel1_
double lmaxLevel2_
float rawYield_
int level_
int type_
int tableSetId_
int tableId_
int stopTableId_
int lBin_
int lBinStop_
int rhoBin_
int rhoBinStop_
int phiBin_
int phiBinStop_
double angularSelectLow_
double angularSelectHigh_
double depthSelectLow_
double depthSelectHigh_
bool isPhotorecTable_
class I3PhotoSplineService : public I3PhotonicsService, public I3ServiceBase

Access to spline-interpolated photonics tables.

Access and evaluate spline-interpolated photonics tables. The spline tables can be shared between different processes on the same computing node.

Public Types

using shared_allocator_type = bi::allocator<void, bi::managed_shared_memory::segment_manager>
using splinetable = photospline::splinetable<shared_allocator_type>
using evaluator = splinetable::evaluator

Public Functions

I3PhotoSplineService(const std::string &amplitudeTable, const std::string &timingTable, const std::string &tiltTableDir = "", const std::string &effectiveDistanceTable = "", double timingSigma = 0, double maxRadius = std::numeric_limits<double>::infinity(), std::pair<double, double> cosAziRange = std::make_pair(-1., 1.), double quantileEpsilon = 0, const std::string &effectiveDistanceTableProb = "", const std::string &effectiveDistanceTableTmod = "")

Create a new I3PhotoSplineService instance.

Parameters:
  • amplitudeTable – Path to the amplitude spline table

  • timingTable – Path to the timing spline table

  • effectiveDistanceTable – Path to the effective distance spline table

  • tiltTableDir – Path to the ice layer tilt table files

  • timingSigma – Smear the arrival time distribution with a B-spline of order 1 and this standard deviation.

  • maxRadius – Maximum expected distance for detected light from emitter

  • cosAziRange – Range of table azimuth to clamp (avoiding singularities in the coordinate transformation)

  • quantileEpsilon – Switch to double precision evaluation when timing quantile differs from 1 by less than this amount

I3PhotoSplineService()
I3PhotoSplineService(const I3Context &context)
virtual ~I3PhotoSplineService()
void Configure()
virtual void SelectModuleCoordinates(double OMx, double OMy, double OMz)

Select OM.

Parameters:

OMx, OMy, OMz[in] Coordinates of OM

virtual void SelectSource(double &meanPEs, double &emissionPointDistance, double &geoTime, const PhotonicsSource &source)

Select source.

Select a source, set the time distribution parameters for later calls to the timing methods, and return the mean number of expected photoelectrons at the previously selected OM.

Parameters:
  • meanPEs[out] Mean number of expected photoelectrons

  • emissionPointDistance[out] Distance from nominal light emission point to OM

  • geoTime[out] Geometric photon arrival time

  • source[in] Source parameters

virtual void SelectSource(double &meanPEs, double gradients[6], double &emissionPointDistance, double &geoTime, const PhotonicsSource &source, bool getAmp = true)

Select source.

Select a source, set the time distribution parameters for later calls to the timing methods, and return both the mean number of expected photoelectrons and the gradient at the previously selected OM.

Parameters:
  • meanPEs[out] Mean number of expected photoelectrons

  • gradients[out] Gradient along source position (x, y, z), direction (theta, phi), and energy

  • emissionPointDistance[out] Distance from nominal light emission point to OM

  • geoTime[out] Geometric photon arrival time

  • source[in] Source parameters

  • getAmp[in] If false, set both meanPEs and gradients to zero.

virtual void GetTimeDelay(double random, double &timeDelay)

Time residual.

Get the residual time of a hit with respect to direct propagation from the nominal light emission point.

Warning

This derived method is not implemented, because an implementation makes no sense here, and raises an exception.

Parameters:
  • random[in] Uniformly distributed random number

  • timeDelay[out] Residual time

virtual void SelectSource(double &meanPEs, double &emissionPointDistance, double &geoTime, PhotonicsSource const &source, double &rho_radial_dist)
virtual void SelectSource(double &meanPEs, double gradients[6], double &emissionPointDistance, double &geoTime, PhotonicsSource const &source, double &rho_radial_dist, bool getAmp = true)
virtual void UpdateInternalParams(PhotonicsSource const &source, double saved_meanamp)
virtual void GetTimeDelays(I3RandomServicePtr random, double timeDelays[], int numSamples)

Time residuals.

Sample residual times of hits with respect to direct propagation from the nominal light emission point.

Parameters:
  • random[in] Random number generator

  • timeDelays[out] Sequence of residual times of size n

  • numSamples[in] Number of residual times to sample

virtual void GetProbabilityDensity(double &density, double timeDelay)

Photon detection probability density.

Get the photon detection probability density for a previously selected OM/source combination.

Parameters:
  • density[out] Photon detection probability density for the given residual time

  • timeDelay[in] Residual time

virtual bool GetProbabilityQuantiles(double timeEdges[], double timeDirect, double timeProbs[], size_t numBins)

Photon detection probability.

Get the photon detection probability for a previously selected OM/source combination.

Parameters:
  • timeEdges[in] Sequence of bin edges along time; size of numBins + 1

  • timeDirect[in] Direct time: time at which not-scattered photons from the source would reach the DOM.

  • timeProbs[out] Sequence of photon detection probabilities; size of numBins

  • numBins[in] Number of bins along time

Returns:

A boolean specifying if the calculation was successful.

virtual bool GetProbabilityQuantiles(double timeEdges[], double timeDirect, double timeProbs[], double gradients[][6], size_t numBins)

Photon detection probability.

Get the photon detection probability and gradients for a previously selected OM/source combination.

Parameters:
  • timeEdges[in] Sequence of bin edges along time; size of numBins + 1

  • timeDirect[in] Direct time: time at which not-scattered photons from the source would reach the DOM.

  • timeProbs[out] Sequence of photon detection probabilities; size of numBins

  • gradients[out] Gradient along source position (x, y, z), event time, and source direction (theta, phi) for each bin along time; size of numBins along first dimension

  • numBins[in] Number of bins along time

Returns:

A boolean specifying if the calculation was successful.

virtual bool GetMeanAmplitudeGradient(double gradient[6])

Mean amplitude gradient.

Get the gradient of the number of expected photoelectrons for the previously selected OM/source combination.

Parameters:

gradient[out] Gradient along source position (x, y, z), direction (theta, phi), and energy.

Returns:

A boolean specifying if the calculation was successful.

virtual bool GetMeanAmplitudeHessian(double gradient[6], double hessian[6][6])

Mean amplitude Hesse matrix.

Get both the gradient and the Hesse matrix of the number of expected photoelectrons for the previously selected OM/source combination.

Parameters:

gradient, hessian[out] Gradient and Hesse matrix along source position (x, y, z), direction (theta, phi), and energy

virtual bool GetProbabilityQuantileGradients(double timeEdges[], double timeDirect, double gradients[][6], size_t numBins)

Photon detection probability gradient.

Get the gradient of the photon detection probability for the previously selected OM/source combination.

Parameters:
  • timeEdges[in] Sequence of bin edges along time; size of numBins + 1

  • timeDirect[in] Direct time: time at which not-scattered photons from the source would reach the DOM.

  • gradients[out] Gradient along source position (x, y, z), event time, and source direction (theta, phi) for each bin along time; size of numBins along first dimension

  • numBins[in] Number of bins along time

virtual bool GetProbabilityQuantileHessians(double timeEdges[], double timeDirect, double timeProbs[], double gradients[][6], double hessians[][6][6], size_t numBins)

Photon detection probability Hesse matrix.

Get both the gradient and the Hesse matrix of the photon detection probability for the previously selected OM/source combination.

Parameters:
  • timeEdges[in] Sequence of bin edges along time; size of numBins + 1

  • timeDirect[in] Direct time: time at which not-scattered photons from the source would reach the DOM.

  • timeProbs[out] Sequence of photon detection probabilities; size of numBins

  • gradients, hessians[out] Gradient and Hesse matrix along source position (x, y, z), event time, and source direction (theta, phi) for each bin along time; size of numBins along first dimension

  • numBins[in] Number of bins along time

int TableCDFEval(double *coordinates, double *result)
int TableCDFEvalHessian(double *coordinates, double result[6][6])
int TableCDFEvalGradients(double *coordinates, double *results)
void BasicDensityGrad(double tablecoordinates[6], int centers[6], double *gradient)
void BasicDensityHessian(double tablecoordinates[6], int centers[6], double result[6][6])
void BasicCDFGrad(double tablecoordinates[6], int centers[6], double *gradient)
void BasicCDFHessian(double tablecoordinates[6], int centers[6], double result[6][6])
virtual void GetCDF(double &cdf, double timeDelay)
virtual bool GetCDFGradient(double gradient[6], double timeDelay)
virtual bool GetCDFGradnHessian(double cdf_grad[6], double cdf_hessian[6][6], double timeDelay)
virtual bool GetProbabilityDensityGradient(double gradient[6], double timeDelay)
virtual bool GetProbabilityDensityGradnHessian(double density_grad[6], double density_hessian[6][6], double timeDelay)
int TableEval(double *coordinates, double *result)
int TableEvalHessian(double *coordinates, double result[6][6])
int TableEvalGradients(double *coordinates, double *results)
int TableDensityEval(double *coordinates, double *result)
int TableDensityEvalHessian(double *coordinates, double result[6][6])
int TableDensityEvalGradients(double *coordinates, double *results)
virtual void GetKnotVector(double *knots, int dim)
virtual void GetTimeExtent(double *ext)
bool CheckSupport(double tableCoords[6]) const

Check if the table coordinates are supported.

Check if the given table coordinates are within the tables’ extents.

Parameters:

Table[in] coordinates

Returns:

A boolean specifying if the given table coordinates are supported.

template<typename Float>
I3PhotoSplineService::evaluator<Float> *GetEvaluator(I3PhotoSplineService::splinetable *table) const

Protected Functions

template<typename T>
evaluator<T> *GetEvaluator(splinetable*) const
SET_LOGGER ("I3PhotoSplineService")

Protected Attributes

splinetable *amplitudeSplineTable_

Amplitude spline table.

splinetable *timingSplineTable_

Timing spline table.

splinetable *effectiveDistanceSplineTable_

Effective distance spline table.

splinetable *effectiveDistanceSplineTableProb_

Effective distance spline table for timing.

splinetable *effectiveDistanceSplineTableTmod_

Effective distance spline table for timing shift.

std::unique_ptr<bi::managed_shared_memory> tableStorage_

Keep raw pointers to the spline tables in a shared memory storage.

evaluators<float> floatEvaluators_
evaluators<double> doubleEvaluators_

Private Functions

bool CheckSupport(double tableCoords[6], const splinetable *spline) const
virtual bool LoadSplineTables(const std::string &ampFileName, const std::string &timeFileName, const std::string &effdFileName, const std::string &effdProbFileName, const std::string &effdTmodFileName, double timingSigma = 0.)

Load spline-interpolated photonics tables.

Load spline-interpolated photonics tables stored in FITS files either from disk or from shared memory.

Parameters:
  • ampFileName[in] Path to amplitude spline table

  • timeFileName[in] Path to timing spline table

  • timingSigma[in] Smear the arrival time distribution with a B-spline of order 1 and this standard deviation.

Returns:

A boolean specifying if the loading was successful

void FillTableCoordinates(double tableCoords[6], const PhotonicsSource &source, bool timing)

Fill table coordinates.

Fill an array of table coordinates, given a previously selected OM/source combination, for evaluating the spline tables.

Parameters:
  • tableCoords[out] Table coordinates

  • timing[in] Add time as a dimension to the table coordinates; the index is taken from the timeAxis_ member.

void ConvertMeanAmplitudeGradient(double rawGradient[6], double gradient[6], const PhotonicsSource &source)

Conversion of mean amplitude gradient.

Convert the gradient obtained from the evaluation of the amplitude spline table from table to source coordinates.

Parameters:
  • rawGradient[in] Gradient along table coordinates

  • gradient[out] Gradient along source position (x, y, z), direction (theta, phi) and energy

  • source[in] Source parameters

void ScaleMeanAmplitudeGradient(double gradient[6], const double &rawYield, const double &meanPEs, const PhotonicsSource &source)

Scaling of mean amplitude gradient.

Scale the gradient obtained from the evaluation of the amplitude spline table, converted to source coordinates, with the mean number of expected photoelectrons.

Parameters:
  • gradient[inout] Gradient along source position (x, y, z), direction (theta, phi), and energy

  • rawYield[in] Light yield obtained from the evaluation of the amplitude spline table; needed for the scaling of the gradient component along energy.

  • meanPEs[in] Mean number of expected photoelectrons

void FillJacobian(double jac[6][6], const PhotonicsSource &source, bool timing)
bool ApplyEffectiveDistance(bool timing)
void SampleTimeDelays(double timeDelays[], int numSamples, I3RandomServicePtr random)

Time residuals.

Sample residual times from the timing spline table by using the Pandel distribution as a proposal distribution.

Parameters:
  • timeDelays[out] Sequence of residual times of size samples

  • samples[in] Number of residual times to sample

  • random[in] Random number generator

Private Members

int geotype_

Geometric type of spline tables: point source or infinite muon.

unsigned timeAxis_

Time axis corresponding to the geometry type; the time dimension is along the 3rd or 2nd for a point source or a infinite muon track, respectively.

double maxRadius_

Maximum expected distance for detected light from emitter.

double cosAziMin_

Range of table azimuth angles to clamp.

double cosAziMax_
I3IceLayerTilt tilt_

Optional: correct z-coordinates for the tilt in the ice layers.

double quantileEpsilon_

Optional: switch to double precision when quantiles are within this epsilon of 1. If 0, all evaluations use single precision. If > 0, densities, gradients, and hessians of the time distribution use double precision.

double meanPEs_

Cached mean number of expected photoelectrons.

PhotonicsSource lastSource_

Cache the last requested source.

double effectivedistancecoordinates_[4]

Effective distance coordinates for possible ice anisotropy and tilt correction.

double rawYield_

Cached unscaled number of photoelectrons.

double geoTime_

Cached geometric time.

double photonicsCoords_[4]

Cached photonics input parameters.

struct Interp_type

Public Members

double f[TWO_POWER_VARS]
int bin[VARS][2]
unsigned short mask
photonics::ph_short dummy_A
photonics::ph_int dummy_B
struct Io_type

Structure for storing offsets need for data retreival.

Public Members

photonics::ph_size_t h_offset

Header size in bytes

photonics::ph_size_t offset[VARS]

Byte offset for each binning variable

photonics::ph_int n_chunk

Number of elements in one data chunk

photonics::Header_type *h

Pointer to header of opened file

struct Level2_data_type

Public Members

float *cont

Pointer to data table

photonics::ph_size_t offset[L2VARS]

Array encoding size of each subtable

struct Level2_geo_type

this is not written to disk, format therefore changable

Public Members

photonics::ph_int n[L2VARS]

Number of bins in each dimension

double d[L2VARS]

Bin size for all dimensions

double *edge[L2VARS]

Bin edges for fast binary search of table location

double *times

representing point for each time bin.

struct Level2_header_type

Public Members

photonics::MetaHead_type MetaHead
char dummy_padding[28]

not used

float gausconv

convolved with gausian of this width

float ref_np

phase refractive index used for true <&#8212;> residual calc

float ref_ng

phase refractive index used for true <&#8212;> residual calc

bool dummy_a

NOT USED

photonics::source_type source

Emission source type

bool dummy_b

NOT USED

float dummy_c1

Step for photon tracking (m)

float e

Shower energy for shower sources in (GeV)

float dummy_c2

NOT USED

float theta

Source axis zenith angle

float dummy_c3[2]

NOT USED

geo_type dummy_d

NOT USED

photonics::ph_int n[VARS]

Number of bins in each dimension

float range[L2VARS][2]

Recordable limits for each dimension

float dummy_range[VARS - L2VARS][2]

NOT USED

float dummy_e[VARS][2]

NOT USED

float z0

depth of active volume center wrt ice table

photonics::scale_type d_scale

distance scaling parameter

photonics::scale_type t_scale

time scaling parameter

float lambda

light wavelength, or spectral “index”

photonics::ph_int efficiency

Efficinency calibrations applied

photonics::ph_int dummy_e2

NOT USED

photonics_l2_table_flavor type

Table type

photonics::ph_long n_dummy_f1

NOT USED

photonics::scale_type l_scale

lengthwize scaling parameter

photonics::time_ref_type tref

Timing reference

struct Level2_interp_type

Public Members

double f[L2_INTERP_BINS]

Interpolation weight

int bin[L2VARS][2]

Bins used in linear interpolation

unsigned short mask

Interpolation mask

photonics::ph_short dummy_A
photonics::ph_int dummy_B
struct Level2_read_type

Public Members

float val[L2VARS]

Physical coords of interest

int bin[L2VARS]

Corresponding bin for physical coord

int n[L2VARS]

Number of bins in each dimesnion

unsigned short interp_mask

Bin interpolation mask

float lowEdge[L2VARS]

Physical value of lower edge of a bin

photonics::ph_int dummy_A

NOT USED

float binSize[L2VARS]

Physical size of a bin

photonics::ph_int dummy_B

NOT USED

struct MetaHead_type

Public Members

char File_Format_Label[4]
ph_tiny File_Format_Revision

currently 0

ph_tiny dummy0

future high byte for revision

ph_tiny bitsys
ph_tiny endian

endian = 1 is little, 2 is big

ph_tiny level
ph_tiny dummy2
ph_tiny dummy3
ph_tiny dummy4
char Photonics_Version[32]
char dummy_padding[40]

not used

struct Mid_type

Public Members

double cosine

Cosine of mid point value

double sine

Sine of mid point value

struct Opt_type

Structure for runtime configuration data.

Public Members

bool long_run
char in_file_name[MAXLINE]
char out_file_name[MAXLINE]
char ice_file_name[MAXLINE]
char eff_file_name[MAXLINE]
char tmp_out_file_name[MAXLINE]
double flasher_theta[12]

holds configuration for flasher board source

double flasher_phi[12]
photonics::ph_int active_number

the number of flashers turned on for a flasher board source

photonics::ph_int dummy_padding

NOT USED

bool hole_ice

hole ice cylinder around source is either on or off

double hole_ice_r

radius of hole ice cylinder

double hole_scattering

scattering length for the hole ice

struct PhotonicsSource

A type for passing the light source parameters.

Public Functions

PhotonicsSource()
PhotonicsSource(const I3Particle&)

Fill a PhotonicsSource struct from an I3Particle.

PhotonicsSource(double x, double y, double z, double zenith, double azimuth, double speed, double length, double Energy, int type)

Fill a PhotonicsSource struct from basic quantities.

Parameters:
  • x, y, z – Source coordinates (metres)

  • zenith, azimuth – Direction which source points from (degrees)

  • speed – Particle speed (fraction of c)

  • Energy – Energy (GeV)

  • length – Source length (zero for point source) (metres)

  • type – Source type (0=muon, 1=EM cascade)

Public Members

double x

Coordinates of source.

double y
double z
double dirx

Direction source is pointing.

double diry
double dirz
double perpx

Perpendicular vector.

Unit vector perpendicular to source direction and pointing a close to vertically upwards as possible.

double perpy
double perpz
double sintheta

Decomposition of source direction.

double costheta
double sinphi
double cosphi
double zenith

Zenith angle angle source is pointing away from (zero if pointing vertically down)

double E

Energy (or energy per metre) of source particle.

The energy is used to re-scale the light output appropriately. For cascade tables the re-scaling is linear in the cascade energy. For level 2 lineshower tables (“light-sabres”), with cascades uniformly distributed along the track, this implies that the re-scaling gives the light output for a deposited energy E per metre. This is not true for level 2 muon tables, since for such tables the re-scaling is based on the muon energy, and includes the effects of the continuous energy loss.

double length

Length of source.

double speed

Speed of source, as a fraction of c.

int type

Photonics type (0=muon,1=EM cascade).

This refers to the photonics definitions (in photoamasim.h and light.c): MUON=0, EMS=1, HADS=2 photonics-service knows about these three types and uses the photonics light() function to calculate the light output.

Note, however, that as of December 2008 there are no hadronic tables, and the EM tables are used also for hadronic cascades, but with corrections applied externally by photonics-service.

For types outside the range 0,1,2 no conversion from table content to light output is made. In addition, for such types level1 EM tablesi are generally assumed. For certain “known types” different from 0 and 1, however, photon tables can be generated, and in this case the “known type” will be passed to photonics. These “known types” are currently 9,10,11,12 and have been used for monopole tables.

Photonics also defines the following source_type enumeration: ISOTROPIC = 1,CHERENKOV = 2,BEAMED = 3,COSTHETA = 4, EM_SHOWER = 5, HAD_SHOWER= 6, FLASHER_LED=7, FLASHER_BOARD=8. but these are not used here.

struct pref_level1_t

behaviour control

Public Members

int zedgelimiting

Use lowest/highest z directly if track below/above

int greetingdone
double external_ref_ng

the interface defines residual time by using this

double z_load_offset

add z offset to the z coordinates as the tables are loaded

struct pref_level2_t

behaviour control

Public Members

int zl_matching

Try to find best z/l table combination

int zedgelimiting

Use lowest/highest z directly if track below/above

int greetingdone
double external_ref_ng

the interface defines residual time by using this

struct Read_type

Public Members

float val[VARS]
int bin[VARS]
int n[VARS]
unsigned short interp_mask
photonics::ph_short dummy_A
float binCenter[VARS]
photonics::ph_int dummy_B
float binSpacing[VARS]
photonics::ph_int dummy_C
struct Region_type

Public Members

Edge_type high

< region info High edge info

Edge_type low

Low edge info

Mid_type mid

Mid value info, used for angular bins

struct Tableset_level1_container_type

A level1 tableset container contains several level1 table sets.

mytablesets_levbel2 is a static global which is intended to handle any number of tablesets.

The struct members are:

  • current : index of current tableset

  • n_tablesets : total number of tablesets initialized

  • tableset : an array of tablesets [0,…,n_tablesets-1]

Public Members

unsigned int current
unsigned int n_tablesets
double request_angle_limit_low
double request_angle_limit_high
double request_depth_limit_low
double request_depth_limit_high
Tableset_level1_type *tableset
struct Tableset_level1_type

Public Members

Amasim_Table_Type *table
photonics::Geo_type *geo
photonics::Header_type *header
unsigned long memused
unsigned long memforset
int photorec_mode

option for the photorec functionallity

int *n_tables
double z_src_max

highest valid z_src

double z_src_min

highest valid z_src

double a_src_max
double a_src_min
int n_z_layers

number of z layers in this tableset

int dummy_A

not used

int *z_layer_index

indeces to first table of each z layer

int *z_layer_n_thetas

number of angles in each z layer

double *z_layer_centers

central z value in each z layer

struct Tableset_level2_container_type

A level2 tableset container contains several level2 table sets.

mytablesets_levbel2 is a static global which is intended to handle any number of tablesets.

The struct members are:

  • current : index of current tableset

  • n_tablesets : total number of tablesets initialized

  • tableset : an array of tablesets [0,…,n_tablesets-1]

Public Members

int current
int n_tablesets
double request_angle_limit_low
double request_angle_limit_high
double request_depth_limit_low
double request_depth_limit_high
Tableset_level2_type *tableset
struct Tableset_level2_type

Public Members

Amasim_Level2_Table_type *table
Level2_geo_type *geo
Level2_header_type *header
tableset_type type
unsigned long memused
unsigned long memforset
double last_probcalc
double delay_probcalc

time used by probcalc, must be in internal format

int photorec_mode

option for the photorec functionallity

int pair_id
int *n_tables
double z_src_max

highest valid z_src

double z_src_min

highest valid z_src

double a_src_max

highest valid a_src

double a_src_min

highest valid a_src

double ref_dist

reference distance, distance of influence in l

double ref_dist_fraction

tiny fraction of ref_dist

int n_z_layers

number of z layers in this tableset

double inv_sin_ch

inverted sin cherenkov angle

int *z_layer_index

indeces to first table of each z layer

int *z_layer_n_thetas

number of angles in each z layer

double *z_layer_centers

central z value in each z layer

namespace [anonymous]
namespace [anonymous]
namespace [anonymous]
namespace [anonymous]
namespace [anonymous]
namespace I3DummyPhotonics

A few parameters to describe response. Only very roughly tuned to give results which are not entirely unreasonable.

Variables

const double B = 1. / 22.
const double A = 2.1
const double C = 0.016
const double TAU = 400
const double T0SLOPE = 8
namespace I3MPConst

Functions

const double ALPHA_2_PI (2.*I3Constants::pi/137.)

The fine structure constant times 2 pi

const double LAMBA_0 (300.*I3Units::nanometer)

The lower and upper integration limits of the Cherenkov spectrum. This needs to match the simulation range used in photonics.

const double LAMBA_1 (600.*I3Units::nanometer)

Variables

const double G = 68.5

Monopole Charge. Units of e. The charge is 2*pi*h_bar*c/e

const double Z_SQUARED = pow(G * I3Constants::n_ice_phase, 2)

The charge number of the particle. Note that phase index needed

const double MP_FACTOR = ALPHA_2_PI * Z_SQUARED * (1. / LAMBA_0 - 1. / LAMBA_1)

This is the constant factor in the Cherenkov radiation formula including the integration over wavelength. The product of this times the speed dependent factor gives the number of photons emitted per unit length.

const double BETA_TYPE9 = 1.0

Photonics track type boundaries

const double BETA_TYPE10 = 0.9
const double BETA_TYPE11 = 0.8
const double BETA_TYPE12 = 0.76
const double BETA_TYPE13 = 0.02
namespace I3PhotonicsCommons

Functions

double scaleLightYield(const PhotonicsSource &s, double rawYield, double energy = -1, unsigned derivative = 0)

Light yield parametrization from ChW. Copied from photonics code.

void fillJacobian(const double &xOM, const double &yOM, const double &zOM, const double &r, const double &rho, const double &cosAzi, const double &l, const PhotonicsSource &source, double jac[6][6], const geo_type geometry = CYLINDRICAL, const parity_type parity = EVEN, const double n_group = nGroup)
void fillJacobianInfiniteMuon(const double &xOM, const double &yOM, const double &zOM, const double &r, const double &rho, const double &cosAzi, const double &l, const PhotonicsSource &source, double jac[6][6], const geo_type geometry, const parity_type parity, const double n_group)
void transformJacobianEffectiveDistance(const double &xOM, const double &yOM, const double &zOM, const PhotonicsSource &source, double jac[6][6], double transgradient[5], const geo_type geometry = SPHERICAL, double tmodgradient[5] = nullptr)
void fillHessian(const double &xOM, const double &yOM, const double &zOM, const double &r, const double &rho, const double &cosAzi, const double &l, const PhotonicsSource &source, double jac[6][6], double hess[6][6][6], const geo_type geometry = CYLINDRICAL, const parity_type parity = EVEN, const double n_group = nGroup)
void fillHessianInfiniteMuon(const double &xOM, const double &yOM, const double &zOM, const double &r, const double &rho, const double &cosAzi, const double &l, const PhotonicsSource &source, double jac[6][6], double hess[6][6][6], const geo_type geometry, const parity_type parity, const double n_group)

Variables

static const double nPhase = 1.3195
static const double nGroup = 1.35634
static const double cVacuum = 0.299792458
static const double default_unshadowed = 0.94
static const double default_domeff = 1.
namespace photonics

Namespace for putting functions used by both the L1 and L2 photonics readers.

Typedefs

typedef int8_t ph_tiny
typedef int16_t ph_short
typedef int32_t ph_int
typedef int32_t ph_size_t
typedef long long ph_long

Enums

enum source_type

Values:

enumerator ISOTROPIC
enumerator CHERENKOV
enumerator BEAMED
enumerator COSTHETA
enumerator EM_SHOWER
enumerator HAD_SHOWER
enumerator FLASHER_LED
enumerator FLASHER_BOARD
enumerator FLASHER_BOARD_WITH_HOLE_ICE
enumerator STANDARD_CANDLE_WITH_HOLE_ICE
enumerator STANDARD_CANDLE_DOWNWARDS_WITH_HOLE_ICE
enum scale_type

Values:

enumerator LINEAR
enumerator QUADRATIC
enum time_ref_type

Values:

enumerator ORIGIN
enumerator POCA
enumerator DIRECT

Functions

double next_boundary_sqr(const double base, const double step)
void copy_header(const Header_type*, Header_type*)

Copies header info.

bool checkMetaHeadLittle(MetaHead_type *MetaHead)

true if the examined meta head is little endian

bool checkMetaHead32bit(MetaHead_type *MetaHead)

true if the examined meta head is written on 32 bit machine

bool checkMetaHead_back(MetaHead_type *MetaHead, int verbose)
bool checkMetaHead(MetaHead_type *MetaHead)

true if the examined meta head is written on 32 bit machine

double residual_convert(double ind_old, double ind_new, double time_old, double rho, double l, double rev_sin_ang, time_ref_type REFTYPE)

Convert a residual time from one group index of refraction to another.

Parameters:
  • ind_old – refractive index for input timedelay

  • ind_new – refractive index to convert timedelay into

  • time_old – residual time in ind_old sens

  • rho – perpendicular distance track origin&#8212;OM

  • l – longitudinal distance track origin&#8212;OM

  • rev_sin_ang – 1/(sin(cherenkov_angle))

  • REFTYPE – type of residual calculation

Returns:

residual time, as if it would have been calculated with group refractive ind_new.

int binary(const float*, int, double)

Binary search of an integrated probability distribution.

int find(const double*, int, double, int)

Modified hunt routine from NR, for seeded binary search.

IMPORTANT: If array is sorted from low to high, bins are defined as [low_edge,high_edge). If sorted from high to low, then bins are (low_edge,high_edge]. E.g. array={-1,0,1} find with key=0 returns 1, i.e. 0 is in [0,1) array={1,0,-1} find with key=0 returns 0, i.e. 0 is in (-1,0]

Note

n is the highest allowed index. that is, (nbins-1) this function does not work when n=0;

bool isLittleEndian(void)

Functions for determination of supported environment.

int memlength()
int ph_long_length()
bool is32bitMemory()
bool is64bitMemory()
bool isSupportedEnvironment()
void px_swap32(void *p_swapit_)

32 bit byte swapping. bytes ABCD -> DCBA.

Operates directly on p_swapit_

void px_swap64(void *p_swapit_)

64 bit byte swapping. bytes ABCD EFGH -> DCBA HGFE

Because the type is actually ‘long long’ Operates directly on p_swapit_

namespace std

STL namespace.

file geo_type.h

Defines

PHOTONICS_PHOTONICS_H_ENUM_PARITY_TYPE_ENUM_DEFINED

Enums

enum geo_type

Values:

enumerator SPHERICAL
enumerator CYLINDRICAL
enumerator CUBIC
enum parity_type

Values:

enumerator EVEN
enumerator ODD
file I3DummyPhotonicsService.cxx
#include <iostream>
#include <ostream>
#include <cmath>

Implementation of class I3DummyPhotonicsService.

Author

Klas Hultqvist

Version

$Id$

Date

$Date$ (c) the IceCube Collaboration

Defines

BACKWARD
file I3DummyPhotonicsService.h

I3DummyPhotonicsService A class which re-implements methods from I3PhotonicsService with dummy ones which do not use photonics tables.

Author

Klas Hultqvist

Version

$Id$

Date

$Date$ (c) the IceCube Collaboration *

Functions

I3_POINTER_TYPEDEFS(I3DummyPhotonicsService)

Definitions of shared pointers.

file I3IceLayerTilt.cxx
#include <cmath>
#include <fstream>
#include <iostream>
#include <vector>
#include <boost/algorithm/clamp.hpp>
#include “icetray/I3Logging.h”
file I3IceLayerTilt.h
#include <string>

I3IceLayerTilt A class for calculating ice layer tilt.

Author

Dmitry Chirkin (c) the IceCube Collaboration

Defines

LMAX
LYRS
CTX
CTY
DIR1
DIR2
file I3MPConstants.h
#include “dataclasses/I3Constants.h”
file I3PhotonicsHitMaker.cxx
#include <phys-services/I3RandomService.h>
#include <dataclasses/physics/I3Particle.h>
#include <simclasses/I3MCPE.h>
#include <dataclasses/physics/I3MCTree.h>
#include <dataclasses/geometry/I3Geometry.h>
#include <dataclasses/calibration/I3Calibration.h>
#include <dataclasses/status/I3DetectorStatus.h>
#include “sim-services/I3SimConstants.h”
#include <icetray/I3Module.h>
#include <boost/foreach.hpp>

Functions

I3_MODULE(I3PhotonicsHitMaker)
static inline bool operator<(const I3MCPE &a, const I3MCPE &b)
file I3PhotonicsL1Reader.cxx
#include <cmath>
#include <cstdio>
#include <cerrno>
#include <cstring>
#include <cassert>
#include <sys/types.h>
#include <sys/user.h>
#include <sys/mman.h>
#include “icetray/I3Logging.h”
#include “dataclasses/I3Constants.h”

This file for code for reading level1 photonics tables.

The following is a list of files from photonic which I copied verbatium to create this file:

  • photonics-1.73/amasim/photoamasim.h

  • photonics-1.73/lib/reader.h

  • photonics-1.73/lib/reader.c

  • photonics-1.73/lib/io.c

  • photonics-1.73/amasim/table_io.c

Non functioning code was removed, comments cleaned up
Author

Kevin Meagher

Author

Johan Lundberg

Author

P. Miocinovic

Author

RCB

Author

KWW

Version

$Id$

Date

$Date$

For documentation of photonics files see http://photonics.sourceforge.net/index.php

Copyright

Copyright (c) The IceCube Collaboration

Defines

ABS_EXT
PROB_EXT
MAX_TABLES
MUON
EMS
HADS
INTERP_BINS
INTERP_NONE
INTERP_PRIMARY
INTERP_SECONDARY
INTERP_TERTIARY
INTERP_EMISSION
INTERP_ARRIVAL
INTERP_TIME
MESSAGE_CYCLE
L1_INTERP_DEPTH
L1_INTERP_ANGLE
file I3PhotonicsL1Reader.h

This header file contains a class for reading photonics level1 tables.

The following is a list of file from photonic-1.73 which I copied verbatium to create this header file:

  • photonics-1.73/lib/photonics.h

  • photonics-1.73/lib/reader.h

  • photonics-1.73/amasim/table_io.c

  • photonics-1.73/amasim/photoamasim.h

For documentation of photonics files see http://photonics.sourceforge.net/index.php
Author

Kevin Meagher

Author

Johan Lundberg

Author

P. Miocinovic

Author

RCB

Author

KWW

Version

$Id$

Date

$Date$

Copyright

Copyright (c) The IceCube Collaboration

file I3PhotonicsL2Reader.cxx
#include <cmath>
#include <cstdio>
#include <cerrno>
#include <cstring>
#include “icetray/I3Logging.h”
#include “dataclasses/I3Constants.h”

Class for Reading Photonics Level2 files for use with photonics-service.

This file contains a cleaned up version of:

  • photonics-1.73/level2/level2_photonics.h:

  • photonics-1.73/level2/level2_reader.h

  • photonics-1.73/level2/light.c

  • photonics-1.73/level2/photonicsCPPio.cxx

  • photonics-1.73/level2/level2_table_io.c

  • photonics-1.73/level2/level2_reader.c

This file contains user functions for loading and reading level2 photonics tables. Level2 historically ment muons, but it is now enhanced to treat any kind of light source.
Author

Kevin Meagher

Author

Johan Lundberg

Author

P. Miocinovic

Version

$Id$

Date

$Date$

For documentation of photonics files see http://photonics.sourceforge.net/index.php

Copyright

Copyright (c) The IceCube Collaboration

Defines

L2_EXT_LISTMARKSTOP
L2_EXT_LISTMARKSTART
L2_EXT_LISTMARKPHOTOREC
L2_INTERP_NONE
L2_INTERP_PRIMARY

l

L2_INTERP_SECONDARY

rho

L2_INTERP_TERTIARY

phi

L2_INTERP_TIME

time:

L2_INTERP_DEPTH

depth: 16

L2_INTERP_ANGLE

theta: 32

MUON
EMS
HADS
photons

Cerenkov photons per meter in 300 - 600 nm range

ERROR_MARGIN

Allowable numerical error for temp array

file I3PhotonicsL2Reader.h

Class for Reading Photonics Level2 files for use with photonics-service.

This file contains a cleaned up version of:

  • photonics-1.73/level2/level2_table_io.h

  • photonics-1.73/level2/photonicsCPPio.h

  • photonics-1.73/level2/level2.h

This file contains user functions for loading and reading level2 photonics tables. Level2 historically ment muons, but it is now enhanced to treat any kind of light source.
Author

Kevin Meagher

Author

Johan Lundberg

Author

P. Miocinovic

Version

$Id$

Date

$Date$

For documentation of photonics files see http://photonics.sourceforge.net/index.php

Copyright

Copyright (c) The IceCube Collaboration

Defines

L2VARS
L2_INTERP_BINS

2**(L2VARS-1) 8 means: rho,l,phi depth, theta and time is done on the side

file I3PhotonicsReader.cxx
#include <cmath>
#include <cstring>
#include <stdint.h>
#include <sys/mman.h>
#include “dataclasses/I3Constants.h”
#include “icetray/I3Logging.h”

This file for code for reading both L1 and L2 photonics tables.

The following is a list of files from photonic which I copied verbatium to create this file:

  • photonics-1.73/lib/photonics.h

  • photonics-1.73/lib/geometry.c

  • photonics-1.73/lib/io.c

  • photonics-1.73/lib/misc.c

Non functioning code was removed, comments cleaned up
Author

Kevin Meagher

Author

Johan Lundberg

Author

P. Miocinovic

Author

RCB

Author

KWW

Version

$Id$

Date

$Date$

For documentation of photonics files see http://photonics.sourceforge.net/index.php

Copyright

Copyright (c) The IceCube Collaboration

Defines

Max(x, y)
Min(x, y)
FILE_FORMAT_LABEL
FILE_FORMAT_REVISION

file format 0 is valid from version 1.4.1

file I3PhotonicsReader.h

Defines

MAX_TABLES
photonics_reader_InF
EPS

small value to avoid round off errors

MAXLINE
VARS

Number of dimensions used.

TWO_POWER_VARS

2**VARS

PHOTONICS_VERSION
HEADER_TYPE_LENGTH
sqr(x)
Rad(x)
Deg(x)
file I3PhotonicsService.cxx
#include <icetray/I3Units.h>
#include <dataclasses/geometry/I3OMGeo.h>
#include “I3MPConstants.h

Implementation of class I3PhotonicsService.

Author

Klas Hultqvist

Version

$Id$

Date

$Date$ (c) the IceCube Collaboration

file I3PhotonicsService.h
#include <icetray/I3Logging.h>
#include <icetray/I3PointerTypedefs.h>
#include <dataclasses/physics/I3Particle.h>
#include <phys-services/I3RandomService.h>
#include <string>
#include <cfloat>
#include <cmath>
#include <vector>

I3PhotonicsService A class for accessing photonics tables.

Heavily modelled on PSInterface by Thomas Burgess, but with reduced generality (photonics only), error checking, and execution time. Methods using photonics are declared as virtual to enable re-implementation in derived dummy class.

Author

Klas Hultqvist

Version

$Id$

Date

$Date$ (c) the IceCube Collaboration

Functions

inline bool operator==(const PhotonicsSource &A, const PhotonicsSource &B)
I3_POINTER_TYPEDEFS(I3PhotonicsService)
I3_DEFAULT_NAME(I3PhotonicsService)
file I3PhotonicsServiceCollection.cxx
file I3PhotonicsServiceCollection.h
#include “dataclasses/geometry/I3OMGeo.h”
#include <icetray/I3ServiceBase.h>

I3PhotonicsServiceCollection A collection of I3PhotonicsService instances, dispatched to by OMType.

Author

Jakob van Santen (c) the IceCube Collaboration

Functions

I3_POINTER_TYPEDEFS(I3PhotonicsServiceCollection)
file I3PhotonicsServiceCommons.cxx
#include <string>
#include <cmath>
#include <float.h>
#include “icetray/I3Units.h”
#include “dataclasses/I3Constants.h”

implementations of I3PhotonicsServiceCommons.h

Author

Eike Middell (c) the IceCube Collaboration

file I3PhotonicsServiceCommons.h
#include “icetray/IcetrayFwd.h”

static methods that are common to several classes

Author

Eike Middell (c) the IceCube Collaboration

file I3PhotonicsServiceFactory.cxx
#include “icetray/I3Units.h”
#include “boost/make_shared.hpp”
#include “boost/filesystem/path.hpp”
#include “boost/filesystem/operations.hpp”

Implementation of class I3PhotonicsServiceFactory.

Author

Klas Hultqvist

Version

$Id$

Date

$Date$ (c) the IceCube Collaboration

Functions

I3_SERVICE_FACTORY(I3PhotonicsServiceFactory)
file I3PhotonicsServiceFactory.h
#include “icetray/I3ServiceFactory.h”
#include <boost/shared_ptr.hpp>
#include <string>

I3PhotonicsServiceFactory A class for creating an I3PhotonicsService object and making it available for use.

Author

Klas Hultqvist

Version

$Id$

Date

$Date$ (c) the IceCube Collaboration

file I3PhotonicsTableService.cxx
#include <sys/param.h>
#include <iostream>
#include <ostream>
#include <cmath>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_rng.h>
#include “icetray/I3Units.h”
#include “dataclasses/geometry/I3OMGeo.h”
#include “boost/filesystem.hpp”

Implementation of class I3PhotonicsTableService.

Author

Klas Hultqvist

Version

$Id$

Date

$Date$ (c) the IceCube Collaboration

Functions

path SwitchDir(const path newDir)
file I3PhotonicsTableService.h
#include <string>
#include <cmath>
#include <vector>

I3PhotonicsTableService A class for accessing photonics tables.

Heavily modelled on PSInterface by Thomas Burgess, but with reduced generality (photonics only), error checking, and execution time. Methods using photonics are declared as virtual to enable re-implementation in derived dummy class.

Author

Klas Hultqvist

Version

$Id$

Date

$Date$ (c) the IceCube Collaboration

Defines

BIGNUMBER

Functions

I3_POINTER_TYPEDEFS(I3PhotonicsTableService)
file I3PhotoSplineSampling.cxx
#include <algorithm>
#include <array>
#include <cmath>
#include <limits>
#include <random>
#include <vector>
#include <icetray/I3Logging.h>
#include <phys-services/I3RandomService.h>

Implementation of photo-spline service: residual time sampling

(c) 2017 the IceCube Collaboration $Id$

Date

$Date$

Author

Jakob van Santen

Enums

enum [anonymous]

Values:

enumerator POINTSOURCE
enumerator INFINITEMUON
file I3PhotoSplineService.cxx
#include <algorithm>
#include <cmath>
#include <chrono>
#include <limits>
#include <memory>
#include <string>
#include <thread>
#include <vector>
#include <boost/compute/detail/sha1.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/containers/string.hpp>
#include <boost/filesystem.hpp>
#include <gsl/gsl_randist.h>
#include <photospline/splinetable.h>
#include <unistd.h>
#include <icetray/I3Context.h>
#include <icetray/I3Logging.h>
#include <icetray/I3ServiceBase.h>
#include <icetray/I3SingleServiceFactory.h>
#include <icetray/I3Units.h>
#include <dataclasses/I3Constants.h>
#include <phys-services/I3RandomService.h>

Typedefs

using I3PhotoSplineServiceFactory = I3SingleServiceFactory<I3PhotoSplineService, I3PhotonicsService>

Enums

enum [anonymous]

Values:

enumerator POINTSOURCE
enumerator INFINITEMUON

Functions

I3_SERVICE_FACTORY(I3PhotoSplineServiceFactory)
file I3PhotoSplineService.h
#include <limits>
#include <memory>
#include <string>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <photospline/splinetable.h>
#include <icetray/I3Context.h>
#include <icetray/I3Logging.h>
#include <icetray/I3PointerTypedefs.h>
#include <icetray/I3ServiceBase.h>
#include <phys-services/I3RandomService.h>

Implementation of photo-spline service

(c) 2009 the IceCube Collaboration $Id$

Definition of photo-spline service

Date

$Date$

Author

Eike Middell

(c) 2009 the IceCube Collaboration $Id$

Date

$Date$

Author

Eike Middell

Functions

I3_POINTER_TYPEDEFS(I3PhotoSplineService)
file I3PhotoSplineServiceGradients.cxx
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <icetray/I3Logging.h>

Implementation of photo-spline service: gradient methods

(c) 2011 the IceCube Collaboration $Id$

Date

$Date$

Author

Jakob van Santen

Defines

WARN_UNLESS_SELECTABLE_PRECISION

Enums

enum [anonymous]

Values:

enumerator POINTSOURCE
enumerator INFINITEMUON
file index.dox
dir icetray
dir photonics-service
dir photonics-service
dir photonics-service
dir private
dir public
page index

Author

Klas Hultqvist

Description

This is the automatic documentation of the photonics-service project. Photonics-service provides the interface to access the photonics i/o functions from IceTray.

For specific information on classes or files, click the appropriate tab at the top of the page.

For wiki documentation, see http://wiki.icecube.wisc.edu/index.php/Photonics-service

Photonics is described in the paper: Light tracking through ice and water &#8212; Scattering and absorption in heterogeneous media with PHOTONICS J. Lundberg a, P. Miocinovic, K. Woschnagg, T. Burgess , J. Adams, S. Hundertmark, P. Desiati, P. Niessen, Nucl. Instr. and Meth. A, Volume 581, Issue 3, 1 November 2007, Pages 619-631 http://dx.doi.org/10.1016/j.nima.2007.07.143 free mirror: astro-ph/0702108

For more information on photonics, see http://photonics.sourceforge.net/index.php