YAP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DecayTree.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_DecayTree_h
22 #define yap_DecayTree_h
23 
24 #include "fwd/DecayTree.h"
25 
26 #include "fwd/AmplitudeComponent.h"
27 #include "fwd/DataPoint.h"
28 #include "fwd/DecayChannel.h"
29 #include "fwd/FreeAmplitude.h"
30 #include "fwd/Model.h"
31 #include "fwd/ParticleCombination.h"
32 #include "fwd/Spin.h"
33 #include "fwd/SpinAmplitude.h"
34 #include "fwd/StatusManager.h"
35 #include "fwd/VariableStatus.h"
36 
37 #include <array>
38 #include <complex>
39 #include <map>
40 #include <memory>
41 #include <string>
42 #include <vector>
43 
44 namespace yap {
45 
49 class DecayTree
50 {
51 public:
52 
55  using DaughterDecayTreeMap = std::map<unsigned, std::shared_ptr<DecayTree> >;
56 
61  explicit DecayTree(std::shared_ptr<FreeAmplitude> free_amp);
62 
64  const std::complex<double> dataIndependentAmplitude() const;
65 
69  const std::complex<double> dataDependentAmplitude(const DataPoint& d) const;
70 
74  const std::complex<double> dataDependentAmplitude(const DataPoint& d, const std::shared_ptr<ParticleCombination>& pc) const;
75 
78 
80  const std::shared_ptr<FreeAmplitude>& freeAmplitude() const
81  { return FreeAmplitude_; }
82 
85  { return DaughterDecayTrees_; }
86 
88  std::shared_ptr<DecayingParticle> decayingParticle() const;
89 
91  const Model* model() const;
92 
94  friend class DecayChannel;
95 
97  friend class DecayingParticle;
98 
100  friend class Resonance;
101 
102 protected:
103 
107  void setDaughterDecayTree(unsigned i, std::shared_ptr<DecayTree> dt);
108 
111  void setDaughterSpinProjection(unsigned i, int two_m)
112  { DaughtersTwoM_.at(i) = two_m; }
113 
115  void addAmplitudeComponent(const AmplitudeComponent& rda);
116 
117 private:
118 
120  std::shared_ptr<FreeAmplitude> FreeAmplitude_;
121 
123  SpinProjectionVector DaughtersTwoM_;
124 
126  std::vector<const AmplitudeComponent*> AmplitudeComponents_;
127 
130 
131 };
132 
134 std::string to_string(const DecayTree& dt, std::string offset = "");
135 
137 std::string to_string(const DecayTreeVector& dtv);
138 
140 inline bool operator==(const DecayTree& lhs, const DecayTree& rhs)
141 { return lhs.freeAmplitude() == rhs.freeAmplitude() and lhs.daughterDecayTrees() == rhs.daughterDecayTrees(); }
142 
144 unsigned depth(const DecayTree& DT);
145 
149 inline const std::complex<double> amplitude(const DecayTree& dt, const DataPoint& d)
150 { return dt.dataIndependentAmplitude() * dt.dataDependentAmplitude(d); }
151 
156 inline const std::complex<double> amplitude(const DecayTree& dt, const DataPoint& d, const std::shared_ptr<ParticleCombination>& pc)
157 { return dt.dataIndependentAmplitude() * dt.dataDependentAmplitude(d, pc); }
158 
162 const std::complex<double> amplitude(const DecayTreeVector& dtv, const DataPoint& d);
163 
167 inline const double intensity(const DecayTreeVector& dtv, const DataPoint& d)
168 { return norm(amplitude(dtv, d)); }
169 
171 FreeAmplitudeSet free_amplitudes(const DecayTree& DT);
172 
174 FreeAmplitudeSet free_amplitudes(const DecayTreeVector& DTV);
175 
177 const bool has_changed(const std::shared_ptr<DecayTree>& dt);
178 
181 const DecayTreeVector select_changed(const DecayTreeVector& dtv);
182 
183 }
184 
185 #endif
const std::complex< double > amplitude(const DecayTree &dt, const DataPoint &d)
Definition: DecayTree.h:149
const Model * model() const
Definition: DecayTree.cxx:42
bool operator==(const CachedValue::Status &S, const CalculationStatus &s)
equality operator for checking the CalculationStatus
Definition: CachedValue.h:153
std::vector< const AmplitudeComponent * > AmplitudeComponents_
vector of AmplitudeComponent's
Definition: DecayTree.h:126
DecayTree(std::shared_ptr< FreeAmplitude > free_amp)
Definition: DecayTree.cxx:22
VariableStatus
Definition: VariableStatus.h:29
Class holding vectors of fixed and free amplitudes that define a decay tree.
Definition: DecayTree.h:49
DaughterDecayTreeMap DaughterDecayTrees_
map of daughter index -> daughter DecayTree
Definition: DecayTree.h:129
Definition: AmplitudeComponent.h:41
Class for holding data and cached values per data point for fast calculation.
Definition: DataPoint.h:35
unsigned depth(const DecayTree &DT)
Definition: DecayTree.cxx:203
void addAmplitudeComponent(const AmplitudeComponent &rda)
Add an AmplitudeComponent.
Definition: DecayTree.cxx:148
const DecayTreeVector select_changed(const DecayTreeVector &dtv)
Definition: DecayTree.cxx:218
const bool has_changed(const std::shared_ptr< DecayTree > &dt)
Definition: DecayTree.cxx:212
void setDaughterSpinProjection(unsigned i, int two_m)
Definition: DecayTree.h:111
Class implementing a PWA model.
Definition: Model.h:56
const VariableStatus dataDependentAmplitudeStatus() const
Definition: DecayTree.cxx:106
const double intensity(const DecayTreeVector &dtv, const DataPoint &d)
Definition: DecayTree.h:167
const std::complex< double > dataIndependentAmplitude() const
Definition: DecayTree.cxx:121
FreeAmplitudeSet free_amplitudes(const DecayingParticle &dp)
Definition: DecayingParticle.cxx:377
std::shared_ptr< DecayingParticle > decayingParticle() const
Definition: DecayTree.cxx:162
const std::complex< double > dataDependentAmplitude(const DataPoint &d) const
Definition: DecayTree.cxx:79
const std::shared_ptr< FreeAmplitude > & freeAmplitude() const
Definition: DecayTree.h:80
std::string to_string(const CachedValue::Status &S)
streaming operator for CachedValue::Status
Definition: CachedValue.cxx:27
SpinProjectionVector DaughtersTwoM_
daughter spin projections
Definition: DecayTree.h:123
Definition: DecayingParticle.h:51
Class for a particle that will decay and has a mass shape.
Definition: Resonance.h:47
std::shared_ptr< FreeAmplitude > FreeAmplitude_
ComplexParameter of the free amplitude for the decay.
Definition: DecayTree.h:120
std::map< unsigned, std::shared_ptr< DecayTree > > DaughterDecayTreeMap
Definition: DecayTree.h:55
const DaughterDecayTreeMap daughterDecayTrees() const
Definition: DecayTree.h:84
void setDaughterDecayTree(unsigned i, std::shared_ptr< DecayTree > dt)
Definition: DecayTree.cxx:132
Class implementing a decay channel.
Definition: DecayChannel.h:40