ATLAS Offline Software
Loading...
Searching...
No Matches
APEvtWeight.cxx File Reference
#include "ReweightUtils/APEvtWeight.h"
#include "ReweightUtils/APWeightEntry.h"
#include <cmath>
#include <iostream>
Include dependency graph for APEvtWeight.cxx:

Go to the source code of this file.

Macros

#define APEvtWeight_cxx

Functions

const APEvtWeight operator&& (const APEvtWeight &a_in, const APEvtWeight &b_in)
const APEvtWeight operator|| (const APEvtWeight &a_in, const APEvtWeight &b_in)
const APEvtWeight operator! (const APEvtWeight &a_in)

Macro Definition Documentation

◆ APEvtWeight_cxx

#define APEvtWeight_cxx

Definition at line 5 of file APEvtWeight.cxx.

Function Documentation

◆ operator!()

const APEvtWeight operator! ( const APEvtWeight & a_in)

Definition at line 212 of file APEvtWeight.cxx.

212 {
213
214 APEvtWeight a = a_in;
215 APEvtWeight ret = a;
216 if(!a.m_isComputed && a.GetType() <= APEvtWeight::kDiJet ) a.Compute();
217 if(ret.GetType() <= APEvtWeight::kDiJet) ret.Compute();
218 ret.m_k_evt_weight = 1.0 - a.m_k_evt_weight;
219 return ret;
220
221}
Class to calculate the sum of weights ("weighted counter")
Definition APEvtWeight.h:26
ObjType GetType()
Returns the type of the event weight (muon, electron, jet, ANDed, ORed).
double m_k_evt_weight
Holds the event weight.
Definition APEvtWeight.h:55

◆ operator&&()

const APEvtWeight operator&& ( const APEvtWeight & a_in,
const APEvtWeight & b_in )

Definition at line 42 of file APEvtWeight.cxx.

42 {
43 APEvtWeight a = a_in;
44 APEvtWeight b = b_in;
45 APEvtWeight::ObjType a_type = a.GetType();
46 APEvtWeight::ObjType b_type = b.GetType();
47
48 if ( (a_type >= APEvtWeight::kDiMuon && a_type <= APEvtWeight::kDiJet) || (b_type >= APEvtWeight::kDiMuon && b_type <= APEvtWeight::kDiJet) ) cout << "WARNING in APEvtWeight::operator&&: Trying to logically AND diobject weights. You shouldn't do this. Uncertainties will be incorrect." << endl;
49 if ( ((a_type >= APEvtWeight::kMuon && a_type <= APEvtWeight::kJet) || (b_type >= APEvtWeight::kMuon && b_type <= APEvtWeight::kJet)) && (a_type != b_type) ) cout << "WARNING in APEvtWeight::operator&&: Trying to logically AND weights for single component triggers in multiobject configuration. You shouldn't do this, but use kXxxMO types instead. Uncertainties will be incorrect." << endl;
50
51 if ( a_type != b_type ) {
53 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuon].push_back(a.m_current_evt_weights[APEvtWeight::kMuon][i]);
54 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuon].push_back(b.m_current_evt_weights[APEvtWeight::kMuon][i]);
55 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTau].push_back(a.m_current_evt_weights[APEvtWeight::kTau][i]);
56 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTau].push_back(b.m_current_evt_weights[APEvtWeight::kTau][i]);
57 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectron].push_back(a.m_current_evt_weights[APEvtWeight::kElectron][i]);
58 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectron].push_back(b.m_current_evt_weights[APEvtWeight::kElectron][i]);
59 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJet].push_back(a.m_current_evt_weights[APEvtWeight::kJet][i]);
60 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJet].push_back(b.m_current_evt_weights[APEvtWeight::kJet][i]);
61 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kMuonMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuonMO].push_back(a.m_current_evt_weights[APEvtWeight::kMuonMO][i]);
62 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kMuonMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuonMO].push_back(b.m_current_evt_weights[APEvtWeight::kMuonMO][i]);
63 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kTauMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTauMO].push_back(a.m_current_evt_weights[APEvtWeight::kTauMO][i]);
64 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kTauMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTauMO].push_back(b.m_current_evt_weights[APEvtWeight::kTauMO][i]);
65 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kElectronMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectronMO].push_back(a.m_current_evt_weights[APEvtWeight::kElectronMO][i]);
66 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kElectronMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectronMO].push_back(b.m_current_evt_weights[APEvtWeight::kElectronMO][i]);
67 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kJetMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJetMO].push_back(a.m_current_evt_weights[APEvtWeight::kJetMO][i]);
68 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kJetMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJetMO].push_back(b.m_current_evt_weights[APEvtWeight::kJetMO][i]);
69 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiMuon].push_back(a.m_current_evt_weights[APEvtWeight::kDiMuon][i]);
70 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiMuon].push_back(b.m_current_evt_weights[APEvtWeight::kDiMuon][i]);
71 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiTau].push_back(a.m_current_evt_weights[APEvtWeight::kDiTau][i]);
72 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiTau].push_back(b.m_current_evt_weights[APEvtWeight::kDiTau][i]);
73 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiElectron].push_back(a.m_current_evt_weights[APEvtWeight::kDiElectron][i]);
74 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiElectron].push_back(b.m_current_evt_weights[APEvtWeight::kDiElectron][i]);
75 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiJet].push_back(a.m_current_evt_weights[APEvtWeight::kDiJet][i]);
76 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiJet].push_back(b.m_current_evt_weights[APEvtWeight::kDiJet][i]);
77
78 if (!b.m_isComputed) b.Compute();
79 if (!a.m_isComputed) a.Compute();
80 ret.m_n_entries = a.m_n_entries + b.m_n_entries;
81 ret.m_k_evt_weight = a.m_k_evt_weight * b.m_k_evt_weight;
82 ret.m_variance = a.m_variance * b.m_k_evt_weight * b.m_k_evt_weight + b.m_variance * a.m_k_evt_weight * a.m_k_evt_weight;
83 ret.m_variance_sys = a.m_variance_sys * b.m_k_evt_weight * b.m_k_evt_weight + b.m_variance_sys * a.m_k_evt_weight * a.m_k_evt_weight;
84 return ret;
85
86 }
87 else {
89 if (a_type > APEvtWeight::kJetMO || b_type > APEvtWeight::kJetMO) {
90 if ((a.m_current_evt_weights[APEvtWeight::kMuon].size() > 0 && b.m_current_evt_weights[APEvtWeight::kMuon].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kTau].size() > 0 && b.m_current_evt_weights[APEvtWeight::kTau].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kElectron].size() > 0 && b.m_current_evt_weights[APEvtWeight::kElectron].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kJet].size() > 0 && b.m_current_evt_weights[APEvtWeight::kJet].size() > 0) ||(a.m_current_evt_weights[APEvtWeight::kMuonMO].size() > 0 && b.m_current_evt_weights[APEvtWeight::kMuonMO].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kTauMO].size() > 0 && b.m_current_evt_weights[APEvtWeight::kTauMO].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kElectronMO].size() > 0 && b.m_current_evt_weights[APEvtWeight::kElectronMO].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kJetMO].size() > 0 && b.m_current_evt_weights[APEvtWeight::kJetMO].size() > 0) )
91 cout << "WARNING in APEvtWeight::operator&&: Trying to combine already combined event weights with overlapping objects. Uncertainties will be incorrect." << endl;
92 }
93 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuon].push_back(a.m_current_evt_weights[APEvtWeight::kMuon][i]);
94 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuon].push_back(b.m_current_evt_weights[APEvtWeight::kMuon][i]);
95 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTau].push_back(a.m_current_evt_weights[APEvtWeight::kTau][i]);
96 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTau].push_back(b.m_current_evt_weights[APEvtWeight::kTau][i]);
97 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectron].push_back(a.m_current_evt_weights[APEvtWeight::kElectron][i]);
98 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectron].push_back(b.m_current_evt_weights[APEvtWeight::kElectron][i]);
99 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJet].push_back(a.m_current_evt_weights[APEvtWeight::kJet][i]);
100 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJet].push_back(b.m_current_evt_weights[APEvtWeight::kJet][i]);
101 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kMuonMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuonMO].push_back(a.m_current_evt_weights[APEvtWeight::kMuonMO][i]);
102 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kMuonMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuonMO].push_back(b.m_current_evt_weights[APEvtWeight::kMuonMO][i]);
103 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kTauMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTauMO].push_back(a.m_current_evt_weights[APEvtWeight::kTauMO][i]);
104 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kTauMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTauMO].push_back(b.m_current_evt_weights[APEvtWeight::kTauMO][i]);
105 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kElectronMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectronMO].push_back(a.m_current_evt_weights[APEvtWeight::kElectronMO][i]);
106 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kElectronMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectronMO].push_back(b.m_current_evt_weights[APEvtWeight::kElectronMO][i]);
107 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kJetMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJetMO].push_back(a.m_current_evt_weights[APEvtWeight::kJetMO][i]);
108 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kJetMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJetMO].push_back(b.m_current_evt_weights[APEvtWeight::kJetMO][i]);
109 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiMuon].push_back(a.m_current_evt_weights[APEvtWeight::kDiMuon][i]);
110 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiMuon].push_back(b.m_current_evt_weights[APEvtWeight::kDiMuon][i]);
111 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiTau].push_back(a.m_current_evt_weights[APEvtWeight::kDiTau][i]);
112 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiTau].push_back(b.m_current_evt_weights[APEvtWeight::kDiTau][i]);
113 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiElectron].push_back(a.m_current_evt_weights[APEvtWeight::kDiElectron][i]);
114 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiElectron].push_back(b.m_current_evt_weights[APEvtWeight::kDiElectron][i]);
115 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiJet].push_back(a.m_current_evt_weights[APEvtWeight::kDiJet][i]);
116 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiJet].push_back(b.m_current_evt_weights[APEvtWeight::kDiJet][i]);
117
118 if (!b.m_isComputed) b.Compute();
119 if (!a.m_isComputed) a.Compute();
120 ret.m_n_entries = a.m_n_entries + b.m_n_entries;
121 ret.m_k_evt_weight = a.m_k_evt_weight * b.m_k_evt_weight;
122 ret.m_variance = a.m_variance * b.m_k_evt_weight * b.m_k_evt_weight + b.m_variance * a.m_k_evt_weight * a.m_k_evt_weight;
123 ret.m_variance_sys = a.m_variance_sys * b.m_k_evt_weight * b.m_k_evt_weight + b.m_variance_sys * a.m_k_evt_weight * a.m_k_evt_weight;
124 return ret;
125 }
126}
#define I(x, y, z)
Definition MD5.cxx:116

◆ operator||()

const APEvtWeight operator|| ( const APEvtWeight & a_in,
const APEvtWeight & b_in )

Definition at line 128 of file APEvtWeight.cxx.

128 {
129 APEvtWeight a = a_in;
130 APEvtWeight b = b_in;
131 APEvtWeight::ObjType a_type = a.GetType();
132 APEvtWeight::ObjType b_type = b.GetType();
133
134 if ( (a_type != b_type) || (a_type == APEvtWeight::kElectron && b_type == APEvtWeight::kDiElectron ) || (a_type == APEvtWeight::kDiElectron && b_type == APEvtWeight::kElectron ) || (a_type == APEvtWeight::kMuon && b_type == APEvtWeight::kDiMuon ) || (a_type == APEvtWeight::kDiMuon && b_type == APEvtWeight::kMuon ) || (a_type == APEvtWeight::kTau && b_type == APEvtWeight::kDiTau ) || ( a_type == APEvtWeight::kDiTau && b_type == APEvtWeight::kTau ) || (a_type == APEvtWeight::kJet && b_type == APEvtWeight::kDiJet ) || (a_type == APEvtWeight::kDiJet && b_type == APEvtWeight::kJet ) ) { // for what reason were all the extra conditions included?!
136 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuon].push_back(a.m_current_evt_weights[APEvtWeight::kMuon][i]);
137 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuon].push_back(b.m_current_evt_weights[APEvtWeight::kMuon][i]);
138 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTau].push_back(a.m_current_evt_weights[APEvtWeight::kTau][i]);
139 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTau].push_back(b.m_current_evt_weights[APEvtWeight::kTau][i]);
140 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectron].push_back(a.m_current_evt_weights[APEvtWeight::kElectron][i]);
141 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectron].push_back(b.m_current_evt_weights[APEvtWeight::kElectron][i]);
142 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJet].push_back(a.m_current_evt_weights[APEvtWeight::kJet][i]);
143 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJet].push_back(b.m_current_evt_weights[APEvtWeight::kJet][i]);
144 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kMuonMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuonMO].push_back(a.m_current_evt_weights[APEvtWeight::kMuonMO][i]);
145 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kMuonMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuonMO].push_back(b.m_current_evt_weights[APEvtWeight::kMuonMO][i]);
146 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kTauMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTauMO].push_back(a.m_current_evt_weights[APEvtWeight::kTauMO][i]);
147 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kTauMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTauMO].push_back(b.m_current_evt_weights[APEvtWeight::kTauMO][i]);
148 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kElectronMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectronMO].push_back(a.m_current_evt_weights[APEvtWeight::kElectronMO][i]);
149 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kElectronMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectronMO].push_back(b.m_current_evt_weights[APEvtWeight::kElectronMO][i]);
150 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kJetMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJetMO].push_back(a.m_current_evt_weights[APEvtWeight::kJetMO][i]);
151 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kJetMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJetMO].push_back(b.m_current_evt_weights[APEvtWeight::kJetMO][i]);
152 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiMuon].push_back(a.m_current_evt_weights[APEvtWeight::kDiMuon][i]);
153 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiMuon].push_back(b.m_current_evt_weights[APEvtWeight::kDiMuon][i]);
154 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiTau].push_back(a.m_current_evt_weights[APEvtWeight::kDiTau][i]);
155 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiTau].push_back(b.m_current_evt_weights[APEvtWeight::kDiTau][i]);
156 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiElectron].push_back(a.m_current_evt_weights[APEvtWeight::kDiElectron][i]);
157 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiElectron].push_back(b.m_current_evt_weights[APEvtWeight::kDiElectron][i]);
158 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiJet].push_back(a.m_current_evt_weights[APEvtWeight::kDiJet][i]);
159 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiJet].push_back(b.m_current_evt_weights[APEvtWeight::kDiJet][i]);
160
161 if (!b.m_isComputed) b.Compute();
162 if (!a.m_isComputed) a.Compute();
163
164 ret.m_n_entries = a.m_n_entries + b.m_n_entries;
165 ret.m_k_evt_weight = a.m_k_evt_weight + b.m_k_evt_weight * ( 1.0 - a.m_k_evt_weight );
166 ret.m_variance = a.m_variance * ( 1.0 - b.m_k_evt_weight ) * ( 1.0 - b.m_k_evt_weight ) + b.m_variance * ( 1.0 - a.m_k_evt_weight ) * ( 1.0 - a.m_k_evt_weight );
167 ret.m_variance_sys = a.m_variance_sys * ( 1.0 - b.m_k_evt_weight ) * ( 1.0 - b.m_k_evt_weight ) + b.m_variance_sys * ( 1.0 - a.m_k_evt_weight ) * ( 1.0 - a.m_k_evt_weight );
168 return ret;
169 }
170 else if (a_type > APEvtWeight::kJetMO || b_type > APEvtWeight::kJetMO) {
171 if ((a.m_current_evt_weights[APEvtWeight::kMuon].size() > 0 && b.m_current_evt_weights[APEvtWeight::kMuon].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kTau].size() > 0 && b.m_current_evt_weights[APEvtWeight::kTau].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kElectron].size() > 0 && b.m_current_evt_weights[APEvtWeight::kElectron].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kJet].size() > 0 && b.m_current_evt_weights[APEvtWeight::kJet].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kMuonMO].size() > 0 && b.m_current_evt_weights[APEvtWeight::kMuonMO].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kTauMO].size() > 0 && b.m_current_evt_weights[APEvtWeight::kTauMO].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kElectronMO].size() > 0 && b.m_current_evt_weights[APEvtWeight::kElectronMO].size() > 0) || (a.m_current_evt_weights[APEvtWeight::kJetMO].size() > 0 && b.m_current_evt_weights[APEvtWeight::kJetMO].size() > 0) )
172 cout << "WARNING in APEvtWeight::operator||: Trying to combine already combined event weights with overlapping objects. Uncertainties will be incorrect." << endl;
173 }
174
176
177 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuon].push_back(a.m_current_evt_weights[APEvtWeight::kMuon][i]);
178 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuon].push_back(b.m_current_evt_weights[APEvtWeight::kMuon][i]);
179 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTau].push_back(a.m_current_evt_weights[APEvtWeight::kTau][i]);
180 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTau].push_back(b.m_current_evt_weights[APEvtWeight::kTau][i]);
181 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectron].push_back(a.m_current_evt_weights[APEvtWeight::kElectron][i]);
182 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectron].push_back(b.m_current_evt_weights[APEvtWeight::kElectron][i]);
183 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJet].push_back(a.m_current_evt_weights[APEvtWeight::kJet][i]);
184 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJet].push_back(b.m_current_evt_weights[APEvtWeight::kJet][i]);
185 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kMuonMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuonMO].push_back(a.m_current_evt_weights[APEvtWeight::kMuonMO][i]);
186 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kMuonMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kMuonMO].push_back(b.m_current_evt_weights[APEvtWeight::kMuonMO][i]);
187 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kTauMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTauMO].push_back(a.m_current_evt_weights[APEvtWeight::kTauMO][i]);
188 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kTauMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kTauMO].push_back(b.m_current_evt_weights[APEvtWeight::kTauMO][i]);
189 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kElectronMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectronMO].push_back(a.m_current_evt_weights[APEvtWeight::kElectronMO][i]);
190 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kElectronMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kElectronMO].push_back(b.m_current_evt_weights[APEvtWeight::kElectronMO][i]);
191 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kJetMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJetMO].push_back(a.m_current_evt_weights[APEvtWeight::kJetMO][i]);
192 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kJetMO].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kJetMO].push_back(b.m_current_evt_weights[APEvtWeight::kJetMO][i]);
193 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiMuon].push_back(a.m_current_evt_weights[APEvtWeight::kDiMuon][i]);
194 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiMuon].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiMuon].push_back(b.m_current_evt_weights[APEvtWeight::kDiMuon][i]);
195 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiTau].push_back(a.m_current_evt_weights[APEvtWeight::kDiTau][i]);
196 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiTau].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiTau].push_back(b.m_current_evt_weights[APEvtWeight::kDiTau][i]);
197 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiElectron].push_back(a.m_current_evt_weights[APEvtWeight::kDiElectron][i]);
198 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiElectron].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiElectron].push_back(b.m_current_evt_weights[APEvtWeight::kDiElectron][i]);
199 for (unsigned int i = 0, I = a.m_current_evt_weights[APEvtWeight::kDiJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiJet].push_back(a.m_current_evt_weights[APEvtWeight::kDiJet][i]);
200 for (unsigned int i = 0, I = b.m_current_evt_weights[APEvtWeight::kDiJet].size(); i < I; ++i) ret.m_current_evt_weights[APEvtWeight::kDiJet].push_back(b.m_current_evt_weights[APEvtWeight::kDiJet][i]);
201
202 if (!b.m_isComputed) b.Compute();
203 if (!a.m_isComputed) a.Compute();
204
205 ret.m_n_entries = a.m_n_entries + b.m_n_entries;
206 ret.m_k_evt_weight = 1.0 - (1.0 - a.m_k_evt_weight) * (1.0 - b.m_k_evt_weight);
207 ret.m_variance = a.m_variance * (1.0 - b.m_k_evt_weight) * (1.0 - b.m_k_evt_weight) + b.m_variance * (1.0 - a.m_k_evt_weight) * (1.0 - a.m_k_evt_weight);
208 ret.m_variance_sys = a.m_variance_sys * (1.0 - b.m_k_evt_weight) * (1.0 - b.m_k_evt_weight) + b.m_variance_sys * (1.0 - a.m_k_evt_weight) * (1.0 - a.m_k_evt_weight);
209 return ret;
210}