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()) {
415 int n_remove = (index + number >
size()) ?
size() - index :
number;
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();
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);
void phibar(const double &phibar)
Set event Compton scatter angle.
void free_members(void)
Delete class members.
const GGti & gti(void) const
Return Good Time Intervals.
double dist_deg(const GSkyDir &dir) const
Compute angular distance between sky directions in degrees.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
std::string number(const std::string &noun, const int &number)
Convert singular noun into number noun.
virtual const GCOMRoi & roi(void) const
Return Region of Interest.
void lb(const double &l, const double &b)
Set galactic sky direction (radians)
void init_members(void)
Initialise class members.
Abstract event atom container class.
COMPTEL event list class definition.
void init_members(void)
Initialise class members.
const GTime & tstop(void) const
Return stop time.
GEbounds m_ebounds
Energy boundaries covered by events.
void read_events(const GFitsTable &table)
Read COMPTEL events from FITS table.
FITS file class interface definition.
void append(const GTime &tstart, const GTime &tstop)
Append Good Time Interval.
Implementation of support function used by COMPTEL classes.
std::string centre(const std::string &s, const int &n, const char &c= ' ')
Centre string to achieve a length of n characters.
virtual GCOMEventList & operator=(const GCOMEventList &list)
Assignment operator.
GCOMRoi m_roi
Region of interest.
virtual GCOMEventList * clone(void) const
Clone event list.
void saveto(const GFilename &filename, const bool &clobber=false)
Saves to specified FITS file.
double real(const std::string &keyname) const
Return card value as double precision.
virtual void load(const GFilename &filename)
Load COMPTEL events from FITS file.
virtual int size(void) const
Return number of events in list.
Energy boundaries container class.
void dir(const GSkyDir &dir)
Set event scatter direction.
void free_members(void)
Delete class members.
Abstract interface for FITS table column.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save COMPTEL events.
int com_tjd(const GTime &time)
Convert GTime in COMPTEL TJD.
void remove(const int &index, const int &number=1)
Remove events from event list.
virtual GEventList & operator=(const GEventList &list)
Assignment operator.
virtual void clear(void)
Clear region of interest.
Abstract interface for FITS table.
GGti m_gti
Good time intervals covered by events.
int integer(const std::string &keyname) const
Return card value as integer.
void append(const GCOMEventAtom &event)
Append event to event list.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL event list information.
void copy_members(const GCOMEventList &list)
Copy class members.
COMPTEL region of interest class.
const int & nrows(void) const
Return number of rows in table.
virtual void write(GFits &file) const
Write COMPTEL event list into FITS file.
void free_members(void)
Delete class members.
virtual GCOMEventAtom * operator[](const int &index)
COMPTEL event atom access operator.
int com_tics(const GTime &time)
Convert GTime in COMPTEL tics.
virtual int integer(const int &row, const int &inx=0) const =0
virtual void clear(void)
Clear COMPTEL event list.
virtual double real(const int &row, const int &inx=0) const =0
const GEnergy & emin(void) const
Return minimum energy.
std::vector< GCOMEventAtom > m_events
Events.
double keV(void) const
Return energy in keV.
GCOMEventList(void)
Void constructor.
void lb_deg(const double &l, const double &b)
Set galactic sky direction (degrees)
virtual int number(void) const
Return number of events in list.
Exception handler interface definition.
COMPTEL event list class.
const GEbounds & ebounds(void) const
Return energy boundaries.
virtual void read(const GFits &file)
Read COMPTEL events from FITS file.
Interface for the region of interest classes.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
const GTime & tstart(void) const
Return start time.
void close(void)
Close FITS file.
double tofcor(const double &d1e, const double &d2e, double tof) const
Compute TOF correction.
const GEnergy & emax(void) const
Return maximum energy.
void init_members(void)
Initialise class members.
Interface for the COMPTEL instrument direction class.
Mathematical function definitions.
virtual ~GCOMEventList(void)
Destructor.
Class that handles energies in a unit independent way.
COMPTEL event atom class.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.