44 #define G_UPDATE_RESPONSE_VECTOR_NO_WARNINGS
45 //#define G_NORMALISE_RESPONSE_VECTOR
186 double response = 0.0;
203 if (response < 0.0) {
211 if (ereco < thrinf) {
212 double fac = (ereco - thrinf)/thrsig;
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;
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)
925 norm = 1.0 / (norm * ebin);
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;
1052 0.01 * d + 0.014 *
std::pow(d,-2.5);
1102 double arg = (e - m_ereco) * m_wgt;
GCOMD2Response & operator=(const GCOMD2Response &rsp)
Assignment operator.
GCOMD2Response(void)
Void constructor.
void unit(const std::string &unit)
Set column unit.
void clear(void)
Clear instance.
int size(void) const
Return number of nodes in node array.
void copy_members(const GCOMD2Response &rsp)
Copy class members.
FITS table double column class interface definition.
GFitsTable * table(const int &extno)
Get pointer to table HDU.
void read(const GFitsTable &table)
Read COMPTEL D2 module response.
double m_wgt_escape2
Inverse of width of first escape peak (1/MeV)
std::vector< double > m_emins
Lower energy threshold of D2.
double norm(const GVector &vector)
Computes vector norm.
double romberg(std::vector< double > bounds, const int &order=5)
Perform Romberg integration.
void update_cache(const double &etrue) const
Update computation cache.
double m_sigma
Width of photo peak (MeV)
std::vector< double > m_rsp_values
Response vector values.
double emax(void) const
Return maximum D2 input energy (MeV)
GVector abs(const GVector &vector)
Computes absolute of vector elements.
double m_pos_escape2
Position of second escape peak (MeV)
std::vector< double > m_escapes2
Amplitude of second escape peak.
COMPTEL D2 module response class interface definition.
void write(GFitsBinTable &table)
Write COMPTEL D2 module response.
bool is_empty(void) const
Signal if filename is empty.
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 node array.
void reserve(const int &num)
Reserves space for nodes in node array.
std::vector< double > m_amplitudes
Photo peak amplitude.
GFitsTableCol * append(const GFitsTableCol &column)
Append column to the table.
double m_wgt_photo
Inverse of width of photo peak (1/MeV)
double m_escape2
Amplitude of second escape peak.
double sigma(const double &etrue) const
Return photo peak standard deviation.
FITS table float column class interface definition.
GIntegral class interface definition.
double m_escape1
Amplitude of first escape peak.
std::string print(const GChatter &chatter=NORMAL) const
Print COMPTEL D2 module response information.
void init_members(void)
Initialise class members.
bool is_empty(void) const
Signals if there are no nodes in node array.
double m_position
Position of photo peak (MeV)
void free_members(void)
Delete class members.
double m_amplitude
Amplitude of photo peak.
GVector sqrt(const GVector &vector)
Computes square root of vector elements.
Calibration database class.
double eval(const double &e)
Computes modified Klein-Nishina cross section multiplied with Gaussian kernel.
Interface for the COMPTEL D2 module response class.
Abstract interface for FITS table column.
double m_tail
Amplitude of Compton tail.
void load(const std::string &sdbname)
Load COMPTEL D2 module response.
std::vector< double > m_sigmas
Photo peak width in MeV.
bool exists(void) const
Checks whether file exists.
double m_emax
Upper energy limit of D2 (MeV)
double m_energy
Incident total energy (MeV)
GVector log(const GVector &vector)
Computes natural logarithm of vector elements.
double interpolate(const double &value, const std::vector< double > &vector) const
Interpolate value.
double m_emin
Amplitude of Compton background
~GCOMD2Response(void)
Destructor.
std::vector< double > m_escapes1
Amplitude of first escape peak.
Abstract interface for FITS table.
std::vector< double > m_emaxs
Upper energy limit of D2.
double m_ewidth
Lower energy threshold width of D2 (MeV)
double emin(void) const
Return minimum D2 input energy (MeV)
const GCaldb & caldb(void) const
Return calibration database.
double m_wgt_escape1
Inverse of width of first escape peak (1/MeV)
GCOMD2Response * clone(void) const
Clone instance.
const std::string & extname(void) const
Return extension name.
double m_pos_escape1
Position of first escape peak (MeV)
void silent(const bool &silent)
Set silence flag.
double m_wgt
Inverse of Gaussian standard deviation (1/MeV)
const int & nrows(void) const
Return number of rows in table.
GNodeArray m_energies
Input energies.
std::vector< double > m_ewidths
Lower energy threshold width of D2.
void eps(const double &eps)
Set relative precision.
std::vector< double > m_backgrounds
Amplitude of Compton background.
virtual double real(const int &row, const int &inx=0) const =0
double m_compton_edge
Position of Compton edge (MeV)
void update_response_vector(const double &etrue) const
Update response vector.
GVector pow(const GVector &vector, const double &power)
Computes tanh of vector elements.
std::string print(const GChatter &chatter=NORMAL) const
Print calibration database information.
GNodeArray m_rsp_energies
Response vector energies.
std::vector< double > m_positions
Photo peak position in MeV.
FITS binary table class definition.
GVector exp(const GVector &vector)
Computes exponential of vector elements.
GCaldb m_caldb
Calibration database.
std::string filepath(const std::string &pathname, const std::string &filename)
Build file path from path name and file name.
std::vector< double > m_tails
Amplitude of Compton tail.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
void append(const double &node)
Append one node to array.
double eval(const double &e)
Computes Compton background multiplied with Gaussian.
Integration class interface definition.
void close(void)
Close FITS file.
double m_e0
Incident energy (MeV)
void clear(void)
Clear calibration database.
FITS table double column.
std::string rootdir(void) const
Return path to CALDB root directory.
Mathematical function definitions.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
FITS table abstract base class interface definition.
double m_rsp_etrue
True energy of response vector.
double operator()(const double &etrue, const double &ereco) const
D2 module response evaluation operator.