Public Member Functions | Private Member Functions | Private Attributes | List of all members
opdet::FlashHypothesisCollection Class Reference

#include <FlashHypothesis.h>

Public Member Functions

 FlashHypothesisCollection ()
 
 FlashHypothesisCollection (size_t s)
 
 FlashHypothesisCollection (const FlashHypothesis &prompt, const FlashHypothesis &late)
 
void SetPromptAndLateHyp (const FlashHypothesis &prompt, const FlashHypothesis &late)
 
void SetTotalHypAndPromptFraction (const FlashHypothesis &total, float frac)
 
void SetPromptHypAndPromptFraction (const FlashHypothesis &prompt, float frac)
 
size_t GetVectorSize () const
 
float GetPromptFraction () const
 
float GetLateFraction () const
 
const FlashHypothesisGetPromptHypothesis () const
 
const FlashHypothesisGetLateHypothesis () const
 
const FlashHypothesisGetTotalHypothesis () const
 
void Normalize (float totalPEs)
 
void Print ()
 
FlashHypothesisCollection operator+ (const FlashHypothesisCollection &fhc)
 

Private Member Functions

void CheckFrac (float f)
 
void UpdateTotalHyp ()
 

Private Attributes

FlashHypothesis _prompt_hyp
 
FlashHypothesis _late_hyp
 
FlashHypothesis _total_hyp
 
float _prompt_frac
 

Detailed Description

Definition at line 73 of file FlashHypothesis.h.

Constructor & Destructor Documentation

opdet::FlashHypothesisCollection::FlashHypothesisCollection ( )
inline

Definition at line 77 of file FlashHypothesis.h.

77 {}
opdet::FlashHypothesisCollection::FlashHypothesisCollection ( size_t  s)
inline

Definition at line 78 of file FlashHypothesis.h.

79  { _prompt_hyp=FlashHypothesis(s); _late_hyp=FlashHypothesis(s); UpdateTotalHyp(); }
static QCString * s
Definition: config.cpp:1042
opdet::FlashHypothesisCollection::FlashHypothesisCollection ( const FlashHypothesis prompt,
const FlashHypothesis late 
)
inline

Definition at line 80 of file FlashHypothesis.h.

81  { SetPromptAndLateHyp(prompt,late); }
void SetPromptAndLateHyp(const FlashHypothesis &prompt, const FlashHypothesis &late)

Member Function Documentation

void opdet::FlashHypothesisCollection::CheckFrac ( float  f)
private

Definition at line 74 of file FlashHypothesis.cxx.

75 {
76  if ( std::abs(f-0.0) < std::numeric_limits<float>::epsilon() ||
77  std::abs(f-1.0) < std::numeric_limits<float>::epsilon() ||
78  (f>0.0 && f<1.0) )
79  return;
80 
81  throw std::runtime_error("ERROR in FlashHypothesisCollection: Input fraction is not in valid range.");
82 }
T abs(T value)
float opdet::FlashHypothesisCollection::GetLateFraction ( ) const
inline

Definition at line 91 of file FlashHypothesis.h.

const FlashHypothesis& opdet::FlashHypothesisCollection::GetLateHypothesis ( ) const
inline

Definition at line 94 of file FlashHypothesis.h.

94 { return _late_hyp; }
float opdet::FlashHypothesisCollection::GetPromptFraction ( ) const
inline

Definition at line 90 of file FlashHypothesis.h.

const FlashHypothesis& opdet::FlashHypothesisCollection::GetPromptHypothesis ( ) const
inline

Definition at line 93 of file FlashHypothesis.h.

93 { return _prompt_hyp; }
const FlashHypothesis& opdet::FlashHypothesisCollection::GetTotalHypothesis ( ) const
inline

Definition at line 95 of file FlashHypothesis.h.

95 { return _total_hyp; }
size_t opdet::FlashHypothesisCollection::GetVectorSize ( ) const
inline

Definition at line 88 of file FlashHypothesis.h.

88 { return _prompt_hyp.GetVectorSize(); }
size_t GetVectorSize() const
void opdet::FlashHypothesisCollection::Normalize ( float  totalPEs)

Definition at line 68 of file FlashHypothesis.cxx.

68  {
69  _prompt_hyp.Normalize(totalPE_target*_prompt_frac);
70  _late_hyp.Normalize(totalPE_target*(1.-_prompt_frac));
72 }
void Normalize(float const &totalPE_target)
FlashHypothesisCollection opdet::FlashHypothesisCollection::operator+ ( const FlashHypothesisCollection fhc)
inline

Definition at line 101 of file FlashHypothesis.h.

101  {
102 
103  if( this->GetVectorSize() != fhc.GetVectorSize() )
104  throw std::runtime_error("ERROR in FlashHypothesisCollectionAddition: Cannot add hypothesis of different size");
105 
106  FlashHypothesis ph = this->GetPromptHypothesis();
107  ph = ph + fhc.GetPromptHypothesis();
108  FlashHypothesis lh = this->GetLateHypothesis();
109  lh = lh + fhc.GetLateHypothesis();
110 
111  return (FlashHypothesisCollection(ph,lh));
112  }
const FlashHypothesis & GetLateHypothesis() const
const FlashHypothesis & GetPromptHypothesis() const
void opdet::FlashHypothesisCollection::Print ( void  )

Definition at line 94 of file FlashHypothesis.cxx.

95 {
96  std::cout << "PromptHyp:" << std::endl;
98  std::cout << "LateHyp:" << std::endl;
99  _late_hyp.Print();
100  std::cout << "TotalHyp:" << std::endl;
101  _total_hyp.Print();
102  std::cout << "PromptFraction: " << _prompt_frac << std::endl;
103 
104 }
QTextStream & endl(QTextStream &s)
void opdet::FlashHypothesisCollection::SetPromptAndLateHyp ( const FlashHypothesis prompt,
const FlashHypothesis late 
)
inline

Definition at line 83 of file FlashHypothesis.h.

void opdet::FlashHypothesisCollection::SetPromptHypAndPromptFraction ( const FlashHypothesis prompt,
float  frac 
)

Definition at line 59 of file FlashHypothesis.cxx.

60 {
61  CheckFrac(frac);
62  _prompt_hyp = prompt;
63  _prompt_frac = frac;
64  _late_hyp = prompt; _late_hyp.Normalize( (1/frac - 1.)*prompt.GetTotalPEs() );
66 }
void Normalize(float const &totalPE_target)
void opdet::FlashHypothesisCollection::SetTotalHypAndPromptFraction ( const FlashHypothesis total,
float  frac 
)

Definition at line 50 of file FlashHypothesis.cxx.

51 {
52  CheckFrac(frac);
53  _total_hyp = total;
54  _prompt_frac = frac;
55  _prompt_hyp = total; _prompt_hyp.Normalize( frac*total.GetTotalPEs() );
56  _late_hyp = total; _late_hyp.Normalize( (1.-frac)*total.GetTotalPEs() );
57 }
void Normalize(float const &totalPE_target)
void opdet::FlashHypothesisCollection::UpdateTotalHyp ( )
private

Definition at line 84 of file FlashHypothesis.cxx.

85 {
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;
90  else
91  _prompt_frac = 1.;
92 }
float GetTotalPEs() const

Member Data Documentation

FlashHypothesis opdet::FlashHypothesisCollection::_late_hyp
private

Definition at line 116 of file FlashHypothesis.h.

float opdet::FlashHypothesisCollection::_prompt_frac
private

Definition at line 118 of file FlashHypothesis.h.

FlashHypothesis opdet::FlashHypothesisCollection::_prompt_hyp
private

Definition at line 115 of file FlashHypothesis.h.

FlashHypothesis opdet::FlashHypothesisCollection::_total_hyp
private

Definition at line 117 of file FlashHypothesis.h.


The documentation for this class was generated from the following files: