44#define G_UPDATE_RESPONSE_VECTOR_NO_WARNINGS
186 double response = 0.0;
203 if (response < 0.0) {
211 if (ereco < thrinf) {
212 double fac = (ereco - thrinf)/thrsig;
218 response *= std::exp(-0.5 * fac);
302 GFits fits(filename);
341 int num = table.
nrows();
360 for (
int i = 0; i < num; ++i) {
410 col_energy.
unit(
"MeV");
411 col_position.
unit(
"MeV");
412 col_width.
unit(
"MeV");
413 col_emin.
unit(
"MeV");
414 col_ewidth.
unit(
"MeV");
415 col_emax.
unit(
"MeV");
418 for (
int i = 0; i < num; ++i) {
434 table.
append(col_position);
436 table.
append(col_amplitude);
437 table.
append(col_escape1);
438 table.
append(col_escape2);
440 table.
append(col_background);
465 result.append(
"=== GCOMD2Response ===");
474 result.append(
"not defined");
730 const double prcs = 1.0e-15;
761 #if defined(G_NORMALISE_RESPONSE_VECTOR)
766 int istart = int((etrue - 5.0 *
m_sigma) / ebin);
769 for (
int i = 0; i < nbin; ++i) {
772 double ereco = (i + 0.5) * ebin;
784 if (std::abs(arg) < 5.0) {
794 if (std::abs(arg) < 5.0) {
795 value +=
m_escape1 * std::exp(-0.5 * arg * arg);
804 if (std::abs(arg) < 5.0) {
805 value +=
m_escape2 * std::exp(-0.5 * arg * arg);
844 integral.
eps(1.0e-5);
847 #if defined(G_UPDATE_RESPONSE_VECTOR_NO_WARNINGS)
887 if (
emin <= etrue-prcs) {
896 integral.
eps(1.0e-5);
899 #if defined(G_UPDATE_RESPONSE_VECTOR_NO_WARNINGS)
916 #if defined(G_NORMALISE_RESPONSE_VECTOR)
923 #if defined(G_NORMALISE_RESPONSE_VECTOR)
926 for (
int i = 0; i < nbin; ++i) {
933 #if defined(G_DEBUG_UPDATE_RESPONSE_VECTOR)
934 std::cout <<
"etrue=" << etrue;
935 std::cout <<
" ebin=" << ebin;
936 std::cout <<
" nbin=" << nbin;
937 #if defined(G_NORMALISE_RESPONSE_VECTOR)
938 std::cout <<
" norm=" <<
norm;
940 std::cout << std::endl;
1027 double value = term * term - a + 1.0/(1.0-a);
1035 double d =
m_e0 - e;
1051 double mu = 0.72 * std::exp(-1.28 * std::pow(d,0.35)) +
1052 0.01 * d + 0.014 * std::pow(d,-2.5);
1055 double l = 2.9 * std::log(
m_e0 - 11.14);
1058 value *= std::exp(-mu * l);
1102 double arg = (e - m_ereco) * m_wgt;
COMPTEL D2 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.
Integration class interface definition.
Mathematical function definitions.
double norm(const GVector &vector)
Computes vector norm.
double eval(const double &e)
Computes Compton background multiplied with Gaussian.
double m_e0
Incident energy (MeV)
double eval(const double &e)
Computes modified Klein-Nishina cross section multiplied with Gaussian kernel.
double m_wgt
Inverse of Gaussian standard deviation (1/MeV)
Interface for the COMPTEL D2 module response class.
GNodeArray m_rsp_energies
Response vector energies.
std::vector< double > m_escapes1
Amplitude of first escape peak.
std::vector< double > m_tails
Amplitude of Compton tail.
double m_tail
Amplitude of Compton tail.
double m_compton_edge
Position of Compton edge (MeV)
double m_escape2
Amplitude of second escape peak.
GNodeArray m_energies
Input energies.
GCOMD2Response & operator=(const GCOMD2Response &rsp)
Assignment operator.
double m_emax
Upper energy limit of D2 (MeV)
GCOMD2Response(void)
Void constructor.
void copy_members(const GCOMD2Response &rsp)
Copy class members.
std::vector< double > m_emaxs
Upper energy limit of D2.
void free_members(void)
Delete class members.
void write(GFitsBinTable &table)
Write COMPTEL D2 module response.
void update_response_vector(const double &etrue) const
Update response vector.
double m_wgt_photo
Inverse of width of photo peak (1/MeV)
std::vector< double > m_backgrounds
Amplitude of Compton background.
void read(const GFitsTable &table)
Read COMPTEL D2 module response.
GCaldb m_caldb
Calibration database.
double m_amplitude
Amplitude of photo peak.
double m_ewidth
Lower energy threshold width of D2 (MeV)
void init_members(void)
Initialise class members.
std::vector< double > m_rsp_values
Response vector values.
double sigma(const double &etrue) const
Return photo peak standard deviation.
std::vector< double > m_amplitudes
Photo peak amplitude.
const GCaldb & caldb(void) const
Return calibration database.
std::vector< double > m_ewidths
Lower energy threshold width of D2.
std::vector< double > m_sigmas
Photo peak width in MeV.
std::vector< double > m_positions
Photo peak position in MeV.
double emin(void) const
Return minimum D2 input energy (MeV)
~GCOMD2Response(void)
Destructor.
void update_cache(const double &etrue) const
Update computation cache.
double operator()(const double &etrue, const double &ereco) const
D2 module response evaluation operator.
std::vector< double > m_emins
Lower energy threshold of D2.
double m_wgt_escape2
Inverse of width of first escape peak (1/MeV)
GCOMD2Response * clone(void) const
Clone instance.
double m_pos_escape2
Position of second escape peak (MeV)
double m_emin
‍Amplitude of Compton background
void load(const std::string &sdbname)
Load COMPTEL D2 module response.
std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL D2 module response information.
double emax(void) const
Return maximum D2 input energy (MeV)
std::vector< double > m_escapes2
Amplitude of second escape peak.
double m_wgt_escape1
Inverse of width of first escape peak (1/MeV)
double m_escape1
Amplitude of first escape peak.
double m_pos_escape1
Position of first escape peak (MeV)
double m_energy
Incident total energy (MeV)
double m_sigma
Width of photo peak (MeV)
void clear(void)
Clear instance.
double m_rsp_etrue
True energy of response vector.
double m_position
Position of photo peak (MeV)
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.
GIntegral class interface definition.
void eps(const double &eps)
Set relative precision.
double romberg(std::vector< double > bounds, const int &order=5)
Perform Romberg integration.
void silent(const bool &silent)
Set silence flag.
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 reserve(const int &num)
Reserves space for 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.