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/DeltaDMassBackground.h>
#include <hydra/functions/GeneralizedGamma.h>
#include <hydra/Placeholders.h>
#include <hydra/GaussKronrodQuadrature.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 | PARTICLE_MASS_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 (true) |
Variables | |
auto | A1 = hydra::Parameter::Create("A1").Value( 0.55).Error(0.0001).Limits( 0.4, 0.6) |
auto | A2 = hydra::Parameter::Create("A2").Value(0.4).Error(0.0001).Limits( 0.3, 0.5) |
auto | alfa = hydra::Parameter::Create("alfa").Value(-1.1).Error(0.0001).Limits(-1.5, -0.5) |
char ** | argc |
auto | B1 = hydra::Parameter::Create("B1").Value( 0.067).Error(0.0001).Limits( 0.002, 0.1) |
auto | B2 = hydra::Parameter::Create("B2").Value(3.8).Error(0.0001).Limits( 1.0, 5.0) |
auto | beta = hydra::Parameter::Create("beta").Value(0.1).Error(0.0001).Limits(0.05, 0.5).Fixed() |
auto | C1 = hydra::Parameter::Create("C1").Value( 15.50).Error(0.0001).Limits( 10.0, 20.0) |
auto | C2 = hydra::Parameter::Create("C2").Value(0.85).Error(0.0001).Limits(0.5 , 1.0) |
auto | Combinatorial_Background_PDF |
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(1);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, 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(1.7).Error(0.0001).Limits(0.5, 2.6) |
auto | L2 = hydra::Parameter::Create("L2").Value(2.6).Error(0.0001).Limits(1.0, 3.5) |
auto | M0 = hydra::Parameter::Create("M0").Value(418.71).Error(0.0001).Limits(415.0, 421.0).Fixed() |
double | max = 550.0 |
double | min = 418.71 |
auto | model |
auto | mu = hydra::Parameter::Create("mu").Value(493.677).Error(0.0001).Limits(493.5, 493.7) |
auto | N1 = hydra::Parameter::Create("N1").Value(1.45).Error(0.0001).Limits(0.25, 2.7) |
auto | N2 = hydra::Parameter::Create("N2").Value(2.35).Error(0.0001).Limits(1.0, 3.5) |
hydra::Parameter | N_Combinatorial ("N_Combinatorial", 6000, 100, 100, nentries) |
hydra::Parameter | N_PartialRec ("N_PartialRec", 2000, 100, 100, nentries) |
hydra::Parameter | N_Signal ("N_Signal", 5000, 100, 100, nentries) |
nentries = EArg.getValue() | |
auto | PartialRec_Background_PDF |
auto | range = hydra::sample(data, min, max, model.GetFunctor()) |
return | |
auto | sigma = hydra::Parameter::Create("sigma").Value(3.5).Error(0.0001).Limits(2.0,5.0) |
auto | Signal_PDF |
try | |
#define PARTICLE_MASS_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 | ( | true | ) |
auto A1 = hydra::Parameter::Create("A1").Value( 0.55).Error(0.0001).Limits( 0.4, 0.6) |
auto A2 = hydra::Parameter::Create("A2").Value(0.4).Error(0.0001).Limits( 0.3, 0.5) |
auto alfa = hydra::Parameter::Create("alfa").Value(-1.1).Error(0.0001).Limits(-1.5, -0.5) |
auto B1 = hydra::Parameter::Create("B1").Value( 0.067).Error(0.0001).Limits( 0.002, 0.1) |
auto B2 = hydra::Parameter::Create("B2").Value(3.8).Error(0.0001).Limits( 1.0, 5.0) |
auto beta = hydra::Parameter::Create("beta").Value(0.1).Error(0.0001).Limits(0.05, 0.5).Fixed() |
auto C1 = hydra::Parameter::Create("C1").Value( 15.50).Error(0.0001).Limits( 10.0, 20.0) |
auto C2 = hydra::Parameter::Create("C2").Value(0.85).Error(0.0001).Limits(0.5 , 1.0) |
auto Combinatorial_Background_PDF |
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(1); 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, 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(1.7).Error(0.0001).Limits(0.5, 2.6) |
auto L2 = hydra::Parameter::Create("L2").Value(2.6).Error(0.0001).Limits(1.0, 3.5) |
auto M0 = hydra::Parameter::Create("M0").Value(418.71).Error(0.0001).Limits(415.0, 421.0).Fixed() |
double max = 550.0 |
double min = 418.71 |
auto model |
auto mu = hydra::Parameter::Create("mu").Value(493.677).Error(0.0001).Limits(493.5, 493.7) |
auto N1 = hydra::Parameter::Create("N1").Value(1.45).Error(0.0001).Limits(0.25, 2.7) |
auto N2 = hydra::Parameter::Create("N2").Value(2.35).Error(0.0001).Limits(1.0, 3.5) |
hydra::Parameter N_Combinatorial("N_Combinatorial",6000, 100, 100, nentries) |
hydra::Parameter N_PartialRec("N_PartialRec",2000, 100, 100, nentries) |
hydra::Parameter N_Signal("N_Signal",5000, 100, 100, nentries) |
nentries = EArg.getValue() |
auto PartialRec_Background_PDF |
auto range = hydra::sample(data, min, max, model.GetFunctor()) |
return |
auto sigma = hydra::Parameter::Create("sigma").Value(3.5).Error(0.0001).Limits(2.0,5.0) |
auto Signal_PDF |
try |