GooFit  v2.1.3
Macros.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <goofit/Log.h>
4 
5 // The following macros help with registering new values
6 
7 #define GOOFIT_START_PDF \
8  std::vector<unsigned int> pindices; \
9  pindices.push_back(0);
10 
11 #define GOOFIT_ADD_PARAM(i, par, name) \
12  { \
13  pindices.push_back(registerParameter((par))); \
14  if((i) != pindices.size()) \
15  throw GooFit::GeneralError( \
16  "{}: Param {} {} actually has number {}", getName(), (name), (i), pindices.size()); \
17  }
18 
19 #define GOOFIT_ADD_OBS(par) {registarObservable((par))};
20 
21 #define GOOFIT_ADD_CONST(i, par, name) \
22  { \
23  pindices.push_back(registerConstants(1)); \
24  MEMCPY_TO_SYMBOL(functorConstants, &(par), sizeof par, cIndex * sizeof par, cudaMemcpyHostToDevice); \
25  if((i) != pindices.size()) \
26  throw GooFit::GeneralError( \
27  "{}: Const {} {} actually has number {}", getName(), (name), (i), pindices.size()); \
28  GOOFIT_DEBUG("{}: Registered constant value {}={} at c:{}", getName(), (name), (par), pindices.size()); \
29  }
30 
31 #define GOOFIT_ADD_INT(i, par, name) \
32  { \
33  GOOFIT_DEBUG("{}: Registered integer {} at {}", getName(), (name), (par), pindices.size()); \
34  pindices.push_back((par)); \
35  if((i) != pindices.size()) \
36  throw GooFit::GeneralError( \
37  "{}: Int {} {} actually has number {}", getName(), (name), (i), pindices.size()); \
38  }
39 
40 #define GOOFIT_FINALIZE_PDF \
41  initialize(pindices); \
42  GOOFIT_DEBUG("{}: Initializing indices", getName());
43 
44 #define GOOFIT_GET_PARAM(i) cudaArray[indices[(i)]]
45 #define GOOFIT_GET_INT(i) indices[(i)]
46 #define GOOFIT_GET_CONST(i) functorConstants[indices[(i)]]
47 
48 #define GOOFIT_PDF_IMPL_1(n) __device__ fptype #n(fptype *evt, fptype *p, unsigned int *indices)
49 #define GOOFIT_PDF_IMPL_3(n) __device__ fpcomplex #n(fptype Mpair, fptype m1, fptype m2, unsigned int *indices)