Hydra  4.0.1
A header-only templated C++ framework to perform data analysis on massively parallel platforms.
crystal_ball_plus_exponential.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/DenseHistogram.h>
#include <hydra/functions/CrystalBallShape.h>
#include <hydra/functions/Exponential.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 crystal_ball_plus_exponential.inl:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CRYSTAL_BALL_PLUS_EXPONENTIAL_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

auto alpha = hydra::Parameter::Create().Name("Alpha").Value(-1.5).Error(0.0001).Limits(-1.6, 1.4)
 
char ** argc
 
auto Background_PDF
 
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(2);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 = 20.0
 
auto mean = hydra::Parameter::Create().Name("Mean").Value(0.0).Error(0.0001).Limits(-1.5, 1.5)
 
double min = -20.0
 
auto model = hydra::add_pdfs( {N_Signal, N_Background}, Signal_PDF, Background_PDF)
 
char const * model_name = "Crystal Ball + Exponential"
 
auto n = hydra::Parameter::Create().Name("N").Value(2.5).Error(0.0001).Limits(0.0, 5.0).Fixed()
 
hydra::Parameter N_Background ("N_Background", 2000, 1, 100, nentries)
 
hydra::Parameter N_Signal ("N_Signal", 2000, 1, 100, nentries)
 
 nentries = EArg.getValue()
 
auto range = hydra::sample(data, min, max, model.GetFunctor())
 
 return
 
auto sigma = hydra::Parameter::Create().Name("Sigma").Value(1.0).Error(0.0001).Limits(0.1, 2.5)
 
auto Signal_PDF
 
auto tau = hydra::Parameter::Create().Name("Tau").Value(-0.1).Error(0.0001).Limits(-1.0, 0.0)
 
 try
 

Macro Definition Documentation

◆ CRYSTAL_BALL_PLUS_EXPONENTIAL_INL_

#define CRYSTAL_BALL_PLUS_EXPONENTIAL_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

◆ alpha

auto alpha = hydra::Parameter::Create().Name("Alpha").Value(-1.5).Error(0.0001).Limits(-1.6, 1.4)

◆ argc

char** argc
Initial value:
{
size_t nentries = 0
nentries
Definition: crystal_ball_plus_exponential.inl:108
Examples:
crystal_ball_plus_exponential.inl.

◆ Background_PDF

auto Background_PDF
Initial value:
double min
Definition: crystal_ball_plus_exponential.inl:118
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
https://en.wikipedia.org/wiki/Exponential_function
Definition: Exponential.h:57
double max
Definition: crystal_ball_plus_exponential.inl:119
Definition: AnalyticalIntegral.inl:39
auto tau
Definition: crystal_ball_plus_exponential.inl:141
Examples:
crystal_ball_plus_exponential.inl.

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

auto mean = hydra::Parameter::Create().Name("Mean").Value(0.0).Error(0.0001).Limits(-1.5, 1.5)

◆ min

double min = -20.0

◆ model

◆ model_name

char const* model_name = "Crystal Ball + Exponential"

◆ n

auto n = hydra::Parameter::Create().Name("N").Value(2.5).Error(0.0001).Limits(0.0, 5.0).Fixed()

◆ N_Background

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

◆ N_Signal

hydra::Parameter N_Signal("N_Signal",2000, 1, 100, nentries)

◆ nentries

nentries = EArg.getValue()

◆ range

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

◆ return

return

◆ sigma

auto sigma = hydra::Parameter::Create().Name("Sigma").Value(1.0).Error(0.0001).Limits(0.1, 2.5)

◆ Signal_PDF

auto Signal_PDF
Initial value:
Implementation the Crystal Ball line shape.
Definition: CrystalBallShape.h:61
auto mean
Definition: crystal_ball_plus_exponential.inl:127
auto n
Definition: crystal_ball_plus_exponential.inl:131
double min
Definition: crystal_ball_plus_exponential.inl:118
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: crystal_ball_plus_exponential.inl:119
auto sigma
Definition: crystal_ball_plus_exponential.inl:128
Definition: AnalyticalIntegral.inl:39
auto alpha
Definition: crystal_ball_plus_exponential.inl:129
Examples:
crystal_ball_plus_exponential.inl.

◆ tau

auto tau = hydra::Parameter::Create().Name("Tau").Value(-0.1).Error(0.0001).Limits(-1.0, 0.0)

◆ try

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