aboutsummaryrefslogtreecommitdiffstats
path: root/models/dbeta1d.hpp
blob: 53fa2931cafe567f2091adb16ec4f7fb21010ace (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef DBETA_MODEL_H_
#define DBETA_MODEL_H_
#define OPT_HEADER
#include <core/fitter.hpp>
#include <cmath>
#include <iostream>
namespace opt_utilities
{
  template <typename T>
  class dbeta1d
    :public model<T,T,std::vector<T>,std::string>
  {
  private:
    model<T,T,std::vector<T> >* do_clone()const
    {
      return new dbeta1d<T>(*this);
    }
    
    const char* do_get_type_name()const
    {
      return "1d double beta model";
    }

  public:
    dbeta1d()
    {
      this->push_param_info(param_info<std::vector<T> >("S01",1));
      this->push_param_info(param_info<std::vector<T> >("rc1",30));
      this->push_param_info(param_info<std::vector<T> >("beta1",.6));

      this->push_param_info(param_info<std::vector<T> >("S02",.5));
      this->push_param_info(param_info<std::vector<T> >("rc2",20));
      this->push_param_info(param_info<std::vector<T> >("beta2",.4));


      this->push_param_info(param_info<std::vector<T> >("bkg",0));
    }


    T do_eval(const T& x,const std::vector<T>& param)
    {
      T S01=get_element(param,0);
      T r_c1=get_element(param,1);
      T beta1=get_element(param,2);

      T S02=get_element(param,3);
      T r_c2=get_element(param,4);
      T beta2=get_element(param,5);


      T bkg=get_element(param,6);

      return bkg+S01*pow(1+(x*x)/(r_c1*r_c1),-3*beta1+static_cast<T>(.5))
	+S02*pow(1+(x*x)/(r_c2*r_c2),-3*beta2+static_cast<T>(.5));
    }

  private:
    std::string do_to_string()const
    {
      return "double 1d beta model\n"
	"S=beta(S01,beta1,rc1)+beta(S02,beta2,rc2)\n";
    }
  };
}



#endif
//EOF