All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
opdet::FlashHypothesis Class Reference

#include <FlashHypothesis.h>

Public Member Functions

 FlashHypothesis ()
 
 FlashHypothesis (size_t s)
 
 FlashHypothesis (std::vector< float > const &vector, std::vector< float > const &vector_error=std::vector< float >())
 
std::vector< float > const & GetHypothesisVector () const
 
std::vector< float > const & GetHypothesisErrorVector () const
 
void SetHypothesisVector (std::vector< float > v)
 
void SetHypothesisErrorVector (std::vector< float > v)
 
void SetHypothesisVectorAndErrorVector (std::vector< float > v, std::vector< float > err=std::vector< float >(0))
 
float const & GetHypothesis (size_t i_opdet) const
 
float const & GetHypothesisError (size_t i_opdet) const
 
void SetHypothesis (size_t i_opdet, float pe)
 
void SetHypothesisError (size_t i_opdet, float err)
 
void SetHypothesisAndError (size_t i_opdet, float pe, float err=-999)
 
float GetTotalPEs () const
 
float GetTotalPEsError () const
 
size_t GetVectorSize () const
 
void Normalize (float const &totalPE_target)
 
void Print ()
 
FlashHypothesis operator+ (const FlashHypothesis &fh)
 

Private Attributes

std::vector< float > _NPEs_Vector
 
std::vector< float > _NPEs_ErrorVector
 

Detailed Description

Definition at line 18 of file FlashHypothesis.h.

Constructor & Destructor Documentation

opdet::FlashHypothesis::FlashHypothesis ( )
inline

Definition at line 21 of file FlashHypothesis.h.

21 {}
opdet::FlashHypothesis::FlashHypothesis ( size_t  s)
inline

Definition at line 22 of file FlashHypothesis.h.

23  { _NPEs_Vector = std::vector<float>(s,0.0); _NPEs_ErrorVector = std::vector<float>(s,0.0); }
std::vector< float > _NPEs_ErrorVector
std::vector< float > _NPEs_Vector
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
opdet::FlashHypothesis::FlashHypothesis ( std::vector< float > const &  vector,
std::vector< float > const &  vector_error = std::vector<float>() 
)
inline

Definition at line 24 of file FlashHypothesis.h.

26  { SetHypothesisVectorAndErrorVector(vector,vector_error); }
void SetHypothesisVectorAndErrorVector(std::vector< float > v, std::vector< float > err=std::vector< float >(0))

Member Function Documentation

float const& opdet::FlashHypothesis::GetHypothesis ( size_t  i_opdet) const
inline

Definition at line 34 of file FlashHypothesis.h.

34 { return _NPEs_Vector.at(i_opdet); }
std::vector< float > _NPEs_Vector
float const& opdet::FlashHypothesis::GetHypothesisError ( size_t  i_opdet) const
inline

Definition at line 35 of file FlashHypothesis.h.

35 { return _NPEs_ErrorVector.at(i_opdet); }
std::vector< float > _NPEs_ErrorVector
std::vector<float> const& opdet::FlashHypothesis::GetHypothesisErrorVector ( ) const
inline

Definition at line 29 of file FlashHypothesis.h.

29 { return _NPEs_ErrorVector; }
std::vector< float > _NPEs_ErrorVector
std::vector<float> const& opdet::FlashHypothesis::GetHypothesisVector ( ) const
inline

Definition at line 28 of file FlashHypothesis.h.

28 { return _NPEs_Vector; }
std::vector< float > _NPEs_Vector
float opdet::FlashHypothesis::GetTotalPEs ( ) const
inline

Definition at line 41 of file FlashHypothesis.h.

42  { return std::accumulate(_NPEs_Vector.begin(),_NPEs_Vector.end(),0.0); }
std::vector< float > _NPEs_Vector
float opdet::FlashHypothesis::GetTotalPEsError ( ) const
inline

Definition at line 43 of file FlashHypothesis.h.

44  { return std::sqrt( std::inner_product(_NPEs_ErrorVector.begin(),_NPEs_ErrorVector.end(),_NPEs_ErrorVector.begin(),0.0) ); }
std::vector< float > _NPEs_ErrorVector
size_t opdet::FlashHypothesis::GetVectorSize ( ) const
inline

Definition at line 46 of file FlashHypothesis.h.

46 { return _NPEs_Vector.size(); }
std::vector< float > _NPEs_Vector
void FlashHypothesis::Normalize ( float const &  totalPE_target)

Definition at line 30 of file FlashHypothesis.cxx.

30  {
31 
32  if( GetTotalPEs() < std::numeric_limits<float>::epsilon() ) return;
33 
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]);
38  }
39 
40 }
std::vector< float > _NPEs_ErrorVector
float GetTotalPEs() const
std::vector< float > _NPEs_Vector
FlashHypothesis opdet::FlashHypothesis::operator+ ( const FlashHypothesis fh)
inline

Definition at line 52 of file FlashHypothesis.h.

52  {
53 
54  if( _NPEs_Vector.size() != fh.GetVectorSize() )
55  throw std::runtime_error("ERROR in FlashHypothesisAddition: Cannot add hypothesis of different size");
56 
57  FlashHypothesis flashhyp(_NPEs_Vector.size());
58  for(size_t i=0; i<_NPEs_Vector.size(); i++){
59  flashhyp._NPEs_Vector[i] = _NPEs_Vector[i] + fh._NPEs_Vector[i];
60  flashhyp._NPEs_ErrorVector[i] =
61  std::sqrt(this->_NPEs_ErrorVector[i]*this->_NPEs_ErrorVector[i] +
62  fh._NPEs_ErrorVector[i]*fh._NPEs_ErrorVector[i]);
63  }
64  return flashhyp;
65  }
std::vector< float > _NPEs_ErrorVector
std::vector< float > _NPEs_Vector
void FlashHypothesis::Print ( )

Definition at line 42 of file FlashHypothesis.cxx.

43 {
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;
48 }
size_t GetVectorSize() const
float GetTotalPEsError() const
float GetTotalPEs() const
float const & GetHypothesisError(size_t i_opdet) const
float const & GetHypothesis(size_t i_opdet) const
BEGIN_PROLOG could also be cout
void opdet::FlashHypothesis::SetHypothesis ( size_t  i_opdet,
float  pe 
)
inline

Definition at line 36 of file FlashHypothesis.h.

36 { _NPEs_Vector.at(i_opdet)=pe; }
std::vector< float > _NPEs_Vector
void FlashHypothesis::SetHypothesisAndError ( size_t  i_opdet,
float  pe,
float  err = -999 
)

Definition at line 23 of file FlashHypothesis.cxx.

24 {
25  SetHypothesis(i_opdet,pe);
26  if(err>0) SetHypothesisError(i_opdet,err);
27  else SetHypothesisError(i_opdet,std::sqrt(pe));
28 }
EResult err(const char *call)
void SetHypothesisError(size_t i_opdet, float err)
void SetHypothesis(size_t i_opdet, float pe)
void opdet::FlashHypothesis::SetHypothesisError ( size_t  i_opdet,
float  err 
)
inline

Definition at line 37 of file FlashHypothesis.h.

37 { _NPEs_ErrorVector.at(i_opdet) = err; }
EResult err(const char *call)
std::vector< float > _NPEs_ErrorVector
void opdet::FlashHypothesis::SetHypothesisErrorVector ( std::vector< float >  v)
inline

Definition at line 31 of file FlashHypothesis.h.

31 { _NPEs_ErrorVector = v; _NPEs_Vector.resize(v.size()); }
std::vector< float > _NPEs_ErrorVector
std::vector< float > _NPEs_Vector
void opdet::FlashHypothesis::SetHypothesisVector ( std::vector< float >  v)
inline

Definition at line 30 of file FlashHypothesis.h.

30 { _NPEs_Vector=v; _NPEs_ErrorVector.resize(v.size()); }
std::vector< float > _NPEs_ErrorVector
std::vector< float > _NPEs_Vector
void FlashHypothesis::SetHypothesisVectorAndErrorVector ( std::vector< float >  v,
std::vector< float >  err = std::vector<float>(0) 
)

Definition at line 6 of file FlashHypothesis.cxx.

7 {
8  if(err.size()!=0 && err.size()!=v.size())
9  throw std::runtime_error("ERROR in FlashHypothesisVectorSetter: Vector sizes not equal");
10 
11  _NPEs_Vector = v;
12  if(err.size()==0){
13  _NPEs_Vector = v;
14  _NPEs_ErrorVector.resize(v.size());
15  for(size_t i=0; i<_NPEs_Vector.size(); i++)
16  _NPEs_ErrorVector[i] = std::sqrt(_NPEs_Vector[i]);
17  }
18  else
20 
21 }
EResult err(const char *call)
std::vector< float > _NPEs_ErrorVector
std::vector< float > _NPEs_Vector

Member Data Documentation

std::vector<float> opdet::FlashHypothesis::_NPEs_ErrorVector
private

Definition at line 69 of file FlashHypothesis.h.

std::vector<float> opdet::FlashHypothesis::_NPEs_Vector
private

Definition at line 68 of file FlashHypothesis.h.


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