LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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...
 
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 50 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 26 of file GFException.cxx.

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

Definition at line 29 of file GFException.cxx.

29  {
30 }

Member Function Documentation

std::string GFException::getExcString ( )
inline

Definition at line 94 of file GFException.h.

References fExcString.

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

print information in the exception object

Definition at line 56 of file GFException.cxx.

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

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

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

get fatal flag.

Definition at line 82 of file GFException.h.

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

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

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

Definition at line 96 of file GFException.h.

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

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

set list of matrices with description

Definition at line 39 of file GFException.cxx.

References fMatrices, and fMatricesLabel.

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

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

set list of numbers with description

Definition at line 32 of file GFException.cxx.

References fNumbers, and fNumbersLabel.

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

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

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

Definition at line 46 of file GFException.cxx.

References fExcString, fFatal, fFile, fLine, and fQuiet.

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

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

Member Data Documentation

std::string GFException::fExcString
private

Definition at line 56 of file GFException.h.

Referenced by getExcString(), and what().

bool GFException::fFatal
private

Definition at line 65 of file GFException.h.

Referenced by isFatal(), and what().

std::string GFException::fFile
private

Definition at line 58 of file GFException.h.

Referenced by what().

int GFException::fLine
private

Definition at line 57 of file GFException.h.

Referenced by what().

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

Definition at line 63 of file GFException.h.

Referenced by info(), and setMatrices().

std::string GFException::fMatricesLabel
private

Definition at line 61 of file GFException.h.

Referenced by info(), and setMatrices().

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

Definition at line 62 of file GFException.h.

Referenced by info(), and setNumbers().

std::string GFException::fNumbersLabel
private

Definition at line 60 of file GFException.h.

Referenced by info(), and setNumbers().

bool GFException::fQuiet = false
staticprivate

Definition at line 54 of file GFException.h.

Referenced by info(), and what().


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