laura is hosted by Hepforge, IPPP Durham
Laura++  v3r3
A maximum likelihood fitting package for performing Dalitz-plot analysis.

The master process for simultaneous/combined fits. More...

#include <LauSimFitMaster.hh>

Inheritance diagram for LauSimFitMaster:
LauFitObject

Public Member Functions

 LauSimFitMaster (UInt_t numSlaves, UInt_t port=9090)
 Constructor. More...
 
virtual ~LauSimFitMaster ()
 Destructor. More...
 
void runSimFit (const TString &fitNtupleFileName, const UInt_t nExp, const UInt_t firstExp=0, const Bool_t useAsymmErrors=kFALSE, const Bool_t doTwoStageFit=kFALSE)
 Run the fit. More...
 
virtual void withinAsymErrorCalc (const Bool_t inAsymErrCalc)
 Mark that the fit is calculating asymmetric errors. More...
 
virtual void setParsFromMinuit (Double_t *par, Int_t npar)
 This function sets the parameter values from Minuit. More...
 
virtual Double_t getTotNegLogLikelihood ()
 Calculate the new value of the negative log likelihood. More...
 
- Public Member Functions inherited from LauFitObject
virtual ~LauFitObject ()
 Destructor. More...
 
void useAsymmFitErrors (Bool_t useAsymmErrors)
 Turn on or off the computation of asymmetric errors (e.g. MINOS routine in Minuit) More...
 
Bool_t useAsymmFitErrors () const
 Report whether or not calculation of asymmetric errors is enabled. More...
 
void twoStageFit (Bool_t doTwoStageFit)
 Turn on or off the two stage fit. More...
 
Bool_t twoStageFit () const
 Report whether the two-stage fit is enabled. More...
 
Bool_t withinAsymErrorCalc () const
 Query whether the fit is calculating the asymmetric errors. More...
 
void setNExpts (UInt_t nExperiments, UInt_t firstExperiment=0)
 Set the number of experiments and the first experiment. More...
 
UInt_t eventsPerExpt () const
 Obtain the total number of events in the current experiment. More...
 
UInt_t nExpt () const
 Obtain the number of experiments. More...
 
UInt_t firstExpt () const
 Obtain the number of the first experiment. More...
 
UInt_t iExpt () const
 Obtain the number of the current experiment. More...
 
virtual void addConstraint (const TString &formula, const std::vector< TString > &pars, const Double_t mean, const Double_t width)
 Store constraint information for fit parameters. More...
 

Protected Member Functions

void printParInfo () const
 Print information on the parameters. More...
 
void initialise ()
 Initialise. More...
 
void initSockets ()
 Initialise socket connections for the slaves. More...
 
void getParametersFromSlaves ()
 Determine/update the parameter initial values from all slaves. More...
 
void getParametersFromSlavesFirstTime ()
 Determine the parameter names and initial values from all slaves. More...
 
void updateParametersFromSlaves ()
 Update and verify the parameter initial values from all slaves. More...
 
void checkParameter (const LauParameter *param, UInt_t index) const
 Check for compatibility between two same-named parameters, which should therefore be identical. More...
 
void addConParameters ()
 Add parameters to the list of Gaussian constrained parameters. More...
 
Double_t getLogLikelihoodPenalty ()
 Calculate the penalty terms to the log likelihood from Gaussian constraints. More...
 
Bool_t readData ()
 Instruct the slaves to read the input data for the given experiment. More...
 
Bool_t cacheInputData ()
 Instruct the slaves to perform the caching. More...
 
void fitExpt ()
 Perform the fit for the current experiment. More...
 
void checkInitFitParams ()
 Instruct the slaves to update the initial fit parameter values, if required. More...
 
Bool_t finalise ()
 Return the final parameters to the slaves and instruct them to perform their finalisation. More...
 
Bool_t writeOutResults ()
 Instruct the slaves to write out the fit results. More...
 
- Protected Member Functions inherited from LauFitObject
 LauFitObject ()
 Constructor. More...
 
const std::vector
< StoreConstraints > & 
constraintsStore () const
 Const access to the constraints store. More...
 
std::vector< StoreConstraints > & constraintsStore ()
 Access to the constraints store. More...
 
void resetFitCounters ()
 Reset the good/bad fit counters. More...
 
void setCurrentExperiment (const UInt_t curExpt)
 Set the ID of the current experiment. More...
 
void startNewFit (const UInt_t nPars, const UInt_t nFreePars)
 Indicate the start of a new fit. More...
 
void eventsPerExpt (UInt_t nEvents)
 Set the number of events in the current experiment. More...
 
Double_t worstLogLike () const
 Access the worst log likelihood found so far. More...
 
void worstLogLike (const Double_t newWorstLogLike)
 Set a new value for the worst log likelihood. More...
 
void storeFitStatus (const LauAbsFitter::FitStatus &status, const TMatrixD &covMatrix)
 Store fit status information. More...
 
UInt_t nTotParams () const
 Access the total number of fit parameters. More...
 
UInt_t nFreeParams () const
 Access the total number of fit parameters. More...
 
const LauAbsFitter::FitStatusfitStatus () const
 Access the fit status information. More...
 
Double_t nll () const
 Access the current NLL value. More...
 
Double_t edm () const
 Access the current EDM value. More...
 
Int_t statusCode () const
 Access the fit status code. More...
 
const TMatrixD & covarianceMatrix () const
 Access the fit covariance matrix. More...
 
UInt_t numberOKFits () const
 Access the number of successful fits. More...
 
UInt_t numberBadFits () const
 Access the number of failed fits. More...
 

Private Member Functions

 LauSimFitMaster (const LauSimFitMaster &rhs)
 Copy constructor (not implemented) More...
 
LauSimFitMasteroperator= (const LauSimFitMaster &rhs)
 Copy assignment operator (not implemented) More...
 
 ClassDef (LauSimFitMaster, 0)
 

Private Attributes

std::vector< StoreConstraints > storeCon_
 Store the constraints for fit parameters until initialisation is complete. More...
 
const UInt_t nSlaves_
 The number of slaves. More...
 
const UInt_t reqPort_
 The requested port. More...
 
std::vector< TMatrixD > covMatrices_
 The covariance sub-matrices for each slave. More...
 
TMonitor * socketMonitor_
 Parallel setup monitor. More...
 
std::vector< TSocket * > sSlaves_
 Sockets for each of the slaves. More...
 
std::vector< TMessage * > messagesToSlaves_
 Messages to slaves. More...
 
TMessage * messageFromSlave_
 Message from slaves to the master. More...
 
std::map< TString, UInt_t > parIndices_
 Map of parameter names to index in the values vector. More...
 
std::map< UInt_t, TString > parNames_
 Reverse map of index in the values vector to parameter names. More...
 
std::vector< LauParameter * > params_
 Parameters. More...
 
std::vector< LauAbsRValue * > conVars_
 Gaussian constraints. More...
 
std::vector< Double_t > parValues_
 Parameter values. More...
 
std::vector< std::vector
< UInt_t > > 
slaveIndices_
 Lists of indices for each slave. More...
 
std::vector< std::vector
< UInt_t > > 
slaveFreeIndices_
 Lists of indices of free parameters for each slave. More...
 
std::vector< Double_t * > vectorPar_
 Parameter values to send to the slaves. More...
 
std::vector< Double_t > vectorRes_
 Likelihood values returned from the slaves. More...
 
TStopwatch timer_
 The fit timer. More...
 
TStopwatch cumulTimer_
 The total fit timer. More...
 
LauFitNtuplefitNtuple_
 The fit results ntuple. More...
 

Detailed Description

The master process for simultaneous/combined fits.

Implementation of the JFit method described in arXiv:1409.5080 [physics.data-an].

This class acts as the interface between the slave processes and the minimiser.

Definition at line 43 of file LauSimFitMaster.hh.

Constructor & Destructor Documentation

LauSimFitMaster::LauSimFitMaster ( UInt_t  numSlaves,
UInt_t  port = 9090 
)

Constructor.

Parameters
[in]numSlavesthe number of slaves processes to expect connections from
[in]portthe port on which to listen for connections from the slaves

Definition at line 41 of file LauSimFitMaster.cc.

LauSimFitMaster::~LauSimFitMaster ( )
virtual

Destructor.

Definition at line 54 of file LauSimFitMaster.cc.

LauSimFitMaster::LauSimFitMaster ( const LauSimFitMaster rhs)
private

Copy constructor (not implemented)

Member Function Documentation

void LauSimFitMaster::addConParameters ( )
protected

Add parameters to the list of Gaussian constrained parameters.

Definition at line 777 of file LauSimFitMaster.cc.

Bool_t LauSimFitMaster::cacheInputData ( )
protected

Instruct the slaves to perform the caching.

Returns
success/failure of the caching operations

Definition at line 577 of file LauSimFitMaster.cc.

void LauSimFitMaster::checkInitFitParams ( )
protected

Instruct the slaves to update the initial fit parameter values, if required.

Definition at line 620 of file LauSimFitMaster.cc.

void LauSimFitMaster::checkParameter ( const LauParameter param,
UInt_t  index 
) const
protected

Check for compatibility between two same-named parameters, which should therefore be identical.

Definition at line 386 of file LauSimFitMaster.cc.

LauSimFitMaster::ClassDef ( LauSimFitMaster  ,
 
)
private
Bool_t LauSimFitMaster::finalise ( )
protected

Return the final parameters to the slaves and instruct them to perform their finalisation.

Definition at line 821 of file LauSimFitMaster.cc.

void LauSimFitMaster::fitExpt ( )
protected

Perform the fit for the current experiment.

Definition at line 626 of file LauSimFitMaster.cc.

Double_t LauSimFitMaster::getLogLikelihoodPenalty ( )
protected

Calculate the penalty terms to the log likelihood from Gaussian constraints.

Definition at line 761 of file LauSimFitMaster.cc.

void LauSimFitMaster::getParametersFromSlaves ( )
protected

Determine/update the parameter initial values from all slaves.

Definition at line 201 of file LauSimFitMaster.cc.

void LauSimFitMaster::getParametersFromSlavesFirstTime ( )
protected

Determine the parameter names and initial values from all slaves.

Definition at line 288 of file LauSimFitMaster.cc.

Double_t LauSimFitMaster::getTotNegLogLikelihood ( )
virtual

Calculate the new value of the negative log likelihood.

This function has to be public since it is called from the global FCN. It should not be called otherwise!

Implements LauFitObject.

Definition at line 696 of file LauSimFitMaster.cc.

void LauSimFitMaster::initialise ( )
protected

Initialise.

Definition at line 411 of file LauSimFitMaster.cc.

void LauSimFitMaster::initSockets ( )
protected

Initialise socket connections for the slaves.

Definition at line 99 of file LauSimFitMaster.cc.

LauSimFitMaster& LauSimFitMaster::operator= ( const LauSimFitMaster rhs)
private

Copy assignment operator (not implemented)

void LauSimFitMaster::printParInfo ( ) const
protected

Print information on the parameters.

Definition at line 363 of file LauSimFitMaster.cc.

Bool_t LauSimFitMaster::readData ( )
protected

Instruct the slaves to read the input data for the given experiment.

Returns
success/failure of the reading operations

Definition at line 530 of file LauSimFitMaster.cc.

void LauSimFitMaster::runSimFit ( const TString &  fitNtupleFileName,
const UInt_t  nExp,
const UInt_t  firstExp = 0,
const Bool_t  useAsymmErrors = kFALSE,
const Bool_t  doTwoStageFit = kFALSE 
)

Run the fit.

Parameters
[in]fitNtupleFileNamethe file to which the ntuple containing the fit results should be written
[in]nExpthe number of experiments to be fitted
[in]firstExpthe ID of the first experiment to be fitted
[in]useAsymmErrorsshould asymmetric errors be calculated or not
[in]doTwoStageFitshould the fit be performed in two stages or not

Definition at line 416 of file LauSimFitMaster.cc.

void LauSimFitMaster::setParsFromMinuit ( Double_t *  par,
Int_t  npar 
)
virtual

This function sets the parameter values from Minuit.

This function has to be public since it is called from the global FCN. It should not be called otherwise!

Parameters
[in]paran array storing the various parameter values
[in]nparthe number of free parameters

Implements LauFitObject.

Definition at line 666 of file LauSimFitMaster.cc.

void LauSimFitMaster::updateParametersFromSlaves ( )
protected

Update and verify the parameter initial values from all slaves.

Definition at line 218 of file LauSimFitMaster.cc.

void LauSimFitMaster::withinAsymErrorCalc ( const Bool_t  inAsymErrCalc)
virtual

Mark that the fit is calculating asymmetric errors.

This function has to be public since it is called by the fitter interface to mark when entering and exiting the asymmetric error calculation. It should not be called otherwise!

Parameters
[in]inAsymErrCalcboolean marking that the fit is calculating the asymmetric errors

Reimplemented from LauFitObject.

Definition at line 486 of file LauSimFitMaster.cc.

Bool_t LauSimFitMaster::writeOutResults ( )
protected

Instruct the slaves to write out the fit results.

Definition at line 989 of file LauSimFitMaster.cc.

Member Data Documentation

std::vector<LauAbsRValue*> LauSimFitMaster::conVars_
private

Gaussian constraints.

Definition at line 191 of file LauSimFitMaster.hh.

std::vector<TMatrixD> LauSimFitMaster::covMatrices_
private

The covariance sub-matrices for each slave.

Definition at line 167 of file LauSimFitMaster.hh.

TStopwatch LauSimFitMaster::cumulTimer_
private

The total fit timer.

Definition at line 212 of file LauSimFitMaster.hh.

LauFitNtuple* LauSimFitMaster::fitNtuple_
private

The fit results ntuple.

Definition at line 215 of file LauSimFitMaster.hh.

TMessage* LauSimFitMaster::messageFromSlave_
private

Message from slaves to the master.

Definition at line 179 of file LauSimFitMaster.hh.

std::vector<TMessage*> LauSimFitMaster::messagesToSlaves_
private

Messages to slaves.

Definition at line 176 of file LauSimFitMaster.hh.

const UInt_t LauSimFitMaster::nSlaves_
private

The number of slaves.

Definition at line 161 of file LauSimFitMaster.hh.

std::vector<LauParameter*> LauSimFitMaster::params_
private

Parameters.

Definition at line 188 of file LauSimFitMaster.hh.

std::map< TString, UInt_t > LauSimFitMaster::parIndices_
private

Map of parameter names to index in the values vector.

Definition at line 182 of file LauSimFitMaster.hh.

std::map< UInt_t, TString > LauSimFitMaster::parNames_
private

Reverse map of index in the values vector to parameter names.

Definition at line 185 of file LauSimFitMaster.hh.

std::vector<Double_t> LauSimFitMaster::parValues_
private

Parameter values.

Definition at line 194 of file LauSimFitMaster.hh.

const UInt_t LauSimFitMaster::reqPort_
private

The requested port.

Definition at line 164 of file LauSimFitMaster.hh.

std::vector< std::vector<UInt_t> > LauSimFitMaster::slaveFreeIndices_
private

Lists of indices of free parameters for each slave.

Definition at line 200 of file LauSimFitMaster.hh.

std::vector< std::vector<UInt_t> > LauSimFitMaster::slaveIndices_
private

Lists of indices for each slave.

Definition at line 197 of file LauSimFitMaster.hh.

TMonitor* LauSimFitMaster::socketMonitor_
private

Parallel setup monitor.

Definition at line 170 of file LauSimFitMaster.hh.

std::vector<TSocket*> LauSimFitMaster::sSlaves_
private

Sockets for each of the slaves.

Definition at line 173 of file LauSimFitMaster.hh.

std::vector<StoreConstraints> LauSimFitMaster::storeCon_
private

Store the constraints for fit parameters until initialisation is complete.

Definition at line 158 of file LauSimFitMaster.hh.

TStopwatch LauSimFitMaster::timer_
private

The fit timer.

Definition at line 209 of file LauSimFitMaster.hh.

std::vector<Double_t*> LauSimFitMaster::vectorPar_
private

Parameter values to send to the slaves.

Definition at line 203 of file LauSimFitMaster.hh.

std::vector<Double_t> LauSimFitMaster::vectorRes_
private

Likelihood values returned from the slaves.

Definition at line 206 of file LauSimFitMaster.hh.


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