40#define G_OPERATOR "GCOMEventList::operator[](int&)"
41#define G_ROI "GCOMEventList::roi(GRoi&)"
174 #if defined(G_RANGE_CHECK)
175 if (index < 0 || index >=
size()) {
199 #if defined(G_RANGE_CHECK)
200 if (index < 0 || index >=
size()) {
260 GFits fits(filename);
282 const bool& clobber)
const
291 fits.
saveto(filename, clobber);
365 if (comroi == NULL) {
366 std::string cls = std::string(
typeid(&
roi).name());
367 std::string msg =
"Region of interest of type \""+cls+
"\" is "
368 "not a COMPTEL RoI. Please specify a "
369 "COMPTEL RoI as argument.";
412 if (index <
size()) {
419 m_events.begin() + index + n_remove);
443 result.append(
"=== GCOMEventList ===");
460 result.append(
tstart().utc()+
" - ");
461 result.append(
tstop().utc());
465 result.append(
"not defined");
472 result.append(
" - ");
476 result.append(
"not defined");
550 int num = table.
nrows();
557 centre.lb_deg(table.
real(
"GLON_SCZ"), table.
real(
"GLAT_SCZ"));
560 int verno = table.
integer(
"DSD_REP");
561 #if defined(G_DEBUG_TOFCOR)
562 std::cout <<
"GCOMEventList::read_events: DSD_REP = ";
563 std::cout << verno << std::endl;
567 double radius_max = 0.0;
568 double phibar_min = 0.0;
569 double phibar_max = 0.0;
598 #if defined(G_DEBUG_TOFCOR)
599 bool noticed =
false;
603 for (
int i = 0; i < num; ++i) {
613 sky_dir.
lb(ptr_glat_scat->
real(i), ptr_glon_scat->
real(i));
614 inst_dir.
dir(sky_dir);
625 double x_d2 = double(ptr_x2->
integer(i))*0.03125;
626 double y_d2 = double(ptr_y2->
integer(i))*0.03125;
631 double psd = double(ptr_psd->
integer(i))/128.0;
632 double tof = double(ptr_tof->
integer(i))/128.0;
637 if (ptr_reflag->
integer(i) >= 4) {
638 #if defined(G_DEBUG_TOFCOR)
639 double tof_raw = tof;
642 #if defined(G_DEBUG_TOFCOR)
644 std::cout <<
"GCOMEventList::read_events: ";
645 std::cout <<
"apply TOF correction (";
646 std::cout << tof_raw;
649 std::cout <<
")" << std::endl;
662 event.phibar(phibar);
664 event.e1(ptr_e1->
real(i) * 1.0e-3);
665 event.e2(ptr_e2->
real(i) * 1.0e-3);
670 event.modcom(ptr_modcom->
integer(i));
671 event.reflag(ptr_reflag->
integer(i));
672 event.veto(ptr_veto->
integer(i));
678 double radius = centre.dist_deg(sky_dir);
695 if (phibar < phibar_min) {
698 if (phibar > phibar_max) {
701 if (radius > radius_max) {
709 double phibar = 0.5 * (phibar_min + phibar_max);
711 phibar_min, phibar_max);
736 const double d1sta = 50.0;
737 const double d1end = 20000.0;
740 const double d2sta = 600.0;
741 const double d2end = 30000.0;
744 const int ndegd1 = 6;
747 const double d1ebrk = 2250.0;
750 const int ndegd2 = 4;
753 const double d2ebrk1 = 1400.0;
754 const double d2ebrk2 = 5500.0;
757 const double tofref = 118.30;
760 const double tofcen = 120.0;
763 const double d11cof[] = {111.74858,
772 const double d12cof[] = {116.25374,
781 const double d21cof[] = { 181.77024,
788 const double d22cof[] = { 120.91608,
795 const double d23cof[] = { 119.24278,
804 if (d1ener < d1sta) {
807 if (d1ener > d1end) {
810 if (d2ener < d2sta) {
813 if (d2ener > d2end) {
818 double d1ecor = -tofref;
819 double d1emev = d1ener * 1.0e-3;
821 if (d1ener <= d1ebrk) {
822 for (
int i = 0; i <= ndegd1; ++i) {
823 d1ecor += d11cof[i] * d1edum;
828 for (
int i = 0; i <= ndegd1; ++i) {
829 d1ecor += d12cof[i] * d1edum;
835 double d2ecor = -tofref;
836 double d2emev = d2ener * 1.0e-3;
838 if (d2ener <= d2ebrk1) {
839 for (
int i = 0; i <= ndegd2; ++i) {
840 d2ecor += d21cof[i] * d2edum;
844 else if (d2ener > d2ebrk2) {
845 for (
int i = 0; i <= ndegd2; ++i) {
846 d2ecor += d23cof[i] * d2edum;
851 for (
int i = 0; i <= ndegd2; ++i) {
852 d2ecor += d22cof[i] * d2edum;
858 tof += tofcen - (tofref + d1ecor + d2ecor);
COMPTEL event list class definition.
Implementation of support function used by COMPTEL classes.
Exception handler interface definition.
FITS file class interface definition.
Mathematical function definitions.
COMPTEL event atom class.
COMPTEL event list class.
void init_members(void)
Initialise class members.
GCOMRoi m_roi
Region of interest.
void remove(const int &index, const int &number=1)
Remove events from event list.
virtual int size(void) const
Return number of events in list.
virtual GCOMEventList * clone(void) const
Clone event list.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save COMPTEL events.
double tofcor(const double &d1e, const double &d2e, double tof) const
Compute TOF correction.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL event list information.
virtual void load(const GFilename &filename)
Load COMPTEL events from FITS file.
void copy_members(const GCOMEventList &list)
Copy class members.
std::vector< GCOMEventAtom > m_events
Events.
virtual GCOMEventList & operator=(const GCOMEventList &list)
Assignment operator.
virtual GCOMEventAtom * operator[](const int &index)
COMPTEL event atom access operator.
void read_events(const GFitsTable &table)
Read COMPTEL events from FITS table.
void free_members(void)
Delete class members.
void append(const GCOMEventAtom &event)
Append event to event list.
virtual void clear(void)
Clear COMPTEL event list.
virtual int number(void) const
Return number of events in list.
virtual void write(GFits &file) const
Write COMPTEL event list into FITS file.
virtual const GCOMRoi & roi(void) const
Return Region of Interest.
virtual ~GCOMEventList(void)
Destructor.
GCOMEventList(void)
Void constructor.
virtual void read(const GFits &file)
Read COMPTEL events from FITS file.
Interface for the COMPTEL instrument direction class.
void dir(const GSkyDir &dir)
Set event scatter direction.
void phibar(const double &phibar)
Set event Compton scatter angle.
COMPTEL region of interest class.
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.
double real(const std::string &keyname) const
Return card value as double precision.
int integer(const std::string &keyname) const
Return card value as integer.
Abstract interface for FITS table column.
virtual int integer(const int &row, const int &inx=0) const =0
virtual double real(const int &row, const int &inx=0) const =0
Abstract interface for FITS 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.
void close(void)
Close FITS file.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
void append(const GTime &tstart, const GTime &tstop)
Append Good Time Interval.
Interface for the region of interest classes.
void lb(const double &l, const double &b)
Set galactic sky direction (radians)
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
int com_tics(const GTime &time)
Convert GTime in COMPTEL tics.
int com_tjd(const GTime &time)
Convert GTime in COMPTEL TJD.