The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
iNode.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2023 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11#pragma once
12
13#include <GaudiKernel/Kernel.h>
15#include <functional>
16#include <iosfwd>
17#include <memory>
18
19namespace Gaudi {
20 namespace Interfaces {
22 }
23 class ParticleID;
24} // namespace Gaudi
25
26namespace Gaudi::Decays {
36 public:
41 virtual bool operator()( const Gaudi::ParticleID& pid ) const = 0;
42
44 virtual iNode* clone() const = 0;
45
50 virtual std::ostream& fillStream( std::ostream& s ) const = 0;
52 virtual bool valid() const = 0;
54 virtual bool operator!() const;
55
61
63 virtual std::string toString() const;
64
66 virtual ~iNode() = default;
67 };
68
74 class GAUDI_API Node : public iNode {
75 public:
77 Node( const Decays::iNode& node );
79 Node( const Decays::Node& right );
81 Node* clone() const override;
83 bool operator()( const Gaudi::ParticleID& p ) const override;
85 std::ostream& fillStream( std::ostream& s ) const override;
87 bool valid() const override;
90
91 public:
92 Node& operator&=( const iNode& right ) { return op_and( right ); }
93 Node& operator|=( const iNode& right ) { return op_or( right ); }
94
95 // get the underlying node
96 inline const iNode& node() const { return *m_node; }
97
98 // evaluate the underlying node
99 inline bool node( const Gaudi::ParticleID& pid ) const { return node()( pid ); }
100
102 Node& operator=( const Node& right );
104 Node& operator=( const iNode& right );
105
106 private:
107 Node& op_and( const iNode& right );
108 Node& op_or( const iNode& right );
109
111 std::unique_ptr<iNode> m_node;
112 };
113
121 inline std::ostream& operator<<( std::ostream& s, const iNode& n ) { return n.fillStream( s ); }
122
128 inline bool operator==( const Decays::iNode& node, const Gaudi::ParticleID& pid ) { return node( pid ); }
129
135 inline bool operator==( const Gaudi::ParticleID& pid, const Decays::iNode& node ) { return node == pid; }
136
142 inline bool operator!=( const Decays::iNode& node, const Gaudi::ParticleID& pid ) { return !( node == pid ); }
143
149 inline bool operator!=( const Gaudi::ParticleID& pid, const Decays::iNode& node ) { return node != pid; }
150
159 return n.validate( svc );
160 }
161
170 return n.validate( svc );
171 }
172} // namespace Gaudi::Decays
#define GAUDI_API
Definition Kernel.h:49
bool operator!(const Gaudi::Time &t)
Definition Time.icpp:190
The generic class to hold the pointer to other node.
Definition iNode.h:74
bool node(const Gaudi::ParticleID &pid) const
Definition iNode.h:99
Node & operator&=(const iNode &right)
Definition iNode.h:92
Node & op_or(const iNode &right)
Definition iNode.cpp:76
Node * clone() const override
MANDATORY: clone method ("virtual constructor")
Definition iNode.cpp:72
Node & op_and(const iNode &right)
Definition iNode.cpp:74
bool valid() const override
MANDATORY: check the validity of the node.
Definition iNode.cpp:47
std::unique_ptr< iNode > m_node
the node itself:
Definition iNode.h:111
Node(const Decays::iNode &node)
constructor from the node
Definition iNode.cpp:32
bool operator()(const Gaudi::ParticleID &p) const override
MANDATORY: the only one essential method.
Definition iNode.cpp:43
std::ostream & fillStream(std::ostream &s) const override
MANDATORY: the specific printout.
Definition iNode.cpp:45
const iNode & node() const
Definition iNode.h:96
StatusCode validate(const Gaudi::Interfaces::IParticlePropertySvc *svc) const override
MANDATORY: the proper validation of the node.
Definition iNode.cpp:49
Node & operator|=(const iNode &right)
Definition iNode.h:93
The abstract class which represents the single "node" of decay tree.
Definition iNode.h:35
virtual std::string toString() const
the string representation of the node
Definition iNode.cpp:24
virtual bool operator()(const Gaudi::ParticleID &pid) const =0
the basic operation: comparison of the particle PID with the node
virtual StatusCode validate(const Gaudi::Interfaces::IParticlePropertySvc *svc) const =0
validate the decay node
virtual bool valid() const =0
check the validity of the node
virtual std::ostream & fillStream(std::ostream &s) const =0
printout of the stream
virtual ~iNode()=default
virtual destructor
virtual iNode * clone() const =0
clone method ("virtual constructor")
The abstract interface to Particle Property Service.
Holds PDG + LHCb extension particle code, following the PDG particle numbering scheme (pdg....
Definition ParticleID.h:43
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
std::ostream & operator<<(std::ostream &s, const iNode &n)
printout to the output stream
Definition iNode.h:121
StatusCode operator+(const Decays::iNode &n, const Gaudi::Interfaces::IParticlePropertySvc *svc)
"on-flight" validation of the node
Definition iNode.h:158
bool operator==(const Decays::iNode &node, const Gaudi::ParticleID &pid)
equality The node is "equal" to the PID , if the given pid satisfies the node criteria
Definition iNode.h:128
bool operator!=(const Decays::iNode &node, const Gaudi::ParticleID &pid)
non-equality The node is "equal" to the PID , if the given PID satisfies the node criteria
Definition iNode.h:142
StatusCode operator*(const Decays::iNode &n, const Gaudi::Interfaces::IParticlePropertySvc *svc)
"on-flight" validation of the node
Definition iNode.h:169
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1