The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
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>
15#include <string>
16#include <vector>
17
18namespace Gaudi {
19 namespace Interfaces {
21 }
22 class ParticleProperty;
23} // namespace Gaudi
24
25namespace 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:
65 mutable std::string m_name;
69 mutable const Gaudi::ParticleProperty* m_pp = nullptr;
70 };
71
73 typedef std::vector<Item> Items;
74
75 public:
76 Decay() = default;
77
82 Decay( const Gaudi::ParticleProperty* mother, const std::vector<const Gaudi::ParticleProperty*>& daughters );
83
88
89 Decay( const std::string& mother, const std::vector<std::string>& daughters );
94
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
176inline std::ostream& operator<<( std::ostream& s, const Gaudi::Decays::Decay& decay ) { return decay.fillStream( s ); }
177
179inline std::ostream& operator<<( std::ostream& s, const Gaudi::Decays::Decay::Item& item ) {
180 return item.fillStream( s );
181}
std::ostream & operator<<(std::ostream &s, const Gaudi::Decays::Decay &decay)
the printout operator to the stream
Definition Decay.h:176
#define GAUDI_API
Definition Kernel.h:49
the helper representation of the item in the decay chain
Definition Decay.h:39
std::string m_name
the particle name
Definition Decay.h:65
const Gaudi::ParticleProperty * pp() const
get the particle property
Definition Decay.h:53
const Gaudi::ParticleID & pid() const
get the particle PID
Definition Decay.h:51
Gaudi::ParticleID m_pid
the particle PID
Definition Decay.h:67
Item(const Gaudi::ParticleProperty *pp=0)
the constructor from the particle property
Definition Decay.cpp:24
const Gaudi::ParticleProperty * m_pp
the source of properties
Definition Decay.h:69
std::ostream & fillStream(std::ostream &s) const
the default printout
Definition Decay.cpp:114
const std::string & name() const
get the particle name
Definition Decay.h:49
The simple representation of "simple 1-step" decay (there are no trees!
Definition Decay.h:32
void setChildren(const std::vector< std::string > &daugs)
set the daughters
Definition Decay.h:147
StatusCode validate(const Gaudi::Interfaces::IParticlePropertySvc *svc) const
validate the decay using the service
Definition Decay.cpp:92
std::ostream & fillStream(std::ostream &s) const
the default printout
Definition Decay.cpp:105
Items m_daughters
the daughter particles
Definition Decay.h:171
const Item & operator[](const unsigned int index) const
get the component by the number
Definition Decay.h:124
void setDaughters(const Items &daugs)
set the daughters
Definition Decay.cpp:148
const Item & mother() const
get the mother(head) of the decay
Definition Decay.h:104
const Items & children() const
get all daughters
Definition Decay.h:108
std::vector< Item > Items
the vector of items (the obvious representation of daughter particles)
Definition Decay.h:73
void setChidlren(const std::vector< Gaudi::ParticleID > &daugs)
set the daughters
Definition Decay.h:149
void setChildren(const std::vector< const Gaudi::ParticleProperty * > &daugs)
set the daughters
Definition Decay.h:145
void setChildren(const Items &daugs)
set the daughters
Definition Decay.h:143
size_t nChildren() const
get the number of daughters
Definition Decay.h:112
size_t nDaughters() const
get the number of daughters
Definition Decay.h:110
const Items & daughters() const
get all daughters
Definition Decay.h:106
Item m_mother
the head of the decay
Definition Decay.h:169
The abstract interface to Particle Property Service.
Holds PDG + LHCb extension particle code, following the PDG particle numbering scheme (pdg....
Definition ParticleID.h:43
A trivial class to hold information about a single particle properties.
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
StatusCode validate(Iterator begin, Iterator end, const Gaudi::Interfaces::IParticlePropertySvc *svc)
validate trees/nodes
Definition Nodes.h:53
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1