#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/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/BreitWignerNR.h>
#include <hydra/functions/Polynomial.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.
|
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.begin(), range.end()) |
|
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) |
|
|
char ** | argc |
|
auto | Background_PDF |
|
auto | c0 = hydra::Parameter::Create().Name("C_0").Value( 1.0).Fixed() |
|
auto | c1 = hydra::Parameter::Create().Name("C_1").Value( 1.0).Error(0.0001).Limits( 0.1, 1.5) |
|
auto | c2 = hydra::Parameter::Create().Name("C_2").Value( 0.5).Error(0.0001).Limits( 0.0, 1.0) |
|
std::cout<< std::endl<< "Generated 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(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(50000, 1));auto end_d=std::chrono::high_resolution_clock::now();std::chrono::duration< double, std::milli > | elapsed_d = end_d - start_d |
|
double | max = 10.0 |
|
hydra::Parameter | mean = hydra::Parameter::Create().Name("Mean" ).Value(6.0).Error(0.0001).Limits(5.0,7.0) |
|
double | min = 2.0 |
|
auto | model = hydra::add_pdfs( {N_Signal, N_Background}, Signal_PDF, Background_PDF) |
|
char const * | model_name = "Breit-Wigner + Polynomial order 2" |
|
hydra::Parameter | N_Background ("N_Background", 2000, 100, 100, nentries) |
|
hydra::Parameter | N_Signal ("N_Signal", 500, 100, 100, nentries) |
|
| nentries = EArg.getValue() |
|
auto | range = hydra::sample(data, min, max, model.GetFunctor()) |
|
| return |
|
auto | Signal_PDF |
|
| try |
|
hydra::Parameter | width = hydra::Parameter::Create().Name("Width").Value(0.5).Error(0.0001).Limits(0.3,1.0) |
|
◆ BREITWIGNER_PLUS_POLYNOMIAL_INL_
#define BREITWIGNER_PLUS_POLYNOMIAL_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 Fill |
( |
range. |
begin(), |
|
|
range. |
end() |
|
) |
| |
◆ Hist_Data()
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 |
|
|
) |
| |
◆ parse()
cmd parse |
( |
argv |
, |
|
|
argc |
|
|
) |
| |
◆ SetExtended()
◆ argc
◆ Background_PDF
Initial value:double min
Definition: breit_wigner_plus_polynomial.inl:120
Pdf< FUNCTOR, INTEGRATOR > make_pdf(FUNCTOR const &functor, INTEGRATOR integrator)
Build a hydra::Pdf given a shape described by a functor and a integrator (algorithm or functor)...
Definition: Pdf.h:299
double max
Definition: breit_wigner_plus_polynomial.inl:121
From : https://en.wikipedia.org/wiki/Polynomial
Definition: Polynomial.h:80
auto c2
Definition: breit_wigner_plus_polynomial.inl:141
Definition: AnalyticalIntegral.inl:39
auto c1
Definition: breit_wigner_plus_polynomial.inl:140
auto c0
Definition: breit_wigner_plus_polynomial.inl:139
- Examples:
- breit_wigner_plus_polynomial.inl.
◆ c0
◆ c1
◆ c2
◆ elapsed_d
std::cout<< std::endl<< "Generated 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(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(50000, 1)); auto end_d = std::chrono::high_resolution_clock::now(); std::chrono::duration<double, std::milli> elapsed_d = end_d - start_d |
◆ max
◆ mean
◆ min
◆ model
◆ model_name
char const* model_name = "Breit-Wigner + Polynomial order 2" |
◆ N_Background
◆ N_Signal
◆ nentries
nentries = EArg.getValue() |
◆ range
◆ return
◆ Signal_PDF
Initial value:double min
Definition: breit_wigner_plus_polynomial.inl:120
Pdf< FUNCTOR, INTEGRATOR > make_pdf(FUNCTOR const &functor, INTEGRATOR integrator)
Build a hydra::Pdf given a shape described by a functor and a integrator (algorithm or functor)...
Definition: Pdf.h:299
double max
Definition: breit_wigner_plus_polynomial.inl:121
hydra::Parameter mean
Definition: breit_wigner_plus_polynomial.inl:129
Definition: BreitWignerNR.h:56
hydra::Parameter width
Definition: breit_wigner_plus_polynomial.inl:130
Definition: AnalyticalIntegral.inl:39
- Examples:
- breit_wigner_plus_polynomial.inl.
◆ try
Initial value:{
TCLAP::CmdLine cmd("Command line arguments for ", '=')
◆ width