Belle II Software development
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#pragma once
11
12#include <stdio.h>
13
14#include <framework/logging/Logger.h>
15
16
17namespace Belle2 {
22
23 namespace analysis {
24
28 class KFitError {
29 public:
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
KFitError is a container of error codes and a macro function.
Definition KFitError.h:28
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:71
ECode
ECode is a error code enumerate.
Definition KFitError.h:33
@ kCannotGetARCSIN
Cannot get arcsin (bad track property or internal error)
Definition KFitError.h:59
@ kUnimplemented
Unprepared.
Definition KFitError.h:43
@ kCannotGetMatrixInverse
Cannot calculate matrix inverse (bad track property or internal error)
Definition KFitError.h:57
@ kOutOfRange
Specified track-id out of range.
Definition KFitError.h:41
@ kNotFittedYet
Not fitted yet.
Definition KFitError.h:38
@ kDivisionByZero
Division by zero (bad track property or internal error)
Definition KFitError.h:55
@ kBadInitialCHIsq
Bad initial chi-square (internal error)
Definition KFitError.h:52
@ kBadTrackSize
Track count too small to perform fit.
Definition KFitError.h:46
@ kBadMatrixSize
Wrong correlation matrix size.
Definition KFitError.h:48
@ kBadCorrelationSize
Wrong correlation matrix size (internal error)
Definition KFitError.h:50
commonly used functions
Definition func.h:22
Abstract base class for different kinds of events.