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 <tclap/CmdLine.h>
#include <hydra/device/System.h>
#include <hydra/Function.h>
#include <hydra/Lambda.h>
#include <hydra/FunctorArithmetic.h>
#include <hydra/Random.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/DenseHistogram.h>
#include <hydra/functions/Ipatia.h>
#include <hydra/functions/ArgusShape.h>
#include <hydra/Placeholders.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.
Macros | |
#define | IPATIA_PLUS_ARGUS_INL_ |
Functions | |
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<< "| [Fit] 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) |
model | SetExtended (1) |
Variables | |
auto | alfa = hydra::Parameter::Create("alfa").Value(-6.5).Error(0.0001).Limits(-7.0, -6.0) |
char ** | argc |
auto | Background_PDF |
auto | beta = hydra::Parameter::Create("beta").Value(1.0).Error(0.0001).Limits(0.5, 1.5) |
std::cout<< std::endl<< "Generated data (10 first elements):"<< std::endl;for(size_t i=0;i< 10;i++) std::cout<< "["<< i<< "] :"<< range[i]<< std::endl;std::cout<< std::endl<< "Total dataset size :"<< range.size()<< std::endl;auto fcn=hydra::make_loglikehood_fcn(model, range);ROOT::Minuit2::MnPrint::SetGlobalLevel(3);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(500000, 50));auto end_d=std::chrono::high_resolution_clock::now();std::chrono::duration< double, std::milli > | elapsed_d = end_d - start_d |
auto | L1 = hydra::Parameter::Create("L1").Value(0.5).Error(0.0001).Limits(0.1, 1.0) |
auto | L2 = hydra::Parameter::Create("L2").Value(1.2).Error(0.0001).Limits(0.5, 1.5) |
auto | m0 = hydra::Parameter::Create("M0").Value(5.291).Error(0.0001).Limits(5.28, 5.3) |
double | max = 5.30 |
double | min = 5.20 |
auto | model = hydra::add_pdfs( {N_Signal, N_Background}, Signal_PDF, Background_PDF) |
auto | mu = hydra::Parameter::Create("mu").Value(5.28).Error(0.0001).Limits(5.27,5.29) |
auto | N1 = hydra::Parameter::Create("N1").Value(2.0).Error(0.0001).Limits(4.5, 6.5) |
auto | N2 = hydra::Parameter::Create("N2").Value(9.5).Error(0.0001).Limits(8.5, 10.5) |
hydra::Parameter | N_Background ("N_Background", 2000, 100, 100, nentries) |
hydra::Parameter | N_Signal ("N_Signal", 500, 100, 100, nentries) |
nentries = EArg.getValue() | |
auto | power = hydra::Parameter::Create("Power").Value(0.5).Fixed() |
auto | range = hydra::sample(data, min, max, model.GetFunctor()) |
return | |
auto | sigma = hydra::Parameter::Create("sigma").Value(0.0026).Error(0.0001).Limits(0.0020,0.0028) |
auto | Signal_PDF |
auto | slope = hydra::Parameter::Create("Slope").Value(-20.0).Error(0.0001).Limits(-30.0, -10.0) |
try | |
#define IPATIA_PLUS_ARGUS_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" | |||
) |
std::cout<< "Minimum: " << minimum_d << std::endl; std::cout << "-----------------------------------------"<<std::endl; std::cout << "| [Fit] 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 | |||
) |
model SetExtended | ( | 1 | ) |
auto alfa = hydra::Parameter::Create("alfa").Value(-6.5).Error(0.0001).Limits(-7.0, -6.0) |
auto Background_PDF |
auto beta = hydra::Parameter::Create("beta").Value(1.0).Error(0.0001).Limits(0.5, 1.5) |
std::cout<< std::endl<< "Generated data (10 first elements):"<< std::endl; for(size_t i=0; i< 10; i++) std::cout << "[" << i << "] :" << range[i] << std::endl; std::cout<< std::endl<< "Total dataset size :"<< range.size() << std::endl; auto fcn = hydra::make_loglikehood_fcn( model, range ); ROOT::Minuit2::MnPrint::SetGlobalLevel(3); 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(500000, 50)); auto end_d = std::chrono::high_resolution_clock::now(); std::chrono::duration<double, std::milli> elapsed_d = end_d - start_d |
auto L1 = hydra::Parameter::Create("L1").Value(0.5).Error(0.0001).Limits(0.1, 1.0) |
auto L2 = hydra::Parameter::Create("L2").Value(1.2).Error(0.0001).Limits(0.5, 1.5) |
auto m0 = hydra::Parameter::Create("M0").Value(5.291).Error(0.0001).Limits(5.28, 5.3) |
double max = 5.30 |
double min = 5.20 |
auto model = hydra::add_pdfs( {N_Signal, N_Background}, Signal_PDF, Background_PDF) |
auto mu = hydra::Parameter::Create("mu").Value(5.28).Error(0.0001).Limits(5.27,5.29) |
auto N1 = hydra::Parameter::Create("N1").Value(2.0).Error(0.0001).Limits(4.5, 6.5) |
auto N2 = hydra::Parameter::Create("N2").Value(9.5).Error(0.0001).Limits(8.5, 10.5) |
hydra::Parameter N_Background("N_Background", 2000, 100, 100, nentries) |
hydra::Parameter N_Signal("N_Signal",500, 100, 100, nentries) |
nentries = EArg.getValue() |
auto power = hydra::Parameter::Create("Power").Value(0.5).Fixed() |
auto range = hydra::sample(data, min, max, model.GetFunctor()) |
return |
auto sigma = hydra::Parameter::Create("sigma").Value(0.0026).Error(0.0001).Limits(0.0020,0.0028) |
auto Signal_PDF |
auto slope = hydra::Parameter::Create("Slope").Value(-20.0).Error(0.0001).Limits(-30.0, -10.0) |
try |