41#define G_OPERATOR "GCOSEventList::operator[](int&)"
42#define G_READ "GCOSEventList::read(GFits&)"
43#define G_ROI "GCOSEventList::roi(GRoi&)"
175 #if defined(G_RANGE_CHECK)
176 if (index < 0 || index >=
size()) {
200 #if defined(G_RANGE_CHECK)
201 if (index < 0 || index >=
size()) {
261 GFits fits(filename);
283 const bool& clobber)
const
292 fits.
saveto(filename, clobber);
320 double radius = 180.0;
326 int num = table.
nrows();
332 double phi_min = 0.0;
333 double phi_max = 0.0;
348 for (
int i = 0; i < num; ++i) {
355 dir_local.
radec(ptr_chi_local->
real(i), ptr_psi_local->
real(i));
360 energy.
keV(ptr_energies->
real(i));
400 std::string unit = table.
string(
"DSUNI2");
401 std::string dsval = table.
string(
"DSVAL2");
403 if (energy.size() != 2) {
404 std::string msg =
"Invalid data selecetion value string DSVAL2="+
405 dsval+
". Please specify a FITS file with a "
406 "correct formatting.";
425 std::string dsval = table.
string(
"DSVAL3");
429 if (angles.size() != 3) {
430 std::string msg =
"Invalid data selecetion value string DSVAL3="+
431 dsval+
". Please specify a FITS file with a "
432 "correct formatting.";
473 col_energies.
unit(
"keV");
476 col_chi_local.
unit(
"rad");
477 col_psi_local.
unit(
"rad");
478 col_chi_gal.
unit(
"deg");
479 col_psi_gal.
unit(
"deg");
482 for (
int i = 0; i <
size(); ++i) {
483 col_energies(i) =
m_events[i].energy().keV();
486 col_chi_local(i) =
m_events[i].dir().dir_local().ra();
487 col_psi_local(i) =
m_events[i].dir().dir_local().dec();
488 col_chi_gal(i) =
m_events[i].dir().dir().l_deg();
489 col_psi_gal(i) =
m_events[i].dir().dir().b_deg();
493 table.
append(col_energies);
496 table.
append(col_chi_local);
497 table.
append(col_psi_local);
498 table.
append(col_chi_gal);
499 table.
append(col_psi_gal);
507 table.
card(
"DSTYP1",
"TIME",
"Data sub-space type");
508 table.
card(
"DSUNI1",
"s",
"Data sub-space unit");
509 table.
card(
"DSVAL1",
"TABLE",
"Data sub-space value");
510 table.
card(
"DSREF1", dsref1,
"Data sub-space reference");
511 table.
card(
"DSTYP2",
"ENERGY",
"Data sub-space type");
512 table.
card(
"DSUNI2",
"keV",
"Data sub-space unit");
513 table.
card(
"DSVAL2", dsval2,
"Data sub-space value");
514 table.
card(
"DSTYP3",
"POS(RA,DEC)",
"Data sub-space type");
515 table.
card(
"DSUNI3",
"deg",
"Data sub-space unit");
516 table.
card(
"DSVAL3", dsval3,
"Data sub-space value");
517 table.
card(
"NDSKEYS", 3,
"Number of data sub-space keys");
544 if (cosroi == NULL) {
545 std::string cls = std::string(
typeid(&
roi).name());
546 std::string msg =
"Region of interest of type \""+cls+
"\" is "
547 "not a COSI RoI. Please specify a "
548 "COSI RoI as argument.";
589 int num = list.
size();
598 for (
int i = 0; i < num; ++i) {
623 if (index <
size()) {
630 m_events.begin() + index + n_remove);
669 result.append(
"=== GCOSEventList ===");
681 result.append(
tstart().utc()+
" - ");
682 result.append(
tstop().utc());
686 result.append(
"not defined");
693 result.append(
" - ");
697 result.append(
"not defined");
COSI event list class definition.
Exception handler interface definition.
FITS binary table class definition.
FITS table double column class interface definition.
FITS file class interface definition.
virtual GCOSEventList & operator=(const GCOSEventList &list)
Assignment operator.
void remove(const int &index, const int &number=1)
Remove events from event list.
virtual void read(const GFits &fits)
Read COSI events from FITS file.
virtual void load(const GFilename &filename)
Load COSI events from FITS file.
void reserve(const int &number)
Reserves space for events.
void extend(const GCOSEventList &list)
Extend event list with another event list.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save COSI events.
virtual const GCOSRoi & roi(void) const
Return Region of Interest.
virtual ~GCOSEventList(void)
Destructor.
GCOSRoi m_roi
Region of interest.
void copy_members(const GCOSEventList &list)
Copy class members.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COSI event list information.
void sort(void)
Sort events by increasing time.
void free_members(void)
Delete class members.
virtual int size(void) const
Return number of events in list.
virtual GCOSEventList * clone(void) const
Clone event list.
void append(const GCOSEventAtom &event)
Append event to event list.
virtual GCOSEventAtom * operator[](const int &index)
COSI event atom access operator.
void init_members(void)
Initialise class members.
std::vector< GCOSEventAtom > m_events
Events.
GCOSEventList(void)
Void constructor.
virtual void clear(void)
Clear COSI event list.
virtual void write(GFits &fits) const
Write COSI event list into FITS file.
virtual double number(void) const
Return number of events in list.
COSI instrument direction class.
COSI region of interest class.
const double & radius(void) const
Returns region of interest radius.
virtual void clear(void)
Clear region of interest.
Energy boundaries container class.
Class that handles energies in a unit independent way.
double keV(void) const
Return energy in keV.
Abstract event atom container class.
virtual GEventList & operator=(const GEventList &list)
Assignment operator.
void init_members(void)
Initialise class members.
void free_members(void)
Delete class members.
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.
const std::string & extname(void) const
Return extension name.
std::string string(const std::string &keyname) const
Return card value as string.
GFitsHeaderCard & card(const int &cardno)
Return header card.
Abstract interface for FITS table column.
virtual double real(const int &row, const int &inx=0) const =0
void unit(const std::string &unit)
Set column unit.
FITS table double column.
Abstract interface for FITS table.
GFitsTableCol * append(const GFitsTableCol &column)
Append column to the table.
const int & nrows(void) const
Return number of rows in 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.
GFitsHDU * append(const GFitsHDU &hdu)
Append HDU to FITS file.
void close(void)
Close FITS file.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
void write(GFits &fits, const std::string &extname=gammalib::extname_gti) const
Write Good Time Intervals and time reference into FITS object.
void read(const GFitsTable &table)
Read Good Time Intervals and time reference from FITS table.
Interface for the region of interest classes.
void radec(const double &ra, const double &dec)
Set equatorial sky direction (radians)
void lb_deg(const double &l, const double &b)
Set galactic sky direction (degrees)
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
double cos_seconds(const GTime &time)
Convert GammaLib time to COSI seconds.
GTime cos_time(const double &seconds)
Convert COSI seconds to GammaLib time.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
double todouble(const std::string &arg)
Convert string into double precision value.
std::string replace_segment(const std::string &arg, const std::string &segment, const std::string &replacement)
Replace string segment in string.
std::string rstrip_chars(const std::string &arg, const std::string &chars)
Strip trailing character from string.
const std::string extname_gti
std::vector< std::string > split(const std::string &s, const std::string &sep)
Split string.