GammaLib 2.2.0.dev
Loading...
Searching...
No Matches
GCOSEventBin.cpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCOSEventBin.cpp - COSI event bin class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2026 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 GCOSEventBin.hpp
23 * @brief COSI event bin class implementation
24 * @author Juergen Knoedlseder
25 */
26
27/* __ Includes ___________________________________________________________ */
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31#include <cmath>
32#include <string>
33#include "GTools.hpp"
34#include "GCOSEventBin.hpp"
35
36/* __ Method name definitions ____________________________________________ */
37#define G_DIR_GET "GCOSEventBin::dir()"
38#define G_CHI_GET "GCOSEventBin::chi()"
39#define G_PSI_GET "GCOSEventBin::psi()"
40#define G_PHI_GET "GCOSEventBin::phi()"
41#define G_ENERGY_GET "GCOSEventBin::energy()"
42#define G_TIME_GET "GCOSEventBin::time()"
43#define G_COUNTS_GET "GCOSEventBin::counts()"
44#define G_SOLIDANGLE_GET "GCOSEventBin::solidangle()"
45#define G_PHIWIDTH_GET "GCOSEventBin::phiwidth()"
46#define G_EWIDTH_GET "GCOSEventBin::ewidth()"
47#define G_ONTIME_GET "GCOSEventBin::ontime()"
48#define G_DIR_SET1 "GCOSEventBin::dir(GCOSInstDir&)"
49#define G_DIR_SET2 "GCOSEventBin::dir(double&, double&, double&)"
50#define G_ENERGY_SET "GCOSEventBin::energy(GEnergy&)"
51#define G_TIME_SET "GCOSEventBin::time(GTime&)"
52#define G_COUNTS_SET "GCOSEventBin::counts(double&)"
53#define G_SOLIDANGLE_SET "GCOSEventBin::solidangle(double&)"
54#define G_PHIWIDTH_SET "GCOSEventBin::phiwidth(double&)"
55#define G_EWIDTH_SET "GCOSEventBin::ewidth(GEnergy&)"
56#define G_ONTIME_SET "GCOSEventBin::ontime(double&)"
57
58/* __ Macros _____________________________________________________________ */
59
60/* __ Coding definitions _________________________________________________ */
61
62/* __ Debug definitions __________________________________________________ */
63
64
65/*==========================================================================
66 = =
67 = Constructors/destructors =
68 = =
69 ==========================================================================*/
70
71/***********************************************************************//**
72 * @brief Void constructor
73 *
74 * Creates an empty COSI event bin.
75 ***************************************************************************/
77{
78 // Initialise class members for clean destruction
80
81 // Return
82 return;
83}
84
85
86/***********************************************************************//**
87 * @brief Copy constructor
88 *
89 * @param[in] bin COSI event bin.
90 ***************************************************************************/
92{
93 // Initialise class members for clean destruction
95
96 // Copy members
97 copy_members(bin);
98
99 // Return
100 return;
101}
102
103
104/***********************************************************************//**
105 * @brief Destructor
106 ***************************************************************************/
108{
109 // Free members
110 free_members();
111
112 // Return
113 return;
114}
115
116
117/*==========================================================================
118 = =
119 = Operators =
120 = =
121 ==========================================================================*/
122
123/***********************************************************************//**
124 * @brief Assignment operator
125 *
126 * @param[in] bin COSI event bin.
127 * @return COSI event bin.
128 ***************************************************************************/
130{
131 // Execute only if object is not identical
132 if (this != &bin) {
133
134 // Copy base class members
135 this->GEventBin::operator=(bin);
136
137 // Free members
138 free_members();
139
140 // Initialise private members for clean destruction
141 init_members();
142
143 // Copy members
144 copy_members(bin);
145
146 } // endif: object was not identical
147
148 // Return this object
149 return *this;
150}
151
152
153/*==========================================================================
154 = =
155 = Public methods =
156 = =
157 ==========================================================================*/
158
159/***********************************************************************//**
160 * @brief Clear COSI event bin
161 *
162 * Clears COSI event bin by resetting all class members to an initial state.
163 * Any information that was present before will be lost.
164 ***************************************************************************/
166{
167 // Free class members (base and derived classes, derived class first)
168 free_members();
170 this->GEvent::free_members();
171
172 // Initialise members
173 this->GEvent::init_members();
175 init_members();
176
177 // Return
178 return;
179}
180
181
182/***********************************************************************//**
183 * @brief Clone event bin
184 *
185 * @return Pointer to deep copy of COSI event bin.
186 ***************************************************************************/
188{
189 return new GCOSEventBin(*this);
190}
191
192
193/***********************************************************************//**
194 * @brief Return size of event bin
195 *
196 * @return Size of event bin (sr MeV s)
197 *
198 * The size of the event bin (units: sr MeV s) is given by
199 * \f[size = \Omega \times \Delta E \times \Delta T\f]
200 * where
201 * \f$\Omega\f$ is the size of the spatial bin in sr,
202 * \f$\Delta E\f$ is the size of the energy bin in MeV, and
203 * \f$\Delta T\f$ is the ontime of the observation in seconds.
204 ***************************************************************************/
205double GCOSEventBin::size(void) const
206{
207 // Compute bin size
208 double size = solidangle() * ewidth().MeV() * ontime();
209
210 // Return bin size
211 return size;
212}
213
214
215/***********************************************************************//**
216 * @brief Return instrument direction of event bin
217 *
218 * @return Instrument direction of event bin.
219 *
220 * @exception GException::invalid_value
221 * Invalid instrument direction pointer.
222 *
223 * Returns reference to the instrument direction of the event bin.
224 ***************************************************************************/
226{
227 // Throw an exception if instrument direction pointer is not valid
228 if (m_dir == NULL) {
229 std::string msg = "No memory has been allocated from which the "
230 "instrument direction could be retrieved.";
232 }
233
234 // Return instrument direction
235 return *m_dir;
236}
237
238
239/***********************************************************************//**
240 * @brief Return Galactic longitude of event bin scatter direction Chi
241 *
242 * @return Galactic longitude of event bin scatter direction Chi (deg).
243 *
244 * @exception GException::invalid_value
245 * Invalid instrument direction pointer.
246 *
247 * Returns Galactic longitude of event bin scatter direction Chi in degrees.
248 ***************************************************************************/
249double GCOSEventBin::chi(void) const
250{
251 // Throw an exception if instrument direction pointer is not valid
252 if (m_dir == NULL) {
253 std::string msg = "No memory has been allocated from which the "
254 "scatter direction Chi could be retrieved.";
256 }
257
258 // Return scatter direction Chi
259 return (m_dir->dir().l_deg());
260}
261
262
263/***********************************************************************//**
264 * @brief Return Galactic longitude of event bin scatter direction Psi
265 *
266 * @return Galactic longitude of event bin scatter direction Psi (deg).
267 *
268 * @exception GException::invalid_value
269 * Invalid instrument direction pointer.
270 *
271 * Returns Galactic longitude of event bin scatter direction Psi in degrees.
272 ***************************************************************************/
273double GCOSEventBin::psi(void) const
274{
275 // Throw an exception if instrument direction pointer is not valid
276 if (m_dir == NULL) {
277 std::string msg = "No memory has been allocated from which the "
278 "scatter direction Psi could be retrieved.";
280 }
281
282 // Return scatter direction Psi
283 return (m_dir->dir().b_deg());
284}
285
286
287/***********************************************************************//**
288 * @brief Return event bin scatter angle Phi
289 *
290 * @return Galactic longitude of event bin scatter angle Phi (deg).
291 *
292 * @exception GException::invalid_value
293 * Invalid instrument direction pointer.
294 *
295 * Returns Galactic longitude of event bin scatter angle Phi in degrees.
296 ***************************************************************************/
297const double& GCOSEventBin::phi(void) const
298{
299 // Throw an exception if instrument direction pointer is not valid
300 if (m_dir == NULL) {
301 std::string msg = "No memory has been allocated from which the "
302 "scatter angle Phi could be retrieved.";
304 }
305
306 // Return scatter angle Phi
307 return (m_dir->phi());
308}
309
310
311/***********************************************************************//**
312 * @brief Return energy of event bin
313 *
314 * @return Energy of event bin.
315 *
316 * @exception GException::invalid_value
317 * Invalid energy pointer.
318 *
319 * Returns reference to the energy of the event bin.
320 ***************************************************************************/
322{
323 // Throw an exception if energy pointer is not valid
324 if (m_energy == NULL) {
325 std::string msg = "No memory has been allocated from which the energy "
326 "could be retrieved.";
328 }
329
330 // Return energy
331 return *m_energy;
332}
333
334
335/***********************************************************************//**
336 * @brief Return time of event bin
337 *
338 * @return Time of event bin.
339 *
340 * @exception GException::invalid_value
341 * Invalid time pointer.
342 *
343 * Returns reference to the time of the event bin.
344 ***************************************************************************/
345const GTime& GCOSEventBin::time(void) const
346{
347 // Throw an exception if time pointer is not valid
348 if (m_energy == NULL) {
349 std::string msg = "No memory has been allocated from which the time "
350 "could be retrieved.";
352 }
353
354 // Return time
355 return *m_time;
356}
357
358
359/***********************************************************************//**
360 * @brief Return number of counts in event bin
361 *
362 * @return Number of counts in event bin.
363 *
364 * @exception GCTAException::invalid_value
365 * Invalid counts pointer.
366 *
367 * Returns the number of counts in the event bin.
368 ***************************************************************************/
369double GCOSEventBin::counts(void) const
370{
371 // Throw an exception if counts pointer is not valid
372 if (m_counts == NULL) {
373 std::string msg = "No memory has been allocated from which the counts "
374 "could be retrieved.";
376 }
377
378 // Return counts
379 return *m_counts;
380}
381
382
383/***********************************************************************//**
384 * @brief Return error in number of counts
385 *
386 * @return Error in number of counts in event bin.
387 *
388 * Returns \f$\sqrt(counts+delta)\f$ as the uncertainty in the number of
389 * counts in the bin. Adding delta avoids uncertainties of 0 which will
390 * lead in the optimisation step to the exlusion of the corresponding bin.
391 * In the actual implementation delta=1e-50.
392 *
393 * @todo The choice of delta has been made somewhat arbitrary, mainly
394 * because the optimizer routines filter error^2 below 1e-100.
395 ***************************************************************************/
396double GCOSEventBin::error(void) const
397{
398 // Compute uncertainty
399 double error = std::sqrt(counts()+1.0e-50);
400
401 // Return error
402 return error;
403}
404
405
406/***********************************************************************//**
407 * @brief Return solid angle of event bin
408 *
409 * @return Solid angle of event bin (sr).
410 *
411 * @exception GException::invalid_value
412 * Invalid solid angle pointer.
413 *
414 * Returns reference to the solid angle of the event bin.
415 ***************************************************************************/
416const double& GCOSEventBin::solidangle(void) const
417{
418 // Throw an exception if counts pointer is not valid
419 if (m_solidangle == NULL) {
420 std::string msg = "No memory has been allocated from which the solid "
421 "angle could be retrieved.";
423 }
424
425 // Return solid angle
426 return *m_solidangle;
427}
428
429
430/***********************************************************************//**
431 * @brief Return Phi width of event bin
432 *
433 * @return Phi width of event bin (deg).
434 *
435 * @exception GException::invalid_value
436 * Invalid Phi width pointer.
437 *
438 * Returns reference to the Phi width of the event bin.
439 ***************************************************************************/
440const double& GCOSEventBin::phiwidth(void) const
441{
442 // Throw an exception if counts pointer is not valid
443 if (m_phiwidth == NULL) {
444 std::string msg = "No memory has been allocated from which the Phi "
445 "width could be retrieved.";
447 }
448
449 // Return Phi width
450 return *m_phiwidth;
451}
452
453
454/***********************************************************************//**
455 * @brief Return energy width of event bin
456 *
457 * @return Energy width of event bin.
458 *
459 * @exception GException::invalid_value
460 * Invalid energy width pointer.
461 *
462 * Returns reference to the energy width of the event bin.
463 ***************************************************************************/
465{
466 // Throw an exception if energy width pointer is not valid
467 if (m_ewidth == NULL) {
468 std::string msg = "No memory has been allocated from which the energy "
469 "width could be retrieved.";
471 }
472
473 // Return energy width
474 return *m_ewidth;
475}
476
477
478/***********************************************************************//**
479 * @brief Return ontime of event bin
480 *
481 * @return Ontime of event bin (sec).
482 *
483 * @exception GException::invalid_value
484 * Invalid ontime pointer.
485 *
486 * Returns reference to the ontime of the event bin.
487 ***************************************************************************/
488const double& GCOSEventBin::ontime(void) const
489{
490 // Throw an exception if energy width pointer is not valid
491 if (m_ontime == NULL) {
492 std::string msg = "No memory has been allocated from which the "
493 "ontime could be retrieved.";
495 }
496
497 // Return ontime
498 return *m_ontime;
499}
500
501
502/***********************************************************************//**
503 * @brief Set instrument direction of event bin
504 *
505 * @param[in] dir Instrument direction of event bin.
506 *
507 * @exception GException::invalid_value
508 * No memory allocated to hold instrument direction.
509 *
510 * Sets the instrument direction of the event bin.
511 ***************************************************************************/
513{
514 // Throw an exception if no memory has been allocated
515 if (m_dir == NULL) {
516 std::string msg = "No memory has been allocated to store the "
517 "instrument direction.";
519 }
520
521 // Set instrument direction
522 *m_dir = dir;
523
524 // Return
525 return;
526}
527
528
529/***********************************************************************//**
530 * @brief Set Chi, Psi and Phi of event bin
531 *
532 * @param[in] chi Galactic longitude of scatter direction Chi (deg).
533 * @param[in] psi Galactic longitude of scatter direction Psi (deg).
534 * @param[in] phi Scatter angle Phi (deg).
535 *
536 * @exception GException::invalid_value
537 * No memory allocated to hold Chi, Psi and Phi values.
538 *
539 * Sets the scatter direction and scatter angle of the event bin.
540 *
541 * Note that this method does not set the scatter direction in local
542 * coordinates. Use the dir(GCOSInstDir&) method to also set the scatter
543 * direction in local coordinates.
544 ***************************************************************************/
545void GCOSEventBin::dir(const double& chi, const double& psi, const double& phi)
546{
547 // Throw an exception if no memory has been allocated
548 if (m_dir == NULL) {
549 std::string msg = "No memory has been allocated to store the "
550 "Chi, Psi and Phi values.";
552 }
553
554 // Set scatter direction
555 GSkyDir dir;
556 dir.lb_deg(chi,psi);
557
558 // Set instrument direction
559 m_dir->dir(dir);
560 m_dir->phi(phi);
561
562 // Return
563 return;
564}
565
566
567/***********************************************************************//**
568 * @brief Set energy of event bin
569 *
570 * @param[in] energy Energy of event bin.
571 *
572 * @exception GException::invalid_value
573 * No memory allocated to store the energy.
574 *
575 * Sets the energy of the event bin.
576 ***************************************************************************/
577void GCOSEventBin::energy(const GEnergy& energy)
578{
579 // Throw an exception if no memory has been allocated
580 if (m_energy == NULL) {
581 std::string msg = "No memory has been allocated to store the energy.";
583 }
584
585 // Set energy
586 *m_energy = energy;
587
588 // Return
589 return;
590}
591
592
593/***********************************************************************//**
594 * @brief Set time of event bin
595 *
596 * @param[in] time Time of event bin.
597 *
598 * @exception GException::invalid_value
599 * No memory allocated to store the time.
600 *
601 * Sets the time of the event bin.
602 ***************************************************************************/
603void GCOSEventBin::time(const GTime& time)
604{
605 // Throw an exception if no memory has been allocated
606 if (m_time == NULL) {
607 std::string msg = "No memory has been allocated to store the time.";
609 }
610
611 // Set time
612 *m_time = time;
613
614 // Return
615 return;
616}
617
618
619/***********************************************************************//**
620 * @brief Set number of counts in event bin
621 *
622 * @param[in] counts Number of counts.
623 *
624 * @exception GException::invalid_value
625 * No memory allocated to store counts.
626 *
627 * Set the number of counts in the event bin.
628 ***************************************************************************/
629void GCOSEventBin::counts(const double& counts)
630{
631 // Throw an exception if counts pointer is not valid
632 if (m_counts == NULL) {
633 std::string msg = "No memory has been allocated to store the counts.";
635 }
636
637 // Set number of counts in event bin
638 *m_counts = counts;
639
640 // Return
641 return;
642}
643
644
645/***********************************************************************//**
646 * @brief Set solid angle of event bin
647 *
648 * @param[in] solidangle Solid angle of event bin (sr).
649 *
650 * @exception GException::invalid_value
651 * No memory allocated to store solid angle.
652 *
653 * Sets the solid angle of the event bin.
654 ***************************************************************************/
655void GCOSEventBin::solidangle(const double& solidangle)
656{
657 // Throw an exception if no memory has been allocated
658 if (m_solidangle == NULL) {
659 std::string msg = "No memory has been allocated to store the solid "
660 "angle.";
662 }
663
664 // Set solid angle
666
667 // Return
668 return;
669}
670
671
672/***********************************************************************//**
673 * @brief Set Phi width of event bin
674 *
675 * @param[in] phiwidth Energy width of event bin (deg).
676 *
677 * @exception GException::invalid_value
678 * No memory allocated to store Phi width.
679 *
680 * Sets the Phi width of the event bin.
681 ***************************************************************************/
682void GCOSEventBin::phiwidth(const double& phiwidth)
683{
684 // Throw an exception if no memory has been allocated
685 if (m_phiwidth == NULL) {
686 std::string msg = "No memory has been allocated to store the Phi "
687 "width.";
689 }
690
691 // Set Phi width
693
694 // Return
695 return;
696}
697
698/***********************************************************************//**
699 * @brief Set energy width of event bin
700 *
701 * @param[in] ewidth Energy width of event bin.
702 *
703 * @exception GException::invalid_value
704 * No memory allocated to store energy width.
705 *
706 * Sets the energy width of the event bin.
707 ***************************************************************************/
708void GCOSEventBin::ewidth(const GEnergy& ewidth)
709{
710 // Throw an exception if no memory has been allocated
711 if (m_ewidth == NULL) {
712 std::string msg = "No memory has been allocated to store the energy "
713 "width.";
715 }
716
717 // Set energy width
718 *m_ewidth = ewidth;
719
720 // Return
721 return;
722}
723
724
725/***********************************************************************//**
726 * @brief Set ontime of event bin
727 *
728 * @param[in] ontime Ontime of event bin (sec).
729 *
730 * @exception GException::invalid_value
731 * No memory allocated to store ontime.
732 *
733 * Sets the ontime of the event bin.
734 ***************************************************************************/
735void GCOSEventBin::ontime(const double& ontime)
736{
737 // Throw an exception if no memory has been allocated
738 if (m_ontime == NULL) {
739 std::string msg = "No memory has been allocated to store the ontime.";
741 }
742
743 // Set solid angle
744 *m_ontime = ontime;
745
746 // Return
747 return;
748}
749
750
751/***********************************************************************//**
752 * @brief Print event information
753 *
754 * @param[in] chatter Chattiness.
755 * @return String containing event information.
756 ***************************************************************************/
757std::string GCOSEventBin::print(const GChatter& chatter) const
758{
759 // Initialise result string
760 std::string result;
761
762 // Continue only if chatter is not silent
763 if (chatter != SILENT) {
764
765 // Append number of counts
766 result.append(gammalib::str(counts()));
767
768 } // endif: chatter was not silent
769
770 // Return result
771 return result;
772}
773
774
775/*==========================================================================
776 = =
777 = Private methods =
778 = =
779 ==========================================================================*/
780
781/***********************************************************************//**
782 * @brief Initialise class members
783 *
784 * This method allocates memory for all event bin attributes and intialises
785 * the attributes to well defined initial values.
786 *
787 * The method assumes that on entry no memory is hold by the member pointers.
788 ***************************************************************************/
790{
791 // Allocate members
792 m_alloc = true;
793 m_index = -1; // Signals that event bin does not correspond to cube
794 m_counts = new double;
795 m_dir = new GCOSInstDir;
796 m_solidangle = new double;
797 m_time = new GTime;
798 m_ontime = new double;
799 m_phiwidth = new double;
800 m_energy = new GEnergy;
801 m_ewidth = new GEnergy;
802
803 // Initialise members
804 *m_counts = 0.0;
805 m_dir->clear();
806 *m_solidangle = 0.0,
807 m_time->clear();
808 *m_ontime = 0.0;
809 *m_phiwidth = 0.0;
810 m_energy->clear();
811 m_ewidth->clear();
812
813 // Return
814 return;
815}
816
817
818/***********************************************************************//**
819 * @brief Copy class members
820 *
821 * @param[in] bin COSI event bin.
822 ***************************************************************************/
824{
825 // First de-allocate existing memory if needed
826 free_members();
827
828 // Copy members by cloning
829 m_counts = new double(*bin.m_counts);
830 m_dir = new GCOSInstDir(*bin.m_dir);
831 m_solidangle = new double(*bin.m_solidangle);
832 m_time = new GTime(*bin.m_time);
833 m_ontime = new double(*bin.m_ontime);
834 m_phiwidth = new double(*bin.m_phiwidth);
835 m_energy = new GEnergy(*bin.m_energy);
836 m_ewidth = new GEnergy(*bin.m_ewidth);
837
838 // Copy non-pointer members
839 m_index = bin.m_index;
840
841 // Signal memory allocation
842 m_alloc = true;
843
844 // Return
845 return;
846}
847
848
849/***********************************************************************//**
850 * @brief Delete class members
851 *
852 * This method frees all memory of the class attributes and sets the member
853 * pointers to NULL. This method should only be called if new memory is
854 * allocated immediately afterwards (for example by cloning another event
855 * bin), or upon destruction of the object.
856 *
857 * Note that some logic has been implemented that frees only memory that also
858 * has indeed been allocated by the class. Thus if the class only serves as
859 * container to hold memory pointer allocated by someone else (for example
860 * the GCOSEventCube class), no memory is freed.
861 ***************************************************************************/
863{
864 // If memory was allocated then free members now
865 if (m_alloc) {
866 if (m_counts != NULL) delete m_counts;
867 if (m_dir != NULL) delete m_dir;
868 if (m_solidangle != NULL) delete m_solidangle;
869 if (m_time != NULL) delete m_time;
870 if (m_ontime != NULL) delete m_ontime;
871 if (m_phiwidth != NULL) delete m_phiwidth;
872 if (m_energy != NULL) delete m_energy;
873 if (m_ewidth != NULL) delete m_ewidth;
874 }
875
876 // Signal member pointers as free
877 m_counts = NULL;
878 m_dir = NULL;
879 m_solidangle = NULL;
880 m_time = NULL;
881 m_ontime = NULL;
882 m_phiwidth = NULL;
883 m_energy = NULL;
884 m_ewidth = NULL;
885
886 // Signal memory de-allocation
887 m_alloc = false;
888
889 // Return
890 return;
891}
#define G_TIME_GET
#define G_TIME_SET
#define G_DIR_GET
#define G_SOLIDANGLE_GET
#define G_EWIDTH_SET
#define G_COUNTS_GET
#define G_ONTIME_SET
#define G_COUNTS_SET
#define G_SOLIDANGLE_SET
#define G_EWIDTH_GET
#define G_ONTIME_GET
#define G_PHIWIDTH_GET
#define G_PHIWIDTH_SET
#define G_CHI_GET
#define G_DIR_SET1
#define G_PHI_GET
#define G_DIR_SET2
#define G_PSI_GET
COSI event bin class definition.
#define G_ENERGY_GET
#define G_ENERGY_SET
Gammalib tools definition.
GChatter
Definition GTypemaps.hpp:33
@ SILENT
Definition GTypemaps.hpp:34
COSI event bin class.
double chi(void) const
Return Galactic longitude of event bin scatter direction Chi.
double * m_ontime
Pointer to ontime of bin (seconds)
double * m_phiwidth
Pointer to Phi width.
const double & phi(void) const
Return event bin scatter angle Phi.
virtual double counts(void) const
Return number of counts in event bin.
virtual double error(void) const
Return error in number of counts.
virtual void clear(void)
Clear COSI event bin.
double psi(void) const
Return Galactic longitude of event bin scatter direction Psi.
virtual const GTime & time(void) const
Return time of event bin.
virtual GCOSEventBin * clone(void) const
Clone event bin.
GEnergy * m_energy
Pointer to bin energy.
void init_members(void)
Initialise class members.
const GEnergy & ewidth(void) const
Return energy width of event bin.
virtual ~GCOSEventBin(void)
Destructor.
virtual GCOSEventBin & operator=(const GCOSEventBin &bin)
Assignment operator.
bool m_alloc
Signals proper memory allocation.
GTime * m_time
Pointer to bin time.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print event information.
const double & ontime(void) const
Return ontime of event bin.
virtual const GCOSInstDir & dir(void) const
Return instrument direction of event bin.
const double & phiwidth(void) const
Return Phi width of event bin.
GEnergy * m_ewidth
Pointer to energy width of bin.
int m_index
Dataspace index.
GCOSInstDir * m_dir
Pointer to bin direction.
void copy_members(const GCOSEventBin &bin)
Copy class members.
double * m_solidangle
Pointer to solid angle of pixel (sr)
virtual double size(void) const
Return size of event bin.
const double & solidangle(void) const
Return solid angle of event bin.
double * m_counts
Pointer to number of counts.
GCOSEventBin(void)
Void constructor.
virtual const GEnergy & energy(void) const
Return energy of event bin.
void free_members(void)
Delete class members.
COSI instrument direction class.
void phi(const double &phi)
Set event Compton scatter angle.
virtual void clear(void)
Clear COSI instrument direction.
void dir(const GSkyDir &dir)
Set event scatter direction in celestial coordinates.
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
double MeV(void) const
Return energy in MeV.
Definition GEnergy.cpp:342
void clear(void)
Clear instance.
Definition GEnergy.cpp:267
Abstract interface for the event bin class.
Definition GEventBin.hpp:64
void free_members(void)
Delete class members.
virtual GEventBin & operator=(const GEventBin &bin)
Assignment operator.
void init_members(void)
Initialise class members.
void free_members(void)
Delete class members.
Definition GEvent.cpp:163
void init_members(void)
Initialise class members.
Definition GEvent.cpp:141
Sky direction class.
Definition GSkyDir.hpp:62
Time class.
Definition GTime.hpp:55
void clear(void)
Clear time.
Definition GTime.cpp:252
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
Definition GTools.cpp:508