13constexpr double TWOPI = 2.0 * M_PI;
24 declareParameter(
"A", 1.0,
"Polarization at time zero");
25 declareParameter(
"Delta", 0.2,
"Distribution width of local fields (MHz)");
26 declareParameter(
"Field", 50.0,
"Longitudinal field (Gauss)");
27 declareParameter(
"Fluct", 0.2,
"Hopping rate (inverse correlation time, MHz)");
40 throw std::runtime_error(
"Attempt to use an inactive parameter");
59 throw std::runtime_error(
"Attempt to use an inactive parameter");
81 for (
size_t i = 0; i < nData; i++) {
112 const double omegaSq = larmor * larmor;
113 const double nuSq = fluct * fluct;
114 const double omegaT = larmor * time;
115 const double nuT = fluct * time;
116 const double expon = exp(-1.0 * nuT);
119 const double prefactor = (2.0 * deltaSq) / ((omegaSq + nuSq) * (omegaSq + nuSq));
121 const double term1 = (omegaSq + nuSq) * nuT;
122 const double term2 = omegaSq - nuSq;
123 const double term3 = 1.0 - expon * cos(omegaT);
124 const double term4 = 2.0 * fluct * larmor * expon * sin(omegaT);
126 return prefactor * (term1 + term2 * term3 - term4);
double value
The value of the point.
#define DECLARE_FUNCTION(classname)
Macro for declaring a new type of function to be used with the FunctionFactory.
bool isActive(size_t i) const
Check if an active parameter i is actually active.
void setParameter(size_t, const double &value, bool explicitlySet=true) override
Set i-th parameter.
std::string parameterName(size_t i) const override
Returns the name of parameter i.
double getParameter(size_t i) const override
Get i-th parameter.
Keren : Keren fitting function for muon scientists.
void setActiveParameter(size_t i, double value) override
Set active parameter.
double activeParameter(size_t i) const override
Get active parameter.
double relaxation(const double delta, const double larmor, const double fluct, const double time) const
Relaxation form.
void function1D(double *out, const double *xValues, const size_t nData) const override
Evaluate the function at the given values.
double polarization(const double delta, const double larmor, const double fluct, const double time) const
Time-dependent muon polarization.
static constexpr double MuonGyromagneticRatio
Muon gyromagnetic ratio in MHz/G Taken from CalMuonDetectorPhases and DynamicKuboToyabe on 02/02/2016...