Belle II Software  release-08-01-10
KFitError.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * External Contributor: J. Tanaka *
5  * *
6  * See git log for contributors and copyright holders. *
7  * This file is licensed under LGPL-3.0, see LICENSE.md. *
8  **************************************************************************/
9 
10 
11 #pragma once
12 
13 #include <stdio.h>
14 
15 #include <framework/logging/Logger.h>
16 
17 
18 namespace Belle2 {
24  namespace analysis {
25 
29  class KFitError {
30  public:
34  enum ECode {
36  kNoError = 0,
37 
40 
45 
54 
61  };
62 
63 
64  public:
72  static void displayError(const char* file, const int line, const char* func, const enum ECode code)
73  {
74  const char* str_error =
75  code == kNoError ? "No error" :
76  code == kNotFittedYet ? "Not fitted yet" :
77  code == kOutOfRange ? "Out of range" :
78  code == kBadTrackSize ? "Bad track count" :
79  code == kBadMatrixSize ? "Bad matrix size" :
80  code == kBadCorrelationSize ? "Bad correlation size" :
81  code == kBadInitialCHIsq ? "Bad initial chisq" :
82  code == kDivisionByZero ? "Division by zero" :
83  code == kCannotGetMatrixInverse ? "Cannot calculate matrix inverse" :
84  code == kCannotGetARCSIN ? "Cannot calculate arcsin" :
85  "Unknown error";
86 
87  char buf[1024];
88  sprintf(buf, "%s:%d:%s(): %s", file, line, func, str_error);
89  B2WARNING(buf);
90  }
91  };
92 
93  } // namespace analysis
94 
96 } // namespace Belle2
97 
98 
KFitError is a container of error codes and a macro function.
Definition: KFitError.h:29
static void displayError(const char *file, const int line, const char *func, const enum ECode code)
Display a description of error and its location.
Definition: KFitError.h:72
ECode
ECode is a error code enumerate.
Definition: KFitError.h:34
@ kCannotGetARCSIN
Cannot get arcsin (bad track property or internal error)
Definition: KFitError.h:60
@ kUnimplemented
Unprepared.
Definition: KFitError.h:44
@ kCannotGetMatrixInverse
Cannot calculate matrix inverse (bad track property or internal error)
Definition: KFitError.h:58
@ kOutOfRange
Specified track-id out of range.
Definition: KFitError.h:42
@ kNotFittedYet
Not fitted yet.
Definition: KFitError.h:39
@ kDivisionByZero
Division by zero (bad track property or internal error)
Definition: KFitError.h:56
@ kBadInitialCHIsq
Bad initial chi-square (internal error)
Definition: KFitError.h:53
@ kBadTrackSize
Track count too small to perform fit.
Definition: KFitError.h:47
@ kBadMatrixSize
Wrong correlation matrix size.
Definition: KFitError.h:49
@ kBadCorrelationSize
Wrong correlation matrix size (internal error)
Definition: KFitError.h:51
Abstract base class for different kinds of events.