The Gaudi Framework  master (37c0b60a)
Decay.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 <Gaudi/ParticleID.h>
14 #include <GaudiKernel/StatusCode.h>
15 #include <string>
16 #include <vector>
17 
18 namespace Gaudi {
19  namespace Interfaces {
20  class IParticlePropertySvc;
21  }
22  class ParticleProperty;
23 } // namespace Gaudi
24 
25 namespace Gaudi::Decays {
32  class GAUDI_API Decay final {
33  public:
39  class Item final {
40  public:
42  Item( const Gaudi::ParticleProperty* pp = 0 );
44  Item( const std::string& name );
46  Item( const Gaudi::ParticleID& pid );
47 
49  const std::string& name() const { return m_name; }
51  const Gaudi::ParticleID& pid() const { return m_pid; }
53  const Gaudi::ParticleProperty* pp() const { return m_pp; }
54 
56  std::ostream& fillStream( std::ostream& s ) const;
57 
61  StatusCode validate( const Gaudi::ParticleProperty* prop ) const;
62 
63  private:
69  mutable const Gaudi::ParticleProperty* m_pp = nullptr;
70  };
71 
74 
75  public:
76  Decay() = default;
77 
83 
89  Decay( const std::string& mother, const std::vector<std::string>& daughters );
95  Decay( const Gaudi::ParticleID& mother, const std::vector<Gaudi::ParticleID>& daughters );
96 
101  Decay( const Item& mother, const std::vector<Item>& daughters );
102 
104  const Item& mother() const { return m_mother; }
106  const Items& daughters() const { return m_daughters; }
108  const Items& children() const { return daughters(); }
110  size_t nDaughters() const { return m_daughters.size(); }
112  size_t nChildren() const { return m_daughters.size(); }
118  const Item& operator()( const unsigned int index ) const;
124  const Item& operator[]( const unsigned int index ) const { return ( *this )( index ); }
125 
127  void setMother( const Item& mom );
129  void setMother( const Gaudi::ParticleProperty* mom );
131  void setMother( const std::string& mom );
133  void setMother( const Gaudi::ParticleID& mom );
135  void setDaughters( const Items& daugs );
137  void setDaughters( const std::vector<const Gaudi::ParticleProperty*>& daugs );
139  void setDaughters( const std::vector<std::string>& daugs );
141  void setDaughters( const std::vector<Gaudi::ParticleID>& daugs );
143  void setChildren( const Items& daugs ) { setDaughters( daugs ); }
145  void setChildren( const std::vector<const Gaudi::ParticleProperty*>& daugs ) { setDaughters( daugs ); }
147  void setChildren( const std::vector<std::string>& daugs ) { setDaughters( daugs ); }
149  void setChidlren( const std::vector<Gaudi::ParticleID>& daugs ) { setDaughters( daugs ); }
150 
152  Decay& operator+=( const std::string& child );
154  Decay& operator+=( const Gaudi::ParticleID& child );
156  Decay& operator+=( const Gaudi::ParticleProperty* child );
158  Decay& operator+=( const Item& child );
159 
162 
164  std::ostream& fillStream( std::ostream& s ) const;
166  std::string toString() const;
167 
169  mutable Item m_mother; // the head of the decay
171  mutable Items m_daughters; // the daughter particles
172  };
173 } // namespace Gaudi::Decays
174 
176 inline std::ostream& operator<<( std::ostream& s, const Gaudi::Decays::Decay& decay ) { return decay.fillStream( s ); }
177 
180  return item.fillStream( s );
181 }
Gaudi::Decays::Decay::setChildren
void setChildren(const std::vector< const Gaudi::ParticleProperty * > &daugs)
set the daughters
Definition: Decay.h:145
std::string
STL class.
Gaudi::Decays::Decay::Item::m_name
std::string m_name
the particle name
Definition: Decay.h:65
Gaudi::Decays::Decay::setChildren
void setChildren(const Items &daugs)
set the daughters
Definition: Decay.h:143
Gaudi::Decays::Decay
Definition: Decay.h:32
gaudirun.s
string s
Definition: gaudirun.py:346
std::vector< Item >
Gaudi::Decays::Decay::Item::m_pid
Gaudi::ParticleID m_pid
the particle PID
Definition: Decay.h:67
Gaudi::Decays::Decay::setChildren
void setChildren(const std::vector< std::string > &daugs)
set the daughters
Definition: Decay.h:147
ParticleProperty
Definition: ParticleProperty.py:1
Gaudi::Interfaces::IParticlePropertySvc
Definition: IParticlePropertySvc.h:29
Gaudi::Decays::Decay::setChidlren
void setChidlren(const std::vector< Gaudi::ParticleID > &daugs)
set the daughters
Definition: Decay.h:149
Gaudi::Decays::Decay::daughters
const Items & daughters() const
get all daughters
Definition: Decay.h:106
ParticleID.h
StatusCode.h
Gaudi::Decays::Decay::Item::pid
const Gaudi::ParticleID & pid() const
get the particle PID
Definition: Decay.h:51
Gaudi::Decays::Decay::m_daughters
Items m_daughters
the daughter particles
Definition: Decay.h:171
Gaudi::Decays::Decay::fillStream
std::ostream & fillStream(std::ostream &s) const
the default printout
Definition: Decay.cpp:105
Gaudi::Decays::Decay::Item::name
const std::string & name() const
get the particle name
Definition: Decay.h:49
StatusCode
Definition: StatusCode.h:65
operator<<
std::ostream & operator<<(std::ostream &s, const Gaudi::Decays::Decay &decay)
the printout operator to the stream
Definition: Decay.h:176
Gaudi::Decays::Decay::Item::fillStream
std::ostream & fillStream(std::ostream &s) const
the default printout
Definition: Decay.cpp:114
std::ostream
STL class.
Gaudi::Decays::validate
StatusCode validate(Iterator begin, Iterator end, const Gaudi::Interfaces::IParticlePropertySvc *svc)
validate trees/nodes
Definition: Nodes.h:53
Gaudi::Decays::Decay::Items
std::vector< Item > Items
the vector of items (the obvious representation of daughter particles)
Definition: Decay.h:73
GaudiPartProp.decorators.Items
Items
Definition: decorators.py:304
Gaudi::ParticleProperty
Definition: ParticleProperty.h:37
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Gaudi::Decays::Decay::nDaughters
size_t nDaughters() const
get the number of daughters
Definition: Decay.h:110
Gaudi::Decays
Definition: CC.h:17
Gaudi::Utils::toString
std::string toString(const TYPE &obj)
the generic implementation of the type conversion to the string
Definition: ToStream.h:353
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
Gaudi::ParticleID
Definition: ParticleID.h:43
GaudiPartProp.decorators.Item
Item
Definition: decorators.py:306
Gaudi::Decays::Decay::operator[]
const Item & operator[](const unsigned int index) const
get the component by the number
Definition: Decay.h:124
Gaudi::Decays::Decay::Item
Definition: Decay.h:39
Gaudi::Decays::Decay::m_mother
Item m_mother
the head of the decay
Definition: Decay.h:169
Gaudi::Decays::Decay::Item::pp
const Gaudi::ParticleProperty * pp() const
get the particle property
Definition: Decay.h:53
Gaudi::Decays::Decay::mother
const Item & mother() const
get the mother(head) of the decay
Definition: Decay.h:104
Gaudi::Decays::Decay::Decay
Decay()=default
GaudiPartProp.decorators.Decay
Decay
Definition: decorators.py:305
compareOutputFiles.pp
pp
Definition: compareOutputFiles.py:507
Gaudi::Decays::Decay::children
const Items & children() const
get all daughters
Definition: Decay.h:108
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
Gaudi::ParticleProperties::index
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
Definition: IParticlePropertySvc.cpp:39
Gaudi::Decays::Decay::nChildren
size_t nChildren() const
get the number of daughters
Definition: Decay.h:112