/
GFException.cxx
77 lines (66 loc) · 2.75 KB
/
GFException.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* Copyright 2008-2010, Technische Universitaet Muenchen,
Authors: Christian Hoeppner & Sebastian Neubert
This file is part of GENFIT.
GENFIT is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
GENFIT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
*/
#include"GFException.h"
bool GFException::fQuiet = false;
GFException::GFException(std::string _excString, int _line, std::string _file) : fExcString(_excString), fLine(_line), fFile(_file),fFatal(false) {
std::ostringstream ErrMsgStream;
ErrMsgStream << "GFException thrown with excString:"
<< std::endl << fExcString << std::endl
<< "in line: " << fLine << " in file: " << fFile << std::endl
<< "with fatal flag " << fFatal << std::endl;
fErrorMessage = ErrMsgStream.str();
}
GFException::~GFException() throw() {
}
void GFException::setNumbers(std::string _numbersLabel,
const std::vector<double>& _numbers) {
fNumbersLabel = _numbersLabel;
fNumbers = _numbers;
}
void GFException::setMatrices(std::string _matricesLabel,
const std::vector< TMatrixT<double> >& _matrices) {
fMatricesLabel = _matricesLabel;
fMatrices = _matrices;
}
const char* GFException::what() const throw(){
if(fQuiet) return "";
return fErrorMessage.c_str();
}
void GFException::info() {
if(fQuiet) return;
if(fNumbers.size() == 0 && fMatrices.size() == 0) return;//do nothing
std::cout << "GFException Info Output" << std::endl;
std::cout << "===========================" << std::endl;
if(fNumbersLabel != "") {
std::cout << "Numbers Label String:" << std::endl;
std::cout << fNumbersLabel << std::endl;
}
if(fNumbers.size() > 0) {
std::cout << "---------------------------" << std::endl;
std::cout << "Numbers:" << std::endl;
for(unsigned int i=0;i<fNumbers.size(); i++ ) std::cout << fNumbers.at(i) << std::endl;
}
if(fMatricesLabel != "") {
std::cout << "---------------------------" << std::endl;
std::cout << "Matrices Label String:" << std::endl;
std::cout << fMatricesLabel << std::endl;
}
if(fMatrices.size() > 0) {
std::cout << "---------------------------" << std::endl;
std::cout << "Matrices:" << std::endl;
for(unsigned int i=0;i<fMatrices.size(); i++ ) fMatrices.at(i).Print();
}
std::cout << "===========================" << std::endl;
}