38#define G_NAXIS "GCTAEventCube::naxis(int)"
39#define G_ENERGY "GCTAEventCube::energy(int&)"
40#define G_SET_DIRECTIONS "GCTAEventCube::set_directions()"
41#define G_SET_ENERGIES "GCTAEventCube::set_energies()"
42#define G_SET_TIMES "GCTAEventCube::set_times()"
43#define G_SET_BIN "GCTAEventCube::set_bin(int&)"
338 #if defined(G_RANGE_CHECK)
339 if (axis < 0 || axis >=
dim()) {
380 GFits fits(filename);
403 const bool& clobber)
const
412 fits.
saveto(filename, clobber);
440 std::string counts_hdu(
"Primary");
554 if (
size() > 0 && pixels != NULL) {
555 for (
int i = 0; i <
size(); ++i) {
556 if (pixels[i] > 0.0) {
612 #if defined(G_RANGE_CHECK)
613 if (index < 0 || index >=
ebins()) {
615 "CTA event cube energy axis", index,
ebins());
639 result.append(
"=== GCTAEventCube ===");
653 result.append(
" - ");
657 result.append(
"not defined");
666 result.append(
"not defined");
683 result.append(
" - ");
687 result.append(
"not defined");
806 double ra_pnt = hdu.
real(
"RA_PNT");
807 double dec_pnt = hdu.
real(
"DEC_PNT");
884 std::string msg =
"CTA event cube contains no sky pixels. Please "
885 "provide a valid CTA event cube.";
898 for (
int iy = 0; iy <
ny(); ++iy) {
899 for (
int ix = 0; ix <
nx(); ++ix) {
930 for (
int i = 0; i <
size; ++i) {
962 std::string msg =
"CTA event cube contains no energy boundaries. "
963 "Please provide a valid CTA event cube.";
976 for (
int i = 0; i <
ebins; ++i) {
1004 std::string msg =
"No Good Time Intervals have been found in event "
1005 "cube. Every CTA event cube needs a definition "
1006 "of the Good Time Intervals.";
1061 #if defined(G_RANGE_CHECK)
1062 if (index < 0 || index >=
size()) {
1070 ") is incompatible with size of energies ("+
1073 "). Please provide an correctly initialised event "
1081 ") is incompatible with size of sky directions ("+
1084 "). Please provide an correctly initialised event "
CTA event bin container class interface definition.
Definition of GammaLib CTA typemaps.
#define G_CTA_MJDREF
Reference of CTA time frame.
Exception handler interface definition.
FITS file class interface definition.
GCTAEventBin class interface definition.
int m_ieng
Index of energy layer.
double * m_weight
Pointer to weight of bin.
double * m_solidangle
Pointer to solid angle of pixel (sr)
GEnergy * m_energy
Pointer to bin energy.
double * m_counts
Pointer to number of counts.
GEnergy * m_ewidth
Pointer to energy width of bin.
GTime * m_time
Pointer to bin time.
void free_members(void)
Delete class members.
int m_ipix
Index in spatial map.
GCTAInstDir * m_dir
Pointer to bin direction.
double * m_ontime
Pointer to ontime of bin (seconds)
virtual void clear(void)
Clear eventbin.
CTA event bin container class.
void init_bin(void)
Initialise event bin.
virtual void load(const GFilename &filename)
Load CTA event cube from FITS file.
const GEnergy & energy(const int &index) const
Return energy of cube layer.
const GSkyMap & counts(void) const
Return event cube counts as sky map.
GSkyMap m_weights
Cube weights stored as sky map.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print event cube information.
virtual void clear(void)
Clear CTA event cube.
void read_cntmap(const GFitsImage &hdu)
Read CTA counts map from HDU.
void copy_members(const GCTAEventCube &cube)
Copy class members.
GCTAEventBin m_bin
Actual event bin.
virtual int dim(void) const
Return dimension of event cube.
virtual int size(void) const
Return number of bins in event cube.
void read_ebds(const GFitsTable &hdu)
Read energy boundaries from HDU.
int npix(void) const
Return number of pixels in one energy bins of the event cube.
int nx(void) const
Return number of bins in X direction.
void set_detxy(const GCTAPointing &pnt)
Set DETX and DETY coordinates.
double m_ontime
Event cube ontime (sec)
void init_members(void)
Initialise class members.
GCTAEventCube(void)
Void constructor.
virtual int naxis(const int &axis) const
Return number of bins in axis.
virtual GCTAEventCube * clone(void) const
Clone CTA event cube.
std::vector< double > m_solidangle
Array of solid angles (sr)
std::vector< GCTAInstDir > m_dirs
Array of event directions.
GTime m_time
Event cube mean time.
std::vector< GEnergy > m_ewidth
Array of energy bin widths.
virtual void set_energies(void)
Set log mean energies and energy widths of event cube.
virtual GCTAEventCube & operator=(const GCTAEventCube &cube)
Assignment operator.
virtual GCTAEventBin * operator[](const int &index)
Event bin access operator.
virtual void read(const GFits &file)
Read CTA event cube from FITS file.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save CTA event cube into FITS file.
void free_members(void)
Delete class members.
bool m_has_pnt
Event cube has pointing.
const GSkyMap & weights(void) const
Return event cube weights as sky map.
virtual void write(GFits &file) const
Write CTA event cube into FITS file.
virtual ~GCTAEventCube(void)
Destructor.
virtual void set_times(void)
Set mean event time and ontime of event cube.
GSkyMap m_map
Counts cube stored as sky map.
void set_bin(const int &index)
Set event bin.
GCTAPointing m_pnt
Event cube pointing.
virtual double number(void) const
Return number of events in cube.
void read_gti(const GFitsTable &hdu)
Read GTIs from HDU.
std::vector< GEnergy > m_energies
Array of log mean energies.
void set_directions(void)
Set sky directions and solid angles of events cube.
int ebins(void) const
Return number of energy bins in the event cube.
int ny(void) const
Return number of bins in Y direction.
CTA instrument direction class.
GCTAInstDir instdir(const GSkyDir &skydir) const
Get instrument direction from sky direction.
const GSkyDir & dir(void) const
Return pointing sky direction.
void clear(void)
Clear CTA pointing.
Energy boundaries container class.
void read(const GFitsTable &table)
Read energy boundaries from FITS table.
int size(void) const
Return number of energy boundaries.
void write(GFits &file, const std::string &extname=gammalib::extname_ebounds, const std::string &unit="keV") const
Write energy boundaries into FITS object.
Class that handles energies in a unit independent way.
Abstract event bin container class.
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.
virtual GEventCube & operator=(const GEventCube &cube)
Assignment operator.
void free_members(void)
Delete class members.
GGti m_gti
Good time intervals covered by events.
const GTime & tstart(void) const
Return start time.
GEbounds m_ebounds
Energy boundaries covered by events.
const GGti & gti(void) const
Return Good Time Intervals.
void init_members(void)
Initialise class members.
const GTime & tstop(void) const
Return stop time.
const GEbounds & ebounds(void) const
Return energy boundaries.
const GEnergy & emax(void) const
Return maximum energy.
const GEnergy & emin(void) const
Return minimum energy.
bool has_card(const int &cardno) const
Check existence of header card.
double real(const std::string &keyname) const
Return card value as double precision.
Abstract FITS image base class.
Abstract interface for FITS table.
void saveto(const GFilename &filename, const bool &clobber=false)
Saves to specified FITS file.
bool contains(const int &extno) const
Check if HDU exists in FITS file.
GFitsImage * image(const int &extno)
Get pointer to image HDU.
void close(void)
Close FITS file.
void remove(const int &extno)
Remove HDU from FITS file.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
Good Time Interval class.
void reference(const GTimeReference &ref)
Set time reference for Good Time Intervals.
void write(GFits &fits, const std::string &extname=gammalib::extname_gti) const
Write Good Time Intervals and time reference into FITS object.
const GTime & tstop(void) const
Returns latest stop time in Good Time Intervals.
void read(const GFitsTable &table)
Read Good Time Intervals and time reference from FITS table.
int size(void) const
Return number of Good Time Intervals.
const double & ontime(void) const
Returns ontime.
const GTime & tstart(void) const
Returns earliest start time in Good Time Intervals.
void radec_deg(const double &ra, const double &dec)
Set equatorial sky direction (degrees)
std::string print(const GChatter &chatter=NORMAL) const
Print sky direction information.
double solidangle(const int &index) const
Returns solid angle of pixel.
const int & nmaps(void) const
Returns number of maps.
void clear(void)
Clear instance.
const int & nx(void) const
Returns number of pixels in x coordinate.
void read(const GFitsHDU &hdu)
Read skymap from FITS HDU.
const int & npix(void) const
Returns number of pixels.
const int & ny(void) const
Returns number of pixels in y coordinate.
GFitsHDU * write(GFits &file, const std::string &extname="") const
Write sky map into FITS file.
GSkyDir pix2dir(const GSkyPixel &pixel) const
Returns sky direction of pixel.
const double * pixels(void) const
Returns pointer to pixel data.
std::string print(const GChatter &chatter=NORMAL) const
Print sky map.
Implements a time reference.
void clear(void)
Clear time.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
const std::string extname_ebounds
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
const std::string extname_cta_counts
GChatter reduce(const GChatter &chatter)
Reduce chattiness by one level.
const std::string extname_cta_weights
const std::string extname_gti