7 std::vector<float> err)
9 if (err.size() != 0 && err.size() != v.size())
10 throw std::runtime_error(
"ERROR in FlashHypothesisVectorSetter: Vector sizes not equal");
13 if (err.size() == 0) {
35 if (
GetTotalPEs() < std::numeric_limits<float>::epsilon())
return;
37 const float PE_ratio = totalPE_target /
GetTotalPEs();
38 for (
size_t i_opdet = 0; i_opdet <
_NPEs_Vector.size(); i_opdet++) {
73 _total_hyp = _prompt_hyp + _late_hyp;
78 _prompt_hyp.Normalize(totalPE_target * _prompt_frac);
79 _late_hyp.Normalize(totalPE_target * (1. - _prompt_frac));
85 if (
std::abs(f - 0.0) < std::numeric_limits<float>::epsilon() ||
86 std::abs(f - 1.0) < std::numeric_limits<float>::epsilon() || (f > 0.0 && f < 1.0))
89 throw std::runtime_error(
90 "ERROR in FlashHypothesisCollection: Input fraction is not in valid range.");
95 _total_hyp = _prompt_hyp + _late_hyp;
96 const float total_pe = _total_hyp.GetTotalPEs();
97 if (total_pe > std::numeric_limits<float>::epsilon())
98 _prompt_frac = _prompt_hyp.GetTotalPEs() / total_pe;
105 std::cout <<
"PromptHyp:" << std::endl;
107 std::cout <<
"LateHyp:" << std::endl;
109 std::cout <<
"TotalHyp:" << std::endl;
111 std::cout <<
"PromptFraction: " << _prompt_frac << std::endl;
void SetHypothesisVectorAndErrorVector(std::vector< float > v, std::vector< float > err=std::vector< float >(0))
size_t GetVectorSize() const
float GetTotalPEsError() const
constexpr auto abs(T v)
Returns the absolute value of the argument.
std::vector< float > _NPEs_ErrorVector
void SetHypothesisAndError(size_t i_opdet, float pe, float err=-999)
float GetTotalPEs() const
float const & GetHypothesisError(size_t i_opdet) const
void SetTotalHypAndPromptFraction(const FlashHypothesis &total, float frac)
void SetHypothesisError(size_t i_opdet, float err)
std::vector< float > _NPEs_Vector
void SetPromptHypAndPromptFraction(const FlashHypothesis &prompt, float frac)
float const & GetHypothesis(size_t i_opdet) const
void Normalize(float const &totalPE_target)
void SetHypothesis(size_t i_opdet, float pe)
void Normalize(float totalPEs)