The Gaudi Framework  master (594c33fa)
Gaudi::Decays::Nodes::And Class Reference

#include </builds/gaudi/Gaudi/GaudiPartProp/include/Gaudi/Decays/Nodes.h>

Inheritance diagram for Gaudi::Decays::Nodes::And:
Collaboration diagram for Gaudi::Decays::Nodes::And:

Public Member Functions

 And (const Decays::iNode &n1, const Decays::iNode &n2)
 constructor from two nodes More...
 
 And (const Decays::iNode &n1, const Decays::iNode &n2, const Decays::iNode &n3)
 constructor from three nodes More...
 
 And (const Decays::iNode &n1, const Decays::iNode &n2, const Decays::iNode &n3, const Decays::iNode &n4)
 constructor from four nodes More...
 
 And (const Decays::NodeList &nodes)
 constructor from list of nodes More...
 
Andclone () const override
 MANDATORY: clone method ("virtual constructor") More...
 
bool operator() (const Gaudi::ParticleID &p) const override
 MANDATORY: the only one essential method. More...
 
std::ostreamfillStream (std::ostream &s) const override
 MANDATORY: the specific printout. More...
 
bool valid () const override
 MANDATORY: check the validity. More...
 
StatusCode validate (const Gaudi::Interfaces::IParticlePropertySvc *svc) const override
 MANDATORY: the proper validation of the node. More...
 
Andoperator+= (const Decays::iNode &node)
 
Andoperator+= (const Decays::NodeList &nodes)
 
- Public Member Functions inherited from Gaudi::Decays::iNode
virtual bool operator! () const
 invalid node? More...
 
virtual std::string toString () const
 the string representation of the node More...
 
virtual ~iNode ()=default
 virtual destructor More...
 

Protected Member Functions

size_t add (const Decays::iNode &node)
 
size_t add (const Decays::NodeList &nodes)
 

Private Attributes

NodeList m_nodes
 the sub-nodes More...
 

Detailed Description

the rather simple (but powerful) node in the decay tree: it matches .AND. for sub-nodes

Author
Vanya BELYAEV Ivan..nosp@m.Bely.nosp@m.aev@n.nosp@m.ikhe.nosp@m.f.nl
Date
2008-04-12

Definition at line 270 of file Nodes.h.

Constructor & Destructor Documentation

◆ And() [1/4]

Gaudi::Decays::Nodes::And::And ( const Decays::iNode n1,
const Decays::iNode n2 
)

constructor from two nodes

Definition at line 130 of file Nodes.cpp.

130  {
131  add( n1 );
132  add( n2 );
133 }

◆ And() [2/4]

Gaudi::Decays::Nodes::And::And ( const Decays::iNode n1,
const Decays::iNode n2,
const Decays::iNode n3 
)

constructor from three nodes

Definition at line 135 of file Nodes.cpp.

135  {
136  add( n1 );
137  add( n2 );
138  add( n3 );
139 }

◆ And() [3/4]

Gaudi::Decays::Nodes::And::And ( const Decays::iNode n1,
const Decays::iNode n2,
const Decays::iNode n3,
const Decays::iNode n4 
)

constructor from four nodes

Definition at line 141 of file Nodes.cpp.

142  {
143  add( n1 );
144  add( n2 );
145  add( n3 );
146  add( n4 );
147 }

◆ And() [4/4]

Gaudi::Decays::Nodes::And::And ( const Decays::NodeList nodes)

constructor from list of nodes

Definition at line 149 of file Nodes.cpp.

149 { add( nodes ); }

Member Function Documentation

◆ add() [1/2]

size_t Gaudi::Decays::Nodes::And::add ( const Decays::iNode node)
protected

Definition at line 151 of file Nodes.cpp.

151  {
152  const Decays::iNode* right = &node;
153  const And* _and = dynamic_cast<const And*>( right );
154  if ( 0 != _and ) { return add( _and->m_nodes ); } // RETURN
155  // holder ?
156  const Node* _no = dynamic_cast<const Node*>( right );
157  if ( 0 != _no ) { return add( _no->node() ); } // RETURN
158  // just add the node
159  m_nodes.push_back( node );
160  return m_nodes.size();
161 }

◆ add() [2/2]

size_t Gaudi::Decays::Nodes::And::add ( const Decays::NodeList nodes)
protected

Definition at line 163 of file Nodes.cpp.

163  {
164  for ( const auto& n : nodes ) add( n );
165  return m_nodes.size();
166 }

◆ clone()

Decays::Nodes::And * Gaudi::Decays::Nodes::And::clone ( ) const
overridevirtual

MANDATORY: clone method ("virtual constructor")

Implements Gaudi::Decays::iNode.

Definition at line 168 of file Nodes.cpp.

168 { return new And( *this ); }

◆ fillStream()

std::ostream & Gaudi::Decays::Nodes::And::fillStream ( std::ostream s) const
overridevirtual

MANDATORY: the specific printout.

Implements Gaudi::Decays::iNode.

Definition at line 175 of file Nodes.cpp.

175  {
176  return GaudiUtils::details::ostream_joiner( s << " (", m_nodes, "&" ) << ") ";
177 }

◆ operator()()

bool Gaudi::Decays::Nodes::And::operator() ( const Gaudi::ParticleID p) const
overridevirtual

MANDATORY: the only one essential method.

Implements Gaudi::Decays::iNode.

Definition at line 170 of file Nodes.cpp.

170  {
171  if ( m_nodes.empty() ) { return false; }
172  return std::all_of( m_nodes.begin(), m_nodes.end(), [&]( const Decays::Nodes::_Node& n ) { return n == pid; } );
173 }

◆ operator+=() [1/2]

Decays::Nodes::And & Gaudi::Decays::Nodes::And::operator+= ( const Decays::iNode node)

Definition at line 203 of file Nodes.cpp.

203  {
204  add( node );
205  return *this;
206 }

◆ operator+=() [2/2]

Decays::Nodes::And & Gaudi::Decays::Nodes::And::operator+= ( const Decays::NodeList nodes)

Definition at line 211 of file Nodes.cpp.

211  {
212  add( nodes );
213  return *this;
214 }

◆ valid()

bool Gaudi::Decays::Nodes::And::valid ( ) const
overridevirtual

MANDATORY: check the validity.

Implements Gaudi::Decays::iNode.

Definition at line 179 of file Nodes.cpp.

179 { return !m_nodes.empty() && Decays::valid( m_nodes.begin(), m_nodes.end() ); }

◆ validate()

StatusCode Gaudi::Decays::Nodes::And::validate ( const Gaudi::Interfaces::IParticlePropertySvc svc) const
overridevirtual

MANDATORY: the proper validation of the node.

Implements Gaudi::Decays::iNode.

Definition at line 181 of file Nodes.cpp.

181  {
182  if ( m_nodes.empty() ) { return StatusCode::FAILURE; }
183  return Decays::validate( m_nodes.begin(), m_nodes.end(), svc );
184 }

Member Data Documentation

◆ m_nodes

NodeList Gaudi::Decays::Nodes::And::m_nodes
private

the sub-nodes

Definition at line 301 of file Nodes.h.


The documentation for this class was generated from the following files:
Gaudi::Decays::NodeList::size
size_t size() const
Definition: Nodes.h:206
Gaudi::Decays::NodeList::empty
bool empty() const
Definition: Nodes.h:207
Gaudi::Decays::NodeList::end
iterator end()
Definition: Nodes.h:209
gaudirun.s
string s
Definition: gaudirun.py:346
GaudiPartProp.Nodes._Node
_Node
Definition: Nodes.py:273
std::all_of
T all_of(T... args)
Gaudi::Decays::Nodes::And::m_nodes
NodeList m_nodes
the sub-nodes
Definition: Nodes.h:301
GaudiPartProp.Nodes.Node
Node
Definition: Nodes.py:247
Gaudi::Decays::NodeList::begin
iterator begin()
Definition: Nodes.h:208
Gaudi::Decays::validate
StatusCode validate(Iterator begin, Iterator end, const Gaudi::Interfaces::IParticlePropertySvc *svc)
validate trees/nodes
Definition: Nodes.h:53
Gaudi::Decays::Nodes::And::And
And(const Decays::iNode &n1, const Decays::iNode &n2)
constructor from two nodes
Definition: Nodes.cpp:130
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:234
std::right
T right(T... args)
Gaudi::Decays::Nodes::And::add
size_t add(const Decays::iNode &node)
Definition: Nodes.cpp:151
Gaudi::Decays::valid
bool valid(Iterator begin, Iterator end)
check the validness of the trees or nodes
Definition: Nodes.h:36
Gaudi::Decays::iNode
Definition: iNode.h:35
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:101
Gaudi::Decays::NodeList::push_back
void push_back(const Decays::Nodes::_Node &node)
Definition: Nodes.cpp:26
GaudiUtils::details::ostream_joiner
Stream & ostream_joiner(Stream &os, Iterator first, Iterator last, Separator sep, OutputElement output=OutputElement{})
Definition: SerializeSTL.h:73