38#define G_NAXIS "GCOSEventCube::naxis(int)"
39#define G_SET "GCOSEventCube::set(std::string&, int&, std::string&, "\
40 "GBounds&, GEbounds&)"
41#define G_FILL "GCOSEventCube::fill(GCOSEventList&)"
42#define G_SET_SCATTER_DIRECTIONS "GCOSEventCube::set_scatter_directions()"
43#define G_SET_SCATTER_ANGLES "GCOSEventCube::set_scatter_angles()"
44#define G_SET_ENERGIES "GCOSEventCube::set_energies()"
45#define G_SET_TIMES "GCOSEventCube::set_times()"
46#define G_SET_BIN "GCOSEventCube::set_bin(int&)"
94 const std::string& order,
328 #if defined(G_RANGE_CHECK)
329 if (axis < 0 || axis >=
dim()) {
354 GFits fits(filename);
384 fits.
saveto(filename, clobber);
407 const GFitsHDU& hdu = *fits[
"EVENT CUBE"];
498 hdu->
card(
"NEVREJ", num_events_rejected,
"Number of rejected events");
528 for (
int i = 0; i <
size(); ++i, ++ptr) {
557 const std::string& order,
576 if ((unit !=
"") && ((unit !=
"deg") || (unit !=
"degrees"))) {
577 std::string msg =
"Invalid unit \""+
phibounds.
unit()+
"\"specified for "
578 "Phi boundaries. Please specify Phi boundaries in "
641 if (
gti().is_empty()) {
642 std::string msg =
"No Good Time Intervals were defined for the event "
643 "cube. Please set the Good Time Intervals before "
644 "calling the method.";
648 std::string msg =
"No energy boundaries were defined for the event "
649 "cube. Please set the energy boundaries before "
650 "calling the method.";
654 std::string msg =
"No scatter angle boundaries were defined for the "
655 "event cube. Please set the scatter angle "
656 "boundaries before calling the method.";
664 for (
int i = 0; i < list.
size(); ++i) {
735 m_cube(ipix, imap) += 1.0;
759 result.append(
"=== GCOSEventCube ===");
790 result.append(
" - ");
794 result.append(
"not defined");
798 result.append(
tstart().utc());
799 result.append(
" - ");
800 result.append(
tstop().utc());
803 result.append(
"not defined");
928 std::string msg =
"No sky pixels were defined for event cube. "
929 "Please define the sky pixels of the event "
938 for (
int i = 0; i <
m_npix; ++i) {
970 std::string msg =
"No scatter angles were defined for event cube. "
971 "Please define the scatter angles of the event "
981 for (
int i = 0; i <
m_nphi; ++i) {
1007 std::string msg =
"No energy boundaries were defined for event cube. "
1008 "Please define the energy boundaries of the event "
1042 std::string msg =
"No Good Time Intervals were defined for event "
1043 "cube. Please define the Good Time Intervals of "
1109 #if defined(G_RANGE_CHECK)
1110 if (index < 0 || index >=
size()) {
1116 int ipix = index %
m_npix;
1117 int imap = index /
m_npix;
1118 int iphi = imap %
m_nphi;
1119 int ieng = imap /
m_nphi;
Boundaries class interface definition.
#define G_SET_SCATTER_DIRECTIONS
#define G_SET_SCATTER_ANGLES
COSI event bin container class definition.
COSI event list class definition.
Energy boundaries class interface definition.
Sky map class definition.
Boundaries container class.
void read(const GFitsTable &table)
Read boundaries from FITS table.
void clear(void)
Clear boundaries.
const std::string & unit(void) const
Return boundary units.
double max(void) const
Return maximum value of all intervals.
double mean(const int &index) const
Returns mean value for a given interval.
double min(void) const
Return minimum value of all intervals.
void write(GFits &file, const std::string &extname=gammalib::extname_bounds) const
Write boundaries into FITS object.
int size(void) const
Return number of boundaries.
int index(const double &value) const
Returns bin index for a value.
double * m_ontime
Pointer to ontime of bin (seconds)
double * m_phiwidth
Pointer to Phi width.
virtual void clear(void)
Clear COSI event bin.
GEnergy * m_energy
Pointer to bin energy.
GTime * m_time
Pointer to bin time.
GEnergy * m_ewidth
Pointer to energy width of bin.
int m_index
Dataspace index.
GCOSInstDir * m_dir
Pointer to bin direction.
double * m_solidangle
Pointer to solid angle of pixel (sr)
double * m_counts
Pointer to number of counts.
void free_members(void)
Delete class members.
COSI event bin container class.
void init_members(void)
Initialise class members.
std::vector< GEnergy > m_ewidths
Cube energy bin widths.
virtual int naxis(const int &axis) const
Return number of bins in axis.
virtual void clear(void)
Clear COSI event cube.
void free_members(void)
Delete class members.
virtual GCOSEventCube & operator=(const GCOSEventCube &cube)
Assignment operator.
GCOSEventBin m_bin
Current event bin.
virtual int size(void) const
Return number of bins in event cube.
void set(const std::string &coords, const int &nside, const std::string &order, const GBounds &phibounds, const GEbounds &ebounds, const GGti >i)
Set event cube.
virtual GCOSEventBin * operator[](const int &index)
Event bin access operator.
int m_num_outside_ebounds
Number of events outside energy boundaries.
std::vector< double > m_phiwidths
Array of scatter angles bin widths.
void init_bin(void)
Initialise event bin.
int m_num_outside_phibounds
Number of events outside scatter angle bounds.
virtual void read(const GFits &fits)
Read COSI event cube from FITS file.
void copy_members(const GCOSEventCube &cube)
Copy class members.
virtual ~GCOSEventCube(void)
Destructor.
virtual void set_energies(void)
Set log mean energies and energy widths of energy bins.
const GSkyMap & cube(void) const
Return event cube.
GBounds m_phibounds
Phi layer boundaries.
void set_scatter_angles(void)
Set Compton scatter angles of event cube.
int m_num_outside_gti
Number of events outside GTI.
GCOSEventCube(void)
Void constructor.
double m_ontime
Event cube ontime (sec)
virtual GCOSEventCube * clone(void) const
Clone event cube.
const GBounds & phibounds(void) const
Return Phi boundaries.
void set_scatter_directions(void)
Set scatter directions of all events cube pixels.
int m_num_events_checked
Number of checked events.
virtual double number(void) const
Return number of events in cube.
int m_npix
Number of HealPix pixels.
GCOSInstDir m_dir
Current event direction.
void fill(const GCOSEventList &list)
Fill event cube with events from event list.
GTime m_time
Event cube mean time.
virtual void load(const GFilename &filename)
Load COSI event cube from FITS file.
GSkyMap m_cube
Event cube.
double m_solidangle
Event bin solid angle (sr)
const GTime & time(void) const
Return event cube time.
virtual int dim(void) const
Return dimension of event cube.
virtual void write(GFits &fits) const
Write COSI event cube into FITS file.
int m_num_events_used
Number of used events.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COSI event cube information.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save COSI event cube into FITS file.
std::vector< GEnergy > m_energies
Cube energy bin mean energies.
virtual void set_times(void)
Set mean event time and ontime of event cube.
std::vector< GSkyDir > m_dirs
Cube pixel scatter directions.
std::vector< double > m_phis
Array of scatter angles.
void set_bin(const int &index)
Set event bin.
int m_nphi
Number of Phi layers.
virtual int size(void) const
Return number of events in list.
void phi(const double &phi)
Set event Compton scatter angle.
virtual void clear(void)
Clear COSI instrument direction.
void dir(const GSkyDir &dir)
Set event scatter direction in celestial coordinates.
Energy boundaries container class.
int index(const GEnergy &eng) const
Returns energy bin index for a given energy.
const GEnergy & emax(void) const
Return maximum energy of all intervals.
void read(const GFitsTable &table)
Read energy boundaries from FITS table.
int size(void) const
Return number of energy boundaries.
GEnergy elogmean(const int &index) const
Returns logarithmic mean energy for a given energy interval.
const GEnergy & emin(void) const
Return minimum energy of all intervals.
void write(GFits &file, const std::string &extname=gammalib::extname_ebounds, const std::string &unit="keV") const
Write energy boundaries into FITS object.
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.
Abstract FITS extension base class.
bool has_card(const int &cardno) const
Check existence of header card.
GFitsHeaderCard & card(const int &cardno)
Return header card.
int integer(const std::string &keyname) const
Return card value as integer.
Abstract interface for FITS table.
void saveto(const GFilename &filename, const bool &clobber=false)
Saves to specified FITS file.
void close(void)
Close FITS file.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
Good Time Interval class.
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.
double solidangle(const int &index) const
Returns solid angle of pixel.
int ndim(void) const
Returns dimension of maps.
const int & nmaps(void) const
Returns number of maps.
void clear(void)
Clear instance.
GSkyDir inx2dir(const int &index) const
Returns sky direction of pixel.
bool is_empty(void) const
Signals if sky map is empty.
int dir2inx(const GSkyDir &dir) const
Returns pixel index for a given sky direction.
void read(const GFitsHDU &hdu)
Read skymap from FITS HDU.
const int & npix(void) const
Returns number of pixels.
GFitsHDU * write(GFits &file, const std::string &extname="") const
Write sky map into FITS file.
const std::vector< int > & shape(void) const
Returns shape of maps.
const double * pixels(void) const
Returns pointer to pixel data.
void clear(void)
Clear time.
std::string print(const GChatter &chatter=NORMAL) const
Print 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.
std::string tolower(const std::string &s)
Convert string to lower case.
GChatter reduce(const GChatter &chatter)
Reduce chattiness by one level.
const std::string extname_gti