meerkat is hosted by Hepforge, IPPP Durham
Meerkat  v1r3
Multidimensional kernel density estimation package
DalitzPhaseSpace.cpp
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <vector>
3 #include <stdlib.h>
4 
5 #include "TMath.h"
6 
7 #include "DalitzPhaseSpace.hh"
8 
9 #include "Logger.hh"
10 
11 DalitzPhaseSpace::DalitzPhaseSpace(const char* phspName,
12  Double_t md,
13  Double_t ma,
14  Double_t mb,
15  Double_t mc) : AbsPhaseSpace(phspName) {
16 
17  m_a = ma;
18  m_b = mb;
19  m_c = mc;
20  m_d = md;
21 
22  Logger::print(0,"%20.20s INFO: Creating Dalitz phase space for mother of mass %f and daughters of masses %f, %f, %f\n",
23  m_name, m_d, m_a, m_b, m_c);
24 
25  m_a2 = m_a*m_a;
26  m_b2 = m_b*m_b;
27  m_c2 = m_c*m_c;
28  m_d2 = m_d*m_d;
29  m_SqSum = m_d2 + m_a2 + m_b2 + m_c2;
30 
31  m_MinAB = TMath::Power(m_a + m_b, 2);
32  m_MaxAB = TMath::Power(m_d - m_c, 2);
33  m_MinBC = TMath::Power(m_b + m_c, 2);
34  m_MaxBC = TMath::Power(m_d - m_a, 2);
35 }
36 
38 
39 }
40 
41 Bool_t DalitzPhaseSpace::withinLimits(std::vector<Double_t> &x) {
42 
43  Double_t m2ab = x[0];
44  Double_t m2bc = x[1];
45 
46 // Logger::print(0,"%f %f %f %f %f %f\n", m2ab, m2bc, m_MinAB, m_MinBC, m_MaxAB, m_MaxBC);
47 
48  if (m2ab < m_MinAB || m2ab > m_MaxAB || m2bc < m_MinBC || m2bc > m_MaxBC) return 0;
49 
50 // Logger::print(0,"1\n");
51 
52  Double_t eb = (m2ab - m_a2 + m_b2)/2./TMath::Sqrt(m2ab);
53  Double_t ec = (m_d2 - m2ab - m_c2)/2./TMath::Sqrt(m2ab);
54 
55  Double_t p2b = TMath::Power(eb, 2) - m_b2;
56  Double_t p2c = TMath::Power(ec, 2) - m_c2;
57 
58  if (p2c<0 || p2b<0) return 0;
59 
60 // Logger::print(0,"2\n");
61 
62  Double_t m2bc_max = TMath::Power(eb+ec, 2) - TMath::Power(sqrt(p2b) - sqrt(p2c), 2);
63  Double_t m2bc_min = TMath::Power(eb+ec, 2) - TMath::Power(sqrt(p2b) + sqrt(p2c), 2);
64 
65  if (m2bc < m2bc_min || m2bc > m2bc_max) return 0;
66 
67 // Logger::print(0,"3\n");
68 
69  return 1;
70 }
71 
72 Double_t DalitzPhaseSpace::lowerLimit(UInt_t var) {
73  switch(var) {
74  case 0: return m_MinAB;
75  case 1: return m_MinBC;
76  default:
77  Logger::print(2,"%20.20s ERROR: var=%d for lower limit of 2D phase space\n", m_name, var);
78  abort();
79  }
80 }
81 
82 Double_t DalitzPhaseSpace::upperLimit(UInt_t var) {
83  switch(var) {
84  case 0: return m_MaxAB;
85  case 1: return m_MaxBC;
86  default:
87  Logger::print(2,"%20.20s ERROR: var=%d for upper limit of 2D phase space\n", m_name, var);
88  abort();
89  }
90 }
91 
92 Bool_t DalitzPhaseSpace::limits(UInt_t var, std::vector<Double_t> &x,
93  Double_t* lower, Double_t* upper) {
94 
95  if (var == 0) { // AB
96  Double_t m2bc = x[1];
97  if (m2bc < m_MinBC || m2bc > m_MaxBC) return 0;
98 
99  Double_t eb = (m2bc + m_b2 - m_c2)/2./TMath::Sqrt(m2bc);
100  Double_t ea = (m_d2 - m2bc - m_a2)/2./TMath::Sqrt(m2bc);
101 
102  Double_t p2b = TMath::Power(eb, 2) - m_b2;
103  Double_t p2a = TMath::Power(ea, 2) - m_a2;
104 
105  if (p2a<0 || p2b<0) return 0;
106 
107 // Logger::print(0,"2\n");
108 
109  *upper = TMath::Power(ea+eb, 2) - TMath::Power(sqrt(p2a) - sqrt(p2b), 2);
110  *lower = TMath::Power(ea+eb, 2) - TMath::Power(sqrt(p2a) + sqrt(p2b), 2);
111 
112  }
113  else if (var == 1) { // BC
114 
115  Double_t m2ab = x[0];
116  if (m2ab < m_MinAB || m2ab > m_MaxAB) return 0;
117 
118  Double_t eb = (m2ab - m_a2 + m_b2)/2./TMath::Sqrt(m2ab);
119  Double_t ec = (m_d2 - m2ab - m_c2)/2./TMath::Sqrt(m2ab);
120 
121  Double_t p2b = TMath::Power(eb, 2) - m_b2;
122  Double_t p2c = TMath::Power(ec, 2) - m_c2;
123 
124  if (p2c<0 || p2b<0) return 0;
125 
126 // Logger::print(0,"2\n");
127 
128  *upper = TMath::Power(eb+ec, 2) - TMath::Power(sqrt(p2b) - sqrt(p2c), 2);
129  *lower = TMath::Power(eb+ec, 2) - TMath::Power(sqrt(p2b) + sqrt(p2c), 2);
130 
131  } else {
132  Logger::print(2,"%20.20s ERROR: var=%d for limits of 2D phase space\n", m_name, var);
133  abort();
134  }
135 
136  return 1;
137 
138 }
Double_t lowerLimit(UInt_t var)
Get lower limit.
Double_t m_a
Mass of the particle A.
Double_t m_c
Mass of the particle C.
Double_t m_d
Mass of the mother particle.
Double_t m_MaxBC
Upper limit of BC invariant mass values.
char m_name[256]
Phase space name.
Double_t upperLimit(UInt_t var)
Get upper limit.
Double_t m_MinBC
Lower limit of BC invariant mass values.
Double_t m_c2
Squared mass of the particle C.
void print(int level, const char *format,...)
Definition: Logger.cpp:27
Bool_t limits(UInt_t var, std::vector< Double_t > &x, Double_t *lower, Double_t *upper)
Return limits (lower and upper) for the variable at the certain point of the phase space...
Double_t m_d2
Squared mass of the mother particle.
Double_t m_b
Mass of the particle B.
Abstract class which defines phase space interface.
Double_t m_b2
Squared mass of the particle B.
DalitzPhaseSpace(const char *phaseSpaceName, Double_t mD, Double_t mA, Double_t mB, Double_t mC)
Constructor.
Bool_t withinLimits(std::vector< Double_t > &x)
Check if the point is within the phase space limits.
Double_t m_SqSum
Sum of squared masses of daughter and mother particles.
Double_t m_MaxAB
Upper limit of AB invariant mass values.
Double_t m_a2
Squared mass of the particle A.
Double_t m_MinAB
Lower limit of AB invariant mass values.
virtual ~DalitzPhaseSpace()
Destructor.