NueFit2D.h File Reference

#include "TROOT.h"
#include "NueAna/MultiBinAna/Extrapolate2D.h"
#include "NueAna/MultiBinAna/ErrorCalc.h"
#include "TH2D.h"
#include "TH1D.h"
#include "TMath.h"
#include "TCanvas.h"
#include <vector>
#include "TMatrixD.h"
#include <string>
#include "TMinuit.h"
#include "TObject.h"
#include "TGraph.h"
#include "TGraph2D.h"
#include <iostream>
#include "TSystem.h"
#include "TRandom.h"
#include "TF1.h"
#include "TMatrixDEigen.h"

Go to the source code of this file.

Classes

class  NueFit2D

Functions

double Poisson (double mean, int n, bool numOnly=false)
double Gaussian (double x, double mean, double sig)

Function Documentation

double Gaussian ( double  x,
double  mean,
double  sig 
)

Definition at line 50 of file NueFit2D.cxx.

00051 { 
00052   double front = 1/TMath::Sqrt(2*3.1415926*sig);
00053   double exp = (x-mean)*(x-mean)/(2*sig);
00054   return front*TMath::Exp(-exp);
00055 } 

double Poisson ( double  mean,
int  n,
bool  numOnly = false 
)

Definition at line 31 of file NueFit2D.cxx.

00032 {
00033   double numerator = 1;
00034   if(mean > 100 || n > 100){
00035       // use roots protected function -
00036     if(!numOnly) return TMath::Poisson(n, mean);
00037 
00038       // else     pull a trick to prevent explosions
00039     double logN = n*TMath::Log(mean) - mean;
00040     numerator = TMath::Exp(logN);
00041   } 
00042   else{
00043     numerator = TMath::Power(mean,n)*TMath::Exp(-mean);   
00044   }
00045   double denom = 1.0;
00046   if(!numOnly) denom = TMath::Factorial(n);
00047   return numerator/denom;
00048 } 


Generated on 8 Jul 2019 for loon by  doxygen 1.6.1