Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:26:11

0001 #include "SeedPtFunction.h"
0002 SeedPtFunction::SeedPtFunction(){
0003   
0004   
0005 }
0006 
0007 SeedPtFunction::~SeedPtFunction(){
0008  
0009 }
0010 
0011 Double_t SeedPtFunction::fitf(Double_t *x, Double_t *par) {
0012          Double_t theX = 10. + x[0];
0013          Double_t fitval =  par[0]
0014                          + (par[1]/  theX )
0015                          + (par[2]/ ( theX*theX ) )
0016                          + (par[3]/ ( theX*theX*theX ) ) ;
0017          return fitval;
0018 }
0019 
0020 Double_t SeedPtFunction::fitf2(Double_t *x, Double_t *par) {
0021          Double_t fitval =  par[0]
0022                          + (par[1] * x[0] )
0023                          + (par[2] / x[0] ) ;
0024          return fitval;
0025 }
0026 
0027 Double_t SeedPtFunction::linear(Double_t *x, Double_t *par) {
0028          Double_t fitval2 =  par[0]
0029                           + (par[1]* x[0] )
0030                           + (par[2]* x[0]*x[0]  )
0031                           + (par[3]* x[0]*x[0]*x[0] );
0032          return fitval2;
0033 }
0034 
0035 Double_t SeedPtFunction::fgaus(Double_t *x, Double_t *par) {
0036 
0037      Double_t gs_Value = TMath::Gaus(x[0],par[1],par[2]) ;
0038      Double_t fitV = par[0]*gs_Value ;
0039      return fitV;
0040 }
0041 
0042 // sigma : sigma of the data set w.r.t mean
0043 // deviation : the deviation of data and mean/prefit value
0044 bool SeedPtFunction::DataRejection(double sigma, double deviation, int N_data ) {
0045 
0046     bool reject = false ;
0047     /// gaussian probability for data point
0048     double p_gaus = 0.0;
0049     double k = 0.0;
0050     for (int i=0; i != 10000; i++ ) {
0051         k += ( deviation*0.0001) ;
0052         double n1 = 1.0/ (sigma*sqrt(2.0*3.14159)) ;
0053         double x2 = (-1.0*k*k)/(2.0*sigma*sigma) ;
0054         double gaus1 = n1*exp(x2);
0055         p_gaus += (gaus1*deviation*0.0001);
0056     }
0057     /// expected number outside the deviation of the distribution
0058     double nExpected = (1.0-(p_gaus*2.0))*(N_data*1.0);
0059 
0060     if ( nExpected < 0.99 ) reject = true;
0061 
0062     return reject;
0063 }