ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
AnalysisCommon
FakeBkgTools
Root
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
6
#include "
FakeBkgTools/FakeBkgInternals.h
"
7
#include "
FakeBkgTools/LhoodMMEvent.h
"
8
9
#include <stdexcept>
10
#include <iostream>
11
12
using
FakeBkgTools::Efficiency
;
13
using
CP::BaseFakeBkgTool
;
14
15
void
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
;
18
m_realEff
=
realEff
;
19
m_fakeEff
=
fakeEff
;
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
}
27
m_isTight
=
isTight
;
28
m_charge
=
charge
;
29
30
m_weight
=
weight
;
31
m_aux
=
aux
;
32
m_aux2
=
aux2
;
33
}
34
35
LhoodMMEvent::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
37
Init
(
nlep
,
realEff
,
fakeEff
,
isTight
,
charge
,
weight
,
aux
,
aux2
);
38
}
39
40
LhoodMMEvent::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
49
LhoodMMEvent::LhoodMMEvent
(
const
LhoodMMEvent
& mmevt) {
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
55
float
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
68
float
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
82
const
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
91
const
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
101
bool
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
110
int
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
FakeBkgInternals.h
LhoodMMEvent.h
CP::BaseFakeBkgTool
Definition
BaseFakeBkgTool.h:41
LhoodMMEvent::m_aux2
double m_aux2
Definition
LhoodMMEvent.h:43
LhoodMMEvent::aux
double aux() const
Definition
LhoodMMEvent.h:30
LhoodMMEvent::m_realEff
std::vector< FakeBkgTools::Efficiency > m_realEff
Definition
LhoodMMEvent.h:38
LhoodMMEvent::Init
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)
Definition
LhoodMMEvent.cxx:15
LhoodMMEvent::aux2
double aux2() const
Definition
LhoodMMEvent.h:32
LhoodMMEvent::m_weight
float m_weight
Definition
LhoodMMEvent.h:42
LhoodMMEvent::fakeEff
float fakeEff(unsigned ilep, CP::BaseFakeBkgTool *tool=nullptr) const
Definition
LhoodMMEvent.cxx:68
LhoodMMEvent::fakeEffObj
const FakeBkgTools::Efficiency & fakeEffObj(unsigned ilep) const
Definition
LhoodMMEvent.cxx:91
LhoodMMEvent::charge
int charge(unsigned ilep) const
Definition
LhoodMMEvent.cxx:110
LhoodMMEvent::m_aux
double m_aux
Definition
LhoodMMEvent.h:43
LhoodMMEvent::m_isTight
std::vector< bool > m_isTight
Definition
LhoodMMEvent.h:40
LhoodMMEvent::LhoodMMEvent
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.)
Definition
LhoodMMEvent.cxx:35
LhoodMMEvent::realEff
float realEff(unsigned ilep, CP::BaseFakeBkgTool *tool=nullptr) const
Definition
LhoodMMEvent.cxx:55
LhoodMMEvent::isTight
bool isTight(unsigned ilep) const
Definition
LhoodMMEvent.cxx:101
LhoodMMEvent::realEffObj
const FakeBkgTools::Efficiency & realEffObj(unsigned ilep) const
Definition
LhoodMMEvent.cxx:82
LhoodMMEvent::nlep
unsigned nlep() const
Definition
LhoodMMEvent.h:19
LhoodMMEvent::m_nlep
unsigned m_nlep
Definition
LhoodMMEvent.h:36
LhoodMMEvent::weight
float weight() const
Definition
LhoodMMEvent.h:28
LhoodMMEvent::m_charge
std::vector< int > m_charge
Definition
LhoodMMEvent.h:39
LhoodMMEvent::m_fakeEff
std::vector< FakeBkgTools::Efficiency > m_fakeEff
Definition
LhoodMMEvent.h:38
FakeBkgTools::Efficiency
a structure to hold an efficiency together with a variable number of uncertainties
Definition
FakeBkgInternals.h:40
Generated on
for ATLAS Offline Software by
1.17.0