#include <iostream>
#include <assert.h>
#include <time.h>
#include <chrono>
#include <tclap/CmdLine.h>
#include <hydra/device/System.h>
#include <hydra/Function.h>
#include <hydra/Lambda.h>
#include <hydra/Random.h>
#include <hydra/LogLikelihoodFCN.h>
#include <hydra/Parameter.h>
#include <hydra/UserParameters.h>
#include <hydra/Pdf.h>
#include <hydra/Filter.h>
#include <hydra/functions/Gaussian.h>
#include <hydra/DenseHistogram.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"
Go to the source code of this file.
|
cmd | add (EArg) |
|
| catch (TCLAP::ArgException &e) |
|
| declarg (_X, 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) |
|
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, 1, hydra::device::sys_t > | Hist_Data (100, min, max) |
|
cmd | parse (argv, argc) |
|
|
char ** | argc |
|
std::cout<< std::endl<< "Generated data:"<< std::endl;for(size_t i=0;i< 10;i++) std::cout<< "["<< i<< "] :"<< data[i]<< std::endl;auto filter=hydra::wrap_lambda([=] __hydra_dual__(_X x){ return(x > min) &&(x< max);});auto range=hydra::filter(data, filter);std::cout<< std::endl<< "Filtered data:"<< std::endl;for(size_t i=0;i< 10;i++) std::cout<< "["<< i<< "] :"<< range[i]<< std::endl;auto fcn=hydra::make_loglikehood_fcn(model, range);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(std::numeric_limits< unsigned int >::max(), 5));auto end_d=std::chrono::high_resolution_clock::now();std::chrono::duration< double, std::milli > | elapsed_d = end_d - start_d |
|
hydra::Gaussian< _X > | gaussian (mean_p, sigma_p) |
|
double | max = 5.0 |
|
double | mean = 0.0 |
|
hydra::Parameter | mean_p = hydra::Parameter::Create().Name("Mean").Value(0.5).Error(0.0001).Limits(-1.0, 1.0) |
|
double | min = -5.0 |
|
auto | model = hydra::make_pdf(gaussian, hydra::AnalyticalIntegral<hydra::Gaussian< _X>>(min, max) ) |
|
| nentries = EArg.getValue() |
|
| return |
|
double | sigma = 1.0 |
|
hydra::Parameter | sigma_p = hydra::Parameter::Create().Name("Sigma").Value(0.5).Error(0.0001).Limits(0.01, 1.5) |
|
| try |
|
◆ BASIC_FIT_RANGE_SEMANTICS_INL_
#define BASIC_FIT_RANGE_SEMANTICS_INL_ |
◆ add()
◆ catch()
catch |
( |
TCLAP::ArgException & |
e | ) |
|
◆ declarg()
◆ EArg()
TCLAP::ValueArg<size_t> EArg |
( |
"n" |
, |
|
|
"number-of-events" |
, |
|
|
"Number of events" |
, |
|
|
true |
, |
|
|
10e6 |
, |
|
|
"size_t" |
|
|
) |
| |
◆ Fill()
◆ Hist_Data()
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,1, hydra::device::sys_t> Hist_Data |
( |
100 |
, |
|
|
min |
, |
|
|
max |
|
|
) |
| |
◆ parse()
cmd parse |
( |
argv |
, |
|
|
argc |
|
|
) |
| |
◆ argc
◆ elapsed_d
◆ gaussian
◆ max
◆ mean
- Examples:
- adaptive_gauss_kronrod.inl, basic_fit_range_semantics.inl, convolute_functions.inl, fill_basic_distributions.inl, fit_convoluted_pdfs.inl, gauss_kronrod.inl, multidimensional_fit.inl, plain_mc.inl, pseudo_experiment.inl, sample_distribution.inl, simultaneous_fit.inl, and vegas.inl.
◆ mean_p
◆ min
◆ model
◆ nentries
nentries = EArg.getValue() |
◆ return
◆ sigma
◆ sigma_p
◆ try
Initial value:{
TCLAP::CmdLine cmd("Command line arguments for ", '=')