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