Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Exception.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Exception.cc
1 /* Copyright 2008-2010, Technische Universitaet Muenchen,
2  Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
3 
4  This file is part of GENFIT.
5 
6  GENFIT is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  GENFIT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "Exception.h"
21 #include "IO.h"
22 
23 namespace genfit {
24 
25 bool Exception::quiet_ = false;
26 
28  excString_(excString), line_(line), file_(file), fatal_(false) {
29  std::ostringstream ErrMsgStream;
30  ErrMsgStream << "genfit::Exception thrown with excString:"
31  << std::endl << excString_ << std::endl
32  << "in line: " << line_ << " in file: " << file_ << std::endl
33  << "with fatal flag " << fatal_ << std::endl;
34  errorMessage_ = ErrMsgStream.str();
35 }
36 
38 }
39 
41  const std::vector<double>& _numbers) {
42  numbersLabel_ = _numbersLabel;
43  numbers_ = _numbers;
44 }
45 
46 void Exception::setMatrices(std::string _matricesLabel,
47  const std::vector<TMatrixD>& _matrices) {
48  matricesLabel_ = _matricesLabel;
49  matrices_ = _matrices;
50 }
51 
52 const char* Exception::what() const noexcept{
53  return errorMessage_.c_str();
54 }
55 
57  if(quiet_) return;
58  if(numbers_.empty() && matrices_.empty()) return; //do nothing
59  debugOut << "genfit::Exception Info Output" << std::endl;
60  debugOut << "===========================" << std::endl;
61  if(numbersLabel_ != "") {
62  debugOut << "Numbers Label String:" << std::endl;
63  debugOut << numbersLabel_ << std::endl;
64  }
65  if(!numbers_.empty()) {
66  debugOut << "---------------------------" << std::endl;
67  debugOut << "Numbers:" << std::endl;
68  for(unsigned int i=0;i<numbers_.size(); ++i ) debugOut << numbers_[i] << std::endl;
69  }
70  if(matricesLabel_ != "") {
71  debugOut << "---------------------------" << std::endl;
72  debugOut << "Matrices Label String:" << std::endl;
73  debugOut << matricesLabel_ << std::endl;
74  }
75  if(!matrices_.empty()) {
76  debugOut << "---------------------------" << std::endl;
77  debugOut << "Matrices:" << std::endl;
78  for(unsigned int i=0;i<matrices_.size(); ++i ) matrices_[i].Print();
79  }
80  debugOut << "===========================" << std::endl;
81 }
82 
83 } /* End of namespace genfit */
84