File indexing completed on 2025-01-30 10:07:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #pragma once
0012
0013 #include <Gaudi/ParticleID.h>
0014 #include <GaudiKernel/StatusCode.h>
0015 #include <string>
0016 #include <vector>
0017
0018 namespace Gaudi {
0019 namespace Interfaces {
0020 class IParticlePropertySvc;
0021 }
0022 class ParticleProperty;
0023 }
0024
0025 namespace Gaudi::Decays {
0026
0027
0028
0029
0030
0031
0032 class GAUDI_API Decay final {
0033 public:
0034
0035
0036
0037
0038
0039 class Item final {
0040 public:
0041
0042 Item( const Gaudi::ParticleProperty* pp = 0 );
0043
0044 Item( const std::string& name );
0045
0046 Item( const Gaudi::ParticleID& pid );
0047
0048
0049 const std::string& name() const { return m_name; }
0050
0051 const Gaudi::ParticleID& pid() const { return m_pid; }
0052
0053 const Gaudi::ParticleProperty* pp() const { return m_pp; }
0054
0055
0056 std::ostream& fillStream( std::ostream& s ) const;
0057
0058
0059 StatusCode validate( const Gaudi::Interfaces::IParticlePropertySvc* svc ) const;
0060
0061 StatusCode validate( const Gaudi::ParticleProperty* prop ) const;
0062
0063 private:
0064
0065 mutable std::string m_name;
0066
0067 mutable Gaudi::ParticleID m_pid;
0068
0069 mutable const Gaudi::ParticleProperty* m_pp = nullptr;
0070 };
0071
0072
0073 typedef std::vector<Item> Items;
0074
0075 public:
0076 Decay() = default;
0077
0078
0079
0080
0081
0082 Decay( const Gaudi::ParticleProperty* mother, const std::vector<const Gaudi::ParticleProperty*>& daughters );
0083
0084
0085
0086
0087
0088
0089 Decay( const std::string& mother, const std::vector<std::string>& daughters );
0090
0091
0092
0093
0094
0095 Decay( const Gaudi::ParticleID& mother, const std::vector<Gaudi::ParticleID>& daughters );
0096
0097
0098
0099
0100
0101 Decay( const Item& mother, const std::vector<Item>& daughters );
0102
0103
0104 const Item& mother() const { return m_mother; }
0105
0106 const Items& daughters() const { return m_daughters; }
0107
0108 const Items& children() const { return daughters(); }
0109
0110 size_t nDaughters() const { return m_daughters.size(); }
0111
0112 size_t nChildren() const { return m_daughters.size(); }
0113
0114
0115
0116
0117
0118 const Item& operator()( const unsigned int index ) const;
0119
0120
0121
0122
0123
0124 const Item& operator[]( const unsigned int index ) const { return ( *this )( index ); }
0125
0126
0127 void setMother( const Item& mom );
0128
0129 void setMother( const Gaudi::ParticleProperty* mom );
0130
0131 void setMother( const std::string& mom );
0132
0133 void setMother( const Gaudi::ParticleID& mom );
0134
0135 void setDaughters( const Items& daugs );
0136
0137 void setDaughters( const std::vector<const Gaudi::ParticleProperty*>& daugs );
0138
0139 void setDaughters( const std::vector<std::string>& daugs );
0140
0141 void setDaughters( const std::vector<Gaudi::ParticleID>& daugs );
0142
0143 void setChildren( const Items& daugs ) { setDaughters( daugs ); }
0144
0145 void setChildren( const std::vector<const Gaudi::ParticleProperty*>& daugs ) { setDaughters( daugs ); }
0146
0147 void setChildren( const std::vector<std::string>& daugs ) { setDaughters( daugs ); }
0148
0149 void setChidlren( const std::vector<Gaudi::ParticleID>& daugs ) { setDaughters( daugs ); }
0150
0151
0152 Decay& operator+=( const std::string& child );
0153
0154 Decay& operator+=( const Gaudi::ParticleID& child );
0155
0156 Decay& operator+=( const Gaudi::ParticleProperty* child );
0157
0158 Decay& operator+=( const Item& child );
0159
0160
0161 StatusCode validate( const Gaudi::Interfaces::IParticlePropertySvc* svc ) const;
0162
0163
0164 std::ostream& fillStream( std::ostream& s ) const;
0165
0166 std::string toString() const;
0167
0168
0169 mutable Item m_mother;
0170
0171 mutable Items m_daughters;
0172 };
0173 }
0174
0175
0176 inline std::ostream& operator<<( std::ostream& s, const Gaudi::Decays::Decay& decay ) { return decay.fillStream( s ); }
0177
0178
0179 inline std::ostream& operator<<( std::ostream& s, const Gaudi::Decays::Decay::Item& item ) {
0180 return item.fillStream( s );
0181 }