GooFit  v2.1.3
DalitzVetoPdf.cu
Go to the documentation of this file.
1 #include <goofit/PDFs/physics/DalitzPlotHelpers.h>
2 #include <goofit/PDFs/physics/DalitzVetoPdf.h>
3 
4 namespace GooFit {
5 
6 __device__ fptype device_DalitzVeto(fptype *evt, fptype *p, unsigned int *indices) {
7  fptype x = evt[RO_CACHE(indices[2 + RO_CACHE(indices[0]) + 0])];
8  fptype y = evt[RO_CACHE(indices[2 + RO_CACHE(indices[0]) + 1])];
9 
10  fptype motherM = RO_CACHE(p[RO_CACHE(indices[1])]);
11  fptype d1m = RO_CACHE(p[RO_CACHE(indices[2])]);
12  fptype d2m = RO_CACHE(p[RO_CACHE(indices[3])]);
13  fptype d3m = RO_CACHE(p[RO_CACHE(indices[4])]);
14 
15  fptype massSum = motherM * motherM + d1m * d1m + d2m * d2m + d3m * d3m;
16  fptype z = massSum - x - y;
17 
18  fptype ret = inDalitz(x, y, motherM, d1m, d2m, d3m) ? 1.0 : 0.0;
19  unsigned int numVetos = RO_CACHE(indices[5]);
20 
21  for(int i = 0; i < numVetos; ++i) {
22  unsigned int varIndex = indices[6 + i * 3 + 0];
23  fptype minimum = RO_CACHE(p[RO_CACHE(indices[6 + i * 3 + 1])]);
24  fptype maximum = RO_CACHE(p[RO_CACHE(indices[6 + i * 3 + 2])]);
25  fptype currDalitzVar = (PAIR_12 == varIndex ? x : PAIR_13 == varIndex ? y : z);
26 
27  ret *= ((currDalitzVar < maximum) && (currDalitzVar > minimum)) ? 0.0 : 1.0;
28  }
29 
30  return ret;
31 }
32 
33 __device__ device_function_ptr ptr_to_DalitzVeto = device_DalitzVeto;
34 
35 __host__ DalitzVetoPdf::DalitzVetoPdf(std::string n,
36  Observable _x,
37  Observable _y,
38  Variable motherM,
39  Variable d1m,
40  Variable d2m,
41  Variable d3m,
42  std::vector<VetoInfo> vetos)
43  : GooPdf(n, _x, _y) {
44  std::vector<unsigned int> pindices;
45  pindices.push_back(registerParameter(motherM));
46  pindices.push_back(registerParameter(d1m));
47  pindices.push_back(registerParameter(d2m));
48  pindices.push_back(registerParameter(d3m));
49 
50  pindices.push_back(vetos.size());
51 
52  for(auto &veto : vetos) {
53  pindices.push_back(veto.cyclic_index);
54  pindices.push_back(registerParameter(veto.minimum));
55  pindices.push_back(registerParameter(veto.maximum));
56  }
57 
58  GET_FUNCTION_ADDR(ptr_to_DalitzVeto);
59  initialize(pindices);
60 }
61 } // namespace GooFit