User Tools

Site Tools


software:analysis

Analysis tools

Novosibirsk function

The Novosibirsk function is typically used to fit monoenergetic electromagnetic calorimeter spectra. Explanations on this function are given here novosibirsk.pdf.

A C++ code snippet to calculate the function using ROOT classes is given below. The interface is chosen to be usable with the ROOT fitting routines, e.g. TH1::Fit(). It takes two arrays as input. From the first one only the first element is used as x, From the second array, the values of the fit parameters are taken.

#include "TMath.h" 

/*   p[0] = normalisation constant   
     p[1] = peak position   
     p[2] = sigma (energy  resolution)   
     p[3] = eta (asymmetry parameter)   
     p[4] = constant background  
*/ 
double novosibirsk(double *x, double *p) 
{   
   double xi=2.35482004503094933e+00;
   double Y=(x[0]-p[1])*p[3]/p[2];

   if(Y>=1) return p[4];

   double lnX = log( 1. - Y );   
   double s0  = 2/xi*TMath::ASinH(p[3]*xi*0.5);   
   double s02 = s0*s0;   
  
   double f = p[0]*exp ( -0.5/s02 * lnX*lnX - 0.5*s02) + p[4];     
   return f; 
} 
software/analysis.txt · Last modified: 2022/01/14 18:44 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki