AtNuOscFitInterpolation Class Reference

#include <AtNuOscFitInterpolation.h>

List of all members.

Public Member Functions

 AtNuOscFitInterpolation ()
 ~AtNuOscFitInterpolation ()
void Interpolate (Double_t x, Double_t &m2, Double_t &m1, Double_t &nom, Double_t &p1, Double_t &p2)
void UseLinearInterpolation (Bool_t yesno=1)
void Debug (Bool_t debug=1)

Private Member Functions

void MyInterpolationDummy (Double_t x, Double_t &m2, Double_t &m1, Double_t &nom, Double_t &p1, Double_t &p2)
void MyInterpolationLinear (Double_t x, Double_t &m2, Double_t &m1, Double_t &nom, Double_t &p1, Double_t &p2)
void MyInterpolation (Double_t x, Double_t &m2, Double_t &m1, Double_t &nom, Double_t &p1, Double_t &p2)

Private Attributes

Bool_t fUseLinearInterpolation
Bool_t fDebug

Detailed Description

Definition at line 6 of file AtNuOscFitInterpolation.h.


Constructor & Destructor Documentation

AtNuOscFitInterpolation::AtNuOscFitInterpolation (  ) 

Definition at line 8 of file AtNuOscFitInterpolation.cxx.

00009 {
00010   fDebug = 0; 
00011 
00012   fUseLinearInterpolation = 0;
00013 }

AtNuOscFitInterpolation::~AtNuOscFitInterpolation (  ) 

Definition at line 15 of file AtNuOscFitInterpolation.cxx.

00016 {
00017 
00018 }


Member Function Documentation

void AtNuOscFitInterpolation::Debug ( Bool_t  debug = 1  )  [inline]

Definition at line 19 of file AtNuOscFitInterpolation.h.

References fDebug.

00019 { if( debug ) fDebug = debug; }

void AtNuOscFitInterpolation::Interpolate ( Double_t  x,
Double_t &  m2,
Double_t &  m1,
Double_t &  nom,
Double_t &  p1,
Double_t &  p2 
)

Definition at line 20 of file AtNuOscFitInterpolation.cxx.

References fUseLinearInterpolation, MyInterpolation(), and MyInterpolationLinear().

Referenced by AtNuOscFit::AddToExpectation().

00021 {
00022   if( fUseLinearInterpolation ){
00023     this->MyInterpolationLinear(x,m2,m1,nom,p1,p2);
00024   }
00025   else{
00026     this->MyInterpolation(x,m2,m1,nom,p1,p2);
00027   }
00028 }

void AtNuOscFitInterpolation::MyInterpolation ( Double_t  x,
Double_t &  m2,
Double_t &  m1,
Double_t &  nom,
Double_t &  p1,
Double_t &  p2 
) [private]

Definition at line 58 of file AtNuOscFitInterpolation.cxx.

References fDebug, and n.

Referenced by Interpolate().

00059 {
00060   Double_t weight = 1.0;
00061   Double_t dx = 1.0; 
00062 
00063   Double_t fW[5] = { 0.0, 0.0, 0.0, 0.0, 0.0 };
00064   Double_t fX[5] = { -2.0, -1.0, 0.0, +1.0, +2.0 };
00065 
00066   for( Int_t n=-1; n<5; n++ ){
00067     if( ( n==-1 && x<fX[0] )
00068      || ( n==+4 && x>=fX[4] )
00069      || ( n<4 && x>=fX[n] && x<fX[n+1] ) ){
00070 
00071       if( n>=0 && n<=3 
00072        && x>=fX[n] && x<fX[n+1] ){
00073         dx = fabs(fX[n+1]-fX[n]);
00074         weight = dx*dx*dx;
00075         fW[n]   += -weight*(x-fX[n+1])/(fX[n+1]-fX[n]);
00076         fW[n+1] += +weight*(x-fX[n])/(fX[n+1]-fX[n]);
00077       }
00078         
00079       if( n>=1 && n<=4 ){
00080         if( n<=3 ) dx = fabs(x-fX[n+1]);
00081         else dx = fabs(fX[n]-fX[n-1]);
00082         weight = dx*dx*dx; 
00083         fW[n-1] += -weight*(x-fX[n])/(fX[n]-fX[n-1]);
00084         fW[n]   += +weight*(x-fX[n-1])/(fX[n]-fX[n-1]);
00085       }
00086 
00087       if( n>=-1 && n<=2 ) {   
00088         if( n>=0 ) dx = fabs(x-fX[n]);
00089         else dx = fabs(fX[n+2]-fX[n+1]);
00090         weight = dx*dx*dx;
00091         fW[n+1] += -weight*(x-fX[n+2])/(fX[n+2]-fX[n+1]);
00092         fW[n+2] += +weight*(x-fX[n+1])/(fX[n+2]-fX[n+1]);
00093       }
00094     }
00095   }
00096       
00097   weight = 0.0;
00098      
00099   for( Int_t n=0; n<5; n++ ){
00100     weight += fW[n];
00101   }
00102 
00103   if( weight>0.0 ){
00104     for( Int_t n=0; n<5; n++ ){
00105       fW[n] /= weight;
00106     }
00107   }
00108   else{
00109     fW[2] = 1.0;
00110   }
00111 
00112   m2 = fW[0];
00113   m1 = fW[1];
00114   nom = fW[2];
00115   p1 = fW[3];
00116   p2 = fW[4];
00117 
00118   if( fDebug ){
00119     std::cout << " x=" << x << " w=[" << m2 << "|" << m1 << "|" << nom << "|" << p1 << "|" << p2 << "]" << std::endl;
00120   }
00121 
00122   return;
00123 }

void AtNuOscFitInterpolation::MyInterpolationDummy ( Double_t  x,
Double_t &  m2,
Double_t &  m1,
Double_t &  nom,
Double_t &  p1,
Double_t &  p2 
) [private]

Definition at line 30 of file AtNuOscFitInterpolation.cxx.

References fDebug.

00031 {
00032   m2 = 0.0;
00033   m1 = 0.0;
00034   nom = 1.0;
00035   p1 = 0.0;
00036   p2 = 0.0;
00037 
00038   if( fDebug ){
00039     std::cout << " x=" << x << " w=[" << m2 << "|" << m1 << "|" << nom << "|" << p1 << "|" << p2 << "]" << std::endl;
00040   }
00041 
00042   return;
00043 }

void AtNuOscFitInterpolation::MyInterpolationLinear ( Double_t  x,
Double_t &  m2,
Double_t &  m1,
Double_t &  nom,
Double_t &  p1,
Double_t &  p2 
) [private]

Definition at line 45 of file AtNuOscFitInterpolation.cxx.

Referenced by Interpolate().

00046 {
00047   Double_t alpha = 0.5;                  //  alpha = 0
00048 
00049   m2  = -0.5*x*alpha/(2.0*alpha+1.0);    //  0.0;        
00050   m1  = -0.5*x/(2.0*alpha+1.0);          // -0.5*x;
00051   nom = +1.0;                            //  1.0;
00052   p1  = +0.5*x/(2.0*alpha+1.0);          // +0.5*x;
00053   p2  = +0.5*x*alpha/(2.0*alpha+1.0);    //  0.0;
00054 
00055   return;
00056 }

void AtNuOscFitInterpolation::UseLinearInterpolation ( Bool_t  yesno = 1  )  [inline]

Definition at line 15 of file AtNuOscFitInterpolation.h.

References fUseLinearInterpolation.

Referenced by AtNuOscFit::UseLinearInterpolation().

00015                                                  {
00016     fUseLinearInterpolation = yesno;
00017   }


Member Data Documentation

Definition at line 31 of file AtNuOscFitInterpolation.h.

Referenced by Debug(), MyInterpolation(), and MyInterpolationDummy().

Definition at line 29 of file AtNuOscFitInterpolation.h.

Referenced by Interpolate(), and UseLinearInterpolation().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1