ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis
DerivationFramework
DerivationFrameworkSUSY
src
PdgConditional.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
PdgConditional.h
"
6
#include <cmath>
//for std::abs
7
8
9
namespace
DerivationFramework
{
10
PdgConditional::PdgConditional
():
m_condition
(0){
11
//nop
12
}
13
PdgConditional::PdgConditional
(
int
equalInt):
m_condition
(equalInt){
14
//nop
15
}
16
PdgConditional::PdgConditional
(
unsigned
equalInt):
m_condition
(equalInt){
17
//nop
18
}
19
20
PdgConditional::PdgConditional
(std::function<
bool
(
int
)> b):
m_condition
(b){
21
//nop
22
}
23
24
bool
25
PdgConditional::operator==
(
int
v)
const
{
26
//compare with the held integer
27
if
(std::holds_alternative<int>(
m_condition
)){
28
auto
rawValue = std::get<0>(
m_condition
);
29
return
v == rawValue;
30
}
31
//use abs(value) if the held integer is unsigned
32
if
(std::holds_alternative<unsigned>(
m_condition
)){
33
auto
rawValue = std::get<1>(
m_condition
);
34
return
unsigned(std::abs(v)) == rawValue;
35
}
36
//otherwise use user-defined binary predicate
37
return
std::get<2>(
m_condition
)(v);
38
}
39
40
}
PdgConditional.h
DerivationFramework::PdgConditional::PdgConditional
PdgConditional()
Definition
PdgConditional.cxx:10
DerivationFramework::PdgConditional::operator==
bool operator==(int v) const
Definition
PdgConditional.cxx:25
DerivationFramework::PdgConditional::m_condition
const std::variant< int, unsigned, std::function< bool(int)> > m_condition
Definition
PdgConditional.h:30
DerivationFramework
THE reconstruction tool.
Definition
ParticleSortingAlg.h:24
Generated on
for ATLAS Offline Software by
1.14.0