Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
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...
 
virtual const char * what () const throw ()
 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 48 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.

28  : fExcString(_excString), fLine(_line), fFile(_file),fFatal(false) {
29 }
std::string fFile
Definition: GFException.h:56
std::string fExcString
Definition: GFException.h:54
GFException::~GFException ( )
throw (
)
virtual

Definition at line 31 of file GFException.cxx.

31  {
32 }

Member Function Documentation

std::string GFException::getExcString ( )
inline

Definition at line 92 of file GFException.h.

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

print information in the exception object

Definition at line 58 of file GFException.cxx.

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

get fatal flag.

Definition at line 80 of file GFException.h.

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

Definition at line 94 of file GFException.h.

94 {fQuiet=b;}
static bool * b
Definition: config.cpp:1043
static bool fQuiet
Definition: GFException.h:52
GFException& GFException::setFatal ( bool  b = true)
inline

set fatal flag. if this is true, the fit stops for this current track repr.

Definition at line 78 of file GFException.h.

78 { fFatal=b; return *this; }
static bool * b
Definition: config.cpp:1043
GFException & GFException::setMatrices ( std::string  _matricesLabel,
const std::vector< TMatrixT< Double_t > > &  _matrices 
)

set list of matrices with description

Definition at line 41 of file GFException.cxx.

42  {
43  fMatricesLabel = _matricesLabel;
44  fMatrices = _matrices;
45  return *this;
46 }
std::vector< TMatrixT< Double_t > > fMatrices
Definition: GFException.h:61
std::string fMatricesLabel
Definition: GFException.h:59
GFException & GFException::setNumbers ( std::string  _numbersLabel,
const std::vector< double > &  _numbers 
)

set list of numbers with description

Definition at line 34 of file GFException.cxx.

35  {
36  fNumbersLabel = _numbersLabel;
37  fNumbers = _numbers;
38  return *this;
39 }
std::string fNumbersLabel
Definition: GFException.h:58
std::vector< double > fNumbers
Definition: GFException.h:60
const char * GFException::what ( void  ) const
throw (
)
virtual

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

Definition at line 48 of file GFException.cxx.

48  {
49  if(fQuiet) return "";
50  std::ostringstream returnStream;
51  returnStream << "GFException thrown with excString:"
53  << "in line: " << fLine << " in file: " << fFile << std::endl
54  << "with fatal flag " << fFatal << std::endl;
55  return returnStream.str().c_str();
56 }
std::string fFile
Definition: GFException.h:56
std::string fExcString
Definition: GFException.h:54
static bool fQuiet
Definition: GFException.h:52
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::string GFException::fExcString
private

Definition at line 54 of file GFException.h.

bool GFException::fFatal
private

Definition at line 63 of file GFException.h.

std::string GFException::fFile
private

Definition at line 56 of file GFException.h.

int GFException::fLine
private

Definition at line 55 of file GFException.h.

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

Definition at line 61 of file GFException.h.

std::string GFException::fMatricesLabel
private

Definition at line 59 of file GFException.h.

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

Definition at line 60 of file GFException.h.

std::string GFException::fNumbersLabel
private

Definition at line 58 of file GFException.h.

bool GFException::fQuiet = false
staticprivate

Definition at line 52 of file GFException.h.


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