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 DAS {
6 
16 struct Weight {
17  double v = 1;
18  int i = 0;
19  operator double () const { return v; }
20  Weight& operator= (const double v) { this->v = v; return *this; }
21 };
22 
23 inline bool operator== (const Weight& w, const int v) { return w.v == v; }
24 inline bool operator== (const Weight& w, const float v) { return w.v == v; }
25 inline bool operator== (const Weight& w, const double v) { return w.v == v; }
26 inline bool operator== (const Weight& l, const Weight& r) { return l.v == r.v && l.i == r.i; }
27 inline double operator* (const Weight& w, const int v) { return w.v * v; }
28 inline double operator* (const int v, const Weight& w) { return w.v * v; }
29 inline double operator* (const Weight& w, const float v) { return w.v * v; }
30 inline double operator* (const float v, const Weight& w) { return w.v * v; }
31 inline double operator* (const Weight& w, const double v) { return w.v * v; }
32 inline double operator* (const double v, const Weight& w) { return w.v * v; }
33 inline Weight& operator*= (Weight& w, const int v) { w.v *= v; return w; }
34 inline Weight& operator/= (Weight& w, const int v) { w.v /= v; return w; }
35 inline Weight& operator*= (Weight& w, const float 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 double v) { w.v *= v; return w; }
38 inline Weight& operator/= (Weight& w, const double v) { w.v /= v; return w; }
39 inline double operator* (const Weight& w1, const Weight& w2) { return w1.v * w2.v; }
40 
41 typedef std::vector<Weight> Weights;
42 
43 inline Weights& operator*= (Weights& wgts, const int v) { for (auto& w: wgts) w *= v; return wgts; }
44 inline Weights& operator/= (Weights& wgts, const int v) { for (auto& w: wgts) w /= v; return wgts; }
45 inline Weights& operator*= (Weights& wgts, const float 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 double 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 
50 } // end of DAS namespace
51 
52 #ifdef __ROOTCLING__
53 #pragma link C++ class DAS::Weight +;
54 #endif // __ROOTCLING__
55 
DAS::operator*=
Weight & operator*=(Weight &w, const int v)
Definition: Weight.h:33
DAS::operator==
bool operator==(const PhysicsObject &l, const PhysicsObject &r)
Definition: PhysicsObject.h:72
DAS::Weights
std::vector< Weight > Weights
Definition: Weight.h:41
DAS
Definition: applyBTagSF.cc:31
DAS::Weight::operator=
Weight & operator=(const double v)
Definition: Weight.h:20
DAS::JetEnergy::w
static const float w
Definition: common.h:47
DAS::Weight::v
double v
value
Definition: Weight.h:17
DAS::operator*
double operator*(const Weight &w, const int v)
Definition: Weight.h:27
DAS::Weight::i
int i
correlation index
Definition: Weight.h:18
DAS::Weight
Definition: Weight.h:16
DAS::operator/=
Weight & operator/=(Weight &w, const int v)
Definition: Weight.h:34