Commit 444d0496c31a71fd5e3136e59f63f66a89d53b00

Authored by Jürgen Knödlseder
1 parent 9d815502

Add event identifier to event list.

src/ctobssim/ctobssim.cpp
@@ -733,8 +733,10 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, @@ -733,8 +733,10 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models,
733 *obs, 733 *obs,
734 ran); 734 ran);
735 if (event != NULL) { 735 if (event != NULL) {
  736 + event->event_id(m_event_id);
736 events->append(*event); 737 events->append(*event);
737 delete event; 738 delete event;
  739 + m_event_id++;
738 } 740 }
739 741
740 } // endfor: looped over events 742 } // endfor: looped over events
@@ -873,6 +875,10 @@ void ctobssim::simulate_background(GCTAObservation* obs, @@ -873,6 +875,10 @@ void ctobssim::simulate_background(GCTAObservation* obs,
873 // Get event pointer 875 // Get event pointer
874 GCTAEventAtom* event = (*list)[k]; 876 GCTAEventAtom* event = (*list)[k];
875 877
  878 + // Set event identifier
  879 + event->event_id(m_event_id);
  880 + m_event_id++;
  881 +
876 // Append event 882 // Append event
877 events->append(*event); 883 events->append(*event);
878 884
@@ -943,6 +949,9 @@ void ctobssim::init_members(void) @@ -943,6 +949,9 @@ void ctobssim::init_members(void)
943 // a better mechanism to implement the CTA reference MJD. 949 // a better mechanism to implement the CTA reference MJD.
944 m_cta_ref.set(G_CTA_MJDREF, "s", "TT", "LOCAL"); 950 m_cta_ref.set(G_CTA_MJDREF, "s", "TT", "LOCAL");
945 951
  952 + // Initialise first event identifier
  953 + m_event_id = 1;
  954 +
946 // Set logger properties 955 // Set logger properties
947 log.date(true); 956 log.date(true);
948 957
@@ -982,6 +991,7 @@ void ctobssim::copy_members(const ctobssim& app) @@ -982,6 +991,7 @@ void ctobssim::copy_members(const ctobssim& app)
982 m_use_xml = app.m_use_xml; 991 m_use_xml = app.m_use_xml;
983 m_read_ahead = app.m_read_ahead; 992 m_read_ahead = app.m_read_ahead;
984 m_cta_ref = app.m_cta_ref; 993 m_cta_ref = app.m_cta_ref;
  994 + m_event_id = app.m_event_id;
985 995
986 // Return 996 // Return
987 return; 997 return;
src/ctobssim/ctobssim.hpp
@@ -102,6 +102,7 @@ protected: @@ -102,6 +102,7 @@ protected:
102 bool m_use_xml; //!< Use XML file instead of FITS file 102 bool m_use_xml; //!< Use XML file instead of FITS file
103 bool m_read_ahead; //!< Read ahead parameters 103 bool m_read_ahead; //!< Read ahead parameters
104 GTimeReference m_cta_ref; //!< CTA time reference 104 GTimeReference m_cta_ref; //!< CTA time reference
  105 + int m_event_id; //!< Event identifier
105 }; 106 };
106 107
107 #endif /* CTOBSSIM_HPP */ 108 #endif /* CTOBSSIM_HPP */