Commit b1ebe3854dbac73b28eaffd1362323cbb294bb83

Authored by knodlseder
1 parent ed3164c6

updated for new column definition (v1.0.0)

inst/cta/include/GCTAEventAtom.hpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7   - * This program is free software; you can redistribute it and/or modify *
8   - * it under the terms of the GNU General Public License as published by *
9   - * the Free Software Foundation; either version 2 of the License, or *
10   - * (at your option) any later version. *
  7 + * This program is free software: you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation, either version 3 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * This program is distributed in the hope that it will be useful, *
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15 + * GNU General Public License for more details. *
  16 + * *
  17 + * You should have received a copy of the GNU General Public License *
  18 + * along with this program. If not, see <http://www.gnu.org/licenses/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -67,30 +75,26 @@ protected:
67 75 void free_members(void);
68 76  
69 77 // Protected members
70   - GCTAInstDir m_dir; //!< Event direction
71   - GEnergy m_energy; //!< Event energy
72   - GTime m_time; //!< Event time
73   - long m_event_id; //!< Event identifier
74   - char m_flags; //!< Flags
75   - int m_multip; //!< Multiplicity
76   - char m_telmask; //!< Telescope mask
77   - float m_dir_err; //!< Error on event direction
78   - float m_detx; //!<
79   - float m_dety; //!<
80   - float m_alt_pnt; //!< Pointing altitude
81   - float m_az_pnt; //!< Pointing azimuth
82   - float m_alt; //!< Event altitude
83   - float m_az; //!< Event azimuth
84   - float m_corex; //!<
85   - float m_corey; //!<
86   - float m_core_err; //!<
87   - float m_xmax; //!<
88   - float m_xmax_err; //!<
89   - float m_energy_err; //!< Error on event energy (MeV)
90   - float m_hil_msw; //!< Hillas width
91   - float m_hil_msw_err; //!< Error on Hillas width
92   - float m_hil_msl; //!< Hillas length
93   - float m_hil_msl_err; //!< Error on Hillas length
  78 + GCTAInstDir m_dir; //!< Event direction
  79 + GEnergy m_energy; //!< Event energy
  80 + GTime m_time; //!< Event time
  81 + unsigned long m_event_id; //!< Event identifier
  82 + unsigned long m_obs_id; //!< Observation identifier
  83 + int m_multip; //!< Multiplicity
  84 + char m_telmask; //!< Telescope mask
  85 + float m_dir_err; //!< Error on event direction
  86 + float m_detx; //!< Tangential coordinate in nominal sys
  87 + float m_dety; //!< Tangential coordinate in nominal sys
  88 + float m_alt; //!< Event altitude
  89 + float m_az; //!< Event azimuth
  90 + float m_corex; //!< Position on ground (m)
  91 + float m_corey; //!< Position on ground (m)
  92 + float m_core_err; //!< Error on core reconstruction
  93 + float m_xmax; //!< Position of shower max (g/cm2)
  94 + float m_xmax_err; //!< Error on shower max (g/cm2)
  95 + float m_shwidth; //!< Shower width (m)
  96 + float m_shlength; //!< Shower length (m)
  97 + float m_energy_err; //!< Error on event energy (MeV)
94 98 };
95 99  
96 100 #endif /* GCTAEVENTATOM_HPP */
... ...
inst/cta/include/GCTAEventList.hpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010-2011 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7   - * This program is free software; you can redistribute it and/or modify *
8   - * it under the terms of the GNU General Public License as published by *
9   - * the Free Software Foundation; either version 2 of the License, or *
10   - * (at your option) any later version. *
  7 + * This program is free software: you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation, either version 3 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * This program is distributed in the hope that it will be useful, *
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15 + * GNU General Public License for more details. *
  16 + * *
  17 + * You should have received a copy of the GNU General Public License *
  18 + * along with this program. If not, see <http://www.gnu.org/licenses/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ...
inst/cta/src/GCTAEventAtom.cpp
... ... @@ -4,10 +4,18 @@
4 4 * copyright (C) 2010 by Jurgen Knodlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7   - * This program is free software; you can redistribute it and/or modify *
8   - * it under the terms of the GNU General Public License as published by *
9   - * the Free Software Foundation; either version 2 of the License, or *
10   - * (at your option) any later version. *
  7 + * This program is free software: you can redistribute it and/or modify *
  8 + * it under the terms of the GNU General Public License as published by *
  9 + * the Free Software Foundation, either version 3 of the License, or *
  10 + * (at your option) any later version. *
  11 + * *
  12 + * This program is distributed in the hope that it will be useful, *
  13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  15 + * GNU General Public License for more details. *
  16 + * *
  17 + * You should have received a copy of the GNU General Public License *
  18 + * along with this program. If not, see <http://www.gnu.org/licenses/>. *
11 19 * *
12 20 ***************************************************************************/
13 21 /**
... ... @@ -193,14 +201,12 @@ void GCTAEventAtom::init_members(void)
193 201 m_time.clear();
194 202 m_energy.clear();
195 203 m_event_id = 0;
196   - m_flags = 0;
  204 + m_obs_id = 0;
197 205 m_multip = 0;
198 206 m_telmask = 0;
199 207 m_dir_err = 0.0;
200 208 m_detx = 0.0;
201 209 m_dety = 0.0;
202   - m_alt_pnt = 0.0;
203   - m_az_pnt = 0.0;
204 210 m_alt = 0.0;
205 211 m_az = 0.0;
206 212 m_corex = 0.0;
... ... @@ -208,11 +214,9 @@ void GCTAEventAtom::init_members(void)
208 214 m_core_err = 0.0;
209 215 m_xmax = 0.0;
210 216 m_xmax_err = 0.0;
  217 + m_shwidth = 0.0;
  218 + m_shlength = 0.0;
211 219 m_energy_err = 0.0;
212   - m_hil_msw = 0.0;
213   - m_hil_msw_err = 0.0;
214   - m_hil_msl = 0.0;
215   - m_hil_msl_err = 0.0;
216 220  
217 221 // Return
218 222 return;
... ... @@ -231,14 +235,12 @@ void GCTAEventAtom::copy_members(const GCTAEventAtom&amp; atom)
231 235 m_time = atom.m_time;
232 236 m_energy = atom.m_energy;
233 237 m_event_id = atom.m_event_id;
234   - m_flags = atom.m_flags;
  238 + m_obs_id = atom.m_obs_id;
235 239 m_multip = atom.m_multip;
236 240 m_telmask = atom.m_telmask;
237 241 m_dir_err = atom.m_dir_err;
238 242 m_detx = atom.m_detx;
239 243 m_dety = atom.m_dety;
240   - m_alt_pnt = atom.m_alt_pnt;
241   - m_az_pnt = atom.m_az_pnt;
242 244 m_alt = atom.m_alt;
243 245 m_az = atom.m_az;
244 246 m_corex = atom.m_corex;
... ... @@ -246,11 +248,9 @@ void GCTAEventAtom::copy_members(const GCTAEventAtom&amp; atom)
246 248 m_core_err = atom.m_core_err;
247 249 m_xmax = atom.m_xmax;
248 250 m_xmax_err = atom.m_xmax_err;
  251 + m_shwidth = atom.m_shwidth;
  252 + m_shlength = atom.m_shlength;
249 253 m_energy_err = atom.m_energy_err;
250   - m_hil_msw = atom.m_hil_msw;
251   - m_hil_msw_err = atom.m_hil_msw_err;
252   - m_hil_msl = atom.m_hil_msl;
253   - m_hil_msl_err = atom.m_hil_msl_err;
254 254  
255 255 // Return
256 256 return;
... ...
inst/cta/src/GCTAEventList.cpp
... ... @@ -525,29 +525,26 @@ void GCTAEventList::read_events(const GFitsTable* table)
525 525 m_events.reserve(num);
526 526  
527 527 // Get column pointers
528   - GFitsTableULongCol* ptr_eid = (GFitsTableULongCol*)&(*table)["EVENT_ID"];
529   - GFitsTableDoubleCol* ptr_time = (GFitsTableDoubleCol*)&(*table)["TIME"];
530   - GFitsTableShortCol* ptr_multip = (GFitsTableShortCol*)&(*table)["MULTIP"];
531   - GFitsTableFloatCol* ptr_ra = (GFitsTableFloatCol*)&(*table)["RA"];
532   - GFitsTableFloatCol* ptr_dec = (GFitsTableFloatCol*)&(*table)["DEC"];
533   - GFitsTableFloatCol* ptr_dir_err = (GFitsTableFloatCol*)&(*table)["DIR_ERR"];
534   - GFitsTableFloatCol* ptr_detx = (GFitsTableFloatCol*)&(*table)["DETX"];
535   - GFitsTableFloatCol* ptr_dety = (GFitsTableFloatCol*)&(*table)["DETY"];
536   - GFitsTableFloatCol* ptr_alt_pnt = (GFitsTableFloatCol*)&(*table)["ALT_PNT"];
537   - GFitsTableFloatCol* ptr_az_pnt = (GFitsTableFloatCol*)&(*table)["AZ_PNT"];
538   - GFitsTableFloatCol* ptr_alt = (GFitsTableFloatCol*)&(*table)["ALT"];
539   - GFitsTableFloatCol* ptr_az = (GFitsTableFloatCol*)&(*table)["AZ"];
540   - GFitsTableFloatCol* ptr_corex = (GFitsTableFloatCol*)&(*table)["COREX"];
541   - GFitsTableFloatCol* ptr_corey = (GFitsTableFloatCol*)&(*table)["COREY"];
542   - GFitsTableFloatCol* ptr_core_err = (GFitsTableFloatCol*)&(*table)["CORE_ERR"];
543   - GFitsTableFloatCol* ptr_xmax = (GFitsTableFloatCol*)&(*table)["XMAX"];
544   - GFitsTableFloatCol* ptr_xmax_err = (GFitsTableFloatCol*)&(*table)["XMAX_ERR"];
545   - GFitsTableFloatCol* ptr_energy = (GFitsTableFloatCol*)&(*table)["ENERGY"];
546   - GFitsTableFloatCol* ptr_energy_err = (GFitsTableFloatCol*)&(*table)["ENERGY_ERR"];
547   - GFitsTableFloatCol* ptr_hil_msw = (GFitsTableFloatCol*)&(*table)["HIL_MSW"];
548   - GFitsTableFloatCol* ptr_hil_msw_err = (GFitsTableFloatCol*)&(*table)["HIL_MSW_ERR"];
549   - GFitsTableFloatCol* ptr_hil_msl = (GFitsTableFloatCol*)&(*table)["HIL_MSL"];
550   - GFitsTableFloatCol* ptr_hil_msl_err = (GFitsTableFloatCol*)&(*table)["HIL_MSL_ERR"];
  528 + GFitsTableULongCol* ptr_eid = (GFitsTableULongCol*)&(*table)["EVENT_ID"];
  529 + GFitsTableULongCol* ptr_oid = (GFitsTableULongCol*)&(*table)["OBS_ID"];
  530 + GFitsTableDoubleCol* ptr_time = (GFitsTableDoubleCol*)&(*table)["TIME"];
  531 + GFitsTableShortCol* ptr_multip = (GFitsTableShortCol*)&(*table)["MULTIP"];
  532 + GFitsTableFloatCol* ptr_ra = (GFitsTableFloatCol*)&(*table)["RA"];
  533 + GFitsTableFloatCol* ptr_dec = (GFitsTableFloatCol*)&(*table)["DEC"];
  534 + GFitsTableFloatCol* ptr_dir_err = (GFitsTableFloatCol*)&(*table)["DIR_ERR"];
  535 + GFitsTableFloatCol* ptr_detx = (GFitsTableFloatCol*)&(*table)["DETX"];
  536 + GFitsTableFloatCol* ptr_dety = (GFitsTableFloatCol*)&(*table)["DETY"];
  537 + GFitsTableFloatCol* ptr_alt = (GFitsTableFloatCol*)&(*table)["ALT"];
  538 + GFitsTableFloatCol* ptr_az = (GFitsTableFloatCol*)&(*table)["AZ"];
  539 + GFitsTableFloatCol* ptr_corex = (GFitsTableFloatCol*)&(*table)["COREX"];
  540 + GFitsTableFloatCol* ptr_corey = (GFitsTableFloatCol*)&(*table)["COREY"];
  541 + GFitsTableFloatCol* ptr_core_err = (GFitsTableFloatCol*)&(*table)["CORE_ERR"];
  542 + GFitsTableFloatCol* ptr_xmax = (GFitsTableFloatCol*)&(*table)["XMAX"];
  543 + GFitsTableFloatCol* ptr_xmax_err = (GFitsTableFloatCol*)&(*table)["XMAX_ERR"];
  544 + GFitsTableFloatCol* ptr_shw = (GFitsTableFloatCol*)&(*table)["SHWIDTH"];
  545 + GFitsTableFloatCol* ptr_shl = (GFitsTableFloatCol*)&(*table)["SHLENGTH"];
  546 + GFitsTableFloatCol* ptr_energy = (GFitsTableFloatCol*)&(*table)["ENERGY"];
  547 + GFitsTableFloatCol* ptr_energy_err = (GFitsTableFloatCol*)&(*table)["ENERGY_ERR"];
551 548  
552 549 // Copy data from columns into GCTAEventAtom objects
553 550 GCTAEventAtom event;
... ... @@ -556,12 +553,12 @@ void GCTAEventList::read_events(const GFitsTable* table)
556 553 event.m_dir.radec_deg((*ptr_ra)(i), (*ptr_dec)(i));
557 554 event.m_energy.TeV((*ptr_energy)(i));
558 555 event.m_event_id = (*ptr_eid)(i);
  556 + event.m_obs_id = (*ptr_oid)(i);
559 557 event.m_multip = (*ptr_multip)(i);
  558 + event.m_telmask = 0;
560 559 event.m_dir_err = (*ptr_dir_err)(i);
561 560 event.m_detx = (*ptr_detx)(i);
562 561 event.m_dety = (*ptr_dety)(i);
563   - event.m_alt_pnt = (*ptr_alt_pnt)(i);
564   - event.m_az_pnt = (*ptr_az_pnt)(i);
565 562 event.m_alt = (*ptr_alt)(i);
566 563 event.m_az = (*ptr_az)(i);
567 564 event.m_corex = (*ptr_corex)(i);
... ... @@ -569,11 +566,9 @@ void GCTAEventList::read_events(const GFitsTable* table)
569 566 event.m_core_err = (*ptr_core_err)(i);
570 567 event.m_xmax = (*ptr_xmax)(i);
571 568 event.m_xmax_err = (*ptr_xmax_err)(i);
  569 + event.m_shwidth = (*ptr_shw)(i);
  570 + event.m_shlength = (*ptr_shl)(i);
572 571 event.m_energy_err = (*ptr_energy_err)(i);
573   - event.m_hil_msw = (*ptr_hil_msw)(i);
574   - event.m_hil_msw_err = (*ptr_hil_msw_err)(i);
575   - event.m_hil_msl = (*ptr_hil_msl)(i);
576   - event.m_hil_msl_err = (*ptr_hil_msl_err)(i);
577 572 m_events.push_back(event);
578 573 }
579 574  
... ... @@ -778,6 +773,7 @@ void GCTAEventList::write_events(GFitsBinTable* hdu) const
778 773  
779 774 // Allocate columns
780 775 GFitsTableULongCol col_eid = GFitsTableULongCol("EVENT_ID", size());
  776 + GFitsTableULongCol col_oid = GFitsTableULongCol("OBS_ID", size());
781 777 GFitsTableDoubleCol col_time = GFitsTableDoubleCol("TIME", size());
782 778 GFitsTableDoubleCol col_live = GFitsTableDoubleCol("TLIVE", size());
783 779 GFitsTableShortCol col_multip = GFitsTableShortCol("MULTIP", size());
... ... @@ -789,51 +785,45 @@ void GCTAEventList::write_events(GFitsBinTable* hdu) const
789 785 GFitsTableFloatCol col_dety = GFitsTableFloatCol("DETY", size());
790 786 GFitsTableFloatCol col_alt = GFitsTableFloatCol("ALT", size());
791 787 GFitsTableFloatCol col_az = GFitsTableFloatCol("AZ", size());
792   - GFitsTableFloatCol col_alt_pnt = GFitsTableFloatCol("ALT_PNT", size());
793   - GFitsTableFloatCol col_az_pnt = GFitsTableFloatCol("AZ_PNT", size());
794 788 GFitsTableFloatCol col_corex = GFitsTableFloatCol("COREX", size());
795 789 GFitsTableFloatCol col_corey = GFitsTableFloatCol("COREY", size());
796 790 GFitsTableFloatCol col_core_err = GFitsTableFloatCol("CORE_ERR", size());
797 791 GFitsTableFloatCol col_xmax = GFitsTableFloatCol("XMAX", size());
798 792 GFitsTableFloatCol col_xmax_err = GFitsTableFloatCol("XMAX_ERR", size());
  793 + GFitsTableFloatCol col_shw = GFitsTableFloatCol("SHWIDTH", size());
  794 + GFitsTableFloatCol col_shl = GFitsTableFloatCol("SHLENGTH", size());
799 795 GFitsTableFloatCol col_energy = GFitsTableFloatCol("ENERGY", size());
800 796 GFitsTableFloatCol col_energy_err = GFitsTableFloatCol("ENERGY_ERR", size());
801   - GFitsTableFloatCol col_hil_msw = GFitsTableFloatCol("HIL_MSW", size());
802   - GFitsTableFloatCol col_hil_msw_err = GFitsTableFloatCol("HIL_MSW_ERR", size());
803   - GFitsTableFloatCol col_hil_msl = GFitsTableFloatCol("HIL_MSL", size());
804   - GFitsTableFloatCol col_hil_msl_err = GFitsTableFloatCol("HIL_MSL_ERR", size());
805 797  
806 798 // Fill columns
807 799 for (int i = 0; i < size(); ++i) {
808   - col_eid(i) = i;
  800 + col_eid(i) = m_events[i].m_event_id;
  801 + col_oid(i) = m_events[i].m_obs_id;
809 802 col_time(i) = m_events[i].time().met();
810 803 col_live(i) = 0.0;
811 804 col_multip(i) = 0;
812 805 //col_telmask
813 806 col_ra(i) = m_events[i].dir().ra_deg();
814 807 col_dec(i) = m_events[i].dir().dec_deg();
815   - col_direrr(i) = 0.0;
816   - col_detx(i) = 0.0;
817   - col_dety(i) = 0.0;
818   - col_alt(i) = 0.0;
819   - col_az(i) = 0.0;
820   - col_alt_pnt(i) = 0.0;
821   - col_az_pnt(i) = 0.0;
822   - col_corex(i) = 0.0;
823   - col_corey(i) = 0.0;
824   - col_core_err(i) = 0.0;
825   - col_xmax(i) = 0.0;
826   - col_xmax_err(i) = 0.0;
  808 + col_direrr(i) = m_events[i].m_dir_err;
  809 + col_detx(i) = m_events[i].m_detx;
  810 + col_dety(i) = m_events[i].m_dety;
  811 + col_alt(i) = m_events[i].m_alt;
  812 + col_az(i) = m_events[i].m_az;
  813 + col_corex(i) = m_events[i].m_corex;
  814 + col_corey(i) = m_events[i].m_corey;
  815 + col_core_err(i) = m_events[i].m_core_err;
  816 + col_xmax(i) = m_events[i].m_xmax;
  817 + col_xmax_err(i) = m_events[i].m_xmax_err;
  818 + col_shw(i) = m_events[i].m_shwidth;
  819 + col_shl(i) = m_events[i].m_shlength;
827 820 col_energy(i) = m_events[i].energy().TeV();
828   - col_energy_err(i) = 0.0;
829   - col_hil_msw(i) = 0.0;
830   - col_hil_msw_err(i) = 0.0;
831   - col_hil_msl(i) = 0.0;
832   - col_hil_msl_err(i) = 0.0;
  821 + col_energy_err(i) = m_events[i].m_energy_err;
833 822 } // endfor: looped over rows
834 823  
835 824 // Append columns to table
836 825 hdu->append_column(col_eid);
  826 + hdu->append_column(col_oid);
837 827 hdu->append_column(col_time);
838 828 hdu->append_column(col_live);
839 829 hdu->append_column(col_multip);
... ... @@ -845,19 +835,15 @@ void GCTAEventList::write_events(GFitsBinTable* hdu) const
845 835 hdu->append_column(col_dety);
846 836 hdu->append_column(col_alt);
847 837 hdu->append_column(col_az);
848   - hdu->append_column(col_alt_pnt);
849   - hdu->append_column(col_az_pnt);
850 838 hdu->append_column(col_corex);
851 839 hdu->append_column(col_corey);
852 840 hdu->append_column(col_core_err);
853 841 hdu->append_column(col_xmax);
854 842 hdu->append_column(col_xmax_err);
  843 + hdu->append_column(col_shw);
  844 + hdu->append_column(col_shl);
855 845 hdu->append_column(col_energy);
856 846 hdu->append_column(col_energy_err);
857   - hdu->append_column(col_hil_msw);
858   - hdu->append_column(col_hil_msw_err);
859   - hdu->append_column(col_hil_msl);
860   - hdu->append_column(col_hil_msl_err);
861 847  
862 848 } // endif: there were events to write
863 849  
... ...
inst/cta/test/data/crab_cntmap.fits.gz
No preview for this file type
inst/cta/test/data/crab_events.fits.gz
No preview for this file type