Hydra  4.0.1
A header-only templated C++ framework to perform data analysis on massively parallel platforms.
breit_wigner_plus_polynomial.inl File Reference
#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"
Include dependency graph for breit_wigner_plus_polynomial.inl:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BREITWIGNER_PLUS_POLYNOMIAL_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.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_tHist_Data (100, min, max)
 
cmd parse (argv, argc)
 
model SetExtended (1)
 

Variables

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)
 

Macro Definition Documentation

◆ BREITWIGNER_PLUS_POLYNOMIAL_INL_

#define BREITWIGNER_PLUS_POLYNOMIAL_INL_

Function Documentation

◆ add()

cmd add ( EArg  )

◆ catch()

catch ( TCLAP::ArgException &  e)

◆ declarg()

declarg ( _X  ,
double   
)

◆ 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()

model SetExtended ( )

Variable Documentation

◆ argc

char** argc
Initial value:
{
size_t nentries = 0
nentries
Definition: breit_wigner_plus_polynomial.inl:110
Examples:
breit_wigner_plus_polynomial.inl.

◆ Background_PDF

auto Background_PDF
Initial value:
= hydra::make_pdf( hydra::Polynomial<2,_X>(std::array<hydra::Parameter,3>{c0, c1, c2}),
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

auto c0 = hydra::Parameter::Create().Name("C_0").Value( 1.0).Fixed()

◆ c1

auto c1 = hydra::Parameter::Create().Name("C_1").Value( 1.0).Error(0.0001).Limits( 0.1, 1.5)

◆ c2

auto c2 = hydra::Parameter::Create().Name("C_2").Value( 0.5).Error(0.0001).Limits( 0.0, 1.0)

◆ 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

hydra::Parameter mean = hydra::Parameter::Create().Name("Mean" ).Value(6.0).Error(0.0001).Limits(5.0,7.0)

◆ min

◆ model

◆ model_name

char const* model_name = "Breit-Wigner + Polynomial order 2"

◆ N_Background

hydra::Parameter N_Background("N_Background", 2000, 100, 100, nentries)

◆ N_Signal

hydra::Parameter N_Signal("N_Signal",500, 100, 100, nentries)

◆ nentries

nentries = EArg.getValue()

◆ range

auto range = hydra::sample(data, min, max, model.GetFunctor())

◆ return

return

◆ Signal_PDF

auto 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

try
Initial value:
{
TCLAP::CmdLine cmd("Command line arguments for ", '=')

◆ width

hydra::Parameter width = hydra::Parameter::Create().Name("Width").Value(0.5).Error(0.0001).Limits(0.3,1.0)