Hydra
4.0.1
A header-only templated C++ framework to perform data analysis on massively parallel platforms.
|
#include <iostream>
#include <assert.h>
#include <time.h>
#include <chrono>
#include <random>
#include <algorithm>
#include <future>
#include <tclap/CmdLine.h>
#include <hydra/device/System.h>
#include <hydra/host/System.h>
#include <hydra/Function.h>
#include <hydra/Lambda.h>
#include <hydra/Random.h>
#include <hydra/Algorithm.h>
#include <hydra/Tuple.h>
#include <hydra/Distance.h>
#include <hydra/multiarray.h>
#include <hydra/multivector.h>
#include <hydra/LogLikelihoodFCN.h>
#include <hydra/Parameter.h>
#include <hydra/UserParameters.h>
#include <hydra/Pdf.h>
#include <hydra/AddPdf.h>
#include <hydra/Filter.h>
#include <hydra/Plain.h>
#include <hydra/DenseHistogram.h>
#include <hydra/functions/Gaussian.h>
#include <hydra/RandomFill.h>
#include "Minuit2/FunctionMinimum.h"
#include "Minuit2/MnUserParameterState.h"
#include "Minuit2/MnPrint.h"
#include "Minuit2/MnMigrad.h"
#include "Minuit2/MnMinimize.h"
#include "Minuit2/MnMinos.h"
#include "Minuit2/MnContours.h"
#include "Minuit2/CombinedMinimizer.h"
#include "Minuit2/MnPlot.h"
#include "Minuit2/MinosError.h"
#include "Minuit2/ContoursError.h"
#include "Minuit2/VariableMetricMinimizer.h"
Go to the source code of this file.
Macros | |
#define | MULTIDIMENSIONAL_FIT_INL_ |
Functions | |
cmd | add (EArg) |
catch (TCLAP::ArgException &e) | |
declarg (_X, double) declarg(_Y | |
double | declarg (_Z, double) int main(int argv |
TCLAP::ValueArg< size_t > | EArg ("n", "number-of-events", "Number of events", true, 10e6, "size_t") |
Hist_Data | Fill (range.begin(), range.end()) |
std::cout<< "minimum: "<< minimum_d<< std::endl;std::cout<< "-----------------------------------------"<< std::endl;std::cout<< "| GPU Time (ms) ="<< elapsed_d.count()<< std::endl;std::cout<< "-----------------------------------------"<< std::endl;hydra::DenseHistogram< double, 3, hydra::device::sys_t > | Hist_Data ({100, 100, 100}, {min, min, min}, {max, max, max }) |
cmd | parse (argv, argc) |
GaussianX_Handler | wait () |
Variables | |
double char ** | argc |
std::cout<< std::endl<< "Generated data:"<< std::endl;for(size_t i=0;i< 10;i++) std::cout<< "["<< i<< "] :"<< data_d[i]<< std::endl;auto filter=hydra::wrap_lambda([=] __hydra_dual__(_X x, _Y y, _Z z){ bool decision=((x > min) &&(x< max))&&((y > min) &&(y< max))&&((z > min) &&(z< max));return decision;});auto range=hydra::filter(data_d, filter);std::cout<< std::endl<< "Filtered data:"<< std::endl;for(size_t i=0;i< 10;i++) std::cout<< "["<< i<< "] :"<< range.begin()[i]<< std::endl;auto fcn=hydra::make_loglikehood_fcn(model, range);fcn.GetPDF().PrintRegisteredParameters();ROOT::Minuit2::MnPrint::SetGlobalLevel(3);hydra::Print::SetLevel(hydra::WARNING);MnStrategy strategy(2);MnMigrad migrad_d(fcn, fcn.GetParameters().GetMnState(), strategy);std::cout<< fcn.GetParameters().GetMnState()<< std::endl;auto start_d=std::chrono::high_resolution_clock::now();FunctionMinimum minimum_d=FunctionMinimum(migrad_d(5000, 5));auto end_d=std::chrono::high_resolution_clock::now();std::chrono::duration< double, std::milli > | elapsed_d = end_d - start_d |
auto | gaussian |
auto | GaussianX_Handler |
auto | GaussianY_Handler |
auto | GaussianZ_Handler |
hydra::Plain< 3, hydra::device::sys_t > | Integrator ({min, min, min},{ max, max, max }, 50000) |
double | max = 6.0 |
double | meanx = 0.0 |
hydra::Parameter | meanx_p |
double | meany = 0.0 |
hydra::Parameter | meany_p |
double | meanz = 0.0 |
hydra::Parameter | meanz_p |
double | min = -6.0 |
auto | model = hydra::make_pdf(gaussian, Integrator) |
nentries = EArg.getValue() | |
return | |
double | sigmax = 0.5 |
hydra::Parameter | sigmax_p |
double | sigmay = 1.5 |
hydra::Parameter | sigmay_p |
double | sigmaz = 1.0 |
hydra::Parameter | sigmaz_p |
try | |
#define MULTIDIMENSIONAL_FIT_INL_ |
cmd add | ( | EArg | ) |
catch | ( | TCLAP::ArgException & | e | ) |
declarg | ( | _X | , |
double | |||
) |
TCLAP::ValueArg< size_t > EArg | ( | "n" | , |
"number-of-events" | , | ||
"Number of events" | , | ||
true | , | ||
10e6 | , | ||
"size_t" | |||
) |
Hist_Data Fill | ( | range. | begin(), |
range. | end() | ||
) |
std::cout<< "minimum: " << minimum_d << std::endl; std::cout << "-----------------------------------------" << std::endl; std::cout << "| GPU Time (ms) =" << elapsed_d.count() << std::endl; std::cout << "-----------------------------------------" << std::endl; hydra::DenseHistogram<double, 3, hydra::device::sys_t> Hist_Data | ( | {100, 100, 100} | , |
{min, min, min} | , | ||
{max, max, max } | |||
) |
cmd parse | ( | argv | , |
argc | |||
) |
GaussianZ_Handler wait | ( | ) |
double char** argc |
std::cout<< std::endl<< "Generated data:"<< std::endl; for (size_t i = 0; i < 10; i++) std::cout << "[" << i << "] :" << data_d[i] << std::endl; auto filter = hydra::wrap_lambda( [=] __hydra_dual__ ( _X x, _Y y, _Z z ){ bool decision = ((x > min) && (x < max ))&& ((y > min) && (y < max ))&& ((z > min) && (z < max )); return decision; }); auto range = hydra::filter(data_d, filter); std::cout << std::endl<< "Filtered data:" << std::endl; for (size_t i = 0; i < 10; i++) std::cout << "[" << i << "] :" << range.begin()[i] << std::endl; auto fcn = hydra::make_loglikehood_fcn( model, range); fcn.GetPDF().PrintRegisteredParameters(); ROOT::Minuit2::MnPrint::SetGlobalLevel(3); hydra::Print::SetLevel(hydra::WARNING); MnStrategy strategy(2); MnMigrad migrad_d(fcn, fcn.GetParameters().GetMnState(), strategy); std::cout << fcn.GetParameters().GetMnState() << std::endl; auto start_d = std::chrono::high_resolution_clock::now(); FunctionMinimum minimum_d = FunctionMinimum(migrad_d(5000, 5)); auto end_d = std::chrono::high_resolution_clock::now(); std::chrono::duration<double, std::milli> elapsed_d = end_d - start_d |
auto gaussian |
auto GaussianX_Handler |
auto GaussianY_Handler |
auto GaussianZ_Handler |
hydra::Plain<3, hydra::device::sys_t> Integrator({min, min, min},{ max, max, max }, 50000) |
double max = 6.0 |
double meanx = 0.0 |
hydra::Parameter meanx_p |
double meany = 0.0 |
hydra::Parameter meany_p |
double meanz = 0.0 |
hydra::Parameter meanz_p |
double min = -6.0 |
auto model = hydra::make_pdf(gaussian, Integrator) |
nentries = EArg.getValue() |
return |
double sigmax = 0.5 |
hydra::Parameter sigmax_p |
double sigmay = 1.5 |
hydra::Parameter sigmay_p |
double sigmaz = 1.0 |
hydra::Parameter sigmaz_p |
try |