Belle II Software  release-05-02-19
ErrCode.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributor: Wouter Hulsbergen, Francesco Tenchini, Jo-Frederik Krohn *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 namespace TreeFitter {
13 
15  class ErrCode {
16  public:
18  enum Status {success = 0,
19  pocafailure = 1,
20  baddistance = 2,
21  inversionerror = 4,
22  badsetup = 8,
23  divergingconstraint = 16,
24  slowdivergingfit = 32,
25  fastdivergingfit = 64,
26  filtererror = 128,
27  photondimerror = 256,
28  klongdimerror = 512
29  } ;
30 
32  ErrCode() : m_flag(success) {}
33 
35  explicit ErrCode(Status flag) : m_flag(flag) {}
36 
38  const ErrCode& operator|=(const ErrCode& rhs)
39  {
40  m_flag |= rhs.m_flag ; return *this ;
41  }
42 
44  bool operator==(const ErrCode& rhs) const
45  {
46  return m_flag == rhs.m_flag ;
47  }
48 
50  bool operator==(const ErrCode::Status& rhs) const
51  {
52  return *this == ErrCode(rhs) ;
53  }
54 
56  void reset() { m_flag = success ; }
57 
59  bool failure() const { return m_flag != success ; }
60 
62  unsigned int flag() const { return m_flag ; }
63  private:
64 
66  unsigned int m_flag ;
67 
68  } ;
69 }
TreeFitter::ErrCode::flag
unsigned int flag() const
get errorcode
Definition: ErrCode.h:78
TreeFitter::ErrCode::operator==
bool operator==(const ErrCode &rhs) const
operator
Definition: ErrCode.h:60
TreeFitter::ErrCode::ErrCode
ErrCode()
default constructor
Definition: ErrCode.h:48
TreeFitter::ErrCode::m_flag
unsigned int m_flag
storing the errorcode
Definition: ErrCode.h:82
TreeFitter::ErrCode::reset
void reset()
reset the errorcode to default (success!)
Definition: ErrCode.h:72
TreeFitter::ErrCode::Status
Status
some enums to store errors
Definition: ErrCode.h:34
TreeFitter::ErrCode::failure
bool failure() const
returns true if errorcode is error
Definition: ErrCode.h:75
TreeFitter::ErrCode::operator|=
const ErrCode & operator|=(const ErrCode &rhs)
operator
Definition: ErrCode.h:54