1.    Introduction

The GECAM in-orbit response matrix is generated based on the GEANT4 simulation and the in-orbit detector response.

The code is written in PYTHON3.

2.    Download

GECAM CALDB v1.0

3.    Installation

User should add the path of CALDB into environment variable CALDB; and the path of CALDB software into environment variable PYTHONPATH. To add these environment variables, user can simply execute:

bash$ source CALDB_dir/ software/tools/caldbinit.sh

where CALDB_dir is the path of CALDB.

4.    Application 1: get the response matrix from the return value

Order

Code

Description

Parameters

Returns

1

from   RSP_Generator import gen_rsp

import   the function



2

ret_value   = gen_rsp(detname, theta, phi, event_type='evt',    particle='gamma', MET='now', temp=None,   hv=None)

call   the function

l    detname: detector name. such   as ‘bg01H’

l    theta: The theta angle of the   source. range [0,180]

l    phi: The phi angle of the   source. range [0,360)

l    event_type: the type of   events. ['evt'/'btime'/'bspec']

l    particle: the type of   particles.

l    MET: The mission elapsed   time, float type. 'now' will calculate the current mission elapsed time.

l    temp: Temperature. reserved   for future use.

l    hv: Temperature. reserved for   future use.

l    ret_value: A list of values.   If an error occurs, return None

3

final_rsp,   mc_energ_lo, mc_energ_hi, oo_e_min, oo_e_max, final_ebounds_infiles,   final_rsp_infiles = ret_value

extract   the response matrix


l    final_rsp: matrix, shape   (n_Ein, n_Edep)

l    mc_energ_lo: lower edge of MC   energies, shape (n_Ein,)

l    mc_energ_hi: upper edge of MC   energies, shape (n_Ein,)

l    oo_e_min: lower edge of   deposition energies, shape (n_Edep,)

l    oo_e_max: upper edge of   deposition energies, shape (n_Edep,)

l    final_ebounds_infiles: a list   of file paths relative to deposition energies

l    final_rsp_infiles: a list of   file paths relative to matrix


5.    Application 2: generate a response matrix in FITS format

Order

Code

Description

Parameters

Returns

1

from   RSP_Generator import gen_rsp_fits

import   the function



2

gen_rsp_fits(detname,   theta, phi, fits_filepath=None, fits_dir=None, is_overwrite=False,   event_type='evt',    particle='gamma',   MET='now', temp=None, hv=None, uid=None, src=None, version=None)

call   the function

l    detname: detector name. such   as ‘bg01H’

l    theta: The theta angle of the   source. range [0,180]

l    phi: The phi angle of the   source. range [0,360)

l    fits_filepath: The output   FITS filepath. If None, the filepath is automatically generated according to   GECAM definition1.

l    fits_dir: If fits_filepath is   None, the filepath is automatically generated according to GECAM definition1.

l    event_type: the type of   events. ['evt'/'btime'/'bspec']

l    particle: the type of   particles.

l    MET: The mission elapsed   time, float type. 'now' will calculate the current mission elapsed time.

l    temp: Temperature. reserved   for future use.

l    hv: Temperature. reserved for   future use.

l    uid: If fits_filepath is   None, the filepath is automatically generated according to GECAM definition1.

l    src: If fits_filepath is   None, the filepath is automatically generated according to GECAM definition1.

l    version: If fits_filepath is   None, the filepath is automatically generated according to GECAM definition1.

l    bool: is success?

1:   The definition of GECAM response matrix filepath is: fits_dir/detname_x_evt_Ttheta_Pphi_uid_src_vversion.rsp