#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/Chebychev.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("C_0").Value( 1.0).Fixed() |
|
auto | c1 = hydra::Parameter::Create("C_1").Value( 0.2).Error(0.0001).Limits( 0.1, 0.3) |
|
auto | c2 = hydra::Parameter::Create("C_2").Value( 0.1).Error(0.0001).Limits( 0.01, 0.2) |
|
auto | c3 = hydra::Parameter::Create("C_3").Value( 0.1).Error(0.0001).Limits( 0.01, 0.2) |
|
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.begin(), range.end());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(5000, 5));auto end_d=std::chrono::high_resolution_clock::now();std::chrono::duration< double, std::milli > | elapsed_d = end_d - start_d |
|
double | max = 15.0 |
|
hydra::Parameter | mean = hydra::Parameter::Create().Name("Mean" ).Value(6.0).Error(0.0001).Limits(5.0,7.0) |
|
double | min = 0.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.begin(), data.end(), 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) |
|
◆ BREIT_WIGNER_PLUS_CHEBYCHEV_INL_
#define BREIT_WIGNER_PLUS_CHEBYCHEV_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
Initial value:{
nentries
Definition: breit_wigner_plus_chebychev.inl:105
◆ Background_PDF
Initial value:auto c2
Definition: breit_wigner_plus_chebychev.inl:135
auto c1
Definition: breit_wigner_plus_chebychev.inl:134
double max
Definition: breit_wigner_plus_chebychev.inl:116
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
The Chebyshev polynomials (first kind) are polynomials with the largest possible leading coefficient...
Definition: Chebychev.h:67
auto c0
Definition: breit_wigner_plus_chebychev.inl:133
double min
Definition: breit_wigner_plus_chebychev.inl:115
auto c3
Definition: breit_wigner_plus_chebychev.inl:136
Definition: AnalyticalIntegral.inl:39
- Examples:
- fit_convoluted_pdfs.inl.
◆ c0
◆ c1
◆ c2
◆ c3
◆ 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.begin(), range.end() ); 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(5000, 5)); 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:hydra::Parameter mean
Definition: breit_wigner_plus_chebychev.inl:123
double max
Definition: breit_wigner_plus_chebychev.inl:116
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
hydra::Parameter width
Definition: breit_wigner_plus_chebychev.inl:124
Definition: BreitWignerNR.h:56
double min
Definition: breit_wigner_plus_chebychev.inl:115
Definition: AnalyticalIntegral.inl:39
- Examples:
- fit_convoluted_pdfs.inl.
◆ try
Initial value:{
TCLAP::CmdLine cmd("Command line arguments for ", '=')
◆ width