1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-09-19 21:25:36 +01:00

minor fixes in new physics classes

This commit is contained in:
Antonin Portelli 2020-01-28 17:34:37 +00:00
parent 1bde8822b1
commit 685d433032
4 changed files with 40 additions and 6 deletions

View File

@ -128,17 +128,17 @@ CorrelatorModels::ModelPar CorrelatorModels::parseModel(const string s)
if (regex_match(s, sm, regex("exp([0-9]+)"))) if (regex_match(s, sm, regex("exp([0-9]+)")))
{ {
par.type = CorrelatorType::exp; par.type = CorrelatorType::exp;
par.nState = strTo<Index>(sm[0].str()); par.nState = strTo<Index>(sm[1].str());
} }
else if (regex_match(s, sm, regex("cosh([0-9]+)"))) else if (regex_match(s, sm, regex("cosh([0-9]+)")))
{ {
par.type = CorrelatorType::cosh; par.type = CorrelatorType::cosh;
par.nState = strTo<Index>(sm[0].str()); par.nState = strTo<Index>(sm[1].str());
} }
else if (regex_match(s, sm, regex("sinh([0-9]+)"))) else if (regex_match(s, sm, regex("sinh([0-9]+)")))
{ {
par.type = CorrelatorType::sinh; par.type = CorrelatorType::sinh;
par.nState = strTo<Index>(sm[0].str()); par.nState = strTo<Index>(sm[1].str());
} }
else if (s == "linear") else if (s == "linear")
{ {
@ -189,7 +189,7 @@ DVec CorrelatorModels::parameterGuess(const DMatSample &corr,
const ModelPar par) const ModelPar par)
{ {
DVec init; DVec init;
Index nt = corr.size(); Index nt = corr[central].size();
switch (par.type) switch (par.type)
{ {
@ -234,6 +234,11 @@ CorrelatorFitter::CorrelatorFitter(const std::vector<DMatSample> &corr)
setCorrelators(corr); setCorrelators(corr);
} }
XYSampleData & CorrelatorFitter::data(void)
{
return *data_;
}
void CorrelatorFitter::setCorrelator(const DMatSample &corr) void CorrelatorFitter::setCorrelator(const DMatSample &corr)
{ {
std::vector<DMatSample> vec; std::vector<DMatSample> vec;

View File

@ -51,6 +51,8 @@ class CorrelatorFitter
public: public:
CorrelatorFitter(const DMatSample &corr); CorrelatorFitter(const DMatSample &corr);
CorrelatorFitter(const std::vector<DMatSample> &corr); CorrelatorFitter(const std::vector<DMatSample> &corr);
virtual ~CorrelatorFitter(void) = default;
XYSampleData & data(void);
void setCorrelator(const DMatSample &corr); void setCorrelator(const DMatSample &corr);
void setCorrelators(const std::vector<DMatSample> &corr); void setCorrelators(const std::vector<DMatSample> &corr);
const DMatSample & getCorrelator(const Index i = 0) const; const DMatSample & getCorrelator(const Index i = 0) const;

View File

@ -25,8 +25,9 @@ using namespace Latan;
// constructors //////////////////////////////////////////////////////////////// // constructors ////////////////////////////////////////////////////////////////
EffectiveMass::EffectiveMass(const CorrelatorType type) EffectiveMass::EffectiveMass(const CorrelatorType type)
: type_(type) {
{} setType(type);
}
// access ////////////////////////////////////////////////////////////////////// // access //////////////////////////////////////////////////////////////////////
CorrelatorType EffectiveMass::getType(void) const CorrelatorType EffectiveMass::getType(void) const
@ -39,6 +40,31 @@ void EffectiveMass::setType(const CorrelatorType type)
type_ = type; type_ = type;
} }
DVec EffectiveMass::getTime(const Index nt) const
{
DVec tvec;
switch (type_)
{
case CorrelatorType::undefined:
LATAN_ERROR(Argument, "correlator type is undefined");
break;
case CorrelatorType::exp:
case CorrelatorType::linear:
tvec = DVec::LinSpaced(nt - 1, 0, nt - 2);
break;
case CorrelatorType::cosh:
case CorrelatorType::sinh:
tvec = DVec::LinSpaced(nt - 2, 1, nt - 2);
break;
case CorrelatorType::cst:
tvec = DVec::LinSpaced(nt, 0, nt - 1);
break;
}
return tvec;
}
// compute effective mass ////////////////////////////////////////////////////// // compute effective mass //////////////////////////////////////////////////////
DVec EffectiveMass::operator()(const DVec &corr) const DVec EffectiveMass::operator()(const DVec &corr) const
{ {

View File

@ -37,6 +37,7 @@ public:
// access // access
CorrelatorType getType(void) const; CorrelatorType getType(void) const;
void setType(const CorrelatorType type); void setType(const CorrelatorType type);
DVec getTime(const Index nt) const;
// compute effective mass // compute effective mass
DVec operator()(const DVec &corr) const; DVec operator()(const DVec &corr) const;
DMatSample operator()(const DMatSample &corr) const; DMatSample operator()(const DMatSample &corr) const;