ATLAS Offline Software
Loading...
Searching...
No Matches
LhoodMMEvent.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5#define LhoodMMEvent_cxx
8
9#include <stdexcept>
10#include <iostream>
11
14
15void LhoodMMEvent::Init(int nlep, const std::vector<Efficiency>& realEff, const std::vector<Efficiency>& fakeEff, const std::vector<bool>& isTight, const std::vector<int>& charge, float weight, double aux, double aux2) {
16
17 m_nlep = nlep;
20
21 if (m_realEff.size() < m_nlep) {
22 throw std::invalid_argument("LhoodMMEvent::Init: Expected " + std::to_string(m_nlep) + " real efficiency values, but only " + std::to_string(m_realEff.size()) + " provided in efficiency vector");
23 }
24 if (m_fakeEff.size() < m_nlep) {
25 throw std::invalid_argument("ERROR in LhoodMMEvent::Init: Expected " + std::to_string(m_nlep) + " fake efficiency values, but " + std::to_string(m_fakeEff.size()) + " provided in efficiency vector");
26 }
29
31 m_aux = aux;
32 m_aux2 = aux2;
33}
34
35LhoodMMEvent::LhoodMMEvent(int nlep, const std::vector<Efficiency>& realEff, const std::vector<Efficiency>& fakeEff, const std::vector<bool>& isTight, const std::vector<int>& charge, double weight, double aux, double aux2 ) {
36
38}
39
40LhoodMMEvent::LhoodMMEvent(int nlep, const std::vector<Efficiency>& realEff, const std::vector<Efficiency>& fakeEff, const std::vector<bool>& isTight, const std::vector<int>& charge, float weight, float aux, float aux2) {
41
42 double aux_d = aux;
43 double aux2_d = aux2;
44
45 Init(nlep, realEff, fakeEff, isTight, charge, weight, aux_d, aux2_d);
46
47}
48
50
51 Init( mmevt.m_nlep, mmevt.m_realEff, mmevt.m_fakeEff, mmevt.m_isTight,
52 mmevt.m_charge, mmevt.m_weight, mmevt.m_aux, mmevt.m_aux2);
53}
54
55float LhoodMMEvent::realEff(unsigned ilep, BaseFakeBkgTool* tool) const {
56 if (ilep < m_nlep) {
57 if (tool == nullptr) {
58 return m_realEff[ilep].nominal;
59 } else {
60 return m_realEff[ilep].value(tool);
61 }
62 } else {
63 throw std::out_of_range(" LhoodMMEvent::realEff: invalid lepton index " + std::to_string(ilep) + "; must be less than " + std::to_string(m_nlep));
64 }
65
66}
67
68float LhoodMMEvent::fakeEff(unsigned ilep, BaseFakeBkgTool* tool) const {
69 if (ilep < m_nlep) {
70 if (tool == nullptr) {
71 return m_fakeEff[ilep].nominal;
72 } else {
73 return m_fakeEff[ilep].value(tool);
74 }
75 } else {
76
77 throw std::out_of_range(" LhoodMMEvent::fakeEff: invalid lepton index " + std::to_string(ilep) + "; must be less than " + std::to_string(m_nlep));
78 }
79
80}
81
82const Efficiency& LhoodMMEvent::realEffObj(unsigned ilep) const {
83 if (ilep <= m_nlep) {
84 return m_realEff[ilep];
85 } else {
86 throw std::out_of_range(" LhoodMMEvent::realEff: invalid lepton index " + std::to_string(ilep) + "; must be less than " + std::to_string(m_nlep));
87 }
88
89}
90
91const Efficiency& LhoodMMEvent::fakeEffObj(unsigned ilep) const {
92 if (ilep <= m_nlep) {
93 return m_fakeEff[ilep];
94 } else {
95
96 throw std::out_of_range(" LhoodMMEvent::fakeEff: invalid lepton index " + std::to_string(ilep) + "; must be less than " + std::to_string(m_nlep));
97 }
98
99}
100
101bool LhoodMMEvent::isTight(unsigned ilep) const {
102 if (ilep < m_nlep) {
103 return m_isTight[ilep];
104 } else {
105 throw std::out_of_range(" LhoodMMEvent::isTight: invalid lepton index " + std::to_string(ilep) + "; must be less than " + std::to_string(m_nlep));
106 }
107
108}
109
110int LhoodMMEvent::charge(unsigned ilep) const {
111 if (ilep > m_nlep) {
112
113 throw std::out_of_range(" LhoodMMEvent::charge: invalid lepton index " + std::to_string(ilep) + "; must be less than " + std::to_string(m_nlep));
114 }
115 // user may input an empty charge vector if the selection does not care about
116 // lepton charges. Just return 0 without an error in this case
117 if (unsigned(ilep) > m_charge.size() ) {
118 return 0;
119 } else {
120 return m_charge[ilep];
121 }
122}
123
124
125
126
double aux() const
std::vector< FakeBkgTools::Efficiency > m_realEff
void Init(int nlep, const std::vector< FakeBkgTools::Efficiency > &realEff, const std::vector< FakeBkgTools::Efficiency > &fakeEff, const std::vector< bool > &isTight, const std::vector< int > &charge, float weight, double aux, double aux2)
double aux2() const
float fakeEff(unsigned ilep, CP::BaseFakeBkgTool *tool=nullptr) const
const FakeBkgTools::Efficiency & fakeEffObj(unsigned ilep) const
int charge(unsigned ilep) const
std::vector< bool > m_isTight
LhoodMMEvent(int nlep, const std::vector< FakeBkgTools::Efficiency > &realEff, const std::vector< FakeBkgTools::Efficiency > &fakeEff, const std::vector< bool > &isTight, const std::vector< int > &charge, double weight, double aux=0., double aux2=0.)
float realEff(unsigned ilep, CP::BaseFakeBkgTool *tool=nullptr) const
bool isTight(unsigned ilep) const
const FakeBkgTools::Efficiency & realEffObj(unsigned ilep) const
unsigned nlep() const
unsigned m_nlep
float weight() const
std::vector< int > m_charge
std::vector< FakeBkgTools::Efficiency > m_fakeEff
a structure to hold an efficiency together with a variable number of uncertainties