PECalculator Class Reference

#include <PECalculator.h>

List of all members.

Public Member Functions

 PECalculator ()
float SimpleLnL (int npe1, int npe2)
double ProbPeExpect (int pe, int expect)

Private Member Functions

void initializePeExpect ()
void initializePe1Pe2 ()

Private Attributes

double _probPeExpect [INTEG_BINS][PE_BINS]
float _poisProbPe1Pe2 [PE_BINS][PE_BINS]

Detailed Description

Definition at line 22 of file PECalculator.h.


Constructor & Destructor Documentation

PECalculator::PECalculator (  ) 

Definition at line 8 of file PECalculator.cxx.

References _poisProbPe1Pe2, _probPeExpect, initializePe1Pe2(), initializePeExpect(), INTEG_BINS, and PE_BINS.

00009 {
00010 
00011   std::cout << " PE Calculator (v2).... " << std::endl;
00012   
00013   for(int j=0;j<PE_BINS;++j){
00014     for(int i=0;i<PE_BINS;++i){
00015       _poisProbPe1Pe2[i][j] = 0.0;
00016     }
00017     for(int k=0;k<INTEG_BINS;++k){
00018       _probPeExpect[k][j] = 0.0;
00019     }
00020   }
00021 
00022   std::cout << " Initializing Prob(PE;EXPECT) " << std::endl;
00023   initializePeExpect();
00024   std::cout << " Initializing Prob(PE1;PE2)   " << std::endl;
00025   initializePe1Pe2();
00026 
00027 }


Member Function Documentation

void PECalculator::initializePe1Pe2 (  )  [private]

Definition at line 57 of file PECalculator.cxx.

References _poisProbPe1Pe2, _probPeExpect, INTEG_BINS, INTEG_STEP, and PE_BINS.

Referenced by PECalculator().

00057                                    {
00058 
00059   for(int ni=0;ni<PE_BINS;++ni){
00060     for(int nj=0;nj<PE_BINS;++nj){
00061       double pmax = 0.0;
00062       for(int k=0;k<INTEG_BINS;++k){
00063         pmax += (_probPeExpect[k][ni]*_probPeExpect[k][nj])*INTEG_STEP;
00064       }
00065       if(pmax!=0){
00066         _poisProbPe1Pe2[ni][nj] = log(pmax);
00067       }else {
00068         _poisProbPe1Pe2[ni][nj] = -800;
00069       }//<--
00070     }
00071   }
00072 
00073   
00074 
00075   return;
00076 }

void PECalculator::initializePeExpect (  )  [private]

Definition at line 29 of file PECalculator.cxx.

References _probPeExpect, INTEG_BINS, INTEG_STEP, n, and PE_BINS.

Referenced by PECalculator().

00029                                      {
00030 
00031   // Calculate ln(Nfactorial) up front 
00032   double lnNfact[PE_BINS];
00033   lnNfact[0] = 0;
00034   for(int n=1;n<PE_BINS;++n){
00035     lnNfact[n]=lnNfact[n-1]+log((double)n);
00036   }
00037 
00038 
00039   // pure Poisson Probability
00040   for(int i=0;i<INTEG_BINS;++i){
00041     double expect = static_cast<float>((i)+0.5)*INTEG_STEP;
00042     double lnExpect = log(expect);
00043     // now loop over PEs
00044     for(int n=0;n<PE_BINS;++n){
00045       double dn = static_cast<double>(n);
00046       double lnPoissonProb = -expect+dn*lnExpect-lnNfact[n];
00047       double poissonProb = exp(lnPoissonProb);
00048       _probPeExpect[i][n]=poissonProb;
00049     }
00050   }
00051 
00052   return;
00053 
00054 }

double PECalculator::ProbPeExpect ( int  pe,
int  expect 
)

Definition at line 88 of file PECalculator.cxx.

References _probPeExpect.

00089 {
00090   return _probPeExpect[expect][pe];
00091 }

float PECalculator::SimpleLnL ( int  npe1,
int  npe2 
)

Definition at line 80 of file PECalculator.cxx.

References _poisProbPe1Pe2, and PE_BINS.

Referenced by MCNNRunner::CompareEventsBody().

00081 {
00082   float retval = -200.0;
00083   if(npe1>PE_BINS||npe2>PE_BINS)return retval;
00084   return _poisProbPe1Pe2[npe1][npe2];
00085 }


Member Data Documentation

Definition at line 33 of file PECalculator.h.

Referenced by initializePe1Pe2(), PECalculator(), and SimpleLnL().

Definition at line 32 of file PECalculator.h.

Referenced by initializePe1Pe2(), initializePeExpect(), PECalculator(), and ProbPeExpect().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1