diff --git a/inst/cta/include/GCTAEventAtom.hpp b/inst/cta/include/GCTAEventAtom.hpp index cbde8cc..57860e3 100644 --- a/inst/cta/include/GCTAEventAtom.hpp +++ b/inst/cta/include/GCTAEventAtom.hpp @@ -4,10 +4,18 @@ * copyright (C) 2010-2011 by Jurgen Knodlseder * * ----------------------------------------------------------------------- * * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * * * ***************************************************************************/ /** @@ -67,30 +75,26 @@ protected: void free_members(void); // Protected members - GCTAInstDir m_dir; //!< Event direction - GEnergy m_energy; //!< Event energy - GTime m_time; //!< Event time - long m_event_id; //!< Event identifier - char m_flags; //!< Flags - int m_multip; //!< Multiplicity - char m_telmask; //!< Telescope mask - float m_dir_err; //!< Error on event direction - float m_detx; //!< - float m_dety; //!< - float m_alt_pnt; //!< Pointing altitude - float m_az_pnt; //!< Pointing azimuth - float m_alt; //!< Event altitude - float m_az; //!< Event azimuth - float m_corex; //!< - float m_corey; //!< - float m_core_err; //!< - float m_xmax; //!< - float m_xmax_err; //!< - float m_energy_err; //!< Error on event energy (MeV) - float m_hil_msw; //!< Hillas width - float m_hil_msw_err; //!< Error on Hillas width - float m_hil_msl; //!< Hillas length - float m_hil_msl_err; //!< Error on Hillas length + GCTAInstDir m_dir; //!< Event direction + GEnergy m_energy; //!< Event energy + GTime m_time; //!< Event time + unsigned long m_event_id; //!< Event identifier + unsigned long m_obs_id; //!< Observation identifier + int m_multip; //!< Multiplicity + char m_telmask; //!< Telescope mask + float m_dir_err; //!< Error on event direction + float m_detx; //!< Tangential coordinate in nominal sys + float m_dety; //!< Tangential coordinate in nominal sys + float m_alt; //!< Event altitude + float m_az; //!< Event azimuth + float m_corex; //!< Position on ground (m) + float m_corey; //!< Position on ground (m) + float m_core_err; //!< Error on core reconstruction + float m_xmax; //!< Position of shower max (g/cm2) + float m_xmax_err; //!< Error on shower max (g/cm2) + float m_shwidth; //!< Shower width (m) + float m_shlength; //!< Shower length (m) + float m_energy_err; //!< Error on event energy (MeV) }; #endif /* GCTAEVENTATOM_HPP */ diff --git a/inst/cta/include/GCTAEventList.hpp b/inst/cta/include/GCTAEventList.hpp index 458bac7..443d994 100644 --- a/inst/cta/include/GCTAEventList.hpp +++ b/inst/cta/include/GCTAEventList.hpp @@ -4,10 +4,18 @@ * copyright (C) 2010-2011 by Jurgen Knodlseder * * ----------------------------------------------------------------------- * * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * * * ***************************************************************************/ /** diff --git a/inst/cta/src/GCTAEventAtom.cpp b/inst/cta/src/GCTAEventAtom.cpp index 06e56e1..b9616f7 100644 --- a/inst/cta/src/GCTAEventAtom.cpp +++ b/inst/cta/src/GCTAEventAtom.cpp @@ -4,10 +4,18 @@ * copyright (C) 2010 by Jurgen Knodlseder * * ----------------------------------------------------------------------- * * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * * * ***************************************************************************/ /** @@ -193,14 +201,12 @@ void GCTAEventAtom::init_members(void) m_time.clear(); m_energy.clear(); m_event_id = 0; - m_flags = 0; + m_obs_id = 0; m_multip = 0; m_telmask = 0; m_dir_err = 0.0; m_detx = 0.0; m_dety = 0.0; - m_alt_pnt = 0.0; - m_az_pnt = 0.0; m_alt = 0.0; m_az = 0.0; m_corex = 0.0; @@ -208,11 +214,9 @@ void GCTAEventAtom::init_members(void) m_core_err = 0.0; m_xmax = 0.0; m_xmax_err = 0.0; + m_shwidth = 0.0; + m_shlength = 0.0; m_energy_err = 0.0; - m_hil_msw = 0.0; - m_hil_msw_err = 0.0; - m_hil_msl = 0.0; - m_hil_msl_err = 0.0; // Return return; @@ -231,14 +235,12 @@ void GCTAEventAtom::copy_members(const GCTAEventAtom& atom) m_time = atom.m_time; m_energy = atom.m_energy; m_event_id = atom.m_event_id; - m_flags = atom.m_flags; + m_obs_id = atom.m_obs_id; m_multip = atom.m_multip; m_telmask = atom.m_telmask; m_dir_err = atom.m_dir_err; m_detx = atom.m_detx; m_dety = atom.m_dety; - m_alt_pnt = atom.m_alt_pnt; - m_az_pnt = atom.m_az_pnt; m_alt = atom.m_alt; m_az = atom.m_az; m_corex = atom.m_corex; @@ -246,11 +248,9 @@ void GCTAEventAtom::copy_members(const GCTAEventAtom& atom) m_core_err = atom.m_core_err; m_xmax = atom.m_xmax; m_xmax_err = atom.m_xmax_err; + m_shwidth = atom.m_shwidth; + m_shlength = atom.m_shlength; m_energy_err = atom.m_energy_err; - m_hil_msw = atom.m_hil_msw; - m_hil_msw_err = atom.m_hil_msw_err; - m_hil_msl = atom.m_hil_msl; - m_hil_msl_err = atom.m_hil_msl_err; // Return return; diff --git a/inst/cta/src/GCTAEventList.cpp b/inst/cta/src/GCTAEventList.cpp index a708af7..91feb0b 100644 --- a/inst/cta/src/GCTAEventList.cpp +++ b/inst/cta/src/GCTAEventList.cpp @@ -525,29 +525,26 @@ void GCTAEventList::read_events(const GFitsTable* table) m_events.reserve(num); // Get column pointers - GFitsTableULongCol* ptr_eid = (GFitsTableULongCol*)&(*table)["EVENT_ID"]; - GFitsTableDoubleCol* ptr_time = (GFitsTableDoubleCol*)&(*table)["TIME"]; - GFitsTableShortCol* ptr_multip = (GFitsTableShortCol*)&(*table)["MULTIP"]; - GFitsTableFloatCol* ptr_ra = (GFitsTableFloatCol*)&(*table)["RA"]; - GFitsTableFloatCol* ptr_dec = (GFitsTableFloatCol*)&(*table)["DEC"]; - GFitsTableFloatCol* ptr_dir_err = (GFitsTableFloatCol*)&(*table)["DIR_ERR"]; - GFitsTableFloatCol* ptr_detx = (GFitsTableFloatCol*)&(*table)["DETX"]; - GFitsTableFloatCol* ptr_dety = (GFitsTableFloatCol*)&(*table)["DETY"]; - GFitsTableFloatCol* ptr_alt_pnt = (GFitsTableFloatCol*)&(*table)["ALT_PNT"]; - GFitsTableFloatCol* ptr_az_pnt = (GFitsTableFloatCol*)&(*table)["AZ_PNT"]; - GFitsTableFloatCol* ptr_alt = (GFitsTableFloatCol*)&(*table)["ALT"]; - GFitsTableFloatCol* ptr_az = (GFitsTableFloatCol*)&(*table)["AZ"]; - GFitsTableFloatCol* ptr_corex = (GFitsTableFloatCol*)&(*table)["COREX"]; - GFitsTableFloatCol* ptr_corey = (GFitsTableFloatCol*)&(*table)["COREY"]; - GFitsTableFloatCol* ptr_core_err = (GFitsTableFloatCol*)&(*table)["CORE_ERR"]; - GFitsTableFloatCol* ptr_xmax = (GFitsTableFloatCol*)&(*table)["XMAX"]; - GFitsTableFloatCol* ptr_xmax_err = (GFitsTableFloatCol*)&(*table)["XMAX_ERR"]; - GFitsTableFloatCol* ptr_energy = (GFitsTableFloatCol*)&(*table)["ENERGY"]; - GFitsTableFloatCol* ptr_energy_err = (GFitsTableFloatCol*)&(*table)["ENERGY_ERR"]; - GFitsTableFloatCol* ptr_hil_msw = (GFitsTableFloatCol*)&(*table)["HIL_MSW"]; - GFitsTableFloatCol* ptr_hil_msw_err = (GFitsTableFloatCol*)&(*table)["HIL_MSW_ERR"]; - GFitsTableFloatCol* ptr_hil_msl = (GFitsTableFloatCol*)&(*table)["HIL_MSL"]; - GFitsTableFloatCol* ptr_hil_msl_err = (GFitsTableFloatCol*)&(*table)["HIL_MSL_ERR"]; + GFitsTableULongCol* ptr_eid = (GFitsTableULongCol*)&(*table)["EVENT_ID"]; + GFitsTableULongCol* ptr_oid = (GFitsTableULongCol*)&(*table)["OBS_ID"]; + GFitsTableDoubleCol* ptr_time = (GFitsTableDoubleCol*)&(*table)["TIME"]; + GFitsTableShortCol* ptr_multip = (GFitsTableShortCol*)&(*table)["MULTIP"]; + GFitsTableFloatCol* ptr_ra = (GFitsTableFloatCol*)&(*table)["RA"]; + GFitsTableFloatCol* ptr_dec = (GFitsTableFloatCol*)&(*table)["DEC"]; + GFitsTableFloatCol* ptr_dir_err = (GFitsTableFloatCol*)&(*table)["DIR_ERR"]; + GFitsTableFloatCol* ptr_detx = (GFitsTableFloatCol*)&(*table)["DETX"]; + GFitsTableFloatCol* ptr_dety = (GFitsTableFloatCol*)&(*table)["DETY"]; + GFitsTableFloatCol* ptr_alt = (GFitsTableFloatCol*)&(*table)["ALT"]; + GFitsTableFloatCol* ptr_az = (GFitsTableFloatCol*)&(*table)["AZ"]; + GFitsTableFloatCol* ptr_corex = (GFitsTableFloatCol*)&(*table)["COREX"]; + GFitsTableFloatCol* ptr_corey = (GFitsTableFloatCol*)&(*table)["COREY"]; + GFitsTableFloatCol* ptr_core_err = (GFitsTableFloatCol*)&(*table)["CORE_ERR"]; + GFitsTableFloatCol* ptr_xmax = (GFitsTableFloatCol*)&(*table)["XMAX"]; + GFitsTableFloatCol* ptr_xmax_err = (GFitsTableFloatCol*)&(*table)["XMAX_ERR"]; + GFitsTableFloatCol* ptr_shw = (GFitsTableFloatCol*)&(*table)["SHWIDTH"]; + GFitsTableFloatCol* ptr_shl = (GFitsTableFloatCol*)&(*table)["SHLENGTH"]; + GFitsTableFloatCol* ptr_energy = (GFitsTableFloatCol*)&(*table)["ENERGY"]; + GFitsTableFloatCol* ptr_energy_err = (GFitsTableFloatCol*)&(*table)["ENERGY_ERR"]; // Copy data from columns into GCTAEventAtom objects GCTAEventAtom event; @@ -556,12 +553,12 @@ void GCTAEventList::read_events(const GFitsTable* table) event.m_dir.radec_deg((*ptr_ra)(i), (*ptr_dec)(i)); event.m_energy.TeV((*ptr_energy)(i)); event.m_event_id = (*ptr_eid)(i); + event.m_obs_id = (*ptr_oid)(i); event.m_multip = (*ptr_multip)(i); + event.m_telmask = 0; event.m_dir_err = (*ptr_dir_err)(i); event.m_detx = (*ptr_detx)(i); event.m_dety = (*ptr_dety)(i); - event.m_alt_pnt = (*ptr_alt_pnt)(i); - event.m_az_pnt = (*ptr_az_pnt)(i); event.m_alt = (*ptr_alt)(i); event.m_az = (*ptr_az)(i); event.m_corex = (*ptr_corex)(i); @@ -569,11 +566,9 @@ void GCTAEventList::read_events(const GFitsTable* table) event.m_core_err = (*ptr_core_err)(i); event.m_xmax = (*ptr_xmax)(i); event.m_xmax_err = (*ptr_xmax_err)(i); + event.m_shwidth = (*ptr_shw)(i); + event.m_shlength = (*ptr_shl)(i); event.m_energy_err = (*ptr_energy_err)(i); - event.m_hil_msw = (*ptr_hil_msw)(i); - event.m_hil_msw_err = (*ptr_hil_msw_err)(i); - event.m_hil_msl = (*ptr_hil_msl)(i); - event.m_hil_msl_err = (*ptr_hil_msl_err)(i); m_events.push_back(event); } @@ -778,6 +773,7 @@ void GCTAEventList::write_events(GFitsBinTable* hdu) const // Allocate columns GFitsTableULongCol col_eid = GFitsTableULongCol("EVENT_ID", size()); + GFitsTableULongCol col_oid = GFitsTableULongCol("OBS_ID", size()); GFitsTableDoubleCol col_time = GFitsTableDoubleCol("TIME", size()); GFitsTableDoubleCol col_live = GFitsTableDoubleCol("TLIVE", size()); GFitsTableShortCol col_multip = GFitsTableShortCol("MULTIP", size()); @@ -789,51 +785,45 @@ void GCTAEventList::write_events(GFitsBinTable* hdu) const GFitsTableFloatCol col_dety = GFitsTableFloatCol("DETY", size()); GFitsTableFloatCol col_alt = GFitsTableFloatCol("ALT", size()); GFitsTableFloatCol col_az = GFitsTableFloatCol("AZ", size()); - GFitsTableFloatCol col_alt_pnt = GFitsTableFloatCol("ALT_PNT", size()); - GFitsTableFloatCol col_az_pnt = GFitsTableFloatCol("AZ_PNT", size()); GFitsTableFloatCol col_corex = GFitsTableFloatCol("COREX", size()); GFitsTableFloatCol col_corey = GFitsTableFloatCol("COREY", size()); GFitsTableFloatCol col_core_err = GFitsTableFloatCol("CORE_ERR", size()); GFitsTableFloatCol col_xmax = GFitsTableFloatCol("XMAX", size()); GFitsTableFloatCol col_xmax_err = GFitsTableFloatCol("XMAX_ERR", size()); + GFitsTableFloatCol col_shw = GFitsTableFloatCol("SHWIDTH", size()); + GFitsTableFloatCol col_shl = GFitsTableFloatCol("SHLENGTH", size()); GFitsTableFloatCol col_energy = GFitsTableFloatCol("ENERGY", size()); GFitsTableFloatCol col_energy_err = GFitsTableFloatCol("ENERGY_ERR", size()); - GFitsTableFloatCol col_hil_msw = GFitsTableFloatCol("HIL_MSW", size()); - GFitsTableFloatCol col_hil_msw_err = GFitsTableFloatCol("HIL_MSW_ERR", size()); - GFitsTableFloatCol col_hil_msl = GFitsTableFloatCol("HIL_MSL", size()); - GFitsTableFloatCol col_hil_msl_err = GFitsTableFloatCol("HIL_MSL_ERR", size()); // Fill columns for (int i = 0; i < size(); ++i) { - col_eid(i) = i; + col_eid(i) = m_events[i].m_event_id; + col_oid(i) = m_events[i].m_obs_id; col_time(i) = m_events[i].time().met(); col_live(i) = 0.0; col_multip(i) = 0; //col_telmask col_ra(i) = m_events[i].dir().ra_deg(); col_dec(i) = m_events[i].dir().dec_deg(); - col_direrr(i) = 0.0; - col_detx(i) = 0.0; - col_dety(i) = 0.0; - col_alt(i) = 0.0; - col_az(i) = 0.0; - col_alt_pnt(i) = 0.0; - col_az_pnt(i) = 0.0; - col_corex(i) = 0.0; - col_corey(i) = 0.0; - col_core_err(i) = 0.0; - col_xmax(i) = 0.0; - col_xmax_err(i) = 0.0; + col_direrr(i) = m_events[i].m_dir_err; + col_detx(i) = m_events[i].m_detx; + col_dety(i) = m_events[i].m_dety; + col_alt(i) = m_events[i].m_alt; + col_az(i) = m_events[i].m_az; + col_corex(i) = m_events[i].m_corex; + col_corey(i) = m_events[i].m_corey; + col_core_err(i) = m_events[i].m_core_err; + col_xmax(i) = m_events[i].m_xmax; + col_xmax_err(i) = m_events[i].m_xmax_err; + col_shw(i) = m_events[i].m_shwidth; + col_shl(i) = m_events[i].m_shlength; col_energy(i) = m_events[i].energy().TeV(); - col_energy_err(i) = 0.0; - col_hil_msw(i) = 0.0; - col_hil_msw_err(i) = 0.0; - col_hil_msl(i) = 0.0; - col_hil_msl_err(i) = 0.0; + col_energy_err(i) = m_events[i].m_energy_err; } // endfor: looped over rows // Append columns to table hdu->append_column(col_eid); + hdu->append_column(col_oid); hdu->append_column(col_time); hdu->append_column(col_live); hdu->append_column(col_multip); @@ -845,19 +835,15 @@ void GCTAEventList::write_events(GFitsBinTable* hdu) const hdu->append_column(col_dety); hdu->append_column(col_alt); hdu->append_column(col_az); - hdu->append_column(col_alt_pnt); - hdu->append_column(col_az_pnt); hdu->append_column(col_corex); hdu->append_column(col_corey); hdu->append_column(col_core_err); hdu->append_column(col_xmax); hdu->append_column(col_xmax_err); + hdu->append_column(col_shw); + hdu->append_column(col_shl); hdu->append_column(col_energy); hdu->append_column(col_energy_err); - hdu->append_column(col_hil_msw); - hdu->append_column(col_hil_msw_err); - hdu->append_column(col_hil_msl); - hdu->append_column(col_hil_msl_err); } // endif: there were events to write diff --git a/inst/cta/test/data/crab_cntmap.fits.gz b/inst/cta/test/data/crab_cntmap.fits.gz index 473957f..1e151c6 100644 --- a/inst/cta/test/data/crab_cntmap.fits.gz +++ b/inst/cta/test/data/crab_cntmap.fits.gz diff --git a/inst/cta/test/data/crab_events.fits.gz b/inst/cta/test/data/crab_events.fits.gz index e84b170..d83ce73 100644 --- a/inst/cta/test/data/crab_events.fits.gz +++ b/inst/cta/test/data/crab_events.fits.gz