Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:21

0001 /* Copyright 2008-2010, Technische Universitaet Muenchen,
0002    Authors: Christian Hoeppner & Sebastian Neubert & Johannes Rauch
0003 
0004    This file is part of GENFIT.
0005 
0006    GENFIT is free software: you can redistribute it and/or modify
0007    it under the terms of the GNU Lesser General Public License as published
0008    by the Free Software Foundation, either version 3 of the License, or
0009    (at your option) any later version.
0010 
0011    GENFIT is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014    GNU Lesser General Public License for more details.
0015 
0016    You should have received a copy of the GNU Lesser General Public License
0017    along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 #include "Exception.h"
0021 #include "IO.h"
0022 
0023 namespace genfit {
0024 
0025 bool Exception::quiet_ = false;
0026 
0027 Exception::Exception(std::string excString, int line, std::string  file) :
0028     excString_(excString), line_(line), file_(file), fatal_(false) {
0029   std::ostringstream ErrMsgStream;
0030   ErrMsgStream << "genfit::Exception thrown with excString:"
0031          << std::endl << excString_ << std::endl
0032          << "in line: " << line_ << " in file: " << file_ << std::endl
0033          << "with fatal flag " << fatal_ << std::endl;
0034   errorMessage_ = ErrMsgStream.str();
0035 }
0036 
0037 Exception::~Exception() noexcept {
0038 }
0039 
0040 void Exception::setNumbers(std::string _numbersLabel,
0041          const std::vector<double>& _numbers) {
0042   numbersLabel_ = _numbersLabel;
0043   numbers_ = _numbers;
0044 }
0045 
0046 void Exception::setMatrices(std::string _matricesLabel,
0047           const std::vector<TMatrixD>& _matrices) {
0048   matricesLabel_ = _matricesLabel;
0049   matrices_ = _matrices;
0050 }
0051 
0052 const char* Exception::what() const noexcept{
0053   return errorMessage_.c_str();
0054 }
0055 
0056 void Exception::info() {
0057   if(quiet_) return;
0058   if(numbers_.empty() && matrices_.empty()) return; //do nothing
0059   debugOut << "genfit::Exception Info Output" << std::endl;
0060   debugOut << "===========================" << std::endl;
0061   if(numbersLabel_ != "") {
0062   debugOut << "Numbers Label String:" << std::endl;
0063   debugOut << numbersLabel_ << std::endl;
0064   }
0065   if(!numbers_.empty()) {
0066   debugOut << "---------------------------" << std::endl;
0067   debugOut << "Numbers:" << std::endl;
0068   for(unsigned int i=0;i<numbers_.size(); ++i ) debugOut << numbers_[i] << std::endl;
0069   }
0070   if(matricesLabel_ != "") {
0071   debugOut << "---------------------------" << std::endl;
0072   debugOut << "Matrices Label String:" << std::endl;
0073   debugOut << matricesLabel_ << std::endl;
0074   }
0075   if(!matrices_.empty()) {
0076   debugOut << "---------------------------" << std::endl;
0077   debugOut << "Matrices:" << std::endl;
0078   for(unsigned int i=0;i<matrices_.size(); ++i ) matrices_[i].Print();
0079   }
0080   debugOut << "===========================" << std::endl;
0081 }
0082 
0083 } /* End of namespace genfit */
0084