User Tools

Site Tools


software:analysis

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
software:analysis [2020/08/31 08:33] himusersoftware:analysis [2022/01/14 18:44] (current) – external edit 127.0.0.1
Line 4: Line 4:
  
 The Novosibirsk function is typically used to fit monoenergetic electromagnetic calorimeter spectra. The Novosibirsk function is typically used to fit monoenergetic electromagnetic calorimeter spectra.
- +Explanations on this function are given here {{ :software: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.1598862817.txt.gz · Last modified: (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki