LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
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 74 of file FlashHypothesis.h.

Constructor & Destructor Documentation

opdet::FlashHypothesisCollection::FlashHypothesisCollection ( )
inline

Definition at line 78 of file FlashHypothesis.h.

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

Definition at line 79 of file FlashHypothesis.h.

References opdet::FlashHypothesis::FlashHypothesis().

80  { _prompt_hyp=FlashHypothesis(s); _late_hyp=FlashHypothesis(s); UpdateTotalHyp(); }
Float_t s
Definition: plot.C:23
opdet::FlashHypothesisCollection::FlashHypothesisCollection ( const FlashHypothesis prompt,
const FlashHypothesis late 
)
inline

Definition at line 81 of file FlashHypothesis.h.

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

Member Function Documentation

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

Definition at line 72 of file FlashHypothesis.cxx.

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

Definition at line 92 of file FlashHypothesis.h.

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

Definition at line 91 of file FlashHypothesis.h.

const FlashHypothesis& opdet::FlashHypothesisCollection::GetPromptHypothesis ( ) const
inline
const FlashHypothesis& opdet::FlashHypothesisCollection::GetTotalHypothesis ( ) const
inline
size_t opdet::FlashHypothesisCollection::GetVectorSize ( ) const
inline
void opdet::FlashHypothesisCollection::Normalize ( float  totalPEs)

Definition at line 66 of file FlashHypothesis.cxx.

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

Definition at line 102 of file FlashHypothesis.h.

References GetLateHypothesis(), GetPromptHypothesis(), opdet::FlashHypothesis::GetVectorSize(), and GetVectorSize().

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

Definition at line 92 of file FlashHypothesis.cxx.

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

Definition at line 84 of file FlashHypothesis.h.

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

Definition at line 57 of file FlashHypothesis.cxx.

References opdet::FlashHypothesis::GetTotalPEs(), and opdet::FlashHypothesis::Normalize().

Referenced by opdet::FlashHypothesisCreator::CreateFlashHypothesesFromSegment().

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

Definition at line 48 of file FlashHypothesis.cxx.

References opdet::FlashHypothesis::GetTotalPEs(), and opdet::FlashHypothesis::Normalize().

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

Definition at line 82 of file FlashHypothesis.cxx.

83 {
85  const float total_pe = _total_hyp.GetTotalPEs();
86  if(total_pe > std::numeric_limits<float>::epsilon())
87  _prompt_frac = _prompt_hyp.GetTotalPEs() / total_pe;
88  else
89  _prompt_frac = 1.;
90 }
float GetTotalPEs() const

Member Data Documentation

FlashHypothesis opdet::FlashHypothesisCollection::_late_hyp
private

Definition at line 117 of file FlashHypothesis.h.

float opdet::FlashHypothesisCollection::_prompt_frac
private

Definition at line 119 of file FlashHypothesis.h.

FlashHypothesis opdet::FlashHypothesisCollection::_prompt_hyp
private

Definition at line 116 of file FlashHypothesis.h.

FlashHypothesis opdet::FlashHypothesisCollection::_total_hyp
private

Definition at line 118 of file FlashHypothesis.h.


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