GammaLib 2.0.0
Loading...
Searching...
No Matches
GCOMEventCube.cpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCOMEventCube.cpp - COMPTEL event bin container class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2012-2022 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- *
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 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/>. *
19 * *
20 ***************************************************************************/
21/**
22 * @file GCOMEventCube.cpp
23 * @brief COMPTEL event bin container class implementation
24 * @author Juergen Knoedlseder
25 */
26
27/* __ Includes ___________________________________________________________ */
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31#include "GException.hpp"
32#include "GTools.hpp"
33#include "GFits.hpp"
34#include "GFilename.hpp"
35#include "GCOMTools.hpp"
36#include "GCOMSupport.hpp"
37#include "GCOMEventCube.hpp"
38
39/* __ Method name definitions ____________________________________________ */
40#define G_NAXIS "GCOMEventCube::naxis(int)"
41#define G_SET_SCATTER_DIRECTIONS "GCOMEventCube::set_scatter_directions()"
42#define G_SET_ENERGIES "GCOMEventCube::set_energies()"
43#define G_SET_TIMES "GCOMEventCube::set_times()"
44#define G_SET_BIN "GCOMEventCube::set_bin(int&)"
45
46/* __ Macros _____________________________________________________________ */
47
48/* __ Coding definitions _________________________________________________ */
49
50/* __ Debug definitions __________________________________________________ */
51
52
53
54/*==========================================================================
55 = =
56 = Constructors/destructors =
57 = =
58 ==========================================================================*/
59
60/***********************************************************************//**
61 * @brief Void constructor
62 *
63 * Constructs an empty event cube.
64 ***************************************************************************/
66{
67 // Initialise members
69
70 // Return
71 return;
72}
73
74
75/***********************************************************************//**
76 * @brief Load constructor
77 *
78 * @param[in] filename DRE FITS filename.
79 *
80 * Constructs an event cube from a DRE FITS file.
81 ***************************************************************************/
83{
84 // Initialise members
86
87 // Load event cube
88 load(filename);
89
90 // Return
91 return;
92}
93
94
95/***********************************************************************//**
96 * @brief DRE constructor
97 *
98 * @param[in] dre DRE event cube.
99 *
100 * Constructs an event cube from a DRE event cube.
101 ***************************************************************************/
103{
104 // Initialise members
105 init_members();
106
107 // Set DRE event cube
108 m_dri = dre;
109
110 // Initialise event cube
111 init_cube();
112
113 // Return
114 return;
115}
116
117
118/***********************************************************************//**
119 * @brief Copy constructor
120 *
121 * @param[in] cube Event cube.
122 ***************************************************************************/
124{
125 // Initialise members
126 init_members();
127
128 // Copy members
129 copy_members(cube);
130
131 // Return
132 return;
133}
134
135
136/***********************************************************************//**
137 * @brief Destructor
138 ***************************************************************************/
140{
141 // Free members
142 free_members();
143
144 // Return
145 return;
146}
147
148
149/*==========================================================================
150 = =
151 = Operators =
152 = =
153 ==========================================================================*/
154
155/***********************************************************************//**
156 * @brief Assignment operator
157 *
158 * @param[in] cube Event cube.
159 * @return Event cube.
160 ***************************************************************************/
162{
163 // Execute only if object is not identical
164 if (this != &cube) {
165
166 // Copy base class members
167 this->GEventCube::operator=(cube);
168
169 // Free members
170 free_members();
171
172 // Initialise members
173 init_members();
174
175 // Copy members
176 copy_members(cube);
177
178 } // endif: object was not identical
179
180 // Return this object
181 return *this;
182}
183
184
185/***********************************************************************//**
186 * @brief Event bin access operator
187 *
188 * @param[in] index Event index [0,...,size()-1].
189 * @return Pointer to event bin.
190 *
191 * Returns pointer to an event bin. Note that the returned pointer is in
192 * fact always the same, but the method sets the pointers within the
193 * event bin so that they point to the appropriate information.
194 ***************************************************************************/
196{
197 // Set event bin
198 set_bin(index);
199
200 // Return pointer
201 return (&m_bin);
202}
203
204
205/***********************************************************************//**
206 * @brief Event bin access operator (const version)
207 *
208 * @param[in] index Event index [0,...,size()-1].
209 * @return Const pointer to event bin.
210 *
211 * Returns pointer to an event bin. Note that the returned pointer is in
212 * fact always the same, but the method sets the pointers within the
213 * event bin so that they point to the appropriate information.
214 ***************************************************************************/
215const GCOMEventBin* GCOMEventCube::operator[](const int& index) const
216{
217 // Set event bin (circumvent const correctness)
218 const_cast<GCOMEventCube*>(this)->set_bin(index);
219
220 // Return pointer
221 return (&m_bin);
222}
223
224
225/*==========================================================================
226 = =
227 = Public methods =
228 = =
229 ==========================================================================*/
230
231/***********************************************************************//**
232 * @brief Clear instance
233 *
234 * This method properly resets the object to an initial state.
235 ***************************************************************************/
237{
238 // Free class members (base and derived classes, derived class first)
239 free_members();
241 this->GEvents::free_members();
242
243 // Initialise members
244 this->GEvents::init_members();
246 init_members();
247
248 // Return
249 return;
250}
251
252
253/***********************************************************************//**
254 * @brief Clone instance
255 *
256 * @return Pointer to deep copy of event cube.
257 ***************************************************************************/
259{
260 return new GCOMEventCube(*this);
261}
262
263
264/***********************************************************************//**
265 * @brief Return dimension of event cube
266 *
267 * @return Number of dimensions in event cube.
268 *
269 * The dimension of the cube is either 2 or 3, depending on whether several
270 * scatter angle layers exist or not.
271 ***************************************************************************/
272int GCOMEventCube::dim(void) const
273{
274 // Compute dimension from sky map
275 int dim = (m_dri.nphibar() > 1) ? 3 : 2;
276
277 // Return dimension
278 return dim;
279}
280
281
282/***********************************************************************//**
283 * @brief Return number of bins in axis
284 *
285 * @param[in] axis Axis [0,...,dim()-1].
286 * @return Number of bins in axis.
287 *
288 * @exception GException::out_of_range
289 * Axis is out of range.
290 *
291 * Returns the number of bins along a given event cube @p axis.
292 ***************************************************************************/
293int GCOMEventCube::naxis(const int& axis) const
294{
295 // Optionally check if the axis is valid
296 #if defined(G_RANGE_CHECK)
297 if (axis < 0 || axis >= dim()) {
298 throw GException::out_of_range(G_NAXIS, "COMPTEL event cube axis", axis, dim());
299 }
300 #endif
301
302 // Set result
303 int naxis = 0;
304 switch (axis) {
305 case 0:
306 naxis = m_dri.nchi();
307 break;
308 case 1:
309 naxis = m_dri.npsi();
310 break;
311 case 2:
312 naxis = m_dri.nphibar();
313 break;
314 }
315
316 // Return result
317 return naxis;
318}
319
320
321/***********************************************************************//**
322 * @brief Load COMPTEL event cube from FITS file
323 *
324 * @param[in] filename FITS filename.
325 *
326 * Loads the event cube from a DRE FITS file.
327 ***************************************************************************/
328void GCOMEventCube::load(const GFilename& filename)
329{
330 // Open DRE FITS file
331 GFits fits(filename);
332
333 // Load DRE cube from FITS file
334 read(fits);
335
336 // Close FITS file
337 fits.close();
338
339 // Return
340 return;
341}
342
343
344/***********************************************************************//**
345 * @brief Save COMPTEL event cube into FITS file
346 *
347 * @param[in] filename FITS filename.
348 * @param[in] clobber Overwrite existing FITS file? (default: false).
349 *
350 * Saves the COMPTEL event cube into a DRE FITS file.
351 ***************************************************************************/
352void GCOMEventCube::save(const GFilename& filename, const bool& clobber) const
353{
354 // Create empty FITS file
355 GFits fits;
356
357 // Write event cube into FITS file
358 write(fits);
359
360 // Save FITS file
361 fits.saveto(filename, clobber);
362
363 // Return
364 return;
365}
366
367
368/***********************************************************************//**
369 * @brief Read COMPTEL event cube from FITS file
370 *
371 * @param[in] fits FITS file.
372 *
373 * Reads an COMPTEL event cube from a DRE FITS file.
374 ***************************************************************************/
375void GCOMEventCube::read(const GFits& fits)
376{
377 // Clear object
378 clear();
379
380 // Get image
381 const GFitsImage& image = *fits.image("Primary");
382
383 // Read DRI
384 m_dri.read(image);
385
386 // Initialise event cube
387 init_cube();
388
389 // Return
390 return;
391}
392
393
394/***********************************************************************//**
395 * @brief Write COMPTEL event cube into FITS file.
396 *
397 * @param[in] file FITS file.
398 *
399 * Writes the COMPTEL event cube into a DRE FITS file.
400 ***************************************************************************/
402{
403 // Write cube
404 m_dri.write(file);
405
406 // Return
407 return;
408}
409
410
411/***********************************************************************//**
412 * @brief Return number of events in cube
413 *
414 * @return Number of events in event cube.
415 *
416 * This method returns the number of events in the event cube rounded to the
417 * nearest integer.
418 ***************************************************************************/
420{
421 // Initialise result
422 double number = 0.0;
423
424 // Sum event cube
425 for (int i = 0; i < m_dri.size(); ++i) {
426 number += m_dri[i];
427 }
428
429 // Return
430 return int(number+0.5);
431}
432
433
434/***********************************************************************//**
435 * @brief Print event cube information
436 *
437 * @param[in] chatter Chattiness.
438 * @return String containing event cube information.
439 ***************************************************************************/
440std::string GCOMEventCube::print(const GChatter& chatter) const
441{
442 // Initialise result string
443 std::string result;
444
445 // Continue only if chatter is not silent
446 if (chatter != SILENT) {
447
448 // Append header
449 result.append("=== GCOMEventCube ===");
450
451 // Append information
452 result.append("\n"+gammalib::parformat("Number of events"));
453 result.append(gammalib::str(number()));
454 result.append("\n"+gammalib::parformat("Number of elements"));
455 result.append(gammalib::str(size()));
456 result.append("\n"+gammalib::parformat("Size (Chi x Psi x Phi)"));
457 result.append(gammalib::str(m_dri.nchi())+" x ");
458 result.append(gammalib::str(m_dri.npsi())+" x ");
459 result.append(gammalib::str(m_dri.nphibar()));
460 result.append("\n"+gammalib::parformat("Energy range"));
461 result.append(gammalib::str(emin().MeV())+" - ");
462 result.append(gammalib::str(emax().MeV())+" MeV");
463 result.append("\n"+gammalib::parformat("Mean energy"));
464 result.append(m_energy.print(chatter));
465 result.append("\n"+gammalib::parformat("Energy bin width"));
466 result.append(m_ewidth.print(chatter));
467 result.append("\n"+gammalib::parformat("MJD interval"));
468 result.append(gammalib::str(tstart().mjd())+" - ");
469 result.append(gammalib::str(tstop().mjd())+" days");
470 result.append("\n"+gammalib::parformat("UTC interval"));
471 result.append(tstart().utc()+" - ");
472 result.append(tstop().utc());
473 result.append("\n"+gammalib::parformat("TJD interval"));
474 result.append(gammalib::str(gammalib::com_tjd(tstart()))+":");
475 result.append(gammalib::str(gammalib::com_tics(tstart()))+" - ");
476 result.append(gammalib::str(gammalib::com_tjd(tstop()))+":");
477 result.append(gammalib::str(gammalib::com_tics(tstop())));
478 result.append("\n"+gammalib::parformat("Mean time"));
479 result.append(m_time.print(chatter));
480 result.append("\n"+gammalib::parformat("Ontime"));
481 result.append(gammalib::str(m_ontime)+" s");
482
483 // Append ToF correction
484 double tofcor = m_dri.tof_correction();
485 result.append("\n"+gammalib::parformat("ToF correction"));
486 result.append(gammalib::str(tofcor));
487
488 // Append pulsar phase correction
489 double phasecor = m_dri.phase_correction();
490 result.append("\n"+gammalib::parformat("Phase correction"));
491 result.append(gammalib::str(phasecor));
492
493 // EXPLICIT: Append DRI
494 if (chatter >= EXPLICIT) {
495 result.append("\n"+m_dri.print(chatter));
496 }
497
498 } // endif: chatter was not silent
499
500 // Return result
501 return result;
502}
503
504
505/*==========================================================================
506 = =
507 = Private methods =
508 = =
509 ==========================================================================*/
510
511/***********************************************************************//**
512 * @brief Initialise class members
513 *
514 * The method initialises the class members to a well defined state. It also
515 * prepares the event bin member that will be returned in case of an operator
516 * access to the class. As the event bin member manipulates pointers, it will
517 * be possible to directly write to the memory that has been associated with
518 * a bin.
519 ***************************************************************************/
521{
522 // Initialise members
523 m_bin.clear();
524 m_dir.clear();
525 m_dri.clear();
526 m_time.clear();
527 m_ontime = 0.0;
528 m_energy.clear();
529 m_ewidth.clear();
530 m_npix = 0;
531 m_dirs.clear();
532 m_solidangle.clear();
533 m_phibar.clear();
534
535 // Prepare event bin
536 init_bin();
537
538 // Return
539 return;
540}
541
542
543/***********************************************************************//**
544 * @brief Copy class members
545 *
546 * @param[in] cube Event cube.
547 *
548 * This method copies the class members from another event cube in the actual
549 * object. It also prepares the event bin member that will be returned in
550 * case of an operator access to the class.
551 ***************************************************************************/
553{
554 // Copy members. Note that the event bin is not copied as it will
555 // be initialised later. The event bin serves just as a container of
556 // pointers, hence we do not want to copy over the pointers from the
557 // original class.
558 m_dir = cube.m_dir;
559 m_dri = cube.m_dri;
560 m_time = cube.m_time;
561 m_ontime = cube.m_ontime;
562 m_energy = cube.m_energy;
563 m_ewidth = cube.m_ewidth;
564 m_npix = cube.m_npix;
565 m_dirs = cube.m_dirs;
567 m_phibar = cube.m_phibar;
568
569 // Prepare event bin
570 init_bin();
571
572 // Return
573 return;
574}
575
576
577/***********************************************************************//**
578 * @brief Delete class members
579 ***************************************************************************/
581{
582 // Return
583 return;
584}
585
586
587/***********************************************************************//**
588 * @brief Initialise event cube
589 *
590 * This method needs to be called once a new DRI dataset has been read.
591 *
592 * The method copies the energy boundaries and the Good Time Intervals from
593 * the DRI cube into the event cube and sets up arrays that will be used
594 * for event bin access. In particular, the set_scatter_directions(),
595 * set_scatter_angles(), set_energies() and set_times() methods will be
596 * called by this method.
597 ***************************************************************************/
599{
600 // Copy energy boundaries from DRI
602
603 // Copy Good Time Intervals from DRI
604 gti(m_dri.gti());
605
606 // Set scatter directions
608
609 // Set scatter angles
611
612 // Set energies
613 set_energies();
614
615 // Set times
616 set_times();
617
618 // Return
619 return;
620}
621
622
623/***********************************************************************//**
624 * @brief Set sky directions and solid angles of events cube
625 *
626 * @exception GException::invalid_value
627 * No sky pixels have been defined.
628 *
629 * This method computes the sky directions and solid angles for all (Chi,Psi)
630 * values of the event cube. Sky directions are stored in an array of GSkyDir
631 * objects while solid angles are stored in units of sr in an array of double
632 * precision variables.
633 ***************************************************************************/
635{
636 // Compute number of sky pixels
637 m_npix = m_dri.nchi() * m_dri.npsi();
638
639 // Throw an error if we have no sky pixels
640 if (m_npix < 1) {
641 std::string msg = "No sky pixels have been found in event cube. "
642 "Every COMPTEL event cube needs a definition of "
643 "sky pixels.";
645 }
646
647 // Clear vectors
648 m_dirs.clear();
649 m_solidangle.clear();
650
651 // Reserve space for pixel directions and solid angles
652 m_dirs.reserve(m_npix);
653 m_solidangle.reserve(m_npix);
654
655 // Set pixel directions and solid angles
656 for (int iy = 0; iy < m_dri.npsi(); ++iy) {
657 for (int ix = 0; ix < m_dri.nchi(); ++ix) {
658 GSkyPixel pixel = GSkyPixel(double(ix), double(iy));
659 m_dirs.push_back(m_dri.map().pix2dir(pixel));
660 m_solidangle.push_back(m_dri.map().solidangle(pixel));
661 }
662 }
663
664 // Return
665 return;
666}
667
668
669/***********************************************************************//**
670 * @brief Set Compton scatter angles of event cube
671 *
672 * Sets a vector of the Compton scatter angles.
673 ***************************************************************************/
675{
676 // Clear vector
677 m_phibar.clear();
678
679 // Reserve space for pixel directions and solid angles
680 m_phibar.reserve(m_dri.nphibar());
681
682 // Set scatter angles
683 for (int iz = 0; iz < m_dri.nphibar(); ++iz) {
684 double phibar = m_dri.phimin() + (iz+0.5)*m_dri.phibin();
685 m_phibar.push_back(phibar);
686 }
687
688 // Return
689 return;
690}
691
692
693/***********************************************************************//**
694 * @brief Set log mean energy and energy width of event cube
695 *
696 * @exception GException::invalid_value
697 * No energy boundaries found.
698 *
699 * Computes the mean energy and energy bin width of the event cube.
700 ***************************************************************************/
702{
703 // Throw an error if GTI is empty
704 if (m_ebounds.size() < 1) {
705 std::string msg = "No energy boundaries have been found in event "
706 "cube. Every COMPTEL event cube needs a definition "
707 "of the energy boundaries.";
709 }
710
711 // Compute the logarithmic mean energy
713
714 // Compute the energy bin size
716
717 // Return
718 return;
719}
720
721
722/***********************************************************************//**
723 * @brief Set mean event time and ontime of event cube
724 *
725 * @exception GException::invalid_value
726 * No Good Time Intervals found.
727 *
728 * Computes the mean time of the event cube by taking the mean between start
729 * and stop time. Computes also the ontime by summing up of all good time
730 * intervals.
731 ***************************************************************************/
733{
734 // Throw an error if GTI is empty
735 if (m_gti.size() < 1) {
736 std::string msg = "No Good Time Intervals have been found in event "
737 "cube. Every COMPTEL event cube needs a definition "
738 "of the Good Time Intervals.";
740 }
741
742 // Compute mean time
743 m_time = m_gti.tstart() + 0.5 * (m_gti.tstop() - m_gti.tstart());
744
745 // Set ontime
747
748 // Return
749 return;
750}
751
752
753/***********************************************************************//**
754 * @brief Initialise event bin
755 *
756 * This method initialises the event bin. The event bin is cleared and all
757 * fixed pointers are set. Only the m_counts and the m_solidangle member of the
758 * event bin will be set to NULL, but these will be set by the set_bin method
759 * which is called before any event bin access.
760 ***************************************************************************/
762{
763 // Prepare event bin
765 m_bin.m_counts = NULL; //!< Will be set by set_bin method
766 m_bin.m_dir = &m_dir; //!< Content will be set by set_bin method
767 m_bin.m_solidangle = NULL; //!< Will be set by set_bin method
768 m_bin.m_time = &m_time; //!< Fixed content
769 m_bin.m_ontime = &m_ontime; //!< Fixed content
770 m_bin.m_energy = &m_energy; //!< Fixed content
771 m_bin.m_ewidth = &m_ewidth; //!< Fixed content
772
773 // Return
774 return;
775}
776
777
778/***********************************************************************//**
779 * @brief Set event bin
780 *
781 * @param[in] index Event index [0,...,size()[.
782 *
783 * @exception GException::out_of_range
784 * Event index is outside valid range.
785 * @exception GException::invalid_value
786 * Sky directions and solid angles vectors have not been set up.
787 *
788 * This method provides the event attributes to the event bin. The event bin
789 * is in fact physically stored in the event cube, and only a single event
790 * bin is indeed allocated. This method sets up the pointers in the event
791 * bin so that a client can easily access the information of individual bins
792 * as if they were stored in an array.
793 ***************************************************************************/
794void GCOMEventCube::set_bin(const int& index)
795{
796 // Optionally check if the index is valid
797 #if defined(G_RANGE_CHECK)
798 if (index < 0 || index >= size()) {
799 throw GException::out_of_range(G_SET_BIN, "Event index", index, size());
800 }
801 #endif
802
803 // Check for the existence of sky directions and solid angles
804 if (m_dirs.size() != m_npix || m_solidangle.size() != m_npix) {
805 std::string msg = "Sky direction vector has not been setup for "
806 "event cube. Every COMPTEL event cube needs an "
807 "internal vector of sky directions.";
809 }
810
811 // Get pixel and energy bin indices.
812 int ipix = index % m_npix;
813 int iphi = index / m_npix;
814
815 // Set indices
816 m_bin.m_index = index;
817
818 // Set instrument direction
819 m_dir.dir(m_dirs[ipix]);
820 m_dir.phibar(m_phibar[iphi]);
821
822 // Set pointers
823 m_bin.m_counts = &(m_dri[index]);
825
826 // Return
827 return;
828}
#define G_SET_TIMES
#define G_SET_ENERGIES
#define G_SET_SCATTER_DIRECTIONS
#define G_SET_BIN
#define G_NAXIS
COMPTEL event bin container class interface definition.
Implementation of support function used by COMPTEL classes.
Definition of COMPTEL tools.
Exception handler interface definition.
Filename class interface definition.
FITS file class interface definition.
Gammalib tools definition.
GChatter
Definition GTypemaps.hpp:33
@ EXPLICIT
Definition GTypemaps.hpp:37
@ SILENT
Definition GTypemaps.hpp:34
COMPTEL Data Space class.
Definition GCOMDri.hpp:61
const GEbounds & ebounds(void) const
Return energy boundaries of DRI cube.
Definition GCOMDri.hpp:306
virtual void clear(void)
Clear COMPTEL Data Space.
Definition GCOMDri.cpp:228
const double & phase_correction(void) const
Return pulsar phase correction factor.
Definition GCOMDri.hpp:418
int nchi(void) const
Return number of Chi bins.
Definition GCOMDri.hpp:231
const double & tof_correction(void) const
Return ToF correction factor.
Definition GCOMDri.hpp:387
const GGti & gti(void) const
Return Good Time Intervals of DRI cube.
Definition GCOMDri.hpp:333
const double & phibin(void) const
Return Compton scatter angle bin of DRI cube.
Definition GCOMDri.hpp:372
const GSkyMap & map(void) const
Return DRI sky map.
Definition GCOMDri.hpp:267
const double & phimin(void) const
Return minimum Compton scatter angle of DRI cube.
Definition GCOMDri.hpp:360
virtual std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL Data Space.
Definition GCOMDri.cpp:988
int npsi(void) const
Return number of Psi bins.
Definition GCOMDri.hpp:243
int size(void) const
Return number of bins.
Definition GCOMDri.hpp:219
void write(GFits &fits, const std::string &extname="") const
Write COMPTEL Data Space into FITS image.
Definition GCOMDri.cpp:967
int nphibar(void) const
Return number of Phibar bins.
Definition GCOMDri.hpp:255
void read(const GFitsImage &image)
Read COMPTEL Data Space from DRI FITS image.
Definition GCOMDri.cpp:942
COMPTEL event bin class.
GEnergy * m_ewidth
Pointer to energy width of bin.
double * m_counts
Pointer to number of counts.
GTime * m_time
Pointer to bin time.
GCOMInstDir * m_dir
Pointer to bin direction.
double * m_ontime
Pointer to ontime of bin (seconds)
double * m_solidangle
Pointer to solid angle of pixel (sr)
int m_index
Dataspace index.
virtual void clear(void)
Clear instance.
GEnergy * m_energy
Pointer to bin energy.
void free_members(void)
Delete class members.
COMPTEL event bin container class.
virtual void set_times(void)
Set mean event time and ontime of event cube.
int m_npix
Number of DRI pixels.
GEnergy m_ewidth
Event cube energy bin width.
virtual int dim(void) const
Return dimension of event cube.
virtual void load(const GFilename &filename)
Load COMPTEL event cube from FITS file.
std::vector< double > m_phibar
Array of event scatter angles.
virtual int number(void) const
Return number of events in cube.
virtual GCOMEventBin * operator[](const int &index)
Event bin access operator.
virtual int size(void) const
Return number of bins in event cube.
void free_members(void)
Delete class members.
std::vector< double > m_solidangle
Array of solid angles (sr)
void set_scatter_directions(void)
Set sky directions and solid angles of events cube.
virtual ~GCOMEventCube(void)
Destructor.
void init_members(void)
Initialise class members.
virtual GCOMEventCube * clone(void) const
Clone instance.
GTime m_time
Event cube mean time.
GCOMEventCube(void)
Void constructor.
virtual void save(const GFilename &filename, const bool &clobber=false) const
Save COMPTEL event cube into FITS file.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print event cube information.
virtual void read(const GFits &file)
Read COMPTEL event cube from FITS file.
void set_scatter_angles(void)
Set Compton scatter angles of event cube.
const GCOMDri & dre(void) const
Return reference to DRE data.
void init_bin(void)
Initialise event bin.
std::vector< GSkyDir > m_dirs
Array of event scatter directions.
double m_ontime
Event cube ontime (sec)
virtual GCOMEventCube & operator=(const GCOMEventCube &cube)
Assignment operator.
virtual void clear(void)
Clear instance.
void init_cube(void)
Initialise event cube.
virtual void set_energies(void)
Set log mean energy and energy width of event cube.
GCOMDri m_dri
DRI cube.
GEnergy m_energy
Event cube mean energy.
virtual void write(GFits &file) const
Write COMPTEL event cube into FITS file.
void copy_members(const GCOMEventCube &cube)
Copy class members.
GCOMEventBin m_bin
Actual event bin.
virtual int naxis(const int &axis) const
Return number of bins in axis.
void set_bin(const int &index)
Set event bin.
GCOMInstDir m_dir
Actual event direction.
void dir(const GSkyDir &dir)
Set event scatter direction.
virtual void clear(void)
Clear instance.
void phibar(const double &phibar)
Set event Compton scatter angle.
const GEnergy & emax(void) const
Return maximum energy of all intervals.
Definition GEbounds.hpp:199
int size(void) const
Return number of energy boundaries.
Definition GEbounds.hpp:163
GEnergy elogmean(const int &index) const
Returns logarithmic mean energy for a given energy interval.
const GEnergy & emin(void) const
Return minimum energy of all intervals.
Definition GEbounds.hpp:187
std::string print(const GChatter &chatter=NORMAL) const
Print energy.
Definition GEnergy.cpp:748
void clear(void)
Clear instance.
Definition GEnergy.cpp:261
Abstract event bin container class.
void free_members(void)
Delete class members.
void init_members(void)
Initialise class members.
virtual GEventCube & operator=(const GEventCube &cube)
Assignment operator.
void free_members(void)
Delete class members.
Definition GEvents.cpp:206
GGti m_gti
Good time intervals covered by events.
Definition GEvents.hpp:112
const GTime & tstart(void) const
Return start time.
Definition GEvents.hpp:146
GEbounds m_ebounds
Energy boundaries covered by events.
Definition GEvents.hpp:111
const GGti & gti(void) const
Return Good Time Intervals.
Definition GEvents.hpp:134
void init_members(void)
Initialise class members.
Definition GEvents.cpp:176
const GTime & tstop(void) const
Return stop time.
Definition GEvents.hpp:158
const GEbounds & ebounds(void) const
Return energy boundaries.
Definition GEvents.hpp:122
const GEnergy & emax(void) const
Return maximum energy.
Definition GEvents.hpp:182
const GEnergy & emin(void) const
Return minimum energy.
Definition GEvents.hpp:170
Filename class.
Definition GFilename.hpp:62
Abstract FITS image base class.
FITS file class.
Definition GFits.hpp:63
void saveto(const GFilename &filename, const bool &clobber=false)
Saves to specified FITS file.
Definition GFits.cpp:1293
GFitsImage * image(const int &extno)
Get pointer to image HDU.
Definition GFits.cpp:368
void close(void)
Close FITS file.
Definition GFits.cpp:1342
const GTime & tstop(void) const
Returns latest stop time in Good Time Intervals.
Definition GGti.hpp:207
int size(void) const
Return number of Good Time Intervals.
Definition GGti.hpp:154
const double & ontime(void) const
Returns ontime.
Definition GGti.hpp:240
const GTime & tstart(void) const
Returns earliest start time in Good Time Intervals.
Definition GGti.hpp:194
double solidangle(const int &index) const
Returns solid angle of pixel.
Definition GSkyMap.cpp:1858
GSkyDir pix2dir(const GSkyPixel &pixel) const
Returns sky direction of pixel.
Definition GSkyMap.cpp:1360
Sky map pixel class.
Definition GSkyPixel.hpp:74
void clear(void)
Clear time.
Definition GTime.cpp:252
std::string print(const GChatter &chatter=NORMAL) const
Print time.
Definition GTime.cpp:1188
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
Definition GTools.cpp:1143
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
Definition GTools.cpp:489
int com_tics(const GTime &time)
Convert GTime in COMPTEL tics.
int com_tjd(const GTime &time)
Convert GTime in COMPTEL TJD.
Definition GCOMTools.cpp:91