46#define G_COMPASS_THRESHOLD
194 double response = 0.0;
208 if (std::abs(arg) < 5.0) {
209 response =
m_amplitude * std::exp(-0.5 * arg * arg);
214 #if defined(G_COMPASS_THRESHOLD)
217 if (ereco <= thresl) {
222 response *= (ereco - thresl) /
m_ewidth;
236 response *= std::exp(-0.5 * arg * arg);
238 else if (ereco >
m_emax) {
239 double arg = (
m_emax-ereco) / 0.1;
240 response *= std::exp(-0.5 * arg * arg);
322 GFits fits(filename);
357 int num = table.
nrows();
372 for (
int i = 0; i < num; ++i) {
414 col_energy.
unit(
"MeV");
415 col_position.
unit(
"MeV");
416 col_width.
unit(
"MeV");
417 col_emin.
unit(
"MeV");
418 col_ewidth.
unit(
"MeV");
419 col_emax.
unit(
"MeV");
422 for (
int i = 0; i < num; ++i) {
434 table.
append(col_position);
436 table.
append(col_amplitude);
461 result.append(
"=== GCOMD1Response ===");
470 result.append(
"not defined");
602 #if defined(G_RENORMALIZE)
COMPTEL D1 module response class interface definition.
FITS binary table class definition.
FITS table double column class interface definition.
FITS table float column class interface definition.
FITS table abstract base class interface definition.
Mathematical function definitions.
Interface for the COMPTEL D1 module response class.
const GCaldb & caldb(void) const
Return calibration database.
void load(const std::string &sdaname)
Load COMPTEL D1 module response.
~GCOMD1Response(void)
Destructor.
void read(const GFitsTable &table)
Read COMPTEL D1 module response.
std::vector< double > m_sigmas
Photo peak width in MeV.
std::vector< double > m_emaxs
Upper energy limit of D1.
void write(GFitsBinTable &table)
Write COMPTEL D1 module response.
double operator()(const double &etrue, const double &ereco) const
D1 module response evaluation operator.
GNodeArray m_energies
Input energies.
void copy_members(const GCOMD1Response &rsp)
Copy class members.
GCaldb m_caldb
Calibration database.
GCOMD1Response(void)
Void constructor.
std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL D1 module response information.
GCOMD1Response * clone(void) const
Clone instance.
std::vector< double > m_ewidths
Lower energy threshold width of D1.
void init_members(void)
Initialise class members.
void free_members(void)
Delete class members.
std::vector< double > m_positions
Photo peak position in MeV.
std::vector< double > m_amplitudes
Photo peak amplitude.
void clear(void)
Clear instance.
void update_cache(const double &etrue) const
Update computation cache.
std::vector< double > m_emins
Lower energy threshold of D1.
GCOMD1Response & operator=(const GCOMD1Response &rsp)
Assignment operator.
Calibration database class.
std::string rootdir(void) const
Return path to CALDB root directory.
GFilename filename(const std::string &detector, const std::string &filter, const std::string &codename, const std::string &date, const std::string &time, const std::string &expr)
Return calibration file name based on selection parameters.
void clear(void)
Clear calibration database.
std::string print(const GChatter &chatter=NORMAL) const
Print calibration database information.
bool exists(void) const
Checks whether file exists.
bool is_empty(void) const
Signal if filename is empty.
const std::string & extname(void) const
Return extension name.
Abstract interface for FITS table column.
virtual double real(const int &row, const int &inx=0) const =0
void unit(const std::string &unit)
Set column unit.
FITS table double column.
Abstract interface for FITS table.
GFitsTableCol * append(const GFitsTableCol &column)
Append column to the table.
const int & nrows(void) const
Return number of rows in table.
void close(void)
Close FITS file.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
double interpolate(const double &value, const std::vector< double > &vector) const
Interpolate value.
bool is_empty(void) const
Signals if there are no nodes in node array.
void clear(void)
Clear node array.
int size(void) const
Return number of nodes in node array.
void append(const double &node)
Append one node to array.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
std::string filepath(const std::string &pathname, const std::string &filename)
Build file path from path name and file name.