#ifndef CONVOLUTE_FUNCTIONS_INL_
#define CONVOLUTE_FUNCTIONS_INL_
#include <iostream>
#include <assert.h>
#include <time.h>
#include <chrono>
#include <vector>
#if HYDRA_DEVICE_SYSTEM == CUDA
#endif
#if HYDRA_DEVICE_SYSTEM != CUDA
#endif
#include <tclap/CmdLine.h>
#ifdef _ROOT_AVAILABLE_
#include <TROOT.h>
#include <TH1D.h>
#include <TApplication.h>
#include <TCanvas.h>
#endif //_ROOT_AVAILABLE_
{
try {
TCLAP::CmdLine cmd("Command line arguments for ", '=');
TCLAP::ValueArg<size_t>
EArg(
"n",
"number-of-samples",
"Number of samples",
true, 10e6,
"size_t");
}
catch (TCLAP::ArgException &e) {
std::cerr << "error: " << e.error() << " for arg " << e.argId()
<< std::endl;
}
#if HYDRA_DEVICE_SYSTEM==CUDA
#endif
#if HYDRA_DEVICE_SYSTEM!=CUDA
#endif
auto start_d = std::chrono::high_resolution_clock::now();
signal, kernel,
min,
max, conv_result,
true);
auto end_d = std::chrono::high_resolution_clock::now();
std::chrono::duration<double, std::milli>
elapsed_d = end_d - start_d;
std::cout << "-----------------------------------------"<<std::endl;
std::cout <<
"| Time (ms) ="<<
elapsed_d.count() <<std::endl;
std::cout << "-----------------------------------------"<<std::endl;
signal, kernel,
min,
max, conv_result.size() );
auto kernel_int = GKQ61_Kernel.Integrate(kernel);
auto signal_int = GKQ61_Signal.Integrate(signal);
auto convol_int = GKQ61_Signal.Integrate(convoluton);
std::cout << "===========================================" << std::endl;
std::cout << "Kernel Integral: " <<kernel_int.first <<"+/-"<< kernel_int.second << std::endl;
std::cout << "Signal Integral: " <<signal_int.first <<"+/-"<< signal_int.second << std::endl;
std::cout << "Convol Integral: " <<convol_int.first <<"+/-"<< convol_int.second << std::endl;
std::cout << "===========================================" << std::endl;
#ifdef _ROOT_AVAILABLE_
TH1D *hist_convol =
new TH1D(
"convol",
"Convolution result", conv_result.size(),
min,
max);
TH1D *hist_convol_functor =
new TH1D(
"convol_functor",
"Convolution functor", conv_result.size(),
min,
max);
TH1D *hist_signal =
new TH1D(
"signal",
"Signal", conv_result.size(),
min,
max);
TH1D *hist_kernel =
new TH1D(
"kernel",
"Gaussian resolution model: bias 1.0 and width 0.5)", conv_result.size(), -0.5*(
max-
min),0.5*(
max-
min) );
for(int i=1; i<hist_convol->GetNbinsX()+1; i++){
hist_convol_functor->SetBinContent(i, convoluton(hist_convol_functor->GetBinCenter(i)) );
hist_convol->SetBinContent(i, conv_result[i-1] );
hist_signal->SetBinContent(i, signal(hist_signal->GetBinCenter(i) ) );
hist_kernel->SetBinContent(i, kernel(hist_kernel->GetBinCenter(i) ) );
}
#endif //_ROOT_AVAILABLE_
#ifdef _ROOT_AVAILABLE_
TApplication *myapp=new TApplication("myapp",0,0);
TCanvas* canvas = new TCanvas("canvas" ,"canvas", 1500, 1000);
canvas->Divide(2,2);
hist_convol->SetStats(0);
hist_convol->SetLineColor(4);
hist_convol->SetLineWidth(2);
hist_convol->Draw("histl");
hist_convol_functor->SetStats(0);
hist_convol_functor->SetLineColor(8);
hist_convol_functor->SetLineWidth(2);
hist_convol_functor->Draw("histl");
hist_signal->SetStats(0);
hist_signal->SetLineColor(2);
hist_signal->SetLineWidth(2);
hist_signal->Draw("histl");
auto c4 = canvas->cd(4);
hist_kernel->SetStats(0);
hist_kernel->SetLineColor(6);
hist_kernel->SetLineWidth(2);
c4->SetGrid();
hist_kernel->Draw("hist");
myapp->Run();
#endif //_ROOT_AVAILABLE_
convoluton.Dispose();
return 0;
}
#endif