LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
GFException Class Reference

Exception class for error handling in GENFIT (provides storage for diagnostic information) More...

#include "GFException.h"

Inheritance diagram for GFException:

Public Member Functions

 GFException (std::string, int, std::string)
 Initializing constructor. More...
 
virtual ~GFException () throw ()
 
GFExceptionsetFatal (bool b=true)
 set fatal flag. if this is true, the fit stops for this current track repr. More...
 
bool isFatal ()
 get fatal flag. More...
 
GFExceptionsetNumbers (std::string, const std::vector< double > &)
 set list of numbers with description More...
 
GFExceptionsetMatrices (std::string, const std::vector< TMatrixT< Double_t >> &)
 set list of matrices with description More...
 
void info ()
 print information in the exception object More...
 
const char * what () const noexcept override
 standard error message handling for exceptions. use like "std::cerr << e.what();" More...
 
std::string getExcString ()
 

Static Public Member Functions

static void quiet (bool b=true)
 

Private Attributes

std::string fExcString
 
int fLine
 
std::string fFile
 
std::string fNumbersLabel
 
std::string fMatricesLabel
 
std::vector< double > fNumbers
 
std::vector< TMatrixT< Double_t > > fMatrices
 
bool fFatal
 

Static Private Attributes

static bool fQuiet = false
 

Detailed Description

Exception class for error handling in GENFIT (provides storage for diagnostic information)

Author
Christian Höppner (Technische Universität München, original author)
Sebastian Neubert (Technische Universität München, original author)

This is the class that is used for all error handling in GENFIT. It is a utility class that allows to store numbers and matrices together with an error string. The exception class can then be thrown when an error is detected and the C++ exception handling facilities can be used to catch and process the exception.

Definition at line 47 of file GFException.h.

Constructor & Destructor Documentation

GFException::GFException ( std::string  _excString,
int  _line,
std::string  _file 
)

Initializing constructor.

Parameters
whaterror message
lineline at which the exception is created. Can be set through LINE macro
filesorcefile in which the exception is created. Can be set through FILE macro

Definition at line 28 of file GFException.cxx.

References fExcString, fFatal, fFile, and fLine.

29  : fExcString(_excString), fLine(_line), fFile(_file), fFatal(false)
30 {
31  std::ostringstream returnStream;
32  returnStream << "GFException thrown with excString:\n"
33  << fExcString << "\nin line: " << fLine << " in file: " << fFile
34  << "\nwith fatal flag " << fFatal << '\n';
35  fExcString = returnStream.str();
36 }
std::string fFile
Definition: GFException.h:53
std::string fExcString
Definition: GFException.h:51
GFException::~GFException ( )
throw (
)
virtual

Definition at line 38 of file GFException.cxx.

38 {}

Member Function Documentation

std::string GFException::getExcString ( )
inline

Definition at line 93 of file GFException.h.

References fExcString.

93 { return fExcString; }
std::string fExcString
Definition: GFException.h:51
void GFException::info ( )

print information in the exception object

Definition at line 61 of file GFException.cxx.

References fMatrices, fMatricesLabel, fNumbers, fNumbersLabel, and fQuiet.

Referenced by genf::GFKalman::fittingPass(), isFatal(), and genf::GFDaf::processTrack().

62 {
63  if (fQuiet) return;
64  if (fNumbers.size() == 0 && fMatrices.size() == 0) return; //do nothing
65  std::cout << "GFException Info Output" << std::endl;
66  std::cout << "===========================" << std::endl;
67  if (fNumbersLabel != "") {
68  std::cout << "Numbers Label String:" << std::endl;
69  std::cout << fNumbersLabel << std::endl;
70  }
71  if (fNumbers.size() > 0) {
72  std::cout << "---------------------------" << std::endl;
73  std::cout << "Numbers:" << std::endl;
74  for (unsigned int i = 0; i < fNumbers.size(); i++)
75  std::cout << fNumbers.at(i) << std::endl;
76  }
77  if (fMatricesLabel != "") {
78  std::cout << "---------------------------" << std::endl;
79  std::cout << "Matrices Label String:" << std::endl;
80  std::cout << fMatricesLabel << std::endl;
81  }
82  if (fMatrices.size() > 0) {
83  std::cout << "---------------------------" << std::endl;
84  std::cout << "Matrices:" << std::endl;
85  for (unsigned int i = 0; i < fMatrices.size(); i++)
86  fMatrices.at(i).Print();
87  }
88  std::cout << "===========================" << std::endl;
89 }
std::string fNumbersLabel
Definition: GFException.h:55
std::string fMatricesLabel
Definition: GFException.h:56
std::vector< double > fNumbers
Definition: GFException.h:57
static bool fQuiet
Definition: GFException.h:49
std::vector< TMatrixT< Double_t > > fMatrices
Definition: GFException.h:58
bool GFException::isFatal ( )
inline

get fatal flag.

Definition at line 81 of file GFException.h.

References fFatal, info(), setMatrices(), setNumbers(), lar::dump::vector(), and what().

Referenced by genf::GFKalman::fittingPass(), and genf::GFDaf::processTrack().

81 { return fFatal; }
static void GFException::quiet ( bool  b = true)
inlinestatic

Definition at line 95 of file GFException.h.

References genf::PrintROOTmatrix(), and genf::PrintROOTobject().

95 { fQuiet = b; }
static bool fQuiet
Definition: GFException.h:49
GFException & GFException::setMatrices ( std::string  _matricesLabel,
const std::vector< TMatrixT< Double_t >> &  _matrices 
)

set list of matrices with description

Definition at line 47 of file GFException.cxx.

References fMatrices, and fMatricesLabel.

Referenced by genf::GFKalman::calcGain(), genf::GFKalman::chi2Increment(), and isFatal().

49 {
50  fMatricesLabel = _matricesLabel;
51  fMatrices = _matrices;
52  return *this;
53 }
std::string fMatricesLabel
Definition: GFException.h:56
std::vector< TMatrixT< Double_t > > fMatrices
Definition: GFException.h:58
GFException & GFException::setNumbers ( std::string  _numbersLabel,
const std::vector< double > &  _numbers 
)

set list of numbers with description

Definition at line 40 of file GFException.cxx.

References fNumbers, and fNumbersLabel.

Referenced by genf::GFRecoHitFactory::addProducer(), genf::GFKalman::chi2Increment(), genf::GFRecoHitFactory::createOne(), isFatal(), and genf::GFDaf::setProbCut().

41 {
42  fNumbersLabel = _numbersLabel;
43  fNumbers = _numbers;
44  return *this;
45 }
std::string fNumbersLabel
Definition: GFException.h:55
std::vector< double > fNumbers
Definition: GFException.h:57
const char * GFException::what ( ) const
overridenoexcept

standard error message handling for exceptions. use like "std::cerr << e.what();"

Definition at line 55 of file GFException.cxx.

References fExcString, and fQuiet.

Referenced by genf::GFKalman::fittingPass(), isFatal(), genf::GFDaf::processTrack(), and trkf::Track3DKalman::produce().

56 {
57  if (fQuiet) return "";
58  return fExcString.c_str();
59 }
std::string fExcString
Definition: GFException.h:51
static bool fQuiet
Definition: GFException.h:49

Member Data Documentation

std::string GFException::fExcString
private

Definition at line 51 of file GFException.h.

Referenced by getExcString(), GFException(), and what().

bool GFException::fFatal
private

Definition at line 60 of file GFException.h.

Referenced by GFException(), and isFatal().

std::string GFException::fFile
private

Definition at line 53 of file GFException.h.

Referenced by GFException().

int GFException::fLine
private

Definition at line 52 of file GFException.h.

Referenced by GFException().

std::vector<TMatrixT<Double_t> > GFException::fMatrices
private

Definition at line 58 of file GFException.h.

Referenced by info(), and setMatrices().

std::string GFException::fMatricesLabel
private

Definition at line 56 of file GFException.h.

Referenced by info(), and setMatrices().

std::vector<double> GFException::fNumbers
private

Definition at line 57 of file GFException.h.

Referenced by info(), and setNumbers().

std::string GFException::fNumbersLabel
private

Definition at line 55 of file GFException.h.

Referenced by info(), and setNumbers().

bool GFException::fQuiet = false
staticprivate

Definition at line 49 of file GFException.h.

Referenced by info(), and what().


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