GammaLib
2.1.0.dev
|
INTEGRAL/SPI event bin class. More...
#include <GSPIEventBin.hpp>
Public Member Functions | |
GSPIEventBin (void) | |
Void constructor. More... | |
GSPIEventBin (const GSPIEventBin &bin) | |
Copy constructor. More... | |
virtual | ~GSPIEventBin (void) |
Destructor. More... | |
virtual GSPIEventBin & | operator= (const GSPIEventBin &bin) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear INTEGRAL/SPI event bin. More... | |
virtual GSPIEventBin * | clone (void) const |
Clone event bin. More... | |
virtual std::string | classname (void) const |
Return class name. More... | |
virtual double | size (void) const |
Return size of event bin. More... | |
virtual const GSPIInstDir & | dir (void) const |
Return instrument direction. More... | |
virtual const GEnergy & | energy (void) const |
Return energy. More... | |
virtual const GTime & | time (void) const |
Return time. More... | |
virtual double | counts (void) const |
Return number of counts. More... | |
virtual double | error (void) const |
Return error in number of counts. More... | |
virtual void | counts (const double &counts) |
Set number of counts. More... | |
virtual std::string | print (const GChatter &chatter=NORMAL) const |
Print event information. More... | |
const double & | model (const int &index) const |
Return model value. More... | |
const double & | ontime (void) const |
Return ontime of event bin. More... | |
const double & | livetime (void) const |
Return livetime of event bin. More... | |
const int & | index (void) const |
Return event bin index. More... | |
const int & | ipt (void) const |
Return event bin pointing index. More... | |
const int & | idir (void) const |
Return event bin direction index. More... | |
const int & | iebin (void) const |
Return event bin energy index. More... | |
Public Member Functions inherited from GEventBin | |
GEventBin (void) | |
Void constructor. More... | |
GEventBin (const GEventBin &bin) | |
Copy constructor. More... | |
virtual | ~GEventBin (void) |
Destructor. More... | |
virtual GEventBin & | operator= (const GEventBin &bin) |
Assignment operator. More... | |
bool | is_atom (void) const |
Signal if event is an atom. More... | |
bool | is_bin (void) const |
Signal if event is a bin. More... | |
Public Member Functions inherited from GEvent | |
GEvent (void) | |
Void constructor. More... | |
GEvent (const GEvent &event) | |
Copy constructor. More... | |
virtual | ~GEvent (void) |
Destructor. More... | |
virtual GEvent & | operator= (const GEvent &event) |
Assignment operator. More... | |
Public Member Functions inherited from GBase | |
virtual | ~GBase (void) |
Destructor. More... | |
Protected Member Functions | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GSPIEventBin &bin) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Member Functions inherited from GEventBin | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GEventBin &bin) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Member Functions inherited from GEvent | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GEvent &event) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Attributes | |
bool | m_alloc |
Signals proper memory allocation. More... | |
int | m_index |
Dataspace index. More... | |
int | m_ipt |
Pointing index. More... | |
int | m_idir |
Direction index. More... | |
int | m_iebin |
Energy bin index. More... | |
int | m_num_models |
Number of models in bin. More... | |
GSPIInstDir * | m_dir |
Pointer to direction of bin. More... | |
GTime * | m_time |
Pointer to time of bin. More... | |
GEnergy * | m_energy |
Pointer to energy of bin. More... | |
double * | m_counts |
Pointer to number of counts. More... | |
double * | m_ontime |
Pointer to ontime of bin. More... | |
double * | m_livetime |
Pointer to livetime of bin. More... | |
double * | m_size |
Pointer to size of bin. More... | |
double * | m_models |
Pointer to models of bin. More... | |
Friends | |
class | GSPIEventCube |
INTEGRAL/SPI event bin class.
This class defines an event bin of the INTEGRAL/SPI event cube.
Since many event bins share the same attributes (for example many bins will actually have the same energy), it would be a waste of memory to store all bin attributes together with the bin. Therefore, the GSPIEventBin class implement it's own memory management. Either the class allocates memory for all attributes, or it takes pointers to GSPIEventCube class member that store the information in an efficient way.
The data member m_alloc signals in which mode the bin operates. I true, GSPIEventBin has allocated itself the memory for all attributes, and hence has to take care about the memory allocation upon destruction. Otherwise the pointers are just released.
Definition at line 62 of file GSPIEventBin.hpp.
GSPIEventBin::GSPIEventBin | ( | void | ) |
Void constructor.
Creates an empty INTEGRAL/SPI event bin.
Definition at line 59 of file GSPIEventBin.cpp.
References init_members().
Referenced by clone().
GSPIEventBin::GSPIEventBin | ( | const GSPIEventBin & | bin | ) |
Copy constructor.
[in] | bin | INTEGRAL/SPI event bin. |
Definition at line 74 of file GSPIEventBin.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GEventBin.
Definition at line 128 of file GSPIEventBin.hpp.
|
virtual |
Clear INTEGRAL/SPI event bin.
Clears INTEGRAL/SPI event bin by resetting all class members to an initial state. Any information that was present before will be lost.
Implements GEventBin.
Definition at line 148 of file GSPIEventBin.cpp.
References GEventBin::free_members(), GEvent::free_members(), free_members(), GEventBin::init_members(), GEvent::init_members(), and init_members().
Referenced by GSPIEventCube::init_members().
|
virtual |
Clone event bin.
Implements GEventBin.
Definition at line 170 of file GSPIEventBin.cpp.
References GSPIEventBin().
|
protected |
Copy class members.
[in] | bin | INTEGRAL/SPI event bin. |
Definition at line 298 of file GSPIEventBin.cpp.
References free_members(), m_alloc, m_counts, m_dir, m_energy, m_idir, m_iebin, m_index, m_ipt, m_livetime, m_models, m_num_models, m_ontime, m_size, and m_time.
Referenced by GSPIEventBin(), and operator=().
|
inlinevirtual |
|
inlinevirtual |
Set number of counts.
[in] | counts | Number of counts. |
Set the number of counts in the event bin.
Implements GEventBin.
Definition at line 198 of file GSPIEventBin.hpp.
|
inlinevirtual |
Return instrument direction.
Returns the instrument direction of the event bin.
Implements GEventBin.
Definition at line 142 of file GSPIEventBin.hpp.
References m_dir.
Referenced by GSPIResponse::irf_value().
|
inlinevirtual |
Return energy.
Returns the energy of the event bin.
Implements GEventBin.
Definition at line 156 of file GSPIEventBin.hpp.
References m_energy.
|
virtual |
Return error in number of counts.
Returns \(\sqrt(counts+delta)\) as the uncertainty in the number of counts in the bin. Adding delta avoids uncertainties of 0 which will lead in the optimisation step to the exlusion of the corresponding bin. In the actual implementation delta=1e-50.
Implements GEventBin.
Definition at line 189 of file GSPIEventBin.cpp.
|
protected |
Delete class members.
This method frees all memory of the class attributes and sets the member pointers to NULL. This method should only be called if new memory is allocated immediately afterwards (for example by cloning another event bin), or upon destruction of the object.
Note that some logic has been implemented that frees only memory that also has indeed been allocated by the class. Thus if the class only serves as container to hold memory pointer allocated by someone else (for example the GSPIEventCube class), no memory is freed.
Definition at line 348 of file GSPIEventBin.cpp.
References m_alloc, m_counts, m_dir, m_energy, m_livetime, m_models, m_ontime, m_size, and m_time.
Referenced by clear(), copy_members(), GSPIEventCube::init_bin(), operator=(), and ~GSPIEventBin().
|
inline |
Return event bin direction index.
Returns the event bin instrument direction index in the event cube.
Definition at line 282 of file GSPIEventBin.hpp.
References m_idir.
|
inline |
Return event bin energy index.
Returns the event bin energy index in the event cube.
Definition at line 296 of file GSPIEventBin.hpp.
References m_iebin.
Referenced by GSPIResponse::irf(), and GSPIResponse::irf_value().
|
inline |
Return event bin index.
Returns the event bin index in the event cube.
Definition at line 254 of file GSPIEventBin.hpp.
References m_index.
Referenced by GSPIModelDataSpace::eval().
|
protected |
Initialise class members.
This method allocates memory for all event bin attributes and intialises the attributes to well defined initial values.
The method assumes that on entry no memory is hold by the member pointers.
Definition at line 261 of file GSPIEventBin.cpp.
References GSPIInstDir::clear(), GEnergy::clear(), GTime::clear(), m_alloc, m_counts, m_dir, m_energy, m_idir, m_iebin, m_index, m_ipt, m_livetime, m_models, m_num_models, m_ontime, m_size, and m_time.
Referenced by clear(), GSPIEventBin(), and operator=().
|
inline |
Return event bin pointing index.
Returns the event bin pointing index in the event cube.
Definition at line 268 of file GSPIEventBin.hpp.
References m_ipt.
Referenced by GSPIResponse::irf_value().
|
inline |
Return livetime of event bin.
Returns the livetime of the event bin.
Definition at line 240 of file GSPIEventBin.hpp.
References m_livetime.
Referenced by GSPIResponse::irf().
const double & GSPIEventBin::model | ( | const int & | index | ) | const |
Return model value.
[in] | index | Model index. |
GException::out_of_range | Invalid model index |
Definition at line 208 of file GSPIEventBin.cpp.
References G_MODEL, m_models, and m_num_models.
Referenced by GSPIModelDataSpace::eval().
|
inline |
Return ontime of event bin.
Returns the ontime of the event bin.
Definition at line 226 of file GSPIEventBin.hpp.
References m_ontime.
|
virtual |
Assignment operator.
[in] | bin | INTEGRAL/SPI event bin. |
Definition at line 112 of file GSPIEventBin.cpp.
References copy_members(), free_members(), init_members(), and GEventBin::operator=().
Print event information.
[in] | chatter | Chattiness. |
Implements GEventBin.
Definition at line 229 of file GSPIEventBin.cpp.
References counts(), SILENT, and gammalib::str().
|
inlinevirtual |
Return size of event bin.
Returns the size of the event bin.
Implements GEventBin.
Definition at line 212 of file GSPIEventBin.hpp.
References m_size.
Referenced by GSPIModelDataSpace::eval().
|
inlinevirtual |
Return time.
Returns the time of the event bin.
Implements GEventBin.
Definition at line 170 of file GSPIEventBin.hpp.
References m_time.
|
friend |
Definition at line 65 of file GSPIEventBin.hpp.
|
protected |
Signals proper memory allocation.
Definition at line 105 of file GSPIEventBin.hpp.
Referenced by copy_members(), free_members(), and init_members().
|
protected |
Pointer to number of counts.
Definition at line 114 of file GSPIEventBin.hpp.
Referenced by copy_members(), counts(), free_members(), GSPIEventCube::init_bin(), init_members(), and GSPIEventCube::set_bin().
|
protected |
Pointer to direction of bin.
Definition at line 111 of file GSPIEventBin.hpp.
Referenced by copy_members(), dir(), free_members(), GSPIEventCube::init_bin(), init_members(), and GSPIEventCube::set_bin().
|
protected |
Pointer to energy of bin.
Definition at line 113 of file GSPIEventBin.hpp.
Referenced by copy_members(), energy(), free_members(), GSPIEventCube::init_bin(), init_members(), and GSPIEventCube::set_bin().
|
protected |
Direction index.
Definition at line 108 of file GSPIEventBin.hpp.
Referenced by copy_members(), idir(), GSPIEventCube::init_bin(), init_members(), and GSPIEventCube::set_bin().
|
protected |
Energy bin index.
Definition at line 109 of file GSPIEventBin.hpp.
Referenced by copy_members(), iebin(), GSPIEventCube::init_bin(), init_members(), and GSPIEventCube::set_bin().
|
protected |
Dataspace index.
Definition at line 106 of file GSPIEventBin.hpp.
Referenced by copy_members(), index(), GSPIEventCube::init_bin(), init_members(), and GSPIEventCube::set_bin().
|
protected |
Pointing index.
Definition at line 107 of file GSPIEventBin.hpp.
Referenced by copy_members(), GSPIEventCube::init_bin(), init_members(), ipt(), and GSPIEventCube::set_bin().
|
protected |
Pointer to livetime of bin.
Definition at line 116 of file GSPIEventBin.hpp.
Referenced by copy_members(), free_members(), GSPIEventCube::init_bin(), init_members(), livetime(), and GSPIEventCube::set_bin().
|
protected |
Pointer to models of bin.
Definition at line 118 of file GSPIEventBin.hpp.
Referenced by copy_members(), free_members(), GSPIEventCube::init_bin(), init_members(), model(), and GSPIEventCube::set_bin().
|
protected |
Number of models in bin.
Definition at line 110 of file GSPIEventBin.hpp.
Referenced by copy_members(), GSPIEventCube::init_bin(), init_members(), model(), and GSPIEventCube::set_bin().
|
protected |
Pointer to ontime of bin.
Definition at line 115 of file GSPIEventBin.hpp.
Referenced by copy_members(), free_members(), GSPIEventCube::init_bin(), init_members(), ontime(), and GSPIEventCube::set_bin().
|
protected |
Pointer to size of bin.
Definition at line 117 of file GSPIEventBin.hpp.
Referenced by copy_members(), free_members(), GSPIEventCube::init_bin(), init_members(), GSPIEventCube::set_bin(), and size().
|
protected |
Pointer to time of bin.
Definition at line 112 of file GSPIEventBin.hpp.
Referenced by copy_members(), free_members(), GSPIEventCube::init_bin(), init_members(), GSPIEventCube::set_bin(), and time().