4747#include < hydra/functions/Ipatia.h>
4848#include < hydra/device/System.h>
4949#include < hydra/functions/ConvolutionFunctor.h>
50- #include < hydra/Random.h>
50+ #include < hydra/GaussKronrodQuadrature.h>
51+
5152// hydra
5253#if HYDRA_DEVICE_SYSTEM == CUDA
5354#include < hydra/CuFFT.h>
@@ -112,9 +113,9 @@ int main(int argv, char** argc)
112113
113114 // gaussian
114115 auto mean = hydra::Parameter::Create ( " mean" ).Value (0.0 ).Error (0.0001 );
115- auto sigma = hydra::Parameter::Create (" sigma" ).Value (3.5 ).Error (0.0001 );
116+ auto sigma = hydra::Parameter::Create (" sigma" ).Value (1.0 ).Error (0.0001 );
116117
117- hydra::Gaussian<double > gaussian_kernel (mean, sigma);
118+ hydra::Gaussian<double > kernel (mean, sigma);
118119
119120 // ===========================
120121 // signals
@@ -162,7 +163,7 @@ int main(int argv, char** argc)
162163 auto start_d = std::chrono::high_resolution_clock::now ();
163164
164165 hydra::convolute (hydra::device::sys, fft_backend,
165- signal, gaussian_kernel , min, max, conv_result, true );
166+ signal, kernel , min, max, conv_result, true );
166167
167168 auto end_d = std::chrono::high_resolution_clock::now ();
168169
@@ -176,7 +177,22 @@ int main(int argv, char** argc)
176177 /*
177178 * using the hydra::ConvolutionFunctor
178179 */
179- auto convoluton = hydra::make_convolution<double >( hydra::device::sys, fft_backend, signal, gaussian_kernel, min, max, conv_result.size () );
180+ auto convoluton = hydra::make_convolution<double >( hydra::device::sys, fft_backend,
181+ signal, kernel, min, max, conv_result.size () );
182+
183+ hydra::GaussKronrodQuadrature<61 ,100 , hydra::device::sys_t > GKQ61_Kernel (-25.0 , 25.0 );
184+ hydra::GaussKronrodQuadrature<61 ,100 , hydra::device::sys_t > GKQ61_Signal (min, max);
185+
186+ auto kernel_int = GKQ61_Kernel.Integrate (kernel);
187+ auto signal_int = GKQ61_Signal.Integrate (signal);
188+ auto convol_int = GKQ61_Signal.Integrate (convoluton);
189+
190+ std::cout << " ===========================================" << std::endl;
191+ std::cout << " Kernel Integral: " <<kernel_int.first <<" +/-" << kernel_int.second << std::endl;
192+ std::cout << " Signal Integral: " <<signal_int.first <<" +/-" << signal_int.second << std::endl;
193+ std::cout << " Convol Integral: " <<convol_int.first <<" +/-" << convol_int.second << std::endl;
194+ std::cout << " ===========================================" << std::endl;
195+
180196
181197 // ------------------------
182198 // ------------------------
@@ -193,7 +209,7 @@ int main(int argv, char** argc)
193209 hist_convol_functor->SetBinContent (i, convoluton (hist_convol_functor->GetBinCenter (i)) );
194210 hist_convol->SetBinContent (i, conv_result[i-1 ] );
195211 hist_signal->SetBinContent (i, signal (hist_signal->GetBinCenter (i) ) );
196- hist_kernel->SetBinContent (i, gaussian_kernel ( hist_kernel->GetBinCenter (i)));
212+ hist_kernel->SetBinContent (i, kernel ( hist_kernel->GetBinCenter (i)));
197213 }
198214#endif // _ROOT_AVAILABLE_
199215
0 commit comments