MonteCarlo (mc)

Introduction

Module containing functions to analyze MC data and compute sensitivity curves.

Reference/API

lstchain.mc.mc Module

Functions

int_diff_sp(emin, emax, sp_idx, e0)

power_law_integrated_distribution(emin, ...)

For each bin, return the expected number of events for a power-law distribution.

rate(shape, emin, emax, param, cone, area)

Calculates the rate of events for a power-law distribution, in a given energy range, collection area and solid angle

weight(shape, emin, emax, sim_sp_idx, rate, ...)

Calculates the weight of events to transform a power-law distribution with spectral index sim_sp_idx to a power-law distribution with spectral index w_sp_idx

lstchain.mc.plot_utils Module

Functions

fill_bin_content(ax, sensitivity, ...)

Function to fill bin content to be plotted in the case of an optimized figure array

format_axes_array(ax, arr_i, arr_j, plot)

Format axes for the theta2 and gammaness optimization for a figure array with all energy bins together

format_axes_ebin(ax, img)

Format axes for the theta2 and gammaness optimization per energy bin

format_axes_sensitivity(ax)

Format axes of the sensitivity plot

plot_Crab_SED(emin, emax[, percentage, ax])

Plot a percentage of the Crab SED

plot_positions_survived_events(df_gammas, ...)

Plot positions of surviving events after cuts

plot_sensitivity(energy, sensitivity[, ax])

Plot the achieved sensitivity

sensitivity_minimization_plot(n_bins_energy, ...)

Plot the sensitivity minimization plots in different energy bins to check that the theta2 and gammaness cuts were properly applied

sensitivity_plot_comparison(energy, sensitivity)

Main sensitivity plot.

lstchain.mc.sensitivity Module

Functions

bin_definition(n_bins_gammaness, n_bins_theta2)

Define binning in gammaness and theta2 for the optimization of the sensitivity

calculate_sensitivity(n_excesses, ...)

Sensitivity calculation using n_excesses/sqrt(n_background)

calculate_sensitivity_lima(n_signal, ...)

Sensitivity calculation using the Li & Ma formula eq.

diff_events_after_cut(events, rates, ...)

This function calculates the difference between the number of events after the cut in feature and gamma_efficiency*total number of events

find_cut(events, rates, obstime, feature, ...)

Find cut in feature that corresponds to gamma efficiency.

get_weights(mc_par, spectral_par)

Calculate the weight to transform from MC spectra to target spectra

process_mc(dl2_file, mc_type)

Process the MC simulated and reconstructed to extract the relevant parameters to compute the sensitivity

process_real(dl2_file)

read_sim_par(file)

Read MC simulated parameters

ring_containment(angdist2, ring_radius, ...)

Calculate containment of cosmic ray particles with reconstructed positions within a ring of radius=ring_radius and half width=ring_halfwidth

samesign(a, b)

Check if two numbers have the same sign Parameters ---------- a: float b: float

sensitivity_gamma_efficiency(dl2_file_g, ...)

Main function to calculate the sensitivity for cuts based on gamma efficiency

sensitivity_gamma_efficiency_real_data(...)

Main function to calculate the sensitivity for cuts based on gamma efficiency using real data as ON and OFF events

sensitivity_gamma_efficiency_real_protons(...)

Main function to calculate the sensitivity for cuts based on gamma efficiency using real protons as background events