8 if(err.size()!=0 && err.size()!=v.size())
9 throw std::runtime_error(
"ERROR in FlashHypothesisVectorSetter: Vector sizes not equal");
25 SetHypothesis(i_opdet,pe);
26 if(err>0) SetHypothesisError(i_opdet,err);
27 else SetHypothesisError(i_opdet,std::sqrt(pe));
32 if( GetTotalPEs() < std::numeric_limits<float>::epsilon() )
return;
34 const float PE_ratio = totalPE_target/GetTotalPEs();
35 for(
size_t i_opdet=0; i_opdet<_NPEs_Vector.size(); i_opdet++){
36 _NPEs_Vector[i_opdet] *= PE_ratio;
37 _NPEs_ErrorVector[i_opdet] = std::sqrt(_NPEs_Vector[i_opdet]);
44 std::cout <<
"TotalPEs: " << GetTotalPEs() <<
" +/- " << GetTotalPEsError() << std::endl;
45 std::cout <<
"Vector size: " << GetVectorSize() << std::endl;
46 for(
size_t i=0; i<GetVectorSize(); i++)
47 std::cout <<
"\t" << i <<
": " << GetHypothesis(i) <<
" +/- " << GetHypothesisError(i) << std::endl;
65 _total_hyp = _prompt_hyp + _late_hyp;
69 _prompt_hyp.Normalize(totalPE_target*_prompt_frac);
70 _late_hyp.Normalize(totalPE_target*(1.-_prompt_frac));
76 if (
std::abs(f-0.0) < std::numeric_limits<float>::epsilon() ||
77 std::abs(f-1.0) < std::numeric_limits<float>::epsilon() ||
81 throw std::runtime_error(
"ERROR in FlashHypothesisCollection: Input fraction is not in valid range.");
86 _total_hyp = _prompt_hyp + _late_hyp;
87 const float total_pe = _total_hyp.GetTotalPEs();
88 if(total_pe > std::numeric_limits<float>::epsilon())
89 _prompt_frac = _prompt_hyp.GetTotalPEs() / total_pe;
102 std::cout <<
"PromptFraction: " << _prompt_frac << std::endl;
Class def header for a class FlashHypothesis.
EResult err(const char *call)
std::vector< float > _NPEs_ErrorVector
float GetTotalPEs() const
void SetTotalHypAndPromptFraction(const FlashHypothesis &total, float frac)
std::vector< float > _NPEs_Vector
void SetHypothesisVectorAndErrorVector(std::vector< float > v, std::vector< float > err=std::vector< float >(0))
void SetPromptHypAndPromptFraction(const FlashHypothesis &prompt, float frac)
void Normalize(float const &totalPE_target)
void SetHypothesisAndError(size_t i_opdet, float pe, float err=-999)
BEGIN_PROLOG could also be cout
void Normalize(float totalPEs)