[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: |
---|
| 26 | bool has_matrix; |
---|
| 27 | // Smearing matrix |
---|
| 28 | vector<double>* weights; |
---|
| 29 | // Q_min (Min Q-value for I(q)) |
---|
| 30 | double qmin; |
---|
| 31 | // Q_max (Max Q_value for I(q)) |
---|
| 32 | double qmax; |
---|
| 33 | // Number of Q bins |
---|
| 34 | int nbins; |
---|
| 35 | |
---|
| 36 | public: |
---|
| 37 | // Constructor |
---|
| 38 | BaseSmearer(double qmin, double qmax, int nbins); |
---|
| 39 | // Smear function |
---|
| 40 | virtual void smear(double *, double *, int, int); |
---|
| 41 | // Compute the smearing matrix |
---|
| 42 | virtual void compute_matrix(){}; |
---|
| 43 | // Utility function to check the number of bins |
---|
| 44 | int get_nbins() { return nbins; } |
---|
| 45 | }; |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | /** |
---|
| 49 | * Slit smearer class |
---|
| 50 | */ |
---|
| 51 | class SlitSmearer : public BaseSmearer { |
---|
| 52 | |
---|
| 53 | protected: |
---|
| 54 | // Number of points used in the smearing computation |
---|
| 55 | static const int npts = 10000; |
---|
| 56 | |
---|
| 57 | public: |
---|
| 58 | // Slit width in Q units |
---|
| 59 | double width; |
---|
| 60 | // Slit height in Q units |
---|
| 61 | double height; |
---|
| 62 | |
---|
| 63 | // Constructor |
---|
| 64 | SlitSmearer(double width, double height, double qmin, double qmax, int nbins); |
---|
| 65 | // Compute the smearing matrix |
---|
| 66 | virtual void compute_matrix(); |
---|
| 67 | }; |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | /** |
---|
| 71 | * Point smearer class |
---|
| 72 | */ |
---|
| 73 | class QSmearer : public BaseSmearer { |
---|
| 74 | |
---|
| 75 | protected: |
---|
| 76 | // Standard deviation in Q [A-1] |
---|
| 77 | double* width; |
---|
| 78 | |
---|
| 79 | public: |
---|
| 80 | |
---|
| 81 | // Constructor |
---|
| 82 | QSmearer(double* width,double qmin, double qmax, int nbins); |
---|
| 83 | // Compute the smearing matrix |
---|
| 84 | virtual void compute_matrix(); |
---|
| 85 | }; |
---|
| 86 | |
---|
| 87 | #endif |
---|