Action #931

Updated by Knödlseder Jürgen almost 11 years ago

This class stores a counts spectrum. Reading from a PHA file and writing into a PHA file should be supported. A spectrum can be filled using the @fill()@ method. The spectrum also tracks underflows and overflows.
<pre>
class GPha : public GBase {

public:
// Constructors and destructors
GPha(void);
explicit GPha(const GEbounds& ebds);
GPha(const GPha& spec);
virtual ~GPha(void);

// Operators
GPha& operator=(const GPha& spec);
double& operator[](const int& index);
const double& operator[](const int& index) const;

// Implemented pure virtual methods
void clear(void);
GPha* clone(void) const;
int size(void) const;
void fill(const GEnergy& energy, const double& value = 1.0);
void load(const std::string& filename);
void save(const std::string& filename) const;
std::string print(const GChatter& chatter = NORMAL) const;

protected:
// Protected methods
void init_members(void);
void copy_members(const GPha& spec);
void free_members(void);

// Protected members
GEbounds m_ebounds; //!< Energy boundaries
std::vector<double> m_counts; //!< Counts data
double m_underflow; //!< Number of underflowing events
double m_overflow; //!< Number of overflowing events
};

Back