Fork me on GitHub

source: git/external/fastjet/Error.cc@ 4b9a2dc

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 4b9a2dc was 35cdc46, checked in by Pavel Demin <demin@…>, 10 years ago

upgrade FastJet to version 3.1.0-beta.1, upgrade Nsubjettiness to version 2.1.0, add SoftKiller version 1.0.0

  • Property mode set to 100644
File size: 2.9 KB
Line 
1//FJSTARTHEADER
2// $Id: Error.cc 3433 2014-07-23 08:17:03Z salam $
3//
4// Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
5//
6//----------------------------------------------------------------------
7// This file is part of FastJet.
8//
9// FastJet is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; either version 2 of the License, or
12// (at your option) any later version.
13//
14// The algorithms that underlie FastJet have required considerable
15// development. They are described in the original FastJet paper,
16// hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
17// FastJet as part of work towards a scientific publication, please
18// quote the version you use and include a citation to the manual and
19// optionally also to hep-ph/0512210.
20//
21// FastJet is distributed in the hope that it will be useful,
22// but WITHOUT ANY WARRANTY; without even the implied warranty of
23// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24// GNU General Public License for more details.
25//
26// You should have received a copy of the GNU General Public License
27// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
28//----------------------------------------------------------------------
29//FJENDHEADER
30
31#include "fastjet/Error.hh"
32#include "fastjet/config.h"
33#include <sstream>
34
35// printing the stack would need execinfo
36#ifdef FASTJET_HAVE_EXECINFO_H
37#include <execinfo.h>
38#include <cstdlib>
39#endif
40
41FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
42
43using namespace std;
44
45bool Error::_print_errors = true;
46bool Error::_print_backtrace = false;
47ostream * Error::_default_ostr = & cerr;
48
49Error::Error(const std::string & message_in) {
50 _message = message_in;
51 if (_print_errors && _default_ostr){
52 ostringstream oss;
53 oss << "fastjet::Error: "<< message_in << endl;
54
55 // only print the stack if execinfo is available and stack enabled
56#ifdef FASTJET_HAVE_EXECINFO_H
57 if (_print_backtrace){
58 void * array[10];
59 char ** messages;
60
61 int size = backtrace(array, 10);
62 messages = backtrace_symbols(array, size);
63
64 oss << "stack:" << endl;
65 for (int i = 1; i < size && messages != NULL; ++i){
66 oss << " #" << i << ": " << messages[i] << endl;
67 }
68 free(messages);
69 }
70#endif
71
72 *_default_ostr << oss.str();
73 // get something written to file even
74 // if the program aborts
75 _default_ostr->flush();
76
77 // // output error message either to cerr or to the user-set stream
78 // if (_default_ostr) { *_default_ostr << oss.str();
79 // // get something written to file even
80 // // if the program aborts
81 // _default_ostr->flush(); }
82 // else { std::cerr << oss.str(); }
83
84 }
85}
86
87FASTJET_END_NAMESPACE
88
Note: See TracBrowser for help on using the repository browser.