YAP
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FourMomenta.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_FourMomenta_
22 #define yap_FourMomenta_
23 
24 #include "fwd/CachedValue.h"
25 #include "fwd/DataPoint.h"
26 #include "fwd/FinalStateParticle.h"
27 #include "fwd/FourVector.h"
28 #include "fwd/MassAxes.h"
29 #include "fwd/Model.h"
30 #include "fwd/ParticleCombination.h"
31 #include "fwd/StatusManager.h"
32 
33 #include "StaticDataAccessor.h"
34 
35 #include <cmath>
36 #include <iostream>
37 #include <memory>
38 #include <vector>
39 
40 namespace yap {
41 
46 {
47 public:
48 
52 
54  bool consistent() const;
55 
59  virtual void calculate(DataPoint& d, StatusManager& sm) const override;
60 
63 
67  FourVector<double> p(const DataPoint& d, const std::shared_ptr<ParticleCombination>& pc) const;
68 
72  double m2(const DataPoint& d, const std::shared_ptr<ParticleCombination>& pc) const
73  { return pow(m(d, pc), 2); }
74 
78  double m(const DataPoint& d, const std::shared_ptr<ParticleCombination>& pc) const;
79 
82  const FourVector<double> totalMomentum(const DataPoint& d) const;
83 
86  const std::vector<FourVector<double> > finalStateMomenta(const DataPoint& d) const;
87 
89  std::shared_ptr<RealCachedValue> mass()
90  { return M_; }
91 
93  std::shared_ptr<RealCachedValue> mass() const
94  { return M_; }
95 
97  std::shared_ptr<FourVectorCachedValue> momentum()
98  { return P_; }
99 
101  std::shared_ptr<FourVectorCachedValue> momentum() const
102  { return P_; }
103 
105 
107  std::ostream& printMasses(const DataPoint& d, std::ostream& os = std::cout) const;
108 
110  friend class Model;
111 
113  friend class DataAccessor;
114 
115 protected:
116 
121  void setFinalStateMomenta(DataPoint& d, const std::vector<FourVector<double> >& P, StatusManager& sm) const;
122 
124  void addParticleCombination(std::shared_ptr<ParticleCombination> pc) override;
125 
128  {}
129 
130 private:
131 
134 
136  std::vector<int> FSPIndices_;
137 
139  std::shared_ptr<FourVectorCachedValue> P_;
140 
142  std::shared_ptr<RealCachedValue> M_;
143 
144 };
145 
151 std::vector<FourVector<double> > calculate_four_momenta(double initial_mass, const FinalStateParticleVector& FPSs,
152  const MassAxes& axes, const std::vector<double>& squared_masses);
153 
160 std::vector<FourVector<double> > calculate_four_momenta(double initial_mass, const Model& M,
161  const MassAxes& axes, const std::vector<double>& squared_masses);
162 
163 }
164 #endif
165 
std::vector< FourVector< double > > calculate_four_momenta(double initial_mass, const FinalStateParticleVector &FPSs, const MassAxes &axes, const std::vector< double > &squared_masses)
Definition: FourMomenta.cxx:218
bool consistent() const
check consistency
Definition: FourMomenta.cxx:65
void setFinalStateMomenta(DataPoint &d, const std::vector< FourVector< double > > &P, StatusManager &sm) const
Definition: FourMomenta.cxx:32
void addParticleCombination(std::shared_ptr< ParticleCombination > pc) override
looks for ISP when adding ParticleCombination's
Definition: FourMomenta.cxx:46
std::shared_ptr< FourVectorCachedValue > momentum() const
Definition: FourMomenta.h:101
double m(const DataPoint &d, const std::shared_ptr< ParticleCombination > &pc) const
Definition: FourMomenta.cxx:111
Four-Vector handling.
Definition: FourVector.h:41
ParticleCombinationVector specialized to contain axes for defining a phase-space coordinate.
Definition: MassAxes.h:31
FourVector< double > p(const DataPoint &d, const std::shared_ptr< ParticleCombination > &pc) const
Definition: FourMomenta.cxx:105
std::shared_ptr< RealCachedValue > M_
invariant mass of particle combinations [GeV]
Definition: FourMomenta.h:142
std::shared_ptr< FourVectorCachedValue > momentum()
Definition: FourMomenta.h:97
std::shared_ptr< RealCachedValue > mass()
Definition: FourMomenta.h:89
std::shared_ptr< RealCachedValue > mass() const
Definition: FourMomenta.h:93
Class for holding data and cached values per data point for fast calculation.
Definition: DataPoint.h:35
Base class for all data accessors that will only write to DataPoint once at initial data loading...
Definition: StaticDataAccessor.h:36
int TotalIndex_
Symmetrization index of an initial state that is composed from ALL final state particles.
Definition: FourMomenta.h:133
std::vector< int > FSPIndices_
Symmetrization indices of final states.
Definition: FourMomenta.h:136
double m2(const DataPoint &d, const std::shared_ptr< ParticleCombination > &pc) const
Definition: FourMomenta.h:72
Definition: StatusManager.h:32
Class implementing a PWA model.
Definition: Model.h:56
const std::vector< FourVector< double > > finalStateMomenta(const DataPoint &d) const
Definition: FourMomenta.cxx:91
Stores and gives access to four-momenta and invariant masses.
Definition: FourMomenta.h:45
virtual void calculate(DataPoint &d, StatusManager &sm) const override
Definition: FourMomenta.cxx:117
std::ostream & printMasses(const DataPoint &d, std::ostream &os=std::cout) const
print all masses
Definition: FourMomenta.cxx:153
Abstract base class for all objects accessing DataPoint's.
Definition: DataAccessor.h:38
void pruneSymmetrizationIndices() override
override to do nothing, since FourMomenta doesn't rely on parents being set.
Definition: FourMomenta.h:127
FourMomenta(Model &m)
Definition: FourMomenta.cxx:22
std::shared_ptr< FourVectorCachedValue > P_
four-vector of particle combinations
Definition: FourMomenta.h:139
const FourVector< double > totalMomentum(const DataPoint &d) const
Definition: FourMomenta.cxx:83