Belle II Software light-2406-ragdoll
BaseConstraint.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * Forked from https://github.com/iLCSoft/MarlinKinfit *
6 * *
7 * Further information about the fit engine and the user interface *
8 * provided in MarlinKinfit can be found at *
9 * https://www.desy.de/~blist/kinfit/doc/html/ *
10 * and in the LCNotes LC-TOOL-2009-001 and LC-TOOL-2009-004 available *
11 * from http://www-flc.desy.de/lcnotes/ *
12 * *
13 * See git log for contributors and copyright holders. *
14 * This file is licensed under LGPL-3.0, see LICENSE.md. *
15 **************************************************************************/
16
17#include "analysis/OrcaKinFit/BaseConstraint.h"
18
19#include <cassert>
20#include <cstring>
21#include <iostream>
22
23namespace Belle2 {
28 namespace OrcaKinFit {
29
31 : name(nullptr)
32 {
33 setName("???");
34 }
35
37 : name(nullptr)
38 {
39 if (rhs.name) setName(rhs.name);
40 else setName("???");
41 }
43 {
44 if (this != &rhs) {
45 if (rhs.name) setName(rhs.name);
46 else setName("???");
47 }
48 return *this;
49 }
50
52 {
53 delete[] name;
54 }
55
56 const char* BaseConstraint::getName() const
57 {
58 return name;
59 }
60
61 void BaseConstraint::setName(const char* name_)
62 {
63 if (name_ == nullptr) return;
64 size_t l = strlen(name_);
65 if (name) delete[] name;
66 name = new char[l + 1];
67 strcpy(name, name_);
68 }
69
71 {
72 assert(false);
73 return 0;
74 }
75
76 std::ostream& BaseConstraint::print(std::ostream& os) const
77 {
78 os << getName() << "=" << getValue();
79 return os;
80 }
81
82 }// end OrcaKinFit namespace
84} // end Belle2 namespace
Abstract base class for constraints of kinematic fits.
virtual double getValue() const =0
Returns the value of the constraint function.
BaseConstraint & operator=(const BaseConstraint &rhs)
Assignment.
virtual ~BaseConstraint()
Virtual destructor.
void setName(const char *name_)
Set object's name.
virtual const char * getName() const
Returns the name of the constraint.
virtual double getError() const
Returns the error on the value of the constraint.
BaseConstraint()
Creates an empty BaseConstraint object.
virtual std::ostream & print(std::ostream &os) const
print object to ostream
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24