Belle II Software  release-05-02-19
KFitError.h
1 /**************************************************************************
2  * Copyright(C) 1997 - J. Tanaka and the Belle II collaboration *
3  * *
4  * Author: J. Tanaka and the Belle II collaboration *
5  * Contributor: J. Tanaka and *
6  * conversion to Belle II structure by T. Higuchi *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 
12 #pragma once
13 
14 #include <stdio.h>
15 
16 #include <framework/logging/Logger.h>
17 
18 
19 namespace Belle2 {
25  namespace analysis {
26 
30  class KFitError {
31  public:
35  enum ECode {
37  kNoError = 0,
38 
40  kNotFittedYet = 1,
41 
44 
46  kBadTrackSize = 21,
52  kBadInitialCHIsq = 24,
53 
55  kDivisionByZero = 31,
59  kCannotGetARCSIN = 33,
60  };
61 
62 
63  public:
71  static void displayError(const char* file, const int line, const char* func, const enum ECode code)
72  {
73  const char* str_error =
74  code == kNoError ? "No error" :
75  code == kNotFittedYet ? "Not fitted yet" :
76  code == kOutOfRange ? "Out of range" :
77  code == kBadTrackSize ? "Bad track count" :
78  code == kBadMatrixSize ? "Bad matrix size" :
79  code == kBadCorrelationSize ? "Bad correlation size" :
80  code == kBadInitialCHIsq ? "Bad initial chisq" :
81  code == kDivisionByZero ? "Division by zero" :
82  code == kCannotGetMatrixInverse ? "Cannot calculate matrix inverse" :
83  code == kCannotGetARCSIN ? "Cannot calculate arcsin" :
84  "Unknown error";
85 
86  char buf[1024];
87  sprintf(buf, "%s:%d:%s(): %s", file, line, func, str_error);
88  B2WARNING(buf);
89  }
90  };
91 
92  } // namespace analysis
93 
95 } // namespace Belle2
96 
97 
Belle2::analysis::KFitError::kCannotGetARCSIN
@ kCannotGetARCSIN
Cannot get arcsin (bad track property or internal error)
Definition: KFitError.h:67
Belle2::analysis::KFitError::kBadInitialCHIsq
@ kBadInitialCHIsq
Bad initial chi-square (internal error)
Definition: KFitError.h:60
Belle2::analysis::KFitError::kNotFittedYet
@ kNotFittedYet
Not fitted yet.
Definition: KFitError.h:48
Belle2::analysis::KFitError::displayError
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:79
Belle2::analysis::KFitError::kBadCorrelationSize
@ kBadCorrelationSize
Wrong correlation matrix size (internal error)
Definition: KFitError.h:58
Belle2::analysis::KFitError::kNoError
@ kNoError
No error.
Definition: KFitError.h:45
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::analysis::KFitError::kDivisionByZero
@ kDivisionByZero
Division by zero (bad track property or internal error)
Definition: KFitError.h:63
Belle2::analysis::KFitError::kCannotGetMatrixInverse
@ kCannotGetMatrixInverse
Cannot calculate matrix inverse (bad track property or internal error)
Definition: KFitError.h:65
Belle2::analysis::KFitError::ECode
ECode
ECode is a error code enumerate.
Definition: KFitError.h:43
Belle2::analysis::KFitError::kOutOfRange
@ kOutOfRange
Specified track-id out of range.
Definition: KFitError.h:51
Belle2::analysis::KFitError::kBadTrackSize
@ kBadTrackSize
Track count too small to perform fit.
Definition: KFitError.h:54
Belle2::analysis::KFitError::kBadMatrixSize
@ kBadMatrixSize
Wrong correlation matrix size.
Definition: KFitError.h:56