YAP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Particle.h
Go to the documentation of this file.
1 /* YAP - Yet another PWA toolkit
2  Copyright 2015, Technische Universitaet Muenchen,
3  Authors: Daniel Greenwald, Johannes Rauch
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
20 
21 #ifndef yap_Particle_h
22 #define yap_Particle_h
23 
24 #include "fwd/Particle.h"
25 
26 #include "fwd/DataPoint.h"
27 #include "fwd/FinalStateParticle.h"
28 #include "fwd/Model.h"
29 #include "fwd/Parameter.h"
30 #include "fwd/Particle.h"
31 #include "fwd/Spin.h"
32 #include "fwd/StatusManager.h"
33 
34 #include "ParticleCombination.h"
35 #include "QuantumNumbers.h"
36 
37 #include <iostream>
38 #include <memory>
39 #include <string>
40 
41 namespace yap {
42 
47 class Particle :
48  public std::enable_shared_from_this<Particle>
49 {
50 protected:
51 
55  Particle(std::string name, const QuantumNumbers& q)
56  : std::enable_shared_from_this<Particle>(),
57  QuantumNumbers_(q), Name_(name) {}
58 
59 public:
60 
62  virtual bool consistent() const;
63 
66 
69  { return QuantumNumbers_; }
70 
72  const std::string& name() const
73  { return Name_; }
74 
76  std::string& name()
77  { return Name_; }
78 
80  virtual const Model* model() const = 0;
81 
83  const ParticleCombinationSet& particleCombinations() const
84  { return ParticleCombinations_; }
85 
87 
89  friend class DecayChannel;
90 
91 protected:
92 
94  virtual void addParticleCombination(const std::shared_ptr<ParticleCombination>& pc) = 0;
95 
97  virtual void pruneParticleCombinations();
98 
100  virtual void registerWithModel() = 0;
101 
102 private:
103 
106 
108  std::string Name_;
109 
111  ParticleCombinationSet ParticleCombinations_;
112 
113 };
114 
116 const SpinVector spins(const ParticleVector& v);
117 
119 const bool decays_to_full_final_state(const Particle& p);
120 
122 inline std::string to_string(const Particle& p)
123 { return p.name() + "(" + to_string(p.quantumNumbers()) + ")"; }
124 
126 inline std::string to_string(const ParticleVector& p)
127 {
128  return std::accumulate(p.begin(), p.end(), std::string(""),
129  [](std::string& s, const ParticleVector::value_type& p)
130  {return s += " " + p->name();}).erase(0, 1);
131 }
132 
134 inline std::ostream& operator<<(std::ostream& os, const Particle& p)
135 { os << to_string(p); return os; }
136 
137 }
138 
139 #endif
std::string & name()
Get name.
Definition: Particle.h:76
const SpinVector spins(const ParticleVector &v)
Definition: Particle.cxx:35
const ParticleCombinationSet & particleCombinations() const
Definition: Particle.h:83
virtual void registerWithModel()=0
register any necessary DataAccessor's with model
virtual bool consistent() const
Check consitency of object.
Definition: Particle.cxx:10
std::ostream & operator<<(std::ostream &os, const DecayChannel &dc)
<< operator
Definition: DecayChannel.h:127
ParticleCombinationSet ParticleCombinations_
vector of ParticleCombinations that can comprise this particle
Definition: Particle.h:111
Particle(std::string name, const QuantumNumbers &q)
Definition: Particle.h:55
Class implementing a PWA model.
Definition: Model.h:56
const std::string & name() const
Get name (const)
Definition: Particle.h:72
const bool decays_to_full_final_state(const Particle &p)
Definition: Particle.cxx:45
QuantumNumbers QuantumNumbers_
Quantum numbers of particle.
Definition: Particle.h:105
const QuantumNumbers & quantumNumbers() const
const access QuantumNumbers object
Definition: Particle.h:68
virtual void pruneParticleCombinations()
prune ParticleCombinations_ to only contain ParticleCombination's tracing back up the ISP ...
Definition: Particle.cxx:29
std::string to_string(const CachedValue::Status &S)
streaming operator for CachedValue::Status
Definition: CachedValue.cxx:27
virtual void addParticleCombination(const std::shared_ptr< ParticleCombination > &pc)=0
add ParticleCombination to ParticleCombinations_
Definition: Particle.cxx:23
Abstract Particle base class.
Definition: Particle.h:47
Quantum numbers of a Particle.
Definition: QuantumNumbers.h:35
std::string Name_
Name of particle.
Definition: Particle.h:108
Class implementing a decay channel.
Definition: DecayChannel.h:40
virtual const Model * model() const =0
get raw pointer to Model (const)