ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::PdgConditional Class Reference

#include <PdgConditional.h>

Collaboration diagram for DerivationFramework::PdgConditional:

Public Member Functions

 PdgConditional ()
 PdgConditional (int pdgIntCode)
 PdgConditional (unsigned equalInt)
 PdgConditional (std::function< bool(int)> b)
bool operator== (int v) const

Private Attributes

const std::variant< int, unsigned, std::function< bool(int)> > m_condition

Detailed Description

Definition at line 16 of file PdgConditional.h.

Constructor & Destructor Documentation

◆ PdgConditional() [1/4]

DerivationFramework::PdgConditional::PdgConditional ( )

Definition at line 10 of file PdgConditional.cxx.

10 :m_condition(0){
11 //nop
12 }
const std::variant< int, unsigned, std::function< bool(int)> > m_condition

◆ PdgConditional() [2/4]

DerivationFramework::PdgConditional::PdgConditional ( int pdgIntCode)

Definition at line 13 of file PdgConditional.cxx.

13 :m_condition(equalInt){
14 //nop
15 }

◆ PdgConditional() [3/4]

DerivationFramework::PdgConditional::PdgConditional ( unsigned equalInt)

Definition at line 16 of file PdgConditional.cxx.

16 :m_condition(equalInt){
17 //nop
18 }

◆ PdgConditional() [4/4]

DerivationFramework::PdgConditional::PdgConditional ( std::function< bool(int)> b)

Definition at line 20 of file PdgConditional.cxx.

20 :m_condition(b){
21 //nop
22 }

Member Function Documentation

◆ operator==()

bool DerivationFramework::PdgConditional::operator== ( int v) const

Definition at line 25 of file PdgConditional.cxx.

25 {
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 }

Member Data Documentation

◆ m_condition

const std::variant<int, unsigned, std::function<bool(int)> > DerivationFramework::PdgConditional::m_condition
private

Definition at line 30 of file PdgConditional.h.


The documentation for this class was generated from the following files: