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

Go to the source code of this file.

Macros

#define BREIT_WIGNER_PLUS_CHEBYCHEV_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("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)
 

Macro Definition Documentation

◆ BREIT_WIGNER_PLUS_CHEBYCHEV_INL_

#define BREIT_WIGNER_PLUS_CHEBYCHEV_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_chebychev.inl:105

◆ Background_PDF

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

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

◆ c1

auto c1 = hydra::Parameter::Create("C_1").Value( 0.2).Error(0.0001).Limits( 0.1, 0.3)

◆ c2

auto c2 = hydra::Parameter::Create("C_2").Value( 0.1).Error(0.0001).Limits( 0.01, 0.2)

◆ c3

auto c3 = hydra::Parameter::Create("C_3").Value( 0.1).Error(0.0001).Limits( 0.01, 0.2)

◆ 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

double max = 15.0

◆ mean

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

◆ min

double min = 0.0

◆ 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

◆ return

return

◆ Signal_PDF

auto 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

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

◆ width