Commit 9d9b7459b4065aac84e00039fa2b56fb0177f333

Authored by Jürgen Knödlseder
1 parent ea44fb11

Add GCTAPointing member to GCTAEventCube

inst/cta/include/GCTAEventCube.hpp
... ... @@ -37,13 +37,13 @@
37 37 #include "GGti.hpp"
38 38 #include "GEnergy.hpp"
39 39 #include "GTime.hpp"
  40 +#include "GCTAPointing.hpp"
40 41 #include "GCTAInstDir.hpp"
41 42 #include "GFitsTable.hpp"
42 43 #include "GFitsImage.hpp"
43 44  
44 45 /* __ Forward declarations _______________________________________________ */
45 46 class GFilename;
46   -class GCTAPointing;
47 47  
48 48 /* __ Constants __________________________________________________________ */
49 49 namespace gammalib {
... ... @@ -123,6 +123,8 @@ protected:
123 123 GSkyMap m_weights; //!< Cube weights stored as sky map
124 124 GCTAEventBin m_bin; //!< Actual event bin
125 125 GTime m_time; //!< Event cube mean time
  126 + GCTAPointing m_pnt; //!< Event cube pointing
  127 + bool m_has_pnt; //!< Event cube has pointing
126 128 std::vector<GCTAInstDir> m_dirs; //!< Array of event directions
127 129 std::vector<double> m_solidangle; //!< Array of solid angles (sr)
128 130 std::vector<GEnergy> m_energies; //!< Array of log mean energies
... ...
inst/cta/src/GCTAEventCube.cpp
... ... @@ -579,6 +579,12 @@ void GCTAEventCube::counts(const GSkyMap&amp; counts)
579 579 // Compute sky directions
580 580 set_directions();
581 581  
  582 + // If event cube has pointing then set DETX and DETY coordinates of
  583 + // instrument direction
  584 + if (m_has_pnt) {
  585 + set_detxy(m_pnt);
  586 + }
  587 +
582 588 // Set all weights to unity
583 589 m_weights = m_map;
584 590 m_weights = 1.0;
... ... @@ -649,6 +655,15 @@ std::string GCTAEventCube::print(const GChatter&amp; chatter) const
649 655 else {
650 656 result.append("not defined");
651 657 }
  658 +
  659 + // Append pointing
  660 + result.append("\n"+gammalib::parformat("Pointing"));
  661 + if (m_has_pnt) {
  662 + result.append(m_pnt.dir().print());
  663 + }
  664 + else {
  665 + result.append("not defined");
  666 + }
652 667  
653 668 // Append energy intervals
654 669 if (gammalib::reduce(chatter) > SILENT) {
... ... @@ -700,6 +715,8 @@ void GCTAEventCube::init_members(void)
700 715 m_weights.clear();
701 716 m_bin.clear();
702 717 m_time.clear();
  718 + m_pnt.clear();
  719 + m_has_pnt = false;
703 720 m_dirs.clear();
704 721 m_solidangle.clear();
705 722 m_energies.clear();
... ... @@ -735,6 +752,8 @@ void GCTAEventCube::copy_members(const GCTAEventCube&amp; cube)
735 752 m_map = cube.m_map;
736 753 m_weights = cube.m_weights;
737 754 m_time = cube.m_time;
  755 + m_pnt = cube.m_pnt;
  756 + m_has_pnt = cube.m_has_pnt;
738 757 m_dirs = cube.m_dirs;
739 758 m_solidangle = cube.m_solidangle;
740 759 m_energies = cube.m_energies;
... ... @@ -785,12 +804,13 @@ void GCTAEventCube::read_cntmap(const GFitsImage&amp; hdu)
785 804 // Read pointing direction
786 805 double ra_pnt = hdu.real("RA_PNT");
787 806 double dec_pnt = hdu.real("DEC_PNT");
788   - GSkyDir dir_pnt;
789   - dir_pnt.radec_deg(ra_pnt, dec_pnt);
790   - GCTAPointing pnt(dir_pnt);
  807 + GSkyDir pnt;
  808 + pnt.radec_deg(ra_pnt, dec_pnt);
  809 + m_pnt.dir(pnt);
  810 + m_has_pnt = true;
791 811  
792 812 // Set DETX and DETY coordinates of instrument direction
793   - set_detxy(pnt);
  813 + set_detxy(m_pnt);
794 814  
795 815 } // endif: header contained pointing direction
796 816  
... ...