DAS
3.0
Das Analysis System
Weight.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <vector>
4
5
namespace
Darwin::Physics
{
6
17
struct
Weight
{
18
double
v
= 1;
19
int
i
= 0;
20
operator
double ()
const
{
return
v
; }
21
Weight
&
operator=
(
const
double
v
) { this->v =
v
;
return
*
this
; }
22
};
23
24
inline
bool
operator==
(
const
Weight
&
w
,
const
int
v) {
return
w
.v == v; }
25
inline
bool
operator==
(
const
Weight
&
w
,
const
float
v) {
return
w
.v == v; }
26
inline
bool
operator==
(
const
Weight
&
w
,
const
double
v) {
return
w
.v == v; }
27
inline
bool
operator==
(
const
Weight
& l,
const
Weight
& r) {
return
l.
v
== r.
v
&& l.
i
== r.
i
; }
28
inline
double
operator*
(
const
Weight
&
w
,
const
int
v) {
return
w
.v * v; }
29
inline
double
operator*
(
const
int
v,
const
Weight
&
w
) {
return
w
.v * v; }
30
inline
double
operator*
(
const
Weight
&
w
,
const
float
v) {
return
w
.v * v; }
31
inline
double
operator*
(
const
float
v,
const
Weight
&
w
) {
return
w
.v * v; }
32
inline
double
operator*
(
const
Weight
&
w
,
const
double
v) {
return
w
.v * v; }
33
inline
double
operator*
(
const
double
v,
const
Weight
&
w
) {
return
w
.v * v; }
34
inline
Weight
&
operator*=
(
Weight
&
w
,
const
int
v) {
w
.v *= v;
return
w
; }
35
inline
Weight
&
operator/=
(
Weight
&
w
,
const
int
v) {
w
.v /= v;
return
w
; }
36
inline
Weight
&
operator*=
(
Weight
&
w
,
const
float
v) {
w
.v *= v;
return
w
; }
37
inline
Weight
&
operator/=
(
Weight
&
w
,
const
float
v) {
w
.v /= v;
return
w
; }
38
inline
Weight
&
operator*=
(
Weight
&
w
,
const
double
v) {
w
.v *= v;
return
w
; }
39
inline
Weight
&
operator/=
(
Weight
&
w
,
const
double
v) {
w
.v /= v;
return
w
; }
40
inline
double
operator*
(
const
Weight
& w1,
const
Weight
& w2) {
return
w1.
v
* w2.
v
; }
41
42
using
Weights
= std::vector<Weight>;
43
44
inline
Weights
&
operator*=
(
Weights
& wgts,
const
int
v) {
for
(
auto
&
w
: wgts)
w
*= v;
return
wgts; }
45
inline
Weights
&
operator/=
(
Weights
& wgts,
const
int
v) {
for
(
auto
&
w
: wgts)
w
/= v;
return
wgts; }
46
inline
Weights
&
operator*=
(
Weights
& wgts,
const
float
v) {
for
(
auto
&
w
: wgts)
w
*= v;
return
wgts; }
47
inline
Weights
&
operator/=
(
Weights
& wgts,
const
float
v) {
for
(
auto
&
w
: wgts)
w
/= v;
return
wgts; }
48
inline
Weights
&
operator*=
(
Weights
& wgts,
const
double
v) {
for
(
auto
&
w
: wgts)
w
*= v;
return
wgts; }
49
inline
Weights
&
operator/=
(
Weights
& wgts,
const
double
v) {
for
(
auto
&
w
: wgts)
w
/= v;
return
wgts; }
50
inline
bool
operator==
(
const
Weights
& w1,
const
Weights
& w2)
51
{
52
if
(w1.size() != w2.size())
return
false
;
53
for
(std::size_t i = 0; i < w1.size(); ++i)
54
if
(w1.at(i) != w2.at(i))
return
false
;
55
return
true
;
56
}
57
58
}
// end of Darwin::Physics namespace
Darwin::Physics::Weight
Definition:
Weight.h:17
Darwin::Physics::Weight::i
int i
correlation index
Definition:
Weight.h:19
Darwin::Physics::operator/=
Weight & operator/=(Weight &w, const int v)
Definition:
Weight.h:35
Darwin::Physics::Weight::operator=
Weight & operator=(const double v)
Definition:
Weight.h:21
DAS::JetEnergy::w
static const float w
Definition:
common.h:51
Darwin::Physics::Weights
std::vector< Weight > Weights
Definition:
Weight.h:42
Darwin::Physics::operator*
double operator*(const Weight &w, const int v)
Definition:
Weight.h:28
Darwin::Physics::Weight::v
double v
value
Definition:
Weight.h:18
Darwin::Physics::operator==
bool operator==(const GenericObject &l, const GenericObject &r)
Definition:
GenericObject.h:78
Darwin::Physics
Everything what concerns physics analysis directly.
Definition:
darwin.h:24
Darwin::Physics::operator*=
Weight & operator*=(Weight &w, const int v)
Definition:
Weight.h:34
Darwin
interface
Weight.h
Generated on Fri Dec 20 2024 19:01:46 for DAS by
1.8.18