[a3f8d58] | 1 | /** |
---|
| 2 | This software was developed by the University of Tennessee as part of the |
---|
| 3 | Distributed Data Analysis of Neutron Scattering Experiments (DANSE) |
---|
| 4 | project funded by the US National Science Foundation. |
---|
| 5 | |
---|
| 6 | If you use DANSE applications to do scientific research that leads to |
---|
| 7 | publication, we ask that you acknowledge the use of the software with the |
---|
| 8 | following sentence: |
---|
| 9 | |
---|
| 10 | "This work benefited from DANSE software developed under NSF award DMR-0520547." |
---|
| 11 | |
---|
| 12 | copyright 2009, University of Tennessee |
---|
| 13 | */ |
---|
| 14 | #ifndef SMEARER_CLASS_H |
---|
| 15 | #define SMEARER_CLASS_H |
---|
| 16 | |
---|
| 17 | #include <vector> |
---|
| 18 | |
---|
| 19 | using namespace std; |
---|
| 20 | |
---|
| 21 | /** |
---|
| 22 | * Base smearer class, implementing the matrix multiplication only |
---|
| 23 | */ |
---|
| 24 | class BaseSmearer { |
---|
| 25 | protected: |
---|
[5859862] | 26 | // Internal flag: true when the weights vector is filled |
---|
[a3f8d58] | 27 | bool has_matrix; |
---|
[5859862] | 28 | // True when only qmin, qmax and nbins are given. Bins are equidistant |
---|
| 29 | bool even_binning; |
---|
| 30 | // Smearing matrix |
---|
| 31 | vector<double>* weights; |
---|
| 32 | // Q vector |
---|
| 33 | double* q_values; |
---|
[a3f8d58] | 34 | // Q_min (Min Q-value for I(q)) |
---|
| 35 | double qmin; |
---|
| 36 | // Q_max (Max Q_value for I(q)) |
---|
| 37 | double qmax; |
---|
| 38 | // Number of Q bins |
---|
| 39 | int nbins; |
---|
| 40 | |
---|
| 41 | public: |
---|
| 42 | // Constructor |
---|
| 43 | BaseSmearer(double qmin, double qmax, int nbins); |
---|
[5859862] | 44 | BaseSmearer(double* q, int nbins); |
---|
[a3f8d58] | 45 | // Smear function |
---|
| 46 | virtual void smear(double *, double *, int, int); |
---|
| 47 | // Compute the smearing matrix |
---|
| 48 | virtual void compute_matrix(){}; |
---|
| 49 | // Utility function to check the number of bins |
---|
| 50 | int get_nbins() { return nbins; } |
---|
[5859862] | 51 | // Get the q range of a particular bin |
---|
[65883cf] | 52 | virtual int get_bin_range(int, double*, double*, double*); |
---|
[a3f8d58] | 53 | }; |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | /** |
---|
| 57 | * Slit smearer class |
---|
| 58 | */ |
---|
| 59 | class SlitSmearer : public BaseSmearer { |
---|
| 60 | |
---|
| 61 | protected: |
---|
| 62 | // Number of points used in the smearing computation |
---|
[2ca00c4] | 63 | static const int npts = 3000; |
---|
[a3f8d58] | 64 | |
---|
| 65 | public: |
---|
| 66 | // Slit width in Q units |
---|
| 67 | double width; |
---|
| 68 | // Slit height in Q units |
---|
| 69 | double height; |
---|
| 70 | |
---|
| 71 | // Constructor |
---|
| 72 | SlitSmearer(double width, double height, double qmin, double qmax, int nbins); |
---|
[5859862] | 73 | SlitSmearer(double width, double height, double* q, int nbins); |
---|
[a3f8d58] | 74 | // Compute the smearing matrix |
---|
| 75 | virtual void compute_matrix(); |
---|
| 76 | }; |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | /** |
---|
| 80 | * Point smearer class |
---|
| 81 | */ |
---|
| 82 | class QSmearer : public BaseSmearer { |
---|
| 83 | |
---|
| 84 | protected: |
---|
| 85 | // Standard deviation in Q [A-1] |
---|
| 86 | double* width; |
---|
| 87 | |
---|
| 88 | public: |
---|
| 89 | |
---|
| 90 | // Constructor |
---|
[5859862] | 91 | QSmearer(double* width, double qmin, double qmax, int nbins); |
---|
| 92 | QSmearer(double* width, double* q, int nbins); |
---|
[a3f8d58] | 93 | // Compute the smearing matrix |
---|
| 94 | virtual void compute_matrix(); |
---|
| 95 | }; |
---|
| 96 | |
---|
| 97 | #endif |
---|