DDASToys for NSCLDAQ  6.2-000
functions_analytic.h
Go to the documentation of this file.
1 
2 /*
3  This software is Copyright by the Board of Trustees of Michigan
4  State University (c) Copyright 2017.
5 
6  You may use this software under the terms of the GNU public license
7  (GPL). The terms of this license are described at:
8 
9  http://www.gnu.org/licenses/gpl.txt
10 
11  Authors:
12  Ron Fox
13  Jeromy Tompkins
14  Aaron Chester
15  FRIB
16  Michigan State University
17  East Lansing, MI 48824-1321
18 */
19 
26 #ifndef FUNCTIONS_ANALYTIC_H
27 #define FUNCTIONS_ANALYTIC_H
28 
29 #include <vector>
30 #include <cstdint>
31 
33 namespace ddastoys {
35  namespace analyticfit {
36 
51  double logistic(double A, double k, double x1, double x);
61  double decay(double A, double k, double x1, double x);
71  double switchOn(double x1, double x);
82  double singlePulse(
83  double A1, double k1, double k2, double x1,
84  double C, double x
85  );
100  double doublePulse(
101  double A1, double k1, double k2, double x1,
102  double A2, double k3, double k4, double x2,
103  double C, double x
104  );
115  double pulseAmplitude(double A, double k1, double k2, double x0);
132  double chiSquare1(
133  double A1, double k1, double k2, double x1, double C,
134  const std::vector<uint16_t>& trace,
135  int low = 0 , int high = -1
136  );
150  double chiSquare1(
151  double A1, double k1, double k2, double x1, double C,
152  const std::vector<std::pair<uint16_t, uint16_t> >& points
153  );
174  double chiSquare2(
175  double A1, double k1, double k2, double x1,
176  double A2, double k3, double k4, double x2,
177  double C,
178  const std::vector<uint16_t>& trace,
179  int low = 0, int high = -1
180  );
198  double chiSquare2(
199  double A1, double k1, double k2, double x1,
200  double A2, double k3, double k4, double x2,
201  double C,
202  const std::vector<std::pair<uint16_t, uint16_t> >& points
203  );
210  void writeTrace(
211  const char* filename, const char* title,
212  const std::vector<uint16_t>& trace
213  );
221  void writeTrace2(
222  const char* filename, const char* title,
223  const std::vector<uint16_t>& trace1,
224  const std::vector<uint16_t>& trace2
225  );
226 
229  }
230 };
231 
232 #endif
__host__ __device__ float singlePulse(float A1, float k1, float k2, float x1, float C, float x)
Evaluate the value of a single pulse in accordance with our canonical functional form.
Definition: cudafit_analytic.cu:225
__host__ __device__ float doublePulse(float A1, float k1, float k2, float x1, float A2, float k3, float k4, float x2, float C, float x)
Evaluate the canonical form of a double pulse.
Definition: cudafit_analytic.cu:254
__host__ __device__ float logistic(float A, float k, float x1, float x)
Evaluate a logistic function for the specified parameters and point.
Definition: cudafit_analytic.cu:182
__host__ __device__ float decay(float A, float k, float x1, float x)
Exponential decay function.
Definition: cudafit_analytic.cu:201
double pulseAmplitude(double A, double k1, double k2, double x0)
Definition: functions_analytic.cpp:127
double chiSquare2(double A1, double k1, double k2, double x1, double A2, double k3, double k4, double x2, double C, const std::vector< std::pair< uint16_t, uint16_t > > &points)
Computes the chi-square goodness of a specific parameterization of a double pulse canonical form with...
Definition: functions_analytic.cpp:239
double chiSquare1(double A1, double k1, double k2, double x1, double C, const std::vector< std::pair< uint16_t, uint16_t > > &points)
Computes the chi-square goodness-of-fit for a specific parameterization of a single pulse canonical f...
Definition: functions_analytic.cpp:181
void writeTrace2(const char *filename, const char *title, const std::vector< uint16_t > &trace1, const std::vector< uint16_t > &trace2)
Write two traces to a file.
Definition: functions_analytic.cpp:279
double switchOn(double x1, double x)
Logistic switch to turn on a function evaluation at a given point.
Definition: functions_analytic.cpp:65
void writeTrace(const char *filename, const char *title, const std::vector< uint16_t > &trace)
Write a single trace to a file.
Definition: functions_analytic.cpp:263