FairRoot/PandaRoot
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 ()
 
void setFatal (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...
 
void setNumbers (std::string, const std::vector< double > &)
 set list of numbers with description More...
 
void setMatrices (std::string, const std::vector< TMatrixT< double > > &)
 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 fErrorMessage
 
std::string fNumbersLabel
 
std::string fMatricesLabel
 
std::vector< double > fNumbers
 
std::vector< TMatrixT< double > > 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 45 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 23 of file GFException.cxx.

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

23  : fExcString(_excString), fLine(_line), fFile(_file),fFatal(false) {
24  std::ostringstream ErrMsgStream;
25  ErrMsgStream << "GFException thrown with excString:"
26  << std::endl << fExcString << std::endl
27  << "in line: " << fLine << " in file: " << fFile << std::endl
28  << "with fatal flag " << fFatal << std::endl;
29  fErrorMessage = ErrMsgStream.str();
30 }
std::string fErrorMessage
Definition: GFException.h:55
std::string fFile
Definition: GFException.h:53
std::string fExcString
Definition: GFException.h:51
GFException::~GFException ( )
throw (
)
virtual

Definition at line 32 of file GFException.cxx.

32  {
33 }

Member Function Documentation

std::string GFException::getExcString ( )
inline

Definition at line 91 of file GFException.h.

References fExcString.

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

print information in the exception object

Definition at line 52 of file GFException.cxx.

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

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

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

get fatal flag.

Definition at line 79 of file GFException.h.

References fFatal.

Referenced by GFKalman::fittingPass().

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

Definition at line 93 of file GFException.h.

References b, and fQuiet.

Referenced by PndRecoDafFit::Init(), and PndRecoKalmanFit::Init().

93 {fQuiet=b;}
TTree * b
static bool fQuiet
Definition: GFException.h:49
void GFException::setFatal ( bool  b = true)
inline
void GFException::setMatrices ( std::string  _matricesLabel,
const std::vector< TMatrixT< double > > &  _matrices 
)

set list of matrices with description

Definition at line 41 of file GFException.cxx.

References fMatrices, and fMatricesLabel.

Referenced by GFKalman::chi2Increment().

42  {
43  fMatricesLabel = _matricesLabel;
44  fMatrices = _matrices;
45 }
std::string fMatricesLabel
Definition: GFException.h:58
std::vector< TMatrixT< double > > fMatrices
Definition: GFException.h:60
void GFException::setNumbers ( std::string  _numbersLabel,
const std::vector< double > &  _numbers 
)

set list of numbers with description

Definition at line 35 of file GFException.cxx.

References fNumbers, and fNumbersLabel.

Referenced by GFRecoHitFactory::addProducer(), and GFRecoHitFactory::createOne().

36  {
37  fNumbersLabel = _numbersLabel;
38  fNumbers = _numbers;
39 }
std::string fNumbersLabel
Definition: GFException.h:57
std::vector< double > fNumbers
Definition: GFException.h:59
const char * GFException::what ( ) const
throw (
)
virtual

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

Definition at line 47 of file GFException.cxx.

References fErrorMessage, and fQuiet.

Referenced by GFDaf::calcWeights(), PndHypKalmanTask::Exec(), PndHypDKalmanTask::Exec(), PndLmdKalmanTask::Exec(), PndRecoDafFit::Fit(), PndRecoKalmanFit::Fit(), GFKalman::fittingPass(), GenfitTrack2PndTrack(), and GFDaf::processTrack().

47  {
48  if(fQuiet) return "";
49  return fErrorMessage.c_str();
50 }
std::string fErrorMessage
Definition: GFException.h:55
static bool fQuiet
Definition: GFException.h:49

Member Data Documentation

std::string GFException::fErrorMessage
private

Definition at line 55 of file GFException.h.

Referenced by GFException(), and what().

std::string GFException::fExcString
private

Definition at line 51 of file GFException.h.

Referenced by getExcString(), and GFException().

bool GFException::fFatal
private

Definition at line 62 of file GFException.h.

Referenced by GFException(), isFatal(), and setFatal().

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> > GFException::fMatrices
private

Definition at line 60 of file GFException.h.

Referenced by info(), and setMatrices().

std::string GFException::fMatricesLabel
private

Definition at line 58 of file GFException.h.

Referenced by info(), and setMatrices().

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

Definition at line 59 of file GFException.h.

Referenced by info(), and setNumbers().

std::string GFException::fNumbersLabel
private

Definition at line 57 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(), quiet(), and what().


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