Belle II Software
release-05-02-19
WithWeight.h
1
/**************************************************************************
2
* BASF2 (Belle Analysis Framework 2) *
3
* Copyright(C) 2015 - Belle II Collaboration *
4
* *
5
* Author: The Belle II Collaboration *
6
* Contributors: Oliver Frost *
7
* *
8
* This software is provided "as is" without any warranty. *
9
**************************************************************************/
10
#pragma once
11
12
13
#include <tracking/trackFindingCDC/numerics/Weight.h>
14
15
#include <tracking/trackFindingCDC/utilities/Scalar.h>
16
17
namespace
Belle2
{
22
namespace
TrackFindingCDC {
23
25
template
<
class
T>
26
class
WithWeight :
public
ScalarToClass<T> {
27
28
private
:
30
using
Super
= ScalarToClass<T>;
31
32
public
:
34
using
Super::Super;
35
37
explicit
WithWeight
(
const
T& t)
38
:
Super
(t)
39
{
40
}
41
43
WithWeight
(
const
T& t, Weight
weight
)
44
:
Super
(t)
45
,
m_weight
(
weight
)
46
{
47
}
48
50
bool
operator<
(
const
WithWeight<T>
& other)
const
51
{
52
const
T& t(*
this
);
53
const
T& otherT(other);
54
return
t < otherT or (not(otherT < t) and
getWeight
() < other.getWeight());
55
}
56
58
Weight
getWeight
()
const
59
{
60
return
m_weight
;
61
}
62
64
void
setWeight
(Weight
weight
)
65
{
66
m_weight
=
weight
;
67
}
68
70
Weight&
weight
()
71
{
72
return
m_weight
;
73
}
74
75
private
:
77
Weight
m_weight
= 0;
78
};
79
}
81
}
Belle2::TrackFindingCDC::WithWeight::WithWeight
WithWeight(const T &t)
Also forward the copy constructor form the base class object.
Definition:
WithWeight.h:45
Belle2::TrackFindingCDC::WithWeight::weight
Weight & weight()
Mutable getter for the weight.
Definition:
WithWeight.h:78
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::WithWeight::setWeight
void setWeight(Weight weight)
Setter for the weight of the object.
Definition:
WithWeight.h:72
Belle2::TrackFindingCDC::WithWeight
A mixin class to attach a weight to an object.
Definition:
WithWeight.h:34
Belle2::TrackFindingCDC::WithWeight::getWeight
Weight getWeight() const
Getter for the weight.
Definition:
WithWeight.h:66
Belle2::TrackFindingCDC::WithWeight::Super
ScalarToClass< T > Super
Type of the base class.
Definition:
WithWeight.h:38
Belle2::TrackFindingCDC::WithWeight::m_weight
Weight m_weight
Memory for the weight.
Definition:
WithWeight.h:85
Belle2::TrackFindingCDC::WithWeight::operator<
bool operator<(const WithWeight< T > &other) const
Comparison operator establishing an ordering considering the pointer first and the weight second.
Definition:
WithWeight.h:58
tracking
trackFindingCDC
numerics
include
WithWeight.h
Generated on Tue Jan 4 2022 03:08:51 for Belle II Software by
1.8.17