laura is hosted by Hepforge, IPPP Durham
Laura++  v3r5
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauDPPartialIntegralInfo.cc
Go to the documentation of this file.
1 
2 /*
3 Copyright 2014 University of Warwick
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17 
18 /*
19 Laura++ package authors:
20 John Back
21 Paul Harrison
22 Thomas Latham
23 */
24 
29 #include <iostream>
30 
32 #include "LauIntegrals.hh"
33 #include "LauKinematics.hh"
34 
36 
37 
38 LauDPPartialIntegralInfo::LauDPPartialIntegralInfo(const Double_t minm13, const Double_t maxm13,
39  const Double_t minm23, const Double_t maxm23,
40  const Double_t m13BinWidth, const Double_t m23BinWidth,
41  const Double_t precision,
42  const UInt_t nAmp,
43  const UInt_t nIncohAmp,
44  const Bool_t squareDP,
45  const LauKinematics* kinematics) :
46  minm13_(minm13),
47  maxm13_(maxm13),
48  minm23_(minm23),
49  maxm23_(maxm23),
50  m13BinWidth_(m13BinWidth),
51  m23BinWidth_(m23BinWidth),
52  nm13Points_(static_cast<UInt_t>((maxm13-minm13)/m13BinWidth)),
53  nm23Points_(static_cast<UInt_t>((maxm23-minm23)/m23BinWidth)),
54  nAmp_(nAmp),
55  nIncohAmp_(nIncohAmp),
56  squareDP_(squareDP)
57 {
58  const Double_t meanm13 = 0.5*(minm13 + maxm13);
59  const Double_t rangem13 = maxm13 - minm13;
60  const Double_t halfRangem13 = 0.5*rangem13;
61 
62  const Double_t meanm23 = 0.5*(minm23 + maxm23);
63  const Double_t rangem23 = maxm23 - minm23;
64  const Double_t halfRangem23 = 0.5*rangem23;
65 
66  const Double_t intFactor = halfRangem13*halfRangem23;
67 
68  // Raise error if squareDP is true but the kinematics object is not provided
69  if ( squareDP_ && kinematics == 0 ) {
70  std::cerr << "ERROR in LauDPPartialIntegralInfo constructor : Integration in the square DP has been specified but no valid kinematics object has been provided!" << std::endl;
71  return;
72  }
73 
74  // Avoid integral if we have no points in either x or y space
75  if (nm13Points_ == 0 || nm23Points_ == 0) {
76  std::cerr << "ERROR in LauDPPartialIntegralInfo constructor : Range has zero grid points in one or both of the dimensions!" << std::endl;
77  return;
78  }
79 
80  // Print a warning if we have a very large number of points
81  if ( (nm13Points_ * nm23Points_) > 8000000 ) {
82  std::cerr << "WARNING in LauDPPartialIntegralInfo constructor : The integration binning scheme has a very large number of bins, this could cause high memory consumption!" << std::endl;
83  std::cerr << " : In case of problems, consider using LauIsobarDynamics::setNarrowResonanceThreshold and/or LauIsobarDynamics::setIntegralBinningFactor to tune the binning behaviour." << std::endl;
84  }
85 
86  LauIntegrals dpIntegrals(precision);
87  dpIntegrals.calcGaussLegendreWeights(nm13Points_, m13Points_, m13Weights_);
88  dpIntegrals.calcGaussLegendreWeights(nm23Points_, m23Points_, m23Weights_);
89 
90  // Print out total weights for the integration
91  Double_t totm13Weight(0.0), totm23Weight(0.0);
92  for (UInt_t i = 0; i < nm13Points_; ++i) {
93  totm13Weight += m13Weights_[i];
94  }
95  for (UInt_t i = 0; i < nm23Points_; ++i) {
96  totm23Weight += m23Weights_[i];
97  }
98 
99  if ( squareDP_ ) {
100  std::cout<<"INFO in LauDPPartialIntegralInfo constructor : nmPrimePoints = "<<nm13Points_<<", nthPrimePoints = "<<nm23Points_<<std::endl;
101  std::cout<<" : mPrimeBinWidth = "<<m13BinWidth_<<", thPrimeBinWidth = "<<m23BinWidth_<<std::endl;
102  std::cout<<" : Integrating over mPrime = "<<minm13_<<" to "<<maxm13_<<", thPrime = "<<minm23_<<" to "<<maxm23_<<std::endl;
103  std::cout<<" : totmPrimeWeight = "<<totm13Weight<<", totthPrimeWeight = "<<totm23Weight<<std::endl;
104  } else {
105  std::cout<<"INFO in LauDPPartialIntegralInfo constructor : nm13Points = "<<nm13Points_<<", nm23Points = "<<nm23Points_<<std::endl;
106  std::cout<<" : m13BinWidth = "<<m13BinWidth_<<", m23BinWidth = "<<m23BinWidth_<<std::endl;
107  std::cout<<" : Integrating over m13 = "<<minm13_<<" to "<<maxm13_<<", m23 = "<<minm23_<<" to "<<maxm23_<<std::endl;
108  std::cout<<" : totm13Weight = "<<totm13Weight<<", totm23Weight = "<<totm23Weight<<std::endl;
109  }
110 
111  // Calculate the m13 and m23 values at the grid points
112 
113  UInt_t midpoint = (nm13Points_ + 1)/2;
114  for (UInt_t i = 0; i < midpoint; ++i) {
115 
116  UInt_t ii = nm13Points_ - 1 - i; // symmetric i index
117 
118  Double_t dm13 = halfRangem13*m13Points_[i];
119  Double_t m13Val = meanm13 - dm13;
120  m13Points_[i] = m13Val;
121 
122  m13Val = meanm13 + dm13;
123  m13Points_[ii] = m13Val;
124 
125  }
126 
127  midpoint = (nm23Points_ +1)/2;
128  for (UInt_t i = 0; i < midpoint; i++) {
129 
130  UInt_t ii = nm23Points_ - 1 - i; // symmetric i index
131 
132  Double_t dm23 = halfRangem23*m23Points_[i];
133  Double_t m23Val = meanm23 - dm23;
134  m23Points_[i] = m23Val;
135 
136  m23Val = meanm23 + dm23;
137  m23Points_[ii] = m23Val;
138  }
139 
140  // Now compute the combined weights at each grid point
141  weights_.resize( nm13Points_ );
142  efficiencies_.resize( nm13Points_ );
143  amplitudes_.resize( nm13Points_ );
144  incohIntensities_.resize( nm13Points_ );
145  for (UInt_t i = 0; i < nm13Points_; ++i) {
146 
147  weights_[i].resize( nm23Points_ );
148  efficiencies_[i].resize( nm23Points_ );
149  amplitudes_[i].resize( nm23Points_ );
150  incohIntensities_[i].resize( nm23Points_ );
151 
152  for (UInt_t j = 0; j < nm23Points_; ++j) {
153 
154  Double_t weight = m13Weights_[i]*m23Weights_[j];
155 
156  Double_t jacobian(0.0);
157  if ( squareDP_ ) {
158  jacobian = kinematics->calcSqDPJacobian( m13Points_[i], m23Points_[j] );
159  } else {
160  jacobian = 4.0*m13Points_[i]*m23Points_[j];
161  }
162  weight *= (jacobian*intFactor);
163 
164  weights_[i][j] = weight;
165 
166  amplitudes_[i][j].resize( nAmp_ );
167  incohIntensities_[i][j].resize( nIncohAmp_ );
168 
169  } // j weights loop
170  } // i weights loop
171 }
172 
174 {
175 }
176 
177 std::ostream& operator<<( std::ostream& stream, const LauDPPartialIntegralInfo& infoRecord )
178 {
179  stream << "minm13 = " << infoRecord.getMinm13() << ", ";
180  stream << "maxm13 = " << infoRecord.getMaxm13() << ", ";
181  stream << "minm23 = " << infoRecord.getMinm23() << ", ";
182  stream << "maxm23 = " << infoRecord.getMaxm23() << ", ";
183  stream << "m13BinWidth = " << infoRecord.getM13BinWidth() << ", ";
184  stream << "m23BinWidth = " << infoRecord.getM23BinWidth() << std::endl;
185  return stream;
186 }
187 
Double_t getMinm13() const
Retrieve the minm13 of DP.
virtual ~LauDPPartialIntegralInfo()
Destructor.
ClassImp(LauAbsCoeffSet)
Double_t getM23BinWidth() const
Retrieve the m23BinWidth of DP.
Class for defining (a section of) the Dalitz plot integration binning scheme.
Class for performing numerical integration routines.
Definition: LauIntegrals.hh:44
File containing declaration of LauKinematics class.
void calcGaussLegendreWeights(const Int_t numPoints, std::vector< Double_t > &abscissas, std::vector< Double_t > &weights)
Calculate the Gauss-Legendre weights.
Definition: LauIntegrals.cc:64
std::ostream & operator<<(std::ostream &os, const LauComplex &z)
Definition: LauComplex.cc:57
File containing declaration of LauDPPartialIntegralInfo class.
Double_t getMaxm13() const
Retrieve the maxm13 of DP.
Double_t getMinm23() const
Retrieve the minm23 of DP.
Double_t getM13BinWidth() const
Retrieve the m13BinWidth of DP.
Double_t getMaxm23() const
Retrieve the maxm23 of DP.
File containing declaration of LauIntegrals class.
Class for calculating 3-body kinematic quantities.