-
Notifications
You must be signed in to change notification settings - Fork 1
/
likelihood.cxx
35 lines (27 loc) · 872 Bytes
/
likelihood.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef LIKELIHOOD_CXX
#define LIKELIHOOD_CXX
#include "likelihood.h"
using namespace std;
/////////////////////////////////////////
//likelihood from tn186
double evalLnL(double ndata, double nmc, double norm){
if (nmc==0) return 0.;
if (ndata==0) return nmc*norm;
double Nmc = nmc*norm;
double ngLnL = (Nmc-ndata) + ndata*TMath::Log(ndata/Nmc);
return ngLnL;
}
/////////////////////////////////////////////////////////////////////////
// Gaussian with MC errors
double evalGausChi2WithError(double ndata, double mcmean, double mcsig){
double sigmasq = ndata + (mcsig*mcsig);
double diff = (ndata-mcmean);
return (diff*diff)/(2.*sigmasq);
}
////////////////////////////////////////////////////////////////
// standard chi2
double evalChi2(double ndata, double mcexpect){
double diff = (ndata-mcexpect);
return (diff*diff)/(2.*ndata);
}
#endif