source: sasview/src/sas/models/c_extension/c_smearer/smearer.hh @ 6bd3a8d1

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 6bd3a8d1 was 79492222, checked in by krzywon, 10 years ago

Changed the file and folder names to remove all SANS references.

  • Property mode set to 100644
File size: 2.4 KB
RevLine 
[230f479]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
19using namespace std;
20
21/**
22 * Base smearer class, implementing the matrix multiplication only
23 */
24class BaseSmearer {
25protected:
26        // Internal flag: true when the weights vector is filled
27        bool has_matrix;
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;
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
41public:
42    // Constructor
43    BaseSmearer(double qmin, double qmax, int nbins);
44    BaseSmearer(double* q, int nbins);
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; }
51        // Get the q range of a particular bin
52        virtual int get_bin_range(int, double*, double*, double*);
53};
54
55
56/**
57 * Slit smearer class
58 */
59class SlitSmearer : public BaseSmearer {
60
61protected:
62    // Number of points used in the smearing computation
63    static const int npts   = 500;
64
65public:
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);
73        SlitSmearer(double width, double height, double* q, int nbins);
74        // Compute the smearing matrix
75        virtual void compute_matrix();
76};
77
78
79/**
80 * Point smearer class
81 */
82class QSmearer : public BaseSmearer {
83
84protected:
85    // Standard deviation in Q [A-1]
86    double* width;
87
88public:
89
90    // Constructor
91    QSmearer(double* width, double qmin, double qmax, int nbins);
92    QSmearer(double* width, double* q, int nbins);
93        // Compute the smearing matrix
94        virtual void compute_matrix();
95};
96
97#endif
Note: See TracBrowser for help on using the repository browser.