Markov Chain Monte Carlo simulator. More...
#include <mcmc.h>
| 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. | |
Markov Chain Monte Carlo simulator.
Given a set of signal PDFs and a dataset, random walk to map out the likelihood space.
| MCMC::MCMC | ( | const std::vector< Signal > & | signals, | |
| TNtuple * | data | |||
| ) | 
Constructor
| 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
| 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.
| signals | Signals defining the PDFs | |
| data | TNtuple defining the dataset | 
| 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
| 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.
| 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 | 
 1.6.3
 1.6.3