MCMC Class Reference

Markov Chain Monte Carlo simulator. More...

#include <mcmc.h>

List of all members.

Public Member Functions

 MCMC (const std::vector< Signal > &signals, TNtuple *data)
 ~MCMC ()
TNtuple * operator() (unsigned nsteps, float burnin_fraction, unsigned sync_interval=1000)
hemi::Array< float > * build_lut (const std::vector< Signal > &signals, TNtuple *data)

Protected Member Functions

void nll (const float *v, double *nll, double *event_partial_sums, double *event_total_sum)

Private Attributes

unsigned nsignals
 number of signals
unsigned nevents
 number of events
unsigned nnllblocks
 number of cuda blocks for nll partial sums
unsigned nllblocksize
 size of cuda blocks for nll partial sums
unsigned nnllthreads
 number of threads for nll partial sums
unsigned nreducethreads
 number of threads to use in partial sum reduction kernel
unsigned blocksize
 size of blocks for per-signal kernels
unsigned nblocks
 number of blocks for per-signal kernels
std::string varlist
 string identifier list for ntuple indexing
hemi::Array< float > * expectations
 signal rate expectation values
hemi::Array< float > * constraints
 signal rate gaussian constraints
hemi::Array< float > * lut
 Event/PDF probability lookup table.
hemi::Array< RNGState > * rngs
 CURAND RNGs, ignored in CPU mode.

Detailed Description

Markov Chain Monte Carlo simulator.

Given a set of signal PDFs and a dataset, random walk to map out the likelihood space.


Constructor & Destructor Documentation

MCMC::MCMC ( const std::vector< Signal > &  signals,
TNtuple *  data 
)

Constructor

Parameters:
signals List of Signals defining the PDFs and expectations
data The dataset as a TNtuple with fields "e:r"
MCMC::~MCMC (  ) 

Destructor

Free HEMI arrays


Member Function Documentation

hemi::Array< float > * MCMC::build_lut ( const std::vector< Signal > &  signals,
TNtuple *  data 
)

Build Pj(xi) lookup table

Build a table with nevents rows and nsignals columns, containing the value of normalized PDF j evaluted at event i.

Parameters:
signals Signals defining the PDFs
data TNtuple defining the dataset
Returns:
HEMI array of probabilities, indexed as noted above
void MCMC::nll ( const float *  v,
double *  nll,
double *  event_partial_sums,
double *  event_total_sum 
) [protected]

Evaluate the NLL function

-logL = sum(Nj) + 1/2*sum((r-r')^2/s^2) - sum(log(sum(Nj*Pj(xi))))

Nothing is returned -- the output stays in the nll array, so it can stay on the device.

This is done in three steps, to support running on the GPU:

1. Compute partial sums of chunks of events for the last term 2. Total up partial sums from step 1 3. Add normalization and other constraints with sum from step 2

Parameters:
v Parameter vector at which to evaluate
nll Container for output NLL value
event_partial_sums Pre-allocated buffer for event term calculation
event_total_sum Pre-allocated buffer for event term total
TNtuple * MCMC::operator() ( unsigned  nsteps,
float  burnin_fraction,
unsigned  sync_interval = 1000 
)

Perform walk.

Parameters:
nsteps Number of random-walk steps to take
burnin_fraction Fraction of initial steps to throw out
sync_interval How often to copy accepted from GPU to storage
Returns:
TNtuple containing accepted points and their likelihoods

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs
Generated on Wed May 22 15:57:24 2013 for sxmc by  doxygen 1.6.3