GooFit  v2.1.3
DalitzPlotPdf.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <goofit/PDFs/GooPdf.h>
5 
7 
8 namespace GooFit {
9 
10 class SpecialResonanceIntegrator;
11 class SpecialResonanceCalculator;
12 class DalitzPlotter;
13 
14 class DalitzPlotPdf : public GooPdf {
15  public:
16  DalitzPlotPdf(std::string n,
20  DecayInfo3 decay,
21  GooPdf *eff = nullptr);
22  // Note that 'efficiency' refers to anything which depends on (m12, m13) and multiplies the
23  // coherent sum. The caching method requires that it be done this way or the ProdPdf
24  // normalisation will get *really* confused and give wrong answers.
25 
26  __host__ fptype normalize() const override;
27  __host__ void setDataSize(unsigned int dataSize, unsigned int evtSize = 3);
28  __host__ void setForceIntegrals(bool f = true) { forceRedoIntegrals = f; }
29 
31  __host__ const thrust::device_vector<fpcomplex> &getCachedWaveNoCopy(size_t i) const { return *(cachedWaves[i]); }
32 
33  __host__ const std::vector<std::complex<fptype>> getCachedWave(size_t i) const;
34 
36  __host__ fpcomplex sumCachedWave(size_t i) const;
37 
39  __host__ DecayInfo3 &getDecayInfo() { return decayInfo; }
40 
42  __host__ std::vector<std::vector<fptype>> fit_fractions();
43 
44  friend DalitzPlotter;
45 
46  protected:
52 
53  // Following variables are useful if masses and widths, involved in difficult BW calculation,
54  // change infrequently while amplitudes, only used in adding BW results together, change rapidly.
55  thrust::device_vector<fpcomplex> *cachedWaves[16]; // Caches the BW values for each event.
56  fpcomplex ***integrals; // Caches the integrals of the BW waves for each combination of resonances.
57 
58  bool *redoIntegral;
59  mutable bool forceRedoIntegrals;
66 };
67 
68 class SpecialResonanceIntegrator : public thrust::unary_function<thrust::tuple<int, fptype *>, fpcomplex> {
69  public:
70  // Class used to calculate integrals of terms BW_i * BW_j^*.
71  SpecialResonanceIntegrator(int pIdx, unsigned int ri, unsigned int rj);
72  __device__ fpcomplex operator()(thrust::tuple<int, fptype *> t) const;
73 
74  private:
75  unsigned int resonance_i;
76  unsigned int resonance_j;
77  unsigned int parameters;
78 };
79 
80 class SpecialResonanceCalculator : public thrust::unary_function<thrust::tuple<int, fptype *, int>, fpcomplex> {
81  public:
82  // Used to create the cached BW values.
83  SpecialResonanceCalculator(int pIdx, unsigned int res_idx);
84  __device__ fpcomplex operator()(thrust::tuple<int, fptype *, int> t) const;
85 
86  private:
87  unsigned int resonance_i;
88  unsigned int parameters;
89 };
90 
91 } // namespace GooFit
double fptype
__host__ fpcomplex sumCachedWave(size_t i) const
Sum up a cached wave.
__host__ std::vector< std::vector< fptype > > fit_fractions()
Calculate fit fractions (Cache should be pre-filled)
Observable * m12
Special class for observables. Used in DataSets.
Definition: Variable.h:109
unsigned int parameters
Definition: PdfBase.h:132
thrust::complex< fptype > fpcomplex
Definition: Complex.h:8
SpecialResonanceCalculator ** calculators
Definition: DalitzPlotPdf.h:65
Observable * m13
fpcomplex *** integrals
Definition: DalitzPlotPdf.h:56
EventNumber _eventNumber
Definition: DalitzPlotPdf.h:50
__host__ const std::vector< std::complex< fptype > > getCachedWave(size_t i) const
EventNumber * eventNumber
thrust::device_vector< fpcomplex > * cachedWaves[16]
Definition: DalitzPlotPdf.h:55
__host__ const thrust::device_vector< fpcomplex > & getCachedWaveNoCopy(size_t i) const
Get the cached wave (device) vectors.
Definition: DalitzPlotPdf.h:31
__host__ DecayInfo3 & getDecayInfo()
Get the decay info struct.
Definition: DalitzPlotPdf.h:39
__host__ fptype normalize() const override
A normalize function. This fills in the host_normalize.
__host__ void setForceIntegrals(bool f=true)
Definition: DalitzPlotPdf.h:28
__host__ void setDataSize(unsigned int dataSize, unsigned int evtSize=3)
DalitzPlotPdf(std::string n, Observable m12, Observable m13, EventNumber eventNumber, DecayInfo3 decay, GooPdf *eff=nullptr)
SpecialResonanceIntegrator *** integrators
Definition: DalitzPlotPdf.h:64